@galacean/engine-spine 4.2.0-beta.1 → 4.2.0-beta.2

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 (55) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/main.js +1 -1
  3. package/dist/main.js.map +1 -1
  4. package/dist/miniprogram.js +1 -1
  5. package/dist/module.js +1 -1
  6. package/dist/module.js.map +1 -1
  7. package/package.json +3 -3
  8. package/types/loader/SpineResource.d.ts +32 -0
  9. package/types/spine-core/Animation.d.ts +378 -0
  10. package/types/spine-core/AnimationState.d.ts +365 -0
  11. package/types/spine-core/AnimationStateData.d.ts +23 -0
  12. package/types/spine-core/AssetManager.d.ts +36 -0
  13. package/types/spine-core/AtlasAttachmentLoader.d.ts +23 -0
  14. package/types/spine-core/BlendMode.d.ts +7 -0
  15. package/types/spine-core/Bone.d.ts +110 -0
  16. package/types/spine-core/BoneData.d.ts +44 -0
  17. package/types/spine-core/ConstraintData.d.ts +7 -0
  18. package/types/spine-core/Event.d.ts +16 -0
  19. package/types/spine-core/EventData.d.ts +13 -0
  20. package/types/spine-core/IkConstraint.d.ts +38 -0
  21. package/types/spine-core/IkConstraintData.d.ts +26 -0
  22. package/types/spine-core/PathConstraint.d.ts +46 -0
  23. package/types/spine-core/PathConstraintData.d.ts +52 -0
  24. package/types/spine-core/SharedAssetManager.d.ts +19 -0
  25. package/types/spine-core/Skeleton.d.ts +134 -0
  26. package/types/spine-core/SkeletonBinary.d.ts +49 -0
  27. package/types/spine-core/SkeletonBounds.d.ts +48 -0
  28. package/types/spine-core/SkeletonClipping.d.ts +22 -0
  29. package/types/spine-core/SkeletonData.d.ts +89 -0
  30. package/types/spine-core/SkeletonJson.d.ts +34 -0
  31. package/types/spine-core/Skin.d.ts +43 -0
  32. package/types/spine-core/Slot.d.ts +42 -0
  33. package/types/spine-core/SlotData.d.ts +23 -0
  34. package/types/spine-core/Texture.d.ts +43 -0
  35. package/types/spine-core/TextureAtlas.d.ts +30 -0
  36. package/types/spine-core/TransformConstraint.d.ts +36 -0
  37. package/types/spine-core/TransformConstraintData.d.ts +34 -0
  38. package/types/spine-core/Triangulator.d.ts +14 -0
  39. package/types/spine-core/Updatable.d.ts +9 -0
  40. package/types/spine-core/Utils.d.ts +124 -0
  41. package/types/spine-core/VertexEffect.d.ts +7 -0
  42. package/types/spine-core/attachments/Attachment.d.ts +43 -0
  43. package/types/spine-core/attachments/AttachmentLoader.d.ts +25 -0
  44. package/types/spine-core/attachments/AttachmentType.d.ts +9 -0
  45. package/types/spine-core/attachments/BoundingBoxAttachment.d.ts +12 -0
  46. package/types/spine-core/attachments/ClippingAttachment.d.ts +14 -0
  47. package/types/spine-core/attachments/MeshAttachment.d.ts +46 -0
  48. package/types/spine-core/attachments/PathAttachment.d.ts +19 -0
  49. package/types/spine-core/attachments/PointAttachment.d.ts +20 -0
  50. package/types/spine-core/attachments/RegionAttachment.d.ts +88 -0
  51. package/types/spine-core/index.d.ts +45 -0
  52. package/types/spine-core/polyfills.d.ts +1 -0
  53. package/types/spine-core/vertexeffects/JitterEffect.d.ts +11 -0
  54. package/types/spine-core/vertexeffects/SwirlEffect.d.ts +16 -0
  55. package/types/util/AttachmentTools.d.ts +3 -0
package/dist/main.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/engine");function s(t,e,s,r){var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,r);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(n<3?i(a):n>3?i(e,s,a):i(e,s))||a);return n>3&&a&&Object.defineProperty(e,s,a),a}"function"==typeof SuppressedError&&SuppressedError;class r{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class i{r;g;b;a;static WHITE=new i(1,1,1,1);static RED=new i(1,0,0,1);static GREEN=new i(0,1,0,1);static BLUE=new i(0,0,1,1);static MAGENTA=new i(1,0,1,1);constructor(t=0,e=0,s=0,r=0){this.r=t,this.g=e,this.b=s,this.a=r}set(t,e,s,r){return this.r=t,this.g=e,this.b=s,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,r){return this.r+=t,this.g+=e,this.b+=s,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(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new i).setFromString(t)}}class n{static PI=3.1415927;static PI2=2*n.PI;static invPI2=1/n.PI2;static radiansToDegrees=180/n.PI;static radDeg=n.radiansToDegrees;static degreesToRadians=n.PI/180;static degRad=n.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*n.degRad)}static sinDeg(t){return Math.sin(t*n.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*n.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}static randomTriangular(t,e){return n.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let r=Math.random(),i=e-t;return r<=(s-t)/i?t+Math.sqrt(r*i*(s-t)):e-Math.sqrt((1-r)*i*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}}class a{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class o extends a{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}class l{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,r,i){for(let n=e,a=r;n<e+i;n++,a++)s[a]=t[n]}static arrayFill(t,e,s,r){for(let i=e;i<s;i++)t[i]=r}static setArraySize(t,e,s=0){let r=t.length;if(r==e)return t;if(t.length=e,r<e)for(let i=r;i<e;i++)t[i]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:l.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e;return s}static newFloatArray(t){if(l.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static newShortArray(t){if(l.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static toFloatArray(t){return l.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return l.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class h{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}}class c{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}}class d{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class u extends d{static nextID=0;id=u.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,r,i,n){s=i+(s>>1)*n;let a=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let a=t.bone,h=a.worldX,c=a.worldY,d=a.a,u=a.b,p=a.c,m=a.d;for(let t=e,a=i;a<s;t+=2,a+=n){let e=l[t],s=l[t+1];r[a]=e*d+s*u+h,r[a+1]=e*p+s*m+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=a.bones;if(0==o.length)for(let t=i,e=3*d;t<s;t+=n){let s=0,i=0,n=h[c++];for(n+=c;c<n;c++,e+=3){let t=u[h[c]],r=l[e],n=l[e+1],a=l[e+2];s+=(r*t.a+n*t.b+t.worldX)*a,i+=(r*t.c+n*t.d+t.worldY)*a}r[t]=s,r[t+1]=i}else{let t=o;for(let e=i,a=3*d,o=d<<1;e<s;e+=n){let s=0,i=0,n=h[c++];for(n+=c;c<n;c++,a+=3,o+=2){let e=u[h[c]],r=l[a]+t[o],n=l[a+1]+t[o+1],d=l[a+2];s+=(r*e.a+n*e.b+e.worldX)*d,i+=(r*e.c+n*e.d+e.worldY)*d}r[e]=s,r[e+1]=i}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),l.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=l.newFloatArray(this.vertices.length),l.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class p{static _nextID=0;id=p.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new p(this.regions.length);return l.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let r=this.regions[s];e.region!=r&&(e.region=r,e.updateRegion())}getPath(t,e){let s=t,r=(this.start+e).toString();for(let t=this.digits-r.length;t>0;t--)s+="0";return s+=r,s}static nextID(){return p._nextID++}}!function(t){t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse"}(t||(t={}));const m=[t.hold,t.once,t.loop,t.pingpong,t.onceReverse,t.loopReverse,t.pingpongReverse];class f{name;timelines=[];timelineIds=new r;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,r,i,n,a,o){if(!t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let r=0,h=l.length;r<h;r++)l[r].apply(t,e,s,i,n,a,o)}}var g,x;exports.MixBlend=void 0,(g=exports.MixBlend||(exports.MixBlend={}))[g.setup=0]="setup",g[g.first=1]="first",g[g.replace=2]="replace",g[g.add=3]="add",exports.MixDirection=void 0,(x=exports.MixDirection||(exports.MixDirection={}))[x.mixIn=0]="mixIn",x[x.mixOut=1]="mixOut";const w={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};class b{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=l.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 r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let i=s;i<r;i+=s)if(t[i]>e)return i-s;return r-s}}class y extends b{curves;constructor(t,e,s){super(t,s),this.curves=l.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+18*t;if(this.curves.length>e){let t=l.newFloatArray(e);l.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,r,i,n,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let p=.03*(r-2*n+o),m=.03*(i-2*a+l),f=.006*(3*(n-o)-r+h),g=.006*(3*(a-l)-i+c),x=2*p+f,w=2*m+g,b=.3*(n-r)+p+.16666667*f,y=.3*(a-i)+m+.16666667*g,M=r+b,S=i+y;for(let t=u+18;u<t;u+=2)d[u]=M,d[u+1]=S,b+=x,y+=w,x+=f,w+=g,M+=b,S+=y}getBezierValue(t,e,s,r){let i=this.curves;if(i[r]>t){let n=this.frames[e],a=this.frames[e+s];return a+(t-n)/(i[r]-n)*(i[r+1]-a)}let n=r+18;for(r+=2;r<n;r+=2)if(i[r]>=t){let e=i[r-2],s=i[r-1];return s+(t-e)/(i[r]-e)*(i[r+1]-s)}e+=this.getFrameEntries();let a=i[n-2],o=i[n-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}}class M extends y{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 r=this.curves[s>>1];switch(r){case 0:let r=e[s],i=e[s+1];return i+(t-r)/(e[s+2]-r)*(e[s+2+1]-i);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}let n=this.getCurveValue(t);switch(s){case exports.MixBlend.setup:return i+n*e;case exports.MixBlend.first:case exports.MixBlend.replace:n+=i-r}return r+n*e}getAbsoluteValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}let n=this.getCurveValue(t);return s==exports.MixBlend.setup?i+(n-i)*e:r+(n-r)*e}getAbsoluteValue2(t,e,s,r,i,n){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}return s==exports.MixBlend.setup?i+(n-i)*e:r+(n-r)*e}getScaleValue(t,e,s,r,i,a){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return a;case exports.MixBlend.first:return i+(a-i)*e}return i}let o=this.getCurveValue(t)*a;if(1==e)return s==exports.MixBlend.add?i+o-a:o;if(r==exports.MixDirection.mixOut)switch(s){case exports.MixBlend.setup:return a+(Math.abs(o)*n.signum(a)-a)*e;case exports.MixBlend.first:case exports.MixBlend.replace:return i+(Math.abs(o)*n.signum(i)-i)*e}else{let t=0;switch(s){case exports.MixBlend.setup:return t=Math.abs(a)*n.signum(o),t+(o-t)*e;case exports.MixBlend.first:case exports.MixBlend.replace:return t=Math.abs(i)*n.signum(o),t+(o-t)*e}}return i+(o-a)*e}}class S extends y{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class v extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,i,n,o.rotation,o.data.rotation))}}class k extends S{boneIndex=0;constructor(t,e,s){super(t,e,w.x+"|"+s,w.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.setup:return o.x=o.data.x,void(o.y=o.data.y);case exports.MixBlend.first:o.x+=(o.data.x-o.x)*i,o.y+=(o.data.y-o.y)*i}return}let h=0,c=0,d=b.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(n){case exports.MixBlend.setup:o.x=o.data.x+h*i,o.y=o.data.y+c*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:o.x+=(o.data.x+h-o.x)*i,o.y+=(o.data.y+c-o.y)*i;break;case exports.MixBlend.add:o.x+=h*i,o.y+=c*i}}}class I extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,i,n,o.x,o.data.x))}}class A extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,i,n,o.y,o.data.y))}}class T extends S{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleX+"|"+s,w.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,o){let l=t.bones[this.boneIndex];if(!l.active)return;let h,c,d=this.frames;if(s<d[0]){switch(a){case exports.MixBlend.setup:return l.scaleX=l.data.scaleX,void(l.scaleY=l.data.scaleY);case exports.MixBlend.first:l.scaleX+=(l.data.scaleX-l.scaleX)*i,l.scaleY+=(l.data.scaleY-l.scaleY)*i}return}let u=b.search(d,s,3),p=this.curves[u/3];switch(p){case 0:let t=d[u];h=d[u+1],c=d[u+2];let e=(s-t)/(d[u+3]-t);h+=(d[u+3+1]-h)*e,c+=(d[u+3+2]-c)*e;break;case 1:h=d[u+1],c=d[u+2];break;default:h=this.getBezierValue(s,u,1,p-2),c=this.getBezierValue(s,u,2,p+18-2)}if(h*=l.data.scaleX,c*=l.data.scaleY,1==i)a==exports.MixBlend.add?(l.scaleX+=h-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=h,l.scaleY=c);else{let t=0,e=0;if(o==exports.MixDirection.mixOut)switch(a){case exports.MixBlend.setup:t=l.data.scaleX,e=l.data.scaleY,l.scaleX=t+(Math.abs(h)*n.signum(t)-t)*i,l.scaleY=e+(Math.abs(c)*n.signum(e)-e)*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(h)*n.signum(t)-t)*i,l.scaleY=e+(Math.abs(c)*n.signum(e)-e)*i;break;case exports.MixBlend.add:l.scaleX+=(h-l.data.scaleX)*i,l.scaleY+=(c-l.data.scaleY)*i}else switch(a){case exports.MixBlend.setup:t=Math.abs(l.data.scaleX)*n.signum(h),e=Math.abs(l.data.scaleY)*n.signum(c),l.scaleX=t+(h-t)*i,l.scaleY=e+(c-e)*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:t=Math.abs(l.scaleX)*n.signum(h),e=Math.abs(l.scaleY)*n.signum(c),l.scaleX=t+(h-t)*i,l.scaleY=e+(c-e)*i;break;case exports.MixBlend.add:l.scaleX+=(h-l.data.scaleX)*i,l.scaleY+=(c-l.data.scaleY)*i}}}}class B extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,i,n,a,o.scaleX,o.data.scaleX))}}class C extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,i,n,a,o.scaleY,o.data.scaleY))}}class F extends S{boneIndex=0;constructor(t,e,s){super(t,e,w.shearX+"|"+s,w.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case exports.MixBlend.first:o.shearX+=(o.data.shearX-o.shearX)*i,o.shearY+=(o.data.shearY-o.shearY)*i}return}let h=0,c=0,d=b.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(n){case exports.MixBlend.setup:o.shearX=o.data.shearX+h*i,o.shearY=o.data.shearY+c*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:o.shearX+=(o.data.shearX+h-o.shearX)*i,o.shearY+=(o.data.shearY+c-o.shearY)*i;break;case exports.MixBlend.add:o.shearX+=h*i,o.shearY+=c*i}}}class E extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,i,n,o.shearX,o.data.shearX))}}class R extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,i,n,o.shearY,o.data.shearY))}}class Y extends b{boneIndex=0;constructor(t,e){super(t,[w.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,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;s<l[0]?n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||(o.inherit=o.data.inherit):o.inherit=this.frames[b.search(l,s,2)+1]}}class P extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,i,n){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(n){case exports.MixBlend.setup:return void h.setFromColor(t);case exports.MixBlend.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i)}return}let c=0,d=0,u=0,p=0,m=b.search(l,s,5),f=this.curves[m/5];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3],p=l[m+4];let e=(s-t)/(l[m+5]-t);c+=(l[m+5+1]-c)*e,d+=(l[m+5+2]-d)*e,u+=(l[m+5+3]-u)*e,p+=(l[m+5+4]-p)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3],p=l[m+4];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2),p=this.getBezierValue(s,m,4,f+54-2)}1==i?h.set(c,d,u,p):(n==exports.MixBlend.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*i,(d-h.g)*i,(u-h.b)*i,(p-h.a)*i))}}class X extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(n){case exports.MixBlend.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case exports.MixBlend.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i}return}let c=0,d=0,u=0,p=b.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:let t=l[p];c=l[p+1],d=l[p+2],u=l[p+3];let e=(s-t)/(l[p+4]-t);c+=(l[p+4+1]-c)*e,d+=(l[p+4+2]-d)*e,u+=(l[p+4+3]-u)*e;break;case 1:c=l[p+1],d=l[p+2],u=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),u=this.getBezierValue(s,p,3,m+36-2)}if(1==i)h.r=c,h.g=d,h.b=u;else{if(n==exports.MixBlend.setup){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*i,h.g+=(d-h.g)*i,h.b+=(u-h.b)*i}}}class _ extends M{slotIndex=0;constructor(t,e,s){super(t,e,w.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.color;if(s<this.frames[0]){let t=o.data.color;switch(n){case exports.MixBlend.setup:return void(l.a=t.a);case exports.MixBlend.first:l.a+=(t.a-l.a)*i}return}let h=this.getCurveValue(s);1==i?l.a=h:(n==exports.MixBlend.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*i)}}class V extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.alpha+"|"+s,w.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,i,n,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(n){case exports.MixBlend.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case exports.MixBlend.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i),c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,p=0,m=0,f=0,g=0,x=0,w=b.search(l,s,8),y=this.curves[w>>3];switch(y){case 0:let t=l[w];d=l[w+1],u=l[w+2],p=l[w+3],m=l[w+4],f=l[w+5],g=l[w+6],x=l[w+7];let e=(s-t)/(l[w+8]-t);d+=(l[w+8+1]-d)*e,u+=(l[w+8+2]-u)*e,p+=(l[w+8+3]-p)*e,m+=(l[w+8+4]-m)*e,f+=(l[w+8+5]-f)*e,g+=(l[w+8+6]-g)*e,x+=(l[w+8+7]-x)*e;break;case 1:d=l[w+1],u=l[w+2],p=l[w+3],m=l[w+4],f=l[w+5],g=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,y-2),u=this.getBezierValue(s,w,2,y+18-2),p=this.getBezierValue(s,w,3,y+36-2),m=this.getBezierValue(s,w,4,y+54-2),f=this.getBezierValue(s,w,5,y+72-2),g=this.getBezierValue(s,w,6,y+90-2),x=this.getBezierValue(s,w,7,y+108-2)}if(1==i)h.set(d,u,p,m),c.r=f,c.g=g,c.b=x;else{if(n==exports.MixBlend.setup){h.setFromColor(o.data.color);let t=o.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b}h.add((d-h.r)*i,(u-h.g)*i,(p-h.b)*i,(m-h.a)*i),c.r+=(f-c.r)*i,c.g+=(g-c.g)*i,c.b+=(x-c.b)*i}}}class D extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,n,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(n){case exports.MixBlend.setup:return h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,void(c.b=e.b);case exports.MixBlend.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i,c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,p=0,m=0,f=0,g=0,x=b.search(l,s,7),w=this.curves[x/7];switch(w){case 0:let t=l[x];d=l[x+1],u=l[x+2],p=l[x+3],m=l[x+4],f=l[x+5],g=l[x+6];let e=(s-t)/(l[x+7]-t);d+=(l[x+7+1]-d)*e,u+=(l[x+7+2]-u)*e,p+=(l[x+7+3]-p)*e,m+=(l[x+7+4]-m)*e,f+=(l[x+7+5]-f)*e,g+=(l[x+7+6]-g)*e;break;case 1:d=l[x+1],u=l[x+2],p=l[x+3],m=l[x+4],f=l[x+5],g=l[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),p=this.getBezierValue(s,x,3,w+36-2),m=this.getBezierValue(s,x,4,w+54-2),f=this.getBezierValue(s,x,5,w+72-2),g=this.getBezierValue(s,x,6,w+90-2)}if(1==i)h.r=d,h.g=u,h.b=p,c.r=m,c.g=f,c.b=g;else{if(n==exports.MixBlend.setup){let t=o.data.color,e=o.data.darkColor;h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,c.b=e.b}h.r+=(d-h.r)*i,h.g+=(u-h.g)*i,h.b+=(p-h.b)*i,c.r+=(m-c.r)*i,c.g+=(f-c.g)*i,c.b+=(g-c.b)*i}}}class O extends b{slotIndex=0;attachmentNames;constructor(t,e){super(t,[w.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,r,i,n,a){let o=t.slots[this.slotIndex];o.bone.active&&(a!=exports.MixDirection.mixOut?s<this.frames[0]?n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[b.search1(this.frames,s)]):n==exports.MixBlend.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class N extends y{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[w.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,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,r,i,n,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let p=.03*(r-2*n+o),m=.03*l-.06*a,f=.006*(3*(n-o)-r+h),g=.018*(a-l+.33333333),x=2*p+f,w=2*m+g,b=.3*(n-r)+p+.16666667*f,y=.3*a+m+.16666667*g,M=r+b,S=y;for(let t=u+18;u<t;u+=2)d[u]=M,d[u+1]=S,b+=x,y+=w,x+=f,w+=g,M+=b,S+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(r-=2,s[r]>t){let i=this.frames[e];return s[r+1]*(t-i)/(s[r]-i)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=t){let e=s[r-2],i=s[r-1];return i+(t-e)/(s[r]-e)*(s[r+1]-i)}let n=s[i-2],a=s[i-1];return a+(1-a)*(t-n)/(this.frames[e+this.getFrameEntries()]-n)}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let h=o.getAttachment();if(!h)return;if(!(h instanceof u)||h.timelineAttachment!=this.attachment)return;let c=o.deform;0==c.length&&(n=exports.MixBlend.setup);let d=this.vertices,p=d[0].length,m=this.frames;if(s<m[0]){switch(n){case exports.MixBlend.setup:return void(c.length=0);case exports.MixBlend.first:if(1==i)return void(c.length=0);c.length=p;let t=h;if(t.bones){i=1-i;for(f=0;f<p;f++)c[f]*=i}else{let e=t.vertices;for(var f=0;f<p;f++)c[f]+=(e[f]-c[f])*i}}return}if(c.length=p,s>=m[m.length-1]){let t=d[m.length-1];if(1==i)if(n==exports.MixBlend.add){let e=h;if(e.bones)for(let e=0;e<p;e++)c[e]+=t[e];else{let s=e.vertices;for(let e=0;e<p;e++)c[e]+=t[e]-s[e]}}else l.arrayCopy(t,0,c,0,p);else switch(n){case exports.MixBlend.setup:{let e=h;if(e.bones)for(let e=0;e<p;e++)c[e]=t[e]*i;else{let s=e.vertices;for(let e=0;e<p;e++){let r=s[e];c[e]=r+(t[e]-r)*i}}break}case exports.MixBlend.first:case exports.MixBlend.replace:for(let e=0;e<p;e++)c[e]+=(t[e]-c[e])*i;break;case exports.MixBlend.add:let e=h;if(e.bones)for(let e=0;e<p;e++)c[e]+=t[e]*i;else{let s=e.vertices;for(let e=0;e<p;e++)c[e]+=(t[e]-s[e])*i}}return}let g=b.search1(m,s),x=this.getCurvePercent(s,g),w=d[g],y=d[g+1];if(1==i)if(n==exports.MixBlend.add){let t=h;if(t.bones)for(let t=0;t<p;t++){let e=w[t];c[t]+=e+(y[t]-e)*x}else{let e=t.vertices;for(let t=0;t<p;t++){let s=w[t];c[t]+=s+(y[t]-s)*x-e[t]}}}else for(let t=0;t<p;t++){let e=w[t];c[t]=e+(y[t]-e)*x}else switch(n){case exports.MixBlend.setup:{let t=h;if(t.bones)for(let t=0;t<p;t++){let e=w[t];c[t]=(e+(y[t]-e)*x)*i}else{let e=t.vertices;for(let t=0;t<p;t++){let s=w[t],r=e[t];c[t]=r+(s+(y[t]-s)*x-r)*i}}break}case exports.MixBlend.first:case exports.MixBlend.replace:for(let t=0;t<p;t++){let e=w[t];c[t]+=(e+(y[t]-e)*x-c[t])*i}break;case exports.MixBlend.add:let t=h;if(t.bones)for(let t=0;t<p;t++){let e=w[t];c[t]+=(e+(y[t]-e)*x)*i}else{let e=t.vertices;for(let t=0;t<p;t++){let s=w[t];c[t]+=(s+(y[t]-s)*x-e[t])*i}}}}}class L extends b{static propertyIds=[""+w.event];events;constructor(t){super(t,L.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,i,n,a){if(!r)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,i,n,a),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let h=0;if(e<o[0])h=0;else{h=b.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)r.push(this.events[h])}}class q extends b{static propertyIds=[""+w.drawOrder];drawOrders;constructor(t){super(t,q.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,i,n,a){if(a==exports.MixDirection.mixOut)return void(n==exports.MixBlend.setup&&l.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||l.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=b.search1(this.frames,s),h=this.drawOrders[o];if(h){let e=t.drawOrder,s=t.slots;for(let t=0,r=h.length;t<r;t++)e[t]=s[h[t]]}else l.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}}class U extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,i,n,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,r,i,n,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.setup:return o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,void(o.stretch=o.data.stretch);case exports.MixBlend.first:o.mix+=(o.data.mix-o.mix)*i,o.softness+=(o.data.softness-o.softness)*i,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=b.search(l,s,6),u=this.curves[d/6];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+6]-t);h+=(l[d+6+1]-h)*e,c+=(l[d+6+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}n==exports.MixBlend.setup?(o.mix=o.data.mix+(h-o.data.mix)*i,o.softness=o.data.softness+(c-o.data.softness)*i,a==exports.MixDirection.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5])):(o.mix+=(h-o.mix)*i,o.softness+=(c-o.softness)*i,a==exports.MixDirection.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}}class W extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,n,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=r,l[t+3]=i,l[t+4]=n,l[t+5]=a,l[t+6]=o}apply(t,e,s,r,i,n,a){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,p,m=this.frames;if(s<m[0]){let t=o.data;switch(n){case exports.MixBlend.setup:return o.mixRotate=t.mixRotate,o.mixX=t.mixX,o.mixY=t.mixY,o.mixScaleX=t.mixScaleX,o.mixScaleY=t.mixScaleY,void(o.mixShearY=t.mixShearY);case exports.MixBlend.first:o.mixRotate+=(t.mixRotate-o.mixRotate)*i,o.mixX+=(t.mixX-o.mixX)*i,o.mixY+=(t.mixY-o.mixY)*i,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*i,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*i,o.mixShearY+=(t.mixShearY-o.mixShearY)*i}return}let f=b.search(m,s,7),g=this.curves[f/7];switch(g){case 0:let t=m[f];l=m[f+1],h=m[f+2],c=m[f+3],d=m[f+4],u=m[f+5],p=m[f+6];let e=(s-t)/(m[f+7]-t);l+=(m[f+7+1]-l)*e,h+=(m[f+7+2]-h)*e,c+=(m[f+7+3]-c)*e,d+=(m[f+7+4]-d)*e,u+=(m[f+7+5]-u)*e,p+=(m[f+7+6]-p)*e;break;case 1:l=m[f+1],h=m[f+2],c=m[f+3],d=m[f+4],u=m[f+5],p=m[f+6];break;default:l=this.getBezierValue(s,f,1,g-2),h=this.getBezierValue(s,f,2,g+18-2),c=this.getBezierValue(s,f,3,g+36-2),d=this.getBezierValue(s,f,4,g+54-2),u=this.getBezierValue(s,f,5,g+72-2),p=this.getBezierValue(s,f,6,g+90-2)}if(n==exports.MixBlend.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*i,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*i,o.mixShearY=t.mixShearY+(p-t.mixShearY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i,o.mixScaleX+=(d-o.mixScaleX)*i,o.mixScaleY+=(u-o.mixScaleY)*i,o.mixShearY+=(p-o.mixShearY)*i}}class z extends M{constraintIndex=0;constructor(t,e,s){super(t,e,w.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,i,n,o.position,o.data.position))}}class G extends M{constraintIndex=0;constructor(t,e,s){super(t,e,w.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,i,n,o.spacing,o.data.spacing))}}class $ extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){let n=this.frames;n[t<<=2]=e,n[t+1]=s,n[t+2]=r,n[t+3]=i}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(n){case exports.MixBlend.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case exports.MixBlend.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*i,o.mixX+=(o.data.mixX-o.mixX)*i,o.mixY+=(o.data.mixY-o.mixY)*i}return}let u=b.search(d,s,4),p=this.curves[u>>2];switch(p){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,p-2),h=this.getBezierValue(s,u,2,p+18-2),c=this.getBezierValue(s,u,3,p+36-2)}if(n==exports.MixBlend.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i}}class j extends M{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const r of t.physicsConstraints)r.active&&this.global(r.data)&&this.set(r,this.getAbsoluteValue2(s,i,n,this.get(r),this.setup(r),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,i,n,this.get(o),this.setup(o)))}}class H extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class J extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class K extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Q extends j{constructor(t,e,s){super(t,e,s,w.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}}class Z extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class tt extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class et extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class st extends b{static propertyIds=[w.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,st.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,r,i,n,a){let o;if(-1!=this.constraintIndex&&(o=t.physicsConstraints[this.constraintIndex],!o.active))return;const l=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],i,n,a),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[b.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}}class rt extends b{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[w.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return rt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,r,i){let n=this.frames;n[t*=rt.ENTRIES]=e,n[t+rt.MODE]=s|r<<4,n[t+rt.DELAY]=i}apply(e,s,r,i,n,a,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=l.attachment,c=this.attachment;if(!(h==c||h instanceof u&&h.timelineAttachment==c))return;let d=this.frames;if(r<d[0])return void(a!=exports.MixBlend.setup&&a!=exports.MixBlend.first||(l.sequenceIndex=-1));let p=b.search(d,r,rt.ENTRIES),f=d[p],g=d[p+rt.MODE],x=d[p+rt.DELAY];if(!this.attachment.sequence)return;let w=g>>4,y=this.attachment.sequence.regions.length,M=m[15&g];if(M!=t.hold)switch(w+=(r-f)/x+1e-5|0,M){case t.once:w=Math.min(y-1,w);break;case t.loop:w%=y;break;case t.pingpong:{let t=(y<<1)-2;w=0==t?0:w%t,w>=y&&(w=t-w);break}case t.onceReverse:w=Math.max(y-1-w,0);break;case t.loopReverse:w=y-1-w%y;break;case t.pingpongReverse:{let t=(y<<1)-2;w=0==t?0:(w+y-1)%t,w>=y&&(w=t-w)}}l.sequenceIndex=w}}class it{static _emptyAnimation=new f("<empty>",[],0);static emptyAnimation(){return it._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new at(this);propertyIDs=new r;animationsChanged=!1;trackEntryPool=new h((()=>new nt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let i=t*r.timeScale;if(r.delay>0){if(r.delay-=i,r.delay>0)continue;i=-r.delay,r.delay=0}let n=r.next;if(n){let e=r.trackLast-n.delay;if(e>=0){for(n.delay=0,n.trackTime+=0==r.timeScale?0:(e/r.timeScale+t)*n.timeScale,r.trackTime+=i,this.setCurrent(s,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){e[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let t=r.mixingFrom;for(r.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}r.trackTime+=i}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let r=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,r=!1;for(let n=0,a=s.length;n<a;n++){let a=s[n];if(!a||a.delay>0)continue;r=!0;let o=0==n?exports.MixBlend.first:a.mixBlend,h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let c=h>=a.alphaAttachmentThreshold,d=a.animationLast,u=a.getAnimationTime(),p=u,m=e;a.reverse&&(p=a.animation.duration-p,m=null);let f=a.animation.timelines,g=f.length;if(0==n&&1==h||o==exports.MixBlend.add){0==n&&(c=!0);for(let e=0;e<g;e++){l.webkit602BugfixHelper(h,o);var i=f[e];i instanceof O?this.applyAttachmentTimeline(i,t,p,o,c):i.apply(t,d,p,m,h,o,exports.MixDirection.mixIn)}}else{let e=a.timelineMode,s=a.shortestRotation,r=!s&&a.timelinesRotation.length!=g<<1;r&&(a.timelinesRotation.length=g<<1);for(let i=0;i<g;i++){let n=f[i],u=e[i]==lt?o:exports.MixBlend.setup;!s&&n instanceof v?this.applyRotateTimeline(n,t,p,h,u,a.timelinesRotation,i<<1,r):n instanceof O?this.applyAttachmentTimeline(n,t,p,o,c):(l.webkit602BugfixHelper(h,o),n.apply(t,d,p,m,h,u,exports.MixDirection.mixIn))}}this.queueEvents(a,u),e.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime}for(var n=this.unkeyedState+pt,a=t.slots,o=0,h=t.slots.length;o<h;o++){var c=a[o];if(c.attachmentState==n){var d=c.data.attachmentName;c.setAttachment(d?t.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e,s){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,e,s);let i=0;0==t.mixDuration?(i=1,s==exports.MixBlend.first&&(s=exports.MixBlend.setup)):(i=t.mixTime/t.mixDuration,i>1&&(i=1),s!=exports.MixBlend.first&&(s=r.mixBlend));let n=i<r.mixAttachmentThreshold,a=i<r.mixDrawOrderThreshold,o=r.animation.timelines,h=o.length,c=r.alpha*t.interruptAlpha,d=c*(1-i),u=r.animationLast,p=r.getAnimationTime(),m=p,f=null;if(r.reverse?m=r.animation.duration-m:i<r.eventThreshold&&(f=this.events),s==exports.MixBlend.add)for(let t=0;t<h;t++)o[t].apply(e,u,m,f,d,s,exports.MixDirection.mixOut);else{let t=r.timelineMode,i=r.timelineHoldMix,p=r.shortestRotation,g=!p&&r.timelinesRotation.length!=h<<1;g&&(r.timelinesRotation.length=h<<1),r.totalAlpha=0;for(let x=0;x<h;x++){let h,w=o[x],b=exports.MixDirection.mixOut,y=0;switch(t[x]){case lt:if(!a&&w instanceof q)continue;h=s,y=d;break;case ht:h=exports.MixBlend.setup,y=d;break;case ct:h=s,y=c;break;case dt:h=exports.MixBlend.setup,y=c;break;default:h=exports.MixBlend.setup;let t=i[x];y=c*Math.max(0,1-t.mixTime/t.mixDuration)}r.totalAlpha+=y,!p&&w instanceof v?this.applyRotateTimeline(w,e,m,y,h,r.timelinesRotation,x<<1,g):w instanceof O?this.applyAttachmentTimeline(w,e,m,h,n&&y>=r.alphaAttachmentThreshold):(l.webkit602BugfixHelper(y,s),a&&w instanceof q&&h==exports.MixBlend.setup&&(b=exports.MixDirection.mixIn),w.apply(e,u,m,f,y,h,b))}}return t.mixDuration>0&&this.queueEvents(r,p),this.events.length=0,r.nextAnimationLast=p,r.nextTrackLast=r.trackTime,i}applyAttachmentTimeline(t,e,s,r,i){var n=e.slots[t.slotIndex];n.bone.active&&(s<t.frames[0]?r!=exports.MixBlend.setup&&r!=exports.MixBlend.first||this.setAttachment(e,n,n.data.attachmentName,i):this.setAttachment(e,n,t.attachmentNames[b.search1(t.frames,s)],i),n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+pt))}setAttachment(t,e,s,r){e.setAttachment(s?t.getAttachment(e.data.index,s):null),r&&(e.attachmentState=this.unkeyedState+mt)}applyRotateTimeline(t,e,s,r,i,a,o,l){if(l&&(a[o]=0),1==r)return void t.apply(e,0,s,null,1,i,exports.MixDirection.mixIn);let h=e.bones[t.boneIndex];if(!h.active)return;let c=0,d=0;if(s<t.frames[0])switch(i){case exports.MixBlend.setup:h.rotation=h.data.rotation;default:return;case exports.MixBlend.first:c=h.rotation,d=h.data.rotation}else c=i==exports.MixBlend.setup?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(s);let u=0,p=d-c;if(p-=360*Math.ceil(p/360-.5),0==p)u=a[o];else{let t=0,e=0;l?(t=0,e=p):(t=a[o],e=a[o+1]);let s=t-t%360;u=p+s;let r=p>=0,i=t>=0;Math.abs(e)<=90&&n.signum(e)!=n.signum(p)&&(Math.abs(t-s)>180?(u+=360*n.signum(t),i=r):0!=s?u-=360*n.signum(t):i=r),i!=r&&(u+=360*n.signum(t)),a[o]=u}a[o+1]=p,h.rotation=c+u*r}queueEvents(t,e){let s=t.animationStart,r=t.animationEnd,i=r-s,n=t.trackLast%i,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<n)break;e.time>r||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==i)h=!0;else{const e=Math.floor(t.trackTime/i);h=e>0&&e>Math.floor(t.trackLast/i)}else h=e>=r&&t.animationLast<r;for(h&&this.queue.complete(t);o<l;o++){let e=a[o];e.time<s||this.queue.event(t,e)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){let t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(s&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let r=!0,i=this.expandToIndex(t);i&&(-1==i.nextTrackLast?(this.tracks[t]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,r=!1):this.clearNext(i));let n=this.trackEntry(t,e,s,i);return this.setCurrent(t,n,r),this.queue.drain(),n}addAnimation(t,e,s=!1,r=0){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,i,s,r)}addAnimationWith(t,e,s=!1,r=0){if(!e)throw new Error("animation cannot be null.");let i=this.expandToIndex(t);if(i)for(;i.next;)i=i.next;let n=this.trackEntry(t,e,s,i);return i?(i.next=n,n.previous=i,r<=0&&(r+=i.getTrackComplete()-n.mixDuration)):(this.setCurrent(t,n,!0),this.queue.drain()),n.delay=r,n}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,it.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let r=this.addAnimationWith(t,it.emptyAnimation(),!1,s);return s<=0&&(r.delay+=r.mixDuration-e),r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(l.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,r){let i=this.trackEntryPool.obtain();return i.reset(),i.trackIndex=t,i.animation=e,i.loop=s,i.holdPrevious=!1,i.reverse=!1,i.shortestRotation=!1,i.eventThreshold=0,i.alphaAttachmentThreshold=0,i.mixAttachmentThreshold=0,i.mixDrawOrderThreshold=0,i.animationStart=0,i.animationEnd=e.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.mixTime=0,i.mixDuration=r?this.data.getMix(r.animation,e):0,i.interruptAlpha=1,i.totalAlpha=0,i.mixBlend=exports.MixBlend.replace,i}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do{s.mixingTo&&s.mixBlend==exports.MixBlend.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,r=t.animation.timelines.length,i=t.timelineMode;i.length=r;let n=t.timelineHoldMix;n.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<r;t++)i[t]=a.addAll(s[t].getPropertyIds())?dt:ct;else t:for(let o=0;o<r;o++){let r=s[o],l=r.getPropertyIds();if(a.addAll(l))if(!e||r instanceof O||r instanceof q||r instanceof L||!e.animation.hasTimeline(l))i[o]=ht;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){i[o]=ut,n[o]=s;continue t}break}i[o]=dt}else i[o]=lt}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}}class nt{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,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}mixBlend=exports.MixBlend.replace;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?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(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}}class at{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(exports.EventType.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(exports.EventType.interrupt),this.objects.push(t)}end(t){this.objects.push(exports.EventType.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(exports.EventType.dispose),this.objects.push(t)}complete(t){this.objects.push(exports.EventType.complete),this.objects.push(t)}event(t,e){this.objects.push(exports.EventType.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let r=t[s],i=t[s+1];switch(r){case exports.EventType.start:i.listener&&i.listener.start&&i.listener.start(i);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(i)}break;case exports.EventType.interrupt:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(i)}break;case exports.EventType.end:i.listener&&i.listener.end&&i.listener.end(i);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(i)}case exports.EventType.dispose:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(i)}this.animState.trackEntryPool.free(i);break;case exports.EventType.complete:i.listener&&i.listener.complete&&i.listener.complete(i);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(i)}break;case exports.EventType.event:let r=t[2+s++];i.listener&&i.listener.event&&i.listener.event(i,r);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(i,r)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var ot;exports.EventType=void 0,(ot=exports.EventType||(exports.EventType={}))[ot.start=0]="start",ot[ot.interrupt=1]="interrupt",ot[ot.end=2]="end",ot[ot.dispose=3]="dispose",ot[ot.complete=4]="complete",ot[ot.event=5]="event";const lt=0,ht=1,ct=2,dt=3,ut=4,pt=1,mt=2;class ft{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(r,i,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return void 0===r?this.defaultMix:r}}class gt extends u{color=new i(1,1,1,1);constructor(t){super(t)}copy(){let t=new gt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class xt extends u{endSlot=null;color=new i(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new xt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class wt{_image;constructor(t){this._image=t}getImage(){return this._image}}var bt,yt,Mt,St,vt,kt,It,At,Tt;exports.TextureFilter=void 0,(bt=exports.TextureFilter||(exports.TextureFilter={}))[bt.Nearest=9728]="Nearest",bt[bt.Linear=9729]="Linear",bt[bt.MipMap=9987]="MipMap",bt[bt.MipMapNearestNearest=9984]="MipMapNearestNearest",bt[bt.MipMapLinearNearest=9985]="MipMapLinearNearest",bt[bt.MipMapNearestLinear=9986]="MipMapNearestLinear",bt[bt.MipMapLinearLinear=9987]="MipMapLinearLinear",exports.TextureWrap=void 0,(yt=exports.TextureWrap||(exports.TextureWrap={}))[yt.MirroredRepeat=33648]="MirroredRepeat",yt[yt.ClampToEdge=33071]="ClampToEdge",yt[yt.Repeat=10497]="Repeat";class Bt{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class Ct{pages=new Array;regions=new Array;constructor(t){let e=new Ft(t),s=new Array(4),r={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=l.enumValue(exports.TextureFilter,s[1]),t.magFilter=l.enumValue(exports.TextureFilter,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=exports.TextureWrap.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=exports.TextureWrap.Repeat)},pma:t=>{t.pma="true"==s[1]}};var i={xy:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2])},size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},bounds:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2]),t.width=parseInt(s[3]),t.height=parseInt(s[4])},offset:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2])},orig:t=>{t.originalWidth=parseInt(s[1]),t.originalHeight=parseInt(s[2])},offsets:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2]),t.originalWidth=parseInt(s[3]),t.originalHeight=parseInt(s[4])},rotate:t=>{let e=s[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:t=>{t.index=parseInt(s[1])}};let n=e.readLine();for(;n&&0==n.trim().length;)n=e.readLine();for(;n&&0!=n.trim().length&&0!=e.readEntry(s,n);)n=e.readLine();let a=null,o=null,h=null;for(;null!==n;)if(0==n.trim().length)a=null,n=e.readLine();else if(a){let t=new Rt(a,n);for(;;){let r=e.readEntry(s,n=e.readLine());if(0==r)break;let a=i[s[0]];if(a)a(t);else{o||(o=[]),h||(h=[]),o.push(s[0]);let t=[];for(let e=0;e<r;e++)t.push(parseInt(s[e+1]));h.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&h&&h.length>0&&(t.names=o,t.values=h,o=null,h=null),t.u=t.x/a.width,t.v=t.y/a.height,90==t.degrees?(t.u2=(t.x+t.height)/a.width,t.v2=(t.y+t.width)/a.height):(t.u2=(t.x+t.width)/a.width,t.v2=(t.y+t.height)/a.height),this.regions.push(t)}else{for(a=new Et(n.trim());0!=e.readEntry(s,n=e.readLine());){let t=r[s[0]];t&&t(a)}this.pages.push(a)}}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()}}class Ft{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)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let r=1,i=s+1;;r++){let s=e.indexOf(",",i);if(-1==s)return t[r]=e.substr(i).trim(),r;if(t[r]=e.substr(i,s-i).trim(),i=s+1,4==r)return 4}}}class Et{name;minFilter=exports.TextureFilter.Nearest;magFilter=exports.TextureFilter.Nearest;uWrap=exports.TextureWrap.ClampToEdge;vWrap=exports.TextureWrap.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}}class Rt extends Bt{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)}}class Yt extends u{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new i(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new i(0,0,0,0);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=l.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,r=this.region.u,i=this.region.v,n=0,a=0;if(this.region instanceof Rt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/h,i-=(o.originalWidth-o.offsetX-o.width)/c,n=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+t[o+1]*n,e[o+1]=i+(1-t[o])*a;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/h,i-=o.offsetY/c,n=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o])*n,e[o+1]=i+(1-t[o+1])*a;return;case 270:r-=o.offsetY/h,i-=o.offsetX/c,n=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o+1])*n,e[o+1]=i+t[o]*a;return}r-=o.offsetX/h,i-=(o.originalHeight-o.offsetY-o.height)/c,n=o.originalWidth/h,a=o.originalHeight/c}else this.region?(n=this.region.u2-r,a=this.region.v2-i):(r=i=0,n=a=1);for(let o=0;o<s;o+=2)e[o]=r+t[o]*n,e[o+1]=i+t[o+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Yt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),l.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),l.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),l.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),l.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,i,n){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,i,n)}newLinkedMesh(){let t=new Yt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),null!=t.region&&t.updateRegion(),t}}class Pt extends u{lengths=[];closed=!1;constantSpeed=!1;color=new i(1,1,1,1);constructor(t){super(t)}copy(){let t=new Pt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),l.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Xt extends u{x=0;y=0;rotation=0;color=new i(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){const e=this.rotation*n.degRad,s=Math.cos(e),r=Math.sin(e),i=s*t.a+r*t.b,a=s*t.c+r*t.d;return n.atan2Deg(a,i)}copy(){let t=new Xt(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class _t extends d{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new i(1,1,1,1);path;region=null;sequence=null;offset=l.newFloatArray(8);uvs=l.newFloatArray(8);tempColor=new i(1,1,1,1);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,i=-this.width/2*this.scaleX+this.region.offsetX*s,a=-this.height/2*this.scaleY+this.region.offsetY*r,o=i+this.region.width*s,l=a+this.region.height*r,h=this.rotation*n.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,p=this.y,m=i*c+u,f=i*d,g=a*c+p,x=a*d,w=o*c+u,b=o*d,y=l*c+p,M=l*d,S=this.offset;S[0]=m-x,S[1]=g+f,S[2]=m-M,S[3]=y+f,S[4]=w-M,S[5]=y+b,S[6]=w-x,S[7]=g+b,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){null!=this.sequence&&this.sequence.apply(t,this);let i=t.bone,n=this.offset,a=i.worldX,o=i.worldY,l=i.a,h=i.b,c=i.c,d=i.d,u=0,p=0;u=n[0],p=n[1],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[2],p=n[3],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[4],p=n[5],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[6],p=n[7],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o}copy(){let t=new _t(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,l.arrayCopy(this.uvs,0,t.uvs,0,8),l.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31}class Vt{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let i=0,n=r.length;i<n;i++){let n=s.getPath(e,i),a=this.atlas.findRegion(n);if(null==a)throw new Error("Region not found in atlas: "+n+" (sequence: "+t+")");r[i]=a}}newRegionAttachment(t,e,s,r){let i=new _t(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");i.region=t}return i}newMeshAttachment(t,e,s,r){let i=new Yt(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");i.region=t}return i}newBoundingBoxAttachment(t,e){return new gt(e)}newPathAttachment(t,e){return new Pt(e)}newPointAttachment(t,e){return new Xt(e)}newClippingAttachment(t,e){return new xt(e)}}class Dt{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=exports.Inherit.Normal;skinRequired=!1;color=new i;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}}exports.Inherit=void 0,(Mt=exports.Inherit||(exports.Inherit={}))[Mt.Normal=0]="Normal",Mt[Mt.OnlyTranslation=1]="OnlyTranslation",Mt[Mt.NoRotationOrReflection=2]="NoRotationOrReflection",Mt[Mt.NoScale=3]="NoScale",Mt[Mt.NoScaleOrReflection=4]="NoScaleOrReflection";class Ot{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=exports.Inherit.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,i,a,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=a,this.ashearY=o;let l=this.parent;if(!l){let l=this.skeleton;const h=l.scaleX,c=l.scaleY,d=(s+a)*n.degRad,u=(s+90+o)*n.degRad;return this.a=Math.cos(d)*r*h,this.b=Math.cos(u)*i*h,this.c=Math.sin(d)*r*c,this.d=Math.sin(u)*i*c,this.worldX=t*h+l.x,void(this.worldY=e*c+l.y)}let h=l.a,c=l.b,d=l.c,u=l.d;switch(this.worldX=h*t+c*e+l.worldX,this.worldY=d*t+u*e+l.worldY,this.inherit){case exports.Inherit.Normal:{const t=(s+a)*n.degRad,e=(s+90+o)*n.degRad,l=Math.cos(t)*r,p=Math.cos(e)*i,m=Math.sin(t)*r,f=Math.sin(e)*i;return this.a=h*l+c*m,this.b=h*p+c*f,this.c=d*l+u*m,void(this.d=d*p+u*f)}case exports.Inherit.OnlyTranslation:{const t=(s+a)*n.degRad,e=(s+90+o)*n.degRad;this.a=Math.cos(t)*r,this.b=Math.cos(e)*i,this.c=Math.sin(t)*r,this.d=Math.sin(e)*i;break}case exports.Inherit.NoRotationOrReflection:{let t=h*h+d*d,e=0;t>1e-4?(t=Math.abs(h*u-c*d)/t,h/=this.skeleton.scaleX,d/=this.skeleton.scaleY,c=d*t,u=h*t,e=Math.atan2(d,h)*n.radDeg):(h=0,d=0,e=90-Math.atan2(u,c)*n.radDeg);const l=(s+a-e)*n.degRad,p=(s+o-e+90)*n.degRad,m=Math.cos(l)*r,f=Math.cos(p)*i,g=Math.sin(l)*r,x=Math.sin(p)*i;this.a=h*m-c*g,this.b=h*f-c*x,this.c=d*m+u*g,this.d=d*f+u*x;break}case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:{s*=n.degRad;const t=Math.cos(s),e=Math.sin(s);let l=(h*t+c*e)/this.skeleton.scaleX,p=(d*t+u*e)/this.skeleton.scaleY,m=Math.sqrt(l*l+p*p);m>1e-5&&(m=1/m),l*=m,p*=m,m=Math.sqrt(l*l+p*p),this.inherit==exports.Inherit.NoScale&&h*u-c*d<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(p,l);const f=Math.cos(s)*m,g=Math.sin(s)*m;a*=n.degRad,o=(90+o)*n.degRad;const x=Math.cos(a)*r,w=Math.cos(o)*i,b=Math.sin(a)*r,y=Math.sin(o)*i;this.a=l*x+f*b,this.b=l*w+f*y,this.c=p*x+g*b,this.d=p*w+g*y;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)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*n.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,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*n.radDeg);let e,s,r,i,a=t.a,o=t.b,l=t.c,h=t.d,c=1/(a*h-o*l),d=h*c,u=o*c,p=l*c,m=a*c,f=this.worldX-t.worldX,g=this.worldY-t.worldY;if(this.ax=f*d-g*u,this.ay=g*m-f*p,this.inherit==exports.Inherit.OnlyTranslation)e=this.a,s=this.b,r=this.c,i=this.d;else{switch(this.inherit){case exports.Inherit.NoRotationOrReflection:{let t=Math.abs(a*h-o*l)/(a*a+l*l),e=a/this.skeleton.scaleX;o=-(l/this.skeleton.scaleY)*t*this.skeleton.scaleX,h=e*t*this.skeleton.scaleY,c=1/(a*h-o*l),d=h*c,u=o*c;break}case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:let t=n.cosDeg(this.rotation),e=n.sinDeg(this.rotation);a=(a*t+o*e)/this.skeleton.scaleX,l=(l*t+h*e)/this.skeleton.scaleY;let s=Math.sqrt(a*a+l*l);s>1e-5&&(s=1/s),a*=s,l*=s,s=Math.sqrt(a*a+l*l),this.inherit==exports.Inherit.NoScale&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let r=n.PI/2+Math.atan2(l,a);o=Math.cos(r)*s,h=Math.sin(r)*s,c=1/(a*h-o*l),d=h*c,u=o*c,p=l*c,m=a*c}e=d*this.a-u*this.c,s=d*this.b-u*this.d,r=m*this.c-p*this.a,i=m*this.d-p*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+r*r),this.ascaleX>1e-4){let t=e*i-s*r;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+r*i,t)*n.radDeg,this.arotation=Math.atan2(r,e)*n.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+i*i),this.ashearY=0,this.arotation=90-Math.atan2(i,s)*n.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*n.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*n.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,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*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(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=n.sinDeg(t),s=n.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*n.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=n.sinDeg(t),s=n.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*n.radDeg}rotateWorld(t){t*=n.degRad;const e=Math.sin(t),s=Math.cos(t),r=this.a,i=this.b;this.a=s*r-e*this.c,this.b=s*i-e*this.d,this.c=e*r+s*this.c,this.d=e*i+s*this.d}}class Nt{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class Lt{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=e.charCodeAt(i);return r}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)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;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",t,!0);let i=()=>{this.finish(t,r.status,r.responseText)};r.onload=i,r.onerror=i,r.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer";let i=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{200==r.status||0==r.status?this.finish(t,200,new Uint8Array(r.response)):i()},r.onerror=i,r.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let i=200==e||0==e?[s]:[e,s];for(let t=i.length-1,e=r.length;t<e;t+=2)r[t].apply(null,i)}}class qt{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}}class Ut{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class Wt{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 s=0;s<t.bones.length;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].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(0==this.mix)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)}}apply1(t,e,s,r,i,a,o){let l=t.parent;if(!l)throw new Error("IK bone must have parent.");let h=l.a,c=l.b,d=l.c,u=l.d,p=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case exports.Inherit.OnlyTranslation:m=(e-t.worldX)*n.signum(t.skeleton.scaleX),f=(s-t.worldY)*n.signum(t.skeleton.scaleY);break;case exports.Inherit.NoRotationOrReflection:let r=Math.abs(h*u-c*d)/Math.max(1e-4,h*h+d*d),i=h/t.skeleton.scaleX,a=d/t.skeleton.scaleY;c=-a*r*t.skeleton.scaleX,u=i*r*t.skeleton.scaleY,p+=Math.atan2(a,i)*n.radDeg;default:let o=e-l.worldX,g=s-l.worldY,x=h*u-c*d;Math.abs(x)<=1e-4?(m=0,f=0):(m=(o*u-g*c)/x-t.ax,f=(g*h-o*d)/x-t.ay)}p+=Math.atan2(f,m)*n.radDeg,t.ascaleX<0&&(p+=180),p>180?p-=360:p<-180&&(p+=360);let g=t.ascaleX,x=t.ascaleY;if(r||i){switch(t.inherit){case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:m=e-t.worldX,f=s-t.worldY}const n=t.data.length*g;if(n>1e-4){const t=m*m+f*f;if(r&&t<n*n||i&&t>n*n){const e=(Math.sqrt(t)/n-1)*o+1;g*=e,a&&(x*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+p*o,g,x,t.ashearX,t.ashearY)}apply2(t,e,s,r,i,a,o,l,h){if(t.inherit!=exports.Inherit.Normal||e.inherit!=exports.Inherit.Normal)return;let c=t.ax,d=t.ay,u=t.ascaleX,p=t.ascaleY,m=u,f=p,g=e.ascaleX,x=0,w=0,b=0;u<0?(u=-u,x=180,b=-1):(x=0,b=1),p<0&&(p=-p,b=-b),g<0?(g=-g,w=180):w=0;let y=e.ax,M=0,S=0,v=0,k=t.a,I=t.b,A=t.c,T=t.d,B=Math.abs(u-p)<=1e-4;!B||a?(M=0,S=k*y+t.worldX,v=A*y+t.worldY):(M=e.ay,S=k*y+I*M+t.worldX,v=A*y+T*M+t.worldY);let C=t.parent;if(!C)throw new Error("IK parent must itself have a parent.");k=C.a,I=C.b,A=C.c,T=C.d;let F=k*T-I*A,E=S-C.worldX,R=v-C.worldY;F=Math.abs(F)<=1e-4?0:1/F;let Y,P,X=(E*T-R*I)*F-c,_=(R*k-E*A)*F-d,V=Math.sqrt(X*X+_*_),D=e.data.length*g;if(V<1e-4)return this.apply1(t,s,r,!1,a,!1,h),void e.updateWorldTransformWith(y,M,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);E=s-C.worldX,R=r-C.worldY;let O=(E*T-R*I)*F-c,N=(R*k-E*A)*F-d,L=O*O+N*N;if(0!=l){l*=u*(g+1)*.5;let t=Math.sqrt(L),e=t-V-D*u+l;if(e>0){let s=Math.min(1,e/(2*l))-1;s=(e-l*(1-s*s))/t,O-=s*O,N-=s*N,L=O*O+N*N}}t:if(B){D*=u;let t=(L-V*V-D*D)/(2*V*D);t<-1?(t=-1,P=Math.PI*i):t>1?(t=1,P=0,a&&(k=(Math.sqrt(L)/(V+D)-1)*h+1,m*=k,o&&(f*=k))):P=Math.acos(t)*i,k=V+D*t,I=D*Math.sin(P),Y=Math.atan2(N*k-O*I,O*k+N*I)}else{k=u*D,I=p*D;let t=k*k,e=I*I,s=Math.atan2(N,O);A=e*V*V+t*L-t*e;let r=-2*e*V,a=e-t;if(T=r*r-4*a*A,T>=0){let t=Math.sqrt(T);r<0&&(t=-t),t=.5*-(r+t);let e=t/a,n=A/t,o=Math.abs(e)<Math.abs(n)?e:n;if(o*o<=L){R=Math.sqrt(L-o*o)*i,Y=s-Math.atan2(R,o),P=Math.atan2(R/p,(o-V)/u);break t}}let o=n.PI,l=V-k,h=l*l,c=0,d=0,m=V+k,f=m*m,g=0;A=-k*V/(t-e),A>=-1&&A<=1&&(A=Math.acos(A),E=k*Math.cos(A)+V,R=I*Math.sin(A),T=E*E+R*R,T<h&&(o=A,h=T,l=E,c=R),T>f&&(d=A,f=T,m=E,g=R)),L<=.5*(h+f)?(Y=s-Math.atan2(c*i,l),P=o*i):(Y=s-Math.atan2(g*i,m),P=d*i)}let q=Math.atan2(M,y)*b,U=t.arotation;Y=(Y-q)*n.radDeg+x-U,Y>180?Y-=360:Y<-180&&(Y+=360),t.updateWorldTransformWith(c,d,U+Y*h,m,f,0,0),U=e.arotation,P=((P+q)*n.radDeg-e.ashearX)*b+w-U,P>180?P-=360:P<-180&&(P+=360),e.updateWorldTransformWith(y,M,U+P*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class zt extends Nt{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)}}class Gt extends Nt{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=exports.PositionMode.Fixed;spacingMode=exports.SpacingMode.Fixed;rotateMode=exports.RotateMode.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}exports.PositionMode=void 0,(St=exports.PositionMode||(exports.PositionMode={}))[St.Fixed=0]="Fixed",St[St.Percent=1]="Percent",exports.SpacingMode=void 0,(vt=exports.SpacingMode||(exports.SpacingMode={}))[vt.Length=0]="Length",vt[vt.Fixed=1]="Fixed",vt[vt.Percent=2]="Percent",vt[vt.Proportional=3]="Proportional",exports.RotateMode=void 0,(kt=exports.RotateMode||(exports.RotateMode={}))[kt.Tangent=0]="Tangent",kt[kt.Chain=1]="Chain",kt[kt.ChainScale=2]="ChainScale";class $t{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,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 s=0,r=t.bones.length;s<r;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof Pt))return;let s=this.mixRotate,r=this.mixX,i=this.mixY;if(0==s&&0==r&&0==i)return;let a=this.data,o=a.rotateMode==exports.RotateMode.Tangent,h=a.rotateMode==exports.RotateMode.ChainScale,c=this.bones,d=c.length,u=o?d:d+1,p=l.setArraySize(this.spaces,u),m=h?this.lengths=l.setArraySize(this.lengths,d):[],f=this.spacing;switch(a.spacingMode){case exports.SpacingMode.Percent:if(h)for(let t=0,e=u-1;t<e;t++){let e=c[t],s=e.data.length,r=s*e.a,i=s*e.c;m[t]=Math.sqrt(r*r+i*i)}l.arrayFill(p,1,u,f);break;case exports.SpacingMode.Proportional:let t=0;for(let e=0,s=u-1;e<s;){let s=c[e],r=s.data.length;if(r<$t.epsilon)h&&(m[e]=0),p[++e]=f;else{let i=r*s.a,n=r*s.c,a=Math.sqrt(i*i+n*n);h&&(m[e]=a),p[++e]=a,t+=a}}if(t>0){t=u/t*f;for(let e=1;e<u;e++)p[e]*=t}break;default:let e=a.spacingMode==exports.SpacingMode.Length;for(let t=0,s=u-1;t<s;){let s=c[t],r=s.data.length;if(r<$t.epsilon)h&&(m[t]=0),p[++t]=f;else{let i=r*s.a,n=r*s.c,a=Math.sqrt(i*i+n*n);h&&(m[t]=a),p[++t]=(e?r+f:f)*a/r}}}let g=this.computeWorldPositions(e,u,o),x=g[0],w=g[1],b=a.offsetRotation,y=!1;if(0==b)y=a.rotateMode==exports.RotateMode.Chain;else{y=!1;let t=this.target.bone;b*=t.a*t.d-t.b*t.c>0?n.degRad:-n.degRad}for(let t=0,e=3;t<d;t++,e+=3){let a=c[t];a.worldX+=(x-a.worldX)*r,a.worldY+=(w-a.worldY)*i;let l=g[e],d=g[e+1],u=l-x,f=d-w;if(h){let e=m[t];if(0!=e){let t=(Math.sqrt(u*u+f*f)/e-1)*s+1;a.a*=t,a.c*=t}}if(x=l,w=d,s>0){let r=a.a,i=a.b,l=a.c,h=a.d,c=0,d=0,m=0;if(c=o?g[e-1]:0==p[t+1]?g[e+2]:Math.atan2(f,u),c-=Math.atan2(l,r),y){d=Math.cos(c),m=Math.sin(c);let t=a.data.length;x+=(t*(d*r-m*l)-u)*s,w+=(t*(m*r+d*l)-f)*s}else c+=b;c>n.PI?c-=n.PI2:c<-n.PI&&(c+=n.PI2),c*=s,d=Math.cos(c),m=Math.sin(c),a.a=d*r-m*l,a.b=d*i-m*h,a.c=m*r+d*l,a.d=m*i+d*h}a.updateAppliedTransform()}}computeWorldPositions(t,e,s){let r=this.target,i=this.position,n=this.spaces,a=l.setArraySize(this.positions,3*e+2),o=this.world,h=t.closed,c=t.worldVerticesLength,d=c/6,u=$t.NONE;if(!t.constantSpeed){let p=t.lengths;d-=h?1:2;let m,f=p[d];switch(this.data.positionMode==exports.PositionMode.Percent&&(i*=f),this.data.spacingMode){case exports.SpacingMode.Percent:m=f;break;case exports.SpacingMode.Proportional:m=f/e;break;default:m=1}o=l.setArraySize(this.world,8);for(let l=0,g=0,x=0;l<e;l++,g+=3){let e=n[l]*m;i+=e;let w=i;if(h)w%=f,w<0&&(w+=f),x=0;else{if(w<0){u!=$t.BEFORE&&(u=$t.BEFORE,t.computeWorldVertices(r,2,4,o,0,2)),this.addBeforePosition(w,o,0,a,g);continue}if(w>f){u!=$t.AFTER&&(u=$t.AFTER,t.computeWorldVertices(r,c-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,a,g);continue}}for(;;x++){let t=p[x];if(!(w>t)){if(0==x)w/=t;else{let e=p[x-1];w=(w-e)/(t-e)}break}}x!=u&&(u=x,h&&x==d?(t.computeWorldVertices(r,c-4,4,o,0,2),t.computeWorldVertices(r,0,4,o,4,2)):t.computeWorldVertices(r,6*x+2,8,o,0,2)),this.addCurvePosition(w,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],a,g,s||l>0&&0==e)}return a}h?(c+=2,o=l.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,o,0,2),t.computeWorldVertices(r,0,2,o,c-4,2),o[c-2]=o[0],o[c-1]=o[1]):(d--,c-=4,o=l.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,o,0,2));let p,m=l.setArraySize(this.curves,d),f=0,g=o[0],x=o[1],w=0,b=0,y=0,M=0,S=0,v=0,k=0,I=0,A=0,T=0,B=0,C=0,F=0,E=0;for(let t=0,e=2;t<d;t++,e+=6)w=o[e],b=o[e+1],y=o[e+2],M=o[e+3],S=o[e+4],v=o[e+5],k=.1875*(g-2*w+y),I=.1875*(x-2*b+M),A=.09375*(3*(w-y)-g+S),T=.09375*(3*(b-M)-x+v),B=2*k+A,C=2*I+T,F=.75*(w-g)+k+.16666667*A,E=.75*(b-x)+I+.16666667*T,f+=Math.sqrt(F*F+E*E),F+=B,E+=C,B+=A,C+=T,f+=Math.sqrt(F*F+E*E),F+=B,E+=C,f+=Math.sqrt(F*F+E*E),F+=B+A,E+=C+T,f+=Math.sqrt(F*F+E*E),m[t]=f,g=S,x=v;switch(this.data.positionMode==exports.PositionMode.Percent&&(i*=f),this.data.spacingMode){case exports.SpacingMode.Percent:p=f;break;case exports.SpacingMode.Proportional:p=f/e;break;default:p=1}let R=this.segments,Y=0;for(let t=0,r=0,l=0,d=0;t<e;t++,r+=3){let e=n[t]*p;i+=e;let P=i;if(h)P%=f,P<0&&(P+=f),l=0;else{if(P<0){this.addBeforePosition(P,o,0,a,r);continue}if(P>f){this.addAfterPosition(P-f,o,c-4,a,r);continue}}for(;;l++){let t=m[l];if(!(P>t)){if(0==l)P/=t;else{let e=m[l-1];P=(P-e)/(t-e)}break}}if(l!=u){u=l;let t=6*l;for(g=o[t],x=o[t+1],w=o[t+2],b=o[t+3],y=o[t+4],M=o[t+5],S=o[t+6],v=o[t+7],k=.03*(g-2*w+y),I=.03*(x-2*b+M),A=.006*(3*(w-y)-g+S),T=.006*(3*(b-M)-x+v),B=2*k+A,C=2*I+T,F=.3*(w-g)+k+.16666667*A,E=.3*(b-x)+I+.16666667*T,Y=Math.sqrt(F*F+E*E),R[0]=Y,t=1;t<8;t++)F+=B,E+=C,B+=A,C+=T,Y+=Math.sqrt(F*F+E*E),R[t]=Y;F+=B,E+=C,Y+=Math.sqrt(F*F+E*E),R[8]=Y,F+=B+A,E+=C+T,Y+=Math.sqrt(F*F+E*E),R[9]=Y,d=0}for(P*=Y;;d++){let t=R[d];if(!(P>t)){if(0==d)P/=t;else{let e=R[d-1];P=d+(P-e)/(t-e)}break}}this.addCurvePosition(.1*P,g,x,w,b,y,M,S,v,a,r,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,r,i){let n=e[s],a=e[s+1],o=e[s+2]-n,l=e[s+3]-a,h=Math.atan2(l,o);r[i]=n+t*Math.cos(h),r[i+1]=a+t*Math.sin(h),r[i+2]=h}addAfterPosition(t,e,s,r,i){let n=e[s+2],a=e[s+3],o=n-e[s],l=a-e[s+1],h=Math.atan2(l,o);r[i]=n+t*Math.cos(h),r[i+1]=a+t*Math.sin(h),r[i+2]=h}addCurvePosition(t,e,s,r,i,n,a,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(i-s,r-e));let u=t*t,p=u*t,m=1-t,f=m*m,g=f*m,x=m*t,w=3*x,b=m*w,y=w*t,M=e*g+r*b+n*y+o*p,S=s*g+i*b+a*y+l*p;h[c]=M,h[c+1]=S,d&&(h[c+2]=t<.001?Math.atan2(i-s,r-e):Math.atan2(S-(s*f+i*x*2+a*u),M-(e*f+r*x*2+n*u)))}}class jt{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(0==e)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,a=this.data.scaleX>0,o=this.bone,l=o.data.length;switch(t){case exports.Physics.none:return;case exports.Physics.reset:this.reset();case exports.Physics.update:const t=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=t,this.lastTime=this.skeleton.time;const h=o.worldX,c=o.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=c;else{let d=this.remaining,u=this.inertia,p=this.data.limit*t,m=this.data.step,f=this.skeleton.data.referenceScale,g=-1;if(s||r){if(s){const t=(this.ux-h)*u;this.xOffset+=t>p?p:t<-p?-p:t,this.ux=h}if(r){const t=(this.uy-c)*u;this.yOffset+=t>p?p:t<-p?-p:t,this.uy=c}if(d>=m){g=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,i=this.wind*f,n=(Kt.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(i-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=g),r&&(this.yVelocity-=(n+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=g),d-=m}while(d>=m)}s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i||a){let t=Math.atan2(o.c,o.a),s=0,r=0,h=0,c=this.cx-o.worldX,x=this.cy-o.worldY;if(c>p?c=p:c<-p&&(c=-p),x>p?x=p:x<-p&&(x=-p),i){h=(this.data.rotate+this.data.shearX)*e;let i=Math.atan2(x+this.ty,c+this.tx)-t-this.rotateOffset*h;this.rotateOffset+=(i-Math.ceil(i*n.invPI2-.5)*n.PI2)*u,i=this.rotateOffset*h+t,s=Math.cos(i),r=Math.sin(i),a&&(i=l*o.getWorldScaleX(),i>0&&(this.scaleOffset+=(c*s+x*r)*u/i))}else{s=Math.cos(t),r=Math.sin(t);const e=l*o.getWorldScaleX();e>0&&(this.scaleOffset+=(c*s+x*r)*u/e)}if(d=this.remaining,d>=m){-1==g&&(g=Math.pow(this.damping,60*m));const e=this.massInverse*m,n=this.strength,o=this.wind,c=Kt.yDown?-this.gravity:this.gravity,u=l/f;for(;;)if(d-=m,a&&(this.scaleVelocity+=(o*s-c*r-this.scaleOffset*n)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=g),i){if(this.rotateVelocity-=((o*r+c*s)*u+this.rotateOffset*n)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=g,d<m)break;const i=this.rotateOffset*h+t;s=Math.cos(i),r=Math.sin(i)}else if(d<m)break}}this.remaining=d}this.cx=o.worldX,this.cy=o.worldY;break;case exports.Physics.pose:s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i){let t=this.rotateOffset*e,s=0,r=0,i=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),r=Math.cos(e),i=o.b,o.b=r*i-s*o.d,o.d=s*i+r*o.d),e+=t*this.data.shearX,s=Math.sin(e),r=Math.cos(e),i=o.a,o.a=r*i-s*o.c,o.c=s*i+r*o.c}else t*=this.data.rotate,s=Math.sin(t),r=Math.cos(t),i=o.a,o.a=r*i-s*o.c,o.c=s*i+r*o.c,i=o.b,o.b=r*i-s*o.d,o.d=s*i+r*o.d}if(a){const t=1+this.scaleOffset*e*this.data.scaleX;o.a*=t,o.c*=t}t!=exports.Physics.pose&&(this.tx=l*o.a,this.ty=l*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const r=s*n.degRad,i=Math.cos(r),a=Math.sin(r),o=this.cx-t,l=this.cy-e;this.translate(o*i-l*a-o,o*a+l*i-l)}}class Ht{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 i,this.darkColor=t.darkColor?new i:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof u&&this.attachment instanceof u&&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}}class Jt{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new c;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 s=0;s<t.bones.length;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].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){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(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,r=this.mixScaleX,i=this.mixScaleY,a=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,p=h*u-c*d>0?n.degRad:-n.degRad,m=this.data.offsetRotation*p,f=this.data.offsetShearY*p,g=this.bones;for(let p=0,x=g.length;p<x;p++){let x=g[p];if(0!=t){let e=x.a,s=x.b,r=x.c,i=x.d,a=Math.atan2(d,h)-Math.atan2(r,e)+m;a>n.PI?a-=n.PI2:a<-n.PI&&(a+=n.PI2),a*=t;let o=Math.cos(a),l=Math.sin(a);x.a=o*e-l*r,x.b=o*s-l*i,x.c=l*e+o*r,x.d=l*s+o*i}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(t.x-x.worldX)*e,x.worldY+=(t.y-x.worldY)*s}if(0!=r){let t=Math.sqrt(x.a*x.a+x.c*x.c);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleX)*r)/t),x.a*=t,x.c*=t}if(0!=i){let t=Math.sqrt(x.b*x.b+x.d*x.d);0!=t&&(t=(t+(Math.sqrt(c*c+u*u)-t+this.data.offsetScaleY)*i)/t),x.b*=t,x.d*=t}if(a>0){let t=x.b,e=x.d,s=Math.atan2(e,t),r=Math.atan2(u,c)-Math.atan2(d,h)-(s-Math.atan2(x.c,x.a));r>n.PI?r-=n.PI2:r<-n.PI&&(r+=n.PI2),r=s+(r+f)*a;let i=Math.sqrt(t*t+e*e);x.b=Math.cos(r)*i,x.d=Math.sin(r)*i}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,a=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,p=h*u-c*d>0?n.degRad:-n.degRad,m=this.data.offsetRotation*p,f=this.data.offsetShearY*p,g=this.bones;for(let p=0,x=g.length;p<x;p++){let x=g[p];if(0!=t){let e=x.a,s=x.b,r=x.c,i=x.d,a=Math.atan2(d,h)+m;a>n.PI?a-=n.PI2:a<-n.PI&&(a+=n.PI2),a*=t;let o=Math.cos(a),l=Math.sin(a);x.a=o*e-l*r,x.b=o*s-l*i,x.c=l*e+o*r,x.d=l*s+o*i}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=t.x*e,x.worldY+=t.y*s}if(0!=r){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleX)*r+1;x.a*=t,x.c*=t}if(0!=i){let t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleY)*i+1;x.b*=t,x.d*=t}if(a>0){let t=Math.atan2(u,c)-Math.atan2(d,h);t>n.PI?t-=n.PI2:t<-n.PI&&(t+=n.PI2);let e=x.b,s=x.d;t=Math.atan2(s,e)+(t-n.PI/2+f)*a;let r=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*r,x.d=Math.sin(t)*r}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation;0!=t&&(c+=(a.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(a.ax-d+this.data.offsetX)*e,u+=(a.ay-u+this.data.offsetY)*s;let p=h.ascaleX,m=h.ascaleY;0!=r&&0!=p&&(p=(p+(a.ascaleX-p+this.data.offsetScaleX)*r)/p),0!=i&&0!=m&&(m=(m+(a.ascaleY-m+this.data.offsetScaleY)*i)/m);let f=h.ashearY;0!=n&&(f+=(a.ashearY-f+this.data.offsetShearY)*n),h.updateWorldTransformWith(d,u,c,p,m,h.ashearX,f)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(a.arotation+this.data.offsetRotation)*t,d=h.ax+(a.ax+this.data.offsetX)*e,u=h.ay+(a.ay+this.data.offsetY)*s,p=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*r+1),m=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*i+1),f=h.ashearY+(a.ashearY+this.data.offsetShearY)*n;h.updateWorldTransformWith(d,u,c,p,m,h.ashearX,f)}}}class Kt{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 Kt.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,r=t.bones[e];if(r.parent){let t=this.bones[r.parent.index];s=new Ot(r,this,t),t.children.push(s)}else s=new Ot(r,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],r=this.bones[s.boneData.index],i=new Ht(s,r);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new Wt(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Jt(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new $t(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new jt(s,this))}this.color=new i(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,r=this.pathConstraints,i=this.physicsConstraints,n=e.length,a=s.length,o=r.length,l=this.physicsConstraints.length,h=n+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<n;s++){let r=e[s];if(r.data.order==t){this.sortIkConstraint(r);continue t}}for(let e=0;e<a;e++){let r=s[e];if(r.data.order==t){this.sortTransformConstraint(r);continue t}}for(let e=0;e<o;e++){let s=r[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=i[e];if(s.data.order==t){this.sortPhysicsConstraint(s);continue t}}}for(let e=0,s=t.length;e<s;e++)this.sortBone(t[e])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,r=s[0];if(this.sortBone(r),1==s.length)this._updateCache.push(t),this.sortReset(r.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(r.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,r=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,r);let i=e.getAttachment();i instanceof Pt&&this.sortPathConstraintAttachmentWith(i,r);let n=t.bones,a=n.length;for(let t=0;t<a;t++)this.sortBone(n[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(n[t].children);for(let t=0;t<a;t++)n[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let r=t.attachments[e];if(r)for(let t in r)this.sortPathConstraintAttachmentWith(r[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Pt))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,r=s.length;e<r;){let r=s[e++];for(r+=e;e<r;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&l.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,r=s.length;e<r;e++)s[e].update(t)}updateWorldTransformWith(t,e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let r=e.a,i=e.b,a=e.c,o=e.d;s.worldX=r*this.x+i*this.y+e.worldX,s.worldY=a*this.x+o*this.y+e.worldY;const l=(s.rotation+s.shearX)*n.degRad,h=(s.rotation+90+s.shearY)*n.degRad,c=Math.cos(l)*s.scaleX,d=Math.cos(h)*s.scaleY,u=Math.sin(l)*s.scaleX,p=Math.sin(h)*s.scaleY;s.a=(r*c+i*u)*this.scaleX,s.b=(r*d+i*p)*this.scaleX,s.c=(a*c+o*u)*this.scaleY,s.d=(a*d+o*p)*this.scaleY;let m=this._updateCache;for(let e=0,r=m.length;e<r;e++){let r=m[e];r!=s&&r.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;l.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.data.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,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s],i=r.data.attachmentName;if(i){let e=t.getAttachment(s,i);e&&r.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let i=s[r];if(i.data.name==t){let s=null;if(e&&(s=this.getAttachment(r,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find((e=>e.data.name==t))??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find((e=>e.data.name==t))??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find((e=>e.data.name==t))??null}findPhysicsConstraint(t){if(null==t)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find((e=>e.data.name==t))??null}getBoundsRect(){let t=new c,e=new c;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let i=this.drawOrder,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let t=0,e=i.length;t<e;t++){let e=i[t];if(!e.bone.active)continue;let c=0,d=null,u=null,p=e.getAttachment();if(p instanceof _t)c=8,d=l.setArraySize(s,c,0),p.computeWorldVertices(e,d,0,2),u=Kt.quadTriangles;else if(p instanceof Yt){let t=p;c=t.worldVerticesLength,d=l.setArraySize(s,c,0),t.computeWorldVertices(e,0,c,d,0,2),u=t.triangles}else if(p instanceof xt&&null!=r){r.clipStart(e,p);continue}if(d&&u){null!=r&&r.isClipping()&&(r.clipTriangles(d,u,u.length),d=r.clippedVertices,c=r.clippedVertices.length);for(let t=0,e=d.length;t<e;t+=2){let e=d[t],s=d[t+1];n=Math.min(n,e),a=Math.min(a,s),o=Math.max(o,e),h=Math.max(h,s)}}null!=r&&r.clipEndWithSlot(e)}null!=r&&r.clipEnd(),t.set(n,a),e.set(o-n,h-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let r=0,i=s.length;r<i;r++)s[r].translate(t,e)}physicsRotate(t,e,s){const r=this.physicsConstraints;for(let i=0,n=r.length;i<n;i++)r[i].rotate(t,e,s)}}exports.Physics=void 0,(It=exports.Physics||(exports.Physics={}))[It.none=0]="none",It[It.reset=1]="reset",It[It.update=2]="update",It[It.pose=3]="pose";class Qt extends Nt{_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)}}class Zt{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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}}class te{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class ee{name;attachments=new Array;bones=Array();constraints=new Array;color=new i(.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 r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof Yt?(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 r in s){let i=s[r];i&&t.push(new te(e,r,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new te(t,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let i=t.slots[r],n=i.getAttachment();if(n&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(n==t[e]){let t=this.getAttachment(s,e);t&&i.setAttachment(t);break}}}s++}}}class se{index=0;name;boneData;color=new i(1,1,1,1);darkColor=null;attachmentName=null;blendMode=exports.BlendMode.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}exports.BlendMode=void 0,(At=exports.BlendMode||(exports.BlendMode={}))[At.Normal=0]="Normal",At[At.Additive=1]="Additive",At[At.Multiply=2]="Multiply",At[At.Screen=3]="Screen";class re extends Nt{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)}}class ie{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Zt;s.name="";let r=new ne(t),n=r.readInt32(),a=r.readInt32();s.hash=0==a&&0==n?null:a.toString(16)+n.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let h=0;h=r.readInt(!0);for(let t=0;t<h;t++){let t=r.readString();if(!t)throw new Error("String in string table must not be null.");r.strings.push(t)}h=r.readInt(!0);for(let t=0;t<h;t++){let n=r.readString();if(!n)throw new Error("Bone name must not be null.");let a=0==t?null:s.bones[r.readInt(!0)],l=new Dt(t,n,a);l.rotation=r.readFloat(),l.x=r.readFloat()*e,l.y=r.readFloat()*e,l.scaleX=r.readFloat(),l.scaleY=r.readFloat(),l.shearX=r.readFloat(),l.shearY=r.readFloat(),l.length=r.readFloat()*e,l.inherit=r.readByte(),l.skinRequired=r.readBoolean(),o&&(i.rgba8888ToColor(l.color,r.readInt32()),l.icon=r.readString()??void 0,l.visible=r.readBoolean()),s.bones.push(l)}h=r.readInt(!0);for(let t=0;t<h;t++){let e=r.readString();if(!e)throw new Error("Slot name must not be null.");let n=s.bones[r.readInt(!0)],a=new se(t,e,n);i.rgba8888ToColor(a.color,r.readInt32());let l=r.readInt32();-1!=l&&i.rgb888ToColor(a.darkColor=new i,l),a.attachmentName=r.readStringRef(),a.blendMode=r.readInt(!0),o&&(a.visible=r.readBoolean()),s.slots.push(a)}h=r.readInt(!0);for(let t,i=0;i<h;i++){let i=r.readString();if(!i)throw new Error("IK constraint data name must not be null.");let n=new zt(i);n.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.bones[r.readInt(!0)];let a=r.readByte();n.skinRequired=!!(1&a),n.bendDirection=2&a?1:-1,n.compress=!!(4&a),n.stretch=!!(8&a),n.uniform=!!(16&a),32&a&&(n.mix=64&a?r.readFloat():1),128&a&&(n.softness=r.readFloat()*e),s.ikConstraints.push(n)}h=r.readInt(!0);for(let t,i=0;i<h;i++){let i=r.readString();if(!i)throw new Error("Transform constraint data name must not be null.");let n=new re(i);n.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.bones[r.readInt(!0)];let a=r.readByte();n.skinRequired=!!(1&a),n.local=!!(2&a),n.relative=!!(4&a),8&a&&(n.offsetRotation=r.readFloat()),16&a&&(n.offsetX=r.readFloat()*e),32&a&&(n.offsetY=r.readFloat()*e),64&a&&(n.offsetScaleX=r.readFloat()),128&a&&(n.offsetScaleY=r.readFloat()),a=r.readByte(),1&a&&(n.offsetShearY=r.readFloat()),2&a&&(n.mixRotate=r.readFloat()),4&a&&(n.mixX=r.readFloat()),8&a&&(n.mixY=r.readFloat()),16&a&&(n.mixScaleX=r.readFloat()),32&a&&(n.mixScaleY=r.readFloat()),64&a&&(n.mixShearY=r.readFloat()),s.transformConstraints.push(n)}h=r.readInt(!0);for(let t,i=0;i<h;i++){let i=r.readString();if(!i)throw new Error("Path constraint data name must not be null.");let n=new Gt(i);n.order=r.readInt(!0),n.skinRequired=r.readBoolean(),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.slots[r.readInt(!0)];const a=r.readByte();n.positionMode=1&a,n.spacingMode=a>>1&3,n.rotateMode=a>>3&3,128&a&&(n.offsetRotation=r.readFloat()),n.position=r.readFloat(),n.positionMode==exports.PositionMode.Fixed&&(n.position*=e),n.spacing=r.readFloat(),n.spacingMode!=exports.SpacingMode.Length&&n.spacingMode!=exports.SpacingMode.Fixed||(n.spacing*=e),n.mixRotate=r.readFloat(),n.mixX=r.readFloat(),n.mixY=r.readFloat(),s.pathConstraints.push(n)}h=r.readInt(!0);for(let t=0;t<h;t++){const t=r.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const i=new Qt(t);i.order=r.readInt(!0),i.bone=s.bones[r.readInt(!0)];let n=r.readByte();i.skinRequired=!!(1&n),2&n&&(i.x=r.readFloat()),4&n&&(i.y=r.readFloat()),8&n&&(i.rotate=r.readFloat()),16&n&&(i.scaleX=r.readFloat()),32&n&&(i.shearX=r.readFloat()),i.limit=(64&n?r.readFloat():5e3)*e,i.step=1/r.readUnsignedByte(),i.inertia=r.readFloat(),i.strength=r.readFloat(),i.damping=r.readFloat(),i.massInverse=128&n?r.readFloat():1,i.wind=r.readFloat(),i.gravity=r.readFloat(),n=r.readByte(),1&n&&(i.inertiaGlobal=!0),2&n&&(i.strengthGlobal=!0),4&n&&(i.dampingGlobal=!0),8&n&&(i.massGlobal=!0),16&n&&(i.windGlobal=!0),32&n&&(i.gravityGlobal=!0),64&n&&(i.mixGlobal=!0),i.mix=128&n?r.readFloat():1,s.physicsConstraints.push(i)}let c=this.readSkin(r,s,!0,o);c&&(s.defaultSkin=c,s.skins.push(c));{let t=s.skins.length;for(l.setArraySize(s.skins,h=t+r.readInt(!0));t<h;t++){let e=this.readSkin(r,s,!1,o);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}h=this.linkedMeshes.length;for(let t=0;t<h;t++){let e=this.linkedMeshes[t];const r=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let i=r.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,h=r.readInt(!0);for(let t=0;t<h;t++){let t=r.readString();if(!t)throw new Error("Event data name must not be null");let e=new Ut(t);e.intValue=r.readInt(!1),e.floatValue=r.readFloat(),e.stringValue=r.readString(),e.audioPath=r.readString(),e.audioPath&&(e.volume=r.readFloat(),e.balance=r.readFloat()),s.events.push(e)}h=r.readInt(!0);for(let t=0;t<h;t++){let t=r.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,t,s))}return s}readSkin(t,e,s,r){let n=null,a=0;if(s){if(a=t.readInt(!0),0==a)return null;n=new ee("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new ee(s),r&&i.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,r=n.bones.length;s<r;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let s=0;s<a;s++){let s=t.readInt(!0);for(let i=0,a=t.readInt(!0);i<a;i++){let i=t.readStringRef();if(!i)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,n,s,i,r);a&&n.setAttachment(s,i,a)}}return n}readAttachment(t,e,s,r,n,a){let o=this.scale,h=t.readByte();const c=8&h?t.readStringRef():n;if(!c)throw new Error("Attachment name must not be null");switch(7&h){case Tt.Region:{let e=16&h?t.readStringRef():null;const r=32&h?t.readInt32():4294967295,n=64&h?this.readSequence(t):null;let a=128&h?t.readFloat():0,l=t.readFloat(),d=t.readFloat(),u=t.readFloat(),p=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=c);let g=this.attachmentLoader.newRegionAttachment(s,c,e,n);return g?(g.path=e,g.x=l*o,g.y=d*o,g.scaleX=u,g.scaleY=p,g.rotation=a,g.width=m*o,g.height=f*o,i.rgba8888ToColor(g.color,r),g.sequence=n,null==n&&g.updateRegion(),g):null}case Tt.BoundingBox:{let e=this.readVertices(t,!!(16&h)),r=a?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,c);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,a&&i.rgba8888ToColor(n.color,r),n):null}case Tt.Mesh:{let e=16&h?t.readStringRef():c;const r=32&h?t.readInt32():4294967295,n=64&h?this.readSequence(t):null,l=t.readInt(!0),d=this.readVertices(t,!!(128&h)),u=this.readFloatArray(t,d.length,1),p=this.readShortArray(t,3*(d.length-l-2));let m=[],f=0,g=0;a&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),g=t.readFloat()),e||(e=c);let x=this.attachmentLoader.newMeshAttachment(s,c,e,n);return x?(x.path=e,i.rgba8888ToColor(x.color,r),x.bones=d.bones,x.vertices=d.vertices,x.worldVerticesLength=d.length,x.triangles=p,x.regionUVs=u,null==n&&x.updateRegion(),x.hullLength=l<<1,x.sequence=n,a&&(x.edges=m,x.width=f*o,x.height=g*o),x):null}case Tt.LinkedMesh:{const e=16&h?t.readStringRef():c;if(null==e)throw new Error("Path of linked mesh must not be null");const n=32&h?t.readInt32():4294967295,l=64&h?this.readSequence(t):null,d=!!(128&h),u=t.readInt(!0),p=t.readStringRef();let m=0,f=0;a&&(m=t.readFloat(),f=t.readFloat());let g=this.attachmentLoader.newMeshAttachment(s,c,e,l);return g?(g.path=e,i.rgba8888ToColor(g.color,n),g.sequence=l,a&&(g.width=m*o,g.height=f*o),this.linkedMeshes.push(new ae(g,u,r,p,d)),g):null}case Tt.Path:{const e=!!(16&h),r=!!(32&h),n=this.readVertices(t,!!(64&h)),d=l.newArray(n.length/6,0);for(let e=0,s=d.length;e<s;e++)d[e]=t.readFloat()*o;const u=a?t.readInt32():0,p=this.attachmentLoader.newPathAttachment(s,c);return p?(p.closed=e,p.constantSpeed=r,p.worldVerticesLength=n.length,p.vertices=n.vertices,p.bones=n.bones,p.lengths=d,a&&i.rgba8888ToColor(p.color,u),p):null}case Tt.Point:{const e=t.readFloat(),r=t.readFloat(),n=t.readFloat(),l=a?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,c);return h?(h.x=r*o,h.y=n*o,h.rotation=e,a&&i.rgba8888ToColor(h.color,l),h):null}case Tt.Clipping:{const r=t.readInt(!0),n=this.readVertices(t,!!(16&h));let o=a?t.readInt32():0,l=this.attachmentLoader.newClippingAttachment(s,c);return l?(l.endSlot=e.slots[r],l.worldVerticesLength=n.length,l.vertices=n.vertices,l.bones=n.bones,a&&i.rgba8888ToColor(l.color,o),l):null}}return null}readSequence(t){let e=new p(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,r=t.readInt(!0),i=new oe;if(i.length=r<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let n=new Array,a=new Array;for(let e=0;e<r;e++){let e=t.readInt(!0);a.push(e);for(let r=0;r<e;r++)a.push(t.readInt(!0)),n.push(t.readFloat()*s),n.push(t.readFloat()*s),n.push(t.readFloat())}return i.vertices=l.toFloatArray(n),i.bones=a,i}readFloatArray(t,e,s){let r=new Array(e);if(1==s)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let i=0;i<e;i++)r[i]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,i=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,i=t.readInt(!0);s<i;s++){let s=t.readByte(),i=t.readInt(!0),n=i-1;switch(s){case Se:{let s=new O(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat(),t.readStringRef());r.push(s);break}case ve:{let s=t.readInt(!0),a=new P(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,u,1),ce(t,a,s++,e,3,o,r,d,p,1)}o=r,l=i,h=n,c=u,d=p}r.push(a);break}case ke:{let s=t.readInt(!0),a=new X(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,d,1)}o=r,l=i,h=n,c=d}r.push(a);break}case Ie:{let s=t.readInt(!0),a=new V(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,p,m),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,f,1),ce(t,a,s++,e,3,o,r,d,g,1),ce(t,a,s++,e,4,o,r,u,x,1),ce(t,a,s++,e,5,o,r,p,w,1),ce(t,a,s++,e,6,o,r,m,b,1)}o=r,l=i,h=n,c=f,d=g,u=x,p=w,m=b}r.push(a);break}case Ae:{let s=t.readInt(!0),a=new D(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,p),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,m,1),ce(t,a,s++,e,3,o,r,d,f,1),ce(t,a,s++,e,4,o,r,u,g,1),ce(t,a,s++,e,5,o,r,p,x,1)}o=r,l=i,h=n,c=m,d=f,u=g,p=x}r.push(a);break}case Te:{let s=new _(i,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,r=0;s.setFrame(e,a,o),e!=n;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255;switch(t.readByte()){case Le:s.setStepped(e);break;case qe:ce(t,s,r++,e,0,a,i,o,n,1)}a=i,o=n}r.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readByte(),n=t.readInt(!0);if(s==Me){let s=new Y(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readByte());r.push(s);continue}let a=t.readInt(!0);switch(s){case de:r.push(le(t,new v(n,a,e),1));break;case ue:r.push(he(t,new k(n,a,e),i));break;case pe:r.push(le(t,new I(n,a,e),i));break;case me:r.push(le(t,new A(n,a,e),i));break;case fe:r.push(he(t,new T(n,a,e),1));break;case ge:r.push(le(t,new B(n,a,e),1));break;case xe:r.push(le(t,new C(n,a,e),1));break;case we:r.push(he(t,new F(n,a,e),1));break;case be:r.push(le(t,new E(n,a,e),1));break;case ye:r.push(le(t,new R(n,a,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,a=new U(s,t.readInt(!0),e),o=t.readByte(),l=t.readFloat(),h=1&o?2&o?t.readFloat():1:0,c=4&o?t.readFloat()*i:0;for(let e=0,s=0;a.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=n;e++){o=t.readByte();const r=t.readFloat(),n=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*i:0;64&o?a.setStepped(e):128&o&&(ce(t,a,s++,e,0,l,r,h,n,1),ce(t,a,s++,e,1,l,r,c,d,i)),l=r,h=n,c=d}r.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),i=s-1,n=new W(s,t.readInt(!0),e),a=t.readFloat(),o=t.readFloat(),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat();for(let e=0,s=0;n.setFrame(e,a,o,l,h,c,d,u),e!=i;e++){let r=t.readFloat(),i=t.readFloat(),p=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),x=t.readFloat();switch(t.readByte()){case Le:n.setStepped(e);break;case qe:ce(t,n,s++,e,0,a,r,o,i,1),ce(t,n,s++,e,1,a,r,l,p,1),ce(t,n,s++,e,2,a,r,h,m,1),ce(t,n,s++,e,3,a,r,c,f,1),ce(t,n,s++,e,4,a,r,d,g,1),ce(t,n,s++,e,5,a,r,u,x,1)}a=r,o=i,l=p,h=m,c=f,d=g,u=x}r.push(n)}for(let e=0,n=t.readInt(!0);e<n;e++){let e=t.readInt(!0),n=s.pathConstraints[e];for(let s=0,a=t.readInt(!0);s<a;s++){const s=t.readByte(),a=t.readInt(!0),o=t.readInt(!0);switch(s){case Fe:r.push(le(t,new z(a,o,e),n.positionMode==exports.PositionMode.Fixed?i:1));break;case Ee:r.push(le(t,new G(a,o,e),n.spacingMode==exports.SpacingMode.Length||n.spacingMode==exports.SpacingMode.Fixed?i:1));break;case Re:let s=new $(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,r=0,i=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=i;e++){let i=t.readFloat(),n=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Le:s.setStepped(e);break;case qe:ce(t,s,r++,e,0,l,i,h,n,1),ce(t,s,r++,e,1,l,i,c,a,1),ce(t,s,r++,e,2,l,i,d,o,1)}l=i,h=n,c=a,d=o}r.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,i=t.readInt(!0);s<i;s++){const s=t.readByte(),i=t.readInt(!0);if(s==Ne){const s=new st(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat());r.push(s);continue}const n=t.readInt(!0);switch(s){case Ye:r.push(le(t,new H(i,n,e),1));break;case Pe:r.push(le(t,new J(i,n,e),1));break;case Xe:r.push(le(t,new K(i,n,e),1));break;case _e:r.push(le(t,new Q(i,n,e),1));break;case Ve:r.push(le(t,new Z(i,n,e),1));break;case De:r.push(le(t,new tt(i,n,e),1));break;case Oe:r.push(le(t,new et(i,n,e),1))}}}for(let e=0,n=t.readInt(!0);e<n;e++){let e=s.skins[t.readInt(!0)];for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readInt(!0);for(let n=0,a=t.readInt(!0);n<a;n++){let n=t.readStringRef();if(!n)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,n),o=t.readByte(),h=t.readInt(!0),c=h-1;switch(o){case Be:{let e=a,n=e.bones,o=e.vertices,d=n?o.length/3*2:o.length,u=t.readInt(!0),p=new N(h,u,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let r,a=t.readInt(!0);if(0==a)r=n?l.newFloatArray(d):o;else{r=l.newFloatArray(d);let e=t.readInt(!0);if(a+=e,1==i)for(let s=e;s<a;s++)r[s]=t.readFloat();else for(let s=e;s<a;s++)r[s]=t.readFloat()*i;if(!n)for(let t=0,e=r.length;t<e;t++)r[t]+=o[t]}if(p.setFrame(e,m,r),e==c)break;let h=t.readFloat();switch(t.readByte()){case Le:p.setStepped(e);break;case qe:ce(t,p,s++,e,0,m,h,0,1,1)}m=h}r.push(p);break}case Ce:{let e=new rt(h,s,a);for(let s=0;s<h;s++){let r=t.readFloat(),i=t.readInt32();e.setFrame(s,r,m[15&i],i>>4,t.readFloat())}r.push(e);break}}}}}let n=t.readInt(!0);if(n>0){let e=new q(n),i=s.slots.length;for(let s=0;s<n;s++){let r=t.readFloat(),n=t.readInt(!0),a=l.newArray(i,0);for(let t=i-1;t>=0;t--)a[t]=-1;let o=l.newArray(i-n,0),h=0,c=0;for(let e=0;e<n;e++){let e=t.readInt(!0);for(;h!=e;)o[c++]=h++;a[h+t.readInt(!0)]=h++}for(;h<i;)o[c++]=h++;for(let t=i-1;t>=0;t--)-1==a[t]&&(a[t]=o[--c]);e.setFrame(s,r,a)}r.push(e)}let a=t.readInt(!0);if(a>0){let e=new L(a);for(let r=0;r<a;r++){let i=t.readFloat(),n=s.events[t.readInt(!0)],a=new qt(i,n);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=n.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(r,a)}r.push(e)}let o=0;for(let t=0,e=r.length;t<e;t++)o=Math.max(o,r[t].getDuration());return new f(e,r,o)}}class ne{strings;index;buffer;constructor(t,e=new Array,s=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=r}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=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?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;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}class ae{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}}class oe{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}function le(t,e,s){let r=t.readFloat(),i=t.readFloat()*s;for(let n=0,a=0,o=e.getFrameCount()-1;e.setFrame(n,r,i),n!=o;n++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Le:e.setStepped(n);break;case qe:ce(t,e,a++,n,0,r,o,i,l,s)}r=o,i=l}return e}function he(t,e,s){let r=t.readFloat(),i=t.readFloat()*s,n=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,r,i,n),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Le:e.setStepped(a);break;case qe:ce(t,e,o++,a,0,r,l,i,h,s),ce(t,e,o++,a,1,r,l,n,c,s)}r=l,i=h,n=c}return e}function ce(t,e,s,r,i,n,a,o,l,h){e.setBezier(s,r,i,n,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,l)}!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(Tt||(Tt={}));const de=0,ue=1,pe=2,me=3,fe=4,ge=5,xe=6,we=7,be=8,ye=9,Me=10,Se=0,ve=1,ke=2,Ie=3,Ae=4,Te=5,Be=0,Ce=1,Fe=0,Ee=1,Re=2,Ye=0,Pe=1,Xe=2,_e=4,Ve=5,De=6,Oe=7,Ne=8,Le=1,qe=2;class Ue{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new h((()=>new Array));polygonIndicesPool=new h((()=>new Array));triangulate(t){let e=t,s=t.length>>1,r=this.indicesArray;r.length=0;for(let t=0;t<s;t++)r[t]=t;let i=this.isConcaveArray;i.length=0;for(let t=0,n=s;t<n;++t)i[t]=Ue.isConcave(t,s,e,r);let n=this.triangles;for(n.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!i[a]){let n=r[t]<<1,l=r[a]<<1,h=r[o]<<1,c=e[n],d=e[n+1],u=e[l],p=e[l+1],m=e[h],f=e[h+1];for(let n=(o+1)%s;n!=t;n=(n+1)%s){if(!i[n])continue;let t=r[n]<<1,s=e[t],a=e[t+1];if(Ue.positiveArea(m,f,c,d,s,a)&&Ue.positiveArea(c,d,u,p,s,a)&&Ue.positiveArea(u,p,m,f,s,a))break t}break}if(0==o){do{if(!i[a])break;a--}while(a>0);break}t=a,a=o,o=(o+1)%s}n.push(r[(s+a-1)%s]),n.push(r[a]),n.push(r[(a+1)%s]),r.splice(a,1),i.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;i[l]=Ue.isConcave(l,s,e,r),i[h]=Ue.isConcave(h,s,e,r)}return 3==s&&(n.push(r[2]),n.push(r[0]),n.push(r[1])),n}decompose(t,e){let s=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;let n=this.polygonIndicesPool.obtain();n.length=0;let a=this.polygonPool.obtain();a.length=0;let o=-1,l=0;for(let t=0,h=e.length;t<h;t+=3){let h=e[t]<<1,c=e[t+1]<<1,d=e[t+2]<<1,u=s[h],p=s[h+1],m=s[c],f=s[c+1],g=s[d],x=s[d+1],w=!1;if(o==h){let t=a.length-4,e=Ue.winding(a[t],a[t+1],a[t+2],a[t+3],g,x),s=Ue.winding(g,x,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(g),a.push(x),n.push(d),w=!0)}w||(a.length>0?(r.push(a),i.push(n)):(this.polygonPool.free(a),this.polygonIndicesPool.free(n)),a=this.polygonPool.obtain(),a.length=0,a.push(u),a.push(p),a.push(m),a.push(f),a.push(g),a.push(x),n=this.polygonIndicesPool.obtain(),n.length=0,n.push(h),n.push(c),n.push(d),l=Ue.winding(u,p,m,f,g,x),o=h)}a.length>0&&(r.push(a),i.push(n));for(let t=0,e=r.length;t<e;t++){if(n=i[t],0==n.length)continue;let s=n[0],o=n[n.length-1];a=r[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],p=a[0],m=a[1],f=a[2],g=a[3],x=Ue.winding(h,c,d,u,p,m);for(let l=0;l<e;l++){if(l==t)continue;let e=i[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],M=r[l],S=M[M.length-2],v=M[M.length-1];if(w!=s||b!=o)continue;let k=Ue.winding(h,c,d,u,S,v),I=Ue.winding(S,v,p,m,f,g);k==x&&I==x&&(M.length=0,e.length=0,a.push(S),a.push(v),n.push(y),h=d,c=u,d=S,u=v,l=0)}}for(let t=r.length-1;t>=0;t--)a=r[t],0==a.length&&(r.splice(t,1),this.polygonPool.free(a),n=i[t],i.splice(t,1),this.polygonIndicesPool.free(n));return r}static isConcave(t,e,s,r){let i=r[(e+t-1)%e]<<1,n=r[t]<<1,a=r[(t+1)%e]<<1;return!this.positiveArea(s[i],s[i+1],s[n],s[n+1],s[a],s[a+1])}static positiveArea(t,e,s,r,i,n){return t*(n-r)+s*(e-n)+i*(r-e)>=0}static winding(t,e,s,r,i,n){let a=s-t,o=r-e;return i*o-n*a+a*e-t*o>=0?1:-1}}class We{triangulator=new Ue;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,r=l.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,r,0,2);let i=this.clippingPolygon;We.makeClockwise(i);let n=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i));for(let t=0,e=n.length;t<e;t++){let e=n[t];We.makeClockwise(e),e.push(e[0]),e.push(e[1])}return n.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,r,i,n,a){r&&i&&n&&"boolean"==typeof a?this.clipTrianglesRender(t,e,s,r,i,n,a):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){let r=this.clipOutput,i=this.clippedVertices,n=this.clippedTriangles,a=this.clippingPolygons,o=a.length,h=0;i.length=0,n.length=0;for(let c=0;c<s;c+=3){let s=e[c]<<1,d=t[s],u=t[s+1];s=e[c+1]<<1;let p=t[s],m=t[s+1];s=e[c+2]<<1;let f=t[s],g=t[s+1];for(let t=0;t<o;t++){let e=i.length;if(!this.clip(d,u,p,m,f,g,a[t],r)){let t=l.setArraySize(i,e+6);t[e]=d,t[e+1]=u,t[e+2]=p,t[e+3]=m,t[e+4]=f,t[e+5]=g,e=n.length;let s=l.setArraySize(n,e+3);s[e]=h,s[e+1]=h+1,s[e+2]=h+2,h+=3;break}{let t=r.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=l.setArraySize(i,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],r=a[s+1];o[e]=t,o[e+1]=r}e=n.length;let c=l.setArraySize(n,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)c[e]=h,c[e+1]=h+t,c[e+2]=h+t+1;h+=s+1}}}}clipTrianglesRender(t,e,s,r,i,n,a){let o=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,p=a?12:8,m=0;h.length=0,c.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,g=t[s],x=t[s+1],w=r[s],b=r[s+1];s=e[f+1]<<1;let y=t[s],M=t[s+1],S=r[s],v=r[s+1];s=e[f+2]<<1;let k=t[s],I=t[s+1],A=r[s],T=r[s+1];for(let t=0;t<u;t++){let e=h.length;if(!this.clip(g,x,y,M,k,I,d[t],o)){let t=l.setArraySize(h,e+3*p);t[e]=g,t[e+1]=x,t[e+2]=i.r,t[e+3]=i.g,t[e+4]=i.b,t[e+5]=i.a,a?(t[e+6]=w,t[e+7]=b,t[e+8]=n.r,t[e+9]=n.g,t[e+10]=n.b,t[e+11]=n.a,t[e+12]=y,t[e+13]=M,t[e+14]=i.r,t[e+15]=i.g,t[e+16]=i.b,t[e+17]=i.a,t[e+18]=S,t[e+19]=v,t[e+20]=n.r,t[e+21]=n.g,t[e+22]=n.b,t[e+23]=n.a,t[e+24]=k,t[e+25]=I,t[e+26]=i.r,t[e+27]=i.g,t[e+28]=i.b,t[e+29]=i.a,t[e+30]=A,t[e+31]=T,t[e+32]=n.r,t[e+33]=n.g,t[e+34]=n.b,t[e+35]=n.a):(t[e+6]=w,t[e+7]=b,t[e+8]=y,t[e+9]=M,t[e+10]=i.r,t[e+11]=i.g,t[e+12]=i.b,t[e+13]=i.a,t[e+14]=S,t[e+15]=v,t[e+16]=k,t[e+17]=I,t[e+18]=i.r,t[e+19]=i.g,t[e+20]=i.b,t[e+21]=i.a,t[e+22]=A,t[e+23]=T),e=c.length;let s=l.setArraySize(c,e+3);s[e]=m,s[e+1]=m+1,s[e+2]=m+2,m+=3;break}{let t=o.length;if(0==t)continue;let s=M-I,r=k-y,d=g-k,u=I-x,f=1/(s*d+r*(x-I)),B=t>>1,C=this.clipOutput,F=l.setArraySize(h,e+B*p);for(let o=0;o<t;o+=2,e+=p){let t=C[o],l=C[o+1];F[e]=t,F[e+1]=l,F[e+2]=i.r,F[e+3]=i.g,F[e+4]=i.b,F[e+5]=i.a;let h=t-k,c=l-I,p=(s*h+r*c)*f,m=(u*h+d*c)*f,g=1-p-m;F[e+6]=w*p+S*m+A*g,F[e+7]=b*p+v*m+T*g,a&&(F[e+8]=n.r,F[e+9]=n.g,F[e+10]=n.b,F[e+11]=n.a)}e=c.length;let E=l.setArraySize(c,e+3*(B-2));B--;for(let t=1;t<B;t++,e+=3)E[e]=m,E[e+1]=m+t,E[e+2]=m+t+1;m+=B+1}}}}clipTrianglesUnpacked(t,e,s,r){let i=this.clipOutput,n=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,h=this.clippingPolygons,c=h.length,d=0;n.length=0,a.length=0,o.length=0;for(let u=0;u<s;u+=3){let s=e[u]<<1,p=t[s],m=t[s+1],f=r[s],g=r[s+1];s=e[u+1]<<1;let x=t[s],w=t[s+1],b=r[s],y=r[s+1];s=e[u+2]<<1;let M=t[s],S=t[s+1],v=r[s],k=r[s+1];for(let t=0;t<c;t++){let e=n.length;if(!this.clip(p,m,x,w,M,S,h[t],i)){let t=l.setArraySize(n,e+6);t[e]=p,t[e+1]=m,t[e+2]=x,t[e+3]=w,t[e+4]=M,t[e+5]=S;let s=l.setArraySize(a,e+6);s[e]=f,s[e+1]=g,s[e+2]=b,s[e+3]=y,s[e+4]=v,s[e+5]=k,e=o.length;let r=l.setArraySize(o,e+3);r[e]=d,r[e+1]=d+1,r[e+2]=d+2,d+=3;break}{let t=i.length;if(0==t)continue;let s=w-S,r=M-x,h=p-M,c=S-m,u=1/(s*h+r*(m-S)),I=t>>1,A=this.clipOutput,T=l.setArraySize(n,e+2*I),B=l.setArraySize(a,e+2*I);for(let i=0;i<t;i+=2,e+=2){let t=A[i],n=A[i+1];T[e]=t,T[e+1]=n;let a=t-M,o=n-S,l=(s*a+r*o)*u,d=(c*a+h*o)*u,p=1-l-d;B[e]=f*l+b*d+v*p,B[e+1]=g*l+y*d+k*p}e=o.length;let C=l.setArraySize(o,e+3*(I-2));I--;for(let t=1;t<I;t++,e+=3)C[e]=d,C[e+1]=d+t,C[e+2]=d+t+1;d+=I+1}}}}clip(t,e,s,r,i,n,a,o){let l,h=o,c=!1;a.length%4>=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(s),l.push(r),l.push(i),l.push(n),l.push(t),l.push(e),o.length=0;let d=a.length-4,u=a;for(let t=0;;t+=2){let e=u[t],s=u[t+1],r=e-u[t+2],i=s-u[t+3],n=o.length,a=l;for(let t=0,n=l.length-2;t<n;){let n=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=i*(e-h)>r*(s-d),p=i*(e-n)-r*(s-l);if(p>0){if(u){o.push(h),o.push(d);continue}let t=h-n,e=d-l,s=p/(t*i-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s)}else if(u){let t=h-n,e=d-l,s=p/(t*i-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(n==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let p=o;(o=l).length=0,l=p}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,r=e[s-2]*e[1]-e[0]*e[s-1],i=0,n=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)i=e[t],n=e[t+1],a=e[t+2],o=e[t+3],r+=i*o-a*n;if(!(r<0))for(let t=0,r=s-2,i=s>>1;t<i;t+=2){let s=e[t],i=e[t+1],n=r-t;e[t]=e[n],e[t+1]=e[n+1],e[n]=s,e[n+1]=i}}}class ze{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Zt,r="string"==typeof t?JSON.parse(t):t,n=r.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=Je(n,"referenceScale",100)*e,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),r.bones)for(let t=0;t<r.bones.length;t++){let i=r.bones[t],n=null,a=Je(i,"parent",null);a&&(n=s.findBone(a));let o=new Dt(s.bones.length,i.name,n);o.length=Je(i,"length",0)*e,o.x=Je(i,"x",0)*e,o.y=Je(i,"y",0)*e,o.rotation=Je(i,"rotation",0),o.scaleX=Je(i,"scaleX",1),o.scaleY=Je(i,"scaleY",1),o.shearX=Je(i,"shearX",0),o.shearY=Je(i,"shearY",0),o.inherit=l.enumValue(exports.Inherit,Je(i,"inherit","Normal")),o.skinRequired=Je(i,"skin",!1);let h=Je(i,"color",null);h&&o.color.setFromString(h),s.bones.push(o)}if(r.slots)for(let t=0;t<r.slots.length;t++){let e=r.slots[t],n=e.name,a=s.findBone(e.bone);if(!a)throw new Error(`Couldn't find bone ${e.bone} for slot ${n}`);let o=new se(s.slots.length,n,a),h=Je(e,"color",null);h&&o.color.setFromString(h);let c=Je(e,"dark",null);c&&(o.darkColor=i.fromString(c)),o.attachmentName=Je(e,"attachment",null),o.blendMode=l.enumValue(exports.BlendMode,Je(e,"blend","normal")),o.visible=Je(e,"visible",!0),s.slots.push(o)}if(r.ik)for(let t=0;t<r.ik.length;t++){let i=r.ik[t],n=new zt(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=s.findBone(i.bones[t]);if(!e)throw new Error(`Couldn't find bone ${i.bones[t]} for IK constraint ${i.name}.`);n.bones.push(e)}let a=s.findBone(i.target);if(!a)throw new Error(`Couldn't find target bone ${i.target} for IK constraint ${i.name}.`);n.target=a,n.mix=Je(i,"mix",1),n.softness=Je(i,"softness",0)*e,n.bendDirection=Je(i,"bendPositive",!0)?1:-1,n.compress=Je(i,"compress",!1),n.stretch=Je(i,"stretch",!1),n.uniform=Je(i,"uniform",!1),s.ikConstraints.push(n)}if(r.transform)for(let t=0;t<r.transform.length;t++){let i=r.transform[t],n=new re(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for transform constraint ${i.name}.`);n.bones.push(r)}let a=i.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${i.name}.`);n.target=o,n.local=Je(i,"local",!1),n.relative=Je(i,"relative",!1),n.offsetRotation=Je(i,"rotation",0),n.offsetX=Je(i,"x",0)*e,n.offsetY=Je(i,"y",0)*e,n.offsetScaleX=Je(i,"scaleX",0),n.offsetScaleY=Je(i,"scaleY",0),n.offsetShearY=Je(i,"shearY",0),n.mixRotate=Je(i,"mixRotate",1),n.mixX=Je(i,"mixX",1),n.mixY=Je(i,"mixY",n.mixX),n.mixScaleX=Je(i,"mixScaleX",1),n.mixScaleY=Je(i,"mixScaleY",n.mixScaleX),n.mixShearY=Je(i,"mixShearY",1),s.transformConstraints.push(n)}if(r.path)for(let t=0;t<r.path.length;t++){let i=r.path[t],n=new Gt(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for path constraint ${i.name}.`);n.bones.push(r)}let a=i.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${i.name}.`);n.target=o,n.positionMode=l.enumValue(exports.PositionMode,Je(i,"positionMode","Percent")),n.spacingMode=l.enumValue(exports.SpacingMode,Je(i,"spacingMode","Length")),n.rotateMode=l.enumValue(exports.RotateMode,Je(i,"rotateMode","Tangent")),n.offsetRotation=Je(i,"rotation",0),n.position=Je(i,"position",0),n.positionMode==exports.PositionMode.Fixed&&(n.position*=e),n.spacing=Je(i,"spacing",0),n.spacingMode!=exports.SpacingMode.Length&&n.spacingMode!=exports.SpacingMode.Fixed||(n.spacing*=e),n.mixRotate=Je(i,"mixRotate",1),n.mixX=Je(i,"mixX",1),n.mixY=Je(i,"mixY",n.mixX),s.pathConstraints.push(n)}if(r.physics)for(let t=0;t<r.physics.length;t++){const i=r.physics[t],n=new Qt(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);const a=i.bone,o=s.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);n.bone=o,n.x=Je(i,"x",0),n.y=Je(i,"y",0),n.rotate=Je(i,"rotate",0),n.scaleX=Je(i,"scaleX",0),n.shearX=Je(i,"shearX",0),n.limit=Je(i,"limit",5e3)*e,n.step=1/Je(i,"fps",60),n.inertia=Je(i,"inertia",1),n.strength=Je(i,"strength",100),n.damping=Je(i,"damping",1),n.massInverse=1/Je(i,"mass",1),n.wind=Je(i,"wind",0),n.gravity=Je(i,"gravity",0),n.mix=Je(i,"mix",1),n.inertiaGlobal=Je(i,"inertiaGlobal",!1),n.strengthGlobal=Je(i,"strengthGlobal",!1),n.dampingGlobal=Je(i,"dampingGlobal",!1),n.massGlobal=Je(i,"massGlobal",!1),n.windGlobal=Je(i,"windGlobal",!1),n.gravityGlobal=Je(i,"gravityGlobal",!1),n.mixGlobal=Je(i,"mixGlobal",!1),s.physicsConstraints.push(n)}if(r.skins)for(let t=0;t<r.skins.length;t++){let e=r.skins[t],i=new ee(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let r=e.bones[t],n=s.findBone(r);if(!n)throw new Error(`Couldn't find bone ${r} for skin ${e.name}.`);i.bones.push(n)}if(e.ik)for(let t=0;t<e.ik.length;t++){let r=e.ik[t],n=s.findIkConstraint(r);if(!n)throw new Error(`Couldn't find IK constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.transform)for(let t=0;t<e.transform.length;t++){let r=e.transform[t],n=s.findTransformConstraint(r);if(!n)throw new Error(`Couldn't find transform constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.path)for(let t=0;t<e.path.length;t++){let r=e.path[t],n=s.findPathConstraint(r);if(!n)throw new Error(`Couldn't find path constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.physics)for(let t=0;t<e.physics.length;t++){let r=e.physics[t],n=s.findPhysicsConstraint(r);if(!n)throw new Error(`Couldn't find physics constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}for(let t in e.attachments){let r=s.findSlot(t);if(!r)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let n=e.attachments[t];for(let t in n){let e=this.readAttachment(n[t],i,r.index,t,s);e&&i.setAttachment(r.index,t,e)}}s.skins.push(i),"default"==i.name&&(s.defaultSkin=i)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],r=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!r)throw new Error(`Skin not found: ${e.skin}`);let i=r.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let t in r.events){let e=r.events[t],i=new Ut(t);i.intValue=Je(e,"int",0),i.floatValue=Je(e,"float",0),i.stringValue=Je(e,"string",""),i.audioPath=Je(e,"audio",null),i.audioPath&&(i.volume=Je(e,"volume",1),i.balance=Je(e,"balance",0)),s.events.push(i)}if(r.animations)for(let t in r.animations){let e=r.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,r,i){let n=this.scale;switch(r=Je(t,"name",r),Je(t,"type","region")){case"region":{let s=Je(t,"path",r),i=this.readSequence(Je(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,r,s,i);if(!a)return null;a.path=s,a.x=Je(t,"x",0)*n,a.y=Je(t,"y",0)*n,a.scaleX=Je(t,"scaleX",1),a.scaleY=Je(t,"scaleY",1),a.rotation=Je(t,"rotation",0),a.width=t.width*n,a.height=t.height*n,a.sequence=i;let o=Je(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let i=Je(t,"color",null);return i&&s.color.setFromString(i),s}case"mesh":case"linkedmesh":{let i=Je(t,"path",r),a=this.readSequence(Je(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,r,i,a);if(!o)return null;o.path=i;let l=Je(t,"color",null);l&&o.color.setFromString(l),o.width=Je(t,"width",0)*n,o.height=Je(t,"height",0)*n,o.sequence=a;let h=Je(t,"parent",null);if(h)return this.linkedMeshes.push(new Ge(o,Je(t,"skin",null),s,h,Je(t,"timelines",!0))),o;let c=t.uvs;return this.readVertices(t,o,c.length),o.triangles=t.triangles,o.regionUVs=c,null!=o.region&&o.updateRegion(),o.edges=Je(t,"edges",null),o.hullLength=2*Je(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,r);if(!s)return null;s.closed=Je(t,"closed",!1),s.constantSpeed=Je(t,"constantSpeed",!0);let i=t.vertexCount;this.readVertices(t,s,i<<1);let a=l.newArray(i/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*n;s.lengths=a;let o=Je(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,r);if(!s)return null;s.x=Je(t,"x",0)*n,s.y=Je(t,"y",0)*n,s.rotation=Je(t,"rotation",0);let i=Je(t,"color",null);return i&&s.color.setFromString(i),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,r);if(!s)return null;let n=Je(t,"end",null);n&&(s.endSlot=i.findSlot(n));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=Je(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new p(Je(t,"count",0));return e.start=Je(t,"start",1),e.digits=Je(t,"digits",0),e.setupIndex=Je(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let t=l.toFloatArray(i);if(1!=r)for(let e=0,s=i.length;e<s;e++)t[e]*=r;return void(e.vertices=t)}let n=new Array,a=new Array;for(let t=0,e=i.length;t<e;){let e=i[t++];a.push(e);for(let s=t+4*e;t<s;t+=4)a.push(i[t]),n.push(i[t+1]*r),n.push(i[t+2]*r),n.push(i[t+3])}e.bones=a,e.vertices=l.toFloatArray(n)}readAnimation(e,s,r){let n=this.scale,a=new Array;if(e.slots)for(let t in e.slots){let s=e.slots[t],n=r.findSlot(t);if(!n)throw new Error("Slot not found: "+t);let o=n.index;for(let t in s){let e=s[t];if(!e)continue;let r=e.length;if("attachment"==t){let t=new O(r,o);for(let s=0;s<r;s++){let r=e[s];t.setFrame(s,Je(r,"time",0),Je(r,"name",null))}a.push(t)}else if("rgba"==t){let t=new P(r,r<<2,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.color);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b,l.a);let o=e[r+1];if(!o){t.shrink(a);break}let h=Je(o,"time",0),c=i.fromString(o.color),d=s.curve;d&&(a=He(d,t,a,r,0,n,h,l.r,c.r,1),a=He(d,t,a,r,1,n,h,l.g,c.g,1),a=He(d,t,a,r,2,n,h,l.b,c.b,1),a=He(d,t,a,r,3,n,h,l.a,c.a,1)),n=h,l=c,s=o}a.push(t)}else if("rgb"==t){let t=new X(r,3*r,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.color);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b);let o=e[r+1];if(!o){t.shrink(a);break}let h=Je(o,"time",0),c=i.fromString(o.color),d=s.curve;d&&(a=He(d,t,a,r,0,n,h,l.r,c.r,1),a=He(d,t,a,r,1,n,h,l.g,c.g,1),a=He(d,t,a,r,2,n,h,l.b,c.b,1)),n=h,l=c,s=o}a.push(t)}else if("alpha"==t)a.push($e(e,new _(r,r,o),0,1));else if("rgba2"==t){let t=new V(r,7*r,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.light),h=i.fromString(s.dark);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b,l.a,h.r,h.g,h.b);let o=e[r+1];if(!o){t.shrink(a);break}let c=Je(o,"time",0),d=i.fromString(o.light),u=i.fromString(o.dark),p=s.curve;p&&(a=He(p,t,a,r,0,n,c,l.r,d.r,1),a=He(p,t,a,r,1,n,c,l.g,d.g,1),a=He(p,t,a,r,2,n,c,l.b,d.b,1),a=He(p,t,a,r,3,n,c,l.a,d.a,1),a=He(p,t,a,r,4,n,c,h.r,u.r,1),a=He(p,t,a,r,5,n,c,h.g,u.g,1),a=He(p,t,a,r,6,n,c,h.b,u.b,1)),n=c,l=d,h=u,s=o}a.push(t)}else if("rgb2"==t){let t=new D(r,6*r,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.light),h=i.fromString(s.dark);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b,h.r,h.g,h.b);let o=e[r+1];if(!o){t.shrink(a);break}let c=Je(o,"time",0),d=i.fromString(o.light),u=i.fromString(o.dark),p=s.curve;p&&(a=He(p,t,a,r,0,n,c,l.r,d.r,1),a=He(p,t,a,r,1,n,c,l.g,d.g,1),a=He(p,t,a,r,2,n,c,l.b,d.b,1),a=He(p,t,a,r,3,n,c,h.r,u.r,1),a=He(p,t,a,r,4,n,c,h.g,u.g,1),a=He(p,t,a,r,5,n,c,h.b,u.b,1)),n=c,l=d,h=u,s=o}a.push(t)}}}if(e.bones)for(let t in e.bones){let s=e.bones[t],i=r.findBone(t);if(!i)throw new Error("Bone not found: "+t);let o=i.index;for(let t in s){let e=s[t],r=e.length;if(0!=r)if("rotate"===t)a.push($e(e,new v(r,r,o),0,1));else if("translate"===t){let t=new k(r,r<<1,o);a.push(je(e,t,"x","y",0,n))}else if("translatex"===t){let t=new I(r,r,o);a.push($e(e,t,0,n))}else if("translatey"===t){let t=new A(r,r,o);a.push($e(e,t,0,n))}else if("scale"===t){let t=new T(r,r<<1,o);a.push(je(e,t,"x","y",1,1))}else if("scalex"===t){let t=new B(r,r,o);a.push($e(e,t,1,1))}else if("scaley"===t){let t=new C(r,r,o);a.push($e(e,t,1,1))}else if("shear"===t){let t=new F(r,r<<1,o);a.push(je(e,t,"x","y",0,1))}else if("shearx"===t){let t=new E(r,r,o);a.push($e(e,t,0,1))}else if("sheary"===t){let t=new R(r,r,o);a.push($e(e,t,0,1))}else if("inherit"===t){let t=new Y(r,i.index);for(let s=0;s<e.length;s++){let r=e[s];t.setFrame(s,Je(r,"time",0),l.enumValue(exports.Inherit,Je(r,"inherit","Normal")))}a.push(t)}}}if(e.ik)for(let t in e.ik){let s=e.ik[t],i=s[0];if(!i)continue;let o=r.findIkConstraint(t);if(!o)throw new Error("IK Constraint not found: "+t);let l=r.ikConstraints.indexOf(o),h=new U(s.length,s.length<<1,l),c=Je(i,"time",0),d=Je(i,"mix",1),u=Je(i,"softness",0)*n;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Je(i,"bendPositive",!0)?1:-1,Je(i,"compress",!1),Je(i,"stretch",!1));let r=s[t+1];if(!r){h.shrink(e);break}let a=Je(r,"time",0),o=Je(r,"mix",1),l=Je(r,"softness",0)*n,p=i.curve;p&&(e=He(p,h,e,t,0,c,a,d,o,1),e=He(p,h,e,t,1,c,a,u,l,n)),c=a,d=o,u=l,i=r}a.push(h)}if(e.transform)for(let t in e.transform){let s=e.transform[t],i=s[0];if(!i)continue;let n=r.findTransformConstraint(t);if(!n)throw new Error("Transform constraint not found: "+t);let o=r.transformConstraints.indexOf(n),l=new W(s.length,6*s.length,o),h=Je(i,"time",0),c=Je(i,"mixRotate",1),d=Je(i,"mixX",1),u=Je(i,"mixY",d),p=Je(i,"mixScaleX",1),m=Je(i,"mixScaleY",p),f=Je(i,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,p,m,f);let r=s[t+1];if(!r){l.shrink(e);break}let n=Je(r,"time",0),a=Je(r,"mixRotate",1),o=Je(r,"mixX",1),g=Je(r,"mixY",o),x=Je(r,"mixScaleX",1),w=Je(r,"mixScaleY",x),b=Je(r,"mixShearY",1),y=i.curve;y&&(e=He(y,l,e,t,0,h,n,c,a,1),e=He(y,l,e,t,1,h,n,d,o,1),e=He(y,l,e,t,2,h,n,u,g,1),e=He(y,l,e,t,3,h,n,p,x,1),e=He(y,l,e,t,4,h,n,m,w,1),e=He(y,l,e,t,5,h,n,f,b,1)),h=n,c=a,d=o,u=g,p=x,m=w,p=x,i=r}a.push(l)}if(e.path)for(let t in e.path){let s=e.path[t],i=r.findPathConstraint(t);if(!i)throw new Error("Path constraint not found: "+t);let o=r.pathConstraints.indexOf(i);for(let t in s){let e=s[t],r=e[0];if(!r)continue;let l=e.length;if("position"===t){let t=new z(l,l,o);a.push($e(e,t,0,i.positionMode==exports.PositionMode.Fixed?n:1))}else if("spacing"===t){let t=new G(l,l,o);a.push($e(e,t,0,i.spacingMode==exports.SpacingMode.Length||i.spacingMode==exports.SpacingMode.Fixed?n:1))}else if("mix"===t){let t=new $(l,3*l,o),s=Je(r,"time",0),i=Je(r,"mixRotate",1),n=Je(r,"mixX",1),h=Je(r,"mixY",n);for(let a=0,o=0;;a++){t.setFrame(a,s,i,n,h);let l=e[a+1];if(!l){t.shrink(o);break}let c=Je(l,"time",0),d=Je(l,"mixRotate",1),u=Je(l,"mixX",1),p=Je(l,"mixY",u),m=r.curve;m&&(o=He(m,t,o,a,0,s,c,i,d,1),o=He(m,t,o,a,1,s,c,n,u,1),o=He(m,t,o,a,2,s,c,h,p,1)),s=c,i=d,n=u,h=p,r=l}a.push(t)}}}if(e.physics)for(let t in e.physics){let s=e.physics[t],i=-1;if(t.length>0){let e=r.findPhysicsConstraint(t);if(!e)throw new Error("Physics constraint not found: "+t);i=r.physicsConstraints.indexOf(e)}for(let t in s){let e=s[t],r=e[0];if(!r)continue;let n,o=e.length;if("reset"!=t){if("inertia"==t)n=new H(o,o,i);else if("strength"==t)n=new J(o,o,i);else if("damping"==t)n=new K(o,o,i);else if("mass"==t)n=new Q(o,o,i);else if("wind"==t)n=new Z(o,o,i);else if("gravity"==t)n=new tt(o,o,i);else{if("mix"!=t)continue;n=new et(o,o,i)}a.push($e(e,n,0,1))}else{const t=new st(o,i);for(let s=0;null!=r;r=e[s+1],s++)t.setFrame(s,Je(r,"time",0));a.push(t)}}}if(e.attachments)for(let s in e.attachments){let i=e.attachments[s],o=r.findSkin(s);if(!o)throw new Error("Skin not found: "+s);for(let e in i){let s=i[e],h=r.findSlot(e);if(!h)throw new Error("Slot not found: "+e);let c=h.index;for(let e in s){let r=s[e],i=o.getAttachment(c,e);for(let e in r){let s=r[e],o=s[0];if(o)if("deform"==e){let t=i.bones,e=i.vertices,r=t?e.length/3*2:e.length,h=new N(s.length,s.length,c,i),d=Je(o,"time",0);for(let i=0,a=0;;i++){let c,u=Je(o,"vertices",null);if(u){c=l.newFloatArray(r);let s=Je(o,"offset",0);if(l.arrayCopy(u,0,c,s,u.length),1!=n)for(let t=s,e=t+u.length;t<e;t++)c[t]*=n;if(!t)for(let t=0;t<r;t++)c[t]+=e[t]}else c=t?l.newFloatArray(r):e;h.setFrame(i,d,c);let p=s[i+1];if(!p){h.shrink(a);break}let m=Je(p,"time",0),f=o.curve;f&&(a=He(f,h,a,i,0,d,m,0,1,1)),d=m,o=p}a.push(h)}else if("sequence"==e){let e=new rt(s.length,c,i),r=0;for(let i=0;i<s.length;i++){let n=Je(o,"delay",r),a=Je(o,"time",0),l=t[Je(o,"mode","hold")],h=Je(o,"index",0);e.setFrame(i,a,l,h,n),r=n,o=s[i+1]}a.push(e)}}}}}if(e.drawOrder){let t=new q(e.drawOrder.length),s=r.slots.length,i=0;for(let n=0;n<e.drawOrder.length;n++,i++){let a=e.drawOrder[n],o=null,h=Je(a,"offsets",null);if(h){o=l.newArray(s,-1);let t=l.newArray(s-h.length,0),e=0,i=0;for(let s=0;s<h.length;s++){let n=h[s],a=r.findSlot(n.slot);if(!a)throw new Error("Slot not found: "+a);let l=a.index;for(;e!=l;)t[i++]=e++;o[e+n.offset]=e++}for(;e<s;)t[i++]=e++;for(let e=s-1;e>=0;e--)-1==o[e]&&(o[e]=t[--i])}t.setFrame(i,Je(a,"time",0),o)}a.push(t)}if(e.events){let t=new L(e.events.length),s=0;for(let i=0;i<e.events.length;i++,s++){let n=e.events[i],a=r.findEvent(n.name);if(!a)throw new Error("Event not found: "+n.name);let o=new qt(l.toSinglePrecision(Je(n,"time",0)),a);o.intValue=Je(n,"int",a.intValue),o.floatValue=Je(n,"float",a.floatValue),o.stringValue=Je(n,"string",a.stringValue),o.data.audioPath&&(o.volume=Je(n,"volume",1),o.balance=Je(n,"balance",0)),t.setFrame(s,o)}a.push(t)}let o=0;for(let t=0,e=a.length;t<e;t++)o=Math.max(o,a[t].getDuration());r.animations.push(new f(s,a,o))}}class Ge{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}}function $e(t,e,s,r){let i=t[0],n=Je(i,"time",0),a=Je(i,"value",s)*r,o=0;for(let l=0;;l++){e.setFrame(l,n,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Je(h,"time",0),d=Je(h,"value",s)*r;i.curve&&(o=He(i.curve,e,o,l,0,n,c,a,d,r)),n=c,a=d,i=h}}function je(t,e,s,r,i,n){let a=t[0],o=Je(a,"time",0),l=Je(a,s,i)*n,h=Je(a,r,i)*n,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let p=Je(u,"time",0),m=Je(u,s,i)*n,f=Je(u,r,i)*n,g=a.curve;g&&(c=He(g,e,c,d,0,o,p,l,m,n),c=He(g,e,c,d,1,o,p,h,f,n)),o=p,l=m,h=f,a=u}}function He(t,e,s,r,i,n,a,o,l,h){if("stepped"==t)return e.setStepped(r),s;let c=i<<2,d=t[c],u=t[c+1]*h,p=t[c+2],m=t[c+3]*h;return e.setBezier(s,r,i,n,o,d,u,p,m,a,l),s+1}function Je(t,e,s){return void 0!==t[e]?t[e]:s}var Ke;function Qe(t,e,s){const r=new Vt(t);return"json"===s?new ze(r).readSkeletonData(e):new ie(r).readSkeletonData(new Uint8Array(e))}async function Ze(t,s,r){let i;const n=t.map(((t,i)=>{const n=s[i];let a=e.AssetType.Texture2D;return"ktx"===n?a=e.AssetType.KTX:"ktx2"===n&&(a=e.AssetType.KTX2),ss(t,r,a)}));try{i=await Promise.all(n)}catch(t){throw t}return i}async function ts(t,s){const r=function(t){const e=new URL(t),s=e.origin+e.pathname;return s.endsWith("/")?s:s.substring(0,s.lastIndexOf("/")+1)}(t);let i,n;try{i=await e.request(t,{type:"text"})}catch(e){throw new Error(`Spine Atlas: ${t} load error: ${e}`)}let a=new Ct(i);const o=[];for(let t of a.pages){const e=r+t.name;o.push(ss(e,s))}try{n=await Promise.all(o)}catch(t){throw new Error(`Spine Texture: load error: ${t}`)}return a=es(i,n),a}function es(t,e){const s=new Ct(t);return s.pages.forEach(((t,s)=>{const r=function(t){return new rs(new Image,t)}(e.find((e=>e.name===t.name))||e[s]);t.setTexture(r)})),s}function ss(t,s,r=e.AssetType.Texture2D){return s.resourceManager.load({url:t,type:r})}void 0===Math.fround&&(Math.fround=(Ke=new Float32Array(1),function(t){return Ke[0]=t,Ke[0]}));class rs extends wt{constructor(t,e){super(t),this.texture=e,this.texture.generateMipmaps()}getImage(){return this.texture}setFilters(t,s){t===exports.TextureFilter.Nearest?this.texture.filterMode=e.TextureFilterMode.Point:s===exports.TextureFilter.MipMapLinearLinear?this.texture.filterMode=e.TextureFilterMode.Trilinear:this.texture.filterMode=e.TextureFilterMode.Bilinear}setWraps(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)}dispose(){}_convertWrapMode(t){switch(t){case exports.TextureWrap.ClampToEdge:return e.TextureWrapMode.Clamp;case exports.TextureWrap.Repeat:return e.TextureWrapMode.Repeat;case exports.TextureWrap.MirroredRepeat:return e.TextureWrapMode.Mirror;default:throw new Error("Unsupported texture wrap mode.")}}}class is{constructor(t,e=1){this._type=t,this._lastElementIndex=e-1;const s=this._elements=new Array(e);for(let r=0;r<e;++r)s[r]=new t}get(){return this._lastElementIndex<0?new this._type:this._elements[this._lastElementIndex--]}return(t){this._elements[++this._lastElementIndex]=t}}class ns{constructor(t){this._usedElementCount=0,this._type=t,this._elements=[]}get(){const{_usedElementCount:t,_elements:e}=this;if(this._usedElementCount++,e.length===t){const t=new this._type;return e.push(t),t}return e[t]}clear(){this._usedElementCount=0}}const{SourceAlpha:as,One:os,DestinationColor:ls,Zero:hs,OneMinusSourceColor:cs,OneMinusSourceAlpha:ds}=e.BlendFactor,{Add:us}=e.BlendOperation;function ps(t,e){const s=t.renderState.blendState.targetBlendState;switch(e){case exports.BlendMode.Additive:s.sourceColorBlendFactor=as,s.destinationColorBlendFactor=os,s.sourceAlphaBlendFactor=os,s.destinationAlphaBlendFactor=os,s.colorBlendOperation=s.alphaBlendOperation=us;break;case exports.BlendMode.Multiply:s.sourceColorBlendFactor=ls,s.destinationColorBlendFactor=ds,s.sourceAlphaBlendFactor=os,s.destinationAlphaBlendFactor=ds,s.colorBlendOperation=s.alphaBlendOperation=us;break;case exports.BlendMode.Screen:s.sourceColorBlendFactor=os,s.destinationColorBlendFactor=cs,s.sourceAlphaBlendFactor=os,s.destinationAlphaBlendFactor=cs,s.colorBlendOperation=s.alphaBlendOperation=us;break;default:s.sourceColorBlendFactor=as,s.destinationColorBlendFactor=ds,s.sourceAlphaBlendFactor=os,s.destinationAlphaBlendFactor=ds,s.colorBlendOperation=s.alphaBlendOperation=us}}class ms{}const fs=1/0,gs=-1/0;class xs{static{this.QUAD_TRIANGLES=[0,1,2,2,3,0]}static{this.VERTEX_SIZE=8}static{this.VERTEX_STRIDE=9}static{this.tempDark=new i}static{this.tempColor=new i}static{this.tempVerts=new Array(8)}static{this.tempBlendMode=null}static{this.tempTexture=null}static{this.subPrimitivePool=new is(e.SubPrimitive)}static{this.subRenderItemPool=new ns(ms)}static{this.bounds=new e.BoundingBox(new e.Vector3(fs,fs,fs),new e.Vector3(gs,gs,gs))}getMaxVertexCount(t){const e=new Set,{skins:s}=t,r=s.length;for(let t=0;t<r;t++){const r=s[t];this._collectUniqueAttachments(r,e)}return this._calculateTotalVertexCount(e)}buildPrimitive(t,e){const{useClipping:s=!0,zSpacing:r=.01}=e.setting,{_clipper:i,_separateSlots:n,_subRenderItems:a,_separateSlotTextureMap:o}=this,{bounds:l}=xs;l.min.set(fs,fs,fs),l.max.set(gs,gs,gs);let h=0,c=0;const d=t.drawOrder,u=d.length,{engine:p,_indices:m,_vertices:f,_subPrimitives:g}=e;let{tempVerts:x,tempTexture:w,tempBlendMode:b,subRenderItemPool:y,subPrimitivePool:M}=xs;a.length=0,y.clear();let S,v,k=e._vertices,I=0,A=0,T=exports.BlendMode.Normal,B=null,C=0;xs.tempBlendMode=null,xs.tempTexture=null;for(let t=0;t<u;++t){const e=d[t];if(!e.bone.active){i.clipEndWithSlot(e);continue}const l=e.getAttachment();let u=null;const p=r*t;let F=0;const E=i.isClipping();let R=E?2:xs.VERTEX_SIZE;if(l){switch(l.constructor){case _t:const t=l;u=t.color,F=4*R,t.computeWorldVertices(e,x,0,R),S=xs.QUAD_TRIANGLES,v=t.uvs,B=t.region.texture;break;case Yt:const r=l;u=r.color,F=(r.worldVerticesLength>>1)*R,F>k.length&&(xs.tempVerts=new Array(F)),r.computeWorldVertices(e,0,r.worldVerticesLength,x,0,R),S=r.triangles,v=r.uvs,B=r.region.texture;break;case xt:if(s){let t=l;i.clipStart(e,t)}continue;default:s&&i.clipEndWithSlot(e);continue}if(null!=B){let t,s,r,l,d=e.bone.skeleton.color,k=e.color,Y=d.a*k.a*u.a,P=xs.tempColor,X=xs.tempDark;if(P.set(d.r*k.r*u.r,d.g*k.g*u.g,d.b*k.b*u.b,Y),E)i.clipTriangles(x,S,S.length,v,P,X,!1),t=i.clippedVertices,s=t.length,r=i.clippedTriangles,l=r.length;else{let e=x;const{r:i,g:n,b:a,a:o}=P;for(let t=2,s=0,r=F;t<r;t+=R,s+=2)e[t]=i,e[t+1]=n,e[t+2]=a,e[t+3]=o,e[t+4]=v[s],e[t+5]=v[s+1];t=x,s=F,r=S,l=S.length}if(0==s||0==l){i.clipEndWithSlot(e);continue}let _=h/xs.VERTEX_STRIDE,V=f,D=h,O=0;for(;O<s;){let e=t[O++],s=t[O++];V[D++]=e,V[D++]=s,V[D++]=p,V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],this._expandByPoint(e,s,p)}h=D;let N=m;for(D=c,O=0;O<l;D++,O++)N[D]=r[O]+_;c+=l;const L=e.data,q=L.name;T=L.blendMode;const U=null!==b&&b!==L.blendMode,W=null!==w&&w!==B,z=n.get(q);if(z||U||W){if(A>0){const t=g[C];t&&C++;const e=t||M.get();e.start=I,e.count=A;const s=y.get();s.subPrimitive=e,s.texture=w,s.blendMode=b,a.push(s),I+=A,A=0}if(z){const t=o.get(q);if(t){const e=B.texture;t.filterMode=e.filterMode,t.wrapModeU=e.wrapModeU,t.wrapModeV=e.wrapModeV}const e=g[C];e&&C++;const s=e||M.get();s.start=I,s.count=l;const r=y.get();r.blendMode=T,r.subPrimitive=s,r.texture=B,r.slotName=q,a.push(r),I+=l,A=0}else A+=l}else A+=l;w=B,b=T}i.clipEndWithSlot(e)}else s&&i.clipEndWithSlot(e)}if(A>0){const t=g[C];t&&C++;const e=t||M.get();e.start=I,e.count=A;const s=y.get();s.blendMode=T,s.subPrimitive=e,s.texture=B,a.push(s),A=0}i.clipEnd();const F=g.length,E=a.length;if(E<F)for(let t=E;t<F;t++){const e=g[t];M.return(e)}e._clearSubPrimitives();for(let t=0,s=E;t<s;++t){const s=a[t],{slotName:r,blendMode:i,texture:n}=s;e._addSubPrimitive(s.subPrimitive);let l=n.texture;o.has(r)&&(l=o.get(r));const h=`${l.instanceId}_${i}`;let c=bs._materialCache.get(h);c||(c=this._createMaterialForTexture(l,p,i),bs._materialCache.set(h,c)),e.setMaterial(t,c)}e._vertexBuffer.setData(f),e._indexBuffer.setData(m)}addSeparateSlot(t){this._separateSlots.set(t,t)}addSeparateSlotTexture(t,e){this._separateSlotTextureMap.set(t,e)}_createMaterialForTexture(t,e,s){const r=bs._getDefaultMaterial(e);return r.shaderData.setTexture("material_SpineTexture",t),ps(r,s),r}_expandByPoint(t,e,s){const{bounds:{min:r,max:i}}=xs,n=Math.min(r.x,t),a=Math.min(r.y,e),o=Math.min(r.z,s),l=Math.max(i.x,t),h=Math.max(i.y,e),c=Math.max(i.z,s);r.set(n,a,o),i.set(l,h,c)}_collectUniqueAttachments(t,e){const{attachments:s}=t;for(let t=0,r=s.length;t<r;t++){const r=s[t];for(let t in r){const s=r[t];s&&!e.has(s)&&e.add(s)}}}_calculateTotalVertexCount(t){let e=0;const s=xs.QUAD_TRIANGLES.length;return t.forEach((t=>{t instanceof _t?e+=s:t instanceof Yt&&(e+=t.triangles.length)})),e}constructor(){this._clipper=new We,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}}class ws extends e.Material{static{this._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n "}static{this._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n "}constructor(t){super(t,e.Shader.find("galacean-spine-shader")||e.Shader.create("galacean-spine-shader",ws._spineVS,ws._spineFS));const s=this.renderState;s.blendState.targetBlendState.enabled=!0,ps(this,exports.BlendMode.Normal),s.depthState.writeEnabled=!1,s.rasterState.cullMode=e.CullMode.Off,s.renderQueueType=e.RenderQueueType.Transparent}}class bs extends e.Renderer{static{this._spineGenerator=new xs}static{this._positionVertexElement=new e.VertexElement("POSITION",0,e.VertexElementFormat.Vector3,0)}static{this._colorVertexElement=new e.VertexElement("COLOR_0",12,e.VertexElementFormat.Vector4,0)}static{this._uvVertexElement=new e.VertexElement("TEXCOORD_0",28,e.VertexElementFormat.Vector2,0)}static{this._materialCache=new Map}static{this._animationDataCache=new Map}static _getDefaultMaterial(t){let e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return e=new ws(t),e.isGCIgnored=!0,this._defaultMaterial=e,e.clone()}get resource(){return this._resource}set resource(t){if(!t)return this._state=null,this._skeleton=null,void(this._resource=null);this._resource=t,this._addResourceReferCount(t,1);const{skeletonData:e}=t;this._skeleton=new Kt(e);let s=bs._animationDataCache.get(e);s||(s=new ft(e),bs._animationDataCache.set(e,s)),this._state=new it(s);const r=bs._spineGenerator.getMaxVertexCount(e);this._createBuffer(r),this._initializeDefaultState(),this._dirtyUpdateFlag|=4,this._state.addListener({start:()=>{this._onAnimationStart()},complete:t=>{this._onAnimationComplete(t)}})}get state(){return this._state}get skeleton(){return this._skeleton}constructor(t){super(t),this.setting=new Ss,this.defaultState=new vs,this._subPrimitives=[],this._needResizeBuffer=!1,this._vertexCount=0;const s=new e.Primitive(this._engine);this._primitive=s,s.addVertexElement(bs._positionVertexElement),s.addVertexElement(bs._colorVertexElement),s.addVertexElement(bs._uvVertexElement)}addSeparateSlot(t){this._skeleton||console.error("Skeleton not found!");this._skeleton.findSlot(t)?bs._spineGenerator.addSeparateSlot(t):console.warn(`Slot: ${t} not find.`)}_onEnable(){this._initializeDefaultState()}update(t){const{_state:e,_skeleton:s}=this;e&&s&&(e.update(t),e.apply(s),s.update(t),s.updateWorldTransform(exports.Physics.update),bs._spineGenerator.buildPrimitive(this._skeleton,this),this._isContainDirtyFlag(4)&&(this._onWorldVolumeChanged(),this._setDirtyFlagFalse(4)),this._isContainDirtyFlag(2)&&this._calculateGeneratorBounds(this.bounds))}_render(t){const{_primitive:e,_subPrimitives:s}=this,{_materials:r,_engine:i}=this,n=i._renderElementPool.get();n.set(this.priority,this._distanceForSort);const a=i._subRenderElementPool;if(s){for(let t=0,i=s.length;t<i;t++){let i=r[t];if(!i)continue;(i.destroyed||i.shader.destroyed)&&(i=this.engine._meshMagentaMaterial);const o=a.get();o.set(this,i,e,s[t]),n.addSubRenderElement(o)}t.camera._renderPipeline.pushRenderElement(t,n)}}_updateBounds(t){this._calculateGeneratorBounds(t)}_calculateGeneratorBounds(t){const{bounds:s}=xs;e.BoundingBox.transform(s,this.entity.transform.worldMatrix,t)}_cloneTo(t){t.resource=this._resource}_onDestroy(){const{_primitive:t,_subPrimitives:e,_resource:s}=this;e.length=0,t&&t.destroy(),s&&this._addResourceReferCount(s,-1),this._clearMaterialCache(),this._primitive=null,this._resource=null,this._skeleton=null,this._state=null,this.setting=null,super._onDestroy()}_createBuffer(t){const{_engine:s,_primitive:r}=this;this._vertices=new Float32Array(t*xs.VERTEX_STRIDE),this._indices=new Uint16Array(t);const i=4*xs.VERTEX_STRIDE,n=new e.Buffer(s,e.BufferBindFlag.VertexBuffer,this._vertices,e.BufferUsage.Dynamic),a=new e.Buffer(s,e.BufferBindFlag.IndexBuffer,this._indices,e.BufferUsage.Dynamic);this._indexBuffer=a,this._vertexBuffer=n;const o=new e.VertexBufferBinding(n,i);this._primitive.setVertexBufferBinding(0,o);const l=new e.IndexBufferBinding(a,e.IndexFormat.UInt16);r.setIndexBufferBinding(l)}_addSubPrimitive(t){this._subPrimitives.push(t)}_clearSubPrimitives(){this._subPrimitives.length=0}_isContainDirtyFlag(t){return!!(this._dirtyUpdateFlag&t)}_setDirtyFlagFalse(t){this._dirtyUpdateFlag&=~t}_onWorldVolumeChanged(){this._dirtyUpdateFlag|=1}_onAnimationStart(){this._dirtyUpdateFlag|=2}_onAnimationComplete(t){t.loop||this._setDirtyFlagFalse(2)}_clearMaterialCache(){this._materials.forEach((t=>{const e=t.shaderData.getTexture("material_SpineTexture"),s=function(t){const e=t.renderState.blendState.targetBlendState;return e.sourceColorBlendFactor===as&&e.destinationColorBlendFactor===os&&e.sourceAlphaBlendFactor===os&&e.destinationAlphaBlendFactor===os&&e.colorBlendOperation===us&&e.alphaBlendOperation===us?exports.BlendMode.Additive:e.sourceColorBlendFactor===ls&&e.destinationColorBlendFactor===hs&&e.sourceAlphaBlendFactor===os&&e.destinationAlphaBlendFactor===hs&&e.colorBlendOperation===us&&e.alphaBlendOperation===us?exports.BlendMode.Multiply:e.sourceColorBlendFactor===os&&e.destinationColorBlendFactor===cs&&e.sourceAlphaBlendFactor===os&&e.destinationAlphaBlendFactor===cs&&e.colorBlendOperation===us&&e.alphaBlendOperation===us?exports.BlendMode.Screen:exports.BlendMode.Normal}(t),r=`${e.instanceId}_${s}`;bs._materialCache.delete(r)}))}_initializeDefaultState(){const{skeleton:t,state:e}=this;if(t&&e){const{animationName:s,skinName:r,loop:i,scale:n}=this.defaultState;t.scaleX=n,t.scaleY=n,"default"!==r&&(t.setSkinByName(r),t.setToSetupPose()),s&&e.setAnimation(0,s,i)}}}var ys,Ms;s([e.deepClone],bs.prototype,"setting",void 0),s([e.deepClone],bs.prototype,"defaultState",void 0),s([e.ignoreClone],bs.prototype,"_primitive",void 0),s([e.ignoreClone],bs.prototype,"_subPrimitives",void 0),s([e.ignoreClone],bs.prototype,"_indexBuffer",void 0),s([e.ignoreClone],bs.prototype,"_vertexBuffer",void 0),s([e.ignoreClone],bs.prototype,"_vertices",void 0),s([e.ignoreClone],bs.prototype,"_indices",void 0),s([e.ignoreClone],bs.prototype,"_needResizeBuffer",void 0),s([e.ignoreClone],bs.prototype,"_vertexCount",void 0),s([e.ignoreClone],bs.prototype,"_resource",void 0),s([e.ignoreClone],bs.prototype,"_skeleton",void 0),s([e.ignoreClone],bs.prototype,"_state",void 0),function(t){t[t.TransformVolume=1]="TransformVolume",t[t.AnimationVolume=2]="AnimationVolume",t[t.InitialVolume=4]="InitialVolume"}(ys||(ys={})),function(t){t[t.WorldVolume=1]="WorldVolume"}(Ms||(Ms={}));class Ss{constructor(t=.01,e=!0){this.zSpacing=t,this.useClipping=e}}class vs{constructor(t=1,e=!0,s=null,r="default"){this.scale=t,this.loop=e,this.animationName=s,this.skinName=r}}class ks extends e.ReferResource{get skeletonData(){return this._skeletonData}constructor(t,e){super(t),this.textures=[],this._skeletonData=e,this._associationTextureInSkeletonData(e)}_onDestroy(){super._onDestroy();const{textures:t,_skeletonData:e}=this;t&&this._disassociationSuperResource(t),this._clearAttachmentTextures(e),bs._animationDataCache.delete(e),this._skeletonData=null}_disassociationSuperResource(t){for(let e=0,s=t.length;e<s;e++)t[e]._disassociationSuperResource(this)}_associationTextureInSkeletonData(t){const{skins:e}=t;e.forEach((t=>{const{attachments:e}=t;e.forEach((t=>{const e=Object.values(t)[0],s=e?.region?.texture.texture;s&&!this.textures.find((t=>t.instanceId===s.instanceId))&&(this.textures.push(s),s._associationSuperResource(this))}))}))}_clearAttachmentTextures(t){const{skins:e}=t;e.forEach((t=>{const{attachments:e}=t;e.forEach((t=>{const e=Object.values(t)[0];e?.region?.texture&&(e.region.texture.texture=null)}))}))}}class Is{constructor(t,e=0,s){this.data=t,this._dataView=new DataView(t.buffer,t.byteOffset+e,s??t.byteLength-e),this._position=0}nextUint16(){const t=this._dataView.getUint16(this._position,!0);return this._position+=2,t}nextStr(){const t=this.nextUint16(),e=new Uint8Array(this.data.buffer,this._position+this._dataView.byteOffset,t);return this._position+=t,this.decodeText(e)}nextImageData(){return new Uint8Array(this.data.buffer,this.data.byteOffset+this._position)}decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let s=0,r=t.length;s<r;s++)e+=String.fromCharCode(t[s]);return decodeURIComponent(encodeURIComponent(e))}}class As extends e.Loader{static{this.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"]}static{this.skeletonExtensions=["skel","json","bin"]}static parseAndAssignSpineAsset(t,e,s){const{imageExtensions:r,skeletonExtensions:i}=As,n=As.getUrlExtension(t,e);n&&(i.includes(n)&&(s.skeletonPath=t,s.skeletonExtension=n),"atlas"===n&&(s.atlasPath=t),r.includes(n)&&(s.imagePaths.push(t),s.imageExtensions.push(n)))}static deriveAndAssignSpineAsset(t,e,s){const r=As.getUrlExtension(t,e);if(!r)return;s.skeletonPath=t,s.skeletonExtension=r;const i=/(\.(json|bin|skel))$/;let n;if(i.test(t)&&(n=t.replace(i,"")),n){const t=n+".atlas";s.atlasPath=t}}static verifyFileExtensions(t,e){return t?e&&!Array.isArray(t)?(console.error("Expect fileExtensions to be an array."),[]):e||"string"==typeof t?t:(console.error("Expect fileExtensions to be a string."),null):null}static getUrlExtension(t,e){if(e)return e;const s=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/);return s?s[2]||s[4]:null}load(t,s){return new e.AssetPromise((async e=>{let r;if(t.urls)r=await this._handleOriginAsset(t,s);else{const e=await this.request(t.url,{type:"arraybuffer"}),i=new Is(new Uint8Array(e)),n=i.nextStr();r=n.startsWith("spine")?await this._handleEditorAsset(e,i,n,s):await this._handleOriginAsset(t,s,e)}e(r)}))}async _handleEditorAsset(t,e,s,r){let i,n;const a=s.startsWith("spine:skel")?"skel":"json",{engine:o}=r;if("skel"===a)n=e.nextStr(),i=e.nextImageData();else{const e=new TextDecoder("utf-8").decode(new Uint8Array(t)),{data:s,atlas:r}=JSON.parse(e);n=r.refId,i=s}const l=Qe(await r.getResourceByRef({refId:n}),i,a);return new ks(o,l)}async _handleOriginAsset(t,e,s){let{fileExtensions:r}=t.params||{},i={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]};const{engine:n}=e;if(s){const e=As.verifyFileExtensions(r,!1);As.deriveAndAssignSpineAsset(t.url,e,i);const{skeletonPath:a,atlasPath:o}=i;if(!a||!o)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const l=await ts(o,n),{data:h,type:c}=this._determineSkeletonDataType(s),d=Qe(l,h,c);return new ks(n,d)}{r=As.verifyFileExtensions(r,!0);for(let e=0;e<t.urls.length;e+=1){const s=t.urls[e],n=r&&r[e]||null;As.parseAndAssignSpineAsset(s,n,i)}const{skeletonPath:e,atlasPath:s,imagePaths:a,skeletonExtension:o,imageExtensions:l}=i;if(!e||!s)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const h="json"===o?"json":"skel";let c,d,u=["json"===o?this.request(e,{type:"text"}):this.request(e,{type:"arraybuffer"})];if(a.length>0){let t,e;u=u.concat([this.request(s,{type:"text"}),Ze(a,l,n)]),[d,t,e]=await Promise.all(u),c=es(t,e)}else u.push(ts(s,n)),[d,c]=await Promise.all(u);const p=Qe(c,d,h);return new ks(n,p)}}_determineSkeletonDataType(t){let e,s;try{const r=new TextDecoder("utf-8").decode(t);JSON.parse(r),e=r,s="json"}catch(r){e=t,s="skel"}return{data:e,type:s}}}As=s([e.resourceLoader("spine",["json","bin","skel"])],As);class Ts extends e.Loader{load(t,s){return new e.AssetPromise((async e=>{const r=await this.request(t.url,{type:"text"}),{data:i,textures:n}=JSON.parse(r),a=n.map((t=>s.getResourceByRef({refId:t.refId})));e(es(i,await Promise.all(a)))}))}}Ts=s([e.resourceLoader("EditorSpineAtlas",["atlas"])],Ts);const Bs="4.2.0-beta.1";e.Loader.registerClass("SpineAnimationRenderer",bs),console.log(`Galacean spine version: ${Bs}`),exports.AlphaTimeline=_,exports.Animation=f,exports.AnimationState=it,exports.AnimationStateAdapter=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},exports.AnimationStateData=ft,exports.AssetManagerBase=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Lt){this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${r}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${r}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${r}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>{this.success(e,t,this.textureLoader(r))},r.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),r.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},r){let i=t.lastIndexOf("/"),n=i>=0?t.substring(0,i+1):"";t=this.start(t),this.downloader.downloadText(t,(i=>{try{let a=new Ct(i),o=a.pages.length,l=!1;for(let i of a.pages)this.loadTexture(r?r[i.name]:n+i.name,((s,r)=>{l||(i.setTexture(r),0==--o&&this.success(e,t,a))}),((e,r)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,r)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${r}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},exports.AtlasAttachmentLoader=Vt,exports.Attachment=d,exports.AttachmentTimeline=O,exports.BinaryInput=ne,exports.Bone=Ot,exports.BoneData=Dt,exports.BoundingBoxAttachment=gt,exports.CURRENT=mt,exports.ClippingAttachment=xt,exports.Color=i,exports.ConstraintData=Nt,exports.CurveTimeline=y,exports.CurveTimeline1=M,exports.CurveTimeline2=S,exports.DebugUtils=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)}}},exports.DeformTimeline=N,exports.Downloader=Lt,exports.DrawOrderTimeline=q,exports.Event=qt,exports.EventData=Ut,exports.EventQueue=at,exports.EventTimeline=L,exports.FIRST=ht,exports.FakeTexture=class extends wt{setFilters(t,e){}setWraps(t,e){}dispose(){}},exports.HOLD_FIRST=dt,exports.HOLD_MIX=ut,exports.HOLD_SUBSEQUENT=ct,exports.IkConstraint=Wt,exports.IkConstraintData=zt,exports.IkConstraintTimeline=U,exports.InheritTimeline=Y,exports.IntSet=class{array=new Array;add(t){let e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}},exports.Interpolation=a,exports.MathUtils=n,exports.MeshAttachment=Yt,exports.PathAttachment=Pt,exports.PathConstraint=$t,exports.PathConstraintData=Gt,exports.PathConstraintMixTimeline=$,exports.PathConstraintPositionTimeline=z,exports.PathConstraintSpacingTimeline=G,exports.PhysicsConstraintDampingTimeline=K,exports.PhysicsConstraintGravityTimeline=tt,exports.PhysicsConstraintInertiaTimeline=H,exports.PhysicsConstraintMassTimeline=Q,exports.PhysicsConstraintMixTimeline=et,exports.PhysicsConstraintResetTimeline=st,exports.PhysicsConstraintStrengthTimeline=J,exports.PhysicsConstraintTimeline=j,exports.PhysicsConstraintWindTimeline=Z,exports.PointAttachment=Xt,exports.Pool=h,exports.Pow=o,exports.PowOut=class extends o{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},exports.RGB2Timeline=D,exports.RGBA2Timeline=V,exports.RGBATimeline=P,exports.RGBTimeline=X,exports.RegionAttachment=_t,exports.RotateTimeline=v,exports.SETUP=pt,exports.SUBSEQUENT=lt,exports.ScaleTimeline=T,exports.ScaleXTimeline=B,exports.ScaleYTimeline=C,exports.SequenceTimeline=rt,exports.ShearTimeline=F,exports.ShearXTimeline=E,exports.ShearYTimeline=R,exports.Skeleton=Kt,exports.SkeletonBinary=ie,exports.SkeletonBounds=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new h((()=>l.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,n=t.slots,a=n.length;s.length=0,i.freeAll(r),r.length=0;for(let t=0;t<a;t++){let e=n[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof gt){let t=a;s.push(t);let n=i.obtain();n.length!=t.worldVerticesLength&&(n=l.newFloatArray(t.worldVerticesLength)),r.push(n),t.computeWorldVertices(e,0,t.worldVerticesLength,n,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,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let n=0,a=i.length;n<a;n++){let a=i[n],o=a;for(let i=0,n=a.length;i<n;i+=2){let n=o[i],a=o[i+1];t=Math.min(t,n),e=Math.min(e,a),s=Math.max(s,n),r=Math.max(r,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let i=this.minX,n=this.minY,a=this.maxX,o=this.maxY;if(t<=i&&s<=i||e<=n&&r<=n||t>=a&&s>=a||e>=o&&r>=o)return!1;let l=(r-e)/(s-t),h=l*(i-t)+e;if(h>n&&h<o)return!0;if(h=l*(a-t)+e,h>n&&h<o)return!0;let c=(n-e)/l+t;return c>i&&c<a||(c=(o-e)/l+t,c>i&&c<a)}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 r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,i=t.length,n=i-2,a=!1;for(let t=0;t<i;t+=2){let i=r[t+1],o=r[n+1];if(i<s&&o>=s||o<s&&i>=s){let l=r[t];l+(s-i)/(o-i)*(r[n]-l)<e&&(a=!a)}n=t}return a}intersectsSegment(t,e,s,r){let i=this.polygons;for(let n=0,a=i.length;n<a;n++)if(this.intersectsSegmentPolygon(i[n],t,e,s,r))return this.boundingBoxes[n];return null}intersectsSegmentPolygon(t,e,s,r,i){let n=t,a=t.length,o=e-r,l=s-i,h=e*i-s*r,c=n[a-2],d=n[a-1];for(let t=0;t<a;t+=2){let a=n[t],u=n[t+1],p=c*u-d*a,m=c-a,f=d-u,g=o*f-l*m,x=(h*m-o*p)/g;if((x>=c&&x<=a||x>=a&&x<=c)&&(x>=e&&x<=r||x>=r&&x<=e)){let t=(h*f-l*p)/g;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=i||t>=i&&t<=s))return!0}c=a,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},exports.SkeletonClipping=We,exports.SkeletonData=Zt,exports.SkeletonDataResource=ks,exports.SkeletonJson=ze,exports.Skin=ee,exports.SkinEntry=te,exports.Slot=Ht,exports.SlotData=se,exports.SpineAnimationRenderer=bs,exports.StringSet=r,exports.Texture=wt,exports.TextureAtlas=Ct,exports.TextureAtlasPage=Et,exports.TextureAtlasRegion=Rt,exports.TextureRegion=Bt,exports.TimeKeeper=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)}},exports.Timeline=b,exports.TrackEntry=nt,exports.TransformConstraint=Jt,exports.TransformConstraintData=re,exports.TransformConstraintTimeline=W,exports.TranslateTimeline=k,exports.TranslateXTimeline=I,exports.TranslateYTimeline=A,exports.Triangulator=Ue,exports.Utils=l,exports.Vector2=c,exports.VertexAttachment=u,exports.WindowedMean=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}},exports.createTextureAtlas=es,exports.version=Bs;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/engine");function s(t,e,s,r){var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,r);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(n<3?i(a):n>3?i(e,s,a):i(e,s))||a);return n>3&&a&&Object.defineProperty(e,s,a),a}"function"==typeof SuppressedError&&SuppressedError;class r{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}class i{r;g;b;a;static WHITE=new i(1,1,1,1);static RED=new i(1,0,0,1);static GREEN=new i(0,1,0,1);static BLUE=new i(0,0,1,1);static MAGENTA=new i(1,0,1,1);constructor(t=0,e=0,s=0,r=0){this.r=t,this.g=e,this.b=s,this.a=r}set(t,e,s,r){return this.r=t,this.g=e,this.b=s,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,r){return this.r+=t,this.g+=e,this.b+=s,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(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new i).setFromString(t)}}class n{static PI=3.1415927;static PI2=2*n.PI;static invPI2=1/n.PI2;static radiansToDegrees=180/n.PI;static radDeg=n.radiansToDegrees;static degreesToRadians=n.PI/180;static degRad=n.degreesToRadians;static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*n.degRad)}static sinDeg(t){return Math.sin(t*n.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*n.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}static randomTriangular(t,e){return n.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let r=Math.random(),i=e-t;return r<=(s-t)/i?t+Math.sqrt(r*i*(s-t)):e-Math.sqrt((1-r)*i*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}}class a{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class o extends a{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}class l{static SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;static arrayCopy(t,e,s,r,i){for(let n=e,a=r;n<e+i;n++,a++)s[a]=t[n]}static arrayFill(t,e,s,r){for(let i=e;i<s;i++)t[i]=r}static setArraySize(t,e,s=0){let r=t.length;if(r==e)return t;if(t.length=e,r<e)for(let i=r;i<e;i++)t[i]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:l.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let r=0;r<t;r++)s[r]=e;return s}static newFloatArray(t){if(l.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static newShortArray(t){if(l.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static toFloatArray(t){return l.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return l.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}}class h{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}}class c{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}}class d{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}class u extends d{static nextID=0;id=u.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,r,i,n){s=i+(s>>1)*n;let a=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let a=t.bone,h=a.worldX,c=a.worldY,d=a.a,u=a.b,p=a.c,m=a.d;for(let t=e,a=i;a<s;t+=2,a+=n){let e=l[t],s=l[t+1];r[a]=e*d+s*u+h,r[a+1]=e*p+s*m+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=a.bones;if(0==o.length)for(let t=i,e=3*d;t<s;t+=n){let s=0,i=0,n=h[c++];for(n+=c;c<n;c++,e+=3){let t=u[h[c]],r=l[e],n=l[e+1],a=l[e+2];s+=(r*t.a+n*t.b+t.worldX)*a,i+=(r*t.c+n*t.d+t.worldY)*a}r[t]=s,r[t+1]=i}else{let t=o;for(let e=i,a=3*d,o=d<<1;e<s;e+=n){let s=0,i=0,n=h[c++];for(n+=c;c<n;c++,a+=3,o+=2){let e=u[h[c]],r=l[a]+t[o],n=l[a+1]+t[o+1],d=l[a+2];s+=(r*e.a+n*e.b+e.worldX)*d,i+=(r*e.c+n*e.d+e.worldY)*d}r[e]=s,r[e+1]=i}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),l.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=l.newFloatArray(this.vertices.length),l.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}}class p{static _nextID=0;id=p.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new p(this.regions.length);return l.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let r=this.regions[s];e.region!=r&&(e.region=r,e.updateRegion())}getPath(t,e){let s=t,r=(this.start+e).toString();for(let t=this.digits-r.length;t>0;t--)s+="0";return s+=r,s}static nextID(){return p._nextID++}}!function(t){t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse"}(t||(t={}));const m=[t.hold,t.once,t.loop,t.pingpong,t.onceReverse,t.loopReverse,t.pingpongReverse];class f{name;timelines=[];timelineIds=new r;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,r,i,n,a,o){if(!t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let r=0,h=l.length;r<h;r++)l[r].apply(t,e,s,i,n,a,o)}}var g,x;exports.MixBlend=void 0,(g=exports.MixBlend||(exports.MixBlend={}))[g.setup=0]="setup",g[g.first=1]="first",g[g.replace=2]="replace",g[g.add=3]="add",exports.MixDirection=void 0,(x=exports.MixDirection||(exports.MixDirection={}))[x.mixIn=0]="mixIn",x[x.mixOut=1]="mixOut";const w={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};class b{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=l.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 r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let i=s;i<r;i+=s)if(t[i]>e)return i-s;return r-s}}class y extends b{curves;constructor(t,e,s){super(t,s),this.curves=l.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+18*t;if(this.curves.length>e){let t=l.newFloatArray(e);l.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,r,i,n,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let p=.03*(r-2*n+o),m=.03*(i-2*a+l),f=.006*(3*(n-o)-r+h),g=.006*(3*(a-l)-i+c),x=2*p+f,w=2*m+g,b=.3*(n-r)+p+.16666667*f,y=.3*(a-i)+m+.16666667*g,M=r+b,S=i+y;for(let t=u+18;u<t;u+=2)d[u]=M,d[u+1]=S,b+=x,y+=w,x+=f,w+=g,M+=b,S+=y}getBezierValue(t,e,s,r){let i=this.curves;if(i[r]>t){let n=this.frames[e],a=this.frames[e+s];return a+(t-n)/(i[r]-n)*(i[r+1]-a)}let n=r+18;for(r+=2;r<n;r+=2)if(i[r]>=t){let e=i[r-2],s=i[r-1];return s+(t-e)/(i[r]-e)*(i[r+1]-s)}e+=this.getFrameEntries();let a=i[n-2],o=i[n-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}}class M extends y{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 r=this.curves[s>>1];switch(r){case 0:let r=e[s],i=e[s+1];return i+(t-r)/(e[s+2]-r)*(e[s+2+1]-i);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}let n=this.getCurveValue(t);switch(s){case exports.MixBlend.setup:return i+n*e;case exports.MixBlend.first:case exports.MixBlend.replace:n+=i-r}return r+n*e}getAbsoluteValue(t,e,s,r,i){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}let n=this.getCurveValue(t);return s==exports.MixBlend.setup?i+(n-i)*e:r+(n-r)*e}getAbsoluteValue2(t,e,s,r,i,n){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return i;case exports.MixBlend.first:return r+(i-r)*e}return r}return s==exports.MixBlend.setup?i+(n-i)*e:r+(n-r)*e}getScaleValue(t,e,s,r,i,a){if(t<this.frames[0]){switch(s){case exports.MixBlend.setup:return a;case exports.MixBlend.first:return i+(a-i)*e}return i}let o=this.getCurveValue(t)*a;if(1==e)return s==exports.MixBlend.add?i+o-a:o;if(r==exports.MixDirection.mixOut)switch(s){case exports.MixBlend.setup:return a+(Math.abs(o)*n.signum(a)-a)*e;case exports.MixBlend.first:case exports.MixBlend.replace:return i+(Math.abs(o)*n.signum(i)-i)*e}else{let t=0;switch(s){case exports.MixBlend.setup:return t=Math.abs(a)*n.signum(o),t+(o-t)*e;case exports.MixBlend.first:case exports.MixBlend.replace:return t=Math.abs(i)*n.signum(o),t+(o-t)*e}}return i+(o-a)*e}}class S extends y{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class v extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,i,n,o.rotation,o.data.rotation))}}class k extends S{boneIndex=0;constructor(t,e,s){super(t,e,w.x+"|"+s,w.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.setup:return o.x=o.data.x,void(o.y=o.data.y);case exports.MixBlend.first:o.x+=(o.data.x-o.x)*i,o.y+=(o.data.y-o.y)*i}return}let h=0,c=0,d=b.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(n){case exports.MixBlend.setup:o.x=o.data.x+h*i,o.y=o.data.y+c*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:o.x+=(o.data.x+h-o.x)*i,o.y+=(o.data.y+c-o.y)*i;break;case exports.MixBlend.add:o.x+=h*i,o.y+=c*i}}}class I extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,i,n,o.x,o.data.x))}}class A extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,i,n,o.y,o.data.y))}}class B extends S{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleX+"|"+s,w.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,a,o){let l=t.bones[this.boneIndex];if(!l.active)return;let h,c,d=this.frames;if(s<d[0]){switch(a){case exports.MixBlend.setup:return l.scaleX=l.data.scaleX,void(l.scaleY=l.data.scaleY);case exports.MixBlend.first:l.scaleX+=(l.data.scaleX-l.scaleX)*i,l.scaleY+=(l.data.scaleY-l.scaleY)*i}return}let u=b.search(d,s,3),p=this.curves[u/3];switch(p){case 0:let t=d[u];h=d[u+1],c=d[u+2];let e=(s-t)/(d[u+3]-t);h+=(d[u+3+1]-h)*e,c+=(d[u+3+2]-c)*e;break;case 1:h=d[u+1],c=d[u+2];break;default:h=this.getBezierValue(s,u,1,p-2),c=this.getBezierValue(s,u,2,p+18-2)}if(h*=l.data.scaleX,c*=l.data.scaleY,1==i)a==exports.MixBlend.add?(l.scaleX+=h-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=h,l.scaleY=c);else{let t=0,e=0;if(o==exports.MixDirection.mixOut)switch(a){case exports.MixBlend.setup:t=l.data.scaleX,e=l.data.scaleY,l.scaleX=t+(Math.abs(h)*n.signum(t)-t)*i,l.scaleY=e+(Math.abs(c)*n.signum(e)-e)*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:t=l.scaleX,e=l.scaleY,l.scaleX=t+(Math.abs(h)*n.signum(t)-t)*i,l.scaleY=e+(Math.abs(c)*n.signum(e)-e)*i;break;case exports.MixBlend.add:l.scaleX+=(h-l.data.scaleX)*i,l.scaleY+=(c-l.data.scaleY)*i}else switch(a){case exports.MixBlend.setup:t=Math.abs(l.data.scaleX)*n.signum(h),e=Math.abs(l.data.scaleY)*n.signum(c),l.scaleX=t+(h-t)*i,l.scaleY=e+(c-e)*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:t=Math.abs(l.scaleX)*n.signum(h),e=Math.abs(l.scaleY)*n.signum(c),l.scaleX=t+(h-t)*i,l.scaleY=e+(c-e)*i;break;case exports.MixBlend.add:l.scaleX+=(h-l.data.scaleX)*i,l.scaleY+=(c-l.data.scaleY)*i}}}}class T extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,i,n,a,o.scaleX,o.data.scaleX))}}class C extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,i,n,a,o.scaleY,o.data.scaleY))}}class F extends S{boneIndex=0;constructor(t,e,s){super(t,e,w.shearX+"|"+s,w.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case exports.MixBlend.first:o.shearX+=(o.data.shearX-o.shearX)*i,o.shearY+=(o.data.shearY-o.shearY)*i}return}let h=0,c=0,d=b.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(n){case exports.MixBlend.setup:o.shearX=o.data.shearX+h*i,o.shearY=o.data.shearY+c*i;break;case exports.MixBlend.first:case exports.MixBlend.replace:o.shearX+=(o.data.shearX+h-o.shearX)*i,o.shearY+=(o.data.shearY+c-o.shearY)*i;break;case exports.MixBlend.add:o.shearX+=h*i,o.shearY+=c*i}}}class E extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,i,n,o.shearX,o.data.shearX))}}class Y extends M{boneIndex=0;constructor(t,e,s){super(t,e,w.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,i,n,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,i,n,o.shearY,o.data.shearY))}}class R extends b{boneIndex=0;constructor(t,e){super(t,[w.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,r,i,n,a){let o=t.bones[this.boneIndex];if(!o.active)return;if(a==exports.MixDirection.mixOut)return void(n==exports.MixBlend.setup&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||(o.inherit=o.data.inherit):o.inherit=this.frames[b.search(l,s,2)+1]}}class P extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,i,n){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(n){case exports.MixBlend.setup:return void h.setFromColor(t);case exports.MixBlend.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i)}return}let c=0,d=0,u=0,p=0,m=b.search(l,s,5),f=this.curves[m/5];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3],p=l[m+4];let e=(s-t)/(l[m+5]-t);c+=(l[m+5+1]-c)*e,d+=(l[m+5+2]-d)*e,u+=(l[m+5+3]-u)*e,p+=(l[m+5+4]-p)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3],p=l[m+4];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2),p=this.getBezierValue(s,m,4,f+54-2)}1==i?h.set(c,d,u,p):(n==exports.MixBlend.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*i,(d-h.g)*i,(u-h.b)*i,(p-h.a)*i))}}class X extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(n){case exports.MixBlend.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case exports.MixBlend.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i}return}let c=0,d=0,u=0,p=b.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:let t=l[p];c=l[p+1],d=l[p+2],u=l[p+3];let e=(s-t)/(l[p+4]-t);c+=(l[p+4+1]-c)*e,d+=(l[p+4+2]-d)*e,u+=(l[p+4+3]-u)*e;break;case 1:c=l[p+1],d=l[p+2],u=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),u=this.getBezierValue(s,p,3,m+36-2)}if(1==i)h.r=c,h.g=d,h.b=u;else{if(n==exports.MixBlend.setup){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*i,h.g+=(d-h.g)*i,h.b+=(u-h.b)*i}}}class _ extends M{slotIndex=0;constructor(t,e,s){super(t,e,w.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.color;if(s<this.frames[0]){let t=o.data.color;switch(n){case exports.MixBlend.setup:return void(l.a=t.a);case exports.MixBlend.first:l.a+=(t.a-l.a)*i}return}let h=this.getCurveValue(s);1==i?l.a=h:(n==exports.MixBlend.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*i)}}class V extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.alpha+"|"+s,w.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,i,n,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(n){case exports.MixBlend.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case exports.MixBlend.first:h.add((t.r-h.r)*i,(t.g-h.g)*i,(t.b-h.b)*i,(t.a-h.a)*i),c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,p=0,m=0,f=0,g=0,x=0,w=b.search(l,s,8),y=this.curves[w>>3];switch(y){case 0:let t=l[w];d=l[w+1],u=l[w+2],p=l[w+3],m=l[w+4],f=l[w+5],g=l[w+6],x=l[w+7];let e=(s-t)/(l[w+8]-t);d+=(l[w+8+1]-d)*e,u+=(l[w+8+2]-u)*e,p+=(l[w+8+3]-p)*e,m+=(l[w+8+4]-m)*e,f+=(l[w+8+5]-f)*e,g+=(l[w+8+6]-g)*e,x+=(l[w+8+7]-x)*e;break;case 1:d=l[w+1],u=l[w+2],p=l[w+3],m=l[w+4],f=l[w+5],g=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,y-2),u=this.getBezierValue(s,w,2,y+18-2),p=this.getBezierValue(s,w,3,y+36-2),m=this.getBezierValue(s,w,4,y+54-2),f=this.getBezierValue(s,w,5,y+72-2),g=this.getBezierValue(s,w,6,y+90-2),x=this.getBezierValue(s,w,7,y+108-2)}if(1==i)h.set(d,u,p,m),c.r=f,c.g=g,c.b=x;else{if(n==exports.MixBlend.setup){h.setFromColor(o.data.color);let t=o.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b}h.add((d-h.r)*i,(u-h.g)*i,(p-h.b)*i,(m-h.a)*i),c.r+=(f-c.r)*i,c.g+=(g-c.g)*i,c.b+=(x-c.b)*i}}}class D extends y{slotIndex=0;constructor(t,e,s){super(t,e,[w.rgb+"|"+s,w.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,n,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(n){case exports.MixBlend.setup:return h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,void(c.b=e.b);case exports.MixBlend.first:h.r+=(t.r-h.r)*i,h.g+=(t.g-h.g)*i,h.b+=(t.b-h.b)*i,c.r+=(e.r-c.r)*i,c.g+=(e.g-c.g)*i,c.b+=(e.b-c.b)*i}return}let d=0,u=0,p=0,m=0,f=0,g=0,x=b.search(l,s,7),w=this.curves[x/7];switch(w){case 0:let t=l[x];d=l[x+1],u=l[x+2],p=l[x+3],m=l[x+4],f=l[x+5],g=l[x+6];let e=(s-t)/(l[x+7]-t);d+=(l[x+7+1]-d)*e,u+=(l[x+7+2]-u)*e,p+=(l[x+7+3]-p)*e,m+=(l[x+7+4]-m)*e,f+=(l[x+7+5]-f)*e,g+=(l[x+7+6]-g)*e;break;case 1:d=l[x+1],u=l[x+2],p=l[x+3],m=l[x+4],f=l[x+5],g=l[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),p=this.getBezierValue(s,x,3,w+36-2),m=this.getBezierValue(s,x,4,w+54-2),f=this.getBezierValue(s,x,5,w+72-2),g=this.getBezierValue(s,x,6,w+90-2)}if(1==i)h.r=d,h.g=u,h.b=p,c.r=m,c.g=f,c.b=g;else{if(n==exports.MixBlend.setup){let t=o.data.color,e=o.data.darkColor;h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,c.b=e.b}h.r+=(d-h.r)*i,h.g+=(u-h.g)*i,h.b+=(p-h.b)*i,c.r+=(m-c.r)*i,c.g+=(f-c.g)*i,c.b+=(g-c.b)*i}}}class O extends b{slotIndex=0;attachmentNames;constructor(t,e){super(t,[w.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,r,i,n,a){let o=t.slots[this.slotIndex];o.bone.active&&(a!=exports.MixDirection.mixOut?s<this.frames[0]?n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[b.search1(this.frames,s)]):n==exports.MixBlend.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class N extends y{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[w.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,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,r,i,n,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let p=.03*(r-2*n+o),m=.03*l-.06*a,f=.006*(3*(n-o)-r+h),g=.018*(a-l+.33333333),x=2*p+f,w=2*m+g,b=.3*(n-r)+p+.16666667*f,y=.3*a+m+.16666667*g,M=r+b,S=y;for(let t=u+18;u<t;u+=2)d[u]=M,d[u+1]=S,b+=x,y+=w,x+=f,w+=g,M+=b,S+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(r-=2,s[r]>t){let i=this.frames[e];return s[r+1]*(t-i)/(s[r]-i)}let i=r+18;for(r+=2;r<i;r+=2)if(s[r]>=t){let e=s[r-2],i=s[r-1];return i+(t-e)/(s[r]-e)*(s[r+1]-i)}let n=s[i-2],a=s[i-1];return a+(1-a)*(t-n)/(this.frames[e+this.getFrameEntries()]-n)}apply(t,e,s,r,i,n,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let h=o.getAttachment();if(!h)return;if(!(h instanceof u)||h.timelineAttachment!=this.attachment)return;let c=o.deform;0==c.length&&(n=exports.MixBlend.setup);let d=this.vertices,p=d[0].length,m=this.frames;if(s<m[0]){switch(n){case exports.MixBlend.setup:return void(c.length=0);case exports.MixBlend.first:if(1==i)return void(c.length=0);c.length=p;let t=h;if(t.bones){i=1-i;for(f=0;f<p;f++)c[f]*=i}else{let e=t.vertices;for(var f=0;f<p;f++)c[f]+=(e[f]-c[f])*i}}return}if(c.length=p,s>=m[m.length-1]){let t=d[m.length-1];if(1==i)if(n==exports.MixBlend.add){let e=h;if(e.bones)for(let e=0;e<p;e++)c[e]+=t[e];else{let s=e.vertices;for(let e=0;e<p;e++)c[e]+=t[e]-s[e]}}else l.arrayCopy(t,0,c,0,p);else switch(n){case exports.MixBlend.setup:{let e=h;if(e.bones)for(let e=0;e<p;e++)c[e]=t[e]*i;else{let s=e.vertices;for(let e=0;e<p;e++){let r=s[e];c[e]=r+(t[e]-r)*i}}break}case exports.MixBlend.first:case exports.MixBlend.replace:for(let e=0;e<p;e++)c[e]+=(t[e]-c[e])*i;break;case exports.MixBlend.add:let e=h;if(e.bones)for(let e=0;e<p;e++)c[e]+=t[e]*i;else{let s=e.vertices;for(let e=0;e<p;e++)c[e]+=(t[e]-s[e])*i}}return}let g=b.search1(m,s),x=this.getCurvePercent(s,g),w=d[g],y=d[g+1];if(1==i)if(n==exports.MixBlend.add){let t=h;if(t.bones)for(let t=0;t<p;t++){let e=w[t];c[t]+=e+(y[t]-e)*x}else{let e=t.vertices;for(let t=0;t<p;t++){let s=w[t];c[t]+=s+(y[t]-s)*x-e[t]}}}else for(let t=0;t<p;t++){let e=w[t];c[t]=e+(y[t]-e)*x}else switch(n){case exports.MixBlend.setup:{let t=h;if(t.bones)for(let t=0;t<p;t++){let e=w[t];c[t]=(e+(y[t]-e)*x)*i}else{let e=t.vertices;for(let t=0;t<p;t++){let s=w[t],r=e[t];c[t]=r+(s+(y[t]-s)*x-r)*i}}break}case exports.MixBlend.first:case exports.MixBlend.replace:for(let t=0;t<p;t++){let e=w[t];c[t]+=(e+(y[t]-e)*x-c[t])*i}break;case exports.MixBlend.add:let t=h;if(t.bones)for(let t=0;t<p;t++){let e=w[t];c[t]+=(e+(y[t]-e)*x)*i}else{let e=t.vertices;for(let t=0;t<p;t++){let s=w[t];c[t]+=(s+(y[t]-s)*x-e[t])*i}}}}}class L extends b{static propertyIds=[""+w.event];events;constructor(t){super(t,L.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,i,n,a){if(!r)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,i,n,a),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let h=0;if(e<o[0])h=0;else{h=b.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)r.push(this.events[h])}}class q extends b{static propertyIds=[""+w.drawOrder];drawOrders;constructor(t){super(t,q.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,i,n,a){if(a==exports.MixDirection.mixOut)return void(n==exports.MixBlend.setup&&l.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(n!=exports.MixBlend.setup&&n!=exports.MixBlend.first||l.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=b.search1(this.frames,s),h=this.drawOrders[o];if(h){let e=t.drawOrder,s=t.slots;for(let t=0,r=h.length;t<r;t++)e[t]=s[h[t]]}else l.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}}class U extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,i,n,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=i,this.frames[t+4]=n?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,r,i,n,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(n){case exports.MixBlend.setup:return o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,void(o.stretch=o.data.stretch);case exports.MixBlend.first:o.mix+=(o.data.mix-o.mix)*i,o.softness+=(o.data.softness-o.softness)*i,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=b.search(l,s,6),u=this.curves[d/6];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+6]-t);h+=(l[d+6+1]-h)*e,c+=(l[d+6+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}n==exports.MixBlend.setup?(o.mix=o.data.mix+(h-o.data.mix)*i,o.softness=o.data.softness+(c-o.data.softness)*i,a==exports.MixDirection.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5])):(o.mix+=(h-o.mix)*i,o.softness+=(c-o.softness)*i,a==exports.MixDirection.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}}class W extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,i,n,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=r,l[t+3]=i,l[t+4]=n,l[t+5]=a,l[t+6]=o}apply(t,e,s,r,i,n,a){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,p,m=this.frames;if(s<m[0]){let t=o.data;switch(n){case exports.MixBlend.setup:return o.mixRotate=t.mixRotate,o.mixX=t.mixX,o.mixY=t.mixY,o.mixScaleX=t.mixScaleX,o.mixScaleY=t.mixScaleY,void(o.mixShearY=t.mixShearY);case exports.MixBlend.first:o.mixRotate+=(t.mixRotate-o.mixRotate)*i,o.mixX+=(t.mixX-o.mixX)*i,o.mixY+=(t.mixY-o.mixY)*i,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*i,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*i,o.mixShearY+=(t.mixShearY-o.mixShearY)*i}return}let f=b.search(m,s,7),g=this.curves[f/7];switch(g){case 0:let t=m[f];l=m[f+1],h=m[f+2],c=m[f+3],d=m[f+4],u=m[f+5],p=m[f+6];let e=(s-t)/(m[f+7]-t);l+=(m[f+7+1]-l)*e,h+=(m[f+7+2]-h)*e,c+=(m[f+7+3]-c)*e,d+=(m[f+7+4]-d)*e,u+=(m[f+7+5]-u)*e,p+=(m[f+7+6]-p)*e;break;case 1:l=m[f+1],h=m[f+2],c=m[f+3],d=m[f+4],u=m[f+5],p=m[f+6];break;default:l=this.getBezierValue(s,f,1,g-2),h=this.getBezierValue(s,f,2,g+18-2),c=this.getBezierValue(s,f,3,g+36-2),d=this.getBezierValue(s,f,4,g+54-2),u=this.getBezierValue(s,f,5,g+72-2),p=this.getBezierValue(s,f,6,g+90-2)}if(n==exports.MixBlend.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*i,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*i,o.mixShearY=t.mixShearY+(p-t.mixShearY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i,o.mixScaleX+=(d-o.mixScaleX)*i,o.mixScaleY+=(u-o.mixScaleY)*i,o.mixShearY+=(p-o.mixShearY)*i}}class z extends M{constraintIndex=0;constructor(t,e,s){super(t,e,w.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,i,n,o.position,o.data.position))}}class G extends M{constraintIndex=0;constructor(t,e,s){super(t,e,w.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,i,n,o.spacing,o.data.spacing))}}class $ extends y{constraintIndex=0;constructor(t,e,s){super(t,e,[w.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,i){let n=this.frames;n[t<<=2]=e,n[t+1]=s,n[t+2]=r,n[t+3]=i}apply(t,e,s,r,i,n,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(n){case exports.MixBlend.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case exports.MixBlend.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*i,o.mixX+=(o.data.mixX-o.mixX)*i,o.mixY+=(o.data.mixY-o.mixY)*i}return}let u=b.search(d,s,4),p=this.curves[u>>2];switch(p){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,p-2),h=this.getBezierValue(s,u,2,p+18-2),c=this.getBezierValue(s,u,3,p+36-2)}if(n==exports.MixBlend.setup){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*i,o.mixX=t.mixX+(h-t.mixX)*i,o.mixY=t.mixY+(c-t.mixY)*i}else o.mixRotate+=(l-o.mixRotate)*i,o.mixX+=(h-o.mixX)*i,o.mixY+=(c-o.mixY)*i}}class j extends M{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,i,n,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const r of t.physicsConstraints)r.active&&this.global(r.data)&&this.set(r,this.getAbsoluteValue2(s,i,n,this.get(r),this.setup(r),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,i,n,this.get(o),this.setup(o)))}}class H extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}}class J extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}}class K extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}}class Q extends j{constructor(t,e,s){super(t,e,s,w.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}}class Z extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}}class tt extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}}class et extends j{constructor(t,e,s){super(t,e,s,w.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}}class st extends b{static propertyIds=[w.physicsConstraintReset.toString()];constraintIndex;constructor(t,e){super(t,st.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,r,i,n,a){let o;if(-1!=this.constraintIndex&&(o=t.physicsConstraints[this.constraintIndex],!o.active))return;const l=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],i,n,a),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[b.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}}class rt extends b{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,e,s){super(t,[w.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return rt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,r,i){let n=this.frames;n[t*=rt.ENTRIES]=e,n[t+rt.MODE]=s|r<<4,n[t+rt.DELAY]=i}apply(e,s,r,i,n,a,o){let l=e.slots[this.slotIndex];if(!l.bone.active)return;let h=l.attachment,c=this.attachment;if(!(h==c||h instanceof u&&h.timelineAttachment==c))return;if(o==exports.MixDirection.mixOut)return void(a==exports.MixBlend.setup&&(l.sequenceIndex=-1));let d=this.frames;if(r<d[0])return void(a!=exports.MixBlend.setup&&a!=exports.MixBlend.first||(l.sequenceIndex=-1));let p=b.search(d,r,rt.ENTRIES),f=d[p],g=d[p+rt.MODE],x=d[p+rt.DELAY];if(!this.attachment.sequence)return;let w=g>>4,y=this.attachment.sequence.regions.length,M=m[15&g];if(M!=t.hold)switch(w+=(r-f)/x+1e-5|0,M){case t.once:w=Math.min(y-1,w);break;case t.loop:w%=y;break;case t.pingpong:{let t=(y<<1)-2;w=0==t?0:w%t,w>=y&&(w=t-w);break}case t.onceReverse:w=Math.max(y-1-w,0);break;case t.loopReverse:w=y-1-w%y;break;case t.pingpongReverse:{let t=(y<<1)-2;w=0==t?0:(w+y-1)%t,w>=y&&(w=t-w)}}l.sequenceIndex=w}}class it{static _emptyAnimation=new f("<empty>",[],0);static emptyAnimation(){return it._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new at(this);propertyIDs=new r;animationsChanged=!1;trackEntryPool=new h((()=>new nt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let i=t*r.timeScale;if(r.delay>0){if(r.delay-=i,r.delay>0)continue;i=-r.delay,r.delay=0}let n=r.next;if(n){let e=r.trackLast-n.delay;if(e>=0){for(n.delay=0,n.trackTime+=0==r.timeScale?0:(e/r.timeScale+t)*n.timeScale,r.trackTime+=i,this.setCurrent(s,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){e[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let t=r.mixingFrom;for(r.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}r.trackTime+=i}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let r=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,r=!1;for(let n=0,a=s.length;n<a;n++){let a=s[n];if(!a||a.delay>0)continue;r=!0;let o=0==n?exports.MixBlend.first:a.mixBlend,h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let c=h>=a.alphaAttachmentThreshold,d=a.animationLast,u=a.getAnimationTime(),p=u,m=e;a.reverse&&(p=a.animation.duration-p,m=null);let f=a.animation.timelines,g=f.length;if(0==n&&1==h||o==exports.MixBlend.add){0==n&&(c=!0);for(let e=0;e<g;e++){l.webkit602BugfixHelper(h,o);var i=f[e];i instanceof O?this.applyAttachmentTimeline(i,t,p,o,c):i.apply(t,d,p,m,h,o,exports.MixDirection.mixIn)}}else{let e=a.timelineMode,s=a.shortestRotation,r=!s&&a.timelinesRotation.length!=g<<1;r&&(a.timelinesRotation.length=g<<1);for(let i=0;i<g;i++){let n=f[i],u=e[i]==lt?o:exports.MixBlend.setup;!s&&n instanceof v?this.applyRotateTimeline(n,t,p,h,u,a.timelinesRotation,i<<1,r):n instanceof O?this.applyAttachmentTimeline(n,t,p,o,c):(l.webkit602BugfixHelper(h,o),n.apply(t,d,p,m,h,u,exports.MixDirection.mixIn))}}this.queueEvents(a,u),e.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime}for(var n=this.unkeyedState+pt,a=t.slots,o=0,h=t.slots.length;o<h;o++){var c=a[o];if(c.attachmentState==n){var d=c.data.attachmentName;c.setAttachment(d?t.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e,s){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,e,s);let i=0;0==t.mixDuration?(i=1,s==exports.MixBlend.first&&(s=exports.MixBlend.setup)):(i=t.mixTime/t.mixDuration,i>1&&(i=1),s!=exports.MixBlend.first&&(s=r.mixBlend));let n=i<r.mixAttachmentThreshold,a=i<r.mixDrawOrderThreshold,o=r.animation.timelines,h=o.length,c=r.alpha*t.interruptAlpha,d=c*(1-i),u=r.animationLast,p=r.getAnimationTime(),m=p,f=null;if(r.reverse?m=r.animation.duration-m:i<r.eventThreshold&&(f=this.events),s==exports.MixBlend.add)for(let t=0;t<h;t++)o[t].apply(e,u,m,f,d,s,exports.MixDirection.mixOut);else{let t=r.timelineMode,i=r.timelineHoldMix,p=r.shortestRotation,g=!p&&r.timelinesRotation.length!=h<<1;g&&(r.timelinesRotation.length=h<<1),r.totalAlpha=0;for(let x=0;x<h;x++){let h,w=o[x],b=exports.MixDirection.mixOut,y=0;switch(t[x]){case lt:if(!a&&w instanceof q)continue;h=s,y=d;break;case ht:h=exports.MixBlend.setup,y=d;break;case ct:h=s,y=c;break;case dt:h=exports.MixBlend.setup,y=c;break;default:h=exports.MixBlend.setup;let t=i[x];y=c*Math.max(0,1-t.mixTime/t.mixDuration)}r.totalAlpha+=y,!p&&w instanceof v?this.applyRotateTimeline(w,e,m,y,h,r.timelinesRotation,x<<1,g):w instanceof O?this.applyAttachmentTimeline(w,e,m,h,n&&y>=r.alphaAttachmentThreshold):(l.webkit602BugfixHelper(y,s),a&&w instanceof q&&h==exports.MixBlend.setup&&(b=exports.MixDirection.mixIn),w.apply(e,u,m,f,y,h,b))}}return t.mixDuration>0&&this.queueEvents(r,p),this.events.length=0,r.nextAnimationLast=p,r.nextTrackLast=r.trackTime,i}applyAttachmentTimeline(t,e,s,r,i){var n=e.slots[t.slotIndex];n.bone.active&&(s<t.frames[0]?r!=exports.MixBlend.setup&&r!=exports.MixBlend.first||this.setAttachment(e,n,n.data.attachmentName,i):this.setAttachment(e,n,t.attachmentNames[b.search1(t.frames,s)],i),n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+pt))}setAttachment(t,e,s,r){e.setAttachment(s?t.getAttachment(e.data.index,s):null),r&&(e.attachmentState=this.unkeyedState+mt)}applyRotateTimeline(t,e,s,r,i,a,o,l){if(l&&(a[o]=0),1==r)return void t.apply(e,0,s,null,1,i,exports.MixDirection.mixIn);let h=e.bones[t.boneIndex];if(!h.active)return;let c=0,d=0;if(s<t.frames[0])switch(i){case exports.MixBlend.setup:h.rotation=h.data.rotation;default:return;case exports.MixBlend.first:c=h.rotation,d=h.data.rotation}else c=i==exports.MixBlend.setup?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(s);let u=0,p=d-c;if(p-=360*Math.ceil(p/360-.5),0==p)u=a[o];else{let t=0,e=0;l?(t=0,e=p):(t=a[o],e=a[o+1]);let s=t-t%360;u=p+s;let r=p>=0,i=t>=0;Math.abs(e)<=90&&n.signum(e)!=n.signum(p)&&(Math.abs(t-s)>180?(u+=360*n.signum(t),i=r):0!=s?u-=360*n.signum(t):i=r),i!=r&&(u+=360*n.signum(t)),a[o]=u}a[o+1]=p,h.rotation=c+u*r}queueEvents(t,e){let s=t.animationStart,r=t.animationEnd,i=r-s,n=t.trackLast%i,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<n)break;e.time>r||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==i)h=!0;else{const e=Math.floor(t.trackTime/i);h=e>0&&e>Math.floor(t.trackLast/i)}else h=e>=r&&t.animationLast<r;for(h&&this.queue.complete(t);o<l;o++){let e=a[o];e.time<s||this.queue.event(t,e)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){let t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(s&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let r=!0,i=this.expandToIndex(t);i&&(-1==i.nextTrackLast?(this.tracks[t]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.clearNext(i),i=i.mixingFrom,r=!1):this.clearNext(i));let n=this.trackEntry(t,e,s,i);return this.setCurrent(t,n,r),this.queue.drain(),n}addAnimation(t,e,s=!1,r=0){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,i,s,r)}addAnimationWith(t,e,s=!1,r=0){if(!e)throw new Error("animation cannot be null.");let i=this.expandToIndex(t);if(i)for(;i.next;)i=i.next;let n=this.trackEntry(t,e,s,i);return i?(i.next=n,n.previous=i,r<=0&&(r+=i.getTrackComplete()-n.mixDuration)):(this.setCurrent(t,n,!0),this.queue.drain()),n.delay=r,n}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,it.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let r=this.addAnimationWith(t,it.emptyAnimation(),!1,s);return s<=0&&(r.delay+=r.mixDuration-e),r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(l.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,r){let i=this.trackEntryPool.obtain();return i.reset(),i.trackIndex=t,i.animation=e,i.loop=s,i.holdPrevious=!1,i.reverse=!1,i.shortestRotation=!1,i.eventThreshold=0,i.alphaAttachmentThreshold=0,i.mixAttachmentThreshold=0,i.mixDrawOrderThreshold=0,i.animationStart=0,i.animationEnd=e.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.mixTime=0,i.mixDuration=r?this.data.getMix(r.animation,e):0,i.interruptAlpha=1,i.totalAlpha=0,i.mixBlend=exports.MixBlend.replace,i}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do{s.mixingTo&&s.mixBlend==exports.MixBlend.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,r=t.animation.timelines.length,i=t.timelineMode;i.length=r;let n=t.timelineHoldMix;n.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<r;t++)i[t]=a.addAll(s[t].getPropertyIds())?dt:ct;else t:for(let o=0;o<r;o++){let r=s[o],l=r.getPropertyIds();if(a.addAll(l))if(!e||r instanceof O||r instanceof q||r instanceof L||!e.animation.hasTimeline(l))i[o]=ht;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){i[o]=ut,n[o]=s;continue t}break}i[o]=dt}else i[o]=lt}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}}class nt{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,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}mixBlend=exports.MixBlend.replace;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?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(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}}class at{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(exports.EventType.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(exports.EventType.interrupt),this.objects.push(t)}end(t){this.objects.push(exports.EventType.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(exports.EventType.dispose),this.objects.push(t)}complete(t){this.objects.push(exports.EventType.complete),this.objects.push(t)}event(t,e){this.objects.push(exports.EventType.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let r=t[s],i=t[s+1];switch(r){case exports.EventType.start:i.listener&&i.listener.start&&i.listener.start(i);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(i)}break;case exports.EventType.interrupt:i.listener&&i.listener.interrupt&&i.listener.interrupt(i);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(i)}break;case exports.EventType.end:i.listener&&i.listener.end&&i.listener.end(i);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(i)}case exports.EventType.dispose:i.listener&&i.listener.dispose&&i.listener.dispose(i);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(i)}this.animState.trackEntryPool.free(i);break;case exports.EventType.complete:i.listener&&i.listener.complete&&i.listener.complete(i);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(i)}break;case exports.EventType.event:let r=t[2+s++];i.listener&&i.listener.event&&i.listener.event(i,r);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(i,r)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var ot;exports.EventType=void 0,(ot=exports.EventType||(exports.EventType={}))[ot.start=0]="start",ot[ot.interrupt=1]="interrupt",ot[ot.end=2]="end",ot[ot.dispose=3]="dispose",ot[ot.complete=4]="complete",ot[ot.event=5]="event";const lt=0,ht=1,ct=2,dt=3,ut=4,pt=1,mt=2;class ft{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);this.setMixWith(r,i,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return void 0===r?this.defaultMix:r}}class gt extends u{color=new i(1,1,1,1);constructor(t){super(t)}copy(){let t=new gt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class xt extends u{endSlot=null;color=new i(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new xt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class wt{_image;constructor(t){this._image=t}getImage(){return this._image}}var bt,yt,Mt,St,vt,kt,It,At,Bt;exports.TextureFilter=void 0,(bt=exports.TextureFilter||(exports.TextureFilter={}))[bt.Nearest=9728]="Nearest",bt[bt.Linear=9729]="Linear",bt[bt.MipMap=9987]="MipMap",bt[bt.MipMapNearestNearest=9984]="MipMapNearestNearest",bt[bt.MipMapLinearNearest=9985]="MipMapLinearNearest",bt[bt.MipMapNearestLinear=9986]="MipMapNearestLinear",bt[bt.MipMapLinearLinear=9987]="MipMapLinearLinear",exports.TextureWrap=void 0,(yt=exports.TextureWrap||(exports.TextureWrap={}))[yt.MirroredRepeat=33648]="MirroredRepeat",yt[yt.ClampToEdge=33071]="ClampToEdge",yt[yt.Repeat=10497]="Repeat";class Tt{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0}class Ct{pages=new Array;regions=new Array;constructor(t){let e=new Ft(t),s=new Array(4),r={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=l.enumValue(exports.TextureFilter,s[1]),t.magFilter=l.enumValue(exports.TextureFilter,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=exports.TextureWrap.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=exports.TextureWrap.Repeat)},pma:t=>{t.pma="true"==s[1]}};var i={xy:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2])},size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},bounds:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2]),t.width=parseInt(s[3]),t.height=parseInt(s[4])},offset:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2])},orig:t=>{t.originalWidth=parseInt(s[1]),t.originalHeight=parseInt(s[2])},offsets:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2]),t.originalWidth=parseInt(s[3]),t.originalHeight=parseInt(s[4])},rotate:t=>{let e=s[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:t=>{t.index=parseInt(s[1])}};let n=e.readLine();for(;n&&0==n.trim().length;)n=e.readLine();for(;n&&0!=n.trim().length&&0!=e.readEntry(s,n);)n=e.readLine();let a=null,o=null,h=null;for(;null!==n;)if(0==n.trim().length)a=null,n=e.readLine();else if(a){let t=new Yt(a,n);for(;;){let r=e.readEntry(s,n=e.readLine());if(0==r)break;let a=i[s[0]];if(a)a(t);else{o||(o=[]),h||(h=[]),o.push(s[0]);let t=[];for(let e=0;e<r;e++)t.push(parseInt(s[e+1]));h.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&h&&h.length>0&&(t.names=o,t.values=h,o=null,h=null),t.u=t.x/a.width,t.v=t.y/a.height,90==t.degrees?(t.u2=(t.x+t.height)/a.width,t.v2=(t.y+t.width)/a.height):(t.u2=(t.x+t.width)/a.width,t.v2=(t.y+t.height)/a.height),this.regions.push(t)}else{for(a=new Et(n.trim());0!=e.readEntry(s,n=e.readLine());){let t=r[s[0]];t&&t(a)}this.pages.push(a)}}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()}}class Ft{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)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let r=1,i=s+1;;r++){let s=e.indexOf(",",i);if(-1==s)return t[r]=e.substr(i).trim(),r;if(t[r]=e.substr(i,s-i).trim(),i=s+1,4==r)return 4}}}class Et{name;minFilter=exports.TextureFilter.Nearest;magFilter=exports.TextureFilter.Nearest;uWrap=exports.TextureWrap.ClampToEdge;vWrap=exports.TextureWrap.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}}class Yt extends Tt{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)}}class Rt extends u{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new i(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new i(0,0,0,0);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=l.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,r=this.region.u,i=this.region.v,n=0,a=0;if(this.region instanceof Yt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/h,i-=(o.originalWidth-o.offsetX-o.width)/c,n=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+t[o+1]*n,e[o+1]=i+(1-t[o])*a;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/h,i-=o.offsetY/c,n=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o])*n,e[o+1]=i+(1-t[o+1])*a;return;case 270:r-=o.offsetY/h,i-=o.offsetX/c,n=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o+1])*n,e[o+1]=i+t[o]*a;return}r-=o.offsetX/h,i-=(o.originalHeight-o.offsetY-o.height)/c,n=o.originalWidth/h,a=o.originalHeight/c}else this.region?(n=this.region.u2-r,a=this.region.v2-i):(r=i=0,n=a=1);for(let o=0;o<s;o+=2)e[o]=r+t[o]*n,e[o+1]=i+t[o+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Rt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),l.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),l.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),l.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),l.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,i,n){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,i,n)}newLinkedMesh(){let t=new Rt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),null!=t.region&&t.updateRegion(),t}}class Pt extends u{lengths=[];closed=!1;constantSpeed=!1;color=new i(1,1,1,1);constructor(t){super(t)}copy(){let t=new Pt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),l.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Xt extends u{x=0;y=0;rotation=0;color=new i(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){const e=this.rotation*n.degRad,s=Math.cos(e),r=Math.sin(e),i=s*t.a+r*t.b,a=s*t.c+r*t.d;return n.atan2Deg(a,i)}copy(){let t=new Xt(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class _t extends d{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new i(1,1,1,1);path;region=null;sequence=null;offset=l.newFloatArray(8);uvs=l.newFloatArray(8);tempColor=new i(1,1,1,1);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,i=-this.width/2*this.scaleX+this.region.offsetX*s,a=-this.height/2*this.scaleY+this.region.offsetY*r,o=i+this.region.width*s,l=a+this.region.height*r,h=this.rotation*n.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,p=this.y,m=i*c+u,f=i*d,g=a*c+p,x=a*d,w=o*c+u,b=o*d,y=l*c+p,M=l*d,S=this.offset;S[0]=m-x,S[1]=g+f,S[2]=m-M,S[3]=y+f,S[4]=w-M,S[5]=y+b,S[6]=w-x,S[7]=g+b,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){null!=this.sequence&&this.sequence.apply(t,this);let i=t.bone,n=this.offset,a=i.worldX,o=i.worldY,l=i.a,h=i.b,c=i.c,d=i.d,u=0,p=0;u=n[0],p=n[1],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[2],p=n[3],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[4],p=n[5],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o,s+=r,u=n[6],p=n[7],e[s]=u*l+p*h+a,e[s+1]=u*c+p*d+o}copy(){let t=new _t(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,l.arrayCopy(this.uvs,0,t.uvs,0,8),l.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31}class Vt{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let i=0,n=r.length;i<n;i++){let n=s.getPath(e,i),a=this.atlas.findRegion(n);if(null==a)throw new Error("Region not found in atlas: "+n+" (sequence: "+t+")");r[i]=a}}newRegionAttachment(t,e,s,r){let i=new _t(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");i.region=t}return i}newMeshAttachment(t,e,s,r){let i=new Rt(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");i.region=t}return i}newBoundingBoxAttachment(t,e){return new gt(e)}newPathAttachment(t,e){return new Pt(e)}newPointAttachment(t,e){return new Xt(e)}newClippingAttachment(t,e){return new xt(e)}}class Dt{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=exports.Inherit.Normal;skinRequired=!1;color=new i;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}}exports.Inherit=void 0,(Mt=exports.Inherit||(exports.Inherit={}))[Mt.Normal=0]="Normal",Mt[Mt.OnlyTranslation=1]="OnlyTranslation",Mt[Mt.NoRotationOrReflection=2]="NoRotationOrReflection",Mt[Mt.NoScale=3]="NoScale",Mt[Mt.NoScaleOrReflection=4]="NoScaleOrReflection";class Ot{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=exports.Inherit.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,i,a,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=i,this.ashearX=a,this.ashearY=o;let l=this.parent;if(!l){let l=this.skeleton;const h=l.scaleX,c=l.scaleY,d=(s+a)*n.degRad,u=(s+90+o)*n.degRad;return this.a=Math.cos(d)*r*h,this.b=Math.cos(u)*i*h,this.c=Math.sin(d)*r*c,this.d=Math.sin(u)*i*c,this.worldX=t*h+l.x,void(this.worldY=e*c+l.y)}let h=l.a,c=l.b,d=l.c,u=l.d;switch(this.worldX=h*t+c*e+l.worldX,this.worldY=d*t+u*e+l.worldY,this.inherit){case exports.Inherit.Normal:{const t=(s+a)*n.degRad,e=(s+90+o)*n.degRad,l=Math.cos(t)*r,p=Math.cos(e)*i,m=Math.sin(t)*r,f=Math.sin(e)*i;return this.a=h*l+c*m,this.b=h*p+c*f,this.c=d*l+u*m,void(this.d=d*p+u*f)}case exports.Inherit.OnlyTranslation:{const t=(s+a)*n.degRad,e=(s+90+o)*n.degRad;this.a=Math.cos(t)*r,this.b=Math.cos(e)*i,this.c=Math.sin(t)*r,this.d=Math.sin(e)*i;break}case exports.Inherit.NoRotationOrReflection:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;h*=t,d*=e;let l=h*h+d*d,p=0;l>1e-4?(l=Math.abs(h*u*e-c*t*d)/l,c=d*l,u=h*l,p=Math.atan2(d,h)*n.radDeg):(h=0,d=0,p=90-Math.atan2(u,c)*n.radDeg);const m=(s+a-p)*n.degRad,f=(s+o-p+90)*n.degRad,g=Math.cos(m)*r,x=Math.cos(f)*i,w=Math.sin(m)*r,b=Math.sin(f)*i;this.a=h*g-c*w,this.b=h*x-c*b,this.c=d*g+u*w,this.d=d*x+u*b;break}case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:{s*=n.degRad;const t=Math.cos(s),e=Math.sin(s);let l=(h*t+c*e)/this.skeleton.scaleX,p=(d*t+u*e)/this.skeleton.scaleY,m=Math.sqrt(l*l+p*p);m>1e-5&&(m=1/m),l*=m,p*=m,m=Math.sqrt(l*l+p*p),this.inherit==exports.Inherit.NoScale&&h*u-c*d<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(p,l);const f=Math.cos(s)*m,g=Math.sin(s)*m;a*=n.degRad,o=(90+o)*n.degRad;const x=Math.cos(a)*r,w=Math.cos(o)*i,b=Math.sin(a)*r,y=Math.sin(o)*i;this.a=l*x+f*b,this.b=l*w+f*y,this.c=p*x+g*b,this.d=p*w+g*y;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)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*n.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,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*n.radDeg);let e,s,r,i,a=t.a,o=t.b,l=t.c,h=t.d,c=1/(a*h-o*l),d=h*c,u=o*c,p=l*c,m=a*c,f=this.worldX-t.worldX,g=this.worldY-t.worldY;if(this.ax=f*d-g*u,this.ay=g*m-f*p,this.inherit==exports.Inherit.OnlyTranslation)e=this.a,s=this.b,r=this.c,i=this.d;else{switch(this.inherit){case exports.Inherit.NoRotationOrReflection:{let t=Math.abs(a*h-o*l)/(a*a+l*l);o=-l*this.skeleton.scaleX*t/this.skeleton.scaleY,h=a*this.skeleton.scaleY*t/this.skeleton.scaleX,c=1/(a*h-o*l),d=h*c,u=o*c;break}case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:let t=n.cosDeg(this.rotation),e=n.sinDeg(this.rotation);a=(a*t+o*e)/this.skeleton.scaleX,l=(l*t+h*e)/this.skeleton.scaleY;let s=Math.sqrt(a*a+l*l);s>1e-5&&(s=1/s),a*=s,l*=s,s=Math.sqrt(a*a+l*l),this.inherit==exports.Inherit.NoScale&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let r=n.PI/2+Math.atan2(l,a);o=Math.cos(r)*s,h=Math.sin(r)*s,c=1/(a*h-o*l),d=h*c,u=o*c,p=l*c,m=a*c}e=d*this.a-u*this.c,s=d*this.b-u*this.d,r=m*this.c-p*this.a,i=m*this.d-p*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+r*r),this.ascaleX>1e-4){let t=e*i-s*r;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+r*i,t)*n.radDeg,this.arotation=Math.atan2(r,e)*n.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+i*i),this.ashearY=0,this.arotation=90-Math.atan2(i,s)*n.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*n.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*n.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,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*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(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=n.sinDeg(t),s=n.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*n.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=n.sinDeg(t),s=n.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*n.radDeg}rotateWorld(t){t*=n.degRad;const e=Math.sin(t),s=Math.cos(t),r=this.a,i=this.b;this.a=s*r-e*this.c,this.b=s*i-e*this.d,this.c=e*r+s*this.c,this.d=e*i+s*this.d}}class Nt{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class Lt{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,r=new Uint8Array(s),i=0;i<s;i++)r[i]=e.charCodeAt(i);return r}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)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;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",t,!0);let i=()=>{this.finish(t,r.status,r.responseText)};r.onload=i,r.onerror=i,r.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer";let i=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{200==r.status||0==r.status?this.finish(t,200,new Uint8Array(r.response)):i()},r.onerror=i,r.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let i=200==e||0==e?[s]:[e,s];for(let t=i.length-1,e=r.length;t<e;t+=2)r[t].apply(null,i)}}class qt{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}}class Ut{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}}class Wt{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 s=0;s<t.bones.length;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].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(0==this.mix)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)}}apply1(t,e,s,r,i,a,o){let l=t.parent;if(!l)throw new Error("IK bone must have parent.");let h=l.a,c=l.b,d=l.c,u=l.d,p=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case exports.Inherit.OnlyTranslation:m=(e-t.worldX)*n.signum(t.skeleton.scaleX),f=(s-t.worldY)*n.signum(t.skeleton.scaleY);break;case exports.Inherit.NoRotationOrReflection:let r=Math.abs(h*u-c*d)/Math.max(1e-4,h*h+d*d),i=h/t.skeleton.scaleX,a=d/t.skeleton.scaleY;c=-a*r*t.skeleton.scaleX,u=i*r*t.skeleton.scaleY,p+=Math.atan2(a,i)*n.radDeg;default:let o=e-l.worldX,g=s-l.worldY,x=h*u-c*d;Math.abs(x)<=1e-4?(m=0,f=0):(m=(o*u-g*c)/x-t.ax,f=(g*h-o*d)/x-t.ay)}p+=Math.atan2(f,m)*n.radDeg,t.ascaleX<0&&(p+=180),p>180?p-=360:p<-180&&(p+=360);let g=t.ascaleX,x=t.ascaleY;if(r||i){switch(t.inherit){case exports.Inherit.NoScale:case exports.Inherit.NoScaleOrReflection:m=e-t.worldX,f=s-t.worldY}const n=t.data.length*g;if(n>1e-4){const t=m*m+f*f;if(r&&t<n*n||i&&t>n*n){const e=(Math.sqrt(t)/n-1)*o+1;g*=e,a&&(x*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+p*o,g,x,t.ashearX,t.ashearY)}apply2(t,e,s,r,i,a,o,l,h){if(t.inherit!=exports.Inherit.Normal||e.inherit!=exports.Inherit.Normal)return;let c=t.ax,d=t.ay,u=t.ascaleX,p=t.ascaleY,m=u,f=p,g=e.ascaleX,x=0,w=0,b=0;u<0?(u=-u,x=180,b=-1):(x=0,b=1),p<0&&(p=-p,b=-b),g<0?(g=-g,w=180):w=0;let y=e.ax,M=0,S=0,v=0,k=t.a,I=t.b,A=t.c,B=t.d,T=Math.abs(u-p)<=1e-4;!T||a?(M=0,S=k*y+t.worldX,v=A*y+t.worldY):(M=e.ay,S=k*y+I*M+t.worldX,v=A*y+B*M+t.worldY);let C=t.parent;if(!C)throw new Error("IK parent must itself have a parent.");k=C.a,I=C.b,A=C.c,B=C.d;let F=k*B-I*A,E=S-C.worldX,Y=v-C.worldY;F=Math.abs(F)<=1e-4?0:1/F;let R,P,X=(E*B-Y*I)*F-c,_=(Y*k-E*A)*F-d,V=Math.sqrt(X*X+_*_),D=e.data.length*g;if(V<1e-4)return this.apply1(t,s,r,!1,a,!1,h),void e.updateWorldTransformWith(y,M,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);E=s-C.worldX,Y=r-C.worldY;let O=(E*B-Y*I)*F-c,N=(Y*k-E*A)*F-d,L=O*O+N*N;if(0!=l){l*=u*(g+1)*.5;let t=Math.sqrt(L),e=t-V-D*u+l;if(e>0){let s=Math.min(1,e/(2*l))-1;s=(e-l*(1-s*s))/t,O-=s*O,N-=s*N,L=O*O+N*N}}t:if(T){D*=u;let t=(L-V*V-D*D)/(2*V*D);t<-1?(t=-1,P=Math.PI*i):t>1?(t=1,P=0,a&&(k=(Math.sqrt(L)/(V+D)-1)*h+1,m*=k,o&&(f*=k))):P=Math.acos(t)*i,k=V+D*t,I=D*Math.sin(P),R=Math.atan2(N*k-O*I,O*k+N*I)}else{k=u*D,I=p*D;let t=k*k,e=I*I,s=Math.atan2(N,O);A=e*V*V+t*L-t*e;let r=-2*e*V,a=e-t;if(B=r*r-4*a*A,B>=0){let t=Math.sqrt(B);r<0&&(t=-t),t=.5*-(r+t);let e=t/a,n=A/t,o=Math.abs(e)<Math.abs(n)?e:n;if(e=L-o*o,e>=0){Y=Math.sqrt(e)*i,R=s-Math.atan2(Y,o),P=Math.atan2(Y/p,(o-V)/u);break t}}let o=n.PI,l=V-k,h=l*l,c=0,d=0,m=V+k,f=m*m,g=0;A=-k*V/(t-e),A>=-1&&A<=1&&(A=Math.acos(A),E=k*Math.cos(A)+V,Y=I*Math.sin(A),B=E*E+Y*Y,B<h&&(o=A,h=B,l=E,c=Y),B>f&&(d=A,f=B,m=E,g=Y)),L<=.5*(h+f)?(R=s-Math.atan2(c*i,l),P=o*i):(R=s-Math.atan2(g*i,m),P=d*i)}let q=Math.atan2(M,y)*b,U=t.arotation;R=(R-q)*n.radDeg+x-U,R>180?R-=360:R<-180&&(R+=360),t.updateWorldTransformWith(c,d,U+R*h,m,f,0,0),U=e.arotation,P=((P+q)*n.radDeg-e.ashearX)*b+w-U,P>180?P-=360:P<-180&&(P+=360),e.updateWorldTransformWith(y,M,U+P*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class zt extends Nt{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)}}class Gt extends Nt{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=exports.PositionMode.Fixed;spacingMode=exports.SpacingMode.Fixed;rotateMode=exports.RotateMode.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}}exports.PositionMode=void 0,(St=exports.PositionMode||(exports.PositionMode={}))[St.Fixed=0]="Fixed",St[St.Percent=1]="Percent",exports.SpacingMode=void 0,(vt=exports.SpacingMode||(exports.SpacingMode={}))[vt.Length=0]="Length",vt[vt.Fixed=1]="Fixed",vt[vt.Percent=2]="Percent",vt[vt.Proportional=3]="Proportional",exports.RotateMode=void 0,(kt=exports.RotateMode||(exports.RotateMode={}))[kt.Tangent=0]="Tangent",kt[kt.Chain=1]="Chain",kt[kt.ChainScale=2]="ChainScale";class $t{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,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 s=0,r=t.bones.length;s<r;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof Pt))return;let s=this.mixRotate,r=this.mixX,i=this.mixY;if(0==s&&0==r&&0==i)return;let a=this.data,o=a.rotateMode==exports.RotateMode.Tangent,h=a.rotateMode==exports.RotateMode.ChainScale,c=this.bones,d=c.length,u=o?d:d+1,p=l.setArraySize(this.spaces,u),m=h?this.lengths=l.setArraySize(this.lengths,d):[],f=this.spacing;switch(a.spacingMode){case exports.SpacingMode.Percent:if(h)for(let t=0,e=u-1;t<e;t++){let e=c[t],s=e.data.length,r=s*e.a,i=s*e.c;m[t]=Math.sqrt(r*r+i*i)}l.arrayFill(p,1,u,f);break;case exports.SpacingMode.Proportional:let t=0;for(let e=0,s=u-1;e<s;){let s=c[e],r=s.data.length;if(r<$t.epsilon)h&&(m[e]=0),p[++e]=f;else{let i=r*s.a,n=r*s.c,a=Math.sqrt(i*i+n*n);h&&(m[e]=a),p[++e]=a,t+=a}}if(t>0){t=u/t*f;for(let e=1;e<u;e++)p[e]*=t}break;default:let e=a.spacingMode==exports.SpacingMode.Length;for(let t=0,s=u-1;t<s;){let s=c[t],r=s.data.length;if(r<$t.epsilon)h&&(m[t]=0),p[++t]=f;else{let i=r*s.a,n=r*s.c,a=Math.sqrt(i*i+n*n);h&&(m[t]=a),p[++t]=(e?r+f:f)*a/r}}}let g=this.computeWorldPositions(e,u,o),x=g[0],w=g[1],b=a.offsetRotation,y=!1;if(0==b)y=a.rotateMode==exports.RotateMode.Chain;else{y=!1;let t=this.target.bone;b*=t.a*t.d-t.b*t.c>0?n.degRad:-n.degRad}for(let t=0,e=3;t<d;t++,e+=3){let a=c[t];a.worldX+=(x-a.worldX)*r,a.worldY+=(w-a.worldY)*i;let l=g[e],d=g[e+1],u=l-x,f=d-w;if(h){let e=m[t];if(0!=e){let t=(Math.sqrt(u*u+f*f)/e-1)*s+1;a.a*=t,a.c*=t}}if(x=l,w=d,s>0){let r=a.a,i=a.b,l=a.c,h=a.d,c=0,d=0,m=0;if(c=o?g[e-1]:0==p[t+1]?g[e+2]:Math.atan2(f,u),c-=Math.atan2(l,r),y){d=Math.cos(c),m=Math.sin(c);let t=a.data.length;x+=(t*(d*r-m*l)-u)*s,w+=(t*(m*r+d*l)-f)*s}else c+=b;c>n.PI?c-=n.PI2:c<-n.PI&&(c+=n.PI2),c*=s,d=Math.cos(c),m=Math.sin(c),a.a=d*r-m*l,a.b=d*i-m*h,a.c=m*r+d*l,a.d=m*i+d*h}a.updateAppliedTransform()}}computeWorldPositions(t,e,s){let r=this.target,i=this.position,n=this.spaces,a=l.setArraySize(this.positions,3*e+2),o=this.world,h=t.closed,c=t.worldVerticesLength,d=c/6,u=$t.NONE;if(!t.constantSpeed){let p=t.lengths;d-=h?1:2;let m,f=p[d];switch(this.data.positionMode==exports.PositionMode.Percent&&(i*=f),this.data.spacingMode){case exports.SpacingMode.Percent:m=f;break;case exports.SpacingMode.Proportional:m=f/e;break;default:m=1}o=l.setArraySize(this.world,8);for(let l=0,g=0,x=0;l<e;l++,g+=3){let e=n[l]*m;i+=e;let w=i;if(h)w%=f,w<0&&(w+=f),x=0;else{if(w<0){u!=$t.BEFORE&&(u=$t.BEFORE,t.computeWorldVertices(r,2,4,o,0,2)),this.addBeforePosition(w,o,0,a,g);continue}if(w>f){u!=$t.AFTER&&(u=$t.AFTER,t.computeWorldVertices(r,c-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,a,g);continue}}for(;;x++){let t=p[x];if(!(w>t)){if(0==x)w/=t;else{let e=p[x-1];w=(w-e)/(t-e)}break}}x!=u&&(u=x,h&&x==d?(t.computeWorldVertices(r,c-4,4,o,0,2),t.computeWorldVertices(r,0,4,o,4,2)):t.computeWorldVertices(r,6*x+2,8,o,0,2)),this.addCurvePosition(w,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],a,g,s||l>0&&0==e)}return a}h?(c+=2,o=l.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,o,0,2),t.computeWorldVertices(r,0,2,o,c-4,2),o[c-2]=o[0],o[c-1]=o[1]):(d--,c-=4,o=l.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,o,0,2));let p,m=l.setArraySize(this.curves,d),f=0,g=o[0],x=o[1],w=0,b=0,y=0,M=0,S=0,v=0,k=0,I=0,A=0,B=0,T=0,C=0,F=0,E=0;for(let t=0,e=2;t<d;t++,e+=6)w=o[e],b=o[e+1],y=o[e+2],M=o[e+3],S=o[e+4],v=o[e+5],k=.1875*(g-2*w+y),I=.1875*(x-2*b+M),A=.09375*(3*(w-y)-g+S),B=.09375*(3*(b-M)-x+v),T=2*k+A,C=2*I+B,F=.75*(w-g)+k+.16666667*A,E=.75*(b-x)+I+.16666667*B,f+=Math.sqrt(F*F+E*E),F+=T,E+=C,T+=A,C+=B,f+=Math.sqrt(F*F+E*E),F+=T,E+=C,f+=Math.sqrt(F*F+E*E),F+=T+A,E+=C+B,f+=Math.sqrt(F*F+E*E),m[t]=f,g=S,x=v;switch(this.data.positionMode==exports.PositionMode.Percent&&(i*=f),this.data.spacingMode){case exports.SpacingMode.Percent:p=f;break;case exports.SpacingMode.Proportional:p=f/e;break;default:p=1}let Y=this.segments,R=0;for(let t=0,r=0,l=0,d=0;t<e;t++,r+=3){let e=n[t]*p;i+=e;let P=i;if(h)P%=f,P<0&&(P+=f),l=0;else{if(P<0){this.addBeforePosition(P,o,0,a,r);continue}if(P>f){this.addAfterPosition(P-f,o,c-4,a,r);continue}}for(;;l++){let t=m[l];if(!(P>t)){if(0==l)P/=t;else{let e=m[l-1];P=(P-e)/(t-e)}break}}if(l!=u){u=l;let t=6*l;for(g=o[t],x=o[t+1],w=o[t+2],b=o[t+3],y=o[t+4],M=o[t+5],S=o[t+6],v=o[t+7],k=.03*(g-2*w+y),I=.03*(x-2*b+M),A=.006*(3*(w-y)-g+S),B=.006*(3*(b-M)-x+v),T=2*k+A,C=2*I+B,F=.3*(w-g)+k+.16666667*A,E=.3*(b-x)+I+.16666667*B,R=Math.sqrt(F*F+E*E),Y[0]=R,t=1;t<8;t++)F+=T,E+=C,T+=A,C+=B,R+=Math.sqrt(F*F+E*E),Y[t]=R;F+=T,E+=C,R+=Math.sqrt(F*F+E*E),Y[8]=R,F+=T+A,E+=C+B,R+=Math.sqrt(F*F+E*E),Y[9]=R,d=0}for(P*=R;;d++){let t=Y[d];if(!(P>t)){if(0==d)P/=t;else{let e=Y[d-1];P=d+(P-e)/(t-e)}break}}this.addCurvePosition(.1*P,g,x,w,b,y,M,S,v,a,r,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,r,i){let n=e[s],a=e[s+1],o=e[s+2]-n,l=e[s+3]-a,h=Math.atan2(l,o);r[i]=n+t*Math.cos(h),r[i+1]=a+t*Math.sin(h),r[i+2]=h}addAfterPosition(t,e,s,r,i){let n=e[s+2],a=e[s+3],o=n-e[s],l=a-e[s+1],h=Math.atan2(l,o);r[i]=n+t*Math.cos(h),r[i+1]=a+t*Math.sin(h),r[i+2]=h}addCurvePosition(t,e,s,r,i,n,a,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(i-s,r-e));let u=t*t,p=u*t,m=1-t,f=m*m,g=f*m,x=m*t,w=3*x,b=m*w,y=w*t,M=e*g+r*b+n*y+o*p,S=s*g+i*b+a*y+l*p;h[c]=M,h[c+1]=S,d&&(h[c+2]=t<.001?Math.atan2(i-s,r-e):Math.atan2(S-(s*f+i*x*2+a*u),M-(e*f+r*x*2+n*u)))}}class jt{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(0==e)return;const s=this.data.x>0,r=this.data.y>0,i=this.data.rotate>0||this.data.shearX>0,a=this.data.scaleX>0,o=this.bone,l=o.data.length;switch(t){case exports.Physics.none:return;case exports.Physics.reset:this.reset();case exports.Physics.update:const t=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=t.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,p=this.inertia,m=this.data.step,f=this.skeleton.data.referenceScale,g=-1,x=this.data.limit*h,w=x*Math.abs(t.scaleY);if(x*=Math.abs(t.scaleX),s||r){if(s){const t=(this.ux-c)*p;this.xOffset+=t>x?x:t<-x?-x:t,this.ux=c}if(r){const t=(this.uy-d)*p;this.yOffset+=t>w?w:t<-w?-w:t,this.uy=d}if(u>=m){g=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,i=this.wind*f,n=(Kt.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(i-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=g),r&&(this.yVelocity-=(n+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=g),u-=m}while(u>=m)}s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i||a){let t=Math.atan2(o.c,o.a),s=0,r=0,h=0,c=this.cx-o.worldX,d=this.cy-o.worldY;if(c>x?c=x:c<-x&&(c=-x),d>w?d=w:d<-w&&(d=-w),i){h=(this.data.rotate+this.data.shearX)*e;let i=Math.atan2(d+this.ty,c+this.tx)-t-this.rotateOffset*h;this.rotateOffset+=(i-Math.ceil(i*n.invPI2-.5)*n.PI2)*p,i=this.rotateOffset*h+t,s=Math.cos(i),r=Math.sin(i),a&&(i=l*o.getWorldScaleX(),i>0&&(this.scaleOffset+=(c*s+d*r)*p/i))}else{s=Math.cos(t),r=Math.sin(t);const e=l*o.getWorldScaleX();e>0&&(this.scaleOffset+=(c*s+d*r)*p/e)}if(u=this.remaining,u>=m){-1==g&&(g=Math.pow(this.damping,60*m));const e=this.massInverse*m,n=this.strength,o=this.wind,c=Kt.yDown?-this.gravity:this.gravity,d=l/f;for(;;)if(u-=m,a&&(this.scaleVelocity+=(o*s-c*r-this.scaleOffset*n)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=g),i){if(this.rotateVelocity-=((o*r+c*s)*d+this.rotateOffset*n)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=g,u<m)break;const i=this.rotateOffset*h+t;s=Math.cos(i),r=Math.sin(i)}else if(u<m)break}}this.remaining=u}this.cx=o.worldX,this.cy=o.worldY;break;case exports.Physics.pose:s&&(o.worldX+=this.xOffset*e*this.data.x),r&&(o.worldY+=this.yOffset*e*this.data.y)}if(i){let t=this.rotateOffset*e,s=0,r=0,i=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),r=Math.cos(e),i=o.b,o.b=r*i-s*o.d,o.d=s*i+r*o.d),e+=t*this.data.shearX,s=Math.sin(e),r=Math.cos(e),i=o.a,o.a=r*i-s*o.c,o.c=s*i+r*o.c}else t*=this.data.rotate,s=Math.sin(t),r=Math.cos(t),i=o.a,o.a=r*i-s*o.c,o.c=s*i+r*o.c,i=o.b,o.b=r*i-s*o.d,o.d=s*i+r*o.d}if(a){const t=1+this.scaleOffset*e*this.data.scaleX;o.a*=t,o.c*=t}t!=exports.Physics.pose&&(this.tx=l*o.a,this.ty=l*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const r=s*n.degRad,i=Math.cos(r),a=Math.sin(r),o=this.cx-t,l=this.cy-e;this.translate(o*i-l*a-o,o*a+l*i-l)}}class Ht{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 i,this.darkColor=t.darkColor?new i:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof u&&this.attachment instanceof u&&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}}class Jt{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new c;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 s=0;s<t.bones.length;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].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){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(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,r=this.mixScaleX,i=this.mixScaleY,a=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,p=h*u-c*d>0?n.degRad:-n.degRad,m=this.data.offsetRotation*p,f=this.data.offsetShearY*p,g=this.bones;for(let p=0,x=g.length;p<x;p++){let x=g[p];if(0!=t){let e=x.a,s=x.b,r=x.c,i=x.d,a=Math.atan2(d,h)-Math.atan2(r,e)+m;a>n.PI?a-=n.PI2:a<-n.PI&&(a+=n.PI2),a*=t;let o=Math.cos(a),l=Math.sin(a);x.a=o*e-l*r,x.b=o*s-l*i,x.c=l*e+o*r,x.d=l*s+o*i}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(t.x-x.worldX)*e,x.worldY+=(t.y-x.worldY)*s}if(0!=r){let t=Math.sqrt(x.a*x.a+x.c*x.c);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleX)*r)/t),x.a*=t,x.c*=t}if(0!=i){let t=Math.sqrt(x.b*x.b+x.d*x.d);0!=t&&(t=(t+(Math.sqrt(c*c+u*u)-t+this.data.offsetScaleY)*i)/t),x.b*=t,x.d*=t}if(a>0){let t=x.b,e=x.d,s=Math.atan2(e,t),r=Math.atan2(u,c)-Math.atan2(d,h)-(s-Math.atan2(x.c,x.a));r>n.PI?r-=n.PI2:r<-n.PI&&(r+=n.PI2),r=s+(r+f)*a;let i=Math.sqrt(t*t+e*e);x.b=Math.cos(r)*i,x.d=Math.sin(r)*i}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,a=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.a,c=l.b,d=l.c,u=l.d,p=h*u-c*d>0?n.degRad:-n.degRad,m=this.data.offsetRotation*p,f=this.data.offsetShearY*p,g=this.bones;for(let p=0,x=g.length;p<x;p++){let x=g[p];if(0!=t){let e=x.a,s=x.b,r=x.c,i=x.d,a=Math.atan2(d,h)+m;a>n.PI?a-=n.PI2:a<-n.PI&&(a+=n.PI2),a*=t;let o=Math.cos(a),l=Math.sin(a);x.a=o*e-l*r,x.b=o*s-l*i,x.c=l*e+o*r,x.d=l*s+o*i}if(o){let t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=t.x*e,x.worldY+=t.y*s}if(0!=r){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleX)*r+1;x.a*=t,x.c*=t}if(0!=i){let t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleY)*i+1;x.b*=t,x.d*=t}if(a>0){let t=Math.atan2(u,c)-Math.atan2(d,h);t>n.PI?t-=n.PI2:t<-n.PI&&(t+=n.PI2);let e=x.b,s=x.d;t=Math.atan2(s,e)+(t-n.PI/2+f)*a;let r=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*r,x.d=Math.sin(t)*r}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation;0!=t&&(c+=(a.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(a.ax-d+this.data.offsetX)*e,u+=(a.ay-u+this.data.offsetY)*s;let p=h.ascaleX,m=h.ascaleY;0!=r&&0!=p&&(p=(p+(a.ascaleX-p+this.data.offsetScaleX)*r)/p),0!=i&&0!=m&&(m=(m+(a.ascaleY-m+this.data.offsetScaleY)*i)/m);let f=h.ashearY;0!=n&&(f+=(a.ashearY-f+this.data.offsetShearY)*n),h.updateWorldTransformWith(d,u,c,p,m,h.ashearX,f)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,i=this.mixScaleY,n=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(a.arotation+this.data.offsetRotation)*t,d=h.ax+(a.ax+this.data.offsetX)*e,u=h.ay+(a.ay+this.data.offsetY)*s,p=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*r+1),m=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*i+1),f=h.ashearY+(a.ashearY+this.data.offsetShearY)*n;h.updateWorldTransformWith(d,u,c,p,m,h.ashearX,f)}}}class Kt{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 Kt.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,r=t.bones[e];if(r.parent){let t=this.bones[r.parent.index];s=new Ot(r,this,t),t.children.push(s)}else s=new Ot(r,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],r=this.bones[s.boneData.index],i=new Ht(s,r);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new Wt(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Jt(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new $t(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new jt(s,this))}this.color=new i(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,r=this.pathConstraints,i=this.physicsConstraints,n=e.length,a=s.length,o=r.length,l=this.physicsConstraints.length,h=n+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<n;s++){let r=e[s];if(r.data.order==t){this.sortIkConstraint(r);continue t}}for(let e=0;e<a;e++){let r=s[e];if(r.data.order==t){this.sortTransformConstraint(r);continue t}}for(let e=0;e<o;e++){let s=r[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=i[e];if(s.data.order==t){this.sortPhysicsConstraint(s);continue t}}}for(let e=0,s=t.length;e<s;e++)this.sortBone(t[e])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,r=s[0];if(this.sortBone(r),1==s.length)this._updateCache.push(t),this.sortReset(r.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(r.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,r=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,r);let i=e.getAttachment();i instanceof Pt&&this.sortPathConstraintAttachmentWith(i,r);let n=t.bones,a=n.length;for(let t=0;t<a;t++)this.sortBone(n[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(n[t].children);for(let t=0;t<a;t++)n[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&l.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let r=t.attachments[e];if(r)for(let t in r)this.sortPathConstraintAttachmentWith(r[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Pt))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,r=s.length;e<r;){let r=s[e++];for(r+=e;e<r;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&l.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,r=s.length;e<r;e++)s[e].update(t)}updateWorldTransformWith(t,e){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let r=e.a,i=e.b,a=e.c,o=e.d;s.worldX=r*this.x+i*this.y+e.worldX,s.worldY=a*this.x+o*this.y+e.worldY;const l=(s.rotation+s.shearX)*n.degRad,h=(s.rotation+90+s.shearY)*n.degRad,c=Math.cos(l)*s.scaleX,d=Math.cos(h)*s.scaleY,u=Math.sin(l)*s.scaleX,p=Math.sin(h)*s.scaleY;s.a=(r*c+i*u)*this.scaleX,s.b=(r*d+i*p)*this.scaleX,s.c=(a*c+o*u)*this.scaleY,s.d=(a*d+o*p)*this.scaleY;let m=this._updateCache;for(let e=0,r=m.length;e<r;e++){let r=m[e];r!=s&&r.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;l.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.data.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,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s],i=r.data.attachmentName;if(i){let e=t.getAttachment(s,i);e&&r.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,i=s.length;r<i;r++){let i=s[r];if(i.data.name==t){let s=null;if(e&&(s=this.getAttachment(r,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find((e=>e.data.name==t))??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find((e=>e.data.name==t))??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find((e=>e.data.name==t))??null}findPhysicsConstraint(t){if(null==t)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find((e=>e.data.name==t))??null}getBoundsRect(){let t=new c,e=new c;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let i=this.drawOrder,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let t=0,e=i.length;t<e;t++){let e=i[t];if(!e.bone.active)continue;let c=0,d=null,u=null,p=e.getAttachment();if(p instanceof _t)c=8,d=l.setArraySize(s,c,0),p.computeWorldVertices(e,d,0,2),u=Kt.quadTriangles;else if(p instanceof Rt){let t=p;c=t.worldVerticesLength,d=l.setArraySize(s,c,0),t.computeWorldVertices(e,0,c,d,0,2),u=t.triangles}else if(p instanceof xt&&null!=r){r.clipStart(e,p);continue}if(d&&u){null!=r&&r.isClipping()&&(r.clipTriangles(d,u,u.length),d=r.clippedVertices,c=r.clippedVertices.length);for(let t=0,e=d.length;t<e;t+=2){let e=d[t],s=d[t+1];n=Math.min(n,e),a=Math.min(a,s),o=Math.max(o,e),h=Math.max(h,s)}}null!=r&&r.clipEndWithSlot(e)}null!=r&&r.clipEnd(),t.set(n,a),e.set(o-n,h-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let r=0,i=s.length;r<i;r++)s[r].translate(t,e)}physicsRotate(t,e,s){const r=this.physicsConstraints;for(let i=0,n=r.length;i<n;i++)r[i].rotate(t,e,s)}}exports.Physics=void 0,(It=exports.Physics||(exports.Physics={}))[It.none=0]="none",It[It.reset=1]="reset",It[It.update=2]="update",It[It.pose=3]="pose";class Qt extends Nt{_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)}}class Zt{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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;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,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}}class te{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class ee{name;attachments=new Array;bones=Array();constraints=new Array;color=new i(.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 r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof Rt?(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 r in s){let i=s[r];i&&t.push(new te(e,r,i))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let i=s[r];i&&e.push(new te(t,r,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let i=t.slots[r],n=i.getAttachment();if(n&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(n==t[e]){let t=this.getAttachment(s,e);t&&i.setAttachment(t);break}}}s++}}}class se{index=0;name;boneData;color=new i(1,1,1,1);darkColor=null;attachmentName=null;blendMode=exports.BlendMode.Normal;visible=!0;constructor(t,e,s){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}exports.BlendMode=void 0,(At=exports.BlendMode||(exports.BlendMode={}))[At.Normal=0]="Normal",At[At.Additive=1]="Additive",At[At.Multiply=2]="Multiply",At[At.Screen=3]="Screen";class re extends Nt{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)}}class ie{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Zt;s.name="";let r=new ne(t),n=r.readInt32(),a=r.readInt32();s.hash=0==a&&0==n?null:a.toString(16)+n.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let h=0;h=r.readInt(!0);for(let t=0;t<h;t++){let t=r.readString();if(!t)throw new Error("String in string table must not be null.");r.strings.push(t)}h=r.readInt(!0);for(let t=0;t<h;t++){let n=r.readString();if(!n)throw new Error("Bone name must not be null.");let a=0==t?null:s.bones[r.readInt(!0)],l=new Dt(t,n,a);l.rotation=r.readFloat(),l.x=r.readFloat()*e,l.y=r.readFloat()*e,l.scaleX=r.readFloat(),l.scaleY=r.readFloat(),l.shearX=r.readFloat(),l.shearY=r.readFloat(),l.length=r.readFloat()*e,l.inherit=r.readByte(),l.skinRequired=r.readBoolean(),o&&(i.rgba8888ToColor(l.color,r.readInt32()),l.icon=r.readString()??void 0,l.visible=r.readBoolean()),s.bones.push(l)}h=r.readInt(!0);for(let t=0;t<h;t++){let e=r.readString();if(!e)throw new Error("Slot name must not be null.");let n=s.bones[r.readInt(!0)],a=new se(t,e,n);i.rgba8888ToColor(a.color,r.readInt32());let l=r.readInt32();-1!=l&&i.rgb888ToColor(a.darkColor=new i,l),a.attachmentName=r.readStringRef(),a.blendMode=r.readInt(!0),o&&(a.visible=r.readBoolean()),s.slots.push(a)}h=r.readInt(!0);for(let t,i=0;i<h;i++){let i=r.readString();if(!i)throw new Error("IK constraint data name must not be null.");let n=new zt(i);n.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.bones[r.readInt(!0)];let a=r.readByte();n.skinRequired=!!(1&a),n.bendDirection=2&a?1:-1,n.compress=!!(4&a),n.stretch=!!(8&a),n.uniform=!!(16&a),32&a&&(n.mix=64&a?r.readFloat():1),128&a&&(n.softness=r.readFloat()*e),s.ikConstraints.push(n)}h=r.readInt(!0);for(let t,i=0;i<h;i++){let i=r.readString();if(!i)throw new Error("Transform constraint data name must not be null.");let n=new re(i);n.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.bones[r.readInt(!0)];let a=r.readByte();n.skinRequired=!!(1&a),n.local=!!(2&a),n.relative=!!(4&a),8&a&&(n.offsetRotation=r.readFloat()),16&a&&(n.offsetX=r.readFloat()*e),32&a&&(n.offsetY=r.readFloat()*e),64&a&&(n.offsetScaleX=r.readFloat()),128&a&&(n.offsetScaleY=r.readFloat()),a=r.readByte(),1&a&&(n.offsetShearY=r.readFloat()),2&a&&(n.mixRotate=r.readFloat()),4&a&&(n.mixX=r.readFloat()),8&a&&(n.mixY=r.readFloat()),16&a&&(n.mixScaleX=r.readFloat()),32&a&&(n.mixScaleY=r.readFloat()),64&a&&(n.mixShearY=r.readFloat()),s.transformConstraints.push(n)}h=r.readInt(!0);for(let t,i=0;i<h;i++){let i=r.readString();if(!i)throw new Error("Path constraint data name must not be null.");let n=new Gt(i);n.order=r.readInt(!0),n.skinRequired=r.readBoolean(),t=r.readInt(!0);for(let e=0;e<t;e++)n.bones.push(s.bones[r.readInt(!0)]);n.target=s.slots[r.readInt(!0)];const a=r.readByte();n.positionMode=1&a,n.spacingMode=a>>1&3,n.rotateMode=a>>3&3,128&a&&(n.offsetRotation=r.readFloat()),n.position=r.readFloat(),n.positionMode==exports.PositionMode.Fixed&&(n.position*=e),n.spacing=r.readFloat(),n.spacingMode!=exports.SpacingMode.Length&&n.spacingMode!=exports.SpacingMode.Fixed||(n.spacing*=e),n.mixRotate=r.readFloat(),n.mixX=r.readFloat(),n.mixY=r.readFloat(),s.pathConstraints.push(n)}h=r.readInt(!0);for(let t=0;t<h;t++){const t=r.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const i=new Qt(t);i.order=r.readInt(!0),i.bone=s.bones[r.readInt(!0)];let n=r.readByte();i.skinRequired=!!(1&n),2&n&&(i.x=r.readFloat()),4&n&&(i.y=r.readFloat()),8&n&&(i.rotate=r.readFloat()),16&n&&(i.scaleX=r.readFloat()),32&n&&(i.shearX=r.readFloat()),i.limit=(64&n?r.readFloat():5e3)*e,i.step=1/r.readUnsignedByte(),i.inertia=r.readFloat(),i.strength=r.readFloat(),i.damping=r.readFloat(),i.massInverse=128&n?r.readFloat():1,i.wind=r.readFloat(),i.gravity=r.readFloat(),n=r.readByte(),1&n&&(i.inertiaGlobal=!0),2&n&&(i.strengthGlobal=!0),4&n&&(i.dampingGlobal=!0),8&n&&(i.massGlobal=!0),16&n&&(i.windGlobal=!0),32&n&&(i.gravityGlobal=!0),64&n&&(i.mixGlobal=!0),i.mix=128&n?r.readFloat():1,s.physicsConstraints.push(i)}let c=this.readSkin(r,s,!0,o);c&&(s.defaultSkin=c,s.skins.push(c));{let t=s.skins.length;for(l.setArraySize(s.skins,h=t+r.readInt(!0));t<h;t++){let e=this.readSkin(r,s,!1,o);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}h=this.linkedMeshes.length;for(let t=0;t<h;t++){let e=this.linkedMeshes[t];const r=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let i=r.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,h=r.readInt(!0);for(let t=0;t<h;t++){let t=r.readString();if(!t)throw new Error("Event data name must not be null");let e=new Ut(t);e.intValue=r.readInt(!1),e.floatValue=r.readFloat(),e.stringValue=r.readString(),e.audioPath=r.readString(),e.audioPath&&(e.volume=r.readFloat(),e.balance=r.readFloat()),s.events.push(e)}h=r.readInt(!0);for(let t=0;t<h;t++){let t=r.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,t,s))}return s}readSkin(t,e,s,r){let n=null,a=0;if(s){if(a=t.readInt(!0),0==a)return null;n=new ee("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new ee(s),r&&i.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,r=n.bones.length;s<r;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let s=0;s<a;s++){let s=t.readInt(!0);for(let i=0,a=t.readInt(!0);i<a;i++){let i=t.readStringRef();if(!i)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,n,s,i,r);a&&n.setAttachment(s,i,a)}}return n}readAttachment(t,e,s,r,n,a){let o=this.scale,h=t.readByte();const c=8&h?t.readStringRef():n;if(!c)throw new Error("Attachment name must not be null");switch(7&h){case Bt.Region:{let e=16&h?t.readStringRef():null;const r=32&h?t.readInt32():4294967295,n=64&h?this.readSequence(t):null;let a=128&h?t.readFloat():0,l=t.readFloat(),d=t.readFloat(),u=t.readFloat(),p=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=c);let g=this.attachmentLoader.newRegionAttachment(s,c,e,n);return g?(g.path=e,g.x=l*o,g.y=d*o,g.scaleX=u,g.scaleY=p,g.rotation=a,g.width=m*o,g.height=f*o,i.rgba8888ToColor(g.color,r),g.sequence=n,null==n&&g.updateRegion(),g):null}case Bt.BoundingBox:{let e=this.readVertices(t,!!(16&h)),r=a?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,c);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,a&&i.rgba8888ToColor(n.color,r),n):null}case Bt.Mesh:{let e=16&h?t.readStringRef():c;const r=32&h?t.readInt32():4294967295,n=64&h?this.readSequence(t):null,l=t.readInt(!0),d=this.readVertices(t,!!(128&h)),u=this.readFloatArray(t,d.length,1),p=this.readShortArray(t,3*(d.length-l-2));let m=[],f=0,g=0;a&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),g=t.readFloat()),e||(e=c);let x=this.attachmentLoader.newMeshAttachment(s,c,e,n);return x?(x.path=e,i.rgba8888ToColor(x.color,r),x.bones=d.bones,x.vertices=d.vertices,x.worldVerticesLength=d.length,x.triangles=p,x.regionUVs=u,null==n&&x.updateRegion(),x.hullLength=l<<1,x.sequence=n,a&&(x.edges=m,x.width=f*o,x.height=g*o),x):null}case Bt.LinkedMesh:{const e=16&h?t.readStringRef():c;if(null==e)throw new Error("Path of linked mesh must not be null");const n=32&h?t.readInt32():4294967295,l=64&h?this.readSequence(t):null,d=!!(128&h),u=t.readInt(!0),p=t.readStringRef();let m=0,f=0;a&&(m=t.readFloat(),f=t.readFloat());let g=this.attachmentLoader.newMeshAttachment(s,c,e,l);return g?(g.path=e,i.rgba8888ToColor(g.color,n),g.sequence=l,a&&(g.width=m*o,g.height=f*o),this.linkedMeshes.push(new ae(g,u,r,p,d)),g):null}case Bt.Path:{const e=!!(16&h),r=!!(32&h),n=this.readVertices(t,!!(64&h)),d=l.newArray(n.length/6,0);for(let e=0,s=d.length;e<s;e++)d[e]=t.readFloat()*o;const u=a?t.readInt32():0,p=this.attachmentLoader.newPathAttachment(s,c);return p?(p.closed=e,p.constantSpeed=r,p.worldVerticesLength=n.length,p.vertices=n.vertices,p.bones=n.bones,p.lengths=d,a&&i.rgba8888ToColor(p.color,u),p):null}case Bt.Point:{const e=t.readFloat(),r=t.readFloat(),n=t.readFloat(),l=a?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,c);return h?(h.x=r*o,h.y=n*o,h.rotation=e,a&&i.rgba8888ToColor(h.color,l),h):null}case Bt.Clipping:{const r=t.readInt(!0),n=this.readVertices(t,!!(16&h));let o=a?t.readInt32():0,l=this.attachmentLoader.newClippingAttachment(s,c);return l?(l.endSlot=e.slots[r],l.worldVerticesLength=n.length,l.vertices=n.vertices,l.bones=n.bones,a&&i.rgba8888ToColor(l.color,o),l):null}}return null}readSequence(t){let e=new p(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,r=t.readInt(!0),i=new oe;if(i.length=r<<1,!e)return i.vertices=this.readFloatArray(t,i.length,s),i;let n=new Array,a=new Array;for(let e=0;e<r;e++){let e=t.readInt(!0);a.push(e);for(let r=0;r<e;r++)a.push(t.readInt(!0)),n.push(t.readFloat()*s),n.push(t.readFloat()*s),n.push(t.readFloat())}return i.vertices=l.toFloatArray(n),i.bones=a,i}readFloatArray(t,e,s){let r=new Array(e);if(1==s)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let i=0;i<e;i++)r[i]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,i=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,i=t.readInt(!0);s<i;s++){let s=t.readByte(),i=t.readInt(!0),n=i-1;switch(s){case Se:{let s=new O(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat(),t.readStringRef());r.push(s);break}case ve:{let s=t.readInt(!0),a=new P(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,u,1),ce(t,a,s++,e,3,o,r,d,p,1)}o=r,l=i,h=n,c=u,d=p}r.push(a);break}case ke:{let s=t.readInt(!0),a=new X(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,d,1)}o=r,l=i,h=n,c=d}r.push(a);break}case Ie:{let s=t.readInt(!0),a=new V(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,p,m),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,f,1),ce(t,a,s++,e,3,o,r,d,g,1),ce(t,a,s++,e,4,o,r,u,x,1),ce(t,a,s++,e,5,o,r,p,w,1),ce(t,a,s++,e,6,o,r,m,b,1)}o=r,l=i,h=n,c=f,d=g,u=x,p=w,m=b}r.push(a);break}case Ae:{let s=t.readInt(!0),a=new D(i,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,p),e!=n;e++){let r=t.readFloat(),i=t.readUnsignedByte()/255,n=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Le:a.setStepped(e);break;case qe:ce(t,a,s++,e,0,o,r,l,i,1),ce(t,a,s++,e,1,o,r,h,n,1),ce(t,a,s++,e,2,o,r,c,m,1),ce(t,a,s++,e,3,o,r,d,f,1),ce(t,a,s++,e,4,o,r,u,g,1),ce(t,a,s++,e,5,o,r,p,x,1)}o=r,l=i,h=n,c=m,d=f,u=g,p=x}r.push(a);break}case Be:{let s=new _(i,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,r=0;s.setFrame(e,a,o),e!=n;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255;switch(t.readByte()){case Le:s.setStepped(e);break;case qe:ce(t,s,r++,e,0,a,i,o,n,1)}a=i,o=n}r.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readByte(),n=t.readInt(!0);if(s==Me){let s=new R(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readByte());r.push(s);continue}let a=t.readInt(!0);switch(s){case de:r.push(le(t,new v(n,a,e),1));break;case ue:r.push(he(t,new k(n,a,e),i));break;case pe:r.push(le(t,new I(n,a,e),i));break;case me:r.push(le(t,new A(n,a,e),i));break;case fe:r.push(he(t,new B(n,a,e),1));break;case ge:r.push(le(t,new T(n,a,e),1));break;case xe:r.push(le(t,new C(n,a,e),1));break;case we:r.push(he(t,new F(n,a,e),1));break;case be:r.push(le(t,new E(n,a,e),1));break;case ye:r.push(le(t,new Y(n,a,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,a=new U(s,t.readInt(!0),e),o=t.readByte(),l=t.readFloat(),h=1&o?2&o?t.readFloat():1:0,c=4&o?t.readFloat()*i:0;for(let e=0,s=0;a.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=n;e++){o=t.readByte();const r=t.readFloat(),n=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*i:0;64&o?a.setStepped(e):128&o&&(ce(t,a,s++,e,0,l,r,h,n,1),ce(t,a,s++,e,1,l,r,c,d,i)),l=r,h=n,c=d}r.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),i=s-1,n=new W(s,t.readInt(!0),e),a=t.readFloat(),o=t.readFloat(),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat();for(let e=0,s=0;n.setFrame(e,a,o,l,h,c,d,u),e!=i;e++){let r=t.readFloat(),i=t.readFloat(),p=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),x=t.readFloat();switch(t.readByte()){case Le:n.setStepped(e);break;case qe:ce(t,n,s++,e,0,a,r,o,i,1),ce(t,n,s++,e,1,a,r,l,p,1),ce(t,n,s++,e,2,a,r,h,m,1),ce(t,n,s++,e,3,a,r,c,f,1),ce(t,n,s++,e,4,a,r,d,g,1),ce(t,n,s++,e,5,a,r,u,x,1)}a=r,o=i,l=p,h=m,c=f,d=g,u=x}r.push(n)}for(let e=0,n=t.readInt(!0);e<n;e++){let e=t.readInt(!0),n=s.pathConstraints[e];for(let s=0,a=t.readInt(!0);s<a;s++){const s=t.readByte(),a=t.readInt(!0),o=t.readInt(!0);switch(s){case Fe:r.push(le(t,new z(a,o,e),n.positionMode==exports.PositionMode.Fixed?i:1));break;case Ee:r.push(le(t,new G(a,o,e),n.spacingMode==exports.SpacingMode.Length||n.spacingMode==exports.SpacingMode.Fixed?i:1));break;case Ye:let s=new $(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,r=0,i=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=i;e++){let i=t.readFloat(),n=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Le:s.setStepped(e);break;case qe:ce(t,s,r++,e,0,l,i,h,n,1),ce(t,s,r++,e,1,l,i,c,a,1),ce(t,s,r++,e,2,l,i,d,o,1)}l=i,h=n,c=a,d=o}r.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,i=t.readInt(!0);s<i;s++){const s=t.readByte(),i=t.readInt(!0);if(s==Ne){const s=new st(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat());r.push(s);continue}const n=t.readInt(!0);switch(s){case Re:r.push(le(t,new H(i,n,e),1));break;case Pe:r.push(le(t,new J(i,n,e),1));break;case Xe:r.push(le(t,new K(i,n,e),1));break;case _e:r.push(le(t,new Q(i,n,e),1));break;case Ve:r.push(le(t,new Z(i,n,e),1));break;case De:r.push(le(t,new tt(i,n,e),1));break;case Oe:r.push(le(t,new et(i,n,e),1))}}}for(let e=0,n=t.readInt(!0);e<n;e++){let e=s.skins[t.readInt(!0)];for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readInt(!0);for(let n=0,a=t.readInt(!0);n<a;n++){let n=t.readStringRef();if(!n)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,n),o=t.readByte(),h=t.readInt(!0),c=h-1;switch(o){case Te:{let e=a,n=e.bones,o=e.vertices,d=n?o.length/3*2:o.length,u=t.readInt(!0),p=new N(h,u,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let r,a=t.readInt(!0);if(0==a)r=n?l.newFloatArray(d):o;else{r=l.newFloatArray(d);let e=t.readInt(!0);if(a+=e,1==i)for(let s=e;s<a;s++)r[s]=t.readFloat();else for(let s=e;s<a;s++)r[s]=t.readFloat()*i;if(!n)for(let t=0,e=r.length;t<e;t++)r[t]+=o[t]}if(p.setFrame(e,m,r),e==c)break;let h=t.readFloat();switch(t.readByte()){case Le:p.setStepped(e);break;case qe:ce(t,p,s++,e,0,m,h,0,1,1)}m=h}r.push(p);break}case Ce:{let e=new rt(h,s,a);for(let s=0;s<h;s++){let r=t.readFloat(),i=t.readInt32();e.setFrame(s,r,m[15&i],i>>4,t.readFloat())}r.push(e);break}}}}}let n=t.readInt(!0);if(n>0){let e=new q(n),i=s.slots.length;for(let s=0;s<n;s++){let r=t.readFloat(),n=t.readInt(!0),a=l.newArray(i,0);for(let t=i-1;t>=0;t--)a[t]=-1;let o=l.newArray(i-n,0),h=0,c=0;for(let e=0;e<n;e++){let e=t.readInt(!0);for(;h!=e;)o[c++]=h++;a[h+t.readInt(!0)]=h++}for(;h<i;)o[c++]=h++;for(let t=i-1;t>=0;t--)-1==a[t]&&(a[t]=o[--c]);e.setFrame(s,r,a)}r.push(e)}let a=t.readInt(!0);if(a>0){let e=new L(a);for(let r=0;r<a;r++){let i=t.readFloat(),n=s.events[t.readInt(!0)],a=new qt(i,n);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=n.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(r,a)}r.push(e)}let o=0;for(let t=0,e=r.length;t<e;t++)o=Math.max(o,r[t].getDuration());return new f(e,r,o)}}class ne{strings;index;buffer;constructor(t,e=new Array,s=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=r}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=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?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;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}class ae{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}}class oe{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}}function le(t,e,s){let r=t.readFloat(),i=t.readFloat()*s;for(let n=0,a=0,o=e.getFrameCount()-1;e.setFrame(n,r,i),n!=o;n++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Le:e.setStepped(n);break;case qe:ce(t,e,a++,n,0,r,o,i,l,s)}r=o,i=l}return e}function he(t,e,s){let r=t.readFloat(),i=t.readFloat()*s,n=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,r,i,n),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Le:e.setStepped(a);break;case qe:ce(t,e,o++,a,0,r,l,i,h,s),ce(t,e,o++,a,1,r,l,n,c,s)}r=l,i=h,n=c}return e}function ce(t,e,s,r,i,n,a,o,l,h){e.setBezier(s,r,i,n,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,l)}!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(Bt||(Bt={}));const de=0,ue=1,pe=2,me=3,fe=4,ge=5,xe=6,we=7,be=8,ye=9,Me=10,Se=0,ve=1,ke=2,Ie=3,Ae=4,Be=5,Te=0,Ce=1,Fe=0,Ee=1,Ye=2,Re=0,Pe=1,Xe=2,_e=4,Ve=5,De=6,Oe=7,Ne=8,Le=1,qe=2;class Ue{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new h((()=>new Array));polygonIndicesPool=new h((()=>new Array));triangulate(t){let e=t,s=t.length>>1,r=this.indicesArray;r.length=0;for(let t=0;t<s;t++)r[t]=t;let i=this.isConcaveArray;i.length=0;for(let t=0,n=s;t<n;++t)i[t]=Ue.isConcave(t,s,e,r);let n=this.triangles;for(n.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!i[a]){let n=r[t]<<1,l=r[a]<<1,h=r[o]<<1,c=e[n],d=e[n+1],u=e[l],p=e[l+1],m=e[h],f=e[h+1];for(let n=(o+1)%s;n!=t;n=(n+1)%s){if(!i[n])continue;let t=r[n]<<1,s=e[t],a=e[t+1];if(Ue.positiveArea(m,f,c,d,s,a)&&Ue.positiveArea(c,d,u,p,s,a)&&Ue.positiveArea(u,p,m,f,s,a))break t}break}if(0==o){do{if(!i[a])break;a--}while(a>0);break}t=a,a=o,o=(o+1)%s}n.push(r[(s+a-1)%s]),n.push(r[a]),n.push(r[(a+1)%s]),r.splice(a,1),i.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;i[l]=Ue.isConcave(l,s,e,r),i[h]=Ue.isConcave(h,s,e,r)}return 3==s&&(n.push(r[2]),n.push(r[0]),n.push(r[1])),n}decompose(t,e){let s=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;let n=this.polygonIndicesPool.obtain();n.length=0;let a=this.polygonPool.obtain();a.length=0;let o=-1,l=0;for(let t=0,h=e.length;t<h;t+=3){let h=e[t]<<1,c=e[t+1]<<1,d=e[t+2]<<1,u=s[h],p=s[h+1],m=s[c],f=s[c+1],g=s[d],x=s[d+1],w=!1;if(o==h){let t=a.length-4,e=Ue.winding(a[t],a[t+1],a[t+2],a[t+3],g,x),s=Ue.winding(g,x,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(g),a.push(x),n.push(d),w=!0)}w||(a.length>0?(r.push(a),i.push(n)):(this.polygonPool.free(a),this.polygonIndicesPool.free(n)),a=this.polygonPool.obtain(),a.length=0,a.push(u),a.push(p),a.push(m),a.push(f),a.push(g),a.push(x),n=this.polygonIndicesPool.obtain(),n.length=0,n.push(h),n.push(c),n.push(d),l=Ue.winding(u,p,m,f,g,x),o=h)}a.length>0&&(r.push(a),i.push(n));for(let t=0,e=r.length;t<e;t++){if(n=i[t],0==n.length)continue;let s=n[0],o=n[n.length-1];a=r[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],p=a[0],m=a[1],f=a[2],g=a[3],x=Ue.winding(h,c,d,u,p,m);for(let l=0;l<e;l++){if(l==t)continue;let e=i[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],M=r[l],S=M[M.length-2],v=M[M.length-1];if(w!=s||b!=o)continue;let k=Ue.winding(h,c,d,u,S,v),I=Ue.winding(S,v,p,m,f,g);k==x&&I==x&&(M.length=0,e.length=0,a.push(S),a.push(v),n.push(y),h=d,c=u,d=S,u=v,l=0)}}for(let t=r.length-1;t>=0;t--)a=r[t],0==a.length&&(r.splice(t,1),this.polygonPool.free(a),n=i[t],i.splice(t,1),this.polygonIndicesPool.free(n));return r}static isConcave(t,e,s,r){let i=r[(e+t-1)%e]<<1,n=r[t]<<1,a=r[(t+1)%e]<<1;return!this.positiveArea(s[i],s[i+1],s[n],s[n+1],s[a],s[a+1])}static positiveArea(t,e,s,r,i,n){return t*(n-r)+s*(e-n)+i*(r-e)>=0}static winding(t,e,s,r,i,n){let a=s-t,o=r-e;return i*o-n*a+a*e-t*o>=0?1:-1}}class We{triangulator=new Ue;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,r=l.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,r,0,2);let i=this.clippingPolygon;We.makeClockwise(i);let n=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i));for(let t=0,e=n.length;t<e;t++){let e=n[t];We.makeClockwise(e),e.push(e[0]),e.push(e[1])}return n.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,r,i,n,a,o){let l,h,c,d,u,p;"number"==typeof e?(l=s,h=r,c=i,d=n,u=a,p=o):(l=e,h=s,c=r,d=i,u=n,p=a),c&&d&&u&&"boolean"==typeof p?this.clipTrianglesRender(t,l,h,c,d,u,p):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let r=this.clipOutput,i=this.clippedVertices,n=this.clippedTriangles,a=this.clippingPolygons,o=a.length,h=0;i.length=0,n.length=0;for(let c=0;c<s;c+=3){let s=e[c]<<1,d=t[s],u=t[s+1];s=e[c+1]<<1;let p=t[s],m=t[s+1];s=e[c+2]<<1;let f=t[s],g=t[s+1];for(let t=0;t<o;t++){let e=i.length;if(!this.clip(d,u,p,m,f,g,a[t],r)){let t=l.setArraySize(i,e+6);t[e]=d,t[e+1]=u,t[e+2]=p,t[e+3]=m,t[e+4]=f,t[e+5]=g,e=n.length;let s=l.setArraySize(n,e+3);s[e]=h,s[e+1]=h+1,s[e+2]=h+2,h+=3;break}{let t=r.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=l.setArraySize(i,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],r=a[s+1];o[e]=t,o[e+1]=r}e=n.length;let c=l.setArraySize(n,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)c[e]=h,c[e+1]=h+t,c[e+2]=h+t+1;h+=s+1}}}}clipTrianglesRender(t,e,s,r,i,n,a){let o=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,u=d.length,p=a?12:8,m=0;h.length=0,c.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,g=t[s],x=t[s+1],w=r[s],b=r[s+1];s=e[f+1]<<1;let y=t[s],M=t[s+1],S=r[s],v=r[s+1];s=e[f+2]<<1;let k=t[s],I=t[s+1],A=r[s],B=r[s+1];for(let t=0;t<u;t++){let e=h.length;if(!this.clip(g,x,y,M,k,I,d[t],o)){let t=l.setArraySize(h,e+3*p);t[e]=g,t[e+1]=x,t[e+2]=i.r,t[e+3]=i.g,t[e+4]=i.b,t[e+5]=i.a,a?(t[e+6]=w,t[e+7]=b,t[e+8]=n.r,t[e+9]=n.g,t[e+10]=n.b,t[e+11]=n.a,t[e+12]=y,t[e+13]=M,t[e+14]=i.r,t[e+15]=i.g,t[e+16]=i.b,t[e+17]=i.a,t[e+18]=S,t[e+19]=v,t[e+20]=n.r,t[e+21]=n.g,t[e+22]=n.b,t[e+23]=n.a,t[e+24]=k,t[e+25]=I,t[e+26]=i.r,t[e+27]=i.g,t[e+28]=i.b,t[e+29]=i.a,t[e+30]=A,t[e+31]=B,t[e+32]=n.r,t[e+33]=n.g,t[e+34]=n.b,t[e+35]=n.a):(t[e+6]=w,t[e+7]=b,t[e+8]=y,t[e+9]=M,t[e+10]=i.r,t[e+11]=i.g,t[e+12]=i.b,t[e+13]=i.a,t[e+14]=S,t[e+15]=v,t[e+16]=k,t[e+17]=I,t[e+18]=i.r,t[e+19]=i.g,t[e+20]=i.b,t[e+21]=i.a,t[e+22]=A,t[e+23]=B),e=c.length;let s=l.setArraySize(c,e+3);s[e]=m,s[e+1]=m+1,s[e+2]=m+2,m+=3;break}{let t=o.length;if(0==t)continue;let s=M-I,r=k-y,d=g-k,u=I-x,f=1/(s*d+r*(x-I)),T=t>>1,C=this.clipOutput,F=l.setArraySize(h,e+T*p);for(let o=0;o<t;o+=2,e+=p){let t=C[o],l=C[o+1];F[e]=t,F[e+1]=l,F[e+2]=i.r,F[e+3]=i.g,F[e+4]=i.b,F[e+5]=i.a;let h=t-k,c=l-I,p=(s*h+r*c)*f,m=(u*h+d*c)*f,g=1-p-m;F[e+6]=w*p+S*m+A*g,F[e+7]=b*p+v*m+B*g,a&&(F[e+8]=n.r,F[e+9]=n.g,F[e+10]=n.b,F[e+11]=n.a)}e=c.length;let E=l.setArraySize(c,e+3*(T-2));T--;for(let t=1;t<T;t++,e+=3)E[e]=m,E[e+1]=m+t,E[e+2]=m+t+1;m+=T+1}}}}clipTrianglesUnpacked(t,e,s,r){let i=this.clipOutput,n=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,h=this.clippingPolygons,c=h.length,d=0;n.length=0,a.length=0,o.length=0;for(let u=0;u<s;u+=3){let s=e[u]<<1,p=t[s],m=t[s+1],f=r[s],g=r[s+1];s=e[u+1]<<1;let x=t[s],w=t[s+1],b=r[s],y=r[s+1];s=e[u+2]<<1;let M=t[s],S=t[s+1],v=r[s],k=r[s+1];for(let t=0;t<c;t++){let e=n.length;if(!this.clip(p,m,x,w,M,S,h[t],i)){let t=l.setArraySize(n,e+6);t[e]=p,t[e+1]=m,t[e+2]=x,t[e+3]=w,t[e+4]=M,t[e+5]=S;let s=l.setArraySize(a,e+6);s[e]=f,s[e+1]=g,s[e+2]=b,s[e+3]=y,s[e+4]=v,s[e+5]=k,e=o.length;let r=l.setArraySize(o,e+3);r[e]=d,r[e+1]=d+1,r[e+2]=d+2,d+=3;break}{let t=i.length;if(0==t)continue;let s=w-S,r=M-x,h=p-M,c=S-m,u=1/(s*h+r*(m-S)),I=t>>1,A=this.clipOutput,B=l.setArraySize(n,e+2*I),T=l.setArraySize(a,e+2*I);for(let i=0;i<t;i+=2,e+=2){let t=A[i],n=A[i+1];B[e]=t,B[e+1]=n;let a=t-M,o=n-S,l=(s*a+r*o)*u,d=(c*a+h*o)*u,p=1-l-d;T[e]=f*l+b*d+v*p,T[e+1]=g*l+y*d+k*p}e=o.length;let C=l.setArraySize(o,e+3*(I-2));I--;for(let t=1;t<I;t++,e+=3)C[e]=d,C[e+1]=d+t,C[e+2]=d+t+1;d+=I+1}}}}clip(t,e,s,r,i,n,a,o){let l,h=o,c=!1;a.length%4>=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(s),l.push(r),l.push(i),l.push(n),l.push(t),l.push(e),o.length=0;let d=a.length-4,u=a;for(let t=0;;t+=2){let e=u[t],s=u[t+1],r=e-u[t+2],i=s-u[t+3],n=o.length,a=l;for(let t=0,n=l.length-2;t<n;){let n=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=i*(e-h)>r*(s-d),p=i*(e-n)-r*(s-l);if(p>0){if(u){o.push(h),o.push(d);continue}let t=h-n,e=d-l,s=p/(t*i-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s)}else if(u){let t=h-n,e=d-l,s=p/(t*i-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(n+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(n==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let p=o;(o=l).length=0,l=p}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,r=e[s-2]*e[1]-e[0]*e[s-1],i=0,n=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)i=e[t],n=e[t+1],a=e[t+2],o=e[t+3],r+=i*o-a*n;if(!(r<0))for(let t=0,r=s-2,i=s>>1;t<i;t+=2){let s=e[t],i=e[t+1],n=r-t;e[t]=e[n],e[t+1]=e[n+1],e[n]=s,e[n+1]=i}}}class ze{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Zt,r="string"==typeof t?JSON.parse(t):t,n=r.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=Je(n,"referenceScale",100)*e,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),r.bones)for(let t=0;t<r.bones.length;t++){let i=r.bones[t],n=null,a=Je(i,"parent",null);a&&(n=s.findBone(a));let o=new Dt(s.bones.length,i.name,n);o.length=Je(i,"length",0)*e,o.x=Je(i,"x",0)*e,o.y=Je(i,"y",0)*e,o.rotation=Je(i,"rotation",0),o.scaleX=Je(i,"scaleX",1),o.scaleY=Je(i,"scaleY",1),o.shearX=Je(i,"shearX",0),o.shearY=Je(i,"shearY",0),o.inherit=l.enumValue(exports.Inherit,Je(i,"inherit","Normal")),o.skinRequired=Je(i,"skin",!1);let h=Je(i,"color",null);h&&o.color.setFromString(h),s.bones.push(o)}if(r.slots)for(let t=0;t<r.slots.length;t++){let e=r.slots[t],n=e.name,a=s.findBone(e.bone);if(!a)throw new Error(`Couldn't find bone ${e.bone} for slot ${n}`);let o=new se(s.slots.length,n,a),h=Je(e,"color",null);h&&o.color.setFromString(h);let c=Je(e,"dark",null);c&&(o.darkColor=i.fromString(c)),o.attachmentName=Je(e,"attachment",null),o.blendMode=l.enumValue(exports.BlendMode,Je(e,"blend","normal")),o.visible=Je(e,"visible",!0),s.slots.push(o)}if(r.ik)for(let t=0;t<r.ik.length;t++){let i=r.ik[t],n=new zt(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=s.findBone(i.bones[t]);if(!e)throw new Error(`Couldn't find bone ${i.bones[t]} for IK constraint ${i.name}.`);n.bones.push(e)}let a=s.findBone(i.target);if(!a)throw new Error(`Couldn't find target bone ${i.target} for IK constraint ${i.name}.`);n.target=a,n.mix=Je(i,"mix",1),n.softness=Je(i,"softness",0)*e,n.bendDirection=Je(i,"bendPositive",!0)?1:-1,n.compress=Je(i,"compress",!1),n.stretch=Je(i,"stretch",!1),n.uniform=Je(i,"uniform",!1),s.ikConstraints.push(n)}if(r.transform)for(let t=0;t<r.transform.length;t++){let i=r.transform[t],n=new re(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for transform constraint ${i.name}.`);n.bones.push(r)}let a=i.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${i.name}.`);n.target=o,n.local=Je(i,"local",!1),n.relative=Je(i,"relative",!1),n.offsetRotation=Je(i,"rotation",0),n.offsetX=Je(i,"x",0)*e,n.offsetY=Je(i,"y",0)*e,n.offsetScaleX=Je(i,"scaleX",0),n.offsetScaleY=Je(i,"scaleY",0),n.offsetShearY=Je(i,"shearY",0),n.mixRotate=Je(i,"mixRotate",1),n.mixX=Je(i,"mixX",1),n.mixY=Je(i,"mixY",n.mixX),n.mixScaleX=Je(i,"mixScaleX",1),n.mixScaleY=Je(i,"mixScaleY",n.mixScaleX),n.mixShearY=Je(i,"mixShearY",1),s.transformConstraints.push(n)}if(r.path)for(let t=0;t<r.path.length;t++){let i=r.path[t],n=new Gt(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);for(let t=0;t<i.bones.length;t++){let e=i.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for path constraint ${i.name}.`);n.bones.push(r)}let a=i.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${i.name}.`);n.target=o,n.positionMode=l.enumValue(exports.PositionMode,Je(i,"positionMode","Percent")),n.spacingMode=l.enumValue(exports.SpacingMode,Je(i,"spacingMode","Length")),n.rotateMode=l.enumValue(exports.RotateMode,Je(i,"rotateMode","Tangent")),n.offsetRotation=Je(i,"rotation",0),n.position=Je(i,"position",0),n.positionMode==exports.PositionMode.Fixed&&(n.position*=e),n.spacing=Je(i,"spacing",0),n.spacingMode!=exports.SpacingMode.Length&&n.spacingMode!=exports.SpacingMode.Fixed||(n.spacing*=e),n.mixRotate=Je(i,"mixRotate",1),n.mixX=Je(i,"mixX",1),n.mixY=Je(i,"mixY",n.mixX),s.pathConstraints.push(n)}if(r.physics)for(let t=0;t<r.physics.length;t++){const i=r.physics[t],n=new Qt(i.name);n.order=Je(i,"order",0),n.skinRequired=Je(i,"skin",!1);const a=i.bone,o=s.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);n.bone=o,n.x=Je(i,"x",0),n.y=Je(i,"y",0),n.rotate=Je(i,"rotate",0),n.scaleX=Je(i,"scaleX",0),n.shearX=Je(i,"shearX",0),n.limit=Je(i,"limit",5e3)*e,n.step=1/Je(i,"fps",60),n.inertia=Je(i,"inertia",1),n.strength=Je(i,"strength",100),n.damping=Je(i,"damping",1),n.massInverse=1/Je(i,"mass",1),n.wind=Je(i,"wind",0),n.gravity=Je(i,"gravity",0),n.mix=Je(i,"mix",1),n.inertiaGlobal=Je(i,"inertiaGlobal",!1),n.strengthGlobal=Je(i,"strengthGlobal",!1),n.dampingGlobal=Je(i,"dampingGlobal",!1),n.massGlobal=Je(i,"massGlobal",!1),n.windGlobal=Je(i,"windGlobal",!1),n.gravityGlobal=Je(i,"gravityGlobal",!1),n.mixGlobal=Je(i,"mixGlobal",!1),s.physicsConstraints.push(n)}if(r.skins)for(let t=0;t<r.skins.length;t++){let e=r.skins[t],i=new ee(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let r=e.bones[t],n=s.findBone(r);if(!n)throw new Error(`Couldn't find bone ${r} for skin ${e.name}.`);i.bones.push(n)}if(e.ik)for(let t=0;t<e.ik.length;t++){let r=e.ik[t],n=s.findIkConstraint(r);if(!n)throw new Error(`Couldn't find IK constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.transform)for(let t=0;t<e.transform.length;t++){let r=e.transform[t],n=s.findTransformConstraint(r);if(!n)throw new Error(`Couldn't find transform constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.path)for(let t=0;t<e.path.length;t++){let r=e.path[t],n=s.findPathConstraint(r);if(!n)throw new Error(`Couldn't find path constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}if(e.physics)for(let t=0;t<e.physics.length;t++){let r=e.physics[t],n=s.findPhysicsConstraint(r);if(!n)throw new Error(`Couldn't find physics constraint ${r} for skin ${e.name}.`);i.constraints.push(n)}for(let t in e.attachments){let r=s.findSlot(t);if(!r)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let n=e.attachments[t];for(let t in n){let e=this.readAttachment(n[t],i,r.index,t,s);e&&i.setAttachment(r.index,t,e)}}s.skins.push(i),"default"==i.name&&(s.defaultSkin=i)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],r=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!r)throw new Error(`Skin not found: ${e.skin}`);let i=r.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let t in r.events){let e=r.events[t],i=new Ut(t);i.intValue=Je(e,"int",0),i.floatValue=Je(e,"float",0),i.stringValue=Je(e,"string",""),i.audioPath=Je(e,"audio",null),i.audioPath&&(i.volume=Je(e,"volume",1),i.balance=Je(e,"balance",0)),s.events.push(i)}if(r.animations)for(let t in r.animations){let e=r.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,r,i){let n=this.scale;switch(r=Je(t,"name",r),Je(t,"type","region")){case"region":{let s=Je(t,"path",r),i=this.readSequence(Je(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,r,s,i);if(!a)return null;a.path=s,a.x=Je(t,"x",0)*n,a.y=Je(t,"y",0)*n,a.scaleX=Je(t,"scaleX",1),a.scaleY=Je(t,"scaleY",1),a.rotation=Je(t,"rotation",0),a.width=t.width*n,a.height=t.height*n,a.sequence=i;let o=Je(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let i=Je(t,"color",null);return i&&s.color.setFromString(i),s}case"mesh":case"linkedmesh":{let i=Je(t,"path",r),a=this.readSequence(Je(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,r,i,a);if(!o)return null;o.path=i;let l=Je(t,"color",null);l&&o.color.setFromString(l),o.width=Je(t,"width",0)*n,o.height=Je(t,"height",0)*n,o.sequence=a;let h=Je(t,"parent",null);if(h)return this.linkedMeshes.push(new Ge(o,Je(t,"skin",null),s,h,Je(t,"timelines",!0))),o;let c=t.uvs;return this.readVertices(t,o,c.length),o.triangles=t.triangles,o.regionUVs=c,null!=o.region&&o.updateRegion(),o.edges=Je(t,"edges",null),o.hullLength=2*Je(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,r);if(!s)return null;s.closed=Je(t,"closed",!1),s.constantSpeed=Je(t,"constantSpeed",!0);let i=t.vertexCount;this.readVertices(t,s,i<<1);let a=l.newArray(i/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*n;s.lengths=a;let o=Je(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,r);if(!s)return null;s.x=Je(t,"x",0)*n,s.y=Je(t,"y",0)*n,s.rotation=Je(t,"rotation",0);let i=Je(t,"color",null);return i&&s.color.setFromString(i),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,r);if(!s)return null;let n=Je(t,"end",null);n&&(s.endSlot=i.findSlot(n));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=Je(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new p(Je(t,"count",0));return e.start=Je(t,"start",1),e.digits=Je(t,"digits",0),e.setupIndex=Je(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let i=t.vertices;if(s==i.length){let t=l.toFloatArray(i);if(1!=r)for(let e=0,s=i.length;e<s;e++)t[e]*=r;return void(e.vertices=t)}let n=new Array,a=new Array;for(let t=0,e=i.length;t<e;){let e=i[t++];a.push(e);for(let s=t+4*e;t<s;t+=4)a.push(i[t]),n.push(i[t+1]*r),n.push(i[t+2]*r),n.push(i[t+3])}e.bones=a,e.vertices=l.toFloatArray(n)}readAnimation(e,s,r){let n=this.scale,a=new Array;if(e.slots)for(let t in e.slots){let s=e.slots[t],n=r.findSlot(t);if(!n)throw new Error("Slot not found: "+t);let o=n.index;for(let t in s){let e=s[t];if(!e)continue;let r=e.length;if("attachment"==t){let t=new O(r,o);for(let s=0;s<r;s++){let r=e[s];t.setFrame(s,Je(r,"time",0),Je(r,"name",null))}a.push(t)}else if("rgba"==t){let t=new P(r,r<<2,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.color);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b,l.a);let o=e[r+1];if(!o){t.shrink(a);break}let h=Je(o,"time",0),c=i.fromString(o.color),d=s.curve;d&&(a=He(d,t,a,r,0,n,h,l.r,c.r,1),a=He(d,t,a,r,1,n,h,l.g,c.g,1),a=He(d,t,a,r,2,n,h,l.b,c.b,1),a=He(d,t,a,r,3,n,h,l.a,c.a,1)),n=h,l=c,s=o}a.push(t)}else if("rgb"==t){let t=new X(r,3*r,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.color);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b);let o=e[r+1];if(!o){t.shrink(a);break}let h=Je(o,"time",0),c=i.fromString(o.color),d=s.curve;d&&(a=He(d,t,a,r,0,n,h,l.r,c.r,1),a=He(d,t,a,r,1,n,h,l.g,c.g,1),a=He(d,t,a,r,2,n,h,l.b,c.b,1)),n=h,l=c,s=o}a.push(t)}else if("alpha"==t)a.push($e(e,new _(r,r,o),0,1));else if("rgba2"==t){let t=new V(r,7*r,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.light),h=i.fromString(s.dark);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b,l.a,h.r,h.g,h.b);let o=e[r+1];if(!o){t.shrink(a);break}let c=Je(o,"time",0),d=i.fromString(o.light),u=i.fromString(o.dark),p=s.curve;p&&(a=He(p,t,a,r,0,n,c,l.r,d.r,1),a=He(p,t,a,r,1,n,c,l.g,d.g,1),a=He(p,t,a,r,2,n,c,l.b,d.b,1),a=He(p,t,a,r,3,n,c,l.a,d.a,1),a=He(p,t,a,r,4,n,c,h.r,u.r,1),a=He(p,t,a,r,5,n,c,h.g,u.g,1),a=He(p,t,a,r,6,n,c,h.b,u.b,1)),n=c,l=d,h=u,s=o}a.push(t)}else if("rgb2"==t){let t=new D(r,6*r,o),s=e[0],n=Je(s,"time",0),l=i.fromString(s.light),h=i.fromString(s.dark);for(let r=0,a=0;;r++){t.setFrame(r,n,l.r,l.g,l.b,h.r,h.g,h.b);let o=e[r+1];if(!o){t.shrink(a);break}let c=Je(o,"time",0),d=i.fromString(o.light),u=i.fromString(o.dark),p=s.curve;p&&(a=He(p,t,a,r,0,n,c,l.r,d.r,1),a=He(p,t,a,r,1,n,c,l.g,d.g,1),a=He(p,t,a,r,2,n,c,l.b,d.b,1),a=He(p,t,a,r,3,n,c,h.r,u.r,1),a=He(p,t,a,r,4,n,c,h.g,u.g,1),a=He(p,t,a,r,5,n,c,h.b,u.b,1)),n=c,l=d,h=u,s=o}a.push(t)}}}if(e.bones)for(let t in e.bones){let s=e.bones[t],i=r.findBone(t);if(!i)throw new Error("Bone not found: "+t);let o=i.index;for(let t in s){let e=s[t],r=e.length;if(0!=r)if("rotate"===t)a.push($e(e,new v(r,r,o),0,1));else if("translate"===t){let t=new k(r,r<<1,o);a.push(je(e,t,"x","y",0,n))}else if("translatex"===t){let t=new I(r,r,o);a.push($e(e,t,0,n))}else if("translatey"===t){let t=new A(r,r,o);a.push($e(e,t,0,n))}else if("scale"===t){let t=new B(r,r<<1,o);a.push(je(e,t,"x","y",1,1))}else if("scalex"===t){let t=new T(r,r,o);a.push($e(e,t,1,1))}else if("scaley"===t){let t=new C(r,r,o);a.push($e(e,t,1,1))}else if("shear"===t){let t=new F(r,r<<1,o);a.push(je(e,t,"x","y",0,1))}else if("shearx"===t){let t=new E(r,r,o);a.push($e(e,t,0,1))}else if("sheary"===t){let t=new Y(r,r,o);a.push($e(e,t,0,1))}else if("inherit"===t){let t=new R(r,i.index);for(let s=0;s<e.length;s++){let r=e[s];t.setFrame(s,Je(r,"time",0),l.enumValue(exports.Inherit,Je(r,"inherit","Normal")))}a.push(t)}}}if(e.ik)for(let t in e.ik){let s=e.ik[t],i=s[0];if(!i)continue;let o=r.findIkConstraint(t);if(!o)throw new Error("IK Constraint not found: "+t);let l=r.ikConstraints.indexOf(o),h=new U(s.length,s.length<<1,l),c=Je(i,"time",0),d=Je(i,"mix",1),u=Je(i,"softness",0)*n;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Je(i,"bendPositive",!0)?1:-1,Je(i,"compress",!1),Je(i,"stretch",!1));let r=s[t+1];if(!r){h.shrink(e);break}let a=Je(r,"time",0),o=Je(r,"mix",1),l=Je(r,"softness",0)*n,p=i.curve;p&&(e=He(p,h,e,t,0,c,a,d,o,1),e=He(p,h,e,t,1,c,a,u,l,n)),c=a,d=o,u=l,i=r}a.push(h)}if(e.transform)for(let t in e.transform){let s=e.transform[t],i=s[0];if(!i)continue;let n=r.findTransformConstraint(t);if(!n)throw new Error("Transform constraint not found: "+t);let o=r.transformConstraints.indexOf(n),l=new W(s.length,6*s.length,o),h=Je(i,"time",0),c=Je(i,"mixRotate",1),d=Je(i,"mixX",1),u=Je(i,"mixY",d),p=Je(i,"mixScaleX",1),m=Je(i,"mixScaleY",p),f=Je(i,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,p,m,f);let r=s[t+1];if(!r){l.shrink(e);break}let n=Je(r,"time",0),a=Je(r,"mixRotate",1),o=Je(r,"mixX",1),g=Je(r,"mixY",o),x=Je(r,"mixScaleX",1),w=Je(r,"mixScaleY",x),b=Je(r,"mixShearY",1),y=i.curve;y&&(e=He(y,l,e,t,0,h,n,c,a,1),e=He(y,l,e,t,1,h,n,d,o,1),e=He(y,l,e,t,2,h,n,u,g,1),e=He(y,l,e,t,3,h,n,p,x,1),e=He(y,l,e,t,4,h,n,m,w,1),e=He(y,l,e,t,5,h,n,f,b,1)),h=n,c=a,d=o,u=g,p=x,m=w,p=x,i=r}a.push(l)}if(e.path)for(let t in e.path){let s=e.path[t],i=r.findPathConstraint(t);if(!i)throw new Error("Path constraint not found: "+t);let o=r.pathConstraints.indexOf(i);for(let t in s){let e=s[t],r=e[0];if(!r)continue;let l=e.length;if("position"===t){let t=new z(l,l,o);a.push($e(e,t,0,i.positionMode==exports.PositionMode.Fixed?n:1))}else if("spacing"===t){let t=new G(l,l,o);a.push($e(e,t,0,i.spacingMode==exports.SpacingMode.Length||i.spacingMode==exports.SpacingMode.Fixed?n:1))}else if("mix"===t){let t=new $(l,3*l,o),s=Je(r,"time",0),i=Je(r,"mixRotate",1),n=Je(r,"mixX",1),h=Je(r,"mixY",n);for(let a=0,o=0;;a++){t.setFrame(a,s,i,n,h);let l=e[a+1];if(!l){t.shrink(o);break}let c=Je(l,"time",0),d=Je(l,"mixRotate",1),u=Je(l,"mixX",1),p=Je(l,"mixY",u),m=r.curve;m&&(o=He(m,t,o,a,0,s,c,i,d,1),o=He(m,t,o,a,1,s,c,n,u,1),o=He(m,t,o,a,2,s,c,h,p,1)),s=c,i=d,n=u,h=p,r=l}a.push(t)}}}if(e.physics)for(let t in e.physics){let s=e.physics[t],i=-1;if(t.length>0){let e=r.findPhysicsConstraint(t);if(!e)throw new Error("Physics constraint not found: "+t);i=r.physicsConstraints.indexOf(e)}for(let t in s){let e=s[t],r=e[0];if(!r)continue;let n,o=e.length;if("reset"!=t){if("inertia"==t)n=new H(o,o,i);else if("strength"==t)n=new J(o,o,i);else if("damping"==t)n=new K(o,o,i);else if("mass"==t)n=new Q(o,o,i);else if("wind"==t)n=new Z(o,o,i);else if("gravity"==t)n=new tt(o,o,i);else{if("mix"!=t)continue;n=new et(o,o,i)}a.push($e(e,n,0,1))}else{const t=new st(o,i);for(let s=0;null!=r;r=e[s+1],s++)t.setFrame(s,Je(r,"time",0));a.push(t)}}}if(e.attachments)for(let s in e.attachments){let i=e.attachments[s],o=r.findSkin(s);if(!o)throw new Error("Skin not found: "+s);for(let e in i){let s=i[e],h=r.findSlot(e);if(!h)throw new Error("Slot not found: "+e);let c=h.index;for(let e in s){let r=s[e],i=o.getAttachment(c,e);for(let e in r){let s=r[e],o=s[0];if(o)if("deform"==e){let t=i.bones,e=i.vertices,r=t?e.length/3*2:e.length,h=new N(s.length,s.length,c,i),d=Je(o,"time",0);for(let i=0,a=0;;i++){let c,u=Je(o,"vertices",null);if(u){c=l.newFloatArray(r);let s=Je(o,"offset",0);if(l.arrayCopy(u,0,c,s,u.length),1!=n)for(let t=s,e=t+u.length;t<e;t++)c[t]*=n;if(!t)for(let t=0;t<r;t++)c[t]+=e[t]}else c=t?l.newFloatArray(r):e;h.setFrame(i,d,c);let p=s[i+1];if(!p){h.shrink(a);break}let m=Je(p,"time",0),f=o.curve;f&&(a=He(f,h,a,i,0,d,m,0,1,1)),d=m,o=p}a.push(h)}else if("sequence"==e){let e=new rt(s.length,c,i),r=0;for(let i=0;i<s.length;i++){let n=Je(o,"delay",r),a=Je(o,"time",0),l=t[Je(o,"mode","hold")],h=Je(o,"index",0);e.setFrame(i,a,l,h,n),r=n,o=s[i+1]}a.push(e)}}}}}if(e.drawOrder){let t=new q(e.drawOrder.length),s=r.slots.length,i=0;for(let n=0;n<e.drawOrder.length;n++,i++){let a=e.drawOrder[n],o=null,h=Je(a,"offsets",null);if(h){o=l.newArray(s,-1);let t=l.newArray(s-h.length,0),e=0,i=0;for(let s=0;s<h.length;s++){let n=h[s],a=r.findSlot(n.slot);if(!a)throw new Error("Slot not found: "+a);let l=a.index;for(;e!=l;)t[i++]=e++;o[e+n.offset]=e++}for(;e<s;)t[i++]=e++;for(let e=s-1;e>=0;e--)-1==o[e]&&(o[e]=t[--i])}t.setFrame(i,Je(a,"time",0),o)}a.push(t)}if(e.events){let t=new L(e.events.length),s=0;for(let i=0;i<e.events.length;i++,s++){let n=e.events[i],a=r.findEvent(n.name);if(!a)throw new Error("Event not found: "+n.name);let o=new qt(l.toSinglePrecision(Je(n,"time",0)),a);o.intValue=Je(n,"int",a.intValue),o.floatValue=Je(n,"float",a.floatValue),o.stringValue=Je(n,"string",a.stringValue),o.data.audioPath&&(o.volume=Je(n,"volume",1),o.balance=Je(n,"balance",0)),t.setFrame(s,o)}a.push(t)}let o=0;for(let t=0,e=a.length;t<e;t++)o=Math.max(o,a[t].getDuration());r.animations.push(new f(s,a,o))}}class Ge{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=i}}function $e(t,e,s,r){let i=t[0],n=Je(i,"time",0),a=Je(i,"value",s)*r,o=0;for(let l=0;;l++){e.setFrame(l,n,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Je(h,"time",0),d=Je(h,"value",s)*r;i.curve&&(o=He(i.curve,e,o,l,0,n,c,a,d,r)),n=c,a=d,i=h}}function je(t,e,s,r,i,n){let a=t[0],o=Je(a,"time",0),l=Je(a,s,i)*n,h=Je(a,r,i)*n,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let p=Je(u,"time",0),m=Je(u,s,i)*n,f=Je(u,r,i)*n,g=a.curve;g&&(c=He(g,e,c,d,0,o,p,l,m,n),c=He(g,e,c,d,1,o,p,h,f,n)),o=p,l=m,h=f,a=u}}function He(t,e,s,r,i,n,a,o,l,h){if("stepped"==t)return e.setStepped(r),s;let c=i<<2,d=t[c],u=t[c+1]*h,p=t[c+2],m=t[c+3]*h;return e.setBezier(s,r,i,n,o,d,u,p,m,a,l),s+1}function Je(t,e,s){return void 0!==t[e]?t[e]:s}var Ke;function Qe(t,e,s){const r=new Vt(t);return"json"===s?new ze(r).readSkeletonData(e):new ie(r).readSkeletonData(new Uint8Array(e))}async function Ze(t,s,r){let i;const n=t.map(((t,i)=>{const n=s[i];let a=e.AssetType.Texture2D;return"ktx"===n?a=e.AssetType.KTX:"ktx2"===n&&(a=e.AssetType.KTX2),ss(t,r,a)}));try{i=await Promise.all(n)}catch(t){throw t}return i}async function ts(t,s){const r=function(t){const e=new URL(t),s=e.origin+e.pathname;return s.endsWith("/")?s:s.substring(0,s.lastIndexOf("/")+1)}(t);let i,n;try{i=await e.request(t,{type:"text"})}catch(e){throw new Error(`Spine Atlas: ${t} load error: ${e}`)}let a=new Ct(i);const o=[];for(let t of a.pages){const e=r+t.name;o.push(ss(e,s))}try{n=await Promise.all(o)}catch(t){throw new Error(`Spine Texture: load error: ${t}`)}return a=es(i,n),a}function es(t,e){const s=new Ct(t);return s.pages.forEach(((t,s)=>{const r=function(t){return new rs(new Image,t)}(e.find((e=>e.name===t.name))||e[s]);t.setTexture(r)})),s}function ss(t,s,r=e.AssetType.Texture2D){return s.resourceManager.load({url:t,type:r})}void 0===Math.fround&&(Math.fround=(Ke=new Float32Array(1),function(t){return Ke[0]=t,Ke[0]}));class rs extends wt{constructor(t,e){super(t),this.texture=e,this.texture.generateMipmaps()}getImage(){return this.texture}setFilters(t,s){t===exports.TextureFilter.Nearest?this.texture.filterMode=e.TextureFilterMode.Point:s===exports.TextureFilter.MipMapLinearLinear?this.texture.filterMode=e.TextureFilterMode.Trilinear:this.texture.filterMode=e.TextureFilterMode.Bilinear}setWraps(t,e){this.texture.wrapModeU=this._convertWrapMode(t),this.texture.wrapModeV=this._convertWrapMode(e)}dispose(){}_convertWrapMode(t){switch(t){case exports.TextureWrap.ClampToEdge:return e.TextureWrapMode.Clamp;case exports.TextureWrap.Repeat:return e.TextureWrapMode.Repeat;case exports.TextureWrap.MirroredRepeat:return e.TextureWrapMode.Mirror;default:throw new Error("Unsupported texture wrap mode.")}}}class is{constructor(t,e=1){this._type=t,this._lastElementIndex=e-1;const s=this._elements=new Array(e);for(let r=0;r<e;++r)s[r]=new t}get(){return this._lastElementIndex<0?new this._type:this._elements[this._lastElementIndex--]}return(t){this._elements[++this._lastElementIndex]=t}}class ns{constructor(t){this._usedElementCount=0,this._type=t,this._elements=[]}get(){const{_usedElementCount:t,_elements:e}=this;if(this._usedElementCount++,e.length===t){const t=new this._type;return e.push(t),t}return e[t]}clear(){this._usedElementCount=0}}const{SourceAlpha:as,One:os,DestinationColor:ls,Zero:hs,OneMinusSourceColor:cs,OneMinusSourceAlpha:ds}=e.BlendFactor,{Add:us}=e.BlendOperation;function ps(t,e){const s=t.renderState.blendState.targetBlendState;switch(e){case exports.BlendMode.Additive:s.sourceColorBlendFactor=as,s.destinationColorBlendFactor=os,s.sourceAlphaBlendFactor=os,s.destinationAlphaBlendFactor=os,s.colorBlendOperation=s.alphaBlendOperation=us;break;case exports.BlendMode.Multiply:s.sourceColorBlendFactor=ls,s.destinationColorBlendFactor=ds,s.sourceAlphaBlendFactor=os,s.destinationAlphaBlendFactor=ds,s.colorBlendOperation=s.alphaBlendOperation=us;break;case exports.BlendMode.Screen:s.sourceColorBlendFactor=os,s.destinationColorBlendFactor=cs,s.sourceAlphaBlendFactor=os,s.destinationAlphaBlendFactor=cs,s.colorBlendOperation=s.alphaBlendOperation=us;break;default:s.sourceColorBlendFactor=as,s.destinationColorBlendFactor=ds,s.sourceAlphaBlendFactor=os,s.destinationAlphaBlendFactor=ds,s.colorBlendOperation=s.alphaBlendOperation=us}}class ms{}const fs=1/0,gs=-1/0;class xs{static{this.QUAD_TRIANGLES=[0,1,2,2,3,0]}static{this.VERTEX_SIZE=8}static{this.VERTEX_STRIDE=9}static{this.tempDark=new i}static{this.tempColor=new i}static{this.tempVerts=new Array(8)}static{this.tempBlendMode=null}static{this.tempTexture=null}static{this.subPrimitivePool=new is(e.SubPrimitive)}static{this.subRenderItemPool=new ns(ms)}static{this.bounds=new e.BoundingBox(new e.Vector3(fs,fs,fs),new e.Vector3(gs,gs,gs))}getMaxVertexCount(t){const e=new Set,{skins:s}=t,r=s.length;for(let t=0;t<r;t++){const r=s[t];this._collectUniqueAttachments(r,e)}return this._calculateTotalVertexCount(e)}buildPrimitive(t,e){const{useClipping:s=!0,zSpacing:r=.01}=e.setting,{_clipper:i,_separateSlots:n,_subRenderItems:a,_separateSlotTextureMap:o}=this,{bounds:l}=xs;l.min.set(fs,fs,fs),l.max.set(gs,gs,gs);let h=0,c=0;const d=t.drawOrder,u=d.length,{engine:p,_indices:m,_vertices:f,_subPrimitives:g}=e;let{tempVerts:x,tempTexture:w,tempBlendMode:b,subRenderItemPool:y,subPrimitivePool:M}=xs;a.length=0,y.clear();let S,v,k=e._vertices,I=0,A=0,B=exports.BlendMode.Normal,T=null,C=0;xs.tempBlendMode=null,xs.tempTexture=null;for(let t=0;t<u;++t){const e=d[t];if(!e.bone.active){i.clipEndWithSlot(e);continue}const l=e.getAttachment();let u=null;const p=r*t;let F=0;const E=i.isClipping();let Y=E?2:xs.VERTEX_SIZE;if(l){switch(l.constructor){case _t:const t=l;u=t.color,F=4*Y,t.computeWorldVertices(e,x,0,Y),S=xs.QUAD_TRIANGLES,v=t.uvs,T=t.region.texture;break;case Rt:const r=l;u=r.color,F=(r.worldVerticesLength>>1)*Y,F>k.length&&(xs.tempVerts=new Array(F)),r.computeWorldVertices(e,0,r.worldVerticesLength,x,0,Y),S=r.triangles,v=r.uvs,T=r.region.texture;break;case xt:if(s){let t=l;i.clipStart(e,t)}continue;default:s&&i.clipEndWithSlot(e);continue}if(null!=T){let t,s,r,l,d=e.bone.skeleton.color,k=e.color,R=d.a*k.a*u.a,P=xs.tempColor,X=xs.tempDark;if(P.set(d.r*k.r*u.r,d.g*k.g*u.g,d.b*k.b*u.b,R),E)i.clipTriangles(x,S,S.length,v,P,X,!1),t=i.clippedVertices,s=t.length,r=i.clippedTriangles,l=r.length;else{let e=x;const{r:i,g:n,b:a,a:o}=P;for(let t=2,s=0,r=F;t<r;t+=Y,s+=2)e[t]=i,e[t+1]=n,e[t+2]=a,e[t+3]=o,e[t+4]=v[s],e[t+5]=v[s+1];t=x,s=F,r=S,l=S.length}if(0==s||0==l){i.clipEndWithSlot(e);continue}let _=h/xs.VERTEX_STRIDE,V=f,D=h,O=0;for(;O<s;){let e=t[O++],s=t[O++];V[D++]=e,V[D++]=s,V[D++]=p,V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],V[D++]=t[O++],this._expandByPoint(e,s,p)}h=D;let N=m;for(D=c,O=0;O<l;D++,O++)N[D]=r[O]+_;c+=l;const L=e.data,q=L.name;B=L.blendMode;const U=null!==b&&b!==L.blendMode,W=null!==w&&w!==T,z=n.get(q);if(z||U||W){if(A>0){const t=g[C];t&&C++;const e=t||M.get();e.start=I,e.count=A;const s=y.get();s.subPrimitive=e,s.texture=w,s.blendMode=b,a.push(s),I+=A,A=0}if(z){const t=o.get(q);if(t){const e=T.texture;t.filterMode=e.filterMode,t.wrapModeU=e.wrapModeU,t.wrapModeV=e.wrapModeV}const e=g[C];e&&C++;const s=e||M.get();s.start=I,s.count=l;const r=y.get();r.blendMode=B,r.subPrimitive=s,r.texture=T,r.slotName=q,a.push(r),I+=l,A=0}else A+=l}else A+=l;w=T,b=B}i.clipEndWithSlot(e)}else s&&i.clipEndWithSlot(e)}if(A>0){const t=g[C];t&&C++;const e=t||M.get();e.start=I,e.count=A;const s=y.get();s.blendMode=B,s.subPrimitive=e,s.texture=T,a.push(s),A=0}i.clipEnd();const F=g.length,E=a.length;if(E<F)for(let t=E;t<F;t++){const e=g[t];M.return(e)}e._clearSubPrimitives();for(let t=0,s=E;t<s;++t){const s=a[t],{slotName:r,blendMode:i,texture:n}=s;e._addSubPrimitive(s.subPrimitive);let l=n.texture;o.has(r)&&(l=o.get(r));const h=`${l.instanceId}_${i}`;let c=bs._materialCache.get(h);c||(c=this._createMaterialForTexture(l,p,i),bs._materialCache.set(h,c)),e.setMaterial(t,c)}e._vertexBuffer.setData(f),e._indexBuffer.setData(m)}addSeparateSlot(t){this._separateSlots.set(t,t)}addSeparateSlotTexture(t,e){this._separateSlotTextureMap.set(t,e)}_createMaterialForTexture(t,e,s){const r=bs._getDefaultMaterial(e);return r.shaderData.setTexture("material_SpineTexture",t),ps(r,s),r}_expandByPoint(t,e,s){const{bounds:{min:r,max:i}}=xs,n=Math.min(r.x,t),a=Math.min(r.y,e),o=Math.min(r.z,s),l=Math.max(i.x,t),h=Math.max(i.y,e),c=Math.max(i.z,s);r.set(n,a,o),i.set(l,h,c)}_collectUniqueAttachments(t,e){const{attachments:s}=t;for(let t=0,r=s.length;t<r;t++){const r=s[t];for(let t in r){const s=r[t];s&&!e.has(s)&&e.add(s)}}}_calculateTotalVertexCount(t){let e=0;const s=xs.QUAD_TRIANGLES.length;return t.forEach((t=>{t instanceof _t?e+=s:t instanceof Rt&&(e+=t.triangles.length)})),e}constructor(){this._clipper=new We,this._subRenderItems=[],this._separateSlots=new Map,this._separateSlotTextureMap=new Map}}class ws extends e.Material{static{this._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n "}static{this._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n "}constructor(t){super(t,e.Shader.find("galacean-spine-shader")||e.Shader.create("galacean-spine-shader",ws._spineVS,ws._spineFS));const s=this.renderState;s.blendState.targetBlendState.enabled=!0,ps(this,exports.BlendMode.Normal),s.depthState.writeEnabled=!1,s.rasterState.cullMode=e.CullMode.Off,s.renderQueueType=e.RenderQueueType.Transparent}}class bs extends e.Renderer{static{this._spineGenerator=new xs}static{this._positionVertexElement=new e.VertexElement("POSITION",0,e.VertexElementFormat.Vector3,0)}static{this._colorVertexElement=new e.VertexElement("COLOR_0",12,e.VertexElementFormat.Vector4,0)}static{this._uvVertexElement=new e.VertexElement("TEXCOORD_0",28,e.VertexElementFormat.Vector2,0)}static{this._materialCache=new Map}static{this._animationDataCache=new Map}static _getDefaultMaterial(t){let e=this._defaultMaterial;if(e){if(e.engine===t)return e.clone();e.destroy(!0),e=null}return e=new ws(t),e.isGCIgnored=!0,this._defaultMaterial=e,e.clone()}get resource(){return this._resource}set resource(t){if(!t)return this._state=null,this._skeleton=null,void(this._resource=null);this._resource=t,this._addResourceReferCount(t,1);const{skeletonData:e}=t;this._skeleton=new Kt(e);let s=bs._animationDataCache.get(e);s||(s=new ft(e),bs._animationDataCache.set(e,s)),this._state=new it(s);const r=bs._spineGenerator.getMaxVertexCount(e);this._createBuffer(r),this._initializeDefaultState(),this._dirtyUpdateFlag|=4,this._state.addListener({start:()=>{this._onAnimationStart()},complete:t=>{this._onAnimationComplete(t)}})}get state(){return this._state}get skeleton(){return this._skeleton}constructor(t){super(t),this.setting=new ys,this.defaultState=new Ms,this._subPrimitives=[],this._needResizeBuffer=!1,this._vertexCount=0;const s=new e.Primitive(this._engine);this._primitive=s,s.addVertexElement(bs._positionVertexElement),s.addVertexElement(bs._colorVertexElement),s.addVertexElement(bs._uvVertexElement)}addSeparateSlot(t){this._skeleton||console.error("Skeleton not found!");this._skeleton.findSlot(t)?bs._spineGenerator.addSeparateSlot(t):console.warn(`Slot: ${t} not find.`)}_onEnable(){this._initializeDefaultState()}update(t){const{_state:e,_skeleton:s}=this;e&&s&&(e.update(t),e.apply(s),s.update(t),s.updateWorldTransform(exports.Physics.update),bs._spineGenerator.buildPrimitive(this._skeleton,this),this._isContainDirtyFlag(4)&&(this._onWorldVolumeChanged(),this._setDirtyFlagFalse(4)),this._isContainDirtyFlag(2)&&this._calculateGeneratorBounds(this.bounds))}_render(t){const{_primitive:e,_subPrimitives:s}=this,{_materials:r,_engine:i}=this,n=i._renderElementPool.get();n.set(this.priority,this._distanceForSort);const a=i._subRenderElementPool;if(s){for(let t=0,i=s.length;t<i;t++){let i=r[t];if(!i)continue;(i.destroyed||i.shader.destroyed)&&(i=this.engine._meshMagentaMaterial);const o=a.get();o.set(this,i,e,s[t]),n.addSubRenderElement(o)}t.camera._renderPipeline.pushRenderElement(t,n)}}_updateBounds(t){this._calculateGeneratorBounds(t)}_calculateGeneratorBounds(t){const{bounds:s}=xs;e.BoundingBox.transform(s,this.entity.transform.worldMatrix,t)}_cloneTo(t){t.resource=this._resource}_onDestroy(){const{_primitive:t,_subPrimitives:e,_resource:s}=this;e.length=0,t&&t.destroy(),s&&this._addResourceReferCount(s,-1),this._clearMaterialCache(),this._primitive=null,this._resource=null,this._skeleton=null,this._state=null,this.setting=null,super._onDestroy()}_createBuffer(t){const{_engine:s,_primitive:r}=this;this._vertices=new Float32Array(t*xs.VERTEX_STRIDE),this._indices=new Uint16Array(t);const i=4*xs.VERTEX_STRIDE,n=new e.Buffer(s,e.BufferBindFlag.VertexBuffer,this._vertices,e.BufferUsage.Dynamic),a=new e.Buffer(s,e.BufferBindFlag.IndexBuffer,this._indices,e.BufferUsage.Dynamic);this._indexBuffer=a,this._vertexBuffer=n;const o=new e.VertexBufferBinding(n,i);this._primitive.setVertexBufferBinding(0,o);const l=new e.IndexBufferBinding(a,e.IndexFormat.UInt16);r.setIndexBufferBinding(l)}_addSubPrimitive(t){this._subPrimitives.push(t)}_clearSubPrimitives(){this._subPrimitives.length=0}_isContainDirtyFlag(t){return!!(this._dirtyUpdateFlag&t)}_setDirtyFlagFalse(t){this._dirtyUpdateFlag&=~t}_onWorldVolumeChanged(){this._dirtyUpdateFlag|=1}_onAnimationStart(){this._dirtyUpdateFlag|=2}_onAnimationComplete(t){t.loop||this._setDirtyFlagFalse(2)}_clearMaterialCache(){this._materials.forEach((t=>{const e=t.shaderData.getTexture("material_SpineTexture"),s=function(t){const e=t.renderState.blendState.targetBlendState;return e.sourceColorBlendFactor===as&&e.destinationColorBlendFactor===os&&e.sourceAlphaBlendFactor===os&&e.destinationAlphaBlendFactor===os&&e.colorBlendOperation===us&&e.alphaBlendOperation===us?exports.BlendMode.Additive:e.sourceColorBlendFactor===ls&&e.destinationColorBlendFactor===hs&&e.sourceAlphaBlendFactor===os&&e.destinationAlphaBlendFactor===hs&&e.colorBlendOperation===us&&e.alphaBlendOperation===us?exports.BlendMode.Multiply:e.sourceColorBlendFactor===os&&e.destinationColorBlendFactor===cs&&e.sourceAlphaBlendFactor===os&&e.destinationAlphaBlendFactor===cs&&e.colorBlendOperation===us&&e.alphaBlendOperation===us?exports.BlendMode.Screen:exports.BlendMode.Normal}(t),r=`${e.instanceId}_${s}`;bs._materialCache.delete(r)}))}_initializeDefaultState(){const{skeleton:t,state:e}=this;if(t&&e){const{animationName:s,skinName:r,loop:i,scale:n}=this.defaultState;t.scaleX=n,t.scaleY=n,"default"!==r&&(t.setSkinByName(r),t.setToSetupPose()),s&&e.setAnimation(0,s,i)}}}s([e.deepClone],bs.prototype,"setting",void 0),s([e.deepClone],bs.prototype,"defaultState",void 0),s([e.ignoreClone],bs.prototype,"_primitive",void 0),s([e.ignoreClone],bs.prototype,"_subPrimitives",void 0),s([e.ignoreClone],bs.prototype,"_indexBuffer",void 0),s([e.ignoreClone],bs.prototype,"_vertexBuffer",void 0),s([e.ignoreClone],bs.prototype,"_vertices",void 0),s([e.ignoreClone],bs.prototype,"_indices",void 0),s([e.ignoreClone],bs.prototype,"_needResizeBuffer",void 0),s([e.ignoreClone],bs.prototype,"_vertexCount",void 0),s([e.ignoreClone],bs.prototype,"_resource",void 0),s([e.ignoreClone],bs.prototype,"_skeleton",void 0),s([e.ignoreClone],bs.prototype,"_state",void 0);class ys{constructor(t=.01,e=!0){this.zSpacing=t,this.useClipping=e}}class Ms{constructor(t=1,e=!0,s=null,r="default"){this.scale=t,this.loop=e,this.animationName=s,this.skinName=r}}class Ss extends e.ReferResource{get skeletonData(){return this._skeletonData}constructor(t,e){super(t),this.textures=[],this._skeletonData=e,this._associationTextureInSkeletonData(e)}_onDestroy(){super._onDestroy();const{textures:t,_skeletonData:e}=this;t&&this._disassociationSuperResource(t),this._clearAttachmentTextures(e),bs._animationDataCache.delete(e),this._skeletonData=null}_disassociationSuperResource(t){for(let e=0,s=t.length;e<s;e++)t[e]._disassociationSuperResource(this)}_associationTextureInSkeletonData(t){const{skins:e}=t;e.forEach((t=>{const{attachments:e}=t;e.forEach((t=>{const e=Object.values(t)[0],s=e?.region?.texture.texture;s&&!this.textures.find((t=>t.instanceId===s.instanceId))&&(this.textures.push(s),s._associationSuperResource(this))}))}))}_clearAttachmentTextures(t){const{skins:e}=t;e.forEach((t=>{const{attachments:e}=t;e.forEach((t=>{const e=Object.values(t)[0];e?.region?.texture&&(e.region.texture.texture=null)}))}))}}class vs{constructor(t,e=0,s){this.data=t,this._dataView=new DataView(t.buffer,t.byteOffset+e,s??t.byteLength-e),this._position=0}nextUint16(){const t=this._dataView.getUint16(this._position,!0);return this._position+=2,t}nextStr(){const t=this.nextUint16(),e=new Uint8Array(this.data.buffer,this._position+this._dataView.byteOffset,t);return this._position+=t,this.decodeText(e)}nextImageData(){return new Uint8Array(this.data.buffer,this.data.byteOffset+this._position)}decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let s=0,r=t.length;s<r;s++)e+=String.fromCharCode(t[s]);return decodeURIComponent(encodeURIComponent(e))}}class ks extends e.Loader{static{this.imageExtensions=["png","jpg","webp","jpeg","ktx","ktx2"]}static{this.skeletonExtensions=["skel","json","bin"]}static parseAndAssignSpineAsset(t,e,s){const{imageExtensions:r,skeletonExtensions:i}=ks,n=ks.getUrlExtension(t,e);n&&(i.includes(n)&&(s.skeletonPath=t,s.skeletonExtension=n),"atlas"===n&&(s.atlasPath=t),r.includes(n)&&(s.imagePaths.push(t),s.imageExtensions.push(n)))}static deriveAndAssignSpineAsset(t,e,s){const r=ks.getUrlExtension(t,e);if(!r)return;s.skeletonPath=t,s.skeletonExtension=r;const i=/(\.(json|bin|skel))$/;let n;if(i.test(t)&&(n=t.replace(i,"")),n){const t=n+".atlas";s.atlasPath=t}}static verifyFileExtensions(t,e){return t?e&&!Array.isArray(t)?(console.error("Expect fileExtensions to be an array."),[]):e||"string"==typeof t?t:(console.error("Expect fileExtensions to be a string."),null):null}static getUrlExtension(t,e){if(e)return e;const s=t.match(/\/([^\/?#]+)\.([a-zA-Z0-9]+)(\?|#|$)|\?[^#]*\.([a-zA-Z0-9]+)(\?|#|$)/);return s?s[2]||s[4]:null}load(t,s){return new e.AssetPromise((async e=>{let r;if(t.urls)r=await this._handleOriginAsset(t,s);else{const e=await s._request(t.url,{type:"arraybuffer"}),i=new vs(new Uint8Array(e)),n=i.nextStr();r=n.startsWith("spine")?await this._handleEditorAsset(e,i,n,s):await this._handleOriginAsset(t,s,e)}e(r)}))}async _handleEditorAsset(t,e,s,r){let i,n;const a=s.startsWith("spine:skel")?"skel":"json",{engine:o}=r;if("skel"===a)n=e.nextStr(),i=e.nextImageData();else{const e=new TextDecoder("utf-8").decode(new Uint8Array(t)),{data:s,atlas:r}=JSON.parse(e);n=r.refId,i=s}const l=Qe(await r.getResourceByRef({refId:n}),i,a);return new Ss(o,l)}async _handleOriginAsset(t,e,s){let{fileExtensions:r}=t.params||{},i={skeletonPath:"",skeletonExtension:"",atlasPath:"",imagePaths:[],imageExtensions:[]};const{engine:n}=e;if(s){const e=ks.verifyFileExtensions(r,!1);ks.deriveAndAssignSpineAsset(t.url,e,i);const{skeletonPath:a,atlasPath:o}=i;if(!a||!o)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const l=await ts(o,n),{data:h,type:c}=this._determineSkeletonDataType(s),d=Qe(l,h,c);return new Ss(n,d)}{r=ks.verifyFileExtensions(r,!0);for(let e=0;e<t.urls.length;e+=1){const s=t.urls[e],n=r&&r[e]||null;ks.parseAndAssignSpineAsset(s,n,i)}const{skeletonPath:s,atlasPath:a,imagePaths:o,skeletonExtension:l,imageExtensions:h}=i;if(!s||!a)throw new Error("Failed to load spine assets. Please check the file path and ensure the file extension is included.");const c="json"===l?"json":"skel";let d,u,p=["json"===l?e._request(s,{type:"text"}):e._request(s,{type:"arraybuffer"})];if(o.length>0){let t,s;p=p.concat([e._request(a,{type:"text"}),Ze(o,h,n)]),[u,t,s]=await Promise.all(p),d=es(t,s)}else p.push(ts(a,n)),[u,d]=await Promise.all(p);const m=Qe(d,u,c);return new Ss(n,m)}}_determineSkeletonDataType(t){let e,s;try{const r=new TextDecoder("utf-8").decode(t);JSON.parse(r),e=r,s="json"}catch(r){e=t,s="skel"}return{data:e,type:s}}}ks=s([e.resourceLoader("spine",["json","bin","skel"])],ks);class Is extends e.Loader{load(t,s){return new e.AssetPromise((async e=>{const r=await s._request(t.url,{type:"text"}),{data:i,textures:n}=JSON.parse(r),a=n.map((t=>s.getResourceByRef({refId:t.refId})));e(es(i,await Promise.all(a)))}))}}Is=s([e.resourceLoader("EditorSpineAtlas",["atlas"])],Is);const As="4.2.0-beta.2";e.Loader.registerClass("SpineAnimationRenderer",bs),console.log(`Galacean spine version: ${As}`),exports.AlphaTimeline=_,exports.Animation=f,exports.AnimationState=it,exports.AnimationStateAdapter=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},exports.AnimationStateData=ft,exports.AssetManagerBase=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new Lt){this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${r}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${r}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${r}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>{this.success(e,t,this.textureLoader(r))},r.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),r.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},r){let i=t.lastIndexOf("/"),n=i>=0?t.substring(0,i+1):"";t=this.start(t),this.downloader.downloadText(t,(i=>{try{let a=new Ct(i),o=a.pages.length,l=!1;for(let i of a.pages)this.loadTexture(r?r[i.name]:n+i.name,((s,r)=>{l||(i.setTexture(r),0==--o&&this.success(e,t,a))}),((e,r)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,r)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${r}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},exports.AtlasAttachmentLoader=Vt,exports.Attachment=d,exports.AttachmentTimeline=O,exports.BinaryInput=ne,exports.Bone=Ot,exports.BoneData=Dt,exports.BoundingBoxAttachment=gt,exports.CURRENT=mt,exports.ClippingAttachment=xt,exports.Color=i,exports.ConstraintData=Nt,exports.CurveTimeline=y,exports.CurveTimeline1=M,exports.CurveTimeline2=S,exports.DebugUtils=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)}}},exports.DeformTimeline=N,exports.Downloader=Lt,exports.DrawOrderTimeline=q,exports.Event=qt,exports.EventData=Ut,exports.EventQueue=at,exports.EventTimeline=L,exports.FIRST=ht,exports.FakeTexture=class extends wt{setFilters(t,e){}setWraps(t,e){}dispose(){}},exports.HOLD_FIRST=dt,exports.HOLD_MIX=ut,exports.HOLD_SUBSEQUENT=ct,exports.IkConstraint=Wt,exports.IkConstraintData=zt,exports.IkConstraintTimeline=U,exports.InheritTimeline=R,exports.IntSet=class{array=new Array;add(t){let e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}},exports.Interpolation=a,exports.MathUtils=n,exports.MeshAttachment=Rt,exports.PathAttachment=Pt,exports.PathConstraint=$t,exports.PathConstraintData=Gt,exports.PathConstraintMixTimeline=$,exports.PathConstraintPositionTimeline=z,exports.PathConstraintSpacingTimeline=G,exports.PhysicsConstraintDampingTimeline=K,exports.PhysicsConstraintGravityTimeline=tt,exports.PhysicsConstraintInertiaTimeline=H,exports.PhysicsConstraintMassTimeline=Q,exports.PhysicsConstraintMixTimeline=et,exports.PhysicsConstraintResetTimeline=st,exports.PhysicsConstraintStrengthTimeline=J,exports.PhysicsConstraintTimeline=j,exports.PhysicsConstraintWindTimeline=Z,exports.PointAttachment=Xt,exports.Pool=h,exports.Pow=o,exports.PowOut=class extends o{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},exports.RGB2Timeline=D,exports.RGBA2Timeline=V,exports.RGBATimeline=P,exports.RGBTimeline=X,exports.RegionAttachment=_t,exports.RotateTimeline=v,exports.SETUP=pt,exports.SUBSEQUENT=lt,exports.ScaleTimeline=B,exports.ScaleXTimeline=T,exports.ScaleYTimeline=C,exports.SequenceTimeline=rt,exports.ShearTimeline=F,exports.ShearXTimeline=E,exports.ShearYTimeline=Y,exports.Skeleton=Kt,exports.SkeletonBinary=ie,exports.SkeletonBounds=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new h((()=>l.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,r=this.polygons,i=this.polygonPool,n=t.slots,a=n.length;s.length=0,i.freeAll(r),r.length=0;for(let t=0;t<a;t++){let e=n[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof gt){let t=a;s.push(t);let n=i.obtain();n.length!=t.worldVerticesLength&&(n=l.newFloatArray(t.worldVerticesLength)),r.push(n),t.computeWorldVertices(e,0,t.worldVerticesLength,n,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,r=Number.NEGATIVE_INFINITY,i=this.polygons;for(let n=0,a=i.length;n<a;n++){let a=i[n],o=a;for(let i=0,n=a.length;i<n;i+=2){let n=o[i],a=o[i+1];t=Math.min(t,n),e=Math.min(e,a),s=Math.max(s,n),r=Math.max(r,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let i=this.minX,n=this.minY,a=this.maxX,o=this.maxY;if(t<=i&&s<=i||e<=n&&r<=n||t>=a&&s>=a||e>=o&&r>=o)return!1;let l=(r-e)/(s-t),h=l*(i-t)+e;if(h>n&&h<o)return!0;if(h=l*(a-t)+e,h>n&&h<o)return!0;let c=(n-e)/l+t;return c>i&&c<a||(c=(o-e)/l+t,c>i&&c<a)}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 r=0,i=s.length;r<i;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,i=t.length,n=i-2,a=!1;for(let t=0;t<i;t+=2){let i=r[t+1],o=r[n+1];if(i<s&&o>=s||o<s&&i>=s){let l=r[t];l+(s-i)/(o-i)*(r[n]-l)<e&&(a=!a)}n=t}return a}intersectsSegment(t,e,s,r){let i=this.polygons;for(let n=0,a=i.length;n<a;n++)if(this.intersectsSegmentPolygon(i[n],t,e,s,r))return this.boundingBoxes[n];return null}intersectsSegmentPolygon(t,e,s,r,i){let n=t,a=t.length,o=e-r,l=s-i,h=e*i-s*r,c=n[a-2],d=n[a-1];for(let t=0;t<a;t+=2){let a=n[t],u=n[t+1],p=c*u-d*a,m=c-a,f=d-u,g=o*f-l*m,x=(h*m-o*p)/g;if((x>=c&&x<=a||x>=a&&x<=c)&&(x>=e&&x<=r||x>=r&&x<=e)){let t=(h*f-l*p)/g;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=i||t>=i&&t<=s))return!0}c=a,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},exports.SkeletonClipping=We,exports.SkeletonData=Zt,exports.SkeletonDataResource=Ss,exports.SkeletonJson=ze,exports.Skin=ee,exports.SkinEntry=te,exports.Slot=Ht,exports.SlotData=se,exports.SpineAnimationRenderer=bs,exports.StringSet=r,exports.Texture=wt,exports.TextureAtlas=Ct,exports.TextureAtlasPage=Et,exports.TextureAtlasRegion=Yt,exports.TextureRegion=Tt,exports.TimeKeeper=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)}},exports.Timeline=b,exports.TrackEntry=nt,exports.TransformConstraint=Jt,exports.TransformConstraintData=re,exports.TransformConstraintTimeline=W,exports.TranslateTimeline=k,exports.TranslateXTimeline=I,exports.TranslateYTimeline=A,exports.Triangulator=Ue,exports.Utils=l,exports.Vector2=c,exports.VertexAttachment=u,exports.WindowedMean=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}},exports.createTextureAtlas=es,exports.version=As;
2
2
  //# sourceMappingURL=main.js.map