@eva/plugin-renderer-spine 2.0.0-beta.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("pixi.js"),e=require("@eva/spine-base"),s=Object.defineProperty,n=(t,e,n)=>(((t,e,n)=>{e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n);if("undefined"!=typeof window&&window.PIXI){const t=window.require;window.require=e=>t?t(e):e.startsWith("@pixi/")||e.startsWith("pixi.js")?window.PIXI:void 0}var r=class{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,n=t.length;s<n;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},a=class{constructor(t=0,e=0,s=0,n=0){this.r=t,this.g=e,this.b=s,this.a=n}set(t,e,s,n){return this.r=t,this.g=e,this.b=s,this.a=n,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,n){return this.r+=t,this.g+=e,this.b+=s,this.a+=n,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 a).setFromString(t)}},i=a;n(i,"WHITE",new a(1,1,1,1)),n(i,"RED",new a(1,0,0,1)),n(i,"GREEN",new a(0,1,0,1)),n(i,"BLUE",new a(0,0,1,1)),n(i,"MAGENTA",new a(1,0,1,1));var o=class{static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*o.degRad)}static sinDeg(t){return Math.sin(t*o.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*o.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 o.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let n=Math.random(),r=e-t;return n<=(s-t)/r?t+Math.sqrt(n*r*(s-t)):e-Math.sqrt((1-n)*r*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}},l=o;n(l,"PI",3.1415927),n(l,"PI2",2*o.PI),n(l,"invPI2",1/o.PI2),n(l,"radiansToDegrees",180/o.PI),n(l,"radDeg",o.radiansToDegrees),n(l,"degreesToRadians",o.PI/180),n(l,"degRad",o.degreesToRadians);var h=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},c=class extends h{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}},d=class{static arrayCopy(t,e,s,n,r){for(let a=e,i=n;a<e+r;a++,i++)s[i]=t[a]}static arrayFill(t,e,s,n){for(let r=e;r<s;r++)t[r]=n}static setArraySize(t,e,s=0){let n=t.length;if(n==e)return t;if(t.length=e,n<e)for(let r=n;r<e;r++)t[r]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:d.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let n=0;n<t;n++)s[n]=e;return s}static newFloatArray(t){if(d.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(d.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 d.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return d.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}},u=d;n(u,"SUPPORTS_TYPED_ARRAYS","undefined"!=typeof Float32Array);var m=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},f=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}},g=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},p=class extends g{id=p.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,e,s,n,r,a){s=r+(s>>1)*a;let i=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let i=t.bone,h=i.worldX,c=i.worldY,d=i.a,u=i.b,m=i.c,f=i.d;for(let t=e,i=r;i<s;t+=2,i+=a){let e=l[t],s=l[t+1];n[i]=e*d+s*u+h,n[i+1]=e*m+s*f+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=i.bones;if(0==o.length)for(let t=r,e=3*d;t<s;t+=a){let s=0,r=0,a=h[c++];for(a+=c;c<a;c++,e+=3){let t=u[h[c]],n=l[e],a=l[e+1],i=l[e+2];s+=(n*t.a+a*t.b+t.worldX)*i,r+=(n*t.c+a*t.d+t.worldY)*i}n[t]=s,n[t+1]=r}else{let t=o;for(let e=r,i=3*d,o=d<<1;e<s;e+=a){let s=0,r=0,a=h[c++];for(a+=c;c<a;c++,i+=3,o+=2){let e=u[h[c]],n=l[i]+t[o],a=l[i+1]+t[o+1],d=l[i+2];s+=(n*e.a+a*e.b+e.worldX)*d,r+=(n*e.c+a*e.d+e.worldY)*d}n[e]=s,n[e+1]=r}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),u.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=u.newFloatArray(this.vertices.length),u.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},x=p;n(x,"nextID",0);var w=class{id=w.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new w(this.regions.length);return u.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 n=this.regions[s];e.region!=n&&(e.region=n,e.updateRegion())}getPath(t,e){let s=t,n=(this.start+e).toString();for(let t=this.digits-n.length;t>0;t--)s+="0";return s+=n,s}static nextID(){return w._nextID++}},b=w;n(b,"_nextID",0);var y=(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))(y||{}),k=[0,1,2,3,4,5,6],v=class{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,n,r,a,i,o){if(!t)throw new Error("skeleton cannot be null.");n&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let n=0,h=l.length;n<h;n++)l[n].apply(t,e,s,r,a,i,o)}},C=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(C||{}),S=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(S||{}),A={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},T=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=u.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 n=1;n<s;n++)if(t[n]>e)return n-1;return s-1}static search(t,e,s){let n=t.length;for(let r=s;r<n;r+=s)if(t[r]>e)return r-s;return n-s}},I=class extends T{curves;constructor(t,e,s){super(t,s),this.curves=u.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=u.newFloatArray(e);u.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,n,r,a,i,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(n-2*a+o),f=.03*(r-2*i+l),g=.006*(3*(a-o)-n+h),p=.006*(3*(i-l)-r+c),x=2*m+g,w=2*f+p,b=.3*(a-n)+m+.16666667*g,y=.3*(i-r)+f+.16666667*p,k=n+b,v=r+y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=g,w+=p,k+=b,v+=y}getBezierValue(t,e,s,n){let r=this.curves;if(r[n]>t){let a=this.frames[e],i=this.frames[e+s];return i+(t-a)/(r[n]-a)*(r[n+1]-i)}let a=n+18;for(n+=2;n<a;n+=2)if(r[n]>=t){let e=r[n-2],s=r[n-1];return s+(t-e)/(r[n]-e)*(r[n+1]-s)}e+=this.getFrameEntries();let i=r[a-2],o=r[a-1];return o+(t-i)/(this.frames[e]-i)*(this.frames[e+s]-o)}},M=class extends I{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 n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}let n=this.curves[s>>1];switch(n){case 0:let n=e[s],r=e[s+1];return r+(t-n)/(e[s+2]-n)*(e[s+2+1]-r);case 1:return e[s+1]}return this.getBezierValue(t,s,1,n-2)}getRelativeValue(t,e,s,n,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return n+(r-n)*e}return n}let a=this.getCurveValue(t);switch(s){case 0:return r+a*e;case 1:case 2:a+=r-n}return n+a*e}getAbsoluteValue(t,e,s,n,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return n+(r-n)*e}return n}let a=this.getCurveValue(t);return 0==s?r+(a-r)*e:n+(a-n)*e}getAbsoluteValue2(t,e,s,n,r,a){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return n+(r-n)*e}return n}return 0==s?r+(a-r)*e:n+(a-n)*e}getScaleValue(t,e,s,n,r,a){if(t<this.frames[0]){switch(s){case 0:return a;case 1:return r+(a-r)*e}return r}let i=this.getCurveValue(t)*a;if(1==e)return 3==s?r+i-a:i;if(1==n)switch(s){case 0:return a+(Math.abs(i)*l.signum(a)-a)*e;case 1:case 2:return r+(Math.abs(i)*l.signum(r)-r)*e}else{let t=0;switch(s){case 0:return t=Math.abs(a)*l.signum(i),t+(i-t)*e;case 1:case 2:return t=Math.abs(r)*l.signum(i),t+(i-t)*e}}return r+(i-a)*e}},F=class extends I{constructor(t,e,s,n){super(t,e,[s,n])}getFrameEntries(){return 3}setFrame(t,e,s,n){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n}},Y=class extends M{boneIndex=0;constructor(t,e,s){super(t,e,A.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,n,r,a,i){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,r,a,o.rotation,o.data.rotation))}},X=class extends F{boneIndex=0;constructor(t,e,s){super(t,e,A.x+"|"+s,A.y+"|"+s),this.boneIndex=s}apply(t,e,s,n,r,a,i){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(a){case 0:return o.x=o.data.x,void(o.y=o.data.y);case 1:o.x+=(o.data.x-o.x)*r,o.y+=(o.data.y-o.y)*r}return}let h=0,c=0,d=T.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(a){case 0:o.x=o.data.x+h*r,o.y=o.data.y+c*r;break;case 1:case 2:o.x+=(o.data.x+h-o.x)*r,o.y+=(o.data.y+c-o.y)*r;break;case 3:o.x+=h*r,o.y+=c*r}}},P=class extends M{boneIndex=0;constructor(t,e,s){super(t,e,A.x+"|"+s),this.boneIndex=s}apply(t,e,s,n,r,a,i){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,r,a,o.x,o.data.x))}},B=class extends M{boneIndex=0;constructor(t,e,s){super(t,e,A.y+"|"+s),this.boneIndex=s}apply(t,e,s,n,r,a,i){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,r,a,o.y,o.data.y))}},R=class extends F{boneIndex=0;constructor(t,e,s){super(t,e,A.scaleX+"|"+s,A.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,n,r,a,i){let o=t.bones[this.boneIndex];if(!o.active)return;let h,c,d=this.frames;if(s<d[0]){switch(a){case 0:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case 1:o.scaleX+=(o.data.scaleX-o.scaleX)*r,o.scaleY+=(o.data.scaleY-o.scaleY)*r}return}let u=T.search(d,s,3),m=this.curves[u/3];switch(m){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,m-2),c=this.getBezierValue(s,u,2,m+18-2)}if(h*=o.data.scaleX,c*=o.data.scaleY,1==r)3==a?(o.scaleX+=h-o.data.scaleX,o.scaleY+=c-o.data.scaleY):(o.scaleX=h,o.scaleY=c);else{let t=0,e=0;if(1==i)switch(a){case 0:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(h)*l.signum(t)-t)*r,o.scaleY=e+(Math.abs(c)*l.signum(e)-e)*r;break;case 1:case 2:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(h)*l.signum(t)-t)*r,o.scaleY=e+(Math.abs(c)*l.signum(e)-e)*r;break;case 3:o.scaleX+=(h-o.data.scaleX)*r,o.scaleY+=(c-o.data.scaleY)*r}else switch(a){case 0:t=Math.abs(o.data.scaleX)*l.signum(h),e=Math.abs(o.data.scaleY)*l.signum(c),o.scaleX=t+(h-t)*r,o.scaleY=e+(c-e)*r;break;case 1:case 2:t=Math.abs(o.scaleX)*l.signum(h),e=Math.abs(o.scaleY)*l.signum(c),o.scaleX=t+(h-t)*r,o.scaleY=e+(c-e)*r;break;case 3:o.scaleX+=(h-o.data.scaleX)*r,o.scaleY+=(c-o.data.scaleY)*r}}}},E=class extends M{boneIndex=0;constructor(t,e,s){super(t,e,A.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,n,r,a,i){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,r,a,i,o.scaleX,o.data.scaleX))}},D=class extends M{boneIndex=0;constructor(t,e,s){super(t,e,A.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,n,r,a,i){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,r,a,i,o.scaleY,o.data.scaleY))}},V=class extends F{boneIndex=0;constructor(t,e,s){super(t,e,A.shearX+"|"+s,A.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,n,r,a,i){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(a){case 0:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case 1:o.shearX+=(o.data.shearX-o.shearX)*r,o.shearY+=(o.data.shearY-o.shearY)*r}return}let h=0,c=0,d=T.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(a){case 0:o.shearX=o.data.shearX+h*r,o.shearY=o.data.shearY+c*r;break;case 1:case 2:o.shearX+=(o.data.shearX+h-o.shearX)*r,o.shearY+=(o.data.shearY+c-o.shearY)*r;break;case 3:o.shearX+=h*r,o.shearY+=c*r}}},L=class extends M{boneIndex=0;constructor(t,e,s){super(t,e,A.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,n,r,a,i){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,r,a,o.shearX,o.data.shearX))}},O=class extends M{boneIndex=0;constructor(t,e,s){super(t,e,A.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,n,r,a,i){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,r,a,o.shearY,o.data.shearY))}},_=class extends T{boneIndex=0;constructor(t,e){super(t,[A.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,n,r,a,i){let o=t.bones[this.boneIndex];if(!o.active)return;if(1==i)return void(0==a&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?0!=a&&1!=a||(o.inherit=o.data.inherit):o.inherit=this.frames[T.search(l,s,2)+1]}},U=class extends I{slotIndex=0;constructor(t,e,s){super(t,e,[A.rgb+"|"+s,A.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,n,r,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=r,this.frames[t+4]=a}apply(t,e,s,n,r,a,i){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(a){case 0:return void h.setFromColor(t);case 1:h.add((t.r-h.r)*r,(t.g-h.g)*r,(t.b-h.b)*r,(t.a-h.a)*r)}return}let c=0,d=0,u=0,m=0,f=T.search(l,s,5),g=this.curves[f/5];switch(g){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];let e=(s-t)/(l[f+5]-t);c+=(l[f+5+1]-c)*e,d+=(l[f+5+2]-d)*e,u+=(l[f+5+3]-u)*e,m+=(l[f+5+4]-m)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];break;default:c=this.getBezierValue(s,f,1,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+36-2),m=this.getBezierValue(s,f,4,g+54-2)}1==r?h.set(c,d,u,m):(0==a&&h.setFromColor(o.data.color),h.add((c-h.r)*r,(d-h.g)*r,(u-h.b)*r,(m-h.a)*r))}},N=class extends I{slotIndex=0;constructor(t,e,s){super(t,e,[A.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,n,r){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=r}apply(t,e,s,n,r,a,i){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(a){case 0:return h.r=t.r,h.g=t.g,void(h.b=t.b);case 1:h.r+=(t.r-h.r)*r,h.g+=(t.g-h.g)*r,h.b+=(t.b-h.b)*r}return}let c=0,d=0,u=0,m=T.search(l,s,4),f=this.curves[m>>2];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3];let e=(s-t)/(l[m+4]-t);c+=(l[m+4+1]-c)*e,d+=(l[m+4+2]-d)*e,u+=(l[m+4+3]-u)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(1==r)h.r=c,h.g=d,h.b=u;else{if(0==a){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*r,h.g+=(d-h.g)*r,h.b+=(u-h.b)*r}}},q=class extends M{slotIndex=0;constructor(t,e,s){super(t,e,A.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,n,r,a,i){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(a){case 0:return void(l.a=t.a);case 1:l.a+=(t.a-l.a)*r}return}let h=this.getCurveValue(s);1==r?l.a=h:(0==a&&(l.a=o.data.color.a),l.a+=(h-l.a)*r)}},W=class extends I{slotIndex=0;constructor(t,e,s){super(t,e,[A.rgb+"|"+s,A.alpha+"|"+s,A.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,n,r,a,i,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=r,this.frames[t+4]=a,this.frames[t+5]=i,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,n,r,a,i){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(a){case 0:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case 1:h.add((t.r-h.r)*r,(t.g-h.g)*r,(t.b-h.b)*r,(t.a-h.a)*r),c.r+=(e.r-c.r)*r,c.g+=(e.g-c.g)*r,c.b+=(e.b-c.b)*r}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=0,w=T.search(l,s,8),b=this.curves[w>>3];switch(b){case 0:let t=l[w];d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],g=l[w+5],p=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,m+=(l[w+8+3]-m)*e,f+=(l[w+8+4]-f)*e,g+=(l[w+8+5]-g)*e,p+=(l[w+8+6]-p)*e,x+=(l[w+8+7]-x)*e;break;case 1:d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],g=l[w+5],p=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,b-2),u=this.getBezierValue(s,w,2,b+18-2),m=this.getBezierValue(s,w,3,b+36-2),f=this.getBezierValue(s,w,4,b+54-2),g=this.getBezierValue(s,w,5,b+72-2),p=this.getBezierValue(s,w,6,b+90-2),x=this.getBezierValue(s,w,7,b+108-2)}if(1==r)h.set(d,u,m,f),c.r=g,c.g=p,c.b=x;else{if(0==a){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)*r,(u-h.g)*r,(m-h.b)*r,(f-h.a)*r),c.r+=(g-c.r)*r,c.g+=(p-c.g)*r,c.b+=(x-c.b)*r}}},z=class extends I{slotIndex=0;constructor(t,e,s){super(t,e,[A.rgb+"|"+s,A.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,n,r,a,i,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=r,this.frames[t+4]=a,this.frames[t+5]=i,this.frames[t+6]=o}apply(t,e,s,n,r,a,i){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(a){case 0: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 1:h.r+=(t.r-h.r)*r,h.g+=(t.g-h.g)*r,h.b+=(t.b-h.b)*r,c.r+=(e.r-c.r)*r,c.g+=(e.g-c.g)*r,c.b+=(e.b-c.b)*r}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=T.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],m=l[x+3],f=l[x+4],g=l[x+5],p=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,m+=(l[x+7+3]-m)*e,f+=(l[x+7+4]-f)*e,g+=(l[x+7+5]-g)*e,p+=(l[x+7+6]-p)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),m=this.getBezierValue(s,x,3,w+36-2),f=this.getBezierValue(s,x,4,w+54-2),g=this.getBezierValue(s,x,5,w+72-2),p=this.getBezierValue(s,x,6,w+90-2)}if(1==r)h.r=d,h.g=u,h.b=m,c.r=f,c.g=g,c.b=p;else{if(0==a){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)*r,h.g+=(u-h.g)*r,h.b+=(m-h.b)*r,c.r+=(f-c.r)*r,c.g+=(g-c.g)*r,c.b+=(p-c.b)*r}}},G=class extends T{slotIndex=0;attachmentNames;constructor(t,e){super(t,[A.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,n,r,a,i){let o=t.slots[this.slotIndex];o.bone.active&&(1!=i?s<this.frames[0]?0!=a&&1!=a||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[T.search1(this.frames,s)]):0==a&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},$=class extends I{slotIndex=0;attachment;vertices;constructor(t,e,s,n){super(t,e,[A.deform+"|"+s+"|"+n.id]),this.slotIndex=s,this.attachment=n,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,n,r,a,i,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(n-2*a+o),f=.03*l-.06*i,g=.006*(3*(a-o)-n+h),p=.018*(i-l+.33333333),x=2*m+g,w=2*f+p,b=.3*(a-n)+m+.16666667*g,y=.3*i+f+.16666667*p,k=n+b,v=y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,b+=x,y+=w,x+=g,w+=p,k+=b,v+=y}getCurvePercent(t,e){let s=this.curves,n=s[e];switch(n){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(n-=2,s[n]>t){let r=this.frames[e];return s[n+1]*(t-r)/(s[n]-r)}let r=n+18;for(n+=2;n<r;n+=2)if(s[n]>=t){let e=s[n-2],r=s[n-1];return r+(t-e)/(s[n]-e)*(s[n+1]-r)}let a=s[r-2],i=s[r-1];return i+(1-i)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,n,r,a,i){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof x)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(a=0);let c=this.vertices,d=c[0].length,m=this.frames;if(s<m[0]){switch(a){case 0:return void(h.length=0);case 1:if(1==r)return void(h.length=0);h.length=d;let t=l;if(t.bones){r=1-r;for(f=0;f<d;f++)h[f]*=r}else{let e=t.vertices;for(var f=0;f<d;f++)h[f]+=(e[f]-h[f])*r}}return}if(h.length=d,s>=m[m.length-1]){let t=c[m.length-1];if(1==r)if(3==a){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else u.arrayCopy(t,0,h,0,d);else switch(a){case 0:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*r;else{let s=e.vertices;for(let e=0;e<d;e++){let n=s[e];h[e]=n+(t[e]-n)*r}}break}case 1:case 2:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*r;break;case 3:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*r;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*r}}return}let g=T.search1(m,s),p=this.getCurvePercent(s,g),w=c[g],b=c[g+1];if(1==r)if(3==a){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=w[t];h[t]+=e+(b[t]-e)*p}else{let e=t.vertices;for(let t=0;t<d;t++){let s=w[t];h[t]+=s+(b[t]-s)*p-e[t]}}}else for(let t=0;t<d;t++){let e=w[t];h[t]=e+(b[t]-e)*p}else switch(a){case 0:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=w[t];h[t]=(e+(b[t]-e)*p)*r}else{let e=t.vertices;for(let t=0;t<d;t++){let s=w[t],n=e[t];h[t]=n+(s+(b[t]-s)*p-n)*r}}break}case 1:case 2:for(let t=0;t<d;t++){let e=w[t];h[t]+=(e+(b[t]-e)*p-h[t])*r}break;case 3:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=w[t];h[t]+=(e+(b[t]-e)*p)*r}else{let e=t.vertices;for(let t=0;t<d;t++){let s=w[t];h[t]+=(s+(b[t]-s)*p-e[t])*r}}}}},j=class extends T{events;constructor(t){super(t,j.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,n,r,a,i){if(!n)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,n,r,a,i),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=T.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)n.push(this.events[h])}},H=j;n(H,"propertyIds",[""+A.event]);var J=class extends T{drawOrders;constructor(t){super(t,J.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,n,r,a,i){if(1==i)return void(0==a&&u.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(0!=a&&1!=a||u.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=T.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,n=l.length;t<n;t++)e[t]=s[l[t]]}else u.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}},K=J;n(K,"propertyIds",[""+A.drawOrder]);var Q=class extends I{constraintIndex=0;constructor(t,e,s){super(t,e,[A.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,r,a,i){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=r,this.frames[t+4]=a?1:0,this.frames[t+5]=i?1:0}apply(t,e,s,n,r,a,i){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(a){case 0: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 1:o.mix+=(o.data.mix-o.mix)*r,o.softness+=(o.data.softness-o.softness)*r,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=T.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)}0==a?(o.mix=o.data.mix+(h-o.data.mix)*r,o.softness=o.data.softness+(c-o.data.softness)*r,1==i?(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)*r,o.softness+=(c-o.softness)*r,0==i&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}},Z=class extends I{constraintIndex=0;constructor(t,e,s){super(t,e,[A.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,n,r,a,i,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=n,l[t+3]=r,l[t+4]=a,l[t+5]=i,l[t+6]=o}apply(t,e,s,n,r,a,i){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,m,f=this.frames;if(s<f[0]){let t=o.data;switch(a){case 0: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 1:o.mixRotate+=(t.mixRotate-o.mixRotate)*r,o.mixX+=(t.mixX-o.mixX)*r,o.mixY+=(t.mixY-o.mixY)*r,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*r,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*r,o.mixShearY+=(t.mixShearY-o.mixShearY)*r}return}let g=T.search(f,s,7),p=this.curves[g/7];switch(p){case 0:let t=f[g];l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];let e=(s-t)/(f[g+7]-t);l+=(f[g+7+1]-l)*e,h+=(f[g+7+2]-h)*e,c+=(f[g+7+3]-c)*e,d+=(f[g+7+4]-d)*e,u+=(f[g+7+5]-u)*e,m+=(f[g+7+6]-m)*e;break;case 1:l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),h=this.getBezierValue(s,g,2,p+18-2),c=this.getBezierValue(s,g,3,p+36-2),d=this.getBezierValue(s,g,4,p+54-2),u=this.getBezierValue(s,g,5,p+72-2),m=this.getBezierValue(s,g,6,p+90-2)}if(0==a){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*r,o.mixX=t.mixX+(h-t.mixX)*r,o.mixY=t.mixY+(c-t.mixY)*r,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*r,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*r,o.mixShearY=t.mixShearY+(m-t.mixShearY)*r}else o.mixRotate+=(l-o.mixRotate)*r,o.mixX+=(h-o.mixX)*r,o.mixY+=(c-o.mixY)*r,o.mixScaleX+=(d-o.mixScaleX)*r,o.mixScaleY+=(u-o.mixScaleY)*r,o.mixShearY+=(m-o.mixShearY)*r}},tt=class extends M{constraintIndex=0;constructor(t,e,s){super(t,e,A.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,n,r,a,i){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,r,a,o.position,o.data.position))}},et=class extends M{constraintIndex=0;constructor(t,e,s){super(t,e,A.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,n,r,a,i){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,r,a,o.spacing,o.data.spacing))}},st=class extends I{constraintIndex=0;constructor(t,e,s){super(t,e,[A.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,n,r){let a=this.frames;a[t<<=2]=e,a[t+1]=s,a[t+2]=n,a[t+3]=r}apply(t,e,s,n,r,a,i){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(a){case 0:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case 1:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*r,o.mixX+=(o.data.mixX-o.mixX)*r,o.mixY+=(o.data.mixY-o.mixY)*r}return}let u=T.search(d,s,4),m=this.curves[u>>2];switch(m){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,m-2),h=this.getBezierValue(s,u,2,m+18-2),c=this.getBezierValue(s,u,3,m+36-2)}if(0==a){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*r,o.mixX=t.mixX+(h-t.mixX)*r,o.mixY=t.mixY+(c-t.mixY)*r}else o.mixRotate+=(l-o.mixRotate)*r,o.mixX+=(h-o.mixX)*r,o.mixY+=(c-o.mixY)*r}},nt=class extends M{constraintIndex=0;constructor(t,e,s,n){super(t,e,n+"|"+s),this.constraintIndex=s}apply(t,e,s,n,r,a,i){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const n of t.physicsConstraints)n.active&&this.global(n.data)&&this.set(n,this.getAbsoluteValue2(s,r,a,this.get(n),this.setup(n),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,r,a,this.get(o),this.setup(o)))}},rt=class extends nt{constructor(t,e,s){super(t,e,s,A.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},at=class extends nt{constructor(t,e,s){super(t,e,s,A.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},it=class extends nt{constructor(t,e,s){super(t,e,s,A.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ot=class extends nt{constructor(t,e,s){super(t,e,s,A.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}},lt=class extends nt{constructor(t,e,s){super(t,e,s,A.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},ht=class extends nt{constructor(t,e,s){super(t,e,s,A.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},ct=class extends nt{constructor(t,e,s){super(t,e,s,A.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},dt=class extends T{constraintIndex;constructor(t,e){super(t,dt.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,n,r,a,i){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,[],r,a,i),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[T.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}},ut=dt;n(ut,"propertyIds",[A.physicsConstraintReset.toString()]);var mt=class extends T{slotIndex;attachment;constructor(t,e,s){super(t,[A.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return mt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,n,r){let a=this.frames;a[t*=mt.ENTRIES]=e,a[t+mt.MODE]=s|n<<4,a[t+mt.DELAY]=r}apply(t,e,s,n,r,a,i){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof x&&l.timelineAttachment==h))return;if(1==i)return void(0==a&&(o.sequenceIndex=-1));let c=this.frames;if(s<c[0])return void(0!=a&&1!=a||(o.sequenceIndex=-1));let d=T.search(c,s,mt.ENTRIES),u=c[d],m=c[d+mt.MODE],f=c[d+mt.DELAY];if(!this.attachment.sequence)return;let g=m>>4,p=this.attachment.sequence.regions.length,w=k[15&m];if(0!=w)switch(g+=(s-u)/f+1e-5|0,w){case 1:g=Math.min(p-1,g);break;case 2:g%=p;break;case 3:{let t=(p<<1)-2;g=0==t?0:g%t,g>=p&&(g=t-g);break}case 4:g=Math.max(p-1-g,0);break;case 5:g=p-1-g%p;break;case 6:{let t=(p<<1)-2;g=0==t?0:(g+p-1)%t,g>=p&&(g=t-g)}}o.sequenceIndex=g}},ft=mt;n(ft,"ENTRIES",3),n(ft,"MODE",1),n(ft,"DELAY",2);var gt=class{static emptyAnimation(){return gt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new wt(this);propertyIDs=new r;animationsChanged=!1;trackEntryPool=new m((()=>new xt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let r=t*n.timeScale;if(n.delay>0){if(n.delay-=r,n.delay>0)continue;r=-n.delay,n.delay=0}let a=n.next;if(a){let e=n.trackLast-a.delay;if(e>=0){for(a.delay=0,a.trackTime+=0==n.timeScale?0:(e/n.timeScale+t)*a.timeScale,n.trackTime+=r,this.setCurrent(s,a,!0);a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){e[s]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,t)){let t=n.mixingFrom;for(n.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}n.trackTime+=r}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let n=this.updateMixingFrom(s,e);if(s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,-1!=t.nextTrackLast){const e=0==t.mixTime&&0==s.mixTime;if(t.mixTime>=t.mixDuration||e)return(0==s.totalAlpha||0==t.mixDuration||e)&&(t.mixingFrom=s.mixingFrom,null!=s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),n}return 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,n=!1;for(let a=0,i=s.length;a<i;a++){let i=s[a];if(!i||i.delay>0)continue;n=!0;let o=0==a?1:i.mixBlend,l=i.alpha;i.mixingFrom?l*=this.applyMixingFrom(i,t,o):i.trackTime>=i.trackEnd&&!i.next&&(l=0);let h=l>=i.alphaAttachmentThreshold,c=i.animationLast,d=i.getAnimationTime(),m=d,f=e;i.reverse&&(m=i.animation.duration-m,f=null);let g=i.animation.timelines,p=g.length;if(0==a&&1==l||3==o){0==a&&(h=!0);for(let e=0;e<p;e++){u.webkit602BugfixHelper(l,o);var r=g[e];r instanceof G?this.applyAttachmentTimeline(r,t,m,o,h):r.apply(t,c,m,f,l,o,0)}}else{let e=i.timelineMode,s=i.shortestRotation,n=!s&&i.timelinesRotation.length!=p<<1;n&&(i.timelinesRotation.length=p<<1);for(let r=0;r<p;r++){let a=g[r],d=e[r]==yt?o:0;!s&&a instanceof Y?this.applyRotateTimeline(a,t,m,l,d,i.timelinesRotation,r<<1,n):a instanceof G?this.applyAttachmentTimeline(a,t,m,o,h):(u.webkit602BugfixHelper(l,o),a.apply(t,c,m,f,l,d,0))}}this.queueEvents(i,d),e.length=0,i.nextAnimationLast=d,i.nextTrackLast=i.trackTime}for(var a=this.unkeyedState+At,i=t.slots,o=0,l=t.slots.length;o<l;o++){var h=i[o];if(h.attachmentState==a){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(t,e,s){let n=t.mixingFrom;n.mixingFrom&&this.applyMixingFrom(n,e,s);let r=0;0==t.mixDuration?(r=1,1==s&&(s=0)):(r=t.mixTime/t.mixDuration,r>1&&(r=1),1!=s&&(s=n.mixBlend));let a=r<n.mixAttachmentThreshold,i=r<n.mixDrawOrderThreshold,o=n.animation.timelines,l=o.length,h=n.alpha*t.interruptAlpha,c=h*(1-r),d=n.animationLast,m=n.getAnimationTime(),f=m,g=null;if(n.reverse?f=n.animation.duration-f:r<n.eventThreshold&&(g=this.events),3==s)for(let t=0;t<l;t++)o[t].apply(e,d,f,g,c,s,1);else{let t=n.timelineMode,r=n.timelineHoldMix,m=n.shortestRotation,p=!m&&n.timelinesRotation.length!=l<<1;p&&(n.timelinesRotation.length=l<<1),n.totalAlpha=0;for(let x=0;x<l;x++){let l,w=o[x],b=1,y=0;switch(t[x]){case yt:if(!i&&w instanceof K)continue;l=s,y=c;break;case kt:l=0,y=c;break;case vt:l=s,y=h;break;case Ct:l=0,y=h;break;default:l=0;let t=r[x];y=h*Math.max(0,1-t.mixTime/t.mixDuration)}n.totalAlpha+=y,!m&&w instanceof Y?this.applyRotateTimeline(w,e,f,y,l,n.timelinesRotation,x<<1,p):w instanceof G?this.applyAttachmentTimeline(w,e,f,l,a&&y>=n.alphaAttachmentThreshold):(u.webkit602BugfixHelper(y,s),i&&w instanceof K&&0==l&&(b=0),w.apply(e,d,f,g,y,l,b))}}return t.mixDuration>0&&this.queueEvents(n,m),this.events.length=0,n.nextAnimationLast=m,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(t,e,s,n,r){var a=e.slots[t.slotIndex];a.bone.active&&(s<t.frames[0]?0!=n&&1!=n||this.setAttachment(e,a,a.data.attachmentName,r):this.setAttachment(e,a,t.attachmentNames[T.search1(t.frames,s)],r),a.attachmentState<=this.unkeyedState&&(a.attachmentState=this.unkeyedState+At))}setAttachment(t,e,s,n){e.setAttachment(s?t.getAttachment(e.data.index,s):null),n&&(e.attachmentState=this.unkeyedState+Tt)}applyRotateTimeline(t,e,s,n,r,a,i,o){if(o&&(a[i]=0),1==n)return void t.apply(e,0,s,null,1,r,0);let h=e.bones[t.boneIndex];if(!h.active)return;let c=0,d=0;if(s<t.frames[0])switch(r){case 0:h.rotation=h.data.rotation;default:return;case 1:c=h.rotation,d=h.data.rotation}else c=0==r?h.data.rotation:h.rotation,d=h.data.rotation+t.getCurveValue(s);let u=0,m=d-c;if(m-=360*Math.ceil(m/360-.5),0==m)u=a[i];else{let t=0,e=0;o?(t=0,e=m):(t=a[i],e=a[i+1]);let s=t-t%360;u=m+s;let n=m>=0,r=t>=0;Math.abs(e)<=90&&l.signum(e)!=l.signum(m)&&(Math.abs(t-s)>180?(u+=360*l.signum(t),r=n):0!=s?u-=360*l.signum(t):r=n),r!=n&&(u+=360*l.signum(t)),a[i]=u}a[i+1]=m,h.rotation=c+u*n}queueEvents(t,e){let s=t.animationStart,n=t.animationEnd,r=n-s,a=t.trackLast%r,i=this.events,o=0,l=i.length;for(;o<l;o++){let e=i[o];if(e.time<a)break;e.time>n||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==r)h=!0;else{const e=Math.floor(t.trackTime/r);h=e>0&&e>Math.floor(t.trackLast/r)}else h=e>=n&&t.animationLast<n;for(h&&this.queue.complete(t);o<l;o++){let e=i[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 n=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,n&&(s&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let n=!0,r=this.expandToIndex(t);r&&(-1==r.nextTrackLast?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,n=!1):this.clearNext(r));let a=this.trackEntry(t,e,s,r);return this.setCurrent(t,a,n),this.queue.drain(),a}addAnimation(t,e,s=!1,n=0){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,r,s,n)}addAnimationWith(t,e,s=!1,n=0){if(!e)throw new Error("animation cannot be null.");let r=this.expandToIndex(t);if(r)for(;r.next;)r=r.next;let a=this.trackEntry(t,e,s,r);return r?(r.next=a,a.previous=r,n<=0&&(n+=r.getTrackComplete()-a.mixDuration)):(this.setCurrent(t,a,!0),this.queue.drain()),a.delay=n,a}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,gt.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let n=this.addAnimationWith(t,gt.emptyAnimation(),!1,s);return s<=0&&(n.delay+=n.mixDuration-e),n.mixDuration=e,n.trackEnd=e,n}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]:(u.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,n){let r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=t,r.animation=e,r.loop=s,r.holdPrevious=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=e.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=n?this.data.getMix(n.animation,e):0,r.interruptAlpha=1,r.totalAlpha=0,r.mixBlend=2,r}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&&3==s.mixBlend||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,n=t.animation.timelines.length,r=t.timelineMode;r.length=n;let a=t.timelineHoldMix;a.length=0;let i=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<n;t++)r[t]=i.addAll(s[t].getPropertyIds())?Ct:vt;else t:for(let o=0;o<n;o++){let n=s[o],l=n.getPropertyIds();if(i.addAll(l))if(!e||n instanceof G||n instanceof K||n instanceof H||!e.animation.hasTimeline(l))r[o]=kt;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){r[o]=St,a[o]=s;continue t}break}r[o]=Ct}else r[o]=yt}}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()}},pt=gt;n(pt,"_emptyAnimation",new v("<empty>",[],0));var xt=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 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}},wt=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(bt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(bt.interrupt),this.objects.push(t)}end(t){this.objects.push(bt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(bt.dispose),this.objects.push(t)}complete(t){this.objects.push(bt.complete),this.objects.push(t)}event(t,e){this.objects.push(bt.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 n=t[s],r=t[s+1];switch(n){case bt.start:r.listener&&r.listener.start&&r.listener.start(r);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(r)}break;case bt.interrupt:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(r)}break;case bt.end:r.listener&&r.listener.end&&r.listener.end(r);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(r)}case bt.dispose:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(r)}this.animState.trackEntryPool.free(r);break;case bt.complete:r.listener&&r.listener.complete&&r.listener.complete(r);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(r)}break;case bt.event:let n=t[2+s++];r.listener&&r.listener.event&&r.listener.event(r,n);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(r,n)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},bt=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(bt||{}),yt=0,kt=1,vt=2,Ct=3,St=4,At=1,Tt=2,It=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let n=this.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);this.setMixWith(n,r,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let n=t.name+"."+e.name;this.animationToMixTime[n]=s}getMix(t,e){let s=t.name+"."+e.name,n=this.animationToMixTime[s];return void 0===n?this.defaultMix:n}},Mt=class extends x{color=new i(1,1,1,1);constructor(t){super(t)}copy(){let t=new Mt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Ft=class extends x{endSlot=null;color=new i(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Ft(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Yt=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Xt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(Xt||{}),Pt=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(Pt||{}),Bt=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Rt=class{pages=new Array;regions=new Array;constructor(t){let e=new Et(t),s=new Array(4),n={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=u.enumValue(Xt,s[1]),t.magFilter=u.enumValue(Xt,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=10497),-1!=s[1].indexOf("y")&&(t.vWrap=10497)},pma:t=>{t.pma="true"==s[1]}};var r={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 a=e.readLine();for(;a&&0==a.trim().length;)a=e.readLine();for(;a&&0!=a.trim().length&&0!=e.readEntry(s,a);)a=e.readLine();let i=null,o=null,l=null;for(;null!==a;)if(0==a.trim().length)i=null,a=e.readLine();else if(i){let t=new Vt(i,a);for(;;){let n=e.readEntry(s,a=e.readLine());if(0==n)break;let i=r[s[0]];if(i)i(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<n;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=null),t.u=t.x/i.width,t.v=t.y/i.height,90==t.degrees?(t.u2=(t.x+t.height)/i.width,t.v2=(t.y+t.width)/i.height):(t.u2=(t.x+t.width)/i.width,t.v2=(t.y+t.height)/i.height),this.regions.push(t)}else{for(i=new Dt(a.trim());0!=e.readEntry(s,a=e.readLine());){let t=n[s[0]];t&&t(i)}this.pages.push(i)}}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()}},Et=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)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 n=1,r=s+1;;n++){let s=e.indexOf(",",r);if(-1==s)return t[n]=e.substr(r).trim(),n;if(t[n]=e.substr(r,s-r).trim(),r=s+1,4==n)return 4}}},Dt=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},Vt=class 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)}},Lt=class extends x{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=u.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,n=this.region.u,r=this.region.v,a=0,i=0;if(this.region instanceof Vt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:n-=(o.originalHeight-o.offsetY-o.height)/h,r-=(o.originalWidth-o.offsetX-o.width)/c,a=o.originalHeight/h,i=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=n+t[o+1]*a,e[o+1]=r+(1-t[o])*i;return;case 180:n-=(o.originalWidth-o.offsetX-o.width)/h,r-=o.offsetY/c,a=o.originalWidth/h,i=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=n+(1-t[o])*a,e[o+1]=r+(1-t[o+1])*i;return;case 270:n-=o.offsetY/h,r-=o.offsetX/c,a=o.originalHeight/h,i=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=n+(1-t[o+1])*a,e[o+1]=r+t[o]*i;return}n-=o.offsetX/h,r-=(o.originalHeight-o.offsetY-o.height)/c,a=o.originalWidth/h,i=o.originalHeight/c}else this.region?(a=this.region.u2-n,i=this.region.v2-r):(n=r=0,a=i=1);for(let o=0;o<s;o+=2)e[o]=n+t[o]*a,e[o+1]=r+t[o+1]*i}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 Lt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),u.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),u.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),u.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),u.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,n,r,a){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,n,r,a)}newLinkedMesh(){let t=new Lt(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}},Ot=class extends x{lengths=[];closed=!1;constantSpeed=!1;color=new i(1,1,1,1);constructor(t){super(t)}copy(){let t=new Ot(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),u.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},_t=class extends x{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*l.degRad,s=Math.cos(e),n=Math.sin(e),r=s*t.a+n*t.b,a=s*t.c+n*t.d;return l.atan2Deg(a,r)}copy(){let t=new _t(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},Ut=class extends g{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=u.newFloatArray(8);uvs=u.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,n=this.height/this.region.originalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.region.offsetX*s,a=-this.height/2*this.scaleY+this.region.offsetY*n,i=r+this.region.width*s,o=a+this.region.height*n,h=this.rotation*l.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,m=this.y,f=r*c+u,g=r*d,p=a*c+m,x=a*d,w=i*c+u,b=i*d,y=o*c+m,k=o*d,v=this.offset;v[0]=f-x,v[1]=p+g,v[2]=f-k,v[3]=y+g,v[4]=w-k,v[5]=y+b,v[6]=w-x,v[7]=p+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,n){null!=this.sequence&&this.sequence.apply(t,this);let r=t.bone,a=this.offset,i=r.worldX,o=r.worldY,l=r.a,h=r.b,c=r.c,d=r.d,u=0,m=0;u=a[0],m=a[1],e[s]=u*l+m*h+i,e[s+1]=u*c+m*d+o,s+=n,u=a[2],m=a[3],e[s]=u*l+m*h+i,e[s+1]=u*c+m*d+o,s+=n,u=a[4],m=a[5],e[s]=u*l+m*h+i,e[s+1]=u*c+m*d+o,s+=n,u=a[6],m=a[7],e[s]=u*l+m*h+i,e[s+1]=u*c+m*d+o}copy(){let t=new Ut(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,u.arrayCopy(this.uvs,0,t.uvs,0,8),u.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}},Nt=Ut;n(Nt,"X1",0),n(Nt,"Y1",1),n(Nt,"C1R",2),n(Nt,"C1G",3),n(Nt,"C1B",4),n(Nt,"C1A",5),n(Nt,"U1",6),n(Nt,"V1",7),n(Nt,"X2",8),n(Nt,"Y2",9),n(Nt,"C2R",10),n(Nt,"C2G",11),n(Nt,"C2B",12),n(Nt,"C2A",13),n(Nt,"U2",14),n(Nt,"V2",15),n(Nt,"X3",16),n(Nt,"Y3",17),n(Nt,"C3R",18),n(Nt,"C3G",19),n(Nt,"C3B",20),n(Nt,"C3A",21),n(Nt,"U3",22),n(Nt,"V3",23),n(Nt,"X4",24),n(Nt,"Y4",25),n(Nt,"C4R",26),n(Nt,"C4G",27),n(Nt,"C4B",28),n(Nt,"C4A",29),n(Nt,"U4",30),n(Nt,"V4",31);var qt=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let n=s.regions;for(let r=0,a=n.length;r<a;r++){let a=s.getPath(e,r),i=this.atlas.findRegion(a);if(null==i)throw new Error("Region not found in atlas: "+a+" (sequence: "+t+")");n[r]=i}}newRegionAttachment(t,e,s,n){let r=new Nt(e,s);if(null!=n)this.loadSequence(e,s,n);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");r.region=t}return r}newMeshAttachment(t,e,s,n){let r=new Lt(e,s);if(null!=n)this.loadSequence(e,s,n);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");r.region=t}return r}newBoundingBoxAttachment(t,e){return new Mt(e)}newPathAttachment(t,e){return new Ot(e)}newPointAttachment(t,e){return new _t(e)}newClippingAttachment(t,e){return new Ft(e)}},Wt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=zt.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}},zt=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(zt||{}),Gt=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,n,r,a,i){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=n,this.ascaleY=r,this.ashearX=a,this.ashearY=i;let o=this.parent;if(!o){let o=this.skeleton;const h=o.scaleX,c=o.scaleY,d=(s+a)*l.degRad,u=(s+90+i)*l.degRad;return this.a=Math.cos(d)*n*h,this.b=Math.cos(u)*r*h,this.c=Math.sin(d)*n*c,this.d=Math.sin(u)*r*c,this.worldX=t*h+o.x,void(this.worldY=e*c+o.y)}let h=o.a,c=o.b,d=o.c,u=o.d;switch(this.worldX=h*t+c*e+o.worldX,this.worldY=d*t+u*e+o.worldY,this.inherit){case 0:{const t=(s+a)*l.degRad,e=(s+90+i)*l.degRad,o=Math.cos(t)*n,m=Math.cos(e)*r,f=Math.sin(t)*n,g=Math.sin(e)*r;return this.a=h*o+c*f,this.b=h*m+c*g,this.c=d*o+u*f,void(this.d=d*m+u*g)}case 1:{const t=(s+a)*l.degRad,e=(s+90+i)*l.degRad;this.a=Math.cos(t)*n,this.b=Math.cos(e)*r,this.c=Math.sin(t)*n,this.d=Math.sin(e)*r;break}case 2:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;h*=t,d*=e;let o=h*h+d*d,m=0;o>1e-4?(o=Math.abs(h*u*e-c*t*d)/o,c=d*o,u=h*o,m=Math.atan2(d,h)*l.radDeg):(h=0,d=0,m=90-Math.atan2(u,c)*l.radDeg);const f=(s+a-m)*l.degRad,g=(s+i-m+90)*l.degRad,p=Math.cos(f)*n,x=Math.cos(g)*r,w=Math.sin(f)*n,b=Math.sin(g)*r;this.a=h*p-c*w,this.b=h*x-c*b,this.c=d*p+u*w,this.d=d*x+u*b;break}case 3:case 4:{s*=l.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(h*t+c*e)/this.skeleton.scaleX,m=(d*t+u*e)/this.skeleton.scaleY,f=Math.sqrt(o*o+m*m);f>1e-5&&(f=1/f),o*=f,m*=f,f=Math.sqrt(o*o+m*m),3==this.inherit&&h*u-c*d<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(f=-f),s=Math.PI/2+Math.atan2(m,o);const g=Math.cos(s)*f,p=Math.sin(s)*f;a*=l.degRad,i=(90+i)*l.degRad;const x=Math.cos(a)*n,w=Math.cos(i)*r,b=Math.sin(a)*n,y=Math.sin(i)*r;this.a=o*x+g*b,this.b=o*w+g*y,this.c=m*x+p*b,this.d=m*w+p*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)*l.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)*l.radDeg);let e,s,n,r,a=t.a,i=t.b,o=t.c,h=t.d,c=1/(a*h-i*o),d=h*c,u=i*c,m=o*c,f=a*c,g=this.worldX-t.worldX,p=this.worldY-t.worldY;if(this.ax=g*d-p*u,this.ay=p*f-g*m,1==this.inherit)e=this.a,s=this.b,n=this.c,r=this.d;else{switch(this.inherit){case 2:{let t=Math.abs(a*h-i*o)/(a*a+o*o);i=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,h=a*this.skeleton.scaleY*t/this.skeleton.scaleX,c=1/(a*h-i*o),d=h*c,u=i*c;break}case 3:case 4:let t=l.cosDeg(this.rotation),e=l.sinDeg(this.rotation);a=(a*t+i*e)/this.skeleton.scaleX,o=(o*t+h*e)/this.skeleton.scaleY;let s=Math.sqrt(a*a+o*o);s>1e-5&&(s=1/s),a*=s,o*=s,s=Math.sqrt(a*a+o*o),3==this.inherit&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let n=l.PI/2+Math.atan2(o,a);i=Math.cos(n)*s,h=Math.sin(n)*s,c=1/(a*h-i*o),d=h*c,u=i*c,m=o*c,f=a*c}e=d*this.a-u*this.c,s=d*this.b-u*this.d,n=f*this.c-m*this.a,r=f*this.d-m*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+n*n),this.ascaleX>1e-4){let t=e*r-s*n;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+n*r,t)*l.radDeg,this.arotation=Math.atan2(n,e)*l.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+r*r),this.ashearY=0,this.arotation=90-Math.atan2(r,s)*l.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*l.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*l.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,n=t.y-this.worldY;return t.x=s*this.d*e-n*this.b*e,t.y=n*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=l.sinDeg(t),s=l.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*l.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=l.sinDeg(t),s=l.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*l.radDeg}rotateWorld(t){t*=l.degRad;const e=Math.sin(t),s=Math.cos(t),n=this.a,r=this.b;this.a=s*n-e*this.c,this.b=s*r-e*this.d,this.c=e*n+s*this.c,this.d=e*r+s*this.d}},$t=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},jt=class{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,n=new Uint8Array(s),r=0;r<s;r++)n[r]=e.charCodeAt(r);return n}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 n=new XMLHttpRequest;n.overrideMimeType("text/html"),n.open("GET",t,!0);let r=()=>{this.finish(t,n.status,n.responseText)};n.onload=r,n.onerror=r,n.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 n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer";let r=()=>{this.finish(t,n.status,n.response)};n.onload=()=>{200==n.status||0==n.status?this.finish(t,200,new Uint8Array(n.response)):r()},n.onerror=r,n.send()}start(t,e,s){let n=this.callbacks[t];try{if(n)return!0;this.callbacks[t]=n=[]}finally{n.push(e,s)}}finish(t,e,s){let n=this.callbacks[t];delete this.callbacks[t];let r=200==e||0==e?[s]:[e,s];for(let t=r.length-1,e=n.length;t<e;t+=2)n[t].apply(null,r)}},Ht=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},Jt=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},Kt=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let n=e.findBone(t.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(n)}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,n,r,a,i){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let h=o.a,c=o.b,d=o.c,u=o.d,m=-t.ashearX-t.arotation,f=0,g=0;switch(t.inherit){case 1:f=(e-t.worldX)*l.signum(t.skeleton.scaleX),g=(s-t.worldY)*l.signum(t.skeleton.scaleY);break;case 2:let n=Math.abs(h*u-c*d)/Math.max(1e-4,h*h+d*d),r=h/t.skeleton.scaleX,a=d/t.skeleton.scaleY;c=-a*n*t.skeleton.scaleX,u=r*n*t.skeleton.scaleY,m+=Math.atan2(a,r)*l.radDeg;default:let i=e-o.worldX,p=s-o.worldY,x=h*u-c*d;Math.abs(x)<=1e-4?(f=0,g=0):(f=(i*u-p*c)/x-t.ax,g=(p*h-i*d)/x-t.ay)}m+=Math.atan2(g,f)*l.radDeg,t.ascaleX<0&&(m+=180),m>180?m-=360:m<-180&&(m+=360);let p=t.ascaleX,x=t.ascaleY;if(n||r){switch(t.inherit){case 3:case 4:f=e-t.worldX,g=s-t.worldY}const o=t.data.length*p;if(o>1e-4){const t=f*f+g*g;if(n&&t<o*o||r&&t>o*o){const e=(Math.sqrt(t)/o-1)*i+1;p*=e,a&&(x*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*i,p,x,t.ashearX,t.ashearY)}apply2(t,e,s,n,r,a,i,o,h){if(0!=t.inherit||0!=e.inherit)return;let c=t.ax,d=t.ay,u=t.ascaleX,m=t.ascaleY,f=u,g=m,p=e.ascaleX,x=0,w=0,b=0;u<0?(u=-u,x=180,b=-1):(x=0,b=1),m<0&&(m=-m,b=-b),p<0?(p=-p,w=180):w=0;let y=e.ax,k=0,v=0,C=0,S=t.a,A=t.b,T=t.c,I=t.d,M=Math.abs(u-m)<=1e-4;!M||a?(k=0,v=S*y+t.worldX,C=T*y+t.worldY):(k=e.ay,v=S*y+A*k+t.worldX,C=T*y+I*k+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,A=F.b,T=F.c,I=F.d;let Y=S*I-A*T,X=v-F.worldX,P=C-F.worldY;Y=Math.abs(Y)<=1e-4?0:1/Y;let B,R,E=(X*I-P*A)*Y-c,D=(P*S-X*T)*Y-d,V=Math.sqrt(E*E+D*D),L=e.data.length*p;if(V<1e-4)return this.apply1(t,s,n,!1,a,!1,h),void e.updateWorldTransformWith(y,k,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);X=s-F.worldX,P=n-F.worldY;let O=(X*I-P*A)*Y-c,_=(P*S-X*T)*Y-d,U=O*O+_*_;if(0!=o){o*=u*(p+1)*.5;let t=Math.sqrt(U),e=t-V-L*u+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,O-=s*O,_-=s*_,U=O*O+_*_}}t:if(M){L*=u;let t=(U-V*V-L*L)/(2*V*L);t<-1?(t=-1,R=Math.PI*r):t>1?(t=1,R=0,a&&(S=(Math.sqrt(U)/(V+L)-1)*h+1,f*=S,i&&(g*=S))):R=Math.acos(t)*r,S=V+L*t,A=L*Math.sin(R),B=Math.atan2(_*S-O*A,O*S+_*A)}else{S=u*L,A=m*L;let t=S*S,e=A*A,s=Math.atan2(_,O);T=e*V*V+t*U-t*e;let n=-2*e*V,a=e-t;if(I=n*n-4*a*T,I>=0){let t=Math.sqrt(I);n<0&&(t=-t),t=.5*-(n+t);let e=t/a,i=T/t,o=Math.abs(e)<Math.abs(i)?e:i;if(e=U-o*o,e>=0){P=Math.sqrt(e)*r,B=s-Math.atan2(P,o),R=Math.atan2(P/m,(o-V)/u);break t}}let i=l.PI,o=V-S,h=o*o,c=0,d=0,f=V+S,g=f*f,p=0;T=-S*V/(t-e),T>=-1&&T<=1&&(T=Math.acos(T),X=S*Math.cos(T)+V,P=A*Math.sin(T),I=X*X+P*P,I<h&&(i=T,h=I,o=X,c=P),I>g&&(d=T,g=I,f=X,p=P)),U<=.5*(h+g)?(B=s-Math.atan2(c*r,o),R=i*r):(B=s-Math.atan2(p*r,f),R=d*r)}let N=Math.atan2(k,y)*b,q=t.arotation;B=(B-N)*l.radDeg+x-q,B>180?B-=360:B<-180&&(B+=360),t.updateWorldTransformWith(c,d,q+B*h,f,g,0,0),q=e.arotation,R=((R+N)*l.radDeg-e.ashearX)*b+w-q,R>180?R-=360:R<-180&&(R+=360),e.updateWorldTransformWith(y,k,q+R*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},Qt=class extends $t{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)}},Zt=class extends $t{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=te.Fixed;spacingMode=ee.Fixed;rotateMode=se.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},te=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(te||{}),ee=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(ee||{}),se=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(se||{}),ne=class{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,n=t.bones.length;s<n;s++){let n=e.findBone(t.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(n)}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 Ot))return;let s=this.mixRotate,n=this.mixX,r=this.mixY;if(0==s&&0==n&&0==r)return;let a=this.data,i=0==a.rotateMode,o=2==a.rotateMode,h=this.bones,c=h.length,d=i?c:c+1,m=u.setArraySize(this.spaces,d),f=o?this.lengths=u.setArraySize(this.lengths,c):[],g=this.spacing;switch(a.spacingMode){case 2:if(o)for(let t=0,e=d-1;t<e;t++){let e=h[t],s=e.data.length,n=s*e.a,r=s*e.c;f[t]=Math.sqrt(n*n+r*r)}u.arrayFill(m,1,d,g);break;case 3:let t=0;for(let e=0,s=d-1;e<s;){let s=h[e],n=s.data.length;if(n<ne.epsilon)o&&(f[e]=0),m[++e]=g;else{let r=n*s.a,a=n*s.c,i=Math.sqrt(r*r+a*a);o&&(f[e]=i),m[++e]=i,t+=i}}if(t>0){t=d/t*g;for(let e=1;e<d;e++)m[e]*=t}break;default:let e=0==a.spacingMode;for(let t=0,s=d-1;t<s;){let s=h[t],n=s.data.length;if(n<ne.epsilon)o&&(f[t]=0),m[++t]=g;else{let r=n*s.a,a=n*s.c,i=Math.sqrt(r*r+a*a);o&&(f[t]=i),m[++t]=(e?n+g:g)*i/n}}}let p=this.computeWorldPositions(e,d,i),x=p[0],w=p[1],b=a.offsetRotation,y=!1;if(0==b)y=1==a.rotateMode;else{y=!1;let t=this.target.bone;b*=t.a*t.d-t.b*t.c>0?l.degRad:-l.degRad}for(let t=0,e=3;t<c;t++,e+=3){let a=h[t];a.worldX+=(x-a.worldX)*n,a.worldY+=(w-a.worldY)*r;let c=p[e],d=p[e+1],u=c-x,g=d-w;if(o){let e=f[t];if(0!=e){let t=(Math.sqrt(u*u+g*g)/e-1)*s+1;a.a*=t,a.c*=t}}if(x=c,w=d,s>0){let n=a.a,r=a.b,o=a.c,h=a.d,c=0,d=0,f=0;if(c=i?p[e-1]:0==m[t+1]?p[e+2]:Math.atan2(g,u),c-=Math.atan2(o,n),y){d=Math.cos(c),f=Math.sin(c);let t=a.data.length;x+=(t*(d*n-f*o)-u)*s,w+=(t*(f*n+d*o)-g)*s}else c+=b;c>l.PI?c-=l.PI2:c<-l.PI&&(c+=l.PI2),c*=s,d=Math.cos(c),f=Math.sin(c),a.a=d*n-f*o,a.b=d*r-f*h,a.c=f*n+d*o,a.d=f*r+d*h}a.updateAppliedTransform()}}computeWorldPositions(t,e,s){let n=this.target,r=this.position,a=this.spaces,i=u.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=ne.NONE;if(!t.constantSpeed){let m=t.lengths;c-=l?1:2;let f,g=m[c];switch(1==this.data.positionMode&&(r*=g),this.data.spacingMode){case 2:f=g;break;case 3:f=g/e;break;default:f=1}o=u.setArraySize(this.world,8);for(let u=0,p=0,x=0;u<e;u++,p+=3){let e=a[u]*f;r+=e;let w=r;if(l)w%=g,w<0&&(w+=g),x=0;else{if(w<0){d!=ne.BEFORE&&(d=ne.BEFORE,t.computeWorldVertices(n,2,4,o,0,2)),this.addBeforePosition(w,o,0,i,p);continue}if(w>g){d!=ne.AFTER&&(d=ne.AFTER,t.computeWorldVertices(n,h-6,4,o,0,2)),this.addAfterPosition(w-g,o,0,i,p);continue}}for(;;x++){let t=m[x];if(!(w>t)){if(0==x)w/=t;else{let e=m[x-1];w=(w-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(n,h-4,4,o,0,2),t.computeWorldVertices(n,0,4,o,4,2)):t.computeWorldVertices(n,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],i,p,s||u>0&&0==e)}return i}l?(h+=2,o=u.setArraySize(this.world,h),t.computeWorldVertices(n,2,h-4,o,0,2),t.computeWorldVertices(n,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=u.setArraySize(this.world,h),t.computeWorldVertices(n,2,h,o,0,2));let m,f=u.setArraySize(this.curves,c),g=0,p=o[0],x=o[1],w=0,b=0,y=0,k=0,v=0,C=0,S=0,A=0,T=0,I=0,M=0,F=0,Y=0,X=0;for(let t=0,e=2;t<c;t++,e+=6)w=o[e],b=o[e+1],y=o[e+2],k=o[e+3],v=o[e+4],C=o[e+5],S=.1875*(p-2*w+y),A=.1875*(x-2*b+k),T=.09375*(3*(w-y)-p+v),I=.09375*(3*(b-k)-x+C),M=2*S+T,F=2*A+I,Y=.75*(w-p)+S+.16666667*T,X=.75*(b-x)+A+.16666667*I,g+=Math.sqrt(Y*Y+X*X),Y+=M,X+=F,M+=T,F+=I,g+=Math.sqrt(Y*Y+X*X),Y+=M,X+=F,g+=Math.sqrt(Y*Y+X*X),Y+=M+T,X+=F+I,g+=Math.sqrt(Y*Y+X*X),f[t]=g,p=v,x=C;switch(1==this.data.positionMode&&(r*=g),this.data.spacingMode){case 2:m=g;break;case 3:m=g/e;break;default:m=1}let P=this.segments,B=0;for(let t=0,n=0,c=0,u=0;t<e;t++,n+=3){let e=a[t]*m;r+=e;let R=r;if(l)R%=g,R<0&&(R+=g),c=0;else{if(R<0){this.addBeforePosition(R,o,0,i,n);continue}if(R>g){this.addAfterPosition(R-g,o,h-4,i,n);continue}}for(;;c++){let t=f[c];if(!(R>t)){if(0==c)R/=t;else{let e=f[c-1];R=(R-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(p=o[t],x=o[t+1],w=o[t+2],b=o[t+3],y=o[t+4],k=o[t+5],v=o[t+6],C=o[t+7],S=.03*(p-2*w+y),A=.03*(x-2*b+k),T=.006*(3*(w-y)-p+v),I=.006*(3*(b-k)-x+C),M=2*S+T,F=2*A+I,Y=.3*(w-p)+S+.16666667*T,X=.3*(b-x)+A+.16666667*I,B=Math.sqrt(Y*Y+X*X),P[0]=B,t=1;t<8;t++)Y+=M,X+=F,M+=T,F+=I,B+=Math.sqrt(Y*Y+X*X),P[t]=B;Y+=M,X+=F,B+=Math.sqrt(Y*Y+X*X),P[8]=B,Y+=M+T,X+=F+I,B+=Math.sqrt(Y*Y+X*X),P[9]=B,u=0}for(R*=B;;u++){let t=P[u];if(!(R>t)){if(0==u)R/=t;else{let e=P[u-1];R=u+(R-e)/(t-e)}break}}this.addCurvePosition(.1*R,p,x,w,b,y,k,v,C,i,n,s||t>0&&0==e)}return i}addBeforePosition(t,e,s,n,r){let a=e[s],i=e[s+1],o=e[s+2]-a,l=e[s+3]-i,h=Math.atan2(l,o);n[r]=a+t*Math.cos(h),n[r+1]=i+t*Math.sin(h),n[r+2]=h}addAfterPosition(t,e,s,n,r){let a=e[s+2],i=e[s+3],o=a-e[s],l=i-e[s+1],h=Math.atan2(l,o);n[r]=a+t*Math.cos(h),n[r+1]=i+t*Math.sin(h),n[r+2]=h}addCurvePosition(t,e,s,n,r,a,i,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(r-s,n-e));let u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,w=3*x,b=f*w,y=w*t,k=e*p+n*b+a*y+o*m,v=s*p+r*b+i*y+l*m;h[c]=k,h[c+1]=v,d&&(h[c+2]=t<.001?Math.atan2(r-s,n-e):Math.atan2(v-(s*g+r*x*2+i*u),k-(e*g+n*x*2+a*u)))}},re=ne;n(re,"NONE",-1),n(re,"BEFORE",-2),n(re,"AFTER",-3),n(re,"epsilon",1e-5);var ae=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,n=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,a=this.data.scaleX>0,i=this.bone,o=i.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const t=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=t.time;const c=i.worldX,d=i.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let u=this.remaining,m=this.inertia,f=this.data.step,g=this.skeleton.data.referenceScale,p=-1,x=this.data.limit*h,w=x*Math.abs(t.scaleY);if(x*=Math.abs(t.scaleX),s||n){if(s){const t=(this.ux-c)*m;this.xOffset+=t>x?x:t<-x?-x:t,this.ux=c}if(n){const t=(this.uy-d)*m;this.yOffset+=t>w?w:t<-w?-w:t,this.uy=d}if(u>=f){p=Math.pow(this.damping,60*f);const t=this.massInverse*f,e=this.strength,r=this.wind*g,a=(he.yDown?-this.gravity:this.gravity)*g;do{s&&(this.xVelocity+=(r-this.xOffset*e)*t,this.xOffset+=this.xVelocity*f,this.xVelocity*=p),n&&(this.yVelocity-=(a+this.yOffset*e)*t,this.yOffset+=this.yVelocity*f,this.yVelocity*=p),u-=f}while(u>=f)}s&&(i.worldX+=this.xOffset*e*this.data.x),n&&(i.worldY+=this.yOffset*e*this.data.y)}if(r||a){let t=Math.atan2(i.c,i.a),s=0,n=0,h=0,c=this.cx-i.worldX,d=this.cy-i.worldY;if(c>x?c=x:c<-x&&(c=-x),d>w?d=w:d<-w&&(d=-w),r){h=(this.data.rotate+this.data.shearX)*e;let r=Math.atan2(d+this.ty,c+this.tx)-t-this.rotateOffset*h;this.rotateOffset+=(r-Math.ceil(r*l.invPI2-.5)*l.PI2)*m,r=this.rotateOffset*h+t,s=Math.cos(r),n=Math.sin(r),a&&(r=o*i.getWorldScaleX(),r>0&&(this.scaleOffset+=(c*s+d*n)*m/r))}else{s=Math.cos(t),n=Math.sin(t);const e=o*i.getWorldScaleX();e>0&&(this.scaleOffset+=(c*s+d*n)*m/e)}if(u=this.remaining,u>=f){-1==p&&(p=Math.pow(this.damping,60*f));const e=this.massInverse*f,i=this.strength,l=this.wind,c=he.yDown?-this.gravity:this.gravity,d=o/g;for(;;)if(u-=f,a&&(this.scaleVelocity+=(l*s-c*n-this.scaleOffset*i)*e,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=p),r){if(this.rotateVelocity-=((l*n+c*s)*d+this.rotateOffset*i)*e,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=p,u<f)break;const r=this.rotateOffset*h+t;s=Math.cos(r),n=Math.sin(r)}else if(u<f)break}}this.remaining=u}this.cx=i.worldX,this.cy=i.worldY;break;case 3:s&&(i.worldX+=this.xOffset*e*this.data.x),n&&(i.worldY+=this.yOffset*e*this.data.y)}if(r){let t=this.rotateOffset*e,s=0,n=0,r=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),n=Math.cos(e),r=i.b,i.b=n*r-s*i.d,i.d=s*r+n*i.d),e+=t*this.data.shearX,s=Math.sin(e),n=Math.cos(e),r=i.a,i.a=n*r-s*i.c,i.c=s*r+n*i.c}else t*=this.data.rotate,s=Math.sin(t),n=Math.cos(t),r=i.a,i.a=n*r-s*i.c,i.c=s*r+n*i.c,r=i.b,i.b=n*r-s*i.d,i.d=s*r+n*i.d}if(a){const t=1+this.scaleOffset*e*this.data.scaleX;i.a*=t,i.c*=t}3!=t&&(this.tx=o*i.a,this.ty=o*i.c),i.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const n=s*l.degRad,r=Math.cos(n),a=Math.sin(n),i=this.cx-t,o=this.cy-e;this.translate(i*r-o*a-i,i*a+o*r-o)}},ie=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new 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 x&&this.attachment instanceof x&&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}},oe=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new f;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 n=e.findBone(t.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(n)}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,n=this.mixScaleX,r=this.mixScaleY,a=this.mixShearY,i=0!=e||0!=s,o=this.target,h=o.a,c=o.b,d=o.c,u=o.d,m=h*u-c*d>0?l.degRad:-l.degRad,f=this.data.offsetRotation*m,g=this.data.offsetShearY*m,p=this.bones;for(let m=0,x=p.length;m<x;m++){let x=p[m];if(0!=t){let e=x.a,s=x.b,n=x.c,r=x.d,a=Math.atan2(d,h)-Math.atan2(n,e)+f;a>l.PI?a-=l.PI2:a<-l.PI&&(a+=l.PI2),a*=t;let i=Math.cos(a),o=Math.sin(a);x.a=i*e-o*n,x.b=i*s-o*r,x.c=o*e+i*n,x.d=o*s+i*r}if(i){let t=this.temp;o.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!=n){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)*n)/t),x.a*=t,x.c*=t}if(0!=r){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)*r)/t),x.b*=t,x.d*=t}if(a>0){let t=x.b,e=x.d,s=Math.atan2(e,t),n=Math.atan2(u,c)-Math.atan2(d,h)-(s-Math.atan2(x.c,x.a));n>l.PI?n-=l.PI2:n<-l.PI&&(n+=l.PI2),n=s+(n+g)*a;let r=Math.sqrt(t*t+e*e);x.b=Math.cos(n)*r,x.d=Math.sin(n)*r}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,n=this.mixScaleX,r=this.mixScaleY,a=this.mixShearY,i=0!=e||0!=s,o=this.target,h=o.a,c=o.b,d=o.c,u=o.d,m=h*u-c*d>0?l.degRad:-l.degRad,f=this.data.offsetRotation*m,g=this.data.offsetShearY*m,p=this.bones;for(let m=0,x=p.length;m<x;m++){let x=p[m];if(0!=t){let e=x.a,s=x.b,n=x.c,r=x.d,a=Math.atan2(d,h)+f;a>l.PI?a-=l.PI2:a<-l.PI&&(a+=l.PI2),a*=t;let i=Math.cos(a),o=Math.sin(a);x.a=i*e-o*n,x.b=i*s-o*r,x.c=o*e+i*n,x.d=o*s+i*r}if(i){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=t.x*e,x.worldY+=t.y*s}if(0!=n){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleX)*n+1;x.a*=t,x.c*=t}if(0!=r){let t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleY)*r+1;x.b*=t,x.d*=t}if(a>0){let t=Math.atan2(u,c)-Math.atan2(d,h);t>l.PI?t-=l.PI2:t<-l.PI&&(t+=l.PI2);let e=x.b,s=x.d;t=Math.atan2(s,e)+(t-l.PI/2+g)*a;let n=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*n,x.d=Math.sin(t)*n}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,n=this.mixScaleX,r=this.mixScaleY,a=this.mixShearY,i=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+=(i.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(i.ax-d+this.data.offsetX)*e,u+=(i.ay-u+this.data.offsetY)*s;let m=h.ascaleX,f=h.ascaleY;0!=n&&0!=m&&(m=(m+(i.ascaleX-m+this.data.offsetScaleX)*n)/m),0!=r&&0!=f&&(f=(f+(i.ascaleY-f+this.data.offsetScaleY)*r)/f);let g=h.ashearY;0!=a&&(g+=(i.ashearY-g+this.data.offsetShearY)*a),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,n=this.mixScaleX,r=this.mixScaleY,a=this.mixShearY,i=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(i.arotation+this.data.offsetRotation)*t,d=h.ax+(i.ax+this.data.offsetX)*e,u=h.ay+(i.ay+this.data.offsetY)*s,m=h.ascaleX*((i.ascaleX-1+this.data.offsetScaleX)*n+1),f=h.ascaleY*((i.ascaleY-1+this.data.offsetScaleY)*r+1),g=h.ashearY+(i.ashearY+this.data.offsetShearY)*a;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}},le=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return le.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,n=t.bones[e];if(n.parent){let t=this.bones[n.parent.index];s=new Gt(n,this,t),t.children.push(s)}else s=new Gt(n,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],n=this.bones[s.boneData.index],r=new ie(s,n);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new Kt(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new oe(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new re(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new ae(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,n=this.pathConstraints,r=this.physicsConstraints,a=e.length,i=s.length,o=n.length,l=this.physicsConstraints.length,h=a+i+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<a;s++){let n=e[s];if(n.data.order==t){this.sortIkConstraint(n);continue t}}for(let e=0;e<i;e++){let n=s[e];if(n.data.order==t){this.sortTransformConstraint(n);continue t}}for(let e=0;e<o;e++){let s=n[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=r[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&&u.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,n=s[0];if(this.sortBone(n),1==s.length)this._updateCache.push(t),this.sortReset(n.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(n.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&u.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,n=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,n),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,n);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,n);let r=e.getAttachment();r instanceof Ot&&this.sortPathConstraintAttachmentWith(r,n);let a=t.bones,i=a.length;for(let t=0;t<i;t++)this.sortBone(a[t]);this._updateCache.push(t);for(let t=0;t<i;t++)this.sortReset(a[t].children);for(let t=0;t<i;t++)a[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&u.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 n=t.attachments[e];if(n)for(let t in n)this.sortPathConstraintAttachmentWith(n[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Ot))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,n=s.length;e<n;){let n=s[e++];for(n+=e;e<n;)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&&u.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,n=s.length;e<n;e++)s[e].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let s=this.bones;for(let t=1,e=s.length;t<e;t++){let e=s[t];e.ax=e.x,e.ay=e.y,e.arotation=e.rotation,e.ascaleX=e.scaleX,e.ascaleY=e.scaleY,e.ashearX=e.shearX,e.ashearY=e.shearY}let n=this.getRootBone();if(!n)throw new Error("Root bone must not be null.");let r=e.a,a=e.b,i=e.c,o=e.d;n.worldX=r*this.x+a*this.y+e.worldX,n.worldY=i*this.x+o*this.y+e.worldY;const h=(n.rotation+n.shearX)*l.degRad,c=(n.rotation+90+n.shearY)*l.degRad,d=Math.cos(h)*n.scaleX,u=Math.cos(c)*n.scaleY,m=Math.sin(h)*n.scaleX,f=Math.sin(c)*n.scaleY;n.a=(r*d+a*m)*this.scaleX,n.b=(r*u+a*f)*this.scaleX,n.c=(i*d+o*m)*this.scaleY,n.d=(i*u+o*f)*this.scaleY;let g=this._updateCache;for(let e=0,s=g.length;e<s;e++){let s=g[e];s!=n&&s.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;u.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,n=e.length;s<n;s++){let n=e[s];if(n.data.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.data.name==t)return n}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,n=e.length;s<n;s++){let n=e[s],r=n.data.attachmentName;if(r){let e=t.getAttachment(s,r);e&&n.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 n=0,r=s.length;n<r;n++){let r=s[n];if(r.data.name==t){let s=null;if(e&&(s=this.getAttachment(n,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void r.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 f,e=new f;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),n=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let r=this.drawOrder,a=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=r.length;t<e;t++){let e=r[t];if(!e.bone.active)continue;let h=0,c=null,d=null,m=e.getAttachment();if(m instanceof Nt)h=8,c=u.setArraySize(s,h,0),m.computeWorldVertices(e,c,0,2),d=le.quadTriangles;else if(m instanceof Lt){let t=m;h=t.worldVerticesLength,c=u.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(m instanceof Ft&&null!=n){n.clipStart(e,m);continue}if(c&&d){null!=n&&n.isClipping()&&(n.clipTriangles(c,d,d.length),c=n.clippedVertices,h=n.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];a=Math.min(a,e),i=Math.min(i,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=n&&n.clipEndWithSlot(e)}null!=n&&n.clipEnd(),t.set(a,i),e.set(o-a,l-i)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let n=0,r=s.length;n<r;n++)s[n].translate(t,e)}physicsRotate(t,e,s){const n=this.physicsConstraints;for(let r=0,a=n.length;r<a;r++)n[r].rotate(t,e,s)}},he=le;n(he,"quadTriangles",[0,1,2,2,3,0]),n(he,"yDown",!1);var ce=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(ce||{}),de=class extends $t{_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)}},ue=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.name==t)return n}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.name==t)return n}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,n=e.length;s<n;s++){let n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,n=e.length;s<n;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,n=e.length;s<n;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,n=e.length;s<n;s++){const n=e[s];if(n.name==t)return n}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,n=e.length;s<n;s++){const n=e[s];if(n.name==t)return n}return null}},me=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},fe=class{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 n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],n=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){n=!0;break}n||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],n=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){n=!0;break}n||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],n=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){n=!0;break}n||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],n=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){n=!0;break}n||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 Lt?(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 n in s){let r=s[n];r&&t.push(new me(e,n,r))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let n in s){let r=s[n];r&&e.push(new me(t,n,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let n=0;n<t.slots.length;n++){let r=t.slots[n],a=r.getAttachment();if(a&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(a==t[e]){let t=this.getAttachment(s,e);t&&r.setAttachment(t);break}}}s++}}},ge=class{index=0;name;boneData;color=new i(1,1,1,1);darkColor=null;attachmentName=null;blendMode=pe.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}},pe=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(pe||{}),xe=class extends $t{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)}},we=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new ue;s.name="";let n=new be(t),r=n.readInt32(),a=n.readInt32();s.hash=0==a&&0==r?null:a.toString(16)+r.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*e;let o=n.readBoolean();o&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let l=0;l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("String in string table must not be null.");n.strings.push(t)}l=n.readInt(!0);for(let t=0;t<l;t++){let r=n.readString();if(!r)throw new Error("Bone name must not be null.");let a=0==t?null:s.bones[n.readInt(!0)],l=new Wt(t,r,a);l.rotation=n.readFloat(),l.x=n.readFloat()*e,l.y=n.readFloat()*e,l.scaleX=n.readFloat(),l.scaleY=n.readFloat(),l.shearX=n.readFloat(),l.shearY=n.readFloat(),l.length=n.readFloat()*e,l.inherit=n.readByte(),l.skinRequired=n.readBoolean(),o&&(i.rgba8888ToColor(l.color,n.readInt32()),l.icon=n.readString()??void 0,l.visible=n.readBoolean()),s.bones.push(l)}l=n.readInt(!0);for(let t=0;t<l;t++){let e=n.readString();if(!e)throw new Error("Slot name must not be null.");let r=s.bones[n.readInt(!0)],a=new ge(t,e,r);i.rgba8888ToColor(a.color,n.readInt32());let l=n.readInt32();-1!=l&&i.rgb888ToColor(a.darkColor=new i,l),a.attachmentName=n.readStringRef(),a.blendMode=n.readInt(!0),o&&(a.visible=n.readBoolean()),s.slots.push(a)}l=n.readInt(!0);for(let t,r=0;r<l;r++){let r=n.readString();if(!r)throw new Error("IK constraint data name must not be null.");let a=new Qt(r);a.order=n.readInt(!0),t=n.readInt(!0);for(let e=0;e<t;e++)a.bones.push(s.bones[n.readInt(!0)]);a.target=s.bones[n.readInt(!0)];let i=n.readByte();a.skinRequired=!!(1&i),a.bendDirection=2&i?1:-1,a.compress=!!(4&i),a.stretch=!!(8&i),a.uniform=!!(16&i),32&i&&(a.mix=64&i?n.readFloat():1),128&i&&(a.softness=n.readFloat()*e),s.ikConstraints.push(a)}l=n.readInt(!0);for(let t,r=0;r<l;r++){let r=n.readString();if(!r)throw new Error("Transform constraint data name must not be null.");let a=new xe(r);a.order=n.readInt(!0),t=n.readInt(!0);for(let e=0;e<t;e++)a.bones.push(s.bones[n.readInt(!0)]);a.target=s.bones[n.readInt(!0)];let i=n.readByte();a.skinRequired=!!(1&i),a.local=!!(2&i),a.relative=!!(4&i),8&i&&(a.offsetRotation=n.readFloat()),16&i&&(a.offsetX=n.readFloat()*e),32&i&&(a.offsetY=n.readFloat()*e),64&i&&(a.offsetScaleX=n.readFloat()),128&i&&(a.offsetScaleY=n.readFloat()),i=n.readByte(),1&i&&(a.offsetShearY=n.readFloat()),2&i&&(a.mixRotate=n.readFloat()),4&i&&(a.mixX=n.readFloat()),8&i&&(a.mixY=n.readFloat()),16&i&&(a.mixScaleX=n.readFloat()),32&i&&(a.mixScaleY=n.readFloat()),64&i&&(a.mixShearY=n.readFloat()),s.transformConstraints.push(a)}l=n.readInt(!0);for(let t,r=0;r<l;r++){let r=n.readString();if(!r)throw new Error("Path constraint data name must not be null.");let a=new Zt(r);a.order=n.readInt(!0),a.skinRequired=n.readBoolean(),t=n.readInt(!0);for(let e=0;e<t;e++)a.bones.push(s.bones[n.readInt(!0)]);a.target=s.slots[n.readInt(!0)];const i=n.readByte();a.positionMode=1&i,a.spacingMode=i>>1&3,a.rotateMode=i>>3&3,128&i&&(a.offsetRotation=n.readFloat()),a.position=n.readFloat(),0==a.positionMode&&(a.position*=e),a.spacing=n.readFloat(),0!=a.spacingMode&&1!=a.spacingMode||(a.spacing*=e),a.mixRotate=n.readFloat(),a.mixX=n.readFloat(),a.mixY=n.readFloat(),s.pathConstraints.push(a)}l=n.readInt(!0);for(let t=0;t<l;t++){const t=n.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const r=new de(t);r.order=n.readInt(!0),r.bone=s.bones[n.readInt(!0)];let a=n.readByte();r.skinRequired=!!(1&a),2&a&&(r.x=n.readFloat()),4&a&&(r.y=n.readFloat()),8&a&&(r.rotate=n.readFloat()),16&a&&(r.scaleX=n.readFloat()),32&a&&(r.shearX=n.readFloat()),r.limit=(64&a?n.readFloat():5e3)*e,r.step=1/n.readUnsignedByte(),r.inertia=n.readFloat(),r.strength=n.readFloat(),r.damping=n.readFloat(),r.massInverse=128&a?n.readFloat():1,r.wind=n.readFloat(),r.gravity=n.readFloat(),a=n.readByte(),1&a&&(r.inertiaGlobal=!0),2&a&&(r.strengthGlobal=!0),4&a&&(r.dampingGlobal=!0),8&a&&(r.massGlobal=!0),16&a&&(r.windGlobal=!0),32&a&&(r.gravityGlobal=!0),64&a&&(r.mixGlobal=!0),r.mix=128&a?n.readFloat():1,s.physicsConstraints.push(r)}let h=this.readSkin(n,s,!0,o);h&&(s.defaultSkin=h,s.skins.push(h));{let t=s.skins.length;for(u.setArraySize(s.skins,l=t+n.readInt(!0));t<l;t++){let e=this.readSkin(n,s,!1,o);if(!e)throw new Error("readSkin() should not have returned null.");s.skins[t]=e}}l=this.linkedMeshes.length;for(let t=0;t<l;t++){let e=this.linkedMeshes[t];const n=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let r=n.getAttachment(e.slotIndex,e.parent);if(!r)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?r:e.mesh,e.mesh.setParentMesh(r),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("Event data name must not be null");let e=new Jt(t);e.intValue=n.readInt(!1),e.floatValue=n.readFloat(),e.stringValue=n.readString(),e.audioPath=n.readString(),e.audioPath&&(e.volume=n.readFloat(),e.balance=n.readFloat()),s.events.push(e)}l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(n,t,s))}return s}readSkin(t,e,s,n){let r=null,a=0;if(s){if(a=t.readInt(!0),0==a)return null;r=new fe("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");r=new fe(s),n&&i.rgba8888ToColor(r.color,t.readInt32()),r.bones.length=t.readInt(!0);for(let s=0,n=r.bones.length;s<n;s++)r.bones[s]=e.bones[t.readInt(!0)];for(let s=0,n=t.readInt(!0);s<n;s++)r.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,n=t.readInt(!0);s<n;s++)r.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,n=t.readInt(!0);s<n;s++)r.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,n=t.readInt(!0);s<n;s++)r.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 a=0,i=t.readInt(!0);a<i;a++){let a=t.readStringRef();if(!a)throw new Error("Attachment name must not be null");let i=this.readAttachment(t,e,r,s,a,n);i&&r.setAttachment(s,a,i)}}return r}readAttachment(t,e,s,n,r,a){let o=this.scale,l=t.readByte();const h=8&l?t.readStringRef():r;if(!h)throw new Error("Attachment name must not be null");switch(7&l){case ve.Region:{let e=16&l?t.readStringRef():null;const n=32&l?t.readInt32():4294967295,r=64&l?this.readSequence(t):null;let a=128&l?t.readFloat():0,c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat();e||(e=h);let p=this.attachmentLoader.newRegionAttachment(s,h,e,r);return p?(p.path=e,p.x=c*o,p.y=d*o,p.scaleX=u,p.scaleY=m,p.rotation=a,p.width=f*o,p.height=g*o,i.rgba8888ToColor(p.color,n),p.sequence=r,null==r&&p.updateRegion(),p):null}case ve.BoundingBox:{let e=this.readVertices(t,!!(16&l)),n=a?t.readInt32():0,r=this.attachmentLoader.newBoundingBoxAttachment(s,h);return r?(r.worldVerticesLength=e.length,r.vertices=e.vertices,r.bones=e.bones,a&&i.rgba8888ToColor(r.color,n),r):null}case ve.Mesh:{let e=16&l?t.readStringRef():h;const n=32&l?t.readInt32():4294967295,r=64&l?this.readSequence(t):null,c=t.readInt(!0),d=this.readVertices(t,!!(128&l)),u=this.readFloatArray(t,d.length,1),m=this.readShortArray(t,3*(d.length-c-2));let f=[],g=0,p=0;a&&(f=this.readShortArray(t,t.readInt(!0)),g=t.readFloat(),p=t.readFloat()),e||(e=h);let x=this.attachmentLoader.newMeshAttachment(s,h,e,r);return x?(x.path=e,i.rgba8888ToColor(x.color,n),x.bones=d.bones,x.vertices=d.vertices,x.worldVerticesLength=d.length,x.triangles=m,x.regionUVs=u,null==r&&x.updateRegion(),x.hullLength=c<<1,x.sequence=r,a&&(x.edges=f,x.width=g*o,x.height=p*o),x):null}case ve.LinkedMesh:{const e=16&l?t.readStringRef():h;if(null==e)throw new Error("Path of linked mesh must not be null");const r=32&l?t.readInt32():4294967295,c=64&l?this.readSequence(t):null,d=!!(128&l),u=t.readInt(!0),m=t.readStringRef();let f=0,g=0;a&&(f=t.readFloat(),g=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,h,e,c);return p?(p.path=e,i.rgba8888ToColor(p.color,r),p.sequence=c,a&&(p.width=f*o,p.height=g*o),this.linkedMeshes.push(new ye(p,u,n,m,d)),p):null}case ve.Path:{const e=!!(16&l),n=!!(32&l),r=this.readVertices(t,!!(64&l)),c=u.newArray(r.length/6,0);for(let e=0,s=c.length;e<s;e++)c[e]=t.readFloat()*o;const d=a?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,h);return m?(m.closed=e,m.constantSpeed=n,m.worldVerticesLength=r.length,m.vertices=r.vertices,m.bones=r.bones,m.lengths=c,a&&i.rgba8888ToColor(m.color,d),m):null}case ve.Point:{const e=t.readFloat(),n=t.readFloat(),r=t.readFloat(),l=a?t.readInt32():0,c=this.attachmentLoader.newPointAttachment(s,h);return c?(c.x=n*o,c.y=r*o,c.rotation=e,a&&i.rgba8888ToColor(c.color,l),c):null}case ve.Clipping:{const n=t.readInt(!0),r=this.readVertices(t,!!(16&l));let o=a?t.readInt32():0,c=this.attachmentLoader.newClippingAttachment(s,h);return c?(c.endSlot=e.slots[n],c.worldVerticesLength=r.length,c.vertices=r.vertices,c.bones=r.bones,a&&i.rgba8888ToColor(c.color,o),c):null}}return null}readSequence(t){let e=new b(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,n=t.readInt(!0),r=new ke;if(r.length=n<<1,!e)return r.vertices=this.readFloatArray(t,r.length,s),r;let a=new Array,i=new Array;for(let e=0;e<n;e++){let e=t.readInt(!0);i.push(e);for(let n=0;n<e;n++)i.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return r.vertices=u.toFloatArray(a),r.bones=i,r}readFloatArray(t,e,s){let n=new Array(e);if(1==s)for(let s=0;s<e;s++)n[s]=t.readFloat();else for(let r=0;r<e;r++)n[r]=t.readFloat()*s;return n}readShortArray(t,e){let s=new Array(e);for(let n=0;n<e;n++)s[n]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let n=new Array,r=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readByte(),r=t.readInt(!0),a=r-1;switch(s){case Le:{let s=new G(r,e);for(let e=0;e<r;e++)s.setFrame(e,t.readFloat(),t.readStringRef());n.push(s);break}case Oe:{let s=t.readInt(!0),i=new U(r,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;i.setFrame(e,o,l,h,c,d),e!=a;e++){let n=t.readFloat(),r=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case ns:i.setStepped(e);break;case rs:Ae(t,i,s++,e,0,o,n,l,r,1),Ae(t,i,s++,e,1,o,n,h,a,1),Ae(t,i,s++,e,2,o,n,c,u,1),Ae(t,i,s++,e,3,o,n,d,m,1)}o=n,l=r,h=a,c=u,d=m}n.push(i);break}case _e:{let s=t.readInt(!0),i=new N(r,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;i.setFrame(e,o,l,h,c),e!=a;e++){let n=t.readFloat(),r=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case ns:i.setStepped(e);break;case rs:Ae(t,i,s++,e,0,o,n,l,r,1),Ae(t,i,s++,e,1,o,n,h,a,1),Ae(t,i,s++,e,2,o,n,c,d,1)}o=n,l=r,h=a,c=d}n.push(i);break}case Ue:{let s=t.readInt(!0),i=new W(r,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,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;i.setFrame(e,o,l,h,c,d,u,m,f),e!=a;e++){let n=t.readFloat(),r=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case ns:i.setStepped(e);break;case rs:Ae(t,i,s++,e,0,o,n,l,r,1),Ae(t,i,s++,e,1,o,n,h,a,1),Ae(t,i,s++,e,2,o,n,c,g,1),Ae(t,i,s++,e,3,o,n,d,p,1),Ae(t,i,s++,e,4,o,n,u,x,1),Ae(t,i,s++,e,5,o,n,m,w,1),Ae(t,i,s++,e,6,o,n,f,b,1)}o=n,l=r,h=a,c=g,d=p,u=x,m=w,f=b}n.push(i);break}case Ne:{let s=t.readInt(!0),i=new z(r,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,m=t.readUnsignedByte()/255;for(let e=0,s=0;i.setFrame(e,o,l,h,c,d,u,m),e!=a;e++){let n=t.readFloat(),r=t.readUnsignedByte()/255,a=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case ns:i.setStepped(e);break;case rs:Ae(t,i,s++,e,0,o,n,l,r,1),Ae(t,i,s++,e,1,o,n,h,a,1),Ae(t,i,s++,e,2,o,n,c,f,1),Ae(t,i,s++,e,3,o,n,d,g,1),Ae(t,i,s++,e,4,o,n,u,p,1),Ae(t,i,s++,e,5,o,n,m,x,1)}o=n,l=r,h=a,c=f,d=g,u=p,m=x}n.push(i);break}case qe:{let s=new q(r,t.readInt(!0),e),i=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,n=0;s.setFrame(e,i,o),e!=a;e++){let r=t.readFloat(),a=t.readUnsignedByte()/255;switch(t.readByte()){case ns:s.setStepped(e);break;case rs:Ae(t,s,n++,e,0,i,r,o,a,1)}i=r,o=a}n.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,a=t.readInt(!0);s<a;s++){let s=t.readByte(),a=t.readInt(!0);if(s==Ve){let s=new _(a,e);for(let e=0;e<a;e++)s.setFrame(e,t.readFloat(),t.readByte());n.push(s);continue}let i=t.readInt(!0);switch(s){case Ie:n.push(Ce(t,new Y(a,i,e),1));break;case Me:n.push(Se(t,new X(a,i,e),r));break;case Fe:n.push(Ce(t,new P(a,i,e),r));break;case Ye:n.push(Ce(t,new B(a,i,e),r));break;case Xe:n.push(Se(t,new R(a,i,e),1));break;case Pe:n.push(Ce(t,new E(a,i,e),1));break;case Be:n.push(Ce(t,new D(a,i,e),1));break;case Re:n.push(Se(t,new V(a,i,e),1));break;case Ee:n.push(Ce(t,new L(a,i,e),1));break;case De:n.push(Ce(t,new O(a,i,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),a=s-1,i=new Q(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()*r:0;for(let e=0,s=0;i.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=a;e++){o=t.readByte();const n=t.readFloat(),a=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*r:0;64&o?i.setStepped(e):128&o&&(Ae(t,i,s++,e,0,l,n,h,a,1),Ae(t,i,s++,e,1,l,n,c,d,r)),l=n,h=a,c=d}n.push(i)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),r=s-1,a=new Z(s,t.readInt(!0),e),i=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;a.setFrame(e,i,o,l,h,c,d,u),e!=r;e++){let n=t.readFloat(),r=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),x=t.readFloat();switch(t.readByte()){case ns:a.setStepped(e);break;case rs:Ae(t,a,s++,e,0,i,n,o,r,1),Ae(t,a,s++,e,1,i,n,l,m,1),Ae(t,a,s++,e,2,i,n,h,f,1),Ae(t,a,s++,e,3,i,n,c,g,1),Ae(t,a,s++,e,4,i,n,d,p,1),Ae(t,a,s++,e,5,i,n,u,x,1)}i=n,o=r,l=m,h=f,c=g,d=p,u=x}n.push(a)}for(let e=0,a=t.readInt(!0);e<a;e++){let e=t.readInt(!0),a=s.pathConstraints[e];for(let s=0,i=t.readInt(!0);s<i;s++){const s=t.readByte(),i=t.readInt(!0),o=t.readInt(!0);switch(s){case Ge:n.push(Ce(t,new tt(i,o,e),0==a.positionMode?r:1));break;case $e:n.push(Ce(t,new et(i,o,e),0==a.spacingMode||1==a.spacingMode?r:1));break;case je:let s=new st(i,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,n=0,r=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=r;e++){let r=t.readFloat(),a=t.readFloat(),i=t.readFloat(),o=t.readFloat();switch(t.readByte()){case ns:s.setStepped(e);break;case rs:Ae(t,s,n++,e,0,l,r,h,a,1),Ae(t,s,n++,e,1,l,r,c,i,1),Ae(t,s,n++,e,2,l,r,d,o,1)}l=r,h=a,c=i,d=o}n.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,r=t.readInt(!0);s<r;s++){const s=t.readByte(),r=t.readInt(!0);if(s==ss){const s=new ut(r,e);for(let e=0;e<r;e++)s.setFrame(e,t.readFloat());n.push(s);continue}const a=t.readInt(!0);switch(s){case He:n.push(Ce(t,new rt(r,a,e),1));break;case Je:n.push(Ce(t,new at(r,a,e),1));break;case Ke:n.push(Ce(t,new it(r,a,e),1));break;case Qe:n.push(Ce(t,new ot(r,a,e),1));break;case Ze:n.push(Ce(t,new lt(r,a,e),1));break;case ts:n.push(Ce(t,new ht(r,a,e),1));break;case es:n.push(Ce(t,new ct(r,a,e),1))}}}for(let e=0,a=t.readInt(!0);e<a;e++){let e=s.skins[t.readInt(!0)];for(let s=0,a=t.readInt(!0);s<a;s++){let s=t.readInt(!0);for(let a=0,i=t.readInt(!0);a<i;a++){let a=t.readStringRef();if(!a)throw new Error("attachmentName must not be null.");let i=e.getAttachment(s,a),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case We:{let e=i,a=e.bones,o=e.vertices,c=a?o.length/3*2:o.length,d=t.readInt(!0),m=new $(l,d,s,e),f=t.readFloat();for(let e=0,s=0;;e++){let n,i=t.readInt(!0);if(0==i)n=a?u.newFloatArray(c):o;else{n=u.newFloatArray(c);let e=t.readInt(!0);if(i+=e,1==r)for(let s=e;s<i;s++)n[s]=t.readFloat();else for(let s=e;s<i;s++)n[s]=t.readFloat()*r;if(!a)for(let t=0,e=n.length;t<e;t++)n[t]+=o[t]}if(m.setFrame(e,f,n),e==h)break;let l=t.readFloat();switch(t.readByte()){case ns:m.setStepped(e);break;case rs:Ae(t,m,s++,e,0,f,l,0,1,1)}f=l}n.push(m);break}case ze:{let e=new ft(l,s,i);for(let s=0;s<l;s++){let n=t.readFloat(),r=t.readInt32();e.setFrame(s,n,k[15&r],r>>4,t.readFloat())}n.push(e);break}}}}}let a=t.readInt(!0);if(a>0){let e=new K(a),r=s.slots.length;for(let s=0;s<a;s++){let n=t.readFloat(),a=t.readInt(!0),i=u.newArray(r,0);for(let t=r-1;t>=0;t--)i[t]=-1;let o=u.newArray(r-a,0),l=0,h=0;for(let e=0;e<a;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;i[l+t.readInt(!0)]=l++}for(;l<r;)o[h++]=l++;for(let t=r-1;t>=0;t--)-1==i[t]&&(i[t]=o[--h]);e.setFrame(s,n,i)}n.push(e)}let i=t.readInt(!0);if(i>0){let e=new H(i);for(let n=0;n<i;n++){let r=t.readFloat(),a=s.events[t.readInt(!0)],i=new Ht(r,a);i.intValue=t.readInt(!1),i.floatValue=t.readFloat(),i.stringValue=t.readString(),null==i.stringValue&&(i.stringValue=a.stringValue),i.data.audioPath&&(i.volume=t.readFloat(),i.balance=t.readFloat()),e.setFrame(n,i)}n.push(e)}let o=0;for(let t=0,e=n.length;t<e;t++)o=Math.max(o,n[t].getDuration());return new v(e,n,o)}},be=class{constructor(t,e=new Array,s=0,n=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){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()}},ye=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,n,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=n,this.inheritTimeline=r}},ke=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}},ve=(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",t))(ve||{});function Ce(t,e,s){let n=t.readFloat(),r=t.readFloat()*s;for(let a=0,i=0,o=e.getFrameCount()-1;e.setFrame(a,n,r),a!=o;a++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case ns:e.setStepped(a);break;case rs:Ae(t,e,i++,a,0,n,o,r,l,s)}n=o,r=l}return e}function Se(t,e,s){let n=t.readFloat(),r=t.readFloat()*s,a=t.readFloat()*s;for(let i=0,o=0,l=e.getFrameCount()-1;e.setFrame(i,n,r,a),i!=l;i++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case ns:e.setStepped(i);break;case rs:Ae(t,e,o++,i,0,n,l,r,h,s),Ae(t,e,o++,i,1,n,l,a,c,s)}n=l,r=h,a=c}return e}function Ae(t,e,s,n,r,a,i,o,l,h){e.setBezier(s,n,r,a,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,i,l)}var Te,Ie=0,Me=1,Fe=2,Ye=3,Xe=4,Pe=5,Be=6,Re=7,Ee=8,De=9,Ve=10,Le=0,Oe=1,_e=2,Ue=3,Ne=4,qe=5,We=0,ze=1,Ge=0,$e=1,je=2,He=0,Je=1,Ke=2,Qe=4,Ze=5,ts=6,es=7,ss=8,ns=1,rs=2,as=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new m((()=>u.newFloatArray(16)));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,n=this.polygons,r=this.polygonPool,a=t.slots,i=a.length;s.length=0,r.freeAll(n),n.length=0;for(let t=0;t<i;t++){let e=a[t];if(!e.bone.active)continue;let i=e.getAttachment();if(i instanceof Mt){let t=i;s.push(t);let a=r.obtain();a.length!=t.worldVerticesLength&&(a=u.newFloatArray(t.worldVerticesLength)),n.push(a),t.computeWorldVertices(e,0,t.worldVerticesLength,a,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY,r=this.polygons;for(let a=0,i=r.length;a<i;a++){let i=r[a],o=i;for(let r=0,a=i.length;r<a;r+=2){let a=o[r],i=o[r+1];t=Math.min(t,a),e=Math.min(e,i),s=Math.max(s,a),n=Math.max(n,i)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=n}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,n){let r=this.minX,a=this.minY,i=this.maxX,o=this.maxY;if(t<=r&&s<=r||e<=a&&n<=a||t>=i&&s>=i||e>=o&&n>=o)return!1;let l=(n-e)/(s-t),h=l*(r-t)+e;if(h>a&&h<o)return!0;if(h=l*(i-t)+e,h>a&&h<o)return!0;let c=(a-e)/l+t;return c>r&&c<i||(c=(o-e)/l+t,c>r&&c<i)}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 n=0,r=s.length;n<r;n++)if(this.containsPointPolygon(s[n],t,e))return this.boundingBoxes[n];return null}containsPointPolygon(t,e,s){let n=t,r=t.length,a=r-2,i=!1;for(let t=0;t<r;t+=2){let r=n[t+1],o=n[a+1];if(r<s&&o>=s||o<s&&r>=s){let l=n[t];l+(s-r)/(o-r)*(n[a]-l)<e&&(i=!i)}a=t}return i}intersectsSegment(t,e,s,n){let r=this.polygons;for(let a=0,i=r.length;a<i;a++)if(this.intersectsSegmentPolygon(r[a],t,e,s,n))return this.boundingBoxes[a];return null}intersectsSegmentPolygon(t,e,s,n,r){let a=t,i=t.length,o=e-n,l=s-r,h=e*r-s*n,c=a[i-2],d=a[i-1];for(let t=0;t<i;t+=2){let i=a[t],u=a[t+1],m=c*u-d*i,f=c-i,g=d-u,p=o*g-l*f,x=(h*f-o*m)/p;if((x>=c&&x<=i||x>=i&&x<=c)&&(x>=e&&x<=n||x>=n&&x<=e)){let t=(h*g-l*m)/p;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=r||t>=r&&t<=s))return!0}c=i,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}},is=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new m((()=>new Array));polygonIndicesPool=new m((()=>new Array));triangulate(t){let e=t,s=t.length>>1,n=this.indicesArray;n.length=0;for(let t=0;t<s;t++)n[t]=t;let r=this.isConcaveArray;r.length=0;for(let t=0,a=s;t<a;++t)r[t]=is.isConcave(t,s,e,n);let a=this.triangles;for(a.length=0;s>3;){let t=s-1,i=0,o=1;for(;;){t:if(!r[i]){let a=n[t]<<1,l=n[i]<<1,h=n[o]<<1,c=e[a],d=e[a+1],u=e[l],m=e[l+1],f=e[h],g=e[h+1];for(let a=(o+1)%s;a!=t;a=(a+1)%s){if(!r[a])continue;let t=n[a]<<1,s=e[t],i=e[t+1];if(is.positiveArea(f,g,c,d,s,i)&&is.positiveArea(c,d,u,m,s,i)&&is.positiveArea(u,m,f,g,s,i))break t}break}if(0==o){do{if(!r[i])break;i--}while(i>0);break}t=i,i=o,o=(o+1)%s}a.push(n[(s+i-1)%s]),a.push(n[i]),a.push(n[(i+1)%s]),n.splice(i,1),r.splice(i,1),s--;let l=(s+i-1)%s,h=i==s?0:i;r[l]=is.isConcave(l,s,e,n),r[h]=is.isConcave(h,s,e,n)}return 3==s&&(a.push(n[2]),a.push(n[0]),a.push(n[1])),a}decompose(t,e){let s=t,n=this.convexPolygons;this.polygonPool.freeAll(n),n.length=0;let r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let a=this.polygonIndicesPool.obtain();a.length=0;let i=this.polygonPool.obtain();i.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],m=s[h+1],f=s[c],g=s[c+1],p=s[d],x=s[d+1],w=!1;if(o==h){let t=i.length-4,e=is.winding(i[t],i[t+1],i[t+2],i[t+3],p,x),s=is.winding(p,x,i[0],i[1],i[2],i[3]);e==l&&s==l&&(i.push(p),i.push(x),a.push(d),w=!0)}w||(i.length>0?(n.push(i),r.push(a)):(this.polygonPool.free(i),this.polygonIndicesPool.free(a)),i=this.polygonPool.obtain(),i.length=0,i.push(u),i.push(m),i.push(f),i.push(g),i.push(p),i.push(x),a=this.polygonIndicesPool.obtain(),a.length=0,a.push(h),a.push(c),a.push(d),l=is.winding(u,m,f,g,p,x),o=h)}i.length>0&&(n.push(i),r.push(a));for(let t=0,e=n.length;t<e;t++){if(a=r[t],0==a.length)continue;let s=a[0],o=a[a.length-1];i=n[t];let l=i.length-4,h=i[l],c=i[l+1],d=i[l+2],u=i[l+3],m=i[0],f=i[1],g=i[2],p=i[3],x=is.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=r[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],k=n[l],v=k[k.length-2],C=k[k.length-1];if(w!=s||b!=o)continue;let S=is.winding(h,c,d,u,v,C),A=is.winding(v,C,m,f,g,p);S==x&&A==x&&(k.length=0,e.length=0,i.push(v),i.push(C),a.push(y),h=d,c=u,d=v,u=C,l=0)}}for(let t=n.length-1;t>=0;t--)i=n[t],0==i.length&&(n.splice(t,1),this.polygonPool.free(i),a=r[t],r.splice(t,1),this.polygonIndicesPool.free(a));return n}static isConcave(t,e,s,n){let r=n[(e+t-1)%e]<<1,a=n[t]<<1,i=n[(t+1)%e]<<1;return!this.positiveArea(s[r],s[r+1],s[a],s[a+1],s[i],s[i+1])}static positiveArea(t,e,s,n,r,a){return t*(a-n)+s*(e-a)+r*(n-e)>=0}static winding(t,e,s,n,r,a){let i=s-t,o=n-e;return r*o-a*i+i*e-t*o>=0?1:-1}},os=class{triangulator=new is;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,n=u.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,n,0,2);let r=this.clippingPolygon;os.makeClockwise(r);let a=this.clippingPolygons=this.triangulator.decompose(r,this.triangulator.triangulate(r));for(let t=0,e=a.length;t<e;t++){let e=a[t];os.makeClockwise(e),e.push(e[0]),e.push(e[1])}return a.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,n,r,a,i,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=n,c=r,d=a,u=i,m=o):(l=e,h=s,c=n,d=r,u=a,m=i),c&&d&&u&&"boolean"==typeof m?this.clipTrianglesRender(t,l,h,c,d,u,m):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let n=this.clipOutput,r=this.clippedVertices,a=this.clippedTriangles,i=this.clippingPolygons,o=i.length,l=0;r.length=0,a.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let m=t[s],f=t[s+1];s=e[h+2]<<1;let g=t[s],p=t[s+1];for(let t=0;t<o;t++){let e=r.length;if(!this.clip(c,d,m,f,g,p,i[t],n)){let t=u.setArraySize(r,e+6);t[e]=c,t[e+1]=d,t[e+2]=m,t[e+3]=f,t[e+4]=g,t[e+5]=p,e=a.length;let s=u.setArraySize(a,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=n.length;if(0==t)continue;let s=t>>1,i=this.clipOutput,o=u.setArraySize(r,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=i[s],n=i[s+1];o[e]=t,o[e+1]=n}e=a.length;let h=u.setArraySize(a,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,n,r,a,i){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,m=i?12:8,f=0;l.length=0,h.length=0;for(let g=0;g<s;g+=3){let s=e[g]<<1,p=t[s],x=t[s+1],w=n[s],b=n[s+1];s=e[g+1]<<1;let y=t[s],k=t[s+1],v=n[s],C=n[s+1];s=e[g+2]<<1;let S=t[s],A=t[s+1],T=n[s],I=n[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(p,x,y,k,S,A,c[t],o)){let t=u.setArraySize(l,e+3*m);t[e]=p,t[e+1]=x,t[e+2]=r.r,t[e+3]=r.g,t[e+4]=r.b,t[e+5]=r.a,i?(t[e+6]=w,t[e+7]=b,t[e+8]=a.r,t[e+9]=a.g,t[e+10]=a.b,t[e+11]=a.a,t[e+12]=y,t[e+13]=k,t[e+14]=r.r,t[e+15]=r.g,t[e+16]=r.b,t[e+17]=r.a,t[e+18]=v,t[e+19]=C,t[e+20]=a.r,t[e+21]=a.g,t[e+22]=a.b,t[e+23]=a.a,t[e+24]=S,t[e+25]=A,t[e+26]=r.r,t[e+27]=r.g,t[e+28]=r.b,t[e+29]=r.a,t[e+30]=T,t[e+31]=I,t[e+32]=a.r,t[e+33]=a.g,t[e+34]=a.b,t[e+35]=a.a):(t[e+6]=w,t[e+7]=b,t[e+8]=y,t[e+9]=k,t[e+10]=r.r,t[e+11]=r.g,t[e+12]=r.b,t[e+13]=r.a,t[e+14]=v,t[e+15]=C,t[e+16]=S,t[e+17]=A,t[e+18]=r.r,t[e+19]=r.g,t[e+20]=r.b,t[e+21]=r.a,t[e+22]=T,t[e+23]=I),e=h.length;let s=u.setArraySize(h,e+3);s[e]=f,s[e+1]=f+1,s[e+2]=f+2,f+=3;break}{let t=o.length;if(0==t)continue;let s=k-A,n=S-y,c=p-S,d=A-x,g=1/(s*c+n*(x-A)),M=t>>1,F=this.clipOutput,Y=u.setArraySize(l,e+M*m);for(let o=0;o<t;o+=2,e+=m){let t=F[o],l=F[o+1];Y[e]=t,Y[e+1]=l,Y[e+2]=r.r,Y[e+3]=r.g,Y[e+4]=r.b,Y[e+5]=r.a;let h=t-S,u=l-A,m=(s*h+n*u)*g,f=(d*h+c*u)*g,p=1-m-f;Y[e+6]=w*m+v*f+T*p,Y[e+7]=b*m+C*f+I*p,i&&(Y[e+8]=a.r,Y[e+9]=a.g,Y[e+10]=a.b,Y[e+11]=a.a)}e=h.length;let X=u.setArraySize(h,e+3*(M-2));M--;for(let t=1;t<M;t++,e+=3)X[e]=f,X[e+1]=f+t,X[e+2]=f+t+1;f+=M+1}}}}clipTrianglesUnpacked(t,e,s,n){let r=this.clipOutput,a=this.clippedVertices,i=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;a.length=0,i.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,m=t[s],f=t[s+1],g=n[s],p=n[s+1];s=e[d+1]<<1;let x=t[s],w=t[s+1],b=n[s],y=n[s+1];s=e[d+2]<<1;let k=t[s],v=t[s+1],C=n[s],S=n[s+1];for(let t=0;t<h;t++){let e=a.length;if(!this.clip(m,f,x,w,k,v,l[t],r)){let t=u.setArraySize(a,e+6);t[e]=m,t[e+1]=f,t[e+2]=x,t[e+3]=w,t[e+4]=k,t[e+5]=v;let s=u.setArraySize(i,e+6);s[e]=g,s[e+1]=p,s[e+2]=b,s[e+3]=y,s[e+4]=C,s[e+5]=S,e=o.length;let n=u.setArraySize(o,e+3);n[e]=c,n[e+1]=c+1,n[e+2]=c+2,c+=3;break}{let t=r.length;if(0==t)continue;let s=w-v,n=k-x,l=m-k,h=v-f,d=1/(s*l+n*(f-v)),A=t>>1,T=this.clipOutput,I=u.setArraySize(a,e+2*A),M=u.setArraySize(i,e+2*A);for(let r=0;r<t;r+=2,e+=2){let t=T[r],a=T[r+1];I[e]=t,I[e+1]=a;let i=t-k,o=a-v,c=(s*i+n*o)*d,u=(h*i+l*o)*d,m=1-c-u;M[e]=g*c+b*u+C*m,M[e+1]=p*c+y*u+S*m}e=o.length;let F=u.setArraySize(o,e+3*(A-2));A--;for(let t=1;t<A;t++,e+=3)F[e]=c,F[e+1]=c+t,F[e+2]=c+t+1;c+=A+1}}}}clip(t,e,s,n,r,a,i,o){let l,h=o,c=!1;i.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(n),l.push(r),l.push(a),l.push(t),l.push(e),o.length=0;let d=i.length-4,u=i;for(let t=0;;t+=2){let e=u[t],s=u[t+1],n=e-u[t+2],r=s-u[t+3],a=o.length,i=l;for(let t=0,a=l.length-2;t<a;){let a=i[t],l=i[t+1];t+=2;let h=i[t],d=i[t+1],u=r*(e-h)>n*(s-d),m=r*(e-a)-n*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-a,e=d-l,s=m/(t*r-e*n);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(a+t*s),o.push(l+e*s)}else if(u){let t=h-a,e=d-l,s=m/(t*r-e*n);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(a+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(a==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}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,n=e[s-2]*e[1]-e[0]*e[s-1],r=0,a=0,i=0,o=0;for(let t=0,l=s-3;t<l;t+=2)r=e[t],a=e[t+1],i=e[t+2],o=e[t+3],n+=r*o-i*a;if(!(n<0))for(let t=0,n=s-2,r=s>>1;t<r;t+=2){let s=e[t],r=e[t+1],a=n-t;e[t]=e[a],e[t+1]=e[a+1],e[a]=s,e[a+1]=r}}},ls=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new ue,n="string"==typeof t?JSON.parse(t):t,r=n.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=ms(r,"referenceScale",100)*e,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),n.bones)for(let t=0;t<n.bones.length;t++){let r=n.bones[t],a=null,i=ms(r,"parent",null);i&&(a=s.findBone(i));let o=new Wt(s.bones.length,r.name,a);o.length=ms(r,"length",0)*e,o.x=ms(r,"x",0)*e,o.y=ms(r,"y",0)*e,o.rotation=ms(r,"rotation",0),o.scaleX=ms(r,"scaleX",1),o.scaleY=ms(r,"scaleY",1),o.shearX=ms(r,"shearX",0),o.shearY=ms(r,"shearY",0),o.inherit=u.enumValue(zt,ms(r,"inherit","Normal")),o.skinRequired=ms(r,"skin",!1);let l=ms(r,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(n.slots)for(let t=0;t<n.slots.length;t++){let e=n.slots[t],r=e.name,a=s.findBone(e.bone);if(!a)throw new Error(`Couldn't find bone ${e.bone} for slot ${r}`);let o=new ge(s.slots.length,r,a),l=ms(e,"color",null);l&&o.color.setFromString(l);let h=ms(e,"dark",null);h&&(o.darkColor=i.fromString(h)),o.attachmentName=ms(e,"attachment",null),o.blendMode=u.enumValue(pe,ms(e,"blend","normal")),o.visible=ms(e,"visible",!0),s.slots.push(o)}if(n.ik)for(let t=0;t<n.ik.length;t++){let r=n.ik[t],a=new Qt(r.name);a.order=ms(r,"order",0),a.skinRequired=ms(r,"skin",!1);for(let t=0;t<r.bones.length;t++){let e=s.findBone(r.bones[t]);if(!e)throw new Error(`Couldn't find bone ${r.bones[t]} for IK constraint ${r.name}.`);a.bones.push(e)}let i=s.findBone(r.target);if(!i)throw new Error(`Couldn't find target bone ${r.target} for IK constraint ${r.name}.`);a.target=i,a.mix=ms(r,"mix",1),a.softness=ms(r,"softness",0)*e,a.bendDirection=ms(r,"bendPositive",!0)?1:-1,a.compress=ms(r,"compress",!1),a.stretch=ms(r,"stretch",!1),a.uniform=ms(r,"uniform",!1),s.ikConstraints.push(a)}if(n.transform)for(let t=0;t<n.transform.length;t++){let r=n.transform[t],a=new xe(r.name);a.order=ms(r,"order",0),a.skinRequired=ms(r,"skin",!1);for(let t=0;t<r.bones.length;t++){let e=r.bones[t],n=s.findBone(e);if(!n)throw new Error(`Couldn't find bone ${e} for transform constraint ${r.name}.`);a.bones.push(n)}let i=r.target,o=s.findBone(i);if(!o)throw new Error(`Couldn't find target bone ${i} for transform constraint ${r.name}.`);a.target=o,a.local=ms(r,"local",!1),a.relative=ms(r,"relative",!1),a.offsetRotation=ms(r,"rotation",0),a.offsetX=ms(r,"x",0)*e,a.offsetY=ms(r,"y",0)*e,a.offsetScaleX=ms(r,"scaleX",0),a.offsetScaleY=ms(r,"scaleY",0),a.offsetShearY=ms(r,"shearY",0),a.mixRotate=ms(r,"mixRotate",1),a.mixX=ms(r,"mixX",1),a.mixY=ms(r,"mixY",a.mixX),a.mixScaleX=ms(r,"mixScaleX",1),a.mixScaleY=ms(r,"mixScaleY",a.mixScaleX),a.mixShearY=ms(r,"mixShearY",1),s.transformConstraints.push(a)}if(n.path)for(let t=0;t<n.path.length;t++){let r=n.path[t],a=new Zt(r.name);a.order=ms(r,"order",0),a.skinRequired=ms(r,"skin",!1);for(let t=0;t<r.bones.length;t++){let e=r.bones[t],n=s.findBone(e);if(!n)throw new Error(`Couldn't find bone ${e} for path constraint ${r.name}.`);a.bones.push(n)}let i=r.target,o=s.findSlot(i);if(!o)throw new Error(`Couldn't find target slot ${i} for path constraint ${r.name}.`);a.target=o,a.positionMode=u.enumValue(te,ms(r,"positionMode","Percent")),a.spacingMode=u.enumValue(ee,ms(r,"spacingMode","Length")),a.rotateMode=u.enumValue(se,ms(r,"rotateMode","Tangent")),a.offsetRotation=ms(r,"rotation",0),a.position=ms(r,"position",0),0==a.positionMode&&(a.position*=e),a.spacing=ms(r,"spacing",0),0!=a.spacingMode&&1!=a.spacingMode||(a.spacing*=e),a.mixRotate=ms(r,"mixRotate",1),a.mixX=ms(r,"mixX",1),a.mixY=ms(r,"mixY",a.mixX),s.pathConstraints.push(a)}if(n.physics)for(let t=0;t<n.physics.length;t++){const r=n.physics[t],a=new de(r.name);a.order=ms(r,"order",0),a.skinRequired=ms(r,"skin",!1);const i=r.bone,o=s.findBone(i);if(null==o)throw new Error("Physics bone not found: "+i);a.bone=o,a.x=ms(r,"x",0),a.y=ms(r,"y",0),a.rotate=ms(r,"rotate",0),a.scaleX=ms(r,"scaleX",0),a.shearX=ms(r,"shearX",0),a.limit=ms(r,"limit",5e3)*e,a.step=1/ms(r,"fps",60),a.inertia=ms(r,"inertia",1),a.strength=ms(r,"strength",100),a.damping=ms(r,"damping",1),a.massInverse=1/ms(r,"mass",1),a.wind=ms(r,"wind",0),a.gravity=ms(r,"gravity",0),a.mix=ms(r,"mix",1),a.inertiaGlobal=ms(r,"inertiaGlobal",!1),a.strengthGlobal=ms(r,"strengthGlobal",!1),a.dampingGlobal=ms(r,"dampingGlobal",!1),a.massGlobal=ms(r,"massGlobal",!1),a.windGlobal=ms(r,"windGlobal",!1),a.gravityGlobal=ms(r,"gravityGlobal",!1),a.mixGlobal=ms(r,"mixGlobal",!1),s.physicsConstraints.push(a)}if(n.skins)for(let t=0;t<n.skins.length;t++){let e=n.skins[t],r=new fe(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let n=e.bones[t],a=s.findBone(n);if(!a)throw new Error(`Couldn't find bone ${n} for skin ${e.name}.`);r.bones.push(a)}if(e.ik)for(let t=0;t<e.ik.length;t++){let n=e.ik[t],a=s.findIkConstraint(n);if(!a)throw new Error(`Couldn't find IK constraint ${n} for skin ${e.name}.`);r.constraints.push(a)}if(e.transform)for(let t=0;t<e.transform.length;t++){let n=e.transform[t],a=s.findTransformConstraint(n);if(!a)throw new Error(`Couldn't find transform constraint ${n} for skin ${e.name}.`);r.constraints.push(a)}if(e.path)for(let t=0;t<e.path.length;t++){let n=e.path[t],a=s.findPathConstraint(n);if(!a)throw new Error(`Couldn't find path constraint ${n} for skin ${e.name}.`);r.constraints.push(a)}if(e.physics)for(let t=0;t<e.physics.length;t++){let n=e.physics[t],a=s.findPhysicsConstraint(n);if(!a)throw new Error(`Couldn't find physics constraint ${n} for skin ${e.name}.`);r.constraints.push(a)}for(let t in e.attachments){let n=s.findSlot(t);if(!n)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let a=e.attachments[t];for(let t in a){let e=this.readAttachment(a[t],r,n.index,t,s);e&&r.setAttachment(n.index,t,e)}}s.skins.push(r),"default"==r.name&&(s.defaultSkin=r)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],n=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!n)throw new Error(`Skin not found: ${e.skin}`);let r=n.getAttachment(e.slotIndex,e.parent);if(!r)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?r:e.mesh,e.mesh.setParentMesh(r),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,n.events)for(let t in n.events){let e=n.events[t],r=new Jt(t);r.intValue=ms(e,"int",0),r.floatValue=ms(e,"float",0),r.stringValue=ms(e,"string",""),r.audioPath=ms(e,"audio",null),r.audioPath&&(r.volume=ms(e,"volume",1),r.balance=ms(e,"balance",0)),s.events.push(r)}if(n.animations)for(let t in n.animations){let e=n.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,n,r){let a=this.scale;switch(n=ms(t,"name",n),ms(t,"type","region")){case"region":{let s=ms(t,"path",n),r=this.readSequence(ms(t,"sequence",null)),i=this.attachmentLoader.newRegionAttachment(e,n,s,r);if(!i)return null;i.path=s,i.x=ms(t,"x",0)*a,i.y=ms(t,"y",0)*a,i.scaleX=ms(t,"scaleX",1),i.scaleY=ms(t,"scaleY",1),i.rotation=ms(t,"rotation",0),i.width=t.width*a,i.height=t.height*a,i.sequence=r;let o=ms(t,"color",null);return o&&i.color.setFromString(o),null!=i.region&&i.updateRegion(),i}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,n);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let r=ms(t,"color",null);return r&&s.color.setFromString(r),s}case"mesh":case"linkedmesh":{let r=ms(t,"path",n),i=this.readSequence(ms(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,n,r,i);if(!o)return null;o.path=r;let l=ms(t,"color",null);l&&o.color.setFromString(l),o.width=ms(t,"width",0)*a,o.height=ms(t,"height",0)*a,o.sequence=i;let h=ms(t,"parent",null);if(h)return this.linkedMeshes.push(new hs(o,ms(t,"skin",null),s,h,ms(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=ms(t,"edges",null),o.hullLength=2*ms(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,n);if(!s)return null;s.closed=ms(t,"closed",!1),s.constantSpeed=ms(t,"constantSpeed",!0);let r=t.vertexCount;this.readVertices(t,s,r<<1);let i=u.newArray(r/3,0);for(let e=0;e<t.lengths.length;e++)i[e]=t.lengths[e]*a;s.lengths=i;let o=ms(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,n);if(!s)return null;s.x=ms(t,"x",0)*a,s.y=ms(t,"y",0)*a,s.rotation=ms(t,"rotation",0);let r=ms(t,"color",null);return r&&s.color.setFromString(r),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,n);if(!s)return null;let a=ms(t,"end",null);a&&(s.endSlot=r.findSlot(a));let i=t.vertexCount;this.readVertices(t,s,i<<1);let o=ms(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new b(ms(t,"count",0));return e.start=ms(t,"start",1),e.digits=ms(t,"digits",0),e.setupIndex=ms(t,"setup",0),e}readVertices(t,e,s){let n=this.scale;e.worldVerticesLength=s;let r=t.vertices;if(s==r.length){let t=u.toFloatArray(r);if(1!=n)for(let e=0,s=r.length;e<s;e++)t[e]*=n;return void(e.vertices=t)}let a=new Array,i=new Array;for(let t=0,e=r.length;t<e;){let e=r[t++];i.push(e);for(let s=t+4*e;t<s;t+=4)i.push(r[t]),a.push(r[t+1]*n),a.push(r[t+2]*n),a.push(r[t+3])}e.bones=i,e.vertices=u.toFloatArray(a)}readAnimation(t,e,s){let n=this.scale,r=new Array;if(t.slots)for(let e in t.slots){let n=t.slots[e],a=s.findSlot(e);if(!a)throw new Error("Slot not found: "+e);let o=a.index;for(let t in n){let e=n[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new G(s,o);for(let n=0;n<s;n++){let s=e[n];t.setFrame(n,ms(s,"time",0),ms(s,"name",null))}r.push(t)}else if("rgba"==t){let t=new U(s,s<<2,o),n=e[0],a=ms(n,"time",0),l=i.fromString(n.color);for(let s=0,r=0;;s++){t.setFrame(s,a,l.r,l.g,l.b,l.a);let o=e[s+1];if(!o){t.shrink(r);break}let h=ms(o,"time",0),c=i.fromString(o.color),d=n.curve;d&&(r=us(d,t,r,s,0,a,h,l.r,c.r,1),r=us(d,t,r,s,1,a,h,l.g,c.g,1),r=us(d,t,r,s,2,a,h,l.b,c.b,1),r=us(d,t,r,s,3,a,h,l.a,c.a,1)),a=h,l=c,n=o}r.push(t)}else if("rgb"==t){let t=new N(s,3*s,o),n=e[0],a=ms(n,"time",0),l=i.fromString(n.color);for(let s=0,r=0;;s++){t.setFrame(s,a,l.r,l.g,l.b);let o=e[s+1];if(!o){t.shrink(r);break}let h=ms(o,"time",0),c=i.fromString(o.color),d=n.curve;d&&(r=us(d,t,r,s,0,a,h,l.r,c.r,1),r=us(d,t,r,s,1,a,h,l.g,c.g,1),r=us(d,t,r,s,2,a,h,l.b,c.b,1)),a=h,l=c,n=o}r.push(t)}else if("alpha"==t)r.push(cs(e,new q(s,s,o),0,1));else if("rgba2"==t){let t=new W(s,7*s,o),n=e[0],a=ms(n,"time",0),l=i.fromString(n.light),h=i.fromString(n.dark);for(let s=0,r=0;;s++){t.setFrame(s,a,l.r,l.g,l.b,l.a,h.r,h.g,h.b);let o=e[s+1];if(!o){t.shrink(r);break}let c=ms(o,"time",0),d=i.fromString(o.light),u=i.fromString(o.dark),m=n.curve;m&&(r=us(m,t,r,s,0,a,c,l.r,d.r,1),r=us(m,t,r,s,1,a,c,l.g,d.g,1),r=us(m,t,r,s,2,a,c,l.b,d.b,1),r=us(m,t,r,s,3,a,c,l.a,d.a,1),r=us(m,t,r,s,4,a,c,h.r,u.r,1),r=us(m,t,r,s,5,a,c,h.g,u.g,1),r=us(m,t,r,s,6,a,c,h.b,u.b,1)),a=c,l=d,h=u,n=o}r.push(t)}else if("rgb2"==t){let t=new z(s,6*s,o),n=e[0],a=ms(n,"time",0),l=i.fromString(n.light),h=i.fromString(n.dark);for(let s=0,r=0;;s++){t.setFrame(s,a,l.r,l.g,l.b,h.r,h.g,h.b);let o=e[s+1];if(!o){t.shrink(r);break}let c=ms(o,"time",0),d=i.fromString(o.light),u=i.fromString(o.dark),m=n.curve;m&&(r=us(m,t,r,s,0,a,c,l.r,d.r,1),r=us(m,t,r,s,1,a,c,l.g,d.g,1),r=us(m,t,r,s,2,a,c,l.b,d.b,1),r=us(m,t,r,s,3,a,c,h.r,u.r,1),r=us(m,t,r,s,4,a,c,h.g,u.g,1),r=us(m,t,r,s,5,a,c,h.b,u.b,1)),a=c,l=d,h=u,n=o}r.push(t)}}}if(t.bones)for(let e in t.bones){let a=t.bones[e],i=s.findBone(e);if(!i)throw new Error("Bone not found: "+e);let o=i.index;for(let t in a){let e=a[t],s=e.length;if(0!=s)if("rotate"===t)r.push(cs(e,new Y(s,s,o),0,1));else if("translate"===t){let t=new X(s,s<<1,o);r.push(ds(e,t,"x","y",0,n))}else if("translatex"===t){let t=new P(s,s,o);r.push(cs(e,t,0,n))}else if("translatey"===t){let t=new B(s,s,o);r.push(cs(e,t,0,n))}else if("scale"===t){let t=new R(s,s<<1,o);r.push(ds(e,t,"x","y",1,1))}else if("scalex"===t){let t=new E(s,s,o);r.push(cs(e,t,1,1))}else if("scaley"===t){let t=new D(s,s,o);r.push(cs(e,t,1,1))}else if("shear"===t){let t=new V(s,s<<1,o);r.push(ds(e,t,"x","y",0,1))}else if("shearx"===t){let t=new L(s,s,o);r.push(cs(e,t,0,1))}else if("sheary"===t){let t=new O(s,s,o);r.push(cs(e,t,0,1))}else if("inherit"===t){let t=new _(s,i.index);for(let s=0;s<e.length;s++){let n=e[s];t.setFrame(s,ms(n,"time",0),u.enumValue(zt,ms(n,"inherit","Normal")))}r.push(t)}}}if(t.ik)for(let e in t.ik){let a=t.ik[e],i=a[0];if(!i)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new Q(a.length,a.length<<1,l),c=ms(i,"time",0),d=ms(i,"mix",1),u=ms(i,"softness",0)*n;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,ms(i,"bendPositive",!0)?1:-1,ms(i,"compress",!1),ms(i,"stretch",!1));let s=a[t+1];if(!s){h.shrink(e);break}let r=ms(s,"time",0),o=ms(s,"mix",1),l=ms(s,"softness",0)*n,m=i.curve;m&&(e=us(m,h,e,t,0,c,r,d,o,1),e=us(m,h,e,t,1,c,r,u,l,n)),c=r,d=o,u=l,i=s}r.push(h)}if(t.transform)for(let e in t.transform){let n=t.transform[e],a=n[0];if(!a)continue;let i=s.findTransformConstraint(e);if(!i)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(i),l=new Z(n.length,6*n.length,o),h=ms(a,"time",0),c=ms(a,"mixRotate",1),d=ms(a,"mixX",1),u=ms(a,"mixY",d),m=ms(a,"mixScaleX",1),f=ms(a,"mixScaleY",m),g=ms(a,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,g);let s=n[t+1];if(!s){l.shrink(e);break}let r=ms(s,"time",0),i=ms(s,"mixRotate",1),o=ms(s,"mixX",1),p=ms(s,"mixY",o),x=ms(s,"mixScaleX",1),w=ms(s,"mixScaleY",x),b=ms(s,"mixShearY",1),y=a.curve;y&&(e=us(y,l,e,t,0,h,r,c,i,1),e=us(y,l,e,t,1,h,r,d,o,1),e=us(y,l,e,t,2,h,r,u,p,1),e=us(y,l,e,t,3,h,r,m,x,1),e=us(y,l,e,t,4,h,r,f,w,1),e=us(y,l,e,t,5,h,r,g,b,1)),h=r,c=i,d=o,u=p,m=x,f=w,m=x,a=s}r.push(l)}if(t.path)for(let e in t.path){let a=t.path[e],i=s.findPathConstraint(e);if(!i)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(i);for(let t in a){let e=a[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new tt(l,l,o);r.push(cs(e,t,0,0==i.positionMode?n:1))}else if("spacing"===t){let t=new et(l,l,o);r.push(cs(e,t,0,0==i.spacingMode||1==i.spacingMode?n:1))}else if("mix"===t){let t=new st(l,3*l,o),n=ms(s,"time",0),a=ms(s,"mixRotate",1),i=ms(s,"mixX",1),h=ms(s,"mixY",i);for(let r=0,o=0;;r++){t.setFrame(r,n,a,i,h);let l=e[r+1];if(!l){t.shrink(o);break}let c=ms(l,"time",0),d=ms(l,"mixRotate",1),u=ms(l,"mixX",1),m=ms(l,"mixY",u),f=s.curve;f&&(o=us(f,t,o,r,0,n,c,a,d,1),o=us(f,t,o,r,1,n,c,i,u,1),o=us(f,t,o,r,2,n,c,h,m,1)),n=c,a=d,i=u,h=m,s=l}r.push(t)}}}if(t.physics)for(let e in t.physics){let n=t.physics[e],a=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);a=s.physicsConstraints.indexOf(t)}for(let t in n){let e=n[t],s=e[0];if(!s)continue;let i,o=e.length;if("reset"!=t){if("inertia"==t)i=new rt(o,o,a);else if("strength"==t)i=new at(o,o,a);else if("damping"==t)i=new it(o,o,a);else if("mass"==t)i=new ot(o,o,a);else if("wind"==t)i=new lt(o,o,a);else if("gravity"==t)i=new ht(o,o,a);else{if("mix"!=t)continue;i=new ct(o,o,a)}r.push(cs(e,i,0,1))}else{const t=new ut(o,a);for(let n=0;null!=s;s=e[n+1],n++)t.setFrame(n,ms(s,"time",0));r.push(t)}}}if(t.attachments)for(let e in t.attachments){let a=t.attachments[e],i=s.findSkin(e);if(!i)throw new Error("Skin not found: "+e);for(let t in a){let e=a[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],a=i.getAttachment(l,t);for(let t in s){let e=s[t],i=e[0];if(i)if("deform"==t){let t=a.bones,s=a.vertices,o=t?s.length/3*2:s.length,h=new $(e.length,e.length,l,a),c=ms(i,"time",0);for(let r=0,a=0;;r++){let l,d=ms(i,"vertices",null);if(d){l=u.newFloatArray(o);let e=ms(i,"offset",0);if(u.arrayCopy(d,0,l,e,d.length),1!=n)for(let t=e,s=t+d.length;t<s;t++)l[t]*=n;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?u.newFloatArray(o):s;h.setFrame(r,c,l);let m=e[r+1];if(!m){h.shrink(a);break}let f=ms(m,"time",0),g=i.curve;g&&(a=us(g,h,a,r,0,c,f,0,1,1)),c=f,i=m}r.push(h)}else if("sequence"==t){let t=new ft(e.length,l,a),s=0;for(let n=0;n<e.length;n++){let r=ms(i,"delay",s),a=ms(i,"time",0),o=y[ms(i,"mode","hold")],l=ms(i,"index",0);t.setFrame(n,a,o,l,r),s=r,i=e[n+1]}r.push(t)}}}}}if(t.drawOrder){let e=new K(t.drawOrder.length),n=s.slots.length,a=0;for(let r=0;r<t.drawOrder.length;r++,a++){let i=t.drawOrder[r],o=null,l=ms(i,"offsets",null);if(l){o=u.newArray(n,-1);let t=u.newArray(n-l.length,0),e=0,r=0;for(let n=0;n<l.length;n++){let a=l[n],i=s.findSlot(a.slot);if(!i)throw new Error("Slot not found: "+i);let h=i.index;for(;e!=h;)t[r++]=e++;o[e+a.offset]=e++}for(;e<n;)t[r++]=e++;for(let e=n-1;e>=0;e--)-1==o[e]&&(o[e]=t[--r])}e.setFrame(a,ms(i,"time",0),o)}r.push(e)}if(t.events){let e=new H(t.events.length),n=0;for(let r=0;r<t.events.length;r++,n++){let a=t.events[r],i=s.findEvent(a.name);if(!i)throw new Error("Event not found: "+a.name);let o=new Ht(u.toSinglePrecision(ms(a,"time",0)),i);o.intValue=ms(a,"int",i.intValue),o.floatValue=ms(a,"float",i.floatValue),o.stringValue=ms(a,"string",i.stringValue),o.data.audioPath&&(o.volume=ms(a,"volume",1),o.balance=ms(a,"balance",0)),e.setFrame(n,o)}r.push(e)}let a=0;for(let t=0,e=r.length;t<e;t++)a=Math.max(a,r[t].getDuration());s.animations.push(new v(e,r,a))}},hs=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,n,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=n,this.inheritTimeline=r}};function cs(t,e,s,n){let r=t[0],a=ms(r,"time",0),i=ms(r,"value",s)*n,o=0;for(let l=0;;l++){e.setFrame(l,a,i);let h=t[l+1];if(!h)return e.shrink(o),e;let c=ms(h,"time",0),d=ms(h,"value",s)*n;r.curve&&(o=us(r.curve,e,o,l,0,a,c,i,d,n)),a=c,i=d,r=h}}function ds(t,e,s,n,r,a){let i=t[0],o=ms(i,"time",0),l=ms(i,s,r)*a,h=ms(i,n,r)*a,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 m=ms(u,"time",0),f=ms(u,s,r)*a,g=ms(u,n,r)*a,p=i.curve;p&&(c=us(p,e,c,d,0,o,m,l,f,a),c=us(p,e,c,d,1,o,m,h,g,a)),o=m,l=f,h=g,i=u}}function us(t,e,s,n,r,a,i,o,l,h){if("stepped"==t)return e.setStepped(n),s;let c=r<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,n,r,a,o,d,u,m,f,i,l),s+1}function ms(t,e,s){return void 0!==t[e]?t[e]:s}void 0===Math.fround&&(Math.fround=(Te=new Float32Array(1),function(t){return Te[0]=t,Te[0]}));var fs=class extends Yt{static from(t){return fs.textureMap.has(t)?fs.textureMap.get(t):new fs(t)}texture;constructor(e){super(e.resource),this.texture=t.Texture.from(e)}setFilters(t,e){const s=this.texture.source.style;s.minFilter=fs.toPixiTextureFilter(t),s.magFilter=fs.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=fs.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){const s=this.texture.source.style;s.addressModeU=fs.toPixiTextureWrap(t),s.addressModeV=fs.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},gs=fs;n(gs,"textureMap",new Map);var ps={extension:t.ExtensionType.Asset,resolver:{test:e=>t.checkExtension(e,".atlas"),parse:e=>{const s=e.split(".");return{resolution:parseFloat(t.Resolver.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:s[s.length-2],src:e}}},loader:{extension:{type:t.ExtensionType.LoadParser,priority:t.LoaderParserPriority.Normal,name:"spineTextureAtlasLoader"},test:e=>t.checkExtension(e,".atlas"),async load(e){const s=await t.DOMAdapter.get().fetch(e);return await s.text()},testParse(e,s){const n=t.checkExtension(s.src,".atlas"),r="string"==typeof e;return Promise.resolve(n&&r)},unload(t){t.dispose()},async parse(e,s,n){const r=s.data||{};let a=t.path.dirname(s.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");const i=new Rt(e);if(r.images instanceof t.TextureSource||"string"==typeof r.images){const t=r.images;r.images={},r.images[i.pages[0].name]=t}const o=[];for(const e of i.pages){if(r.resolve){const t=r.resolve().then((t=>{e.setTexture(gs.from(t.source))}));o.push(t);continue}const s=e.name,i=r?.images?r.images[s]:void 0;if(i instanceof t.TextureSource)e.setTexture(gs.from(i));else{const l={src:i??t.path.normalize([...a.split(t.path.sep),s].join(t.path.sep)),data:{...r.imageMetadata,alphaMode:e.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},h=n.load(l).then((t=>{e.setTexture(gs.from(t.source))}));o.push(h)}}return await Promise.all(o),i}}};t.extensions.add(ps);var xs={extension:t.ExtensionType.Asset,loader:{extension:{type:t.ExtensionType.LoadParser,priority:t.LoaderParserPriority.Normal,name:"spineSkeletonLoader"},test:e=>t.checkExtension(e,".skel"),async load(e){const s=await t.DOMAdapter.get().fetch(e);return new Uint8Array(await s.arrayBuffer())},testParse(e,s){const n=t.checkExtension(s.src,".json")&&(r=e,Object.prototype.hasOwnProperty.call(r,"bones"));var r;const a=t.checkExtension(s.src,".skel")&&function(t){return t instanceof Uint8Array}(e);return Promise.resolve(n||a)}}};t.extensions.add(xs);var ws=new Float32Array(1),bs=new Uint32Array(1),ys=class extends t.Geometry{constructor(){const e=new t.Buffer({data:ws,label:"attribute-batch-buffer",usage:t.BufferUsage.VERTEX|t.BufferUsage.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:28,offset:0},aUV:{buffer:e,format:"float32x2",stride:28,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:28,offset:16},aDarkColor:{buffer:e,format:"unorm8x4",stride:28,offset:20},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:28,offset:24}},indexBuffer:new t.Buffer({data:bs,label:"index-batch-buffer",usage:t.BufferUsage.INDEX|t.BufferUsage.COPY_DST,shrinkToFit:!1})})}},ks={name:"color-bit",vertex:{header:"\n @in aDarkColor: vec4<f32>;\n @out vDarkColor: vec4<f32>;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n @in vDarkColor: vec4<f32>;\n ",end:"\n\n let alpha = outColor.a * vColor.a;\n let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n\n finalColor = vec4<f32>(rgb, alpha);\n\n "}},vs={name:"color-bit",vertex:{header:"\n in vec4 aDarkColor;\n out vec4 vDarkColor;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n in vec4 vDarkColor;\n ",end:"\n\n finalColor.a = outColor.a * vColor.a;\n finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n "}},Cs=class extends t.Shader{constructor(e){super({glProgram:t.compileHighShaderGlProgram({name:"dark-tint-batch",bits:[t.colorBitGl,vs,t.generateTextureBatchBitGl(e),t.roundPixelsBitGl]}),gpuProgram:t.compileHighShaderGpuProgram({name:"dark-tint-batch",bits:[t.colorBit,ks,t.generateTextureBatchBit(e),t.roundPixelsBit]}),resources:{batchSamplers:t.getBatchSamplersUniformGroup(e)}})}},Ss=null,As=class extends t.Batcher{geometry=new ys;shader=Ss||(Ss=new Cs(this.maxTextures));name=As.extension.name;vertexSize=7;packAttributes(e,s,n,r,a){const i=a<<16|65535&e.roundPixels,o=e.transform,l=o.a,h=o.b,c=o.c,d=o.d,u=o.tx,m=o.ty,{positions:f,uvs:g}=e,p=e.color,x=(p>>24&255)/255,w=t.Color.shared.setValue(e.darkColor).premultiply(x,!0).toPremultiplied(1,!1),b=e.attributeOffset,y=b+e.attributeSize;for(let t=b;t<y;t++){const e=2*t,a=f[e],o=f[e+1];s[r++]=l*a+c*o+u,s[r++]=d*o+h*a+m,s[r++]=g[e],s[r++]=g[e+1],n[r++]=p,n[r++]=w,n[r++]=i}}packQuadAttributes(t,e,s,n,r){const a=t.texture,i=t.transform,o=i.a,l=i.b,h=i.c,c=i.d,d=i.tx,u=i.ty,m=t.bounds,f=m.maxX,g=m.minX,p=m.maxY,x=m.minY,w=a.uvs,b=t.color,y=t.darkColor,k=r<<16|65535&t.roundPixels;e[n+0]=o*g+h*x+d,e[n+1]=c*x+l*g+u,e[n+2]=w.x0,e[n+3]=w.y0,s[n+4]=b,s[n+5]=y,s[n+6]=k,e[n+7]=o*f+h*x+d,e[n+8]=c*x+l*f+u,e[n+9]=w.x1,e[n+10]=w.y1,s[n+11]=b,s[n+12]=y,s[n+13]=k,e[n+14]=o*f+h*p+d,e[n+15]=c*p+l*f+u,e[n+16]=w.x2,e[n+17]=w.y2,s[n+18]=b,s[n+19]=y,s[n+20]=k,e[n+21]=o*g+h*p+d,e[n+22]=c*p+l*g+u,e[n+23]=w.x3,e[n+24]=w.y3,s[n+25]=b,s[n+26]=y,s[n+27]=k}},Ts=As;n(Ts,"extension",{type:[t.ExtensionType.Batcher],name:"darkTint"}),t.extensions.add(Ts);var Is=class{indexOffset=0;attributeOffset=0;indexSize;attributeSize;batcherName="darkTint";topology="triangle-list";packAsQuad=!1;renderable;positions;indices;uvs;roundPixels;data;blendMode;darkTint;texture;transform;_textureId;_attributeStart;_indexStart;_batcher;_batch;get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let n;const r=t.a*s*255;if(16777215!==e){const s=e>>16&255,a=e>>8&255,i=255&e,o=t.r*i,l=t.g*a;n=r<<24|t.b*s<<16|l<<8|o}else n=r<<24|255*t.b<<16|255*t.g<<8|255*t.r;return n}get darkColor(){const t=this.data.darkColor;return 255*t.b<<16|255*t.g<<8|255*t.r}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,n){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const t=e.clippedData;this.indexSize=t.indicesCount,this.attributeSize=t.vertexCount,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=n,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},Ms={0:"normal",1:"add",2:"multiply",3:"screen"},Fs=class{renderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(t){this.renderer=t}validateRenderable(t){if(t._validateAndTransformAttachments(),t.spineAttachmentsDirty)return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let n=0,r=e.length;n<r;n++){const r=e[n],a=r.getAttachment();if(a instanceof Nt||a instanceof Lt){const e=t._getCachedData(r,a),n=s.slotBatches[e.id],i=e.texture;if(i!==n.texture&&!n._batcher.checkAndUpdateTexture(n,i))return!0}}}return!1}addRenderable(e,s){const n=this._getSpineData(e),r=this.renderer.renderPipes.batch,a=e.skeleton.drawOrder,i=this.renderer._roundPixels|e._roundPixels;e._validateAndTransformAttachments();for(let o=0,l=a.length;o<l;o++){const l=a[o],h=l.getAttachment(),c=Ms[l.data.blendMode];if(h instanceof Nt||h instanceof Lt){const t=e._getCachedData(l,h),a=n.slotBatches[t.id]||=new Is;a.setData(e,t,c,i),t.skipRender||r.addToBatch(a,s)}const d=e._slotsObject[l.data.name];if(d){const e=d.container;e.includeInBuild=!0,t.collectAllRenderables(e,s,this.renderer),e.includeInBuild=!1}}}updateRenderable(t){const e=this.gpuSpineData[t.uid];t._validateAndTransformAttachments();const s=t.skeleton.drawOrder;for(let n=0,r=s.length;n<r;n++){const r=s[n],a=r.getAttachment();if(a instanceof Nt||a instanceof Lt){if(!t._getCachedData(r,a).skipRender){const s=e.slotBatches[t._getCachedData(r,a).id];s._batcher?.updateElement(s)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};n(Fs,"extension",{type:[t.ExtensionType.WebGLPipes,t.ExtensionType.WebGPUPipes,t.ExtensionType.CanvasPipes],name:"spine"}),t.extensions.add(Fs);var Ys=new f;he.yDown=!0;var Xs=new os,Ps=new m((()=>new t.Graphics)),Bs=class extends t.ViewContainer{batched=!0;buildId=0;renderPipeId="spine";_didSpineUpdate=!1;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};skeleton;state;skeletonBounds;darkTint=!1;_debug=void 0;_slotsObject=Object.create(null);clippingSlotToPixiMasks=Object.create(null);getSlotFromRef(t){let e;if(e="number"==typeof t?this.skeleton.slots[t]:"string"==typeof t?this.skeleton.findSlot(t):t,!e)throw new Error(`No slot found with the given slot reference: ${t}`);return e}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}_autoUpdate=!0;get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e?t.Ticker.shared.add(this.internalUpdate,this):t.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=e}hasNeverUpdated=!0;constructor(t){t instanceof ue&&(t={skeletonData:t}),super();const e=t instanceof ue?t:t.skeletonData;this.skeleton=new he(e),this.state=new pt(new It(e)),this.autoUpdate=t?.autoUpdate??!0,this.darkTint=void 0===t?.darkTint?this.skeleton.slots.some((t=>!!t.data.darkColor)):t?.darkTint;const s=this.skeleton.slots;for(let t=0;t<s.length;t++)this.attachmentCacheData[t]=Object.create(null)}update(t){this.internalUpdate(0,t)}internalUpdate(e,s){this._updateAndApplyState(s??t.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,e){const s=t;if("string"==typeof t&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(Ys.set(e.x,e.y),t.parent){const e=t.parent.worldToLocal(Ys);t.x=e.x,t.y=-e.y}else t.x=Ys.x,t.y=Ys.y}getBonePosition(t,e){const s=t;return"string"==typeof t&&(t=this.skeleton.findBone(t)),t?(e||(e={x:0,y:0}),e.x=t.worldX,e.y=t.worldY,e):(console.error(`Cant set bone position! Bone ${String(s)} not found`),e)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this._boundsDirty=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,e=this._lastAttachments;let s=0,n=!1;for(let r=0;r<t.length;r++){const a=t[r].getAttachment();a&&(a!==e[s]&&(n=!0,e[s]=a),s++)}s!==e.length&&(n=!0,e.length=s),this.spineAttachmentsDirty=n}updateAndSetPixiMask(t,e){const s=t.attachment;if(s&&s instanceof Ft){return(this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array}).maskComputed=!1,void(this.currentClippingSlot=this.clippingSlotToPixiMasks[t.data.name])}let n=this.currentClippingSlot,r=this._slotsObject[t.data.name];if(n&&r){let t=n.slot,e=t.attachment,s=n.mask;if(s||(s=Ps.obtain(),n.mask=s,this.addChild(s)),!n.maskComputed){n.maskComputed=!0;const r=e.worldVerticesLength,a=n.vertices;e.computeWorldVertices(t,0,r,a,0,2),s.clear().poly(a).stroke({width:0}).fill({alpha:.25})}r.container.mask=s}else r?.container.mask&&(r.container.mask=null);if(n&&n.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),e)for(const t in this.clippingSlotToPixiMasks){const e=this.clippingSlotToPixiMasks[t];e.slot.attachment instanceof Ft&&e.maskComputed||!e.mask||(this.removeChild(e.mask),Ps.free(e.mask),e.mask=void 0)}}currentClippingSlot;transformAttachments(){const e=this.skeleton.drawOrder;for(let s=0;s<e.length;s++){const n=e[s];this.updateAndSetPixiMask(n,s===e.length-1);const r=n.getAttachment();if(r)if(r instanceof Lt||r instanceof Nt){const e=this._getCachedData(n,r);r instanceof Nt?r.computeWorldVertices(n,e.vertices,0,2):r.computeWorldVertices(n,0,r.worldVerticesLength,e.vertices,0,2),e.uvs.length<r.uvs.length&&(e.uvs=new Float32Array(r.uvs.length)),t.fastCopy(r.uvs.buffer,e.uvs.buffer);const s=n.bone.skeleton.color,a=n.color,i=r.color;e.color.set(s.r*a.r*i.r,s.g*a.g*i.g,s.b*a.b*i.b,s.a*a.a*i.a),n.darkColor&&e.darkColor.setFromColor(n.darkColor),e.skipRender=e.clipped=!1;const o=r.region?.texture.texture||t.Texture.EMPTY;e.texture!==o&&(e.texture=o,this.spineTexturesDirty=!0),Xs.isClipping()&&this.updateClippingData(e)}else if(r instanceof Ft){Xs.clipStart(n,r);continue}Xs.clipEndWithSlot(n)}Xs.clipEnd()}updateClippingData(t){t.clipped=!0,Xs.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:e,clippedUVs:s,clippedTriangles:n}=Xs,r=e.length/2,a=n.length;t.clippedData||(t.clippedData={vertices:new Float32Array(2*r),uvs:new Float32Array(2*r),vertexCount:r,indices:new Uint16Array(a),indicesCount:a},this.spineAttachmentsDirty=!0);const i=t.clippedData,o=i.vertexCount!==r||a!==i.indicesCount;t.skipRender=0===r,o&&(this.spineAttachmentsDirty=!0,i.vertexCount<r&&(i.vertices=new Float32Array(2*r),i.uvs=new Float32Array(2*r)),i.indices.length<a&&(i.indices=new Uint16Array(a)));const{vertices:l,uvs:h,indices:c}=i;for(let t=0;t<r;t++)l[2*t]=e[2*t],l[2*t+1]=e[2*t+1],h[2*t]=s[2*t],h[2*t+1]=s[2*t+1];i.vertexCount=r;for(let t=0;t<a;t++)c[t]!==n[t]&&(this.spineAttachmentsDirty=!0,c[t]=n[t]);i.indicesCount=a}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(e){const{slot:s,container:n}=e;if(n.visible=this.skeleton.drawOrder.includes(s),n.visible){const e=s.bone;n.position.set(e.worldX,e.worldY),n.scale.x=e.getWorldScaleX(),n.scale.y=e.getWorldScaleY(),n.rotation=e.getWorldRotationX()*t.DEG_TO_RAD,n.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(t,e){return this.attachmentCacheData[t.data.index][e.name]||this.initCachedData(t,e)}initCachedData(t,e){let s;return e instanceof Nt?(s=new Float32Array(8),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(e.uvs.length),color:new i(1,1,1,1),darkColor:new i(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:e.region?.texture.texture}):(s=new Float32Array(e.worldVerticesLength),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:s,clipped:!1,indices:e.triangles,uvs:new Float32Array(e.uvs.length),color:new i(1,1,1,1),darkColor:new i(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:e.region?.texture.texture}),this.attachmentCacheData[t.data.index][e.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(t,e){t=this.getSlotFromRef(t);for(const t in this._slotsObject)this._slotsObject[t]?.container===e&&this.removeSlotObject(this._slotsObject[t].slot);this.removeSlotObject(t),e.includeInBuild=!1,this.addChild(e);const s={container:e,slot:t};this._slotsObject[t.data.name]=s,this.updateSlotObject(s)}removeSlotObject(e){let s;if(e instanceof t.Container){for(const t in this._slotsObject)if(this._slotsObject[t]?.container===e){this._slotsObject[t]=null,s=e;break}}else{const t=this.getSlotFromRef(e);s=this._slotsObject[t.data.name]?.container,this._slotsObject[t.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}getSlotObject(t){return t=this.getSlotFromRef(t),this._slotsObject[t.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new as;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const t=this.skeleton.drawOrder,e=this._bounds;e.clear();for(let s=0;s<t.length;s++){const n=t[s],r=n.getAttachment();if(r&&(r instanceof Nt||r instanceof Lt)){const t=this._getCachedData(n,r);e.addVertexData(t.vertices,0,t.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(e=!1){super.destroy(e),t.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,e){this.pixiWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}static from({skeleton:e,atlas:s,scale:n=1,darkTint:r,autoUpdate:a=!0}){const i=`${e}-${s}-${n}`;if(t.Cache.has(i))return new Bs(t.Cache.get(i));const o=t.Assets.get(e),l=t.Assets.get(s),h=new qt(l),c=o instanceof Uint8Array?new we(h):new ls(h);c.scale=n;const d=c.readSkeletonData(o);return t.Cache.set(i,d),new Bs({skeletonData:d,darkTint:r,autoUpdate:a})}},Rs={AlphaTimeline:q,Animation:v,AnimationState:pt,AnimationStateAdapter:class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},AnimationStateData:It,AssetManagerBase:class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new jt){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,n)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${n}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,n)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${n}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,n)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${n}`)}))}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 n=new Image;n.crossOrigin="anonymous",n.onload=()=>{this.success(e,t,this.textureLoader(n))},n.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),n.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},n){let r=t.lastIndexOf("/"),a=r>=0?t.substring(0,r+1):"";t=this.start(t),this.downloader.downloadText(t,(r=>{try{let i=new Rt(r),o=i.pages.length,l=!1;for(let r of i.pages)this.loadTexture(n?n[r.name]:a+r.name,((s,n)=>{l||(r.setTexture(n),0==--o&&this.success(e,t,i))}),((e,n)=>{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,n)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${n}`)}))}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}},AtlasAttachmentLoader:qt,Attachment:g,AttachmentTimeline:G,BinaryInput:be,BlendMode:pe,Bone:Gt,BoneData:Wt,BoundingBoxAttachment:Mt,CURRENT:Tt,ClippingAttachment:Ft,Color:i,ConstraintData:$t,CurveTimeline:I,CurveTimeline1:M,CurveTimeline2:F,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)}}},DeformTimeline:$,Downloader:jt,DrawOrderTimeline:K,Event:Ht,EventData:Jt,EventQueue:wt,EventTimeline:H,EventType:bt,FIRST:kt,FakeTexture:class extends Yt{setFilters(t,e){}setWraps(t,e){}dispose(){}},HOLD_FIRST:Ct,HOLD_MIX:St,HOLD_SUBSEQUENT:vt,IkConstraint:Kt,IkConstraintData:Qt,IkConstraintTimeline:Q,Inherit:zt,InheritTimeline:_,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}},Interpolation:h,MathUtils:l,MeshAttachment:Lt,MixBlend:C,MixDirection:S,PathAttachment:Ot,PathConstraint:re,PathConstraintData:Zt,PathConstraintMixTimeline:st,PathConstraintPositionTimeline:tt,PathConstraintSpacingTimeline:et,Physics:ce,PhysicsConstraintDampingTimeline:it,PhysicsConstraintGravityTimeline:ht,PhysicsConstraintInertiaTimeline:rt,PhysicsConstraintMassTimeline:ot,PhysicsConstraintMixTimeline:ct,PhysicsConstraintResetTimeline:ut,PhysicsConstraintStrengthTimeline:at,PhysicsConstraintTimeline:nt,PhysicsConstraintWindTimeline:lt,PointAttachment:_t,Pool:m,PositionMode:te,Pow:c,PowOut:class extends c{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},RGB2Timeline:z,RGBA2Timeline:W,RGBATimeline:U,RGBTimeline:N,RegionAttachment:Nt,RotateMode:se,RotateTimeline:Y,SETUP:At,SUBSEQUENT:yt,ScaleTimeline:R,ScaleXTimeline:E,ScaleYTimeline:D,SequenceTimeline:ft,ShearTimeline:V,ShearXTimeline:L,ShearYTimeline:O,Skeleton:he,SpineTexture:gs,SkeletonBinary:we,SkeletonBounds:as,SkeletonClipping:os,SkeletonData:ue,SkeletonJson:ls,Skin:fe,SkinEntry:me,Slot:ie,SlotData:ge,SpacingMode:ee,Spine:Bs,SpineDebugRenderer:class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e))return void console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);const s={parentDebugContainer:new t.Container,bones:new t.Container,skeletonXY:new t.Graphics,regionAttachmentsShape:new t.Graphics,meshTrianglesLine:new t.Graphics,meshHullLine:new t.Graphics,clippingPolygon:new t.Graphics,boundingBoxesRect:new t.Graphics,boundingBoxesCircle:new t.Graphics,boundingBoxesPolygon:new t.Graphics,pathsCurve:new t.Graphics,pathsLine:new t.Graphics,eventText:new t.Container,eventCallback:{event:(n,r)=>{if(this.drawEvents){const n=Math.abs(e.scale.x||e.scale.y||1),a=new t.Text({text:r.data.name,style:{fontSize:this.eventFontSize/n,fill:this.eventFontColor,fontFamily:"monospace"}});a.scale.x=Math.sign(e.scale.x),a.anchor.set(.5),s.eventText.addChild(a),setTimeout((()=>{a.destroyed||a.destroy()}),250)}}}};s.parentDebugContainer.addChild(s.bones),s.parentDebugContainer.addChild(s.skeletonXY),s.parentDebugContainer.addChild(s.regionAttachmentsShape),s.parentDebugContainer.addChild(s.meshTrianglesLine),s.parentDebugContainer.addChild(s.meshHullLine),s.parentDebugContainer.addChild(s.clippingPolygon),s.parentDebugContainer.addChild(s.boundingBoxesRect),s.parentDebugContainer.addChild(s.boundingBoxesCircle),s.parentDebugContainer.addChild(s.boundingBoxesPolygon),s.parentDebugContainer.addChild(s.pathsCurve),s.parentDebugContainer.addChild(s.pathsLine),s.parentDebugContainer.addChild(s.eventText),s.parentDebugContainer.zIndex=9999999,s.parentDebugContainer.accessibleChildren=!1,s.parentDebugContainer.eventMode="none",s.parentDebugContainer.interactiveChildren=!1,e.addChild(s.parentDebugContainer),e.state.addListener(s.eventCallback),this.registeredSpines.set(e,s)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let t=e.bones.children.length;t>0;t--)e.bones.children[t-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),n=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,n,s),this.drawPaths&&this.drawPathsFunc(t,e,n),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,n),this.drawClipping&&this.drawClippingFunc(t,e,n),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,n),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,n),this.drawEvents)for(const t of e.eventText.children)t.alpha-=.05,t.y-=2}drawBonesFunc(e,s,n,r){const a=e.skeleton,i=a.x,o=a.y,l=a.bones;s.skeletonXY.strokeStyle={width:n,color:this.skeletonXYColor};for(let e=0,a=l.length;e<a;e++){const a=l[e],h=a.data.length,c=i+a.worldX,d=o+a.worldY,u=i+h*a.a+a.worldX,m=o+h*a.b+a.worldY;if("root"===a.data.name||null===a.data.parent)continue;const f=Math.abs(c-u),g=Math.abs(d-m),p=Math.pow(f,2),x=g,w=Math.pow(g,2),b=Math.sqrt(p+w),y=Math.pow(b,2),k=Math.PI/180,v=Math.acos((y+w-p)/(2*x*b))||0;if(0===b)continue;const C=new t.Graphics;s.bones.addChild(C);const S=b/50/r;C.context.poly([0,0,0-S,b-3*S,0,b-S,0+S,b-3*S]).fill(this.bonesColor),C.x=c,C.y=d,C.pivot.y=b;let A=0;c<u&&d<m?A=180*k-v:c>u&&d<m?A=180*k+v:c>u&&d>m?A=-v:c<u&&d>m?A=v:d===m&&c<u?A=90*k:d===m&&c>u?A=-90*k:c===u&&d<m?A=180*k:c===u&&d>m&&(A=0),C.rotation=A,C.circle(0,b,1.2*S).fill({color:0,alpha:.6}).stroke({width:n+S/2.4,color:this.bonesColor})}const h=3*n;s.skeletonXY.context.moveTo(i-h,o-h).lineTo(i+h,o+h).moveTo(i+h,o-h).lineTo(i-h,o+h).stroke()}drawRegionAttachmentsFunc(t,e,s){const n=t.skeleton.slots;for(let t=0,s=n.length;t<s;t++){const s=n[t],r=s.getAttachment();if(null===r||!(r instanceof Nt))continue;const a=r,i=new Float32Array(8);a.computeWorldVertices(s,i,0,2),e.regionAttachmentsShape.poly(Array.from(i.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const n=t.skeleton.slots;for(let t=0,s=n.length;t<s;t++){const s=n[t];if(!s.bone.active)continue;const r=s.getAttachment();if(null===r||!(r instanceof Lt))continue;const a=r,i=new Float32Array(a.worldVerticesLength),o=a.triangles;let l=a.hullLength;if(a.computeWorldVertices(s,0,a.worldVerticesLength,i,0,2),this.drawMeshTriangles)for(let t=0,s=o.length;t<s;t+=3){const s=2*o[t],n=2*o[t+1],r=2*o[t+2];e.meshTrianglesLine.context.moveTo(i[s],i[s+1]).lineTo(i[n],i[n+1]).lineTo(i[r],i[r+1])}if(this.drawMeshHull&&l>0){l=2*(l>>1);let t=i[l-2],s=i[l-1];for(let n=0,r=l;n<r;n+=2){const r=i[n],a=i[n+1];e.meshHullLine.context.moveTo(r,a).lineTo(t,s),t=r,s=a}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const n=t.skeleton.slots;for(let t=0,s=n.length;t<s;t++){const s=n[t];if(!s.bone.active)continue;const r=s.getAttachment();if(null===r||!(r instanceof Ft))continue;const a=r,i=a.worldVerticesLength,o=new Float32Array(i);a.computeWorldVertices(s,0,i,o,0,2),e.clippingPolygon.poly(Array.from(o))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const n=new as;n.update(t.skeleton,!0),n.minX!==1/0&&e.boundingBoxesRect.rect(n.minX,n.minY,n.getWidth(),n.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const r=n.polygons,a=(t,n,r)=>{if(r<3)throw new Error("Polygon must contain at least 3 vertices");const a=[],i=2*s;for(let s=0,n=t.length;s<n;s+=2){const n=t[s],r=t[s+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(n,r,i),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(n,r,i).fill({color:this.boundingBoxesCircleColor}),a.push(n,r)}e.boundingBoxesPolygon.poly(a).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let t=0,e=r.length;t<e;t++){const e=r[t];a(e,0,e.length)}}drawPathsFunc(t,e,s){const n=t.skeleton.slots;for(let t=0,s=n.length;t<s;t++){const s=n[t];if(!s.bone.active)continue;const r=s.getAttachment();if(null===r||!(r instanceof Ot))continue;const a=r;let i=a.worldVerticesLength;const o=new Float32Array(i);a.computeWorldVertices(s,0,i,o,0,2);let l=o[2],h=o[3],c=0,d=0;if(a.closed){const t=o[0],s=o[1],n=o[i-2],r=o[i-1];c=o[i-4],d=o[i-3],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(t,s,n,r,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(t,s),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(n,r)}i-=4;for(let t=4;t<i;t+=6){const s=o[t],n=o[t+1],r=o[t+2],a=o[t+3];c=o[t+4],d=o[t+5],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(s,n,r,a,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(s,n),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(r,a),l=c,h=d}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}},SpinePipe:Fs,SpineTexture:gs,StringSet:r,Texture:Yt,TextureAtlas:Rt,TextureAtlasPage:Dt,TextureAtlasRegion:Vt,TextureFilter:Xt,TextureRegion:Bt,TextureWrap:Pt,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)}},Timeline:T,TrackEntry:xt,TransformConstraint:oe,TransformConstraintData:xe,TransformConstraintTimeline:Z,TranslateTimeline:X,TranslateXTimeline:P,TranslateYTimeline:B,Triangulator:is,Utils:u,Vector2:f,VertexAttachment:x,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}}};class Es extends e.SpineSystem{init(){super.init({pixiSpine:Rs})}}class Ds extends e.Spine{}exports.PixiSpine=Rs,exports.Spine=Ds,exports.SpineSystem=Es;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("pixi.js"),e=require("@eva/spine-base"),s=Object.defineProperty,i=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,l=(t,e,i)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,h=(t,e)=>{for(var s in e||(e={}),e)a.call(e,s)&&l(t,s,e[s]);if(r)for(var s of r(e))o.call(e,s)&&l(t,s,e[s]);return t},c=(t,e,s)=>new Promise(((i,n)=>{var r=t=>{try{o(s.next(t))}catch(t){n(t)}},a=t=>{try{o(s.throw(t))}catch(t){n(t)}},o=t=>t.done?i(t.value):Promise.resolve(t.value).then(r,a);o((s=s.apply(t,e)).next())}));if("undefined"!=typeof window&&window.PIXI){const t=window.require;window.require=e=>t?t(e):e.startsWith("@pixi/")||e.startsWith("pixi.js")?window.PIXI:void 0}var d=class{constructor(){this.entries={},this.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,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},u=class{constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,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 u).setFromString(t)}},m=u;m.WHITE=new u(1,1,1,1),m.RED=new u(1,0,0,1),m.GREEN=new u(0,1,0,1),m.BLUE=new u(0,0,1,1),m.MAGENTA=new u(1,0,1,1);var f=class{static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*f.degRad)}static sinDeg(t){return Math.sin(t*f.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*f.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 f.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let i=Math.random(),n=e-t;return i<=(s-t)/n?t+Math.sqrt(i*n*(s-t)):e-Math.sqrt((1-i)*n*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}},g=f;g.PI=3.1415927,g.PI2=2*f.PI,g.invPI2=1/f.PI2,g.radiansToDegrees=180/f.PI,g.radDeg=f.radiansToDegrees,g.degreesToRadians=f.PI/180,g.degRad=f.degreesToRadians;var p=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},x=class extends p{constructor(t){super(),this.power=2,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}},w=class{static arrayCopy(t,e,s,i,n){for(let r=e,a=i;r<e+n;r++,a++)s[a]=t[r]}static arrayFill(t,e,s,i){for(let n=e;n<s;n++)t[n]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let n=i;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:w.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(w.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(w.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 w.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return w.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}},b=w;b.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var y=class{constructor(t){this.items=new Array,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}},v=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}},k=class{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},C=class extends k{constructor(t){super(t),this.id=C.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVertices(t,e,s,i,n,r){s=n+(s>>1)*r;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,m=a.c,f=a.d;for(let t=e,a=n;a<s;t+=2,a+=r){let e=l[t],s=l[t+1];i[a]=e*d+s*u+h,i[a+1]=e*m+s*f+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=n,e=3*d;t<s;t+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,e+=3){let t=u[h[c]],i=l[e],r=l[e+1],a=l[e+2];s+=(i*t.a+r*t.b+t.worldX)*a,n+=(i*t.c+r*t.d+t.worldY)*a}i[t]=s,i[t+1]=n}else{let t=o;for(let e=n,a=3*d,o=d<<1;e<s;e+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,a+=3,o+=2){let e=u[h[c]],i=l[a]+t[o],r=l[a+1]+t[o+1],d=l[a+2];s+=(i*e.a+r*e.b+e.worldX)*d,n+=(i*e.c+r*e.d+e.worldY)*d}i[e]=s,i[e+1]=n}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),b.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=b.newFloatArray(this.vertices.length),b.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},S=C;S.nextID=0;var A=class{constructor(t){this.id=A.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(t)}copy(){let t=new A(this.regions.length);return b.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 i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let t=this.digits-i.length;t>0;t--)s+="0";return s+=i,s}static nextID(){return A._nextID++}},T=A;T._nextID=0;var I=(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))(I||{}),M=[0,1,2,3,4,5,6],F=class{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new d,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,r,a,o){if(!t)throw new Error("skeleton cannot be null.");i&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let i=0,h=l.length;i<h;i++)l[i].apply(t,e,s,n,r,a,o)}},Y=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(Y||{}),X=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(X||{}),P={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},B=class{constructor(t,e){this.propertyIds=e,this.frames=b.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}},R=class extends B{constructor(t,e,s){super(t,s),this.curves=b.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=b.newFloatArray(e);b.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,i,n,r,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*r+o),f=.03*(n-2*a+l),g=.006*(3*(r-o)-i+h),p=.006*(3*(a-l)-n+c),x=2*m+g,w=2*f+p,b=.3*(r-i)+m+.16666667*g,y=.3*(a-n)+f+.16666667*p,v=i+b,k=n+y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,b+=x,y+=w,x+=g,w+=p,v+=b,k+=y}getBezierValue(t,e,s,i){let n=this.curves;if(n[i]>t){let r=this.frames[e],a=this.frames[e+s];return a+(t-r)/(n[i]-r)*(n[i+1]-a)}let r=i+18;for(i+=2;i<r;i+=2)if(n[i]>=t){let e=n[i-2],s=n[i-1];return s+(t-e)/(n[i]-e)*(n[i+1]-s)}e+=this.getFrameEntries();let a=n[r-2],o=n[r-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}},E=class extends R{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 i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let i=this.curves[s>>1];switch(i){case 0:let i=e[s],n=e[s+1];return n+(t-i)/(e[s+2]-i)*(e[s+2+1]-n);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}let r=this.getCurveValue(t);switch(s){case 0:return n+r*e;case 1:case 2:r+=n-i}return i+r*e}getAbsoluteValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}let r=this.getCurveValue(t);return 0==s?n+(r-n)*e:i+(r-i)*e}getAbsoluteValue2(t,e,s,i,n,r){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}return 0==s?n+(r-n)*e:i+(r-i)*e}getScaleValue(t,e,s,i,n,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return n+(r-n)*e}return n}let a=this.getCurveValue(t)*r;if(1==e)return 3==s?n+a-r:a;if(1==i)switch(s){case 0:return r+(Math.abs(a)*g.signum(r)-r)*e;case 1:case 2:return n+(Math.abs(a)*g.signum(n)-n)*e}else{let t=0;switch(s){case 0:return t=Math.abs(r)*g.signum(a),t+(a-t)*e;case 1:case 2:return t=Math.abs(n)*g.signum(a),t+(a-t)*e}}return n+(a-r)*e}},D=class extends R{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}},V=class extends E{constructor(t,e,s){super(t,e,P.rotate+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,n,r,o.rotation,o.data.rotation))}},L=class extends D{constructor(t,e,s){super(t,e,P.x+"|"+s,P.y+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.x=o.data.x,void(o.y=o.data.y);case 1:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}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(r){case 0:o.x=o.data.x+h*n,o.y=o.data.y+c*n;break;case 1:case 2:o.x+=(o.data.x+h-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case 3:o.x+=h*n,o.y+=c*n}}},O=class extends E{constructor(t,e,s){super(t,e,P.x+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,n,r,o.x,o.data.x))}},_=class extends E{constructor(t,e,s){super(t,e,P.y+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,n,r,o.y,o.data.y))}},U=class extends D{constructor(t,e,s){super(t,e,P.scaleX+"|"+s,P.scaleY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l,h,c=this.frames;if(s<c[0]){switch(r){case 0:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case 1:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let d=B.search(c,s,3),u=this.curves[d/3];switch(u){case 0:let t=c[d];l=c[d+1],h=c[d+2];let e=(s-t)/(c[d+3]-t);l+=(c[d+3+1]-l)*e,h+=(c[d+3+2]-h)*e;break;case 1:l=c[d+1],h=c[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),h=this.getBezierValue(s,d,2,u+18-2)}if(l*=o.data.scaleX,h*=o.data.scaleY,1==n)3==r?(o.scaleX+=l-o.data.scaleX,o.scaleY+=h-o.data.scaleY):(o.scaleX=l,o.scaleY=h);else{let t=0,e=0;if(1==a)switch(r){case 0:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(l)*g.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*g.signum(e)-e)*n;break;case 1:case 2:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(l)*g.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*g.signum(e)-e)*n;break;case 3:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}else switch(r){case 0:t=Math.abs(o.data.scaleX)*g.signum(l),e=Math.abs(o.data.scaleY)*g.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case 1:case 2:t=Math.abs(o.scaleX)*g.signum(l),e=Math.abs(o.scaleY)*g.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case 3:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}}}},N=class extends E{constructor(t,e,s){super(t,e,P.scaleX+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,n,r,a,o.scaleX,o.data.scaleX))}},q=class extends E{constructor(t,e,s){super(t,e,P.scaleY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,n,r,a,o.scaleY,o.data.scaleY))}},W=class extends D{constructor(t,e,s){super(t,e,P.shearX+"|"+s,P.shearY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case 1:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}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(r){case 0:o.shearX=o.data.shearX+h*n,o.shearY=o.data.shearY+c*n;break;case 1:case 2:o.shearX+=(o.data.shearX+h-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case 3:o.shearX+=h*n,o.shearY+=c*n}}},z=class extends E{constructor(t,e,s){super(t,e,P.shearX+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,n,r,o.shearX,o.data.shearX))}},G=class extends E{constructor(t,e,s){super(t,e,P.shearY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,n,r,o.shearY,o.data.shearY))}},$=class extends B{constructor(t,e){super(t,[P.inherit+"|"+e]),this.boneIndex=0,this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;if(1==a)return void(0==r&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?0!=r&&1!=r||(o.inherit=o.data.inherit):o.inherit=this.frames[B.search(l,s,2)+1]}},j=class extends R{constructor(t,e,s){super(t,e,[P.rgb+"|"+s,P.alpha+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r}apply(t,e,s,i,n,r,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(r){case 0:return void h.setFromColor(t);case 1:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n)}return}let c=0,d=0,u=0,m=0,f=B.search(l,s,5),g=this.curves[f/5];switch(g){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];let e=(s-t)/(l[f+5]-t);c+=(l[f+5+1]-c)*e,d+=(l[f+5+2]-d)*e,u+=(l[f+5+3]-u)*e,m+=(l[f+5+4]-m)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];break;default:c=this.getBezierValue(s,f,1,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+36-2),m=this.getBezierValue(s,f,4,g+54-2)}1==n?h.set(c,d,u,m):(0==r&&h.setFromColor(o.data.color),h.add((c-h.r)*n,(d-h.g)*n,(u-h.b)*n,(m-h.a)*n))}},H=class extends R{constructor(t,e,s){super(t,e,[P.rgb+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,r,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(r){case 0:return h.r=t.r,h.g=t.g,void(h.b=t.b);case 1:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n}return}let c=0,d=0,u=0,m=B.search(l,s,4),f=this.curves[m>>2];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3];let e=(s-t)/(l[m+4]-t);c+=(l[m+4+1]-c)*e,d+=(l[m+4+2]-d)*e,u+=(l[m+4+3]-u)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(1==n)h.r=c,h.g=d,h.b=u;else{if(0==r){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*n,h.g+=(d-h.g)*n,h.b+=(u-h.b)*n}}},J=class extends E{constructor(t,e,s){super(t,e,P.alpha+"|"+s),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,i,n,r,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(r){case 0:return void(l.a=t.a);case 1:l.a+=(t.a-l.a)*n}return}let h=this.getCurveValue(s);1==n?l.a=h:(0==r&&(l.a=o.data.color.a),l.a+=(h-l.a)*n)}},K=class extends R{constructor(t,e,s){super(t,e,[P.rgb+"|"+s,P.alpha+"|"+s,P.rgb2+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,r,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,i,n,r,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(r){case 0:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case 1:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n),c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=0,w=B.search(l,s,8),b=this.curves[w>>3];switch(b){case 0:let t=l[w];d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],g=l[w+5],p=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,m+=(l[w+8+3]-m)*e,f+=(l[w+8+4]-f)*e,g+=(l[w+8+5]-g)*e,p+=(l[w+8+6]-p)*e,x+=(l[w+8+7]-x)*e;break;case 1:d=l[w+1],u=l[w+2],m=l[w+3],f=l[w+4],g=l[w+5],p=l[w+6],x=l[w+7];break;default:d=this.getBezierValue(s,w,1,b-2),u=this.getBezierValue(s,w,2,b+18-2),m=this.getBezierValue(s,w,3,b+36-2),f=this.getBezierValue(s,w,4,b+54-2),g=this.getBezierValue(s,w,5,b+72-2),p=this.getBezierValue(s,w,6,b+90-2),x=this.getBezierValue(s,w,7,b+108-2)}if(1==n)h.set(d,u,m,f),c.r=g,c.g=p,c.b=x;else{if(0==r){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)*n,(u-h.g)*n,(m-h.b)*n,(f-h.a)*n),c.r+=(g-c.r)*n,c.g+=(p-c.g)*n,c.b+=(x-c.b)*n}}},Q=class extends R{constructor(t,e,s){super(t,e,[P.rgb+"|"+s,P.rgb2+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,r,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,i,n,r,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(r){case 0: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 1:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n,c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=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],m=l[x+3],f=l[x+4],g=l[x+5],p=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,m+=(l[x+7+3]-m)*e,f+=(l[x+7+4]-f)*e,g+=(l[x+7+5]-g)*e,p+=(l[x+7+6]-p)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];break;default:d=this.getBezierValue(s,x,1,w-2),u=this.getBezierValue(s,x,2,w+18-2),m=this.getBezierValue(s,x,3,w+36-2),f=this.getBezierValue(s,x,4,w+54-2),g=this.getBezierValue(s,x,5,w+72-2),p=this.getBezierValue(s,x,6,w+90-2)}if(1==n)h.r=d,h.g=u,h.b=m,c.r=f,c.g=g,c.b=p;else{if(0==r){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)*n,h.g+=(u-h.g)*n,h.b+=(m-h.b)*n,c.r+=(f-c.r)*n,c.g+=(g-c.g)*n,c.b+=(p-c.b)*n}}},Z=class extends B{constructor(t,e){super(t,[P.attachment+"|"+e]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];o.bone.active&&(1!=a?s<this.frames[0]?0!=r&&1!=r||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[B.search1(this.frames,s)]):0==r&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},tt=class extends R{constructor(t,e,s,i){super(t,e,[P.deform+"|"+s+"|"+i.id]),this.slotIndex=0,this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,r,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*r+o),f=.03*l-.06*a,g=.006*(3*(r-o)-i+h),p=.018*(a-l+.33333333),x=2*m+g,w=2*f+p,b=.3*(r-i)+m+.16666667*g,y=.3*a+f+.16666667*p,v=i+b,k=y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,b+=x,y+=w,x+=g,w+=p,v+=b,k+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){let e=s[i-2],n=s[i-1];return n+(t-e)/(s[i]-e)*(s[i+1]-n)}let r=s[n-2],a=s[n-1];return a+(1-a)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof S)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(r=0);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(r){case 0:return void(h.length=0);case 1:if(1==n)return void(h.length=0);h.length=d;let t=l;if(t.bones){n=1-n;for(m=0;m<d;m++)h[m]*=n}else{let e=t.vertices;for(var m=0;m<d;m++)h[m]+=(e[m]-h[m])*n}}return}if(h.length=d,s>=u[u.length-1]){let t=c[u.length-1];if(1==n)if(3==r){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else b.arrayCopy(t,0,h,0,d);else switch(r){case 0:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++){let i=s[e];h[e]=i+(t[e]-i)*n}}break}case 1:case 2:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*n;break;case 3:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*n}}return}let f=B.search1(u,s),g=this.getCurvePercent(s,f),p=c[f],x=c[f+1];if(1==n)if(3==r){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]+=e+(x[t]-e)*g}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t];h[t]+=s+(x[t]-s)*g-e[t]}}}else for(let t=0;t<d;t++){let e=p[t];h[t]=e+(x[t]-e)*g}else switch(r){case 0:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]=(e+(x[t]-e)*g)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t],i=e[t];h[t]=i+(s+(x[t]-s)*g-i)*n}}break}case 1:case 2:for(let t=0;t<d;t++){let e=p[t];h[t]+=(e+(x[t]-e)*g-h[t])*n}break;case 3:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]+=(e+(x[t]-e)*g)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t];h[t]+=(s+(x[t]-s)*g-e[t])*n}}}}},et=class extends B{constructor(t){super(t,et.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,i,n,r,a){if(!i)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,r,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++)i.push(this.events[h])}},st=et;st.propertyIds=[""+P.event];var it=class extends B{constructor(t){super(t,it.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,i,n,r,a){if(1==a)return void(0==r&&b.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(0!=r&&1!=r||b.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=B.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,i=l.length;t<i;t++)e[t]=s[l[t]]}else b.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}},nt=it;nt.propertyIds=[""+P.drawOrder];var rt=class extends R{constructor(t,e,s){super(t,e,[P.ikConstraint+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,r,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,i,n,r,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0: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 1:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,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)}0==r?(o.mix=o.data.mix+(h-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,1==a?(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)*n,o.softness+=(c-o.softness)*n,0==a&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}},at=class extends R{constructor(t,e,s){super(t,e,[P.transformConstraint+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,r,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,l[t+4]=r,l[t+5]=a,l[t+6]=o}apply(t,e,s,i,n,r,a){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,m,f=this.frames;if(s<f[0]){let t=o.data;switch(r){case 0: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 1:o.mixRotate+=(t.mixRotate-o.mixRotate)*n,o.mixX+=(t.mixX-o.mixX)*n,o.mixY+=(t.mixY-o.mixY)*n,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(t.mixShearY-o.mixShearY)*n}return}let g=B.search(f,s,7),p=this.curves[g/7];switch(p){case 0:let t=f[g];l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];let e=(s-t)/(f[g+7]-t);l+=(f[g+7+1]-l)*e,h+=(f[g+7+2]-h)*e,c+=(f[g+7+3]-c)*e,d+=(f[g+7+4]-d)*e,u+=(f[g+7+5]-u)*e,m+=(f[g+7+6]-m)*e;break;case 1:l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),h=this.getBezierValue(s,g,2,p+18-2),c=this.getBezierValue(s,g,3,p+36-2),d=this.getBezierValue(s,g,4,p+54-2),u=this.getBezierValue(s,g,5,p+72-2),m=this.getBezierValue(s,g,6,p+90-2)}if(0==r){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*n,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*n,o.mixShearY=t.mixShearY+(m-t.mixShearY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n,o.mixScaleX+=(d-o.mixScaleX)*n,o.mixScaleY+=(u-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}},ot=class extends E{constructor(t,e,s){super(t,e,P.pathConstraintPosition+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,n,r,o.position,o.data.position))}},lt=class extends E{constructor(t,e,s){super(t,e,P.pathConstraintSpacing+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,n,r,o.spacing,o.data.spacing))}},ht=class extends R{constructor(t,e,s){super(t,e,[P.pathConstraintMix+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){let r=this.frames;r[t<<=2]=e,r[t+1]=s,r[t+2]=i,r[t+3]=n}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(r){case 0:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case 1:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u=B.search(d,s,4),m=this.curves[u>>2];switch(m){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,m-2),h=this.getBezierValue(s,u,2,m+18-2),c=this.getBezierValue(s,u,3,m+36-2)}if(0==r){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n}},ct=class extends E{constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const i of t.physicsConstraints)i.active&&this.global(i.data)&&this.set(i,this.getAbsoluteValue2(s,n,r,this.get(i),this.setup(i),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,n,r,this.get(o),this.setup(o)))}},dt=class extends ct{constructor(t,e,s){super(t,e,s,P.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ut=class extends ct{constructor(t,e,s){super(t,e,s,P.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},mt=class extends ct{constructor(t,e,s){super(t,e,s,P.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ft=class extends ct{constructor(t,e,s){super(t,e,s,P.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}},gt=class extends ct{constructor(t,e,s){super(t,e,s,P.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},pt=class extends ct{constructor(t,e,s){super(t,e,s,P.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},xt=class extends ct{constructor(t,e,s){super(t,e,s,P.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},wt=class extends B{constructor(t,e){super(t,wt.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,n,r,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,[],n,r,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()}},bt=wt;bt.propertyIds=[P.physicsConstraintReset.toString()];var yt=class extends B{constructor(t,e,s){super(t,[P.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return yt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,n){let r=this.frames;r[t*=yt.ENTRIES]=e,r[t+yt.MODE]=s|i<<4,r[t+yt.DELAY]=n}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof S&&l.timelineAttachment==h))return;if(1==a)return void(0==r&&(o.sequenceIndex=-1));let c=this.frames;if(s<c[0])return void(0!=r&&1!=r||(o.sequenceIndex=-1));let d=B.search(c,s,yt.ENTRIES),u=c[d],m=c[d+yt.MODE],f=c[d+yt.DELAY];if(!this.attachment.sequence)return;let g=m>>4,p=this.attachment.sequence.regions.length,x=M[15&m];if(0!=x)switch(g+=(s-u)/f+1e-5|0,x){case 1:g=Math.min(p-1,g);break;case 2:g%=p;break;case 3:{let t=(p<<1)-2;g=0==t?0:g%t,g>=p&&(g=t-g);break}case 4:g=Math.max(p-1-g,0);break;case 5:g=p-1-g%p;break;case 6:{let t=(p<<1)-2;g=0==t?0:(g+p-1)%t,g>=p&&(g=t-g)}}o.sequenceIndex=g}},vt=yt;vt.ENTRIES=3,vt.MODE=1,vt.DELAY=2;var kt=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new At(this),this.propertyIDs=new d,this.animationsChanged=!1,this.trackEntryPool=new y((()=>new St)),this.data=t}static emptyAnimation(){return kt._emptyAnimation}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(!i)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let n=t*i.timeScale;if(i.delay>0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let r=i.next;if(r){let e=i.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime+=0==i.timeScale?0:(e/i.timeScale+t)*r.timeScale,i.trackTime+=n,this.setCurrent(s,r,!0);r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){e[s]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,t)){let t=i.mixingFrom;for(i.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);if(s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,-1!=t.nextTrackLast){const e=0==t.mixTime&&0==s.mixTime;if(t.mixTime>=t.mixDuration||e)return(0==s.totalAlpha||0==t.mixDuration||e)&&(t.mixingFrom=s.mixingFrom,null!=s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i}return 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,i=!1;for(let r=0,a=s.length;r<a;r++){let a=s[r];if(!a||a.delay>0)continue;i=!0;let o=0==r?1:a.mixBlend,l=a.alpha;a.mixingFrom?l*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(l=0);let h=l>=a.alphaAttachmentThreshold,c=a.animationLast,d=a.getAnimationTime(),u=d,m=e;a.reverse&&(u=a.animation.duration-u,m=null);let f=a.animation.timelines,g=f.length;if(0==r&&1==l||3==o){0==r&&(h=!0);for(let e=0;e<g;e++){b.webkit602BugfixHelper(l,o);var n=f[e];n instanceof Z?this.applyAttachmentTimeline(n,t,u,o,h):n.apply(t,c,u,m,l,o,0)}}else{let e=a.timelineMode,s=a.shortestRotation,i=!s&&a.timelinesRotation.length!=g<<1;i&&(a.timelinesRotation.length=g<<1);for(let n=0;n<g;n++){let r=f[n],d=e[n]==It?o:0;!s&&r instanceof V?this.applyRotateTimeline(r,t,u,l,d,a.timelinesRotation,n<<1,i):r instanceof Z?this.applyAttachmentTimeline(r,t,u,o,h):(b.webkit602BugfixHelper(l,o),r.apply(t,c,u,m,l,d,0))}}this.queueEvents(a,d),e.length=0,a.nextAnimationLast=d,a.nextTrackLast=a.trackTime}for(var r=this.unkeyedState+Pt,a=t.slots,o=0,l=t.slots.length;o<l;o++){var h=a[o];if(h.attachmentState==r){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e,s){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,e,s);let n=0;0==t.mixDuration?(n=1,1==s&&(s=0)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),1!=s&&(s=i.mixBlend));let r=n<i.mixAttachmentThreshold,a=n<i.mixDrawOrderThreshold,o=i.animation.timelines,l=o.length,h=i.alpha*t.interruptAlpha,c=h*(1-n),d=i.animationLast,u=i.getAnimationTime(),m=u,f=null;if(i.reverse?m=i.animation.duration-m:n<i.eventThreshold&&(f=this.events),3==s)for(let t=0;t<l;t++)o[t].apply(e,d,m,f,c,s,1);else{let t=i.timelineMode,n=i.timelineHoldMix,u=i.shortestRotation,g=!u&&i.timelinesRotation.length!=l<<1;g&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let p=0;p<l;p++){let l,x=o[p],w=1,y=0;switch(t[p]){case It:if(!a&&x instanceof nt)continue;l=s,y=c;break;case Mt:l=0,y=c;break;case Ft:l=s,y=h;break;case Yt:l=0,y=h;break;default:l=0;let t=n[p];y=h*Math.max(0,1-t.mixTime/t.mixDuration)}i.totalAlpha+=y,!u&&x instanceof V?this.applyRotateTimeline(x,e,m,y,l,i.timelinesRotation,p<<1,g):x instanceof Z?this.applyAttachmentTimeline(x,e,m,l,r&&y>=i.alphaAttachmentThreshold):(b.webkit602BugfixHelper(y,s),a&&x instanceof nt&&0==l&&(w=0),x.apply(e,d,m,f,y,l,w))}}return t.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,n}applyAttachmentTimeline(t,e,s,i,n){var r=e.slots[t.slotIndex];r.bone.active&&(s<t.frames[0]?0!=i&&1!=i||this.setAttachment(e,r,r.data.attachmentName,n):this.setAttachment(e,r,t.attachmentNames[B.search1(t.frames,s)],n),r.attachmentState<=this.unkeyedState&&(r.attachmentState=this.unkeyedState+Pt))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+Bt)}applyRotateTimeline(t,e,s,i,n,r,a,o){if(o&&(r[a]=0),1==i)return void t.apply(e,0,s,null,1,n,0);let l=e.bones[t.boneIndex];if(!l.active)return;let h=0,c=0;if(s<t.frames[0])switch(n){case 0:l.rotation=l.data.rotation;default:return;case 1:h=l.rotation,c=l.data.rotation}else h=0==n?l.data.rotation:l.rotation,c=l.data.rotation+t.getCurveValue(s);let d=0,u=c-h;if(u-=360*Math.ceil(u/360-.5),0==u)d=r[a];else{let t=0,e=0;o?(t=0,e=u):(t=r[a],e=r[a+1]);let s=t-t%360;d=u+s;let i=u>=0,n=t>=0;Math.abs(e)<=90&&g.signum(e)!=g.signum(u)&&(Math.abs(t-s)>180?(d+=360*g.signum(t),n=i):0!=s?d-=360*g.signum(t):n=i),n!=i&&(d+=360*g.signum(t)),r[a]=d}r[a+1]=u,l.rotation=h+d*i}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,n=i-s,r=t.trackLast%n,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<r)break;e.time>i||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==n)h=!0;else{const e=Math.floor(t.trackTime/n);h=e>0&&e>Math.floor(t.trackLast/n)}else h=e>=i&&t.animationLast<i;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 i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,n=this.expandToIndex(t);n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,i=!1):this.clearNext(n));let r=this.trackEntry(t,e,s,n);return this.setCurrent(t,r,i),this.queue.drain(),r}addAnimation(t,e,s=!1,i=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let r=this.trackEntry(t,e,s,n);return n?(n.next=r,r.previous=n,i<=0&&(i+=n.getTrackComplete()-r.mixDuration)):(this.setCurrent(t,r,!0),this.queue.drain()),r.delay=i,r}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,kt.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,kt.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-e),i.mixDuration=e,i.trackEnd=e,i}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]:(b.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,i){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=i?this.data.getMix(i.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}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&&3==s.mixBlend||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;let r=t.timelineHoldMix;r.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<i;t++)n[t]=a.addAll(s[t].getPropertyIds())?Yt:Ft;else t:for(let o=0;o<i;o++){let i=s[o],l=i.getPropertyIds();if(a.addAll(l))if(!e||i instanceof Z||i instanceof nt||i instanceof st||!e.animation.hasTimeline(l))n[o]=Mt;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){n[o]=Xt,r[o]=s;continue t}break}n[o]=Yt}else n[o]=It}}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()}},Ct=kt;Ct._emptyAnimation=new F("<empty>",[],0);var St=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.mixAttachmentThreshold=0,this.alphaAttachmentThreshold=0,this.mixDrawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this._mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=2,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}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}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}},At=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(Tt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Tt.interrupt),this.objects.push(t)}end(t){this.objects.push(Tt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Tt.dispose),this.objects.push(t)}complete(t){this.objects.push(Tt.complete),this.objects.push(t)}event(t,e){this.objects.push(Tt.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],n=t[s+1];switch(i){case Tt.start:n.listener&&n.listener.start&&n.listener.start(n);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(n)}break;case Tt.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(n)}break;case Tt.end:n.listener&&n.listener.end&&n.listener.end(n);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(n)}case Tt.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(n)}this.animState.trackEntryPool.free(n);break;case Tt.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(n)}break;case Tt.event:let i=t[2+s++];n.listener&&n.listener.event&&n.listener.event(n,i);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(n,i)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Tt=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(Tt||{}),It=0,Mt=1,Ft=2,Yt=3,Xt=4,Pt=1,Bt=2,Rt=class{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(i,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return void 0===i?this.defaultMix:i}},Et=class extends S{constructor(t){super(t),this.color=new m(1,1,1,1)}copy(){let t=new Et(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Dt=class extends S{constructor(t){super(t),this.endSlot=null,this.color=new m(.2275,.2275,.8078,1)}copy(){let t=new Dt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Vt=class{constructor(t){this._image=t}getImage(){return this._image}},Lt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(Lt||{}),Ot=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(Ot||{}),_t=class{constructor(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.degrees=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0}},Ut=class{constructor(t){this.pages=new Array,this.regions=new Array;let e=new Nt(t),s=new Array(4),i={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=b.enumValue(Lt,s[1]),t.magFilter=b.enumValue(Lt,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=10497),-1!=s[1].indexOf("y")&&(t.vWrap=10497)},pma:t=>{t.pma="true"==s[1]}};var n={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 r=e.readLine();for(;r&&0==r.trim().length;)r=e.readLine();for(;r&&0!=r.trim().length&&0!=e.readEntry(s,r);)r=e.readLine();let a=null,o=null,l=null;for(;null!==r;)if(0==r.trim().length)a=null,r=e.readLine();else if(a){let t=new Wt(a,r);for(;;){let i=e.readEntry(s,r=e.readLine());if(0==i)break;let a=n[s[0]];if(a)a(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<i;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=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 qt(r.trim());0!=e.readEntry(s,r=e.readLine());){let t=i[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(){var t;for(let e=0;e<this.pages.length;e++)null==(t=this.pages[e].texture)||t.dispose()}},Nt=class{constructor(t){this.index=0,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 i=1,n=s+1;;i++){let s=e.indexOf(",",n);if(-1==s)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,s-n).trim(),n=s+1,4==i)return 4}}},qt=class{constructor(t){this.minFilter=9728,this.magFilter=9728,this.uWrap=33071,this.vWrap=33071,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.regions=new Array,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}},Wt=class extends _t{constructor(t,e){super(),this.x=0,this.y=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.index=0,this.degrees=0,this.names=null,this.values=null,this.page=t,this.name=e,t.regions.push(this)}},zt=class extends S{constructor(t,e){super(t),this.region=null,this.regionUVs=[],this.uvs=[],this.triangles=[],this.color=new m(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new m(0,0,0,0),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=b.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,n=this.region.v,r=0,a=0;if(this.region instanceof Wt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:i-=(o.originalHeight-o.offsetY-o.height)/h,n-=(o.originalWidth-o.offsetX-o.width)/c,r=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+t[o+1]*r,e[o+1]=n+(1-t[o])*a;return;case 180:i-=(o.originalWidth-o.offsetX-o.width)/h,n-=o.offsetY/c,r=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o])*r,e[o+1]=n+(1-t[o+1])*a;return;case 270:i-=o.offsetY/h,n-=o.offsetX/c,r=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o+1])*r,e[o+1]=n+t[o]*a;return}i-=o.offsetX/h,n-=(o.originalHeight-o.offsetY-o.height)/c,r=o.originalWidth/h,a=o.originalHeight/c}else this.region?(r=this.region.u2-i,a=this.region.v2-n):(i=n=0,r=a=1);for(let o=0;o<s;o+=2)e[o]=i+t[o]*r,e[o+1]=n+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 zt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),b.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),b.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),b.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),b.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,r){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,r)}newLinkedMesh(){let t=new zt(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}},Gt=class extends S{constructor(t){super(t),this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new m(1,1,1,1)}copy(){let t=new Gt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),b.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},$t=class extends S{constructor(t){super(t),this.x=0,this.y=0,this.rotation=0,this.color=new m(.38,.94,0,1)}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*g.degRad,s=Math.cos(e),i=Math.sin(e),n=s*t.a+i*t.b,r=s*t.c+i*t.d;return g.atan2Deg(r,n)}copy(){let t=new $t(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},jt=class extends k{constructor(t,e){super(t),this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new m(1,1,1,1),this.region=null,this.sequence=null,this.offset=b.newFloatArray(8),this.uvs=b.newFloatArray(8),this.tempColor=new m(1,1,1,1),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,i=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,r=-this.height/2*this.scaleY+this.region.offsetY*i,a=n+this.region.width*s,o=r+this.region.height*i,l=this.rotation*g.degRad,h=Math.cos(l),c=Math.sin(l),d=this.x,u=this.y,m=n*h+d,f=n*c,p=r*h+u,x=r*c,w=a*h+d,b=a*c,y=o*h+u,v=o*c,k=this.offset;k[0]=m-x,k[1]=p+f,k[2]=m-v,k[3]=y+f,k[4]=w-v,k[5]=y+b,k[6]=w-x,k[7]=p+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,i){null!=this.sequence&&this.sequence.apply(t,this);let n=t.bone,r=this.offset,a=n.worldX,o=n.worldY,l=n.a,h=n.b,c=n.c,d=n.d,u=0,m=0;u=r[0],m=r[1],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[2],m=r[3],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[4],m=r[5],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[6],m=r[7],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o}copy(){let t=new jt(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,b.arrayCopy(this.uvs,0,t.uvs,0,8),b.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}},Ht=jt;Ht.X1=0,Ht.Y1=1,Ht.C1R=2,Ht.C1G=3,Ht.C1B=4,Ht.C1A=5,Ht.U1=6,Ht.V1=7,Ht.X2=8,Ht.Y2=9,Ht.C2R=10,Ht.C2G=11,Ht.C2B=12,Ht.C2A=13,Ht.U2=14,Ht.V2=15,Ht.X3=16,Ht.Y3=17,Ht.C3R=18,Ht.C3G=19,Ht.C3B=20,Ht.C3A=21,Ht.U3=22,Ht.V3=23,Ht.X4=24,Ht.Y4=25,Ht.C4R=26,Ht.C4G=27,Ht.C4B=28,Ht.C4A=29,Ht.U4=30,Ht.V4=31;var Jt=class{constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let n=0,r=i.length;n<r;n++){let r=s.getPath(e,n),a=this.atlas.findRegion(r);if(null==a)throw new Error("Region not found in atlas: "+r+" (sequence: "+t+")");i[n]=a}}newRegionAttachment(t,e,s,i){let n=new Ht(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=t}return n}newMeshAttachment(t,e,s,i){let n=new zt(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=t}return n}newBoundingBoxAttachment(t,e){return new Et(e)}newPathAttachment(t,e){return new Gt(e)}newPointAttachment(t,e){return new $t(e)}newClippingAttachment(t,e){return new Dt(e)}},Kt=class{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.inherit=Qt.Normal,this.skinRequired=!1,this.color=new m,this.visible=!1,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}},Qt=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(Qt||{}),Zt=class{constructor(t,e,s){if(this.parent=null,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.inherit=0,this.sorted=!1,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,n,r,a){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=r,this.ashearY=a;let o=this.parent;if(!o){let o=this.skeleton;const l=o.scaleX,h=o.scaleY,c=(s+r)*g.degRad,d=(s+90+a)*g.degRad;return this.a=Math.cos(c)*i*l,this.b=Math.cos(d)*n*l,this.c=Math.sin(c)*i*h,this.d=Math.sin(d)*n*h,this.worldX=t*l+o.x,void(this.worldY=e*h+o.y)}let l=o.a,h=o.b,c=o.c,d=o.d;switch(this.worldX=l*t+h*e+o.worldX,this.worldY=c*t+d*e+o.worldY,this.inherit){case 0:{const t=(s+r)*g.degRad,e=(s+90+a)*g.degRad,o=Math.cos(t)*i,u=Math.cos(e)*n,m=Math.sin(t)*i,f=Math.sin(e)*n;return this.a=l*o+h*m,this.b=l*u+h*f,this.c=c*o+d*m,void(this.d=c*u+d*f)}case 1:{const t=(s+r)*g.degRad,e=(s+90+a)*g.degRad;this.a=Math.cos(t)*i,this.b=Math.cos(e)*n,this.c=Math.sin(t)*i,this.d=Math.sin(e)*n;break}case 2:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;l*=t,c*=e;let o=l*l+c*c,u=0;o>1e-4?(o=Math.abs(l*d*e-h*t*c)/o,h=c*o,d=l*o,u=Math.atan2(c,l)*g.radDeg):(l=0,c=0,u=90-Math.atan2(d,h)*g.radDeg);const m=(s+r-u)*g.degRad,f=(s+a-u+90)*g.degRad,p=Math.cos(m)*i,x=Math.cos(f)*n,w=Math.sin(m)*i,b=Math.sin(f)*n;this.a=l*p-h*w,this.b=l*x-h*b,this.c=c*p+d*w,this.d=c*x+d*b;break}case 3:case 4:{s*=g.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(l*t+h*e)/this.skeleton.scaleX,u=(c*t+d*e)/this.skeleton.scaleY,m=Math.sqrt(o*o+u*u);m>1e-5&&(m=1/m),o*=m,u*=m,m=Math.sqrt(o*o+u*u),3==this.inherit&&l*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(u,o);const f=Math.cos(s)*m,p=Math.sin(s)*m;r*=g.degRad,a=(90+a)*g.degRad;const x=Math.cos(r)*i,w=Math.cos(a)*n,b=Math.sin(r)*i,y=Math.sin(a)*n;this.a=o*x+f*b,this.b=o*w+f*y,this.c=u*x+p*b,this.d=u*w+p*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)*g.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)*g.radDeg);let e,s,i,n,r=t.a,a=t.b,o=t.c,l=t.d,h=1/(r*l-a*o),c=l*h,d=a*h,u=o*h,m=r*h,f=this.worldX-t.worldX,p=this.worldY-t.worldY;if(this.ax=f*c-p*d,this.ay=p*m-f*u,1==this.inherit)e=this.a,s=this.b,i=this.c,n=this.d;else{switch(this.inherit){case 2:{let t=Math.abs(r*l-a*o)/(r*r+o*o);a=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,l=r*this.skeleton.scaleY*t/this.skeleton.scaleX,h=1/(r*l-a*o),c=l*h,d=a*h;break}case 3:case 4:let t=g.cosDeg(this.rotation),e=g.sinDeg(this.rotation);r=(r*t+a*e)/this.skeleton.scaleX,o=(o*t+l*e)/this.skeleton.scaleY;let s=Math.sqrt(r*r+o*o);s>1e-5&&(s=1/s),r*=s,o*=s,s=Math.sqrt(r*r+o*o),3==this.inherit&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let i=g.PI/2+Math.atan2(o,r);a=Math.cos(i)*s,l=Math.sin(i)*s,h=1/(r*l-a*o),c=l*h,d=a*h,u=o*h,m=r*h}e=c*this.a-d*this.c,s=c*this.b-d*this.d,i=m*this.c-u*this.a,n=m*this.d-u*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+i*i),this.ascaleX>1e-4){let t=e*n-s*i;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+i*n,t)*g.radDeg,this.arotation=Math.atan2(i,e)*g.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+n*n),this.ashearY=0,this.arotation=90-Math.atan2(n,s)*g.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*g.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*g.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(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=g.sinDeg(t),s=g.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*g.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=g.sinDeg(t),s=g.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*g.radDeg}rotateWorld(t){t*=g.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,n=this.b;this.a=s*i-e*this.c,this.b=s*n-e*this.d,this.c=e*i+s*this.c,this.d=e*n+s*this.d}},te=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},ee=class{constructor(){this.callbacks={},this.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,i=new Uint8Array(s),n=0;n<s;n++)i[n]=e.charCodeAt(n);return i}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 i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",t,!0);let n=()=>{this.finish(t,i.status,i.responseText)};i.onload=n,i.onerror=n,i.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 i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer";let n=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{200==i.status||0==i.status?this.finish(t,200,new Uint8Array(i.response)):n()},i.onerror=n,i.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let n=200==e||0==e?[s]:[e,s];for(let t=n.length-1,e=i.length;t<e;t+=2)i[t].apply(null,n)}},se=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},ie=class{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}},ne=class{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!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 i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(i)}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,i,n,r,a){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let l=o.a,h=o.b,c=o.c,d=o.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case 1:m=(e-t.worldX)*g.signum(t.skeleton.scaleX),f=(s-t.worldY)*g.signum(t.skeleton.scaleY);break;case 2:let i=Math.abs(l*d-h*c)/Math.max(1e-4,l*l+c*c),n=l/t.skeleton.scaleX,r=c/t.skeleton.scaleY;h=-r*i*t.skeleton.scaleX,d=n*i*t.skeleton.scaleY,u+=Math.atan2(r,n)*g.radDeg;default:let a=e-o.worldX,p=s-o.worldY,x=l*d-h*c;Math.abs(x)<=1e-4?(m=0,f=0):(m=(a*d-p*h)/x-t.ax,f=(p*l-a*c)/x-t.ay)}u+=Math.atan2(f,m)*g.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let p=t.ascaleX,x=t.ascaleY;if(i||n){switch(t.inherit){case 3:case 4:m=e-t.worldX,f=s-t.worldY}const o=t.data.length*p;if(o>1e-4){const t=m*m+f*f;if(i&&t<o*o||n&&t>o*o){const e=(Math.sqrt(t)/o-1)*a+1;p*=e,r&&(x*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*a,p,x,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,r,a,o,l){if(0!=t.inherit||0!=e.inherit)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,p=e.ascaleX,x=0,w=0,b=0;d<0?(d=-d,x=180,b=-1):(x=0,b=1),u<0&&(u=-u,b=-b),p<0?(p=-p,w=180):w=0;let y=e.ax,v=0,k=0,C=0,S=t.a,A=t.b,T=t.c,I=t.d,M=Math.abs(d-u)<=1e-4;!M||r?(v=0,k=S*y+t.worldX,C=T*y+t.worldY):(v=e.ay,k=S*y+A*v+t.worldX,C=T*y+I*v+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,A=F.b,T=F.c,I=F.d;let Y=S*I-A*T,X=k-F.worldX,P=C-F.worldY;Y=Math.abs(Y)<=1e-4?0:1/Y;let B,R,E=(X*I-P*A)*Y-h,D=(P*S-X*T)*Y-c,V=Math.sqrt(E*E+D*D),L=e.data.length*p;if(V<1e-4)return this.apply1(t,s,i,!1,r,!1,l),void e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);X=s-F.worldX,P=i-F.worldY;let O=(X*I-P*A)*Y-h,_=(P*S-X*T)*Y-c,U=O*O+_*_;if(0!=o){o*=d*(p+1)*.5;let t=Math.sqrt(U),e=t-V-L*d+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,O-=s*O,_-=s*_,U=O*O+_*_}}t:if(M){L*=d;let t=(U-V*V-L*L)/(2*V*L);t<-1?(t=-1,R=Math.PI*n):t>1?(t=1,R=0,r&&(S=(Math.sqrt(U)/(V+L)-1)*l+1,m*=S,a&&(f*=S))):R=Math.acos(t)*n,S=V+L*t,A=L*Math.sin(R),B=Math.atan2(_*S-O*A,O*S+_*A)}else{S=d*L,A=u*L;let t=S*S,e=A*A,s=Math.atan2(_,O);T=e*V*V+t*U-t*e;let i=-2*e*V,r=e-t;if(I=i*i-4*r*T,I>=0){let t=Math.sqrt(I);i<0&&(t=-t),t=.5*-(i+t);let e=t/r,a=T/t,o=Math.abs(e)<Math.abs(a)?e:a;if(e=U-o*o,e>=0){P=Math.sqrt(e)*n,B=s-Math.atan2(P,o),R=Math.atan2(P/u,(o-V)/d);break t}}let a=g.PI,o=V-S,l=o*o,h=0,c=0,m=V+S,f=m*m,p=0;T=-S*V/(t-e),T>=-1&&T<=1&&(T=Math.acos(T),X=S*Math.cos(T)+V,P=A*Math.sin(T),I=X*X+P*P,I<l&&(a=T,l=I,o=X,h=P),I>f&&(c=T,f=I,m=X,p=P)),U<=.5*(l+f)?(B=s-Math.atan2(h*n,o),R=a*n):(B=s-Math.atan2(p*n,m),R=c*n)}let N=Math.atan2(v,y)*b,q=t.arotation;B=(B-N)*g.radDeg+x-q,B>180?B-=360:B<-180&&(B+=360),t.updateWorldTransformWith(h,c,q+B*l,m,f,0,0),q=e.arotation,R=((R+N)*g.radDeg-e.ashearX)*b+w-q,R>180?R-=360:R<-180&&(R+=360),e.updateWorldTransformWith(y,v,q+R*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},re=class extends te{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=0,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=0,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},ae=class extends te{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=oe.Fixed,this.spacingMode=le.Fixed,this.rotateMode=he.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}},oe=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(oe||{}),le=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(le||{}),he=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(he||{}),ce=class{constructor(t,e){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!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,i=t.bones.length;s<i;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}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 Gt))return;let s=this.mixRotate,i=this.mixX,n=this.mixY;if(0==s&&0==i&&0==n)return;let r=this.data,a=0==r.rotateMode,o=2==r.rotateMode,l=this.bones,h=l.length,c=a?h:h+1,d=b.setArraySize(this.spaces,c),u=o?this.lengths=b.setArraySize(this.lengths,h):[],m=this.spacing;switch(r.spacingMode){case 2:if(o)for(let t=0,e=c-1;t<e;t++){let e=l[t],s=e.data.length,i=s*e.a,n=s*e.c;u[t]=Math.sqrt(i*i+n*n)}b.arrayFill(d,1,c,m);break;case 3:let t=0;for(let e=0,s=c-1;e<s;){let s=l[e],i=s.data.length;if(i<ce.epsilon)o&&(u[e]=0),d[++e]=m;else{let n=i*s.a,r=i*s.c,a=Math.sqrt(n*n+r*r);o&&(u[e]=a),d[++e]=a,t+=a}}if(t>0){t=c/t*m;for(let e=1;e<c;e++)d[e]*=t}break;default:let e=0==r.spacingMode;for(let t=0,s=c-1;t<s;){let s=l[t],i=s.data.length;if(i<ce.epsilon)o&&(u[t]=0),d[++t]=m;else{let n=i*s.a,r=i*s.c,a=Math.sqrt(n*n+r*r);o&&(u[t]=a),d[++t]=(e?i+m:m)*a/i}}}let f=this.computeWorldPositions(e,c,a),p=f[0],x=f[1],w=r.offsetRotation,y=!1;if(0==w)y=1==r.rotateMode;else{y=!1;let t=this.target.bone;w*=t.a*t.d-t.b*t.c>0?g.degRad:-g.degRad}for(let t=0,e=3;t<h;t++,e+=3){let r=l[t];r.worldX+=(p-r.worldX)*i,r.worldY+=(x-r.worldY)*n;let h=f[e],c=f[e+1],m=h-p,b=c-x;if(o){let e=u[t];if(0!=e){let t=(Math.sqrt(m*m+b*b)/e-1)*s+1;r.a*=t,r.c*=t}}if(p=h,x=c,s>0){let i=r.a,n=r.b,o=r.c,l=r.d,h=0,c=0,u=0;if(h=a?f[e-1]:0==d[t+1]?f[e+2]:Math.atan2(b,m),h-=Math.atan2(o,i),y){c=Math.cos(h),u=Math.sin(h);let t=r.data.length;p+=(t*(c*i-u*o)-m)*s,x+=(t*(u*i+c*o)-b)*s}else h+=w;h>g.PI?h-=g.PI2:h<-g.PI&&(h+=g.PI2),h*=s,c=Math.cos(h),u=Math.sin(h),r.a=c*i-u*o,r.b=c*n-u*l,r.c=u*i+c*o,r.d=u*n+c*l}r.updateAppliedTransform()}}computeWorldPositions(t,e,s){let i=this.target,n=this.position,r=this.spaces,a=b.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=ce.NONE;if(!t.constantSpeed){let u=t.lengths;c-=l?1:2;let m,f=u[c];switch(1==this.data.positionMode&&(n*=f),this.data.spacingMode){case 2:m=f;break;case 3:m=f/e;break;default:m=1}o=b.setArraySize(this.world,8);for(let g=0,p=0,x=0;g<e;g++,p+=3){let e=r[g]*m;n+=e;let w=n;if(l)w%=f,w<0&&(w+=f),x=0;else{if(w<0){d!=ce.BEFORE&&(d=ce.BEFORE,t.computeWorldVertices(i,2,4,o,0,2)),this.addBeforePosition(w,o,0,a,p);continue}if(w>f){d!=ce.AFTER&&(d=ce.AFTER,t.computeWorldVertices(i,h-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,a,p);continue}}for(;;x++){let t=u[x];if(!(w>t)){if(0==x)w/=t;else{let e=u[x-1];w=(w-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(i,h-4,4,o,0,2),t.computeWorldVertices(i,0,4,o,4,2)):t.computeWorldVertices(i,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,p,s||g>0&&0==e)}return a}l?(h+=2,o=b.setArraySize(this.world,h),t.computeWorldVertices(i,2,h-4,o,0,2),t.computeWorldVertices(i,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=b.setArraySize(this.world,h),t.computeWorldVertices(i,2,h,o,0,2));let u,m=b.setArraySize(this.curves,c),f=0,g=o[0],p=o[1],x=0,w=0,y=0,v=0,k=0,C=0,S=0,A=0,T=0,I=0,M=0,F=0,Y=0,X=0;for(let t=0,e=2;t<c;t++,e+=6)x=o[e],w=o[e+1],y=o[e+2],v=o[e+3],k=o[e+4],C=o[e+5],S=.1875*(g-2*x+y),A=.1875*(p-2*w+v),T=.09375*(3*(x-y)-g+k),I=.09375*(3*(w-v)-p+C),M=2*S+T,F=2*A+I,Y=.75*(x-g)+S+.16666667*T,X=.75*(w-p)+A+.16666667*I,f+=Math.sqrt(Y*Y+X*X),Y+=M,X+=F,M+=T,F+=I,f+=Math.sqrt(Y*Y+X*X),Y+=M,X+=F,f+=Math.sqrt(Y*Y+X*X),Y+=M+T,X+=F+I,f+=Math.sqrt(Y*Y+X*X),m[t]=f,g=k,p=C;switch(1==this.data.positionMode&&(n*=f),this.data.spacingMode){case 2:u=f;break;case 3:u=f/e;break;default:u=1}let P=this.segments,B=0;for(let t=0,i=0,c=0,b=0;t<e;t++,i+=3){let e=r[t]*u;n+=e;let R=n;if(l)R%=f,R<0&&(R+=f),c=0;else{if(R<0){this.addBeforePosition(R,o,0,a,i);continue}if(R>f){this.addAfterPosition(R-f,o,h-4,a,i);continue}}for(;;c++){let t=m[c];if(!(R>t)){if(0==c)R/=t;else{let e=m[c-1];R=(R-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(g=o[t],p=o[t+1],x=o[t+2],w=o[t+3],y=o[t+4],v=o[t+5],k=o[t+6],C=o[t+7],S=.03*(g-2*x+y),A=.03*(p-2*w+v),T=.006*(3*(x-y)-g+k),I=.006*(3*(w-v)-p+C),M=2*S+T,F=2*A+I,Y=.3*(x-g)+S+.16666667*T,X=.3*(w-p)+A+.16666667*I,B=Math.sqrt(Y*Y+X*X),P[0]=B,t=1;t<8;t++)Y+=M,X+=F,M+=T,F+=I,B+=Math.sqrt(Y*Y+X*X),P[t]=B;Y+=M,X+=F,B+=Math.sqrt(Y*Y+X*X),P[8]=B,Y+=M+T,X+=F+I,B+=Math.sqrt(Y*Y+X*X),P[9]=B,b=0}for(R*=B;;b++){let t=P[b];if(!(R>t)){if(0==b)R/=t;else{let e=P[b-1];R=b+(R-e)/(t-e)}break}}this.addCurvePosition(.1*R,g,p,x,w,y,v,k,C,a,i,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,i,n){let r=e[s],a=e[s+1],o=e[s+2]-r,l=e[s+3]-a,h=Math.atan2(l,o);i[n]=r+t*Math.cos(h),i[n+1]=a+t*Math.sin(h),i[n+2]=h}addAfterPosition(t,e,s,i,n){let r=e[s+2],a=e[s+3],o=r-e[s],l=a-e[s+1],h=Math.atan2(l,o);i[n]=r+t*Math.cos(h),i[n+1]=a+t*Math.sin(h),i[n+2]=h}addCurvePosition(t,e,s,i,n,r,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(n-s,i-e));let u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,w=3*x,b=f*w,y=w*t,v=e*p+i*b+r*y+o*m,k=s*p+n*b+a*y+l*m;h[c]=v,h[c+1]=k,d&&(h[c+2]=t<.001?Math.atan2(n-s,i-e):Math.atan2(k-(s*g+n*x*2+a*u),v-(e*g+i*x*2+r*u)))}},de=ce;de.NONE=-1,de.BEFORE=-2,de.AFTER=-3,de.epsilon=1e-5;var ue=class{constructor(t,e){this._bone=null,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this._reset=!0,this.ux=0,this.uy=0,this.cx=0,this.cy=0,this.tx=0,this.ty=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,this.active=!1,this.remaining=0,this.lastTime=0,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}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}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,i=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,r=this.data.scaleX>0,a=this.bone,o=a.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const t=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=t.time;const h=a.worldX,c=a.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=c;else{let d=this.remaining,u=this.inertia,m=this.data.step,f=this.skeleton.data.referenceScale,p=-1,x=this.data.limit*l,w=x*Math.abs(t.scaleY);if(x*=Math.abs(t.scaleX),s||i){if(s){const t=(this.ux-h)*u;this.xOffset+=t>x?x:t<-x?-x:t,this.ux=h}if(i){const t=(this.uy-c)*u;this.yOffset+=t>w?w:t<-w?-w:t,this.uy=c}if(d>=m){p=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,n=this.wind*f,r=(pe.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(n-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=p),i&&(this.yVelocity-=(r+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=p),d-=m}while(d>=m)}s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n||r){let t=Math.atan2(a.c,a.a),s=0,i=0,l=0,h=this.cx-a.worldX,c=this.cy-a.worldY;if(h>x?h=x:h<-x&&(h=-x),c>w?c=w:c<-w&&(c=-w),n){l=(this.data.rotate+this.data.shearX)*e;let n=Math.atan2(c+this.ty,h+this.tx)-t-this.rotateOffset*l;this.rotateOffset+=(n-Math.ceil(n*g.invPI2-.5)*g.PI2)*u,n=this.rotateOffset*l+t,s=Math.cos(n),i=Math.sin(n),r&&(n=o*a.getWorldScaleX(),n>0&&(this.scaleOffset+=(h*s+c*i)*u/n))}else{s=Math.cos(t),i=Math.sin(t);const e=o*a.getWorldScaleX();e>0&&(this.scaleOffset+=(h*s+c*i)*u/e)}if(d=this.remaining,d>=m){-1==p&&(p=Math.pow(this.damping,60*m));const e=this.massInverse*m,a=this.strength,h=this.wind,c=pe.yDown?-this.gravity:this.gravity,u=o/f;for(;;)if(d-=m,r&&(this.scaleVelocity+=(h*s-c*i-this.scaleOffset*a)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=p),n){if(this.rotateVelocity-=((h*i+c*s)*u+this.rotateOffset*a)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=p,d<m)break;const n=this.rotateOffset*l+t;s=Math.cos(n),i=Math.sin(n)}else if(d<m)break}}this.remaining=d}this.cx=a.worldX,this.cy=a.worldY;break;case 3:s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n){let t=this.rotateOffset*e,s=0,i=0,n=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),i=Math.cos(e),n=a.b,a.b=i*n-s*a.d,a.d=s*n+i*a.d),e+=t*this.data.shearX,s=Math.sin(e),i=Math.cos(e),n=a.a,a.a=i*n-s*a.c,a.c=s*n+i*a.c}else t*=this.data.rotate,s=Math.sin(t),i=Math.cos(t),n=a.a,a.a=i*n-s*a.c,a.c=s*n+i*a.c,n=a.b,a.b=i*n-s*a.d,a.d=s*n+i*a.d}if(r){const t=1+this.scaleOffset*e*this.data.scaleX;a.a*=t,a.c*=t}3!=t&&(this.tx=o*a.a,this.ty=o*a.c),a.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*g.degRad,n=Math.cos(i),r=Math.sin(i),a=this.cx-t,o=this.cy-e;this.translate(a*n-o*r-a,a*r+o*n-o)}},me=class{constructor(t,e){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!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 m,this.darkColor=t.darkColor?new m:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof S&&this.attachment instanceof S&&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}},fe=class{constructor(t,e){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new v,this.active=!1,!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 i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}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,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?g.degRad:-g.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let u=0,x=p.length;u<x;u++){let x=p[u];if(0!=t){let e=x.a,s=x.b,i=x.c,n=x.d,r=Math.atan2(c,l)-Math.atan2(i,e)+m;r>g.PI?r-=g.PI2:r<-g.PI&&(r+=g.PI2),r*=t;let a=Math.cos(r),o=Math.sin(r);x.a=a*e-o*i,x.b=a*s-o*n,x.c=o*e+a*i,x.d=o*s+a*n}if(a){let t=this.temp;o.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!=i){let t=Math.sqrt(x.a*x.a+x.c*x.c);0!=t&&(t=(t+(Math.sqrt(l*l+c*c)-t+this.data.offsetScaleX)*i)/t),x.a*=t,x.c*=t}if(0!=n){let t=Math.sqrt(x.b*x.b+x.d*x.d);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleY)*n)/t),x.b*=t,x.d*=t}if(r>0){let t=x.b,e=x.d,s=Math.atan2(e,t),i=Math.atan2(d,h)-Math.atan2(c,l)-(s-Math.atan2(x.c,x.a));i>g.PI?i-=g.PI2:i<-g.PI&&(i+=g.PI2),i=s+(i+f)*r;let n=Math.sqrt(t*t+e*e);x.b=Math.cos(i)*n,x.d=Math.sin(i)*n}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?g.degRad:-g.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones;for(let u=0,x=p.length;u<x;u++){let x=p[u];if(0!=t){let e=x.a,s=x.b,i=x.c,n=x.d,r=Math.atan2(c,l)+m;r>g.PI?r-=g.PI2:r<-g.PI&&(r+=g.PI2),r*=t;let a=Math.cos(r),o=Math.sin(r);x.a=a*e-o*i,x.b=a*s-o*n,x.c=o*e+a*i,x.d=o*s+a*n}if(a){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.worldX+=t.x*e,x.worldY+=t.y*s}if(0!=i){let t=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*i+1;x.a*=t,x.c*=t}if(0!=n){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*n+1;x.b*=t,x.d*=t}if(r>0){let t=Math.atan2(d,h)-Math.atan2(c,l);t>g.PI?t-=g.PI2:t<-g.PI&&(t+=g.PI2);let e=x.b,s=x.d;t=Math.atan2(s,e)+(t-g.PI/2+f)*r;let i=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*i,x.d=Math.sin(t)*i}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=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 m=h.ascaleX,f=h.ascaleY;0!=i&&0!=m&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*i)/m),0!=n&&0!=f&&(f=(f+(a.ascaleY-f+this.data.offsetScaleY)*n)/f);let g=h.ashearY;0!=r&&(g+=(a.ashearY-g+this.data.offsetShearY)*r),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=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,m=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*i+1),f=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),g=h.ashearY+(a.ashearY+this.data.offsetShearY)*r;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}},ge=class{constructor(t){if(this._updateCache=new Array,this.skin=null,this.scaleX=1,this._scaleY=1,this.x=0,this.y=0,this.time=0,!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,i=t.bones[e];if(i.parent){let t=this.bones[i.parent.index];s=new Zt(i,this,t),t.children.push(s)}else s=new Zt(i,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],i=this.bones[s.boneData.index],n=new me(s,i);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new ne(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new fe(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new de(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new ue(s,this))}this.color=new m(1,1,1,1),this.updateCache()}get scaleY(){return ge.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}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,i=this.pathConstraints,n=this.physicsConstraints,r=e.length,a=s.length,o=i.length,l=this.physicsConstraints.length,h=r+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<r;s++){let i=e[s];if(i.data.order==t){this.sortIkConstraint(i);continue t}}for(let e=0;e<a;e++){let i=s[e];if(i.data.order==t){this.sortTransformConstraint(i);continue t}}for(let e=0;e<o;e++){let s=i[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=n[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&&b.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,i=s[0];if(this.sortBone(i),1==s.length)this._updateCache.push(t),this.sortReset(i.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(i.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&b.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,i=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,i);let n=e.getAttachment();n instanceof Gt&&this.sortPathConstraintAttachmentWith(n,i);let r=t.bones,a=r.length;for(let t=0;t<a;t++)this.sortBone(r[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(r[t].children);for(let t=0;t<a;t++)r[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&b.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 i=t.attachments[e];if(i)for(let t in i)this.sortPathConstraintAttachmentWith(i[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof Gt))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,i=s.length;e<i;){let i=s[e++];for(i+=e;e<i;)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&&b.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,i=s.length;e<i;e++)s[e].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let s=this.bones;for(let t=1,e=s.length;t<e;t++){let e=s[t];e.ax=e.x,e.ay=e.y,e.arotation=e.rotation,e.ascaleX=e.scaleX,e.ascaleY=e.scaleY,e.ashearX=e.shearX,e.ashearY=e.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let n=e.a,r=e.b,a=e.c,o=e.d;i.worldX=n*this.x+r*this.y+e.worldX,i.worldY=a*this.x+o*this.y+e.worldY;const l=(i.rotation+i.shearX)*g.degRad,h=(i.rotation+90+i.shearY)*g.degRad,c=Math.cos(l)*i.scaleX,d=Math.cos(h)*i.scaleY,u=Math.sin(l)*i.scaleX,m=Math.sin(h)*i.scaleY;i.a=(n*c+r*u)*this.scaleX,i.b=(n*d+r*m)*this.scaleX,i.c=(a*c+o*u)*this.scaleY,i.d=(a*d+o*m)*this.scaleY;let f=this._updateCache;for(let e=0,s=f.length;e<s;e++){let s=f[e];s!=i&&s.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;b.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,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}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,i=e.length;s<i;s++){let i=e[s],n=i.data.attachmentName;if(n){let e=t.getAttachment(s,n);e&&i.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 i=0,n=s.length;i<n;i++){let n=s[i];if(n.data.name==t){let s=null;if(e&&(s=this.getAttachment(i,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void n.setAttachment(s)}}throw new Error("Slot not found: "+t)}findIkConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return null!=(e=this.ikConstraints.find((e=>e.data.name==t)))?e:null}findTransformConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return null!=(e=this.transformConstraints.find((e=>e.data.name==t)))?e:null}findPathConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return null!=(e=this.pathConstraints.find((e=>e.data.name==t)))?e:null}findPhysicsConstraint(t){var e;if(null==t)throw new Error("constraintName cannot be null.");return null!=(e=this.physicsConstraints.find((e=>e.data.name==t)))?e:null}getBoundsRect(){let t=new v,e=new v;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,r=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=n.length;t<e;t++){let e=n[t];if(!e.bone.active)continue;let h=0,c=null,d=null,u=e.getAttachment();if(u instanceof Ht)h=8,c=b.setArraySize(s,h,0),u.computeWorldVertices(e,c,0,2),d=ge.quadTriangles;else if(u instanceof zt){let t=u;h=t.worldVerticesLength,c=b.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(u instanceof Dt&&null!=i){i.clipStart(e,u);continue}if(c&&d){null!=i&&i.isClipping()&&(i.clipTriangles(c,d,d.length),c=i.clippedVertices,h=i.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];r=Math.min(r,e),a=Math.min(a,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=i&&i.clipEndWithSlot(e)}null!=i&&i.clipEnd(),t.set(r,a),e.set(o-r,l-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let i=0,n=s.length;i<n;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physicsConstraints;for(let n=0,r=i.length;n<r;n++)i[n].rotate(t,e,s)}},pe=ge;pe.quadTriangles=[0,1,2,2,3,0],pe.yDown=!1;var xe=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(xe||{}),we=class extends te{constructor(t){super(t,0,!1),this._bone=null,this.x=0,this.y=0,this.rotate=0,this.scaleX=0,this.shearX=0,this.limit=0,this.step=0,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this.inertiaGlobal=!1,this.strengthGlobal=!1,this.dampingGlobal=!1,this.massGlobal=!1,this.windGlobal=!1,this.gravityGlobal=!1,this.mixGlobal=!1}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}},be=class{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.physicsConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.referenceScale=100,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}},ye=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},ve=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,this.color=new m(.99607843,.61960787,.30980393,1),!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||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],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||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 zt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let n=s[i];n&&t.push(new ye(e,i,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let n=s[i];n&&e.push(new ye(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let n=t.slots[i],r=n.getAttachment();if(r&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(r==t[e]){let t=this.getAttachment(s,e);t&&n.setAttachment(t);break}}}s++}}},ke=class{constructor(t,e,s){if(this.index=0,this.color=new m(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=Ce.Normal,this.visible=!0,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}},Ce=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Ce||{}),Se=class extends te{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},Ae=class{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){var e;let s=this.scale,i=new be;i.name="";let n=new Te(t),r=n.readInt32(),a=n.readInt32();i.hash=0==a&&0==r?null:a.toString(16)+r.toString(16),i.version=n.readString(),i.x=n.readFloat(),i.y=n.readFloat(),i.width=n.readFloat(),i.height=n.readFloat(),i.referenceScale=n.readFloat()*s;let o=n.readBoolean();o&&(i.fps=n.readFloat(),i.imagesPath=n.readString(),i.audioPath=n.readString());let l=0;l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("String in string table must not be null.");n.strings.push(t)}l=n.readInt(!0);for(let t=0;t<l;t++){let r=n.readString();if(!r)throw new Error("Bone name must not be null.");let a=0==t?null:i.bones[n.readInt(!0)],l=new Kt(t,r,a);l.rotation=n.readFloat(),l.x=n.readFloat()*s,l.y=n.readFloat()*s,l.scaleX=n.readFloat(),l.scaleY=n.readFloat(),l.shearX=n.readFloat(),l.shearY=n.readFloat(),l.length=n.readFloat()*s,l.inherit=n.readByte(),l.skinRequired=n.readBoolean(),o&&(m.rgba8888ToColor(l.color,n.readInt32()),l.icon=null!=(e=n.readString())?e:void 0,l.visible=n.readBoolean()),i.bones.push(l)}l=n.readInt(!0);for(let t=0;t<l;t++){let e=n.readString();if(!e)throw new Error("Slot name must not be null.");let s=i.bones[n.readInt(!0)],r=new ke(t,e,s);m.rgba8888ToColor(r.color,n.readInt32());let a=n.readInt32();-1!=a&&m.rgb888ToColor(r.darkColor=new m,a),r.attachmentName=n.readStringRef(),r.blendMode=n.readInt(!0),o&&(r.visible=n.readBoolean()),i.slots.push(r)}l=n.readInt(!0);for(let t,e=0;e<l;e++){let e=n.readString();if(!e)throw new Error("IK constraint data name must not be null.");let r=new re(e);r.order=n.readInt(!0),t=n.readInt(!0);for(let e=0;e<t;e++)r.bones.push(i.bones[n.readInt(!0)]);r.target=i.bones[n.readInt(!0)];let a=n.readByte();r.skinRequired=!!(1&a),r.bendDirection=2&a?1:-1,r.compress=!!(4&a),r.stretch=!!(8&a),r.uniform=!!(16&a),32&a&&(r.mix=64&a?n.readFloat():1),128&a&&(r.softness=n.readFloat()*s),i.ikConstraints.push(r)}l=n.readInt(!0);for(let t,e=0;e<l;e++){let e=n.readString();if(!e)throw new Error("Transform constraint data name must not be null.");let r=new Se(e);r.order=n.readInt(!0),t=n.readInt(!0);for(let e=0;e<t;e++)r.bones.push(i.bones[n.readInt(!0)]);r.target=i.bones[n.readInt(!0)];let a=n.readByte();r.skinRequired=!!(1&a),r.local=!!(2&a),r.relative=!!(4&a),8&a&&(r.offsetRotation=n.readFloat()),16&a&&(r.offsetX=n.readFloat()*s),32&a&&(r.offsetY=n.readFloat()*s),64&a&&(r.offsetScaleX=n.readFloat()),128&a&&(r.offsetScaleY=n.readFloat()),a=n.readByte(),1&a&&(r.offsetShearY=n.readFloat()),2&a&&(r.mixRotate=n.readFloat()),4&a&&(r.mixX=n.readFloat()),8&a&&(r.mixY=n.readFloat()),16&a&&(r.mixScaleX=n.readFloat()),32&a&&(r.mixScaleY=n.readFloat()),64&a&&(r.mixShearY=n.readFloat()),i.transformConstraints.push(r)}l=n.readInt(!0);for(let t,e=0;e<l;e++){let e=n.readString();if(!e)throw new Error("Path constraint data name must not be null.");let r=new ae(e);r.order=n.readInt(!0),r.skinRequired=n.readBoolean(),t=n.readInt(!0);for(let e=0;e<t;e++)r.bones.push(i.bones[n.readInt(!0)]);r.target=i.slots[n.readInt(!0)];const a=n.readByte();r.positionMode=1&a,r.spacingMode=a>>1&3,r.rotateMode=a>>3&3,128&a&&(r.offsetRotation=n.readFloat()),r.position=n.readFloat(),0==r.positionMode&&(r.position*=s),r.spacing=n.readFloat(),0!=r.spacingMode&&1!=r.spacingMode||(r.spacing*=s),r.mixRotate=n.readFloat(),r.mixX=n.readFloat(),r.mixY=n.readFloat(),i.pathConstraints.push(r)}l=n.readInt(!0);for(let t=0;t<l;t++){const t=n.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const e=new we(t);e.order=n.readInt(!0),e.bone=i.bones[n.readInt(!0)];let r=n.readByte();e.skinRequired=!!(1&r),2&r&&(e.x=n.readFloat()),4&r&&(e.y=n.readFloat()),8&r&&(e.rotate=n.readFloat()),16&r&&(e.scaleX=n.readFloat()),32&r&&(e.shearX=n.readFloat()),e.limit=(64&r?n.readFloat():5e3)*s,e.step=1/n.readUnsignedByte(),e.inertia=n.readFloat(),e.strength=n.readFloat(),e.damping=n.readFloat(),e.massInverse=128&r?n.readFloat():1,e.wind=n.readFloat(),e.gravity=n.readFloat(),r=n.readByte(),1&r&&(e.inertiaGlobal=!0),2&r&&(e.strengthGlobal=!0),4&r&&(e.dampingGlobal=!0),8&r&&(e.massGlobal=!0),16&r&&(e.windGlobal=!0),32&r&&(e.gravityGlobal=!0),64&r&&(e.mixGlobal=!0),e.mix=128&r?n.readFloat():1,i.physicsConstraints.push(e)}let h=this.readSkin(n,i,!0,o);h&&(i.defaultSkin=h,i.skins.push(h));{let t=i.skins.length;for(b.setArraySize(i.skins,l=t+n.readInt(!0));t<l;t++){let e=this.readSkin(n,i,!1,o);if(!e)throw new Error("readSkin() should not have returned null.");i.skins[t]=e}}l=this.linkedMeshes.length;for(let t=0;t<l;t++){let e=this.linkedMeshes[t];const s=i.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let n=s.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("Event data name must not be null");let e=new ie(t);e.intValue=n.readInt(!1),e.floatValue=n.readFloat(),e.stringValue=n.readString(),e.audioPath=n.readString(),e.audioPath&&(e.volume=n.readFloat(),e.balance=n.readFloat()),i.events.push(e)}l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(n,t,i))}return i}readSkin(t,e,s,i){let n=null,r=0;if(s){if(r=t.readInt(!0),0==r)return null;n=new ve("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new ve(s),i&&m.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,i=n.bones.length;s<i;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);r=t.readInt(!0)}for(let s=0;s<r;s++){let s=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let r=t.readStringRef();if(!r)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,n,s,r,i);a&&n.setAttachment(s,r,a)}}return n}readAttachment(t,e,s,i,n,r){let a=this.scale,o=t.readByte();const l=8&o?t.readStringRef():n;if(!l)throw new Error("Attachment name must not be null");switch(7&o){case Fe.Region:{let e=16&o?t.readStringRef():null;const i=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null;let r=128&o?t.readFloat():0,h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),f=t.readFloat(),g=t.readFloat();e||(e=l);let p=this.attachmentLoader.newRegionAttachment(s,l,e,n);return p?(p.path=e,p.x=h*a,p.y=c*a,p.scaleX=d,p.scaleY=u,p.rotation=r,p.width=f*a,p.height=g*a,m.rgba8888ToColor(p.color,i),p.sequence=n,null==n&&p.updateRegion(),p):null}case Fe.BoundingBox:{let e=this.readVertices(t,!!(16&o)),i=r?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,l);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,r&&m.rgba8888ToColor(n.color,i),n):null}case Fe.Mesh:{let e=16&o?t.readStringRef():l;const i=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null,h=t.readInt(!0),c=this.readVertices(t,!!(128&o)),d=this.readFloatArray(t,c.length,1),u=this.readShortArray(t,3*(c.length-h-2));let f=[],g=0,p=0;r&&(f=this.readShortArray(t,t.readInt(!0)),g=t.readFloat(),p=t.readFloat()),e||(e=l);let x=this.attachmentLoader.newMeshAttachment(s,l,e,n);return x?(x.path=e,m.rgba8888ToColor(x.color,i),x.bones=c.bones,x.vertices=c.vertices,x.worldVerticesLength=c.length,x.triangles=u,x.regionUVs=d,null==n&&x.updateRegion(),x.hullLength=h<<1,x.sequence=n,r&&(x.edges=f,x.width=g*a,x.height=p*a),x):null}case Fe.LinkedMesh:{const e=16&o?t.readStringRef():l;if(null==e)throw new Error("Path of linked mesh must not be null");const n=32&o?t.readInt32():4294967295,h=64&o?this.readSequence(t):null,c=!!(128&o),d=t.readInt(!0),u=t.readStringRef();let f=0,g=0;r&&(f=t.readFloat(),g=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,l,e,h);return p?(p.path=e,m.rgba8888ToColor(p.color,n),p.sequence=h,r&&(p.width=f*a,p.height=g*a),this.linkedMeshes.push(new Ie(p,d,i,u,c)),p):null}case Fe.Path:{const e=!!(16&o),i=!!(32&o),n=this.readVertices(t,!!(64&o)),h=b.newArray(n.length/6,0);for(let e=0,s=h.length;e<s;e++)h[e]=t.readFloat()*a;const c=r?t.readInt32():0,d=this.attachmentLoader.newPathAttachment(s,l);return d?(d.closed=e,d.constantSpeed=i,d.worldVerticesLength=n.length,d.vertices=n.vertices,d.bones=n.bones,d.lengths=h,r&&m.rgba8888ToColor(d.color,c),d):null}case Fe.Point:{const e=t.readFloat(),i=t.readFloat(),n=t.readFloat(),o=r?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,l);return h?(h.x=i*a,h.y=n*a,h.rotation=e,r&&m.rgba8888ToColor(h.color,o),h):null}case Fe.Clipping:{const i=t.readInt(!0),n=this.readVertices(t,!!(16&o));let a=r?t.readInt32():0,h=this.attachmentLoader.newClippingAttachment(s,l);return h?(h.endSlot=e.slots[i],h.worldVerticesLength=n.length,h.vertices=n.vertices,h.bones=n.bones,r&&m.rgba8888ToColor(h.color,a),h):null}}return null}readSequence(t){let e=new T(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),n=new Me;if(n.length=i<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let r=new Array,a=new Array;for(let e=0;e<i;e++){let e=t.readInt(!0);a.push(e);for(let i=0;i<e;i++)a.push(t.readInt(!0)),r.push(t.readFloat()*s),r.push(t.readFloat()*s),r.push(t.readFloat())}return n.vertices=b.toFloatArray(r),n.bones=a,n}readFloatArray(t,e,s){let i=new Array(e);if(1==s)for(let s=0;s<e;s++)i[s]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,n=this.scale;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),r=n-1;switch(s){case ze:{let s=new Z(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readStringRef());i.push(s);break}case Ge:{let s=t.readInt(!0),a=new j(n,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!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case cs:a.setStepped(e);break;case ds:Pe(t,a,s++,e,0,o,i,l,n,1),Pe(t,a,s++,e,1,o,i,h,r,1),Pe(t,a,s++,e,2,o,i,c,u,1),Pe(t,a,s++,e,3,o,i,d,m,1)}o=i,l=n,h=r,c=u,d=m}i.push(a);break}case $e:{let s=t.readInt(!0),a=new H(n,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!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case cs:a.setStepped(e);break;case ds:Pe(t,a,s++,e,0,o,i,l,n,1),Pe(t,a,s++,e,1,o,i,h,r,1),Pe(t,a,s++,e,2,o,i,c,d,1)}o=i,l=n,h=r,c=d}i.push(a);break}case je:{let s=t.readInt(!0),a=new K(n,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,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,m,f),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255;switch(t.readByte()){case cs:a.setStepped(e);break;case ds:Pe(t,a,s++,e,0,o,i,l,n,1),Pe(t,a,s++,e,1,o,i,h,r,1),Pe(t,a,s++,e,2,o,i,c,g,1),Pe(t,a,s++,e,3,o,i,d,p,1),Pe(t,a,s++,e,4,o,i,u,x,1),Pe(t,a,s++,e,5,o,i,m,w,1),Pe(t,a,s++,e,6,o,i,f,b,1)}o=i,l=n,h=r,c=g,d=p,u=x,m=w,f=b}i.push(a);break}case He:{let s=t.readInt(!0),a=new Q(n,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,m=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,m),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case cs:a.setStepped(e);break;case ds:Pe(t,a,s++,e,0,o,i,l,n,1),Pe(t,a,s++,e,1,o,i,h,r,1),Pe(t,a,s++,e,2,o,i,c,f,1),Pe(t,a,s++,e,3,o,i,d,g,1),Pe(t,a,s++,e,4,o,i,u,p,1),Pe(t,a,s++,e,5,o,i,m,x,1)}o=i,l=n,h=r,c=f,d=g,u=p,m=x}i.push(a);break}case Je:{let s=new J(n,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,i=0;s.setFrame(e,a,o),e!=r;e++){let n=t.readFloat(),r=t.readUnsignedByte()/255;switch(t.readByte()){case cs:s.setStepped(e);break;case ds:Pe(t,s,i++,e,0,a,n,o,r,1)}a=n,o=r}i.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readByte(),r=t.readInt(!0);if(s==We){let s=new $(r,e);for(let e=0;e<r;e++)s.setFrame(e,t.readFloat(),t.readByte());i.push(s);continue}let a=t.readInt(!0);switch(s){case Re:i.push(Ye(t,new V(r,a,e),1));break;case Ee:i.push(Xe(t,new L(r,a,e),n));break;case De:i.push(Ye(t,new O(r,a,e),n));break;case Ve:i.push(Ye(t,new _(r,a,e),n));break;case Le:i.push(Xe(t,new U(r,a,e),1));break;case Oe:i.push(Ye(t,new N(r,a,e),1));break;case _e:i.push(Ye(t,new q(r,a,e),1));break;case Ue:i.push(Xe(t,new W(r,a,e),1));break;case Ne:i.push(Ye(t,new z(r,a,e),1));break;case qe:i.push(Ye(t,new G(r,a,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),r=s-1,a=new rt(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()*n:0;for(let e=0,s=0;a.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=r;e++){o=t.readByte();const i=t.readFloat(),r=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*n:0;64&o?a.setStepped(e):128&o&&(Pe(t,a,s++,e,0,l,i,h,r,1),Pe(t,a,s++,e,1,l,i,c,d,n)),l=i,h=r,c=d}i.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,r=new at(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;r.setFrame(e,a,o,l,h,c,d,u),e!=n;e++){let i=t.readFloat(),n=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),x=t.readFloat();switch(t.readByte()){case cs:r.setStepped(e);break;case ds:Pe(t,r,s++,e,0,a,i,o,n,1),Pe(t,r,s++,e,1,a,i,l,m,1),Pe(t,r,s++,e,2,a,i,h,f,1),Pe(t,r,s++,e,3,a,i,c,g,1),Pe(t,r,s++,e,4,a,i,d,p,1),Pe(t,r,s++,e,5,a,i,u,x,1)}a=i,o=n,l=m,h=f,c=g,d=p,u=x}i.push(r)}for(let e=0,r=t.readInt(!0);e<r;e++){let e=t.readInt(!0),r=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 Ze:i.push(Ye(t,new ot(a,o,e),0==r.positionMode?n:1));break;case ts:i.push(Ye(t,new lt(a,o,e),0==r.spacingMode||1==r.spacingMode?n:1));break;case es:let s=new ht(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,i=0,n=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=n;e++){let n=t.readFloat(),r=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case cs:s.setStepped(e);break;case ds:Pe(t,s,i++,e,0,l,n,h,r,1),Pe(t,s,i++,e,1,l,n,c,a,1),Pe(t,s,i++,e,2,l,n,d,o,1)}l=n,h=r,c=a,d=o}i.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,n=t.readInt(!0);s<n;s++){const s=t.readByte(),n=t.readInt(!0);if(s==hs){const s=new bt(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat());i.push(s);continue}const r=t.readInt(!0);switch(s){case ss:i.push(Ye(t,new dt(n,r,e),1));break;case is:i.push(Ye(t,new ut(n,r,e),1));break;case ns:i.push(Ye(t,new mt(n,r,e),1));break;case rs:i.push(Ye(t,new ft(n,r,e),1));break;case as:i.push(Ye(t,new gt(n,r,e),1));break;case os:i.push(Ye(t,new pt(n,r,e),1));break;case ls:i.push(Ye(t,new xt(n,r,e),1))}}}for(let e=0,r=t.readInt(!0);e<r;e++){let e=s.skins[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let r=t.readStringRef();if(!r)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,r),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case Ke:{let e=a,r=e.bones,o=e.vertices,c=r?o.length/3*2:o.length,d=t.readInt(!0),u=new tt(l,d,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let i,a=t.readInt(!0);if(0==a)i=r?b.newFloatArray(c):o;else{i=b.newFloatArray(c);let e=t.readInt(!0);if(a+=e,1==n)for(let s=e;s<a;s++)i[s]=t.readFloat();else for(let s=e;s<a;s++)i[s]=t.readFloat()*n;if(!r)for(let t=0,e=i.length;t<e;t++)i[t]+=o[t]}if(u.setFrame(e,m,i),e==h)break;let l=t.readFloat();switch(t.readByte()){case cs:u.setStepped(e);break;case ds:Pe(t,u,s++,e,0,m,l,0,1,1)}m=l}i.push(u);break}case Qe:{let e=new vt(l,s,a);for(let s=0;s<l;s++){let i=t.readFloat(),n=t.readInt32();e.setFrame(s,i,M[15&n],n>>4,t.readFloat())}i.push(e);break}}}}}let r=t.readInt(!0);if(r>0){let e=new nt(r),n=s.slots.length;for(let s=0;s<r;s++){let i=t.readFloat(),r=t.readInt(!0),a=b.newArray(n,0);for(let t=n-1;t>=0;t--)a[t]=-1;let o=b.newArray(n-r,0),l=0,h=0;for(let e=0;e<r;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;a[l+t.readInt(!0)]=l++}for(;l<n;)o[h++]=l++;for(let t=n-1;t>=0;t--)-1==a[t]&&(a[t]=o[--h]);e.setFrame(s,i,a)}i.push(e)}let a=t.readInt(!0);if(a>0){let e=new st(a);for(let i=0;i<a;i++){let n=t.readFloat(),r=s.events[t.readInt(!0)],a=new se(n,r);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=r.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(i,a)}i.push(e)}let o=0;for(let t=0,e=i.length;t<e;t++)o=Math.max(o,i[t].getDuration());return new F(e,i,o)}},Te=class{constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=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()}},Ie=class{constructor(t,e,s,i,n){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}},Me=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}},Fe=(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",t))(Fe||{});function Ye(t,e,s){let i=t.readFloat(),n=t.readFloat()*s;for(let r=0,a=0,o=e.getFrameCount()-1;e.setFrame(r,i,n),r!=o;r++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case cs:e.setStepped(r);break;case ds:Pe(t,e,a++,r,0,i,o,n,l,s)}i=o,n=l}return e}function Xe(t,e,s){let i=t.readFloat(),n=t.readFloat()*s,r=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,i,n,r),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case cs:e.setStepped(a);break;case ds:Pe(t,e,o++,a,0,i,l,n,h,s),Pe(t,e,o++,a,1,i,l,r,c,s)}i=l,n=h,r=c}return e}function Pe(t,e,s,i,n,r,a,o,l,h){e.setBezier(s,i,n,r,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,l)}var Be,Re=0,Ee=1,De=2,Ve=3,Le=4,Oe=5,_e=6,Ue=7,Ne=8,qe=9,We=10,ze=0,Ge=1,$e=2,je=3,He=4,Je=5,Ke=0,Qe=1,Ze=0,ts=1,es=2,ss=0,is=1,ns=2,rs=4,as=5,os=6,ls=7,hs=8,cs=1,ds=2,us=class{constructor(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new y((()=>b.newFloatArray(16)))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,r=t.slots,a=r.length;s.length=0,n.freeAll(i),i.length=0;for(let t=0;t<a;t++){let e=r[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof Et){let t=a;s.push(t);let r=n.obtain();r.length!=t.worldVerticesLength&&(r=b.newFloatArray(t.worldVerticesLength)),i.push(r),t.computeWorldVertices(e,0,t.worldVerticesLength,r,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=this.polygons;for(let r=0,a=n.length;r<a;r++){let a=n[r],o=a;for(let n=0,r=a.length;n<r;n+=2){let r=o[n],a=o[n+1];t=Math.min(t,r),e=Math.min(e,a),s=Math.max(s,r),i=Math.max(i,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let n=this.minX,r=this.minY,a=this.maxX,o=this.maxY;if(t<=n&&s<=n||e<=r&&i<=r||t>=a&&s>=a||e>=o&&i>=o)return!1;let l=(i-e)/(s-t),h=l*(n-t)+e;if(h>r&&h<o)return!0;if(h=l*(a-t)+e,h>r&&h<o)return!0;let c=(r-e)/l+t;return c>n&&c<a||(c=(o-e)/l+t,c>n&&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 i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,n=t.length,r=n-2,a=!1;for(let t=0;t<n;t+=2){let n=i[t+1],o=i[r+1];if(n<s&&o>=s||o<s&&n>=s){let l=i[t];l+(s-n)/(o-n)*(i[r]-l)<e&&(a=!a)}r=t}return a}intersectsSegment(t,e,s,i){let n=this.polygons;for(let r=0,a=n.length;r<a;r++)if(this.intersectsSegmentPolygon(n[r],t,e,s,i))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,i,n){let r=t,a=t.length,o=e-i,l=s-n,h=e*n-s*i,c=r[a-2],d=r[a-1];for(let t=0;t<a;t+=2){let a=r[t],u=r[t+1],m=c*u-d*a,f=c-a,g=d-u,p=o*g-l*f,x=(h*f-o*m)/p;if((x>=c&&x<=a||x>=a&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let t=(h*g-l*m)/p;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=n||t>=n&&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}},ms=class{constructor(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new y((()=>new Array)),this.polygonIndicesPool=new y((()=>new Array))}triangulate(t){let e=t,s=t.length>>1,i=this.indicesArray;i.length=0;for(let t=0;t<s;t++)i[t]=t;let n=this.isConcaveArray;n.length=0;for(let t=0,r=s;t<r;++t)n[t]=ms.isConcave(t,s,e,i);let r=this.triangles;for(r.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!n[a]){let r=i[t]<<1,l=i[a]<<1,h=i[o]<<1,c=e[r],d=e[r+1],u=e[l],m=e[l+1],f=e[h],g=e[h+1];for(let r=(o+1)%s;r!=t;r=(r+1)%s){if(!n[r])continue;let t=i[r]<<1,s=e[t],a=e[t+1];if(ms.positiveArea(f,g,c,d,s,a)&&ms.positiveArea(c,d,u,m,s,a)&&ms.positiveArea(u,m,f,g,s,a))break t}break}if(0==o){do{if(!n[a])break;a--}while(a>0);break}t=a,a=o,o=(o+1)%s}r.push(i[(s+a-1)%s]),r.push(i[a]),r.push(i[(a+1)%s]),i.splice(a,1),n.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;n[l]=ms.isConcave(l,s,e,i),n[h]=ms.isConcave(h,s,e,i)}return 3==s&&(r.push(i[2]),r.push(i[0]),r.push(i[1])),r}decompose(t,e){let s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let r=this.polygonIndicesPool.obtain();r.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],m=s[h+1],f=s[c],g=s[c+1],p=s[d],x=s[d+1],w=!1;if(o==h){let t=a.length-4,e=ms.winding(a[t],a[t+1],a[t+2],a[t+3],p,x),s=ms.winding(p,x,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(p),a.push(x),r.push(d),w=!0)}w||(a.length>0?(i.push(a),n.push(r)):(this.polygonPool.free(a),this.polygonIndicesPool.free(r)),a=this.polygonPool.obtain(),a.length=0,a.push(u),a.push(m),a.push(f),a.push(g),a.push(p),a.push(x),r=this.polygonIndicesPool.obtain(),r.length=0,r.push(h),r.push(c),r.push(d),l=ms.winding(u,m,f,g,p,x),o=h)}a.length>0&&(i.push(a),n.push(r));for(let t=0,e=i.length;t<e;t++){if(r=n[t],0==r.length)continue;let s=r[0],o=r[r.length-1];a=i[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],m=a[0],f=a[1],g=a[2],p=a[3],x=ms.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=n[l];if(3!=e.length)continue;let w=e[0],b=e[1],y=e[2],v=i[l],k=v[v.length-2],C=v[v.length-1];if(w!=s||b!=o)continue;let S=ms.winding(h,c,d,u,k,C),A=ms.winding(k,C,m,f,g,p);S==x&&A==x&&(v.length=0,e.length=0,a.push(k),a.push(C),r.push(y),h=d,c=u,d=k,u=C,l=0)}}for(let t=i.length-1;t>=0;t--)a=i[t],0==a.length&&(i.splice(t,1),this.polygonPool.free(a),r=n[t],n.splice(t,1),this.polygonIndicesPool.free(r));return i}static isConcave(t,e,s,i){let n=i[(e+t-1)%e]<<1,r=i[t]<<1,a=i[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[r],s[r+1],s[a],s[a+1])}static positiveArea(t,e,s,i,n,r){return t*(r-i)+s*(e-r)+n*(i-e)>=0}static winding(t,e,s,i,n,r){let a=s-t,o=i-e;return n*o-r*a+a*e-t*o>=0?1:-1}},fs=class{constructor(){this.triangulator=new ms,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedUVs=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,i=b.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,i,0,2);let n=this.clippingPolygon;fs.makeClockwise(n);let r=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let t=0,e=r.length;t<e;t++){let e=r[t];fs.makeClockwise(e),e.push(e[0]),e.push(e[1])}return r.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,i,n,r,a,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=i,c=n,d=r,u=a,m=o):(l=e,h=s,c=i,d=n,u=r,m=a),c&&d&&u&&"boolean"==typeof m?this.clipTrianglesRender(t,l,h,c,d,u,m):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let i=this.clipOutput,n=this.clippedVertices,r=this.clippedTriangles,a=this.clippingPolygons,o=a.length,l=0;n.length=0,r.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let u=t[s],m=t[s+1];s=e[h+2]<<1;let f=t[s],g=t[s+1];for(let t=0;t<o;t++){let e=n.length;if(!this.clip(c,d,u,m,f,g,a[t],i)){let t=b.setArraySize(n,e+6);t[e]=c,t[e+1]=d,t[e+2]=u,t[e+3]=m,t[e+4]=f,t[e+5]=g,e=r.length;let s=b.setArraySize(r,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=i.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=b.setArraySize(n,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],i=a[s+1];o[e]=t,o[e+1]=i}e=r.length;let h=b.setArraySize(r,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,i,n,r,a){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=a?12:8,m=0;l.length=0,h.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,g=t[s],p=t[s+1],x=i[s],w=i[s+1];s=e[f+1]<<1;let y=t[s],v=t[s+1],k=i[s],C=i[s+1];s=e[f+2]<<1;let S=t[s],A=t[s+1],T=i[s],I=i[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(g,p,y,v,S,A,c[t],o)){let t=b.setArraySize(l,e+3*u);t[e]=g,t[e+1]=p,t[e+2]=n.r,t[e+3]=n.g,t[e+4]=n.b,t[e+5]=n.a,a?(t[e+6]=x,t[e+7]=w,t[e+8]=r.r,t[e+9]=r.g,t[e+10]=r.b,t[e+11]=r.a,t[e+12]=y,t[e+13]=v,t[e+14]=n.r,t[e+15]=n.g,t[e+16]=n.b,t[e+17]=n.a,t[e+18]=k,t[e+19]=C,t[e+20]=r.r,t[e+21]=r.g,t[e+22]=r.b,t[e+23]=r.a,t[e+24]=S,t[e+25]=A,t[e+26]=n.r,t[e+27]=n.g,t[e+28]=n.b,t[e+29]=n.a,t[e+30]=T,t[e+31]=I,t[e+32]=r.r,t[e+33]=r.g,t[e+34]=r.b,t[e+35]=r.a):(t[e+6]=x,t[e+7]=w,t[e+8]=y,t[e+9]=v,t[e+10]=n.r,t[e+11]=n.g,t[e+12]=n.b,t[e+13]=n.a,t[e+14]=k,t[e+15]=C,t[e+16]=S,t[e+17]=A,t[e+18]=n.r,t[e+19]=n.g,t[e+20]=n.b,t[e+21]=n.a,t[e+22]=T,t[e+23]=I),e=h.length;let s=b.setArraySize(h,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=v-A,i=S-y,c=g-S,d=A-p,f=1/(s*c+i*(p-A)),M=t>>1,F=this.clipOutput,Y=b.setArraySize(l,e+M*u);for(let o=0;o<t;o+=2,e+=u){let t=F[o],l=F[o+1];Y[e]=t,Y[e+1]=l,Y[e+2]=n.r,Y[e+3]=n.g,Y[e+4]=n.b,Y[e+5]=n.a;let h=t-S,u=l-A,m=(s*h+i*u)*f,g=(d*h+c*u)*f,p=1-m-g;Y[e+6]=x*m+k*g+T*p,Y[e+7]=w*m+C*g+I*p,a&&(Y[e+8]=r.r,Y[e+9]=r.g,Y[e+10]=r.b,Y[e+11]=r.a)}e=h.length;let X=b.setArraySize(h,e+3*(M-2));M--;for(let t=1;t<M;t++,e+=3)X[e]=m,X[e+1]=m+t,X[e+2]=m+t+1;m+=M+1}}}}clipTrianglesUnpacked(t,e,s,i){let n=this.clipOutput,r=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;r.length=0,a.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,u=t[s],m=t[s+1],f=i[s],g=i[s+1];s=e[d+1]<<1;let p=t[s],x=t[s+1],w=i[s],y=i[s+1];s=e[d+2]<<1;let v=t[s],k=t[s+1],C=i[s],S=i[s+1];for(let t=0;t<h;t++){let e=r.length;if(!this.clip(u,m,p,x,v,k,l[t],n)){let t=b.setArraySize(r,e+6);t[e]=u,t[e+1]=m,t[e+2]=p,t[e+3]=x,t[e+4]=v,t[e+5]=k;let s=b.setArraySize(a,e+6);s[e]=f,s[e+1]=g,s[e+2]=w,s[e+3]=y,s[e+4]=C,s[e+5]=S,e=o.length;let i=b.setArraySize(o,e+3);i[e]=c,i[e+1]=c+1,i[e+2]=c+2,c+=3;break}{let t=n.length;if(0==t)continue;let s=x-k,i=v-p,l=u-v,h=k-m,d=1/(s*l+i*(m-k)),A=t>>1,T=this.clipOutput,I=b.setArraySize(r,e+2*A),M=b.setArraySize(a,e+2*A);for(let n=0;n<t;n+=2,e+=2){let t=T[n],r=T[n+1];I[e]=t,I[e+1]=r;let a=t-v,o=r-k,c=(s*a+i*o)*d,u=(h*a+l*o)*d,m=1-c-u;M[e]=f*c+w*u+C*m,M[e+1]=g*c+y*u+S*m}e=o.length;let F=b.setArraySize(o,e+3*(A-2));A--;for(let t=1;t<A;t++,e+=3)F[e]=c,F[e+1]=c+t,F[e+2]=c+t+1;c+=A+1}}}}clip(t,e,s,i,n,r,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(i),l.push(n),l.push(r),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],i=e-u[t+2],n=s-u[t+3],r=o.length,a=l;for(let t=0,r=l.length-2;t<r;){let r=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=n*(e-h)>i*(s-d),m=n*(e-r)-i*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-r,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s)}else if(u){let t=h-r,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(r==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}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,i=e[s-2]*e[1]-e[0]*e[s-1],n=0,r=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)n=e[t],r=e[t+1],a=e[t+2],o=e[t+3],i+=n*o-a*r;if(!(i<0))for(let t=0,i=s-2,n=s>>1;t<n;t+=2){let s=e[t],n=e[t+1],r=i-t;e[t]=e[r],e[t+1]=e[r+1],e[r]=s,e[r+1]=n}}},gs=class{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){var e,s;let i=this.scale,n=new be,r="string"==typeof t?JSON.parse(t):t,a=r.skeleton;if(a&&(n.hash=a.hash,n.version=a.spine,n.x=a.x,n.y=a.y,n.width=a.width,n.height=a.height,n.referenceScale=ys(a,"referenceScale",100)*i,n.fps=a.fps,n.imagesPath=null!=(e=a.images)?e:null,n.audioPath=null!=(s=a.audio)?s:null),r.bones)for(let t=0;t<r.bones.length;t++){let e=r.bones[t],s=null,a=ys(e,"parent",null);a&&(s=n.findBone(a));let o=new Kt(n.bones.length,e.name,s);o.length=ys(e,"length",0)*i,o.x=ys(e,"x",0)*i,o.y=ys(e,"y",0)*i,o.rotation=ys(e,"rotation",0),o.scaleX=ys(e,"scaleX",1),o.scaleY=ys(e,"scaleY",1),o.shearX=ys(e,"shearX",0),o.shearY=ys(e,"shearY",0),o.inherit=b.enumValue(Qt,ys(e,"inherit","Normal")),o.skinRequired=ys(e,"skin",!1);let l=ys(e,"color",null);l&&o.color.setFromString(l),n.bones.push(o)}if(r.slots)for(let t=0;t<r.slots.length;t++){let e=r.slots[t],s=e.name,i=n.findBone(e.bone);if(!i)throw new Error(`Couldn't find bone ${e.bone} for slot ${s}`);let a=new ke(n.slots.length,s,i),o=ys(e,"color",null);o&&a.color.setFromString(o);let l=ys(e,"dark",null);l&&(a.darkColor=m.fromString(l)),a.attachmentName=ys(e,"attachment",null),a.blendMode=b.enumValue(Ce,ys(e,"blend","normal")),a.visible=ys(e,"visible",!0),n.slots.push(a)}if(r.ik)for(let t=0;t<r.ik.length;t++){let e=r.ik[t],s=new re(e.name);s.order=ys(e,"order",0),s.skinRequired=ys(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let i=n.findBone(e.bones[t]);if(!i)throw new Error(`Couldn't find bone ${e.bones[t]} for IK constraint ${e.name}.`);s.bones.push(i)}let a=n.findBone(e.target);if(!a)throw new Error(`Couldn't find target bone ${e.target} for IK constraint ${e.name}.`);s.target=a,s.mix=ys(e,"mix",1),s.softness=ys(e,"softness",0)*i,s.bendDirection=ys(e,"bendPositive",!0)?1:-1,s.compress=ys(e,"compress",!1),s.stretch=ys(e,"stretch",!1),s.uniform=ys(e,"uniform",!1),n.ikConstraints.push(s)}if(r.transform)for(let t=0;t<r.transform.length;t++){let e=r.transform[t],s=new Se(e.name);s.order=ys(e,"order",0),s.skinRequired=ys(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=n.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for transform constraint ${e.name}.`);s.bones.push(r)}let a=e.target,o=n.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${e.name}.`);s.target=o,s.local=ys(e,"local",!1),s.relative=ys(e,"relative",!1),s.offsetRotation=ys(e,"rotation",0),s.offsetX=ys(e,"x",0)*i,s.offsetY=ys(e,"y",0)*i,s.offsetScaleX=ys(e,"scaleX",0),s.offsetScaleY=ys(e,"scaleY",0),s.offsetShearY=ys(e,"shearY",0),s.mixRotate=ys(e,"mixRotate",1),s.mixX=ys(e,"mixX",1),s.mixY=ys(e,"mixY",s.mixX),s.mixScaleX=ys(e,"mixScaleX",1),s.mixScaleY=ys(e,"mixScaleY",s.mixScaleX),s.mixShearY=ys(e,"mixShearY",1),n.transformConstraints.push(s)}if(r.path)for(let t=0;t<r.path.length;t++){let e=r.path[t],s=new ae(e.name);s.order=ys(e,"order",0),s.skinRequired=ys(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=n.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for path constraint ${e.name}.`);s.bones.push(r)}let a=e.target,o=n.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${e.name}.`);s.target=o,s.positionMode=b.enumValue(oe,ys(e,"positionMode","Percent")),s.spacingMode=b.enumValue(le,ys(e,"spacingMode","Length")),s.rotateMode=b.enumValue(he,ys(e,"rotateMode","Tangent")),s.offsetRotation=ys(e,"rotation",0),s.position=ys(e,"position",0),0==s.positionMode&&(s.position*=i),s.spacing=ys(e,"spacing",0),0!=s.spacingMode&&1!=s.spacingMode||(s.spacing*=i),s.mixRotate=ys(e,"mixRotate",1),s.mixX=ys(e,"mixX",1),s.mixY=ys(e,"mixY",s.mixX),n.pathConstraints.push(s)}if(r.physics)for(let t=0;t<r.physics.length;t++){const e=r.physics[t],s=new we(e.name);s.order=ys(e,"order",0),s.skinRequired=ys(e,"skin",!1);const a=e.bone,o=n.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);s.bone=o,s.x=ys(e,"x",0),s.y=ys(e,"y",0),s.rotate=ys(e,"rotate",0),s.scaleX=ys(e,"scaleX",0),s.shearX=ys(e,"shearX",0),s.limit=ys(e,"limit",5e3)*i,s.step=1/ys(e,"fps",60),s.inertia=ys(e,"inertia",1),s.strength=ys(e,"strength",100),s.damping=ys(e,"damping",1),s.massInverse=1/ys(e,"mass",1),s.wind=ys(e,"wind",0),s.gravity=ys(e,"gravity",0),s.mix=ys(e,"mix",1),s.inertiaGlobal=ys(e,"inertiaGlobal",!1),s.strengthGlobal=ys(e,"strengthGlobal",!1),s.dampingGlobal=ys(e,"dampingGlobal",!1),s.massGlobal=ys(e,"massGlobal",!1),s.windGlobal=ys(e,"windGlobal",!1),s.gravityGlobal=ys(e,"gravityGlobal",!1),s.mixGlobal=ys(e,"mixGlobal",!1),n.physicsConstraints.push(s)}if(r.skins)for(let t=0;t<r.skins.length;t++){let e=r.skins[t],s=new ve(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=n.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for skin ${e.name}.`);s.bones.push(r)}if(e.ik)for(let t=0;t<e.ik.length;t++){let i=e.ik[t],r=n.findIkConstraint(i);if(!r)throw new Error(`Couldn't find IK constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}if(e.transform)for(let t=0;t<e.transform.length;t++){let i=e.transform[t],r=n.findTransformConstraint(i);if(!r)throw new Error(`Couldn't find transform constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}if(e.path)for(let t=0;t<e.path.length;t++){let i=e.path[t],r=n.findPathConstraint(i);if(!r)throw new Error(`Couldn't find path constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}if(e.physics)for(let t=0;t<e.physics.length;t++){let i=e.physics[t],r=n.findPhysicsConstraint(i);if(!r)throw new Error(`Couldn't find physics constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}for(let t in e.attachments){let i=n.findSlot(t);if(!i)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let r=e.attachments[t];for(let t in r){let e=this.readAttachment(r[t],s,i.index,t,n);e&&s.setAttachment(i.index,t,e)}}n.skins.push(s),"default"==s.name&&(n.defaultSkin=s)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],s=e.skin?n.findSkin(e.skin):n.defaultSkin;if(!s)throw new Error(`Skin not found: ${e.skin}`);let i=s.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],s=new ie(t);s.intValue=ys(e,"int",0),s.floatValue=ys(e,"float",0),s.stringValue=ys(e,"string",""),s.audioPath=ys(e,"audio",null),s.audioPath&&(s.volume=ys(e,"volume",1),s.balance=ys(e,"balance",0)),n.events.push(s)}if(r.animations)for(let t in r.animations){let e=r.animations[t];this.readAnimation(e,t,n)}return n}readAttachment(t,e,s,i,n){let r=this.scale;switch(i=ys(t,"name",i),ys(t,"type","region")){case"region":{let s=ys(t,"path",i),n=this.readSequence(ys(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,s,n);if(!a)return null;a.path=s,a.x=ys(t,"x",0)*r,a.y=ys(t,"y",0)*r,a.scaleX=ys(t,"scaleX",1),a.scaleY=ys(t,"scaleY",1),a.rotation=ys(t,"rotation",0),a.width=t.width*r,a.height=t.height*r,a.sequence=n;let o=ys(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let n=ys(t,"color",null);return n&&s.color.setFromString(n),s}case"mesh":case"linkedmesh":{let n=ys(t,"path",i),a=this.readSequence(ys(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,i,n,a);if(!o)return null;o.path=n;let l=ys(t,"color",null);l&&o.color.setFromString(l),o.width=ys(t,"width",0)*r,o.height=ys(t,"height",0)*r,o.sequence=a;let h=ys(t,"parent",null);if(h)return this.linkedMeshes.push(new ps(o,ys(t,"skin",null),s,h,ys(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=ys(t,"edges",null),o.hullLength=2*ys(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,i);if(!s)return null;s.closed=ys(t,"closed",!1),s.constantSpeed=ys(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,s,n<<1);let a=b.newArray(n/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*r;s.lengths=a;let o=ys(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,i);if(!s)return null;s.x=ys(t,"x",0)*r,s.y=ys(t,"y",0)*r,s.rotation=ys(t,"rotation",0);let n=ys(t,"color",null);return n&&s.color.setFromString(n),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,i);if(!s)return null;let r=ys(t,"end",null);r&&(s.endSlot=n.findSlot(r));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=ys(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new T(ys(t,"count",0));return e.start=ys(t,"start",1),e.digits=ys(t,"digits",0),e.setupIndex=ys(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let t=b.toFloatArray(n);if(1!=i)for(let e=0,s=n.length;e<s;e++)t[e]*=i;return void(e.vertices=t)}let r=new Array,a=new Array;for(let t=0,e=n.length;t<e;){let e=n[t++];a.push(e);for(let s=t+4*e;t<s;t+=4)a.push(n[t]),r.push(n[t+1]*i),r.push(n[t+2]*i),r.push(n[t+3])}e.bones=a,e.vertices=b.toFloatArray(r)}readAnimation(t,e,s){let i=this.scale,n=new Array;if(t.slots)for(let e in t.slots){let i=t.slots[e],r=s.findSlot(e);if(!r)throw new Error("Slot not found: "+e);let a=r.index;for(let t in i){let e=i[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new Z(s,a);for(let i=0;i<s;i++){let s=e[i];t.setFrame(i,ys(s,"time",0),ys(s,"name",null))}n.push(t)}else if("rgba"==t){let t=new j(s,s<<2,a),i=e[0],r=ys(i,"time",0),o=m.fromString(i.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a);let a=e[s+1];if(!a){t.shrink(n);break}let l=ys(a,"time",0),h=m.fromString(a.color),c=i.curve;c&&(n=bs(c,t,n,s,0,r,l,o.r,h.r,1),n=bs(c,t,n,s,1,r,l,o.g,h.g,1),n=bs(c,t,n,s,2,r,l,o.b,h.b,1),n=bs(c,t,n,s,3,r,l,o.a,h.a,1)),r=l,o=h,i=a}n.push(t)}else if("rgb"==t){let t=new H(s,3*s,a),i=e[0],r=ys(i,"time",0),o=m.fromString(i.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b);let a=e[s+1];if(!a){t.shrink(n);break}let l=ys(a,"time",0),h=m.fromString(a.color),c=i.curve;c&&(n=bs(c,t,n,s,0,r,l,o.r,h.r,1),n=bs(c,t,n,s,1,r,l,o.g,h.g,1),n=bs(c,t,n,s,2,r,l,o.b,h.b,1)),r=l,o=h,i=a}n.push(t)}else if("alpha"==t)n.push(xs(e,new J(s,s,a),0,1));else if("rgba2"==t){let t=new K(s,7*s,a),i=e[0],r=ys(i,"time",0),o=m.fromString(i.light),l=m.fromString(i.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a,l.r,l.g,l.b);let a=e[s+1];if(!a){t.shrink(n);break}let h=ys(a,"time",0),c=m.fromString(a.light),d=m.fromString(a.dark),u=i.curve;u&&(n=bs(u,t,n,s,0,r,h,o.r,c.r,1),n=bs(u,t,n,s,1,r,h,o.g,c.g,1),n=bs(u,t,n,s,2,r,h,o.b,c.b,1),n=bs(u,t,n,s,3,r,h,o.a,c.a,1),n=bs(u,t,n,s,4,r,h,l.r,d.r,1),n=bs(u,t,n,s,5,r,h,l.g,d.g,1),n=bs(u,t,n,s,6,r,h,l.b,d.b,1)),r=h,o=c,l=d,i=a}n.push(t)}else if("rgb2"==t){let t=new Q(s,6*s,a),i=e[0],r=ys(i,"time",0),o=m.fromString(i.light),l=m.fromString(i.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,l.r,l.g,l.b);let a=e[s+1];if(!a){t.shrink(n);break}let h=ys(a,"time",0),c=m.fromString(a.light),d=m.fromString(a.dark),u=i.curve;u&&(n=bs(u,t,n,s,0,r,h,o.r,c.r,1),n=bs(u,t,n,s,1,r,h,o.g,c.g,1),n=bs(u,t,n,s,2,r,h,o.b,c.b,1),n=bs(u,t,n,s,3,r,h,l.r,d.r,1),n=bs(u,t,n,s,4,r,h,l.g,d.g,1),n=bs(u,t,n,s,5,r,h,l.b,d.b,1)),r=h,o=c,l=d,i=a}n.push(t)}}}if(t.bones)for(let e in t.bones){let r=t.bones[e],a=s.findBone(e);if(!a)throw new Error("Bone not found: "+e);let o=a.index;for(let t in r){let e=r[t],s=e.length;if(0!=s)if("rotate"===t)n.push(xs(e,new V(s,s,o),0,1));else if("translate"===t){let t=new L(s,s<<1,o);n.push(ws(e,t,"x","y",0,i))}else if("translatex"===t){let t=new O(s,s,o);n.push(xs(e,t,0,i))}else if("translatey"===t){let t=new _(s,s,o);n.push(xs(e,t,0,i))}else if("scale"===t){let t=new U(s,s<<1,o);n.push(ws(e,t,"x","y",1,1))}else if("scalex"===t){let t=new N(s,s,o);n.push(xs(e,t,1,1))}else if("scaley"===t){let t=new q(s,s,o);n.push(xs(e,t,1,1))}else if("shear"===t){let t=new W(s,s<<1,o);n.push(ws(e,t,"x","y",0,1))}else if("shearx"===t){let t=new z(s,s,o);n.push(xs(e,t,0,1))}else if("sheary"===t){let t=new G(s,s,o);n.push(xs(e,t,0,1))}else if("inherit"===t){let t=new $(s,a.index);for(let s=0;s<e.length;s++){let i=e[s];t.setFrame(s,ys(i,"time",0),b.enumValue(Qt,ys(i,"inherit","Normal")))}n.push(t)}}}if(t.ik)for(let e in t.ik){let r=t.ik[e],a=r[0];if(!a)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new rt(r.length,r.length<<1,l),c=ys(a,"time",0),d=ys(a,"mix",1),u=ys(a,"softness",0)*i;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,ys(a,"bendPositive",!0)?1:-1,ys(a,"compress",!1),ys(a,"stretch",!1));let s=r[t+1];if(!s){h.shrink(e);break}let n=ys(s,"time",0),o=ys(s,"mix",1),l=ys(s,"softness",0)*i,m=a.curve;m&&(e=bs(m,h,e,t,0,c,n,d,o,1),e=bs(m,h,e,t,1,c,n,u,l,i)),c=n,d=o,u=l,a=s}n.push(h)}if(t.transform)for(let e in t.transform){let i=t.transform[e],r=i[0];if(!r)continue;let a=s.findTransformConstraint(e);if(!a)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(a),l=new at(i.length,6*i.length,o),h=ys(r,"time",0),c=ys(r,"mixRotate",1),d=ys(r,"mixX",1),u=ys(r,"mixY",d),m=ys(r,"mixScaleX",1),f=ys(r,"mixScaleY",m),g=ys(r,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,g);let s=i[t+1];if(!s){l.shrink(e);break}let n=ys(s,"time",0),a=ys(s,"mixRotate",1),o=ys(s,"mixX",1),p=ys(s,"mixY",o),x=ys(s,"mixScaleX",1),w=ys(s,"mixScaleY",x),b=ys(s,"mixShearY",1),y=r.curve;y&&(e=bs(y,l,e,t,0,h,n,c,a,1),e=bs(y,l,e,t,1,h,n,d,o,1),e=bs(y,l,e,t,2,h,n,u,p,1),e=bs(y,l,e,t,3,h,n,m,x,1),e=bs(y,l,e,t,4,h,n,f,w,1),e=bs(y,l,e,t,5,h,n,g,b,1)),h=n,c=a,d=o,u=p,m=x,f=w,m=x,r=s}n.push(l)}if(t.path)for(let e in t.path){let r=t.path[e],a=s.findPathConstraint(e);if(!a)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(a);for(let t in r){let e=r[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new ot(l,l,o);n.push(xs(e,t,0,0==a.positionMode?i:1))}else if("spacing"===t){let t=new lt(l,l,o);n.push(xs(e,t,0,0==a.spacingMode||1==a.spacingMode?i:1))}else if("mix"===t){let t=new ht(l,3*l,o),i=ys(s,"time",0),r=ys(s,"mixRotate",1),a=ys(s,"mixX",1),h=ys(s,"mixY",a);for(let n=0,o=0;;n++){t.setFrame(n,i,r,a,h);let l=e[n+1];if(!l){t.shrink(o);break}let c=ys(l,"time",0),d=ys(l,"mixRotate",1),u=ys(l,"mixX",1),m=ys(l,"mixY",u),f=s.curve;f&&(o=bs(f,t,o,n,0,i,c,r,d,1),o=bs(f,t,o,n,1,i,c,a,u,1),o=bs(f,t,o,n,2,i,c,h,m,1)),i=c,r=d,a=u,h=m,s=l}n.push(t)}}}if(t.physics)for(let e in t.physics){let i=t.physics[e],r=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);r=s.physicsConstraints.indexOf(t)}for(let t in i){let e=i[t],s=e[0];if(!s)continue;let a,o=e.length;if("reset"!=t){if("inertia"==t)a=new dt(o,o,r);else if("strength"==t)a=new ut(o,o,r);else if("damping"==t)a=new mt(o,o,r);else if("mass"==t)a=new ft(o,o,r);else if("wind"==t)a=new gt(o,o,r);else if("gravity"==t)a=new pt(o,o,r);else{if("mix"!=t)continue;a=new xt(o,o,r)}n.push(xs(e,a,0,1))}else{const t=new bt(o,r);for(let i=0;null!=s;s=e[i+1],i++)t.setFrame(i,ys(s,"time",0));n.push(t)}}}if(t.attachments)for(let e in t.attachments){let r=t.attachments[e],a=s.findSkin(e);if(!a)throw new Error("Skin not found: "+e);for(let t in r){let e=r[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],r=a.getAttachment(l,t);for(let t in s){let e=s[t],a=e[0];if(a)if("deform"==t){let t=r.bones,s=r.vertices,o=t?s.length/3*2:s.length,h=new tt(e.length,e.length,l,r),c=ys(a,"time",0);for(let n=0,r=0;;n++){let l,d=ys(a,"vertices",null);if(d){l=b.newFloatArray(o);let e=ys(a,"offset",0);if(b.arrayCopy(d,0,l,e,d.length),1!=i)for(let t=e,s=t+d.length;t<s;t++)l[t]*=i;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?b.newFloatArray(o):s;h.setFrame(n,c,l);let u=e[n+1];if(!u){h.shrink(r);break}let m=ys(u,"time",0),f=a.curve;f&&(r=bs(f,h,r,n,0,c,m,0,1,1)),c=m,a=u}n.push(h)}else if("sequence"==t){let t=new vt(e.length,l,r),s=0;for(let i=0;i<e.length;i++){let n=ys(a,"delay",s),r=ys(a,"time",0),o=I[ys(a,"mode","hold")],l=ys(a,"index",0);t.setFrame(i,r,o,l,n),s=n,a=e[i+1]}n.push(t)}}}}}if(t.drawOrder){let e=new nt(t.drawOrder.length),i=s.slots.length,r=0;for(let n=0;n<t.drawOrder.length;n++,r++){let a=t.drawOrder[n],o=null,l=ys(a,"offsets",null);if(l){o=b.newArray(i,-1);let t=b.newArray(i-l.length,0),e=0,n=0;for(let i=0;i<l.length;i++){let r=l[i],a=s.findSlot(r.slot);if(!a)throw new Error("Slot not found: "+a);let h=a.index;for(;e!=h;)t[n++]=e++;o[e+r.offset]=e++}for(;e<i;)t[n++]=e++;for(let e=i-1;e>=0;e--)-1==o[e]&&(o[e]=t[--n])}e.setFrame(r,ys(a,"time",0),o)}n.push(e)}if(t.events){let e=new st(t.events.length),i=0;for(let n=0;n<t.events.length;n++,i++){let r=t.events[n],a=s.findEvent(r.name);if(!a)throw new Error("Event not found: "+r.name);let o=new se(b.toSinglePrecision(ys(r,"time",0)),a);o.intValue=ys(r,"int",a.intValue),o.floatValue=ys(r,"float",a.floatValue),o.stringValue=ys(r,"string",a.stringValue),o.data.audioPath&&(o.volume=ys(r,"volume",1),o.balance=ys(r,"balance",0)),e.setFrame(i,o)}n.push(e)}let r=0;for(let t=0,e=n.length;t<e;t++)r=Math.max(r,n[t].getDuration());s.animations.push(new F(e,n,r))}},ps=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}};function xs(t,e,s,i){let n=t[0],r=ys(n,"time",0),a=ys(n,"value",s)*i,o=0;for(let l=0;;l++){e.setFrame(l,r,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=ys(h,"time",0),d=ys(h,"value",s)*i;n.curve&&(o=bs(n.curve,e,o,l,0,r,c,a,d,i)),r=c,a=d,n=h}}function ws(t,e,s,i,n,r){let a=t[0],o=ys(a,"time",0),l=ys(a,s,n)*r,h=ys(a,i,n)*r,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 m=ys(u,"time",0),f=ys(u,s,n)*r,g=ys(u,i,n)*r,p=a.curve;p&&(c=bs(p,e,c,d,0,o,m,l,f,r),c=bs(p,e,c,d,1,o,m,h,g,r)),o=m,l=f,h=g,a=u}}function bs(t,e,s,i,n,r,a,o,l,h){if("stepped"==t)return e.setStepped(i),s;let c=n<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,i,n,r,o,d,u,m,f,a,l),s+1}function ys(t,e,s){return void 0!==t[e]?t[e]:s}void 0===Math.fround&&(Math.fround=(Be=new Float32Array(1),function(t){return Be[0]=t,Be[0]}));var vs=class extends Vt{constructor(e){super(e.resource),this.texture=t.Texture.from(e)}static from(t){return vs.textureMap.has(t)?vs.textureMap.get(t):new vs(t)}setFilters(t,e){const s=this.texture.source.style;s.minFilter=vs.toPixiTextureFilter(t),s.magFilter=vs.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=vs.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){const s=this.texture.source.style;s.addressModeU=vs.toPixiTextureWrap(t),s.addressModeV=vs.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},ks=vs;ks.textureMap=new Map;var Cs={extension:t.ExtensionType.Asset,resolver:{test:e=>t.checkExtension(e,".atlas"),parse:e=>{var s,i,n;const r=e.split(".");return{resolution:parseFloat(null!=(n=null==(i=null==(s=t.Resolver.RETINA_PREFIX)?void 0:s.exec(e))?void 0:i[1])?n:"1"),format:r[r.length-2],src:e}}},loader:{extension:{type:t.ExtensionType.LoadParser,priority:t.LoaderParserPriority.Normal,name:"spineTextureAtlasLoader"},test:e=>t.checkExtension(e,".atlas"),load(e){return c(this,null,(function*(){const s=yield t.DOMAdapter.get().fetch(e);return yield s.text()}))},testParse(e,s){const i=t.checkExtension(s.src,".atlas"),n="string"==typeof e;return Promise.resolve(i&&n)},unload(t){t.dispose()},parse(e,s,r){return c(this,null,(function*(){const a=s.data||{};let o=t.path.dirname(s.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=new Ut(e);if(a.images instanceof t.TextureSource||"string"==typeof a.images){const t=a.images;a.images={},a.images[l.pages[0].name]=t}const c=[];for(const e of l.pages){if(a.resolve){const t=a.resolve().then((t=>{e.setTexture(ks.from(t.source))}));c.push(t);continue}const s=e.name,l=(null==a?void 0:a.images)?a.images[s]:void 0;if(l instanceof t.TextureSource)e.setTexture(ks.from(l));else{const m={src:null!=l?l:t.path.normalize([...o.split(t.path.sep),s].join(t.path.sep)),data:(d=h({},a.imageMetadata),u={alphaMode:e.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"},i(d,n(u)))},f=r.load(m).then((t=>{e.setTexture(ks.from(t.source))}));c.push(f)}}var d,u;return yield Promise.all(c),l}))}}};t.extensions.add(Cs);var Ss={extension:t.ExtensionType.Asset,loader:{extension:{type:t.ExtensionType.LoadParser,priority:t.LoaderParserPriority.Normal,name:"spineSkeletonLoader"},test:e=>t.checkExtension(e,".skel"),load(e){return c(this,null,(function*(){const s=yield t.DOMAdapter.get().fetch(e);return new Uint8Array(yield s.arrayBuffer())}))},testParse(e,s){const i=t.checkExtension(s.src,".json")&&(n=e,Object.prototype.hasOwnProperty.call(n,"bones"));var n;const r=t.checkExtension(s.src,".skel")&&function(t){return t instanceof Uint8Array}(e);return Promise.resolve(i||r)}}};t.extensions.add(Ss);var As=new Float32Array(1),Ts=new Uint32Array(1),Is=class extends t.Geometry{constructor(){const e=new t.Buffer({data:As,label:"attribute-batch-buffer",usage:t.BufferUsage.VERTEX|t.BufferUsage.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:28,offset:0},aUV:{buffer:e,format:"float32x2",stride:28,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:28,offset:16},aDarkColor:{buffer:e,format:"unorm8x4",stride:28,offset:20},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:28,offset:24}},indexBuffer:new t.Buffer({data:Ts,label:"index-batch-buffer",usage:t.BufferUsage.INDEX|t.BufferUsage.COPY_DST,shrinkToFit:!1})})}},Ms={name:"color-bit",vertex:{header:"\n @in aDarkColor: vec4<f32>;\n @out vDarkColor: vec4<f32>;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n @in vDarkColor: vec4<f32>;\n ",end:"\n\n let alpha = outColor.a * vColor.a;\n let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n\n finalColor = vec4<f32>(rgb, alpha);\n\n "}},Fs={name:"color-bit",vertex:{header:"\n in vec4 aDarkColor;\n out vec4 vDarkColor;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n in vec4 vDarkColor;\n ",end:"\n\n finalColor.a = outColor.a * vColor.a;\n finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n "}},Ys=class extends t.Shader{constructor(e){super({glProgram:t.compileHighShaderGlProgram({name:"dark-tint-batch",bits:[t.colorBitGl,Fs,t.generateTextureBatchBitGl(e),t.roundPixelsBitGl]}),gpuProgram:t.compileHighShaderGpuProgram({name:"dark-tint-batch",bits:[t.colorBit,Ms,t.generateTextureBatchBit(e),t.roundPixelsBit]}),resources:{batchSamplers:t.getBatchSamplersUniformGroup(e)}})}},Xs=null,Ps=class extends t.Batcher{constructor(){super(...arguments),this.geometry=new Is,this.shader=Xs||(Xs=new Ys(this.maxTextures)),this.name=Ps.extension.name,this.vertexSize=7}packAttributes(e,s,i,n,r){const a=r<<16|65535&e.roundPixels,o=e.transform,l=o.a,h=o.b,c=o.c,d=o.d,u=o.tx,m=o.ty,{positions:f,uvs:g}=e,p=e.color,x=(p>>24&255)/255,w=t.Color.shared.setValue(e.darkColor).premultiply(x,!0).toPremultiplied(1,!1),b=e.attributeOffset,y=b+e.attributeSize;for(let t=b;t<y;t++){const e=2*t,r=f[e],o=f[e+1];s[n++]=l*r+c*o+u,s[n++]=d*o+h*r+m,s[n++]=g[e],s[n++]=g[e+1],i[n++]=p,i[n++]=w,i[n++]=a}}packQuadAttributes(t,e,s,i,n){const r=t.texture,a=t.transform,o=a.a,l=a.b,h=a.c,c=a.d,d=a.tx,u=a.ty,m=t.bounds,f=m.maxX,g=m.minX,p=m.maxY,x=m.minY,w=r.uvs,b=t.color,y=t.darkColor,v=n<<16|65535&t.roundPixels;e[i+0]=o*g+h*x+d,e[i+1]=c*x+l*g+u,e[i+2]=w.x0,e[i+3]=w.y0,s[i+4]=b,s[i+5]=y,s[i+6]=v,e[i+7]=o*f+h*x+d,e[i+8]=c*x+l*f+u,e[i+9]=w.x1,e[i+10]=w.y1,s[i+11]=b,s[i+12]=y,s[i+13]=v,e[i+14]=o*f+h*p+d,e[i+15]=c*p+l*f+u,e[i+16]=w.x2,e[i+17]=w.y2,s[i+18]=b,s[i+19]=y,s[i+20]=v,e[i+21]=o*g+h*p+d,e[i+22]=c*p+l*g+u,e[i+23]=w.x3,e[i+24]=w.y3,s[i+25]=b,s[i+26]=y,s[i+27]=v}},Bs=Ps;Bs.extension={type:[t.ExtensionType.Batcher],name:"darkTint"},t.extensions.add(Bs);var Rs=class{constructor(){this.indexOffset=0,this.attributeOffset=0,this.batcherName="darkTint",this.topology="triangle-list",this.packAsQuad=!1}get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const n=t.a*s*255;if(16777215!==e){const s=e>>16&255,r=e>>8&255,a=255&e,o=t.r*a,l=t.g*r;i=n<<24|t.b*s<<16|l<<8|o}else i=n<<24|255*t.b<<16|255*t.g<<8|255*t.r;return i}get darkColor(){const t=this.data.darkColor;return 255*t.b<<16|255*t.g<<8|255*t.r}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,i){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const t=e.clippedData;this.indexSize=t.indicesCount,this.attributeSize=t.vertexCount,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},Es={0:"normal",1:"add",2:"multiply",3:"screen"},Ds=class{constructor(t){this.gpuSpineData={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t}validateRenderable(t){if(t._validateAndTransformAttachments(),t.spineAttachmentsDirty)return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let i=0,n=e.length;i<n;i++){const n=e[i],r=n.getAttachment();if(r instanceof Ht||r instanceof zt){const e=t._getCachedData(n,r),i=s.slotBatches[e.id],a=e.texture;if(a!==i.texture&&!i._batcher.checkAndUpdateTexture(i,a))return!0}}}return!1}addRenderable(e,s){var i,n;const r=this._getSpineData(e),a=this.renderer.renderPipes.batch,o=e.skeleton.drawOrder,l=this.renderer._roundPixels|e._roundPixels;e._validateAndTransformAttachments();for(let h=0,c=o.length;h<c;h++){const c=o[h],d=c.getAttachment(),u=Es[c.data.blendMode];if(d instanceof Ht||d instanceof zt){const t=e._getCachedData(c,d),o=(i=r.slotBatches)[n=t.id]||(i[n]=new Rs);o.setData(e,t,u,l),t.skipRender||a.addToBatch(o,s)}const m=e._slotsObject[c.data.name];if(m){const e=m.container;e.includeInBuild=!0,t.collectAllRenderables(e,s,this.renderer),e.includeInBuild=!1}}}updateRenderable(t){var e;const s=this.gpuSpineData[t.uid];t._validateAndTransformAttachments();const i=t.skeleton.drawOrder;for(let n=0,r=i.length;n<r;n++){const r=i[n],a=r.getAttachment();if(a instanceof Ht||a instanceof zt){if(!t._getCachedData(r,a).skipRender){const i=s.slotBatches[t._getCachedData(r,a).id];null==(e=i._batcher)||e.updateElement(i)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};Ds.extension={type:[t.ExtensionType.WebGLPipes,t.ExtensionType.WebGPUPipes,t.ExtensionType.CanvasPipes],name:"spine"},t.extensions.add(Ds);var Vs=new v;pe.yDown=!0;var Ls=new fs,Os=new y((()=>new t.Graphics)),_s=class extends t.ViewContainer{constructor(t){var e;t instanceof be&&(t={skeletonData:t}),super(),this.batched=!0,this.buildId=0,this.renderPipeId="spine",this._didSpineUpdate=!1,this.beforeUpdateWorldTransforms=()=>{},this.afterUpdateWorldTransforms=()=>{},this.darkTint=!1,this._debug=void 0,this._slotsObject=Object.create(null),this.clippingSlotToPixiMasks=Object.create(null),this.spineAttachmentsDirty=!0,this.spineTexturesDirty=!0,this._lastAttachments=[],this._stateChanged=!0,this.attachmentCacheData=[],this._autoUpdate=!0,this.hasNeverUpdated=!0;const s=t instanceof be?t:t.skeletonData;this.skeleton=new pe(s),this.state=new Ct(new Rt(s)),this.autoUpdate=null==(e=null==t?void 0:t.autoUpdate)||e,this.darkTint=void 0===(null==t?void 0:t.darkTint)?this.skeleton.slots.some((t=>!!t.data.darkColor)):null==t?void 0:t.darkTint;const i=this.skeleton.slots;for(let t=0;t<i.length;t++)this.attachmentCacheData[t]=Object.create(null)}getSlotFromRef(t){let e;if(e="number"==typeof t?this.skeleton.slots[t]:"string"==typeof t?this.skeleton.findSlot(t):t,!e)throw new Error(`No slot found with the given slot reference: ${t}`);return e}get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e?t.Ticker.shared.add(this.internalUpdate,this):t.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=e}update(t){this.internalUpdate(0,t)}internalUpdate(e,s){this._updateAndApplyState(null!=s?s:t.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,e){const s=t;if("string"==typeof t&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(Vs.set(e.x,e.y),t.parent){const e=t.parent.worldToLocal(Vs);t.x=e.x,t.y=-e.y}else t.x=Vs.x,t.y=Vs.y}getBonePosition(t,e){const s=t;return"string"==typeof t&&(t=this.skeleton.findBone(t)),t?(e||(e={x:0,y:0}),e.x=t.worldX,e.y=t.worldY,e):(console.error(`Cant set bone position! Bone ${String(s)} not found`),e)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this._boundsDirty=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,e=this._lastAttachments;let s=0,i=!1;for(let n=0;n<t.length;n++){const r=t[n].getAttachment();r&&(r!==e[s]&&(i=!0,e[s]=r),s++)}s!==e.length&&(i=!0,e.length=s),this.spineAttachmentsDirty=i}updateAndSetPixiMask(t,e){var s,i;const n=t.attachment;if(n&&n instanceof Dt){return((s=this.clippingSlotToPixiMasks)[i=t.data.name]||(s[i]={slot:t,vertices:new Array})).maskComputed=!1,void(this.currentClippingSlot=this.clippingSlotToPixiMasks[t.data.name])}let r=this.currentClippingSlot,a=this._slotsObject[t.data.name];if(r&&a){let t=r.slot,e=t.attachment,s=r.mask;if(s||(s=Os.obtain(),r.mask=s,this.addChild(s)),!r.maskComputed){r.maskComputed=!0;const i=e.worldVerticesLength,n=r.vertices;e.computeWorldVertices(t,0,i,n,0,2),s.clear().poly(n).stroke({width:0}).fill({alpha:.25})}a.container.mask=s}else(null==a?void 0:a.container.mask)&&(a.container.mask=null);if(r&&r.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),e)for(const t in this.clippingSlotToPixiMasks){const e=this.clippingSlotToPixiMasks[t];e.slot.attachment instanceof Dt&&e.maskComputed||!e.mask||(this.removeChild(e.mask),Os.free(e.mask),e.mask=void 0)}}transformAttachments(){var e;const s=this.skeleton.drawOrder;for(let i=0;i<s.length;i++){const n=s[i];this.updateAndSetPixiMask(n,i===s.length-1);const r=n.getAttachment();if(r)if(r instanceof zt||r instanceof Ht){const s=this._getCachedData(n,r);r instanceof Ht?r.computeWorldVertices(n,s.vertices,0,2):r.computeWorldVertices(n,0,r.worldVerticesLength,s.vertices,0,2),s.uvs.length<r.uvs.length&&(s.uvs=new Float32Array(r.uvs.length)),t.fastCopy(r.uvs.buffer,s.uvs.buffer);const i=n.bone.skeleton.color,a=n.color,o=r.color;s.color.set(i.r*a.r*o.r,i.g*a.g*o.g,i.b*a.b*o.b,i.a*a.a*o.a),n.darkColor&&s.darkColor.setFromColor(n.darkColor),s.skipRender=s.clipped=!1;const l=(null==(e=r.region)?void 0:e.texture.texture)||t.Texture.EMPTY;s.texture!==l&&(s.texture=l,this.spineTexturesDirty=!0),Ls.isClipping()&&this.updateClippingData(s)}else if(r instanceof Dt){Ls.clipStart(n,r);continue}Ls.clipEndWithSlot(n)}Ls.clipEnd()}updateClippingData(t){t.clipped=!0,Ls.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:e,clippedUVs:s,clippedTriangles:i}=Ls,n=e.length/2,r=i.length;t.clippedData||(t.clippedData={vertices:new Float32Array(2*n),uvs:new Float32Array(2*n),vertexCount:n,indices:new Uint16Array(r),indicesCount:r},this.spineAttachmentsDirty=!0);const a=t.clippedData,o=a.vertexCount!==n||r!==a.indicesCount;t.skipRender=0===n,o&&(this.spineAttachmentsDirty=!0,a.vertexCount<n&&(a.vertices=new Float32Array(2*n),a.uvs=new Float32Array(2*n)),a.indices.length<r&&(a.indices=new Uint16Array(r)));const{vertices:l,uvs:h,indices:c}=a;for(let t=0;t<n;t++)l[2*t]=e[2*t],l[2*t+1]=e[2*t+1],h[2*t]=s[2*t],h[2*t+1]=s[2*t+1];a.vertexCount=n;for(let t=0;t<r;t++)c[t]!==i[t]&&(this.spineAttachmentsDirty=!0,c[t]=i[t]);a.indicesCount=r}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(e){const{slot:s,container:i}=e;if(i.visible=this.skeleton.drawOrder.includes(s),i.visible){const e=s.bone;i.position.set(e.worldX,e.worldY),i.scale.x=e.getWorldScaleX(),i.scale.y=e.getWorldScaleY(),i.rotation=e.getWorldRotationX()*t.DEG_TO_RAD,i.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(t,e){return this.attachmentCacheData[t.data.index][e.name]||this.initCachedData(t,e)}initCachedData(t,e){var s,i;let n;return e instanceof Ht?(n=new Float32Array(8),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:n,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(e.uvs.length),color:new m(1,1,1,1),darkColor:new m(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:null==(s=e.region)?void 0:s.texture.texture}):(n=new Float32Array(e.worldVerticesLength),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:n,clipped:!1,indices:e.triangles,uvs:new Float32Array(e.uvs.length),color:new m(1,1,1,1),darkColor:new m(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:null==(i=e.region)?void 0:i.texture.texture}),this.attachmentCacheData[t.data.index][e.name]}onViewUpdate(){var t;if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),null==(t=this.debug)||t.renderDebug(this)}addSlotObject(t,e){var s;t=this.getSlotFromRef(t);for(const t in this._slotsObject)(null==(s=this._slotsObject[t])?void 0:s.container)===e&&this.removeSlotObject(this._slotsObject[t].slot);this.removeSlotObject(t),e.includeInBuild=!1,this.addChild(e);const i={container:e,slot:t};this._slotsObject[t.data.name]=i,this.updateSlotObject(i)}removeSlotObject(e){var s,i;let n;if(e instanceof t.Container){for(const t in this._slotsObject)if((null==(s=this._slotsObject[t])?void 0:s.container)===e){this._slotsObject[t]=null,n=e;break}}else{const t=this.getSlotFromRef(e);n=null==(i=this._slotsObject[t.data.name])?void 0:i.container,this._slotsObject[t.data.name]=null}n&&(this.removeChild(n),n.includeInBuild=!0)}getSlotObject(t){var e;return t=this.getSlotFromRef(t),null==(e=this._slotsObject[t.data.name])?void 0:e.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||(this.skeletonBounds=new us);const t=this.skeletonBounds;if(t.update(this.skeleton,!0),t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const t=this.skeleton.drawOrder,e=this._bounds;e.clear();for(let s=0;s<t.length;s++){const i=t[s],n=i.getAttachment();if(n&&(n instanceof Ht||n instanceof zt)){const t=this._getCachedData(i,n);e.addVertexData(t.vertices,0,t.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(e=!1){super.destroy(e),t.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,e){this.pixiWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}static from({skeleton:e,atlas:s,scale:i=1,darkTint:n,autoUpdate:r=!0}){const a=`${e}-${s}-${i}`;if(t.Cache.has(a))return new _s(t.Cache.get(a));const o=t.Assets.get(e),l=t.Assets.get(s),h=new Jt(l),c=o instanceof Uint8Array?new Ae(h):new gs(h);c.scale=i;const d=c.readSkeletonData(o);return console.log(">>>skeletonData",d),t.Cache.set(a,d),new _s({skeletonData:d,darkTint:n,autoUpdate:r})}},Us={AlphaTimeline:J,Animation:F,AnimationState:Ct,AnimationStateAdapter:class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},AnimationStateData:Rt,AssetManagerBase:class{constructor(t,e="",s=new ee){this.pathPrefix="",this.assets={},this.errors={},this.toLoad=0,this.loaded=0,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,i)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${i}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${i}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${i}`)}))}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 i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this.success(e,t,this.textureLoader(i))},i.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),i.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let n=t.lastIndexOf("/"),r=n>=0?t.substring(0,n+1):"";t=this.start(t),this.downloader.downloadText(t,(n=>{try{let a=new Ut(n),o=a.pages.length,l=!1;for(let n of a.pages)this.loadTexture(i?i[n.name]:r+n.name,((s,i)=>{l||(n.setTexture(i),0==--o&&this.success(e,t,a))}),((e,i)=>{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,i)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${i}`)}))}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}},AtlasAttachmentLoader:Jt,Attachment:k,AttachmentTimeline:Z,BinaryInput:Te,BlendMode:Ce,Bone:Zt,BoneData:Kt,BoundingBoxAttachment:Et,CURRENT:Bt,ClippingAttachment:Dt,Color:m,ConstraintData:te,CurveTimeline:R,CurveTimeline1:E,CurveTimeline2:D,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)}}},DeformTimeline:tt,Downloader:ee,DrawOrderTimeline:nt,Event:se,EventData:ie,EventQueue:At,EventTimeline:st,EventType:Tt,FIRST:Mt,FakeTexture:class extends Vt{setFilters(t,e){}setWraps(t,e){}dispose(){}},HOLD_FIRST:Yt,HOLD_MIX:Xt,HOLD_SUBSEQUENT:Ft,IkConstraint:ne,IkConstraintData:re,IkConstraintTimeline:rt,Inherit:Qt,InheritTimeline:$,IntSet:class{constructor(){this.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}},Interpolation:p,MathUtils:g,MeshAttachment:zt,MixBlend:Y,MixDirection:X,PathAttachment:Gt,PathConstraint:de,PathConstraintData:ae,PathConstraintMixTimeline:ht,PathConstraintPositionTimeline:ot,PathConstraintSpacingTimeline:lt,Physics:xe,PhysicsConstraintDampingTimeline:mt,PhysicsConstraintGravityTimeline:pt,PhysicsConstraintInertiaTimeline:dt,PhysicsConstraintMassTimeline:ft,PhysicsConstraintMixTimeline:xt,PhysicsConstraintResetTimeline:bt,PhysicsConstraintStrengthTimeline:ut,PhysicsConstraintTimeline:ct,PhysicsConstraintWindTimeline:gt,PointAttachment:$t,Pool:y,PositionMode:oe,Pow:x,PowOut:class extends x{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},RGB2Timeline:Q,RGBA2Timeline:K,RGBATimeline:j,RGBTimeline:H,RegionAttachment:Ht,RotateMode:he,RotateTimeline:V,SETUP:Pt,SUBSEQUENT:It,ScaleTimeline:U,ScaleXTimeline:N,ScaleYTimeline:q,SequenceTimeline:vt,ShearTimeline:W,ShearXTimeline:z,ShearYTimeline:G,Skeleton:pe,SkeletonBinary:Ae,SkeletonBounds:us,SkeletonClipping:fs,SkeletonData:be,SkeletonJson:gs,Skin:ve,SkinEntry:ye,Slot:me,SlotData:ke,SpacingMode:le,Spine:_s,SpineDebugRenderer:class{constructor(){this.registeredSpines=new Map,this.drawMeshHull=!0,this.drawMeshTriangles=!0,this.drawBones=!0,this.drawPaths=!0,this.drawBoundingBoxes=!0,this.drawClipping=!0,this.drawRegionAttachments=!0,this.drawEvents=!0,this.lineWidth=1,this.regionAttachmentsColor=30975,this.meshHullColor=30975,this.meshTrianglesColor=16763904,this.clippingPolygonColor=16711935,this.boundingBoxesRectColor=65280,this.boundingBoxesPolygonColor=65280,this.boundingBoxesCircleColor=65280,this.pathsCurveColor=16711680,this.pathsLineColor=16711935,this.skeletonXYColor=16711680,this.bonesColor=61132,this.eventFontSize=24,this.eventFontColor=0}registerSpine(e){if(this.registeredSpines.has(e))return void console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);const s={parentDebugContainer:new t.Container,bones:new t.Container,skeletonXY:new t.Graphics,regionAttachmentsShape:new t.Graphics,meshTrianglesLine:new t.Graphics,meshHullLine:new t.Graphics,clippingPolygon:new t.Graphics,boundingBoxesRect:new t.Graphics,boundingBoxesCircle:new t.Graphics,boundingBoxesPolygon:new t.Graphics,pathsCurve:new t.Graphics,pathsLine:new t.Graphics,eventText:new t.Container,eventCallback:{event:(i,n)=>{if(this.drawEvents){const i=Math.abs(e.scale.x||e.scale.y||1),r=new t.Text({text:n.data.name,style:{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"}});r.scale.x=Math.sign(e.scale.x),r.anchor.set(.5),s.eventText.addChild(r),setTimeout((()=>{r.destroyed||r.destroy()}),250)}}}};s.parentDebugContainer.addChild(s.bones),s.parentDebugContainer.addChild(s.skeletonXY),s.parentDebugContainer.addChild(s.regionAttachmentsShape),s.parentDebugContainer.addChild(s.meshTrianglesLine),s.parentDebugContainer.addChild(s.meshHullLine),s.parentDebugContainer.addChild(s.clippingPolygon),s.parentDebugContainer.addChild(s.boundingBoxesRect),s.parentDebugContainer.addChild(s.boundingBoxesCircle),s.parentDebugContainer.addChild(s.boundingBoxesPolygon),s.parentDebugContainer.addChild(s.pathsCurve),s.parentDebugContainer.addChild(s.pathsLine),s.parentDebugContainer.addChild(s.eventText),s.parentDebugContainer.zIndex=9999999,s.parentDebugContainer.accessibleChildren=!1,s.parentDebugContainer.eventMode="none",s.parentDebugContainer.interactiveChildren=!1,e.addChild(s.parentDebugContainer),e.state.addListener(s.eventCallback),this.registeredSpines.set(e,s)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let t=e.bones.children.length;t>0;t--)e.bones.children[t-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,i,s),this.drawPaths&&this.drawPathsFunc(t,e,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,i),this.drawClipping&&this.drawClippingFunc(t,e,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,i),this.drawEvents)for(const t of e.eventText.children)t.alpha-=.05,t.y-=2}drawBonesFunc(e,s,i,n){const r=e.skeleton,a=r.x,o=r.y,l=r.bones;s.skeletonXY.strokeStyle={width:i,color:this.skeletonXYColor};for(let e=0,r=l.length;e<r;e++){const r=l[e],h=r.data.length,c=a+r.worldX,d=o+r.worldY,u=a+h*r.a+r.worldX,m=o+h*r.b+r.worldY;if("root"===r.data.name||null===r.data.parent)continue;const f=Math.abs(c-u),g=Math.abs(d-m),p=Math.pow(f,2),x=g,w=Math.pow(g,2),b=Math.sqrt(p+w),y=Math.pow(b,2),v=Math.PI/180,k=Math.acos((y+w-p)/(2*x*b))||0;if(0===b)continue;const C=new t.Graphics;s.bones.addChild(C);const S=b/50/n;C.context.poly([0,0,0-S,b-3*S,0,b-S,0+S,b-3*S]).fill(this.bonesColor),C.x=c,C.y=d,C.pivot.y=b;let A=0;c<u&&d<m?A=180*v-k:c>u&&d<m?A=180*v+k:c>u&&d>m?A=-k:c<u&&d>m?A=k:d===m&&c<u?A=90*v:d===m&&c>u?A=-90*v:c===u&&d<m?A=180*v:c===u&&d>m&&(A=0),C.rotation=A,C.circle(0,b,1.2*S).fill({color:0,alpha:.6}).stroke({width:i+S/2.4,color:this.bonesColor})}const h=3*i;s.skeletonXY.context.moveTo(a-h,o-h).lineTo(a+h,o+h).moveTo(a+h,o-h).lineTo(a-h,o+h).stroke()}drawRegionAttachmentsFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t],n=s.getAttachment();if(null===n||!(n instanceof Ht))continue;const r=n,a=new Float32Array(8);r.computeWorldVertices(s,a,0,2),e.regionAttachmentsShape.poly(Array.from(a.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof zt))continue;const r=n,a=new Float32Array(r.worldVerticesLength),o=r.triangles;let l=r.hullLength;if(r.computeWorldVertices(s,0,r.worldVerticesLength,a,0,2),this.drawMeshTriangles)for(let t=0,s=o.length;t<s;t+=3){const s=2*o[t],i=2*o[t+1],n=2*o[t+2];e.meshTrianglesLine.context.moveTo(a[s],a[s+1]).lineTo(a[i],a[i+1]).lineTo(a[n],a[n+1])}if(this.drawMeshHull&&l>0){l=2*(l>>1);let t=a[l-2],s=a[l-1];for(let i=0,n=l;i<n;i+=2){const n=a[i],r=a[i+1];e.meshHullLine.context.moveTo(n,r).lineTo(t,s),t=n,s=r}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Dt))continue;const r=n,a=r.worldVerticesLength,o=new Float32Array(a);r.computeWorldVertices(s,0,a,o,0,2),e.clippingPolygon.poly(Array.from(o))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const i=new us;i.update(t.skeleton,!0),i.minX!==1/0&&e.boundingBoxesRect.rect(i.minX,i.minY,i.getWidth(),i.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const n=i.polygons,r=(t,i,n)=>{if(n<3)throw new Error("Polygon must contain at least 3 vertices");const r=[],a=2*s;for(let s=0,i=t.length;s<i;s+=2){const i=t[s],n=t[s+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(i,n,a),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(i,n,a).fill({color:this.boundingBoxesCircleColor}),r.push(i,n)}e.boundingBoxesPolygon.poly(r).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let t=0,e=n.length;t<e;t++){const e=n[t];r(e,0,e.length)}}drawPathsFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Gt))continue;const r=n;let a=r.worldVerticesLength;const o=new Float32Array(a);r.computeWorldVertices(s,0,a,o,0,2);let l=o[2],h=o[3],c=0,d=0;if(r.closed){const t=o[0],s=o[1],i=o[a-2],n=o[a-1];c=o[a-4],d=o[a-3],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(t,s,i,n,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(t,s),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(i,n)}a-=4;for(let t=4;t<a;t+=6){const s=o[t],i=o[t+1],n=o[t+2],r=o[t+3];c=o[t+4],d=o[t+5],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(s,i,n,r,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(s,i),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(n,r),l=c,h=d}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}},SpinePipe:Ds,SpineTexture:ks,StringSet:d,Texture:Vt,TextureAtlas:Ut,TextureAtlasPage:qt,TextureAtlasRegion:Wt,TextureFilter:Lt,TextureRegion:_t,TextureWrap:Ot,TimeKeeper:class{constructor(){this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.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)}},Timeline:B,TrackEntry:St,TransformConstraint:fe,TransformConstraintData:Se,TransformConstraintTimeline:at,TranslateTimeline:L,TranslateXTimeline:O,TranslateYTimeline:_,Triangulator:ms,Utils:b,Vector2:v,VertexAttachment:S,WindowedMean:class{constructor(t=32){this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,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}}};class Ns extends e.SpineSystem{init(){super.init({pixiSpine:Us})}}class qs extends e.Spine{}exports.PixiSpine=Us,exports.Spine=qs,exports.SpineSystem=Ns;