@eva/plugin-renderer-spine 2.0.1-beta.31 → 2.0.1-beta.33
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,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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("pixi.js"),e=require("@eva/spine-base"),s=Object.defineProperty,r=(t,e,r)=>(((t,e,r)=>{e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(t,"symbol"!=typeof e?e+"":e,r),r);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 n=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,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},i=class{r;g;b;a;constructor(t=0,e=0,s=0,r=0){this.r=t,this.g=e,this.b=s,this.a=r}set(t,e,s,r){return this.r=t,this.g=e,this.b=s,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,r){return this.r+=t,this.g+=e,this.b+=s,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new i).setFromString(t)}},a=i;r(a,"WHITE",new i(1,1,1,1)),r(a,"RED",new i(1,0,0,1)),r(a,"GREEN",new i(0,1,0,1)),r(a,"BLUE",new i(0,0,1,1)),r(a,"MAGENTA",new i(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 r=Math.random(),n=e-t;return r<=(s-t)/n?t+Math.sqrt(r*n*(s-t)):e-Math.sqrt((1-r)*n*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}},l=o;r(l,"PI",3.1415927),r(l,"PI2",2*o.PI),r(l,"invPI2",1/o.PI2),r(l,"radiansToDegrees",180/o.PI),r(l,"radDeg",o.radiansToDegrees),r(l,"degreesToRadians",o.PI/180),r(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,r,n){for(let i=e,a=r;i<e+n;i++,a++)s[a]=t[i]}static arrayFill(t,e,s,r){for(let n=e;n<s;n++)t[n]=r}static setArraySize(t,e,s=0){let r=t.length;if(r==e)return t;if(t.length=e,r<e)for(let n=r;n<e;n++)t[n]=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 r=0;r<t;r++)s[r]=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 r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}},u=d;r(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{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}},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,r,n,i){s=n+(s>>1)*i;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+=i){let e=l[t],s=l[t+1];r[a]=e*d+s*u+h,r[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+=i){let s=0,n=0,i=h[c++];for(i+=c;c<i;c++,e+=3){let t=u[h[c]],r=l[e],i=l[e+1],a=l[e+2];s+=(r*t.a+i*t.b+t.worldX)*a,n+=(r*t.c+i*t.d+t.worldY)*a}r[t]=s,r[t+1]=n}else{let t=o;for(let e=n,a=3*d,o=d<<1;e<s;e+=i){let s=0,n=0,i=h[c++];for(i+=c;c<i;c++,a+=3,o+=2){let e=u[h[c]],r=l[a]+t[o],i=l[a+1]+t[o+1],d=l[a+2];s+=(r*e.a+i*e.b+e.worldX)*d,n+=(r*e.c+i*e.d+e.worldY)*d}r[e]=s,r[e+1]=n}}}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;r(x,"nextID",0);var b,w,y=class{id=y.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new y(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 r=this.regions[s];e.region!=r&&(e.region=r,e.updateRegion())}getPath(t,e){let s=t,r=(this.start+e).toString();for(let t=this.digits-r.length;t>0;t--)s+="0";return s+=r,s}static nextID(){return y._nextID++}},k=y;r(k,"_nextID",0),(w=b||(b={}))[w.hold=0]="hold",w[w.once=1]="once",w[w.loop=2]="loop",w[w.pingpong=3]="pingpong",w[w.onceReverse=4]="onceReverse",w[w.loopReverse=5]="loopReverse",w[w.pingpongReverse=6]="pingpongReverse";var v,C,S,A,T=[b.hold,b.once,b.loop,b.pingpong,b.onceReverse,b.loopReverse,b.pingpongReverse],I=class{name;timelines=[];timelineIds=new n;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,n,i,a,o){if(!t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let r=0,h=l.length;r<h;r++)l[r].apply(t,e,s,n,i,a,o)}};(C=v||(v={}))[C.setup=0]="setup",C[C.first=1]="first",C[C.replace=2]="replace",C[C.add=3]="add",(A=S||(S={}))[A.mixIn=0]="mixIn",A[A.mixOut=1]="mixOut";var M={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},F=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 r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){let r=t.length;for(let n=s;n<r;n+=s)if(t[n]>e)return n-s;return r-s}},Y=class extends F{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,r,n,i,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(r-2*i+o),f=.03*(n-2*a+l),g=.006*(3*(i-o)-r+h),p=.006*(3*(a-l)-n+c),x=2*m+g,b=2*f+p,w=.3*(i-r)+m+.16666667*g,y=.3*(a-n)+f+.16666667*p,k=r+w,v=n+y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,w+=x,y+=b,x+=g,b+=p,k+=w,v+=y}getBezierValue(t,e,s,r){let n=this.curves;if(n[r]>t){let i=this.frames[e],a=this.frames[e+s];return a+(t-i)/(n[r]-i)*(n[r+1]-a)}let i=r+18;for(r+=2;r<i;r+=2)if(n[r]>=t){let e=n[r-2],s=n[r-1];return s+(t-e)/(n[r]-e)*(n[r+1]-s)}e+=this.getFrameEntries();let a=n[i-2],o=n[i-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}},P=class extends Y{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let r=this.curves[s>>1];switch(r){case 0:let r=e[s],n=e[s+1];return n+(t-r)/(e[s+2]-r)*(e[s+2+1]-n);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}getRelativeValue(t,e,s,r,n){if(t<this.frames[0]){switch(s){case v.setup:return n;case v.first:return r+(n-r)*e}return r}let i=this.getCurveValue(t);switch(s){case v.setup:return n+i*e;case v.first:case v.replace:i+=n-r}return r+i*e}getAbsoluteValue(t,e,s,r,n){if(t<this.frames[0]){switch(s){case v.setup:return n;case v.first:return r+(n-r)*e}return r}let i=this.getCurveValue(t);return s==v.setup?n+(i-n)*e:r+(i-r)*e}getAbsoluteValue2(t,e,s,r,n,i){if(t<this.frames[0]){switch(s){case v.setup:return n;case v.first:return r+(n-r)*e}return r}return s==v.setup?n+(i-n)*e:r+(i-r)*e}getScaleValue(t,e,s,r,n,i){if(t<this.frames[0]){switch(s){case v.setup:return i;case v.first:return n+(i-n)*e}return n}let a=this.getCurveValue(t)*i;if(1==e)return s==v.add?n+a-i:a;if(r==S.mixOut)switch(s){case v.setup:return i+(Math.abs(a)*l.signum(i)-i)*e;case v.first:case v.replace:return n+(Math.abs(a)*l.signum(n)-n)*e}else{let t=0;switch(s){case v.setup:return t=Math.abs(i)*l.signum(a),t+(a-t)*e;case v.first:case v.replace:return t=Math.abs(n)*l.signum(a),t+(a-t)*e}}return n+(a-i)*e}},R=class extends Y{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}},X=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,n,i,o.rotation,o.data.rotation))}},B=class extends R{boneIndex=0;constructor(t,e,s){super(t,e,M.x+"|"+s,M.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(i){case v.setup:return o.x=o.data.x,void(o.y=o.data.y);case v.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let h=0,c=0,d=F.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(i){case v.setup:o.x=o.data.x+h*n,o.y=o.data.y+c*n;break;case v.first:case v.replace:o.x+=(o.data.x+h-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case v.add:o.x+=h*n,o.y+=c*n}}},E=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.x+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,n,i,o.x,o.data.x))}},D=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.y+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,n,i,o.y,o.data.y))}},V=class extends R{boneIndex=0;constructor(t,e,s){super(t,e,M.scaleX+"|"+s,M.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];if(!o.active)return;let h,c,d=this.frames;if(s<d[0]){switch(i){case v.setup:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case v.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u=F.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==n)i==v.add?(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(a==S.mixOut)switch(i){case v.setup:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(h)*l.signum(t)-t)*n,o.scaleY=e+(Math.abs(c)*l.signum(e)-e)*n;break;case v.first:case v.replace:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(h)*l.signum(t)-t)*n,o.scaleY=e+(Math.abs(c)*l.signum(e)-e)*n;break;case v.add:o.scaleX+=(h-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}else switch(i){case v.setup:t=Math.abs(o.data.scaleX)*l.signum(h),e=Math.abs(o.data.scaleY)*l.signum(c),o.scaleX=t+(h-t)*n,o.scaleY=e+(c-e)*n;break;case v.first:case v.replace:t=Math.abs(o.scaleX)*l.signum(h),e=Math.abs(o.scaleY)*l.signum(c),o.scaleX=t+(h-t)*n,o.scaleY=e+(c-e)*n;break;case v.add:o.scaleX+=(h-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}}}},L=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,n,i,a,o.scaleX,o.data.scaleX))}},N=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,n,i,a,o.scaleY,o.data.scaleY))}},_=class extends R{boneIndex=0;constructor(t,e,s){super(t,e,M.shearX+"|"+s,M.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(i){case v.setup:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case v.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let h=0,c=0,d=F.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(i){case v.setup:o.shearX=o.data.shearX+h*n,o.shearY=o.data.shearY+c*n;break;case v.first:case v.replace:o.shearX+=(o.data.shearX+h-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case v.add:o.shearX+=h*n,o.shearY+=c*n}}},O=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,n,i,o.shearX,o.data.shearX))}},U=class extends P{boneIndex=0;constructor(t,e,s){super(t,e,M.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,n,i,o.shearY,o.data.shearY))}},q=class extends F{boneIndex=0;constructor(t,e){super(t,[M.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,r,n,i,a){let o=t.bones[this.boneIndex];if(!o.active)return;if(a==S.mixOut)return void(i==v.setup&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?i!=v.setup&&i!=v.first||(o.inherit=o.data.inherit):o.inherit=this.frames[F.search(l,s,2)+1]}},W=class extends Y{slotIndex=0;constructor(t,e,s){super(t,e,[M.rgb+"|"+s,M.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,n,i){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=i}apply(t,e,s,r,n,i,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(i){case v.setup:return void h.setFromColor(t);case v.first: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=F.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):(i==v.setup&&h.setFromColor(o.data.color),h.add((c-h.r)*n,(d-h.g)*n,(u-h.b)*n,(m-h.a)*n))}},z=class extends Y{slotIndex=0;constructor(t,e,s){super(t,e,[M.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n}apply(t,e,s,r,n,i,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(i){case v.setup:return h.r=t.r,h.g=t.g,void(h.b=t.b);case v.first: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=F.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(i==v.setup){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}}},G=class extends P{slotIndex=0;constructor(t,e,s){super(t,e,M.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,r,n,i,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(i){case v.setup:return void(l.a=t.a);case v.first:l.a+=(t.a-l.a)*n}return}let h=this.getCurveValue(s);1==n?l.a=h:(i==v.setup&&(l.a=o.data.color.a),l.a+=(h-l.a)*n)}},$=class extends Y{slotIndex=0;constructor(t,e,s){super(t,e,[M.rgb+"|"+s,M.alpha+"|"+s,M.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,n,i,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=i,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,n,i,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(i){case v.setup:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case v.first: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,b=F.search(l,s,8),w=this.curves[b>>3];switch(w){case 0:let t=l[b];d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],g=l[b+5],p=l[b+6],x=l[b+7];let e=(s-t)/(l[b+8]-t);d+=(l[b+8+1]-d)*e,u+=(l[b+8+2]-u)*e,m+=(l[b+8+3]-m)*e,f+=(l[b+8+4]-f)*e,g+=(l[b+8+5]-g)*e,p+=(l[b+8+6]-p)*e,x+=(l[b+8+7]-x)*e;break;case 1:d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],g=l[b+5],p=l[b+6],x=l[b+7];break;default:d=this.getBezierValue(s,b,1,w-2),u=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+36-2),f=this.getBezierValue(s,b,4,w+54-2),g=this.getBezierValue(s,b,5,w+72-2),p=this.getBezierValue(s,b,6,w+90-2),x=this.getBezierValue(s,b,7,w+108-2)}if(1==n)h.set(d,u,m,f),c.r=g,c.g=p,c.b=x;else{if(i==v.setup){h.setFromColor(o.data.color);let t=o.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b}h.add((d-h.r)*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}}},j=class extends Y{slotIndex=0;constructor(t,e,s){super(t,e,[M.rgb+"|"+s,M.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,i,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=i,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,r,n,i,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(i){case v.setup:return h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,void(c.b=e.b);case v.first: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=F.search(l,s,7),b=this.curves[x/7];switch(b){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,b-2),u=this.getBezierValue(s,x,2,b+18-2),m=this.getBezierValue(s,x,3,b+36-2),f=this.getBezierValue(s,x,4,b+54-2),g=this.getBezierValue(s,x,5,b+72-2),p=this.getBezierValue(s,x,6,b+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(i==v.setup){let t=o.data.color,e=o.data.darkColor;h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,c.b=e.b}h.r+=(d-h.r)*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}}},H=class extends F{slotIndex=0;attachmentNames;constructor(t,e){super(t,[M.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,i,a){let o=t.slots[this.slotIndex];o.bone.active&&(a!=S.mixOut?s<this.frames[0]?i!=v.setup&&i!=v.first||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[F.search1(this.frames,s)]):i==v.setup&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},J=class extends Y{slotIndex=0;attachment;vertices;constructor(t,e,s,r){super(t,e,[M.deform+"|"+s+"|"+r.id]),this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,n,i,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(r-2*i+o),f=.03*l-.06*a,g=.006*(3*(i-o)-r+h),p=.018*(a-l+.33333333),x=2*m+g,b=2*f+p,w=.3*(i-r)+m+.16666667*g,y=.3*a+f+.16666667*p,k=r+w,v=y;for(let t=u+18;u<t;u+=2)d[u]=k,d[u+1]=v,w+=x,y+=b,x+=g,b+=p,k+=w,v+=y}getCurvePercent(t,e){let s=this.curves,r=s[e];switch(r){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(r-=2,s[r]>t){let n=this.frames[e];return s[r+1]*(t-n)/(s[r]-n)}let n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=t){let e=s[r-2],n=s[r-1];return n+(t-e)/(s[r]-e)*(s[r+1]-n)}let i=s[n-2],a=s[n-1];return a+(1-a)*(t-i)/(this.frames[e+this.getFrameEntries()]-i)}apply(t,e,s,r,n,i,a){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&&(i=v.setup);let c=this.vertices,d=c[0].length,m=this.frames;if(s<m[0]){switch(i){case v.setup:return void(h.length=0);case v.first:if(1==n)return void(h.length=0);h.length=d;let t=l;if(t.bones){n=1-n;for(f=0;f<d;f++)h[f]*=n}else{let e=t.vertices;for(var f=0;f<d;f++)h[f]+=(e[f]-h[f])*n}}return}if(h.length=d,s>=m[m.length-1]){let t=c[m.length-1];if(1==n)if(i==v.add){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(i){case v.setup:{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 r=s[e];h[e]=r+(t[e]-r)*n}}break}case v.first:case v.replace:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*n;break;case v.add: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 g=F.search1(m,s),p=this.getCurvePercent(s,g),b=c[g],w=c[g+1];if(1==n)if(i==v.add){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=b[t];h[t]+=e+(w[t]-e)*p}else{let e=t.vertices;for(let t=0;t<d;t++){let s=b[t];h[t]+=s+(w[t]-s)*p-e[t]}}}else for(let t=0;t<d;t++){let e=b[t];h[t]=e+(w[t]-e)*p}else switch(i){case v.setup:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=b[t];h[t]=(e+(w[t]-e)*p)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=b[t],r=e[t];h[t]=r+(s+(w[t]-s)*p-r)*n}}break}case v.first:case v.replace:for(let t=0;t<d;t++){let e=b[t];h[t]+=(e+(w[t]-e)*p-h[t])*n}break;case v.add:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=b[t];h[t]+=(e+(w[t]-e)*p)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=b[t];h[t]+=(s+(w[t]-s)*p-e[t])*n}}}}},K=class extends F{events;constructor(t){super(t,K.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,i,a){if(!r)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,i,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=F.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)r.push(this.events[h])}},Q=K;r(Q,"propertyIds",[""+M.event]);var Z=class extends F{drawOrders;constructor(t){super(t,Z.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,i,a){if(a==S.mixOut)return void(i==v.setup&&u.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(i!=v.setup&&i!=v.first||u.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=F.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,r=l.length;t<r;t++)e[t]=s[l[t]]}else u.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}},tt=Z;r(tt,"propertyIds",[""+M.drawOrder]);var et=class extends Y{constraintIndex=0;constructor(t,e,s){super(t,e,[M.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,n,i,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=i?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,r,n,i,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(i){case v.setup:return o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,void(o.stretch=o.data.stretch);case v.first: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=F.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)}i==v.setup?(o.mix=o.data.mix+(h-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,a==S.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5])):(o.mix+=(h-o.mix)*n,o.softness+=(c-o.softness)*n,a==S.mixIn&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}},st=class extends Y{constraintIndex=0;constructor(t,e,s){super(t,e,[M.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,i,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=r,l[t+3]=n,l[t+4]=i,l[t+5]=a,l[t+6]=o}apply(t,e,s,r,n,i,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(i){case v.setup:return o.mixRotate=t.mixRotate,o.mixX=t.mixX,o.mixY=t.mixY,o.mixScaleX=t.mixScaleX,o.mixScaleY=t.mixScaleY,void(o.mixShearY=t.mixShearY);case v.first: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=F.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(i==v.setup){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}},rt=class extends P{constraintIndex=0;constructor(t,e,s){super(t,e,M.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,r,n,i,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,n,i,o.position,o.data.position))}},nt=class extends P{constraintIndex=0;constructor(t,e,s){super(t,e,M.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,r,n,i,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,n,i,o.spacing,o.data.spacing))}},it=class extends Y{constraintIndex=0;constructor(t,e,s){super(t,e,[M.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){let i=this.frames;i[t<<=2]=e,i[t+1]=s,i[t+2]=r,i[t+3]=n}apply(t,e,s,r,n,i,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(i){case v.setup:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case v.first: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=F.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(i==v.setup){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}},at=class extends P{constraintIndex=0;constructor(t,e,s,r){super(t,e,r+"|"+s),this.constraintIndex=s}apply(t,e,s,r,n,i,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const r of t.physicsConstraints)r.active&&this.global(r.data)&&this.set(r,this.getAbsoluteValue2(s,n,i,this.get(r),this.setup(r),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,n,i,this.get(o),this.setup(o)))}},ot=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},lt=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},ht=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ct=class extends at{constructor(t,e,s){super(t,e,s,M.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}},dt=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},ut=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},mt=class extends at{constructor(t,e,s){super(t,e,s,M.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},ft=class extends F{constraintIndex;constructor(t,e){super(t,ft.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,r,n,i,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,i,a),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[F.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}},gt=ft;r(gt,"propertyIds",[M.physicsConstraintReset.toString()]);var pt=class extends F{slotIndex;attachment;constructor(t,e,s){super(t,[M.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return pt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,r,n){let i=this.frames;i[t*=pt.ENTRIES]=e,i[t+pt.MODE]=s|r<<4,i[t+pt.DELAY]=n}apply(t,e,s,r,n,i,a){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(a==S.mixOut)return void(i==v.setup&&(o.sequenceIndex=-1));let c=this.frames;if(s<c[0])return void(i!=v.setup&&i!=v.first||(o.sequenceIndex=-1));let d=F.search(c,s,pt.ENTRIES),u=c[d],m=c[d+pt.MODE],f=c[d+pt.DELAY];if(!this.attachment.sequence)return;let g=m>>4,p=this.attachment.sequence.regions.length,w=T[15&m];if(w!=b.hold)switch(g+=(s-u)/f+1e-5|0,w){case b.once:g=Math.min(p-1,g);break;case b.loop:g%=p;break;case b.pingpong:{let t=(p<<1)-2;g=0==t?0:g%t,g>=p&&(g=t-g);break}case b.onceReverse:g=Math.max(p-1-g,0);break;case b.loopReverse:g=p-1-g%p;break;case b.pingpongReverse:{let t=(p<<1)-2;g=0==t?0:(g+p-1)%t,g>=p&&(g=t-g)}}o.sequenceIndex=g}},xt=pt;r(xt,"ENTRIES",3),r(xt,"MODE",1),r(xt,"DELAY",2);var bt=class{static emptyAnimation(){return bt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Ct(this);propertyIDs=new n;animationsChanged=!1;trackEntryPool=new m((()=>new vt));constructor(t){this.data=t}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=t*r.timeScale;if(r.delay>0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let i=r.next;if(i){let e=r.trackLast-i.delay;if(e>=0){for(i.delay=0,i.trackTime+=0==r.timeScale?0:(e/r.timeScale+t)*i.timeScale,r.trackTime+=n,this.setCurrent(s,i,!0);i.mixingFrom;)i.mixTime+=t,i=i.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){e[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let t=r.mixingFrom;for(r.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let r=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)),r}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,r=!1;for(let i=0,a=s.length;i<a;i++){let a=s[i];if(!a||a.delay>0)continue;r=!0;let o=0==i?v.first: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(),m=d,f=e;a.reverse&&(m=a.animation.duration-m,f=null);let g=a.animation.timelines,p=g.length;if(0==i&&1==l||o==v.add){0==i&&(h=!0);for(let e=0;e<p;e++){u.webkit602BugfixHelper(l,o);var n=g[e];n instanceof H?this.applyAttachmentTimeline(n,t,m,o,h):n.apply(t,c,m,f,l,o,S.mixIn)}}else{let e=a.timelineMode,s=a.shortestRotation,r=!s&&a.timelinesRotation.length!=p<<1;r&&(a.timelinesRotation.length=p<<1);for(let n=0;n<p;n++){let i=g[n],d=e[n]==Mt?o:v.setup;!s&&i instanceof X?this.applyRotateTimeline(i,t,m,l,d,a.timelinesRotation,n<<1,r):i instanceof H?this.applyAttachmentTimeline(i,t,m,o,h):(u.webkit602BugfixHelper(l,o),i.apply(t,c,m,f,l,d,S.mixIn))}}this.queueEvents(a,d),e.length=0,a.nextAnimationLast=d,a.nextTrackLast=a.trackTime}for(var i=this.unkeyedState+Xt,a=t.slots,o=0,l=t.slots.length;o<l;o++){var h=a[o];if(h.attachmentState==i){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,e,s){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,e,s);let n=0;0==t.mixDuration?(n=1,s==v.first&&(s=v.setup)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),s!=v.first&&(s=r.mixBlend));let i=n<r.mixAttachmentThreshold,a=n<r.mixDrawOrderThreshold,o=r.animation.timelines,l=o.length,h=r.alpha*t.interruptAlpha,c=h*(1-n),d=r.animationLast,m=r.getAnimationTime(),f=m,g=null;if(r.reverse?f=r.animation.duration-f:n<r.eventThreshold&&(g=this.events),s==v.add)for(let t=0;t<l;t++)o[t].apply(e,d,f,g,c,s,S.mixOut);else{let t=r.timelineMode,n=r.timelineHoldMix,m=r.shortestRotation,p=!m&&r.timelinesRotation.length!=l<<1;p&&(r.timelinesRotation.length=l<<1),r.totalAlpha=0;for(let x=0;x<l;x++){let l,b=o[x],w=S.mixOut,y=0;switch(t[x]){case Mt:if(!a&&b instanceof tt)continue;l=s,y=c;break;case Ft:l=v.setup,y=c;break;case Yt:l=s,y=h;break;case Pt:l=v.setup,y=h;break;default:l=v.setup;let t=n[x];y=h*Math.max(0,1-t.mixTime/t.mixDuration)}r.totalAlpha+=y,!m&&b instanceof X?this.applyRotateTimeline(b,e,f,y,l,r.timelinesRotation,x<<1,p):b instanceof H?this.applyAttachmentTimeline(b,e,f,l,i&&y>=r.alphaAttachmentThreshold):(u.webkit602BugfixHelper(y,s),a&&b instanceof tt&&l==v.setup&&(w=S.mixIn),b.apply(e,d,f,g,y,l,w))}}return t.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,n}applyAttachmentTimeline(t,e,s,r,n){var i=e.slots[t.slotIndex];i.bone.active&&(s<t.frames[0]?r!=v.setup&&r!=v.first||this.setAttachment(e,i,i.data.attachmentName,n):this.setAttachment(e,i,t.attachmentNames[F.search1(t.frames,s)],n),i.attachmentState<=this.unkeyedState&&(i.attachmentState=this.unkeyedState+Xt))}setAttachment(t,e,s,r){e.setAttachment(s?t.getAttachment(e.data.index,s):null),r&&(e.attachmentState=this.unkeyedState+Bt)}applyRotateTimeline(t,e,s,r,n,i,a,o){if(o&&(i[a]=0),1==r)return void t.apply(e,0,s,null,1,n,S.mixIn);let h=e.bones[t.boneIndex];if(!h.active)return;let c=0,d=0;if(s<t.frames[0])switch(n){case v.setup:h.rotation=h.data.rotation;default:return;case v.first:c=h.rotation,d=h.data.rotation}else c=n==v.setup?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=i[a];else{let t=0,e=0;o?(t=0,e=m):(t=i[a],e=i[a+1]);let s=t-t%360;u=m+s;let r=m>=0,n=t>=0;Math.abs(e)<=90&&l.signum(e)!=l.signum(m)&&(Math.abs(t-s)>180?(u+=360*l.signum(t),n=r):0!=s?u-=360*l.signum(t):n=r),n!=r&&(u+=360*l.signum(t)),i[a]=u}i[a+1]=m,h.rotation=c+u*r}queueEvents(t,e){let s=t.animationStart,r=t.animationEnd,n=r-s,i=t.trackLast%n,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<i)break;e.time>r||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>=r&&t.animationLast<r;for(h&&this.queue.complete(t);o<l;o++){let e=a[o];e.time<s||this.queue.event(t,e)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){let t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(s&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let r=!0,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,r=!1):this.clearNext(n));let i=this.trackEntry(t,e,s,n);return this.setCurrent(t,i,r),this.queue.drain(),i}addAnimation(t,e,s=!1,r=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,r)}addAnimationWith(t,e,s=!1,r=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let i=this.trackEntry(t,e,s,n);return n?(n.next=i,i.previous=n,r<=0&&(r+=n.getTrackComplete()-i.mixDuration)):(this.setCurrent(t,i,!0),this.queue.drain()),i.delay=r,i}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,bt.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let r=this.addAnimationWith(t,bt.emptyAnimation(),!1,s);return s<=0&&(r.delay+=r.mixDuration-e),r.mixDuration=e,r.trackEnd=e,r}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(u.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,e,s,r){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=r?this.data.getMix(r.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=v.replace,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&&s.mixBlend==v.add||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,r=t.animation.timelines.length,n=t.timelineMode;n.length=r;let i=t.timelineHoldMix;i.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<r;t++)n[t]=a.addAll(s[t].getPropertyIds())?Pt:Yt;else t:for(let o=0;o<r;o++){let r=s[o],l=r.getPropertyIds();if(a.addAll(l))if(!e||r instanceof H||r instanceof tt||r instanceof Q||!e.animation.hasTimeline(l))n[o]=Ft;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){n[o]=Rt,i[o]=s;continue t}break}n[o]=Pt}else n[o]=Mt}}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()}},wt=bt;r(wt,"_emptyAnimation",new I("<empty>",[],0));var yt,kt,vt=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=v.replace;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}},Ct=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(yt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(yt.interrupt),this.objects.push(t)}end(t){this.objects.push(yt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(yt.dispose),this.objects.push(t)}complete(t){this.objects.push(yt.complete),this.objects.push(t)}event(t,e){this.objects.push(yt.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let r=t[s],n=t[s+1];switch(r){case yt.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 yt.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 yt.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 yt.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 yt.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 yt.event:let r=t[2+s++];n.listener&&n.listener.event&&n.listener.event(n,r);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(n,r)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};(kt=yt||(yt={}))[kt.start=0]="start",kt[kt.interrupt=1]="interrupt",kt[kt.end=2]="end",kt[kt.dispose=3]="dispose",kt[kt.complete=4]="complete",kt[kt.event=5]="event";var St,At,Tt,It,Mt=0,Ft=1,Yt=2,Pt=3,Rt=4,Xt=1,Bt=2,Et=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(r,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 r=t.name+"."+e.name;this.animationToMixTime[r]=s}getMix(t,e){let s=t.name+"."+e.name,r=this.animationToMixTime[s];return void 0===r?this.defaultMix:r}},Dt=class extends x{color=new a(1,1,1,1);constructor(t){super(t)}copy(){let t=new Dt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Vt=class extends x{endSlot=null;color=new a(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Vt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Lt=class{_image;constructor(t){this._image=t}getImage(){return this._image}};(At=St||(St={}))[At.Nearest=9728]="Nearest",At[At.Linear=9729]="Linear",At[At.MipMap=9987]="MipMap",At[At.MipMapNearestNearest=9984]="MipMapNearestNearest",At[At.MipMapLinearNearest=9985]="MipMapLinearNearest",At[At.MipMapNearestLinear=9986]="MipMapNearestLinear",At[At.MipMapLinearLinear=9987]="MipMapLinearLinear",(It=Tt||(Tt={}))[It.MirroredRepeat=33648]="MirroredRepeat",It[It.ClampToEdge=33071]="ClampToEdge",It[It.Repeat=10497]="Repeat";var Nt=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},_t=class{pages=new Array;regions=new Array;constructor(t){let e=new Ot(t),s=new Array(4),r={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=u.enumValue(St,s[1]),t.magFilter=u.enumValue(St,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=Tt.Repeat),-1!=s[1].indexOf("y")&&(t.vWrap=Tt.Repeat)},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 i=e.readLine();for(;i&&0==i.trim().length;)i=e.readLine();for(;i&&0!=i.trim().length&&0!=e.readEntry(s,i);)i=e.readLine();let a=null,o=null,l=null;for(;null!==i;)if(0==i.trim().length)a=null,i=e.readLine();else if(a){let t=new qt(a,i);for(;;){let r=e.readEntry(s,i=e.readLine());if(0==r)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<r;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 Ut(i.trim());0!=e.readEntry(s,i=e.readLine());){let t=r[s[0]];t&&t(a)}this.pages.push(a)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},Ot=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 r=1,n=s+1;;r++){let s=e.indexOf(",",n);if(-1==s)return t[r]=e.substr(n).trim(),r;if(t[r]=e.substr(n,s-n).trim(),n=s+1,4==r)return 4}}},Ut=class{name;minFilter=St.Nearest;magFilter=St.Nearest;uWrap=Tt.ClampToEdge;vWrap=Tt.ClampToEdge;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},qt=class extends Nt{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)}},Wt=class extends x{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new a(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new a(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,r=this.region.u,n=this.region.v,i=0,a=0;if(this.region instanceof qt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/h,n-=(o.originalWidth-o.offsetX-o.width)/c,i=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+t[o+1]*i,e[o+1]=n+(1-t[o])*a;return;case 180:r-=(o.originalWidth-o.offsetX-o.width)/h,n-=o.offsetY/c,i=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o])*i,e[o+1]=n+(1-t[o+1])*a;return;case 270:r-=o.offsetY/h,n-=o.offsetX/c,i=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=r+(1-t[o+1])*i,e[o+1]=n+t[o]*a;return}r-=o.offsetX/h,n-=(o.originalHeight-o.offsetY-o.height)/c,i=o.originalWidth/h,a=o.originalHeight/c}else this.region?(i=this.region.u2-r,a=this.region.v2-n):(r=n=0,i=a=1);for(let o=0;o<s;o+=2)e[o]=r+t[o]*i,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 Wt(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,r,n,i){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,n,i)}newLinkedMesh(){let t=new Wt(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}},zt=class extends x{lengths=[];closed=!1;constantSpeed=!1;color=new a(1,1,1,1);constructor(t){super(t)}copy(){let t=new zt(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}},Gt=class extends x{x=0;y=0;rotation=0;color=new a(.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),r=Math.sin(e),n=s*t.a+r*t.b,i=s*t.c+r*t.d;return l.atan2Deg(i,n)}copy(){let t=new Gt(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},$t=class extends g{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new a(1,1,1,1);path;region=null;sequence=null;offset=u.newFloatArray(8);uvs=u.newFloatArray(8);tempColor=new a(1,1,1,1);constructor(t,e){super(t),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,i=-this.height/2*this.scaleY+this.region.offsetY*r,a=n+this.region.width*s,o=i+this.region.height*r,h=this.rotation*l.degRad,c=Math.cos(h),d=Math.sin(h),u=this.x,m=this.y,f=n*c+u,g=n*d,p=i*c+m,x=i*d,b=a*c+u,w=a*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]=b-k,v[5]=y+w,v[6]=b-x,v[7]=p+w,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){null!=this.sequence&&this.sequence.apply(t,this);let n=t.bone,i=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=i[0],m=i[1],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=r,u=i[2],m=i[3],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=r,u=i[4],m=i[5],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=r,u=i[6],m=i[7],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o}copy(){let t=new $t(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,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}},jt=$t;r(jt,"X1",0),r(jt,"Y1",1),r(jt,"C1R",2),r(jt,"C1G",3),r(jt,"C1B",4),r(jt,"C1A",5),r(jt,"U1",6),r(jt,"V1",7),r(jt,"X2",8),r(jt,"Y2",9),r(jt,"C2R",10),r(jt,"C2G",11),r(jt,"C2B",12),r(jt,"C2A",13),r(jt,"U2",14),r(jt,"V2",15),r(jt,"X3",16),r(jt,"Y3",17),r(jt,"C3R",18),r(jt,"C3G",19),r(jt,"C3B",20),r(jt,"C3A",21),r(jt,"U3",22),r(jt,"V3",23),r(jt,"X4",24),r(jt,"Y4",25),r(jt,"C4R",26),r(jt,"C4G",27),r(jt,"C4B",28),r(jt,"C4A",29),r(jt,"U4",30),r(jt,"V4",31);var Ht,Jt,Kt=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let r=s.regions;for(let n=0,i=r.length;n<i;n++){let i=s.getPath(e,n),a=this.atlas.findRegion(i);if(null==a)throw new Error("Region not found in atlas: "+i+" (sequence: "+t+")");r[n]=a}}newRegionAttachment(t,e,s,r){let n=new jt(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=t}return n}newMeshAttachment(t,e,s,r){let n=new Wt(e,s);if(null!=r)this.loadSequence(e,s,r);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=t}return n}newBoundingBoxAttachment(t,e){return new Dt(e)}newPathAttachment(t,e){return new zt(e)}newPointAttachment(t,e){return new Gt(e)}newClippingAttachment(t,e){return new Vt(e)}},Qt=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Ht.Normal;skinRequired=!1;color=new a;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}};(Jt=Ht||(Ht={}))[Jt.Normal=0]="Normal",Jt[Jt.OnlyTranslation=1]="OnlyTranslation",Jt[Jt.NoRotationOrReflection=2]="NoRotationOrReflection",Jt[Jt.NoScale=3]="NoScale",Jt[Jt.NoScaleOrReflection=4]="NoScaleOrReflection";var Zt,te,ee,se,re,ne,ie=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=Ht.Normal;sorted=!1;active=!1;constructor(t,e,s){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,n,i,a){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=i,this.ashearY=a;let o=this.parent;if(!o){let o=this.skeleton;const h=o.scaleX,c=o.scaleY,d=(s+i)*l.degRad,u=(s+90+a)*l.degRad;return this.a=Math.cos(d)*r*h,this.b=Math.cos(u)*n*h,this.c=Math.sin(d)*r*c,this.d=Math.sin(u)*n*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 Ht.Normal:{const t=(s+i)*l.degRad,e=(s+90+a)*l.degRad,o=Math.cos(t)*r,m=Math.cos(e)*n,f=Math.sin(t)*r,g=Math.sin(e)*n;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 Ht.OnlyTranslation:{const t=(s+i)*l.degRad,e=(s+90+a)*l.degRad;this.a=Math.cos(t)*r,this.b=Math.cos(e)*n,this.c=Math.sin(t)*r,this.d=Math.sin(e)*n;break}case Ht.NoRotationOrReflection:{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+i-m)*l.degRad,g=(s+a-m+90)*l.degRad,p=Math.cos(f)*r,x=Math.cos(g)*n,b=Math.sin(f)*r,w=Math.sin(g)*n;this.a=h*p-c*b,this.b=h*x-c*w,this.c=d*p+u*b,this.d=d*x+u*w;break}case Ht.NoScale:case Ht.NoScaleOrReflection:{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),this.inherit==Ht.NoScale&&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;i*=l.degRad,a=(90+a)*l.degRad;const x=Math.cos(i)*r,b=Math.cos(a)*n,w=Math.sin(i)*r,y=Math.sin(a)*n;this.a=o*x+g*w,this.b=o*b+g*y,this.c=m*x+p*w,this.d=m*b+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,r,n,i=t.a,a=t.b,o=t.c,h=t.d,c=1/(i*h-a*o),d=h*c,u=a*c,m=o*c,f=i*c,g=this.worldX-t.worldX,p=this.worldY-t.worldY;if(this.ax=g*d-p*u,this.ay=p*f-g*m,this.inherit==Ht.OnlyTranslation)e=this.a,s=this.b,r=this.c,n=this.d;else{switch(this.inherit){case Ht.NoRotationOrReflection:{let t=Math.abs(i*h-a*o)/(i*i+o*o);a=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,h=i*this.skeleton.scaleY*t/this.skeleton.scaleX,c=1/(i*h-a*o),d=h*c,u=a*c;break}case Ht.NoScale:case Ht.NoScaleOrReflection:let t=l.cosDeg(this.rotation),e=l.sinDeg(this.rotation);i=(i*t+a*e)/this.skeleton.scaleX,o=(o*t+h*e)/this.skeleton.scaleY;let s=Math.sqrt(i*i+o*o);s>1e-5&&(s=1/s),i*=s,o*=s,s=Math.sqrt(i*i+o*o),this.inherit==Ht.NoScale&&c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let r=l.PI/2+Math.atan2(o,i);a=Math.cos(r)*s,h=Math.sin(r)*s,c=1/(i*h-a*o),d=h*c,u=a*c,m=o*c,f=i*c}e=d*this.a-u*this.c,s=d*this.b-u*this.d,r=f*this.c-m*this.a,n=f*this.d-m*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+r*r),this.ascaleX>1e-4){let t=e*n-s*r;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+r*n,t)*l.radDeg,this.arotation=Math.atan2(r,e)*l.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+n*n),this.ashearY=0,this.arotation=90-Math.atan2(n,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,r=t.y-this.worldY;return t.x=s*this.d*e-r*this.b*e,t.y=r*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=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),r=this.a,n=this.b;this.a=s*r-e*this.c,this.b=s*n-e*this.d,this.c=e*r+s*this.c,this.d=e*n+s*this.d}},ae=class{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},oe=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,r=new Uint8Array(s),n=0;n<s;n++)r[n]=e.charCodeAt(n);return r}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",t,!0);let n=()=>{this.finish(t,r.status,r.responseText)};r.onload=n,r.onerror=n,r.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer";let n=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{200==r.status||0==r.status?this.finish(t,200,new Uint8Array(r.response)):n()},r.onerror=n,r.send()}start(t,e,s){let r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,s)}}finish(t,e,s){let r=this.callbacks[t];delete this.callbacks[t];let n=200==e||0==e?[s]:[e,s];for(let t=n.length-1,e=r.length;t<e;t+=2)r[t].apply(null,n)}},le=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}},he=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},ce=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 r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(t,e,s,r,n,i,a){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 Ht.OnlyTranslation:f=(e-t.worldX)*l.signum(t.skeleton.scaleX),g=(s-t.worldY)*l.signum(t.skeleton.scaleY);break;case Ht.NoRotationOrReflection:let r=Math.abs(h*u-c*d)/Math.max(1e-4,h*h+d*d),n=h/t.skeleton.scaleX,i=d/t.skeleton.scaleY;c=-i*r*t.skeleton.scaleX,u=n*r*t.skeleton.scaleY,m+=Math.atan2(i,n)*l.radDeg;default:let a=e-o.worldX,p=s-o.worldY,x=h*u-c*d;Math.abs(x)<=1e-4?(f=0,g=0):(f=(a*u-p*c)/x-t.ax,g=(p*h-a*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(r||n){switch(t.inherit){case Ht.NoScale:case Ht.NoScaleOrReflection: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(r&&t<o*o||n&&t>o*o){const e=(Math.sqrt(t)/o-1)*a+1;p*=e,i&&(x*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*a,p,x,t.ashearX,t.ashearY)}apply2(t,e,s,r,n,i,a,o,h){if(t.inherit!=Ht.Normal||e.inherit!=Ht.Normal)return;let c=t.ax,d=t.ay,u=t.ascaleX,m=t.ascaleY,f=u,g=m,p=e.ascaleX,x=0,b=0,w=0;u<0?(u=-u,x=180,w=-1):(x=0,w=1),m<0&&(m=-m,w=-w),p<0?(p=-p,b=180):b=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||i?(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,P=v-F.worldX,R=C-F.worldY;Y=Math.abs(Y)<=1e-4?0:1/Y;let X,B,E=(P*I-R*A)*Y-c,D=(R*S-P*T)*Y-d,V=Math.sqrt(E*E+D*D),L=e.data.length*p;if(V<1e-4)return this.apply1(t,s,r,!1,i,!1,h),void e.updateWorldTransformWith(y,k,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);P=s-F.worldX,R=r-F.worldY;let N=(P*I-R*A)*Y-c,_=(R*S-P*T)*Y-d,O=N*N+_*_;if(0!=o){o*=u*(p+1)*.5;let t=Math.sqrt(O),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,N-=s*N,_-=s*_,O=N*N+_*_}}t:if(M){L*=u;let t=(O-V*V-L*L)/(2*V*L);t<-1?(t=-1,B=Math.PI*n):t>1?(t=1,B=0,i&&(S=(Math.sqrt(O)/(V+L)-1)*h+1,f*=S,a&&(g*=S))):B=Math.acos(t)*n,S=V+L*t,A=L*Math.sin(B),X=Math.atan2(_*S-N*A,N*S+_*A)}else{S=u*L,A=m*L;let t=S*S,e=A*A,s=Math.atan2(_,N);T=e*V*V+t*O-t*e;let r=-2*e*V,i=e-t;if(I=r*r-4*i*T,I>=0){let t=Math.sqrt(I);r<0&&(t=-t),t=.5*-(r+t);let e=t/i,a=T/t,o=Math.abs(e)<Math.abs(a)?e:a;if(e=O-o*o,e>=0){R=Math.sqrt(e)*n,X=s-Math.atan2(R,o),B=Math.atan2(R/m,(o-V)/u);break t}}let a=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),P=S*Math.cos(T)+V,R=A*Math.sin(T),I=P*P+R*R,I<h&&(a=T,h=I,o=P,c=R),I>g&&(d=T,g=I,f=P,p=R)),O<=.5*(h+g)?(X=s-Math.atan2(c*n,o),B=a*n):(X=s-Math.atan2(p*n,f),B=d*n)}let U=Math.atan2(k,y)*w,q=t.arotation;X=(X-U)*l.radDeg+x-q,X>180?X-=360:X<-180&&(X+=360),t.updateWorldTransformWith(c,d,q+X*h,f,g,0,0),q=e.arotation,B=((B+U)*l.radDeg-e.ashearX)*w+b-q,B>180?B-=360:B<-180&&(B+=360),e.updateWorldTransformWith(y,k,q+B*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},de=class extends ae{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)}},ue=class extends ae{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=Zt.Fixed;spacingMode=ee.Fixed;rotateMode=re.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}};(te=Zt||(Zt={}))[te.Fixed=0]="Fixed",te[te.Percent=1]="Percent",(se=ee||(ee={}))[se.Length=0]="Length",se[se.Fixed=1]="Fixed",se[se.Percent=2]="Percent",se[se.Proportional=3]="Proportional",(ne=re||(re={}))[ne.Tangent=0]="Tangent",ne[ne.Chain=1]="Chain",ne[ne.ChainScale=2]="ChainScale";var me=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,r=t.bones.length;s<r;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof zt))return;let s=this.mixRotate,r=this.mixX,n=this.mixY;if(0==s&&0==r&&0==n)return;let i=this.data,a=i.rotateMode==re.Tangent,o=i.rotateMode==re.ChainScale,h=this.bones,c=h.length,d=a?c:c+1,m=u.setArraySize(this.spaces,d),f=o?this.lengths=u.setArraySize(this.lengths,c):[],g=this.spacing;switch(i.spacingMode){case ee.Percent:if(o)for(let t=0,e=d-1;t<e;t++){let e=h[t],s=e.data.length,r=s*e.a,n=s*e.c;f[t]=Math.sqrt(r*r+n*n)}u.arrayFill(m,1,d,g);break;case ee.Proportional:let t=0;for(let e=0,s=d-1;e<s;){let s=h[e],r=s.data.length;if(r<me.epsilon)o&&(f[e]=0),m[++e]=g;else{let n=r*s.a,i=r*s.c,a=Math.sqrt(n*n+i*i);o&&(f[e]=a),m[++e]=a,t+=a}}if(t>0){t=d/t*g;for(let e=1;e<d;e++)m[e]*=t}break;default:let e=i.spacingMode==ee.Length;for(let t=0,s=d-1;t<s;){let s=h[t],r=s.data.length;if(r<me.epsilon)o&&(f[t]=0),m[++t]=g;else{let n=r*s.a,i=r*s.c,a=Math.sqrt(n*n+i*i);o&&(f[t]=a),m[++t]=(e?r+g:g)*a/r}}}let p=this.computeWorldPositions(e,d,a),x=p[0],b=p[1],w=i.offsetRotation,y=!1;if(0==w)y=i.rotateMode==re.Chain;else{y=!1;let t=this.target.bone;w*=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 i=h[t];i.worldX+=(x-i.worldX)*r,i.worldY+=(b-i.worldY)*n;let c=p[e],d=p[e+1],u=c-x,g=d-b;if(o){let e=f[t];if(0!=e){let t=(Math.sqrt(u*u+g*g)/e-1)*s+1;i.a*=t,i.c*=t}}if(x=c,b=d,s>0){let r=i.a,n=i.b,o=i.c,h=i.d,c=0,d=0,f=0;if(c=a?p[e-1]:0==m[t+1]?p[e+2]:Math.atan2(g,u),c-=Math.atan2(o,r),y){d=Math.cos(c),f=Math.sin(c);let t=i.data.length;x+=(t*(d*r-f*o)-u)*s,b+=(t*(f*r+d*o)-g)*s}else c+=w;c>l.PI?c-=l.PI2:c<-l.PI&&(c+=l.PI2),c*=s,d=Math.cos(c),f=Math.sin(c),i.a=d*r-f*o,i.b=d*n-f*h,i.c=f*r+d*o,i.d=f*n+d*h}i.updateAppliedTransform()}}computeWorldPositions(t,e,s){let r=this.target,n=this.position,i=this.spaces,a=u.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=me.NONE;if(!t.constantSpeed){let m=t.lengths;c-=l?1:2;let f,g=m[c];switch(this.data.positionMode==Zt.Percent&&(n*=g),this.data.spacingMode){case ee.Percent:f=g;break;case ee.Proportional: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=i[u]*f;n+=e;let b=n;if(l)b%=g,b<0&&(b+=g),x=0;else{if(b<0){d!=me.BEFORE&&(d=me.BEFORE,t.computeWorldVertices(r,2,4,o,0,2)),this.addBeforePosition(b,o,0,a,p);continue}if(b>g){d!=me.AFTER&&(d=me.AFTER,t.computeWorldVertices(r,h-6,4,o,0,2)),this.addAfterPosition(b-g,o,0,a,p);continue}}for(;;x++){let t=m[x];if(!(b>t)){if(0==x)b/=t;else{let e=m[x-1];b=(b-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(r,h-4,4,o,0,2),t.computeWorldVertices(r,0,4,o,4,2)):t.computeWorldVertices(r,6*x+2,8,o,0,2)),this.addCurvePosition(b,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],a,p,s||u>0&&0==e)}return a}l?(h+=2,o=u.setArraySize(this.world,h),t.computeWorldVertices(r,2,h-4,o,0,2),t.computeWorldVertices(r,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(r,2,h,o,0,2));let m,f=u.setArraySize(this.curves,c),g=0,p=o[0],x=o[1],b=0,w=0,y=0,k=0,v=0,C=0,S=0,A=0,T=0,I=0,M=0,F=0,Y=0,P=0;for(let t=0,e=2;t<c;t++,e+=6)b=o[e],w=o[e+1],y=o[e+2],k=o[e+3],v=o[e+4],C=o[e+5],S=.1875*(p-2*b+y),A=.1875*(x-2*w+k),T=.09375*(3*(b-y)-p+v),I=.09375*(3*(w-k)-x+C),M=2*S+T,F=2*A+I,Y=.75*(b-p)+S+.16666667*T,P=.75*(w-x)+A+.16666667*I,g+=Math.sqrt(Y*Y+P*P),Y+=M,P+=F,M+=T,F+=I,g+=Math.sqrt(Y*Y+P*P),Y+=M,P+=F,g+=Math.sqrt(Y*Y+P*P),Y+=M+T,P+=F+I,g+=Math.sqrt(Y*Y+P*P),f[t]=g,p=v,x=C;switch(this.data.positionMode==Zt.Percent&&(n*=g),this.data.spacingMode){case ee.Percent:m=g;break;case ee.Proportional:m=g/e;break;default:m=1}let R=this.segments,X=0;for(let t=0,r=0,c=0,u=0;t<e;t++,r+=3){let e=i[t]*m;n+=e;let B=n;if(l)B%=g,B<0&&(B+=g),c=0;else{if(B<0){this.addBeforePosition(B,o,0,a,r);continue}if(B>g){this.addAfterPosition(B-g,o,h-4,a,r);continue}}for(;;c++){let t=f[c];if(!(B>t)){if(0==c)B/=t;else{let e=f[c-1];B=(B-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(p=o[t],x=o[t+1],b=o[t+2],w=o[t+3],y=o[t+4],k=o[t+5],v=o[t+6],C=o[t+7],S=.03*(p-2*b+y),A=.03*(x-2*w+k),T=.006*(3*(b-y)-p+v),I=.006*(3*(w-k)-x+C),M=2*S+T,F=2*A+I,Y=.3*(b-p)+S+.16666667*T,P=.3*(w-x)+A+.16666667*I,X=Math.sqrt(Y*Y+P*P),R[0]=X,t=1;t<8;t++)Y+=M,P+=F,M+=T,F+=I,X+=Math.sqrt(Y*Y+P*P),R[t]=X;Y+=M,P+=F,X+=Math.sqrt(Y*Y+P*P),R[8]=X,Y+=M+T,P+=F+I,X+=Math.sqrt(Y*Y+P*P),R[9]=X,u=0}for(B*=X;;u++){let t=R[u];if(!(B>t)){if(0==u)B/=t;else{let e=R[u-1];B=u+(B-e)/(t-e)}break}}this.addCurvePosition(.1*B,p,x,b,w,y,k,v,C,a,r,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,r,n){let i=e[s],a=e[s+1],o=e[s+2]-i,l=e[s+3]-a,h=Math.atan2(l,o);r[n]=i+t*Math.cos(h),r[n+1]=a+t*Math.sin(h),r[n+2]=h}addAfterPosition(t,e,s,r,n){let i=e[s+2],a=e[s+3],o=i-e[s],l=a-e[s+1],h=Math.atan2(l,o);r[n]=i+t*Math.cos(h),r[n+1]=a+t*Math.sin(h),r[n+2]=h}addCurvePosition(t,e,s,r,n,i,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,r-e));let u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,b=3*x,w=f*b,y=b*t,k=e*p+r*w+i*y+o*m,v=s*p+n*w+a*y+l*m;h[c]=k,h[c+1]=v,d&&(h[c+2]=t<.001?Math.atan2(n-s,r-e):Math.atan2(v-(s*g+n*x*2+a*u),k-(e*g+r*x*2+i*u)))}},fe=me;r(fe,"NONE",-1),r(fe,"BEFORE",-2),r(fe,"AFTER",-3),r(fe,"epsilon",1e-5);var ge,pe,xe=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,r=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,i=this.data.scaleX>0,a=this.bone,o=a.data.length;switch(t){case ge.none:return;case ge.reset:this.reset();case ge.update:const t=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=t.time;const c=a.worldX,d=a.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,b=x*Math.abs(t.scaleY);if(x*=Math.abs(t.scaleX),s||r){if(s){const t=(this.ux-c)*m;this.xOffset+=t>x?x:t<-x?-x:t,this.ux=c}if(r){const t=(this.uy-d)*m;this.yOffset+=t>b?b:t<-b?-b:t,this.uy=d}if(u>=f){p=Math.pow(this.damping,60*f);const e=this.massInverse*f,n=this.strength,i=this.wind*g*t.scaleX,a=this.gravity*g*t.scaleY;do{s&&(this.xVelocity+=(i-this.xOffset*n)*e,this.xOffset+=this.xVelocity*f,this.xVelocity*=p),r&&(this.yVelocity-=(a+this.yOffset*n)*e,this.yOffset+=this.yVelocity*f,this.yVelocity*=p),u-=f}while(u>=f)}s&&(a.worldX+=this.xOffset*e*this.data.x),r&&(a.worldY+=this.yOffset*e*this.data.y)}if(n||i){let t=Math.atan2(a.c,a.a),s=0,r=0,h=0,c=this.cx-a.worldX,d=this.cy-a.worldY;if(c>x?c=x:c<-x&&(c=-x),d>b?d=b:d<-b&&(d=-b),n){h=(this.data.rotate+this.data.shearX)*e;let n=Math.atan2(d+this.ty,c+this.tx)-t-this.rotateOffset*h;this.rotateOffset+=(n-Math.ceil(n*l.invPI2-.5)*l.PI2)*m,n=this.rotateOffset*h+t,s=Math.cos(n),r=Math.sin(n),i&&(n=o*a.getWorldScaleX(),n>0&&(this.scaleOffset+=(c*s+d*r)*m/n))}else{s=Math.cos(t),r=Math.sin(t);const e=o*a.getWorldScaleX();e>0&&(this.scaleOffset+=(c*s+d*r)*m/e)}if(u=this.remaining,u>=f){-1==p&&(p=Math.pow(this.damping,60*f));const e=this.massInverse*f,a=this.strength,l=this.wind,c=ke.yDown?-this.gravity:this.gravity,d=o/g;for(;;)if(u-=f,i&&(this.scaleVelocity+=(l*s-c*r-this.scaleOffset*a)*e,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=p),n){if(this.rotateVelocity-=((l*r+c*s)*d+this.rotateOffset*a)*e,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=p,u<f)break;const n=this.rotateOffset*h+t;s=Math.cos(n),r=Math.sin(n)}else if(u<f)break}}this.remaining=u}this.cx=a.worldX,this.cy=a.worldY;break;case ge.pose:s&&(a.worldX+=this.xOffset*e*this.data.x),r&&(a.worldY+=this.yOffset*e*this.data.y)}if(n){let t=this.rotateOffset*e,s=0,r=0,n=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),r=Math.cos(e),n=a.b,a.b=r*n-s*a.d,a.d=s*n+r*a.d),e+=t*this.data.shearX,s=Math.sin(e),r=Math.cos(e),n=a.a,a.a=r*n-s*a.c,a.c=s*n+r*a.c}else t*=this.data.rotate,s=Math.sin(t),r=Math.cos(t),n=a.a,a.a=r*n-s*a.c,a.c=s*n+r*a.c,n=a.b,a.b=r*n-s*a.d,a.d=s*n+r*a.d}if(i){const t=1+this.scaleOffset*e*this.data.scaleX;a.a*=t,a.c*=t}t!=ge.pose&&(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 r=s*l.degRad,n=Math.cos(r),i=Math.sin(r),a=this.cx-t,o=this.cy-e;this.translate(a*n-o*i-a,a*i+o*n-o)}},be=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 a,this.darkColor=t.darkColor?new a: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}},we=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 r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,i=this.mixShearY,a=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,r=x.c,n=x.d,i=Math.atan2(d,h)-Math.atan2(r,e)+f;i>l.PI?i-=l.PI2:i<-l.PI&&(i+=l.PI2),i*=t;let a=Math.cos(i),o=Math.sin(i);x.a=a*e-o*r,x.b=a*s-o*n,x.c=o*e+a*r,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!=r){let t=Math.sqrt(x.a*x.a+x.c*x.c);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleX)*r)/t),x.a*=t,x.c*=t}if(0!=n){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)*n)/t),x.b*=t,x.d*=t}if(i>0){let t=x.b,e=x.d,s=Math.atan2(e,t),r=Math.atan2(u,c)-Math.atan2(d,h)-(s-Math.atan2(x.c,x.a));r>l.PI?r-=l.PI2:r<-l.PI&&(r+=l.PI2),r=s+(r+g)*i;let n=Math.sqrt(t*t+e*e);x.b=Math.cos(r)*n,x.d=Math.sin(r)*n}x.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,i=this.mixShearY,a=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,r=x.c,n=x.d,i=Math.atan2(d,h)+f;i>l.PI?i-=l.PI2:i<-l.PI&&(i+=l.PI2),i*=t;let a=Math.cos(i),o=Math.sin(i);x.a=a*e-o*r,x.b=a*s-o*n,x.c=o*e+a*r,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!=r){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleX)*r+1;x.a*=t,x.c*=t}if(0!=n){let t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleY)*n+1;x.b*=t,x.d*=t}if(i>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)*i;let r=Math.sqrt(e*e+s*s);x.b=Math.cos(t)*r,x.d=Math.sin(t)*r}x.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,i=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!=r&&0!=m&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*r)/m),0!=n&&0!=f&&(f=(f+(a.ascaleY-f+this.data.offsetScaleY)*n)/f);let g=h.ashearY;0!=i&&(g+=(a.ashearY-g+this.data.offsetShearY)*i),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,r=this.mixScaleX,n=this.mixScaleY,i=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)*r+1),f=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),g=h.ashearY+(a.ashearY+this.data.offsetShearY)*i;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}},ye=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return ye.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,r=t.bones[e];if(r.parent){let t=this.bones[r.parent.index];s=new ie(r,this,t),t.children.push(s)}else s=new ie(r,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],r=this.bones[s.boneData.index],n=new be(s,r);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 ce(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new we(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new fe(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new xe(s,this))}this.color=new a(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,r=this.pathConstraints,n=this.physicsConstraints,i=e.length,a=s.length,o=r.length,l=this.physicsConstraints.length,h=i+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<i;s++){let r=e[s];if(r.data.order==t){this.sortIkConstraint(r);continue t}}for(let e=0;e<a;e++){let r=s[e];if(r.data.order==t){this.sortTransformConstraint(r);continue t}}for(let e=0;e<o;e++){let s=r[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=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&&u.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,r=s[0];if(this.sortBone(r),1==s.length)this._updateCache.push(t),this.sortReset(r.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(r.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&u.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,r=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,r);let n=e.getAttachment();n instanceof zt&&this.sortPathConstraintAttachmentWith(n,r);let i=t.bones,a=i.length;for(let t=0;t<a;t++)this.sortBone(i[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(i[t].children);for(let t=0;t<a;t++)i[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 r=t.attachments[e];if(r)for(let t in r)this.sortPathConstraintAttachmentWith(r[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof zt))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,r=s.length;e<r;){let r=s[e++];for(r+=e;e<r;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&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,r=s.length;e<r;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 r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let n=e.a,i=e.b,a=e.c,o=e.d;r.worldX=n*this.x+i*this.y+e.worldX,r.worldY=a*this.x+o*this.y+e.worldY;const h=(r.rotation+r.shearX)*l.degRad,c=(r.rotation+90+r.shearY)*l.degRad,d=Math.cos(h)*r.scaleX,u=Math.cos(c)*r.scaleY,m=Math.sin(h)*r.scaleX,f=Math.sin(c)*r.scaleY;r.a=(n*d+i*m)*this.scaleX,r.b=(n*u+i*f)*this.scaleX,r.c=(a*d+o*m)*this.scaleY,r.d=(a*u+o*f)*this.scaleY;let g=this._updateCache;for(let e=0,s=g.length;e<s;e++){let s=g[e];s!=r&&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,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.data.name==t)return r}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s],n=r.data.attachmentName;if(n){let e=t.getAttachment(s,n);e&&r.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,n=s.length;r<n;r++){let n=s[r];if(n.data.name==t){let s=null;if(e&&(s=this.getAttachment(r,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void n.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(t){let e=new f,s=new f;return this.getBounds(e,s,void 0,t),{x:e.x,y:e.y,width:s.x,height:s.y}}getBounds(t,e,s=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,i=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,m=e.getAttachment();if(m instanceof jt)h=8,c=u.setArraySize(s,h,0),m.computeWorldVertices(e,c,0,2),d=ye.quadTriangles;else if(m instanceof Wt){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 Vt&&null!=r){r.clipStart(e,m);continue}if(c&&d){null!=r&&r.isClipping()&&(r.clipTriangles(c,d,d.length),c=r.clippedVertices,h=r.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];i=Math.min(i,e),a=Math.min(a,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=r&&r.clipEndWithSlot(e)}null!=r&&r.clipEnd(),t.set(i,a),e.set(o-i,l-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let r=0,n=s.length;r<n;r++)s[r].translate(t,e)}physicsRotate(t,e,s){const r=this.physicsConstraints;for(let n=0,i=r.length;n<i;n++)r[n].rotate(t,e,s)}},ke=ye;r(ke,"quadTriangles",[0,1,2,2,3,0]),r(ke,"yDown",!1),(pe=ge||(ge={}))[pe.none=0]="none",pe[pe.reset=1]="reset",pe[pe.update=2]="update",pe[pe.pose=3]="pose";var ve,Ce,Se=class extends ae{_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)}},Ae=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,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(r.name==t)return r}return null}},Te=class{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Ie=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new a(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],r=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){r=!0;break}r||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],r=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){r=!0;break}r||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof Wt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let r in s){let n=s[r];n&&t.push(new Te(e,r,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let r in s){let n=s[r];n&&e.push(new Te(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){let n=t.slots[r],i=n.getAttachment();if(i&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(i==t[e]){let t=this.getAttachment(s,e);t&&n.setAttachment(t);break}}}s++}}},Me=class{index=0;name;boneData;color=new a(1,1,1,1);darkColor=null;attachmentName=null;blendMode=ve.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}};(Ce=ve||(ve={}))[Ce.Normal=0]="Normal",Ce[Ce.Additive=1]="Additive",Ce[Ce.Multiply=2]="Multiply",Ce[Ce.Screen=3]="Screen";var Fe,Ye,Pe=class extends ae{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)}},Re=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ae;s.name="";let r=new Xe(t),n=r.readInt32(),i=r.readInt32();s.hash=0==i&&0==n?null:i.toString(16)+n.toString(16),s.version=r.readString(),s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat(),s.referenceScale=r.readFloat()*e;let o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let l=0;l=r.readInt(!0);for(let t=0;t<l;t++){let t=r.readString();if(!t)throw new Error("String in string table must not be null.");r.strings.push(t)}l=r.readInt(!0);for(let t=0;t<l;t++){let n=r.readString();if(!n)throw new Error("Bone name must not be null.");let i=0==t?null:s.bones[r.readInt(!0)],l=new Qt(t,n,i);l.rotation=r.readFloat(),l.x=r.readFloat()*e,l.y=r.readFloat()*e,l.scaleX=r.readFloat(),l.scaleY=r.readFloat(),l.shearX=r.readFloat(),l.shearY=r.readFloat(),l.length=r.readFloat()*e,l.inherit=r.readByte(),l.skinRequired=r.readBoolean(),o&&(a.rgba8888ToColor(l.color,r.readInt32()),l.icon=r.readString()??void 0,l.visible=r.readBoolean()),s.bones.push(l)}l=r.readInt(!0);for(let t=0;t<l;t++){let e=r.readString();if(!e)throw new Error("Slot name must not be null.");let n=s.bones[r.readInt(!0)],i=new Me(t,e,n);a.rgba8888ToColor(i.color,r.readInt32());let l=r.readInt32();-1!=l&&a.rgb888ToColor(i.darkColor=new a,l),i.attachmentName=r.readStringRef(),i.blendMode=r.readInt(!0),o&&(i.visible=r.readBoolean()),s.slots.push(i)}l=r.readInt(!0);for(let t,n=0;n<l;n++){let n=r.readString();if(!n)throw new Error("IK constraint data name must not be null.");let i=new de(n);i.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)i.bones.push(s.bones[r.readInt(!0)]);i.target=s.bones[r.readInt(!0)];let a=r.readByte();i.skinRequired=!!(1&a),i.bendDirection=2&a?1:-1,i.compress=!!(4&a),i.stretch=!!(8&a),i.uniform=!!(16&a),32&a&&(i.mix=64&a?r.readFloat():1),128&a&&(i.softness=r.readFloat()*e),s.ikConstraints.push(i)}l=r.readInt(!0);for(let t,n=0;n<l;n++){let n=r.readString();if(!n)throw new Error("Transform constraint data name must not be null.");let i=new Pe(n);i.order=r.readInt(!0),t=r.readInt(!0);for(let e=0;e<t;e++)i.bones.push(s.bones[r.readInt(!0)]);i.target=s.bones[r.readInt(!0)];let a=r.readByte();i.skinRequired=!!(1&a),i.local=!!(2&a),i.relative=!!(4&a),8&a&&(i.offsetRotation=r.readFloat()),16&a&&(i.offsetX=r.readFloat()*e),32&a&&(i.offsetY=r.readFloat()*e),64&a&&(i.offsetScaleX=r.readFloat()),128&a&&(i.offsetScaleY=r.readFloat()),a=r.readByte(),1&a&&(i.offsetShearY=r.readFloat()),2&a&&(i.mixRotate=r.readFloat()),4&a&&(i.mixX=r.readFloat()),8&a&&(i.mixY=r.readFloat()),16&a&&(i.mixScaleX=r.readFloat()),32&a&&(i.mixScaleY=r.readFloat()),64&a&&(i.mixShearY=r.readFloat()),s.transformConstraints.push(i)}l=r.readInt(!0);for(let t,n=0;n<l;n++){let n=r.readString();if(!n)throw new Error("Path constraint data name must not be null.");let i=new ue(n);i.order=r.readInt(!0),i.skinRequired=r.readBoolean(),t=r.readInt(!0);for(let e=0;e<t;e++)i.bones.push(s.bones[r.readInt(!0)]);i.target=s.slots[r.readInt(!0)];const a=r.readByte();i.positionMode=1&a,i.spacingMode=a>>1&3,i.rotateMode=a>>3&3,128&a&&(i.offsetRotation=r.readFloat()),i.position=r.readFloat(),i.positionMode==Zt.Fixed&&(i.position*=e),i.spacing=r.readFloat(),i.spacingMode!=ee.Length&&i.spacingMode!=ee.Fixed||(i.spacing*=e),i.mixRotate=r.readFloat(),i.mixX=r.readFloat(),i.mixY=r.readFloat(),s.pathConstraints.push(i)}l=r.readInt(!0);for(let t=0;t<l;t++){const t=r.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const n=new Se(t);n.order=r.readInt(!0),n.bone=s.bones[r.readInt(!0)];let i=r.readByte();n.skinRequired=!!(1&i),2&i&&(n.x=r.readFloat()),4&i&&(n.y=r.readFloat()),8&i&&(n.rotate=r.readFloat()),16&i&&(n.scaleX=r.readFloat()),32&i&&(n.shearX=r.readFloat()),n.limit=(64&i?r.readFloat():5e3)*e,n.step=1/r.readUnsignedByte(),n.inertia=r.readFloat(),n.strength=r.readFloat(),n.damping=r.readFloat(),n.massInverse=128&i?r.readFloat():1,n.wind=r.readFloat(),n.gravity=r.readFloat(),i=r.readByte(),1&i&&(n.inertiaGlobal=!0),2&i&&(n.strengthGlobal=!0),4&i&&(n.dampingGlobal=!0),8&i&&(n.massGlobal=!0),16&i&&(n.windGlobal=!0),32&i&&(n.gravityGlobal=!0),64&i&&(n.mixGlobal=!0),n.mix=128&i?r.readFloat():1,s.physicsConstraints.push(n)}let h=this.readSkin(r,s,!0,o);h&&(s.defaultSkin=h,s.skins.push(h));{let t=s.skins.length;for(u.setArraySize(s.skins,l=t+r.readInt(!0));t<l;t++){let e=this.readSkin(r,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 r=s.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let n=r.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=r.readInt(!0);for(let t=0;t<l;t++){let t=r.readString();if(!t)throw new Error("Event data name must not be null");let e=new he(t);e.intValue=r.readInt(!1),e.floatValue=r.readFloat(),e.stringValue=r.readString(),e.audioPath=r.readString(),e.audioPath&&(e.volume=r.readFloat(),e.balance=r.readFloat()),s.events.push(e)}l=r.readInt(!0);for(let t=0;t<l;t++){let t=r.readString();if(!t)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,t,s))}return s}readSkin(t,e,s,r){let n=null,i=0;if(s){if(i=t.readInt(!0),0==i)return null;n=new Ie("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new Ie(s),r&&a.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,r=n.bones.length;s<r;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,r=t.readInt(!0);s<r;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);i=t.readInt(!0)}for(let s=0;s<i;s++){let s=t.readInt(!0);for(let i=0,a=t.readInt(!0);i<a;i++){let i=t.readStringRef();if(!i)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,n,s,i,r);a&&n.setAttachment(s,i,a)}}return n}readAttachment(t,e,s,r,n,i){let o=this.scale,l=t.readByte();const h=8&l?t.readStringRef():n;if(!h)throw new Error("Attachment name must not be null");switch(7&l){case Fe.Region:{let e=16&l?t.readStringRef():null;const r=32&l?t.readInt32():4294967295,n=64&l?this.readSequence(t):null;let i=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,n);return p?(p.path=e,p.x=c*o,p.y=d*o,p.scaleX=u,p.scaleY=m,p.rotation=i,p.width=f*o,p.height=g*o,a.rgba8888ToColor(p.color,r),p.sequence=n,null==n&&p.updateRegion(),p):null}case Fe.BoundingBox:{let e=this.readVertices(t,!!(16&l)),r=i?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,h);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,i&&a.rgba8888ToColor(n.color,r),n):null}case Fe.Mesh:{let e=16&l?t.readStringRef():h;const r=32&l?t.readInt32():4294967295,n=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;i&&(f=this.readShortArray(t,t.readInt(!0)),g=t.readFloat(),p=t.readFloat()),e||(e=h);let x=this.attachmentLoader.newMeshAttachment(s,h,e,n);return x?(x.path=e,a.rgba8888ToColor(x.color,r),x.bones=d.bones,x.vertices=d.vertices,x.worldVerticesLength=d.length,x.triangles=m,x.regionUVs=u,null==n&&x.updateRegion(),x.hullLength=c<<1,x.sequence=n,i&&(x.edges=f,x.width=g*o,x.height=p*o),x):null}case Fe.LinkedMesh:{const e=16&l?t.readStringRef():h;if(null==e)throw new Error("Path of linked mesh must not be null");const n=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;i&&(f=t.readFloat(),g=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,h,e,c);return p?(p.path=e,a.rgba8888ToColor(p.color,n),p.sequence=c,i&&(p.width=f*o,p.height=g*o),this.linkedMeshes.push(new Be(p,u,r,m,d)),p):null}case Fe.Path:{const e=!!(16&l),r=!!(32&l),n=this.readVertices(t,!!(64&l)),c=u.newArray(n.length/6,0);for(let e=0,s=c.length;e<s;e++)c[e]=t.readFloat()*o;const d=i?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,h);return m?(m.closed=e,m.constantSpeed=r,m.worldVerticesLength=n.length,m.vertices=n.vertices,m.bones=n.bones,m.lengths=c,i&&a.rgba8888ToColor(m.color,d),m):null}case Fe.Point:{const e=t.readFloat(),r=t.readFloat(),n=t.readFloat(),l=i?t.readInt32():0,c=this.attachmentLoader.newPointAttachment(s,h);return c?(c.x=r*o,c.y=n*o,c.rotation=e,i&&a.rgba8888ToColor(c.color,l),c):null}case Fe.Clipping:{const r=t.readInt(!0),n=this.readVertices(t,!!(16&l));let o=i?t.readInt32():0,c=this.attachmentLoader.newClippingAttachment(s,h);return c?(c.endSlot=e.slots[r],c.worldVerticesLength=n.length,c.vertices=n.vertices,c.bones=n.bones,i&&a.rgba8888ToColor(c.color,o),c):null}}return null}readSequence(t){let e=new k(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,r=t.readInt(!0),n=new Ee;if(n.length=r<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let i=new Array,a=new Array;for(let e=0;e<r;e++){let e=t.readInt(!0);a.push(e);for(let r=0;r<e;r++)a.push(t.readInt(!0)),i.push(t.readFloat()*s),i.push(t.readFloat()*s),i.push(t.readFloat())}return n.vertices=u.toFloatArray(i),n.bones=a,n}readFloatArray(t,e,s){let r=new Array(e);if(1==s)for(let s=0;s<e;s++)r[s]=t.readFloat();else for(let n=0;n<e;n++)r[n]=t.readFloat()*s;return r}readShortArray(t,e){let s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let r=new Array,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),i=n-1;switch(s){case Ke:{let s=new H(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readStringRef());r.push(s);break}case Qe:{let s=t.readInt(!0),a=new W(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!=i;e++){let r=t.readFloat(),n=t.readUnsignedByte()/255,i=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case ps:a.setStepped(e);break;case xs:Le(t,a,s++,e,0,o,r,l,n,1),Le(t,a,s++,e,1,o,r,h,i,1),Le(t,a,s++,e,2,o,r,c,u,1),Le(t,a,s++,e,3,o,r,d,m,1)}o=r,l=n,h=i,c=u,d=m}r.push(a);break}case Ze:{let s=t.readInt(!0),a=new z(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!=i;e++){let r=t.readFloat(),n=t.readUnsignedByte()/255,i=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case ps:a.setStepped(e);break;case xs:Le(t,a,s++,e,0,o,r,l,n,1),Le(t,a,s++,e,1,o,r,h,i,1),Le(t,a,s++,e,2,o,r,c,d,1)}o=r,l=n,h=i,c=d}r.push(a);break}case ts:{let s=t.readInt(!0),a=new $(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!=i;e++){let r=t.readFloat(),n=t.readUnsignedByte()/255,i=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;switch(t.readByte()){case ps:a.setStepped(e);break;case xs:Le(t,a,s++,e,0,o,r,l,n,1),Le(t,a,s++,e,1,o,r,h,i,1),Le(t,a,s++,e,2,o,r,c,g,1),Le(t,a,s++,e,3,o,r,d,p,1),Le(t,a,s++,e,4,o,r,u,x,1),Le(t,a,s++,e,5,o,r,m,b,1),Le(t,a,s++,e,6,o,r,f,w,1)}o=r,l=n,h=i,c=g,d=p,u=x,m=b,f=w}r.push(a);break}case es:{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,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!=i;e++){let r=t.readFloat(),n=t.readUnsignedByte()/255,i=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case ps:a.setStepped(e);break;case xs:Le(t,a,s++,e,0,o,r,l,n,1),Le(t,a,s++,e,1,o,r,h,i,1),Le(t,a,s++,e,2,o,r,c,f,1),Le(t,a,s++,e,3,o,r,d,g,1),Le(t,a,s++,e,4,o,r,u,p,1),Le(t,a,s++,e,5,o,r,m,x,1)}o=r,l=n,h=i,c=f,d=g,u=p,m=x}r.push(a);break}case ss:{let s=new G(n,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,r=0;s.setFrame(e,a,o),e!=i;e++){let n=t.readFloat(),i=t.readUnsignedByte()/255;switch(t.readByte()){case ps:s.setStepped(e);break;case xs:Le(t,s,r++,e,0,a,n,o,i,1)}a=n,o=i}r.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,i=t.readInt(!0);s<i;s++){let s=t.readByte(),i=t.readInt(!0);if(s==Je){let s=new q(i,e);for(let e=0;e<i;e++)s.setFrame(e,t.readFloat(),t.readByte());r.push(s);continue}let a=t.readInt(!0);switch(s){case _e:r.push(De(t,new X(i,a,e),1));break;case Oe:r.push(Ve(t,new B(i,a,e),n));break;case Ue:r.push(De(t,new E(i,a,e),n));break;case qe:r.push(De(t,new D(i,a,e),n));break;case We:r.push(Ve(t,new V(i,a,e),1));break;case ze:r.push(De(t,new L(i,a,e),1));break;case Ge:r.push(De(t,new N(i,a,e),1));break;case $e:r.push(Ve(t,new _(i,a,e),1));break;case je:r.push(De(t,new O(i,a,e),1));break;case He:r.push(De(t,new U(i,a,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),i=s-1,a=new et(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!=i;e++){o=t.readByte();const r=t.readFloat(),i=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*n:0;64&o?a.setStepped(e):128&o&&(Le(t,a,s++,e,0,l,r,h,i,1),Le(t,a,s++,e,1,l,r,c,d,n)),l=r,h=i,c=d}r.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,i=new st(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;i.setFrame(e,a,o,l,h,c,d,u),e!=n;e++){let r=t.readFloat(),n=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),x=t.readFloat();switch(t.readByte()){case ps:i.setStepped(e);break;case xs:Le(t,i,s++,e,0,a,r,o,n,1),Le(t,i,s++,e,1,a,r,l,m,1),Le(t,i,s++,e,2,a,r,h,f,1),Le(t,i,s++,e,3,a,r,c,g,1),Le(t,i,s++,e,4,a,r,d,p,1),Le(t,i,s++,e,5,a,r,u,x,1)}a=r,o=n,l=m,h=f,c=g,d=p,u=x}r.push(i)}for(let e=0,i=t.readInt(!0);e<i;e++){let e=t.readInt(!0),i=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 is:r.push(De(t,new rt(a,o,e),i.positionMode==Zt.Fixed?n:1));break;case as:r.push(De(t,new nt(a,o,e),i.spacingMode==ee.Length||i.spacingMode==ee.Fixed?n:1));break;case os:let s=new it(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,r=0,n=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=n;e++){let n=t.readFloat(),i=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case ps:s.setStepped(e);break;case xs:Le(t,s,r++,e,0,l,n,h,i,1),Le(t,s,r++,e,1,l,n,c,a,1),Le(t,s,r++,e,2,l,n,d,o,1)}l=n,h=i,c=a,d=o}r.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,n=t.readInt(!0);s<n;s++){const s=t.readByte(),n=t.readInt(!0);if(s==gs){const s=new gt(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat());r.push(s);continue}const i=t.readInt(!0);switch(s){case ls:r.push(De(t,new ot(n,i,e),1));break;case hs:r.push(De(t,new lt(n,i,e),1));break;case cs:r.push(De(t,new ht(n,i,e),1));break;case ds:r.push(De(t,new ct(n,i,e),1));break;case us:r.push(De(t,new dt(n,i,e),1));break;case ms:r.push(De(t,new ut(n,i,e),1));break;case fs:r.push(De(t,new mt(n,i,e),1))}}}for(let e=0,i=t.readInt(!0);e<i;e++){let e=s.skins[t.readInt(!0)];for(let s=0,i=t.readInt(!0);s<i;s++){let s=t.readInt(!0);for(let i=0,a=t.readInt(!0);i<a;i++){let i=t.readStringRef();if(!i)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,i),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case rs:{let e=a,i=e.bones,o=e.vertices,c=i?o.length/3*2:o.length,d=t.readInt(!0),m=new J(l,d,s,e),f=t.readFloat();for(let e=0,s=0;;e++){let r,a=t.readInt(!0);if(0==a)r=i?u.newFloatArray(c):o;else{r=u.newFloatArray(c);let e=t.readInt(!0);if(a+=e,1==n)for(let s=e;s<a;s++)r[s]=t.readFloat();else for(let s=e;s<a;s++)r[s]=t.readFloat()*n;if(!i)for(let t=0,e=r.length;t<e;t++)r[t]+=o[t]}if(m.setFrame(e,f,r),e==h)break;let l=t.readFloat();switch(t.readByte()){case ps:m.setStepped(e);break;case xs:Le(t,m,s++,e,0,f,l,0,1,1)}f=l}r.push(m);break}case ns:{let e=new xt(l,s,a);for(let s=0;s<l;s++){let r=t.readFloat(),n=t.readInt32();e.setFrame(s,r,T[15&n],n>>4,t.readFloat())}r.push(e);break}}}}}let i=t.readInt(!0);if(i>0){let e=new tt(i),n=s.slots.length;for(let s=0;s<i;s++){let r=t.readFloat(),i=t.readInt(!0),a=u.newArray(n,0);for(let t=n-1;t>=0;t--)a[t]=-1;let o=u.newArray(n-i,0),l=0,h=0;for(let e=0;e<i;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,r,a)}r.push(e)}let a=t.readInt(!0);if(a>0){let e=new Q(a);for(let r=0;r<a;r++){let n=t.readFloat(),i=s.events[t.readInt(!0)],a=new le(n,i);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=i.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(r,a)}r.push(e)}let o=0;for(let t=0,e=r.length;t<e;t++)o=Math.max(o,r[t].getDuration());return new I(e,r,o)}},Xe=class{strings;index;buffer;constructor(t,e=new Array,s=0,r=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}},Be=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,n){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}},Ee=class{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}};function De(t,e,s){let r=t.readFloat(),n=t.readFloat()*s;for(let i=0,a=0,o=e.getFrameCount()-1;e.setFrame(i,r,n),i!=o;i++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case ps:e.setStepped(i);break;case xs:Le(t,e,a++,i,0,r,o,n,l,s)}r=o,n=l}return e}function Ve(t,e,s){let r=t.readFloat(),n=t.readFloat()*s,i=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,r,n,i),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case ps:e.setStepped(a);break;case xs:Le(t,e,o++,a,0,r,l,n,h,s),Le(t,e,o++,a,1,r,l,i,c,s)}r=l,n=h,i=c}return e}function Le(t,e,s,r,n,i,a,o,l,h){e.setBezier(s,r,n,i,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,l)}(Ye=Fe||(Fe={}))[Ye.Region=0]="Region",Ye[Ye.BoundingBox=1]="BoundingBox",Ye[Ye.Mesh=2]="Mesh",Ye[Ye.LinkedMesh=3]="LinkedMesh",Ye[Ye.Path=4]="Path",Ye[Ye.Point=5]="Point",Ye[Ye.Clipping=6]="Clipping";var Ne,_e=0,Oe=1,Ue=2,qe=3,We=4,ze=5,Ge=6,$e=7,je=8,He=9,Je=10,Ke=0,Qe=1,Ze=2,ts=3,es=4,ss=5,rs=0,ns=1,is=0,as=1,os=2,ls=0,hs=1,cs=2,ds=4,us=5,ms=6,fs=7,gs=8,ps=1,xs=2,bs=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,r=this.polygons,n=this.polygonPool,i=t.slots,a=i.length;s.length=0,n.freeAll(r),r.length=0;for(let t=0;t<a;t++){let e=i[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof Dt){let t=a;s.push(t);let i=n.obtain();i.length!=t.worldVerticesLength&&(i=u.newFloatArray(t.worldVerticesLength)),r.push(i),t.computeWorldVertices(e,0,t.worldVerticesLength,i,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,n=this.polygons;for(let i=0,a=n.length;i<a;i++){let a=n[i],o=a;for(let n=0,i=a.length;n<i;n+=2){let i=o[n],a=o[n+1];t=Math.min(t,i),e=Math.min(e,a),s=Math.max(s,i),r=Math.max(r,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=r}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,r){let n=this.minX,i=this.minY,a=this.maxX,o=this.maxY;if(t<=n&&s<=n||e<=i&&r<=i||t>=a&&s>=a||e>=o&&r>=o)return!1;let l=(r-e)/(s-t),h=l*(n-t)+e;if(h>i&&h<o)return!0;if(h=l*(a-t)+e,h>i&&h<o)return!0;let c=(i-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 r=0,n=s.length;r<n;r++)if(this.containsPointPolygon(s[r],t,e))return this.boundingBoxes[r];return null}containsPointPolygon(t,e,s){let r=t,n=t.length,i=n-2,a=!1;for(let t=0;t<n;t+=2){let n=r[t+1],o=r[i+1];if(n<s&&o>=s||o<s&&n>=s){let l=r[t];l+(s-n)/(o-n)*(r[i]-l)<e&&(a=!a)}i=t}return a}intersectsSegment(t,e,s,r){let n=this.polygons;for(let i=0,a=n.length;i<a;i++)if(this.intersectsSegmentPolygon(n[i],t,e,s,r))return this.boundingBoxes[i];return null}intersectsSegmentPolygon(t,e,s,r,n){let i=t,a=t.length,o=e-r,l=s-n,h=e*n-s*r,c=i[a-2],d=i[a-1];for(let t=0;t<a;t+=2){let a=i[t],u=i[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<=r||x>=r&&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}},ws=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,r=this.indicesArray;r.length=0;for(let t=0;t<s;t++)r[t]=t;let n=this.isConcaveArray;n.length=0;for(let t=0,i=s;t<i;++t)n[t]=ws.isConcave(t,s,e,r);let i=this.triangles;for(i.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!n[a]){let i=r[t]<<1,l=r[a]<<1,h=r[o]<<1,c=e[i],d=e[i+1],u=e[l],m=e[l+1],f=e[h],g=e[h+1];for(let i=(o+1)%s;i!=t;i=(i+1)%s){if(!n[i])continue;let t=r[i]<<1,s=e[t],a=e[t+1];if(ws.positiveArea(f,g,c,d,s,a)&&ws.positiveArea(c,d,u,m,s,a)&&ws.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}i.push(r[(s+a-1)%s]),i.push(r[a]),i.push(r[(a+1)%s]),r.splice(a,1),n.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;n[l]=ws.isConcave(l,s,e,r),n[h]=ws.isConcave(h,s,e,r)}return 3==s&&(i.push(r[2]),i.push(r[0]),i.push(r[1])),i}decompose(t,e){let s=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let i=this.polygonIndicesPool.obtain();i.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],b=!1;if(o==h){let t=a.length-4,e=ws.winding(a[t],a[t+1],a[t+2],a[t+3],p,x),s=ws.winding(p,x,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(p),a.push(x),i.push(d),b=!0)}b||(a.length>0?(r.push(a),n.push(i)):(this.polygonPool.free(a),this.polygonIndicesPool.free(i)),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),i=this.polygonIndicesPool.obtain(),i.length=0,i.push(h),i.push(c),i.push(d),l=ws.winding(u,m,f,g,p,x),o=h)}a.length>0&&(r.push(a),n.push(i));for(let t=0,e=r.length;t<e;t++){if(i=n[t],0==i.length)continue;let s=i[0],o=i[i.length-1];a=r[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],m=a[0],f=a[1],g=a[2],p=a[3],x=ws.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 b=e[0],w=e[1],y=e[2],k=r[l],v=k[k.length-2],C=k[k.length-1];if(b!=s||w!=o)continue;let S=ws.winding(h,c,d,u,v,C),A=ws.winding(v,C,m,f,g,p);S==x&&A==x&&(k.length=0,e.length=0,a.push(v),a.push(C),i.push(y),h=d,c=u,d=v,u=C,l=0)}}for(let t=r.length-1;t>=0;t--)a=r[t],0==a.length&&(r.splice(t,1),this.polygonPool.free(a),i=n[t],n.splice(t,1),this.polygonIndicesPool.free(i));return r}static isConcave(t,e,s,r){let n=r[(e+t-1)%e]<<1,i=r[t]<<1,a=r[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[i],s[i+1],s[a],s[a+1])}static positiveArea(t,e,s,r,n,i){return t*(i-r)+s*(e-i)+n*(r-e)>=0}static winding(t,e,s,r,n,i){let a=s-t,o=r-e;return n*o-i*a+a*e-t*o>=0?1:-1}},ys=class{triangulator=new ws;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,r=u.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,r,0,2);let n=this.clippingPolygon;ys.makeClockwise(n);let i=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let t=0,e=i.length;t<e;t++){let e=i[t];ys.makeClockwise(e),e.push(e[0]),e.push(e[1])}return i.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,r,n,i,a,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=r,c=n,d=i,u=a,m=o):(l=e,h=s,c=r,d=n,u=i,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 r=this.clipOutput,n=this.clippedVertices,i=this.clippedTriangles,a=this.clippingPolygons,o=a.length,l=0;n.length=0,i.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=n.length;if(!this.clip(c,d,m,f,g,p,a[t],r)){let t=u.setArraySize(n,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=i.length;let s=u.setArraySize(i,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=r.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=u.setArraySize(n,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],r=a[s+1];o[e]=t,o[e+1]=r}e=i.length;let h=u.setArraySize(i,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,r,n,i,a){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,m=a?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],b=r[s],w=r[s+1];s=e[g+1]<<1;let y=t[s],k=t[s+1],v=r[s],C=r[s+1];s=e[g+2]<<1;let S=t[s],A=t[s+1],T=r[s],I=r[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]=n.r,t[e+3]=n.g,t[e+4]=n.b,t[e+5]=n.a,a?(t[e+6]=b,t[e+7]=w,t[e+8]=i.r,t[e+9]=i.g,t[e+10]=i.b,t[e+11]=i.a,t[e+12]=y,t[e+13]=k,t[e+14]=n.r,t[e+15]=n.g,t[e+16]=n.b,t[e+17]=n.a,t[e+18]=v,t[e+19]=C,t[e+20]=i.r,t[e+21]=i.g,t[e+22]=i.b,t[e+23]=i.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]=i.r,t[e+33]=i.g,t[e+34]=i.b,t[e+35]=i.a):(t[e+6]=b,t[e+7]=w,t[e+8]=y,t[e+9]=k,t[e+10]=n.r,t[e+11]=n.g,t[e+12]=n.b,t[e+13]=n.a,t[e+14]=v,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=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,r=S-y,c=p-S,d=A-x,g=1/(s*c+r*(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]=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+r*u)*g,f=(d*h+c*u)*g,p=1-m-f;Y[e+6]=b*m+v*f+T*p,Y[e+7]=w*m+C*f+I*p,a&&(Y[e+8]=i.r,Y[e+9]=i.g,Y[e+10]=i.b,Y[e+11]=i.a)}e=h.length;let P=u.setArraySize(h,e+3*(M-2));M--;for(let t=1;t<M;t++,e+=3)P[e]=f,P[e+1]=f+t,P[e+2]=f+t+1;f+=M+1}}}}clipTrianglesUnpacked(t,e,s,r){let n=this.clipOutput,i=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;i.length=0,a.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=r[s],p=r[s+1];s=e[d+1]<<1;let x=t[s],b=t[s+1],w=r[s],y=r[s+1];s=e[d+2]<<1;let k=t[s],v=t[s+1],C=r[s],S=r[s+1];for(let t=0;t<h;t++){let e=i.length;if(!this.clip(m,f,x,b,k,v,l[t],n)){let t=u.setArraySize(i,e+6);t[e]=m,t[e+1]=f,t[e+2]=x,t[e+3]=b,t[e+4]=k,t[e+5]=v;let s=u.setArraySize(a,e+6);s[e]=g,s[e+1]=p,s[e+2]=w,s[e+3]=y,s[e+4]=C,s[e+5]=S,e=o.length;let r=u.setArraySize(o,e+3);r[e]=c,r[e+1]=c+1,r[e+2]=c+2,c+=3;break}{let t=n.length;if(0==t)continue;let s=b-v,r=k-x,l=m-k,h=v-f,d=1/(s*l+r*(f-v)),A=t>>1,T=this.clipOutput,I=u.setArraySize(i,e+2*A),M=u.setArraySize(a,e+2*A);for(let n=0;n<t;n+=2,e+=2){let t=T[n],i=T[n+1];I[e]=t,I[e+1]=i;let a=t-k,o=i-v,c=(s*a+r*o)*d,u=(h*a+l*o)*d,m=1-c-u;M[e]=g*c+w*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,r,n,i,a,o){let l,h=o,c=!1;a.length%4>=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(s),l.push(r),l.push(n),l.push(i),l.push(t),l.push(e),o.length=0;let d=a.length-4,u=a;for(let t=0;;t+=2){let e=u[t],s=u[t+1],r=e-u[t+2],n=s-u[t+3],i=o.length,a=l;for(let t=0,i=l.length-2;t<i;){let i=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=n*(e-h)>r*(s-d),m=n*(e-i)-r*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-i,e=d-l,s=m/(t*n-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(i+t*s),o.push(l+e*s)}else if(u){let t=h-i,e=d-l,s=m/(t*n-e*r);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(i+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(i==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,r=e[s-2]*e[1]-e[0]*e[s-1],n=0,i=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)n=e[t],i=e[t+1],a=e[t+2],o=e[t+3],r+=n*o-a*i;if(!(r<0))for(let t=0,r=s-2,n=s>>1;t<n;t+=2){let s=e[t],n=e[t+1],i=r-t;e[t]=e[i],e[t+1]=e[i+1],e[i]=s,e[i+1]=n}}},ks=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ae,r="string"==typeof t?JSON.parse(t):t,n=r.skeleton;if(n&&(s.hash=n.hash,s.version=n.spine,s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.referenceScale=Ts(n,"referenceScale",100)*e,s.fps=n.fps,s.imagesPath=n.images??null,s.audioPath=n.audio??null),r.bones)for(let t=0;t<r.bones.length;t++){let n=r.bones[t],i=null,a=Ts(n,"parent",null);a&&(i=s.findBone(a));let o=new Qt(s.bones.length,n.name,i);o.length=Ts(n,"length",0)*e,o.x=Ts(n,"x",0)*e,o.y=Ts(n,"y",0)*e,o.rotation=Ts(n,"rotation",0),o.scaleX=Ts(n,"scaleX",1),o.scaleY=Ts(n,"scaleY",1),o.shearX=Ts(n,"shearX",0),o.shearY=Ts(n,"shearY",0),o.inherit=u.enumValue(Ht,Ts(n,"inherit","Normal")),o.skinRequired=Ts(n,"skin",!1);let l=Ts(n,"color",null);l&&o.color.setFromString(l),s.bones.push(o)}if(r.slots)for(let t=0;t<r.slots.length;t++){let e=r.slots[t],n=e.name,i=s.findBone(e.bone);if(!i)throw new Error(`Couldn't find bone ${e.bone} for slot ${n}`);let o=new Me(s.slots.length,n,i),l=Ts(e,"color",null);l&&o.color.setFromString(l);let h=Ts(e,"dark",null);h&&(o.darkColor=a.fromString(h)),o.attachmentName=Ts(e,"attachment",null),o.blendMode=u.enumValue(ve,Ts(e,"blend","normal")),o.visible=Ts(e,"visible",!0),s.slots.push(o)}if(r.ik)for(let t=0;t<r.ik.length;t++){let n=r.ik[t],i=new de(n.name);i.order=Ts(n,"order",0),i.skinRequired=Ts(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=s.findBone(n.bones[t]);if(!e)throw new Error(`Couldn't find bone ${n.bones[t]} for IK constraint ${n.name}.`);i.bones.push(e)}let a=s.findBone(n.target);if(!a)throw new Error(`Couldn't find target bone ${n.target} for IK constraint ${n.name}.`);i.target=a,i.mix=Ts(n,"mix",1),i.softness=Ts(n,"softness",0)*e,i.bendDirection=Ts(n,"bendPositive",!0)?1:-1,i.compress=Ts(n,"compress",!1),i.stretch=Ts(n,"stretch",!1),i.uniform=Ts(n,"uniform",!1),s.ikConstraints.push(i)}if(r.transform)for(let t=0;t<r.transform.length;t++){let n=r.transform[t],i=new Pe(n.name);i.order=Ts(n,"order",0),i.skinRequired=Ts(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for transform constraint ${n.name}.`);i.bones.push(r)}let a=n.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${n.name}.`);i.target=o,i.local=Ts(n,"local",!1),i.relative=Ts(n,"relative",!1),i.offsetRotation=Ts(n,"rotation",0),i.offsetX=Ts(n,"x",0)*e,i.offsetY=Ts(n,"y",0)*e,i.offsetScaleX=Ts(n,"scaleX",0),i.offsetScaleY=Ts(n,"scaleY",0),i.offsetShearY=Ts(n,"shearY",0),i.mixRotate=Ts(n,"mixRotate",1),i.mixX=Ts(n,"mixX",1),i.mixY=Ts(n,"mixY",i.mixX),i.mixScaleX=Ts(n,"mixScaleX",1),i.mixScaleY=Ts(n,"mixScaleY",i.mixScaleX),i.mixShearY=Ts(n,"mixShearY",1),s.transformConstraints.push(i)}if(r.path)for(let t=0;t<r.path.length;t++){let n=r.path[t],i=new ue(n.name);i.order=Ts(n,"order",0),i.skinRequired=Ts(n,"skin",!1);for(let t=0;t<n.bones.length;t++){let e=n.bones[t],r=s.findBone(e);if(!r)throw new Error(`Couldn't find bone ${e} for path constraint ${n.name}.`);i.bones.push(r)}let a=n.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${n.name}.`);i.target=o,i.positionMode=u.enumValue(Zt,Ts(n,"positionMode","Percent")),i.spacingMode=u.enumValue(ee,Ts(n,"spacingMode","Length")),i.rotateMode=u.enumValue(re,Ts(n,"rotateMode","Tangent")),i.offsetRotation=Ts(n,"rotation",0),i.position=Ts(n,"position",0),i.positionMode==Zt.Fixed&&(i.position*=e),i.spacing=Ts(n,"spacing",0),i.spacingMode!=ee.Length&&i.spacingMode!=ee.Fixed||(i.spacing*=e),i.mixRotate=Ts(n,"mixRotate",1),i.mixX=Ts(n,"mixX",1),i.mixY=Ts(n,"mixY",i.mixX),s.pathConstraints.push(i)}if(r.physics)for(let t=0;t<r.physics.length;t++){const n=r.physics[t],i=new Se(n.name);i.order=Ts(n,"order",0),i.skinRequired=Ts(n,"skin",!1);const a=n.bone,o=s.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);i.bone=o,i.x=Ts(n,"x",0),i.y=Ts(n,"y",0),i.rotate=Ts(n,"rotate",0),i.scaleX=Ts(n,"scaleX",0),i.shearX=Ts(n,"shearX",0),i.limit=Ts(n,"limit",5e3)*e,i.step=1/Ts(n,"fps",60),i.inertia=Ts(n,"inertia",1),i.strength=Ts(n,"strength",100),i.damping=Ts(n,"damping",1),i.massInverse=1/Ts(n,"mass",1),i.wind=Ts(n,"wind",0),i.gravity=Ts(n,"gravity",0),i.mix=Ts(n,"mix",1),i.inertiaGlobal=Ts(n,"inertiaGlobal",!1),i.strengthGlobal=Ts(n,"strengthGlobal",!1),i.dampingGlobal=Ts(n,"dampingGlobal",!1),i.massGlobal=Ts(n,"massGlobal",!1),i.windGlobal=Ts(n,"windGlobal",!1),i.gravityGlobal=Ts(n,"gravityGlobal",!1),i.mixGlobal=Ts(n,"mixGlobal",!1),s.physicsConstraints.push(i)}if(r.skins)for(let t=0;t<r.skins.length;t++){let e=r.skins[t],n=new Ie(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let r=e.bones[t],i=s.findBone(r);if(!i)throw new Error(`Couldn't find bone ${r} for skin ${e.name}.`);n.bones.push(i)}if(e.ik)for(let t=0;t<e.ik.length;t++){let r=e.ik[t],i=s.findIkConstraint(r);if(!i)throw new Error(`Couldn't find IK constraint ${r} for skin ${e.name}.`);n.constraints.push(i)}if(e.transform)for(let t=0;t<e.transform.length;t++){let r=e.transform[t],i=s.findTransformConstraint(r);if(!i)throw new Error(`Couldn't find transform constraint ${r} for skin ${e.name}.`);n.constraints.push(i)}if(e.path)for(let t=0;t<e.path.length;t++){let r=e.path[t],i=s.findPathConstraint(r);if(!i)throw new Error(`Couldn't find path constraint ${r} for skin ${e.name}.`);n.constraints.push(i)}if(e.physics)for(let t=0;t<e.physics.length;t++){let r=e.physics[t],i=s.findPhysicsConstraint(r);if(!i)throw new Error(`Couldn't find physics constraint ${r} for skin ${e.name}.`);n.constraints.push(i)}for(let t in e.attachments){let r=s.findSlot(t);if(!r)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let i=e.attachments[t];for(let t in i){let e=this.readAttachment(i[t],n,r.index,t,s);e&&n.setAttachment(r.index,t,e)}}s.skins.push(n),"default"==n.name&&(s.defaultSkin=n)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],r=e.skin?s.findSkin(e.skin):s.defaultSkin;if(!r)throw new Error(`Skin not found: ${e.skin}`);let n=r.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()}if(this.linkedMeshes.length=0,r.events)for(let t in r.events){let e=r.events[t],n=new he(t);n.intValue=Ts(e,"int",0),n.floatValue=Ts(e,"float",0),n.stringValue=Ts(e,"string",""),n.audioPath=Ts(e,"audio",null),n.audioPath&&(n.volume=Ts(e,"volume",1),n.balance=Ts(e,"balance",0)),s.events.push(n)}if(r.animations)for(let t in r.animations){let e=r.animations[t];this.readAnimation(e,t,s)}return s}readAttachment(t,e,s,r,n){let i=this.scale;switch(r=Ts(t,"name",r),Ts(t,"type","region")){case"region":{let s=Ts(t,"path",r),n=this.readSequence(Ts(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,r,s,n);if(!a)return null;a.path=s,a.x=Ts(t,"x",0)*i,a.y=Ts(t,"y",0)*i,a.scaleX=Ts(t,"scaleX",1),a.scaleY=Ts(t,"scaleY",1),a.rotation=Ts(t,"rotation",0),a.width=t.width*i,a.height=t.height*i,a.sequence=n;let o=Ts(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let n=Ts(t,"color",null);return n&&s.color.setFromString(n),s}case"mesh":case"linkedmesh":{let n=Ts(t,"path",r),a=this.readSequence(Ts(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,r,n,a);if(!o)return null;o.path=n;let l=Ts(t,"color",null);l&&o.color.setFromString(l),o.width=Ts(t,"width",0)*i,o.height=Ts(t,"height",0)*i,o.sequence=a;let h=Ts(t,"parent",null);if(h)return this.linkedMeshes.push(new vs(o,Ts(t,"skin",null),s,h,Ts(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=Ts(t,"edges",null),o.hullLength=2*Ts(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,r);if(!s)return null;s.closed=Ts(t,"closed",!1),s.constantSpeed=Ts(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,s,n<<1);let a=u.newArray(n/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*i;s.lengths=a;let o=Ts(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,r);if(!s)return null;s.x=Ts(t,"x",0)*i,s.y=Ts(t,"y",0)*i,s.rotation=Ts(t,"rotation",0);let n=Ts(t,"color",null);return n&&s.color.setFromString(n),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,r);if(!s)return null;let i=Ts(t,"end",null);i&&(s.endSlot=n.findSlot(i));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=Ts(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new k(Ts(t,"count",0));return e.start=Ts(t,"start",1),e.digits=Ts(t,"digits",0),e.setupIndex=Ts(t,"setup",0),e}readVertices(t,e,s){let r=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let t=u.toFloatArray(n);if(1!=r)for(let e=0,s=n.length;e<s;e++)t[e]*=r;return void(e.vertices=t)}let i=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]),i.push(n[t+1]*r),i.push(n[t+2]*r),i.push(n[t+3])}e.bones=a,e.vertices=u.toFloatArray(i)}readAnimation(t,e,s){let r=this.scale,n=new Array;if(t.slots)for(let e in t.slots){let r=t.slots[e],i=s.findSlot(e);if(!i)throw new Error("Slot not found: "+e);let o=i.index;for(let t in r){let e=r[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new H(s,o);for(let r=0;r<s;r++){let s=e[r];t.setFrame(r,Ts(s,"time",0),Ts(s,"name",null))}n.push(t)}else if("rgba"==t){let t=new W(s,s<<2,o),r=e[0],i=Ts(r,"time",0),l=a.fromString(r.color);for(let s=0,n=0;;s++){t.setFrame(s,i,l.r,l.g,l.b,l.a);let o=e[s+1];if(!o){t.shrink(n);break}let h=Ts(o,"time",0),c=a.fromString(o.color),d=r.curve;d&&(n=As(d,t,n,s,0,i,h,l.r,c.r,1),n=As(d,t,n,s,1,i,h,l.g,c.g,1),n=As(d,t,n,s,2,i,h,l.b,c.b,1),n=As(d,t,n,s,3,i,h,l.a,c.a,1)),i=h,l=c,r=o}n.push(t)}else if("rgb"==t){let t=new z(s,3*s,o),r=e[0],i=Ts(r,"time",0),l=a.fromString(r.color);for(let s=0,n=0;;s++){t.setFrame(s,i,l.r,l.g,l.b);let o=e[s+1];if(!o){t.shrink(n);break}let h=Ts(o,"time",0),c=a.fromString(o.color),d=r.curve;d&&(n=As(d,t,n,s,0,i,h,l.r,c.r,1),n=As(d,t,n,s,1,i,h,l.g,c.g,1),n=As(d,t,n,s,2,i,h,l.b,c.b,1)),i=h,l=c,r=o}n.push(t)}else if("alpha"==t)n.push(Cs(e,new G(s,s,o),0,1));else if("rgba2"==t){let t=new $(s,7*s,o),r=e[0],i=Ts(r,"time",0),l=a.fromString(r.light),h=a.fromString(r.dark);for(let s=0,n=0;;s++){t.setFrame(s,i,l.r,l.g,l.b,l.a,h.r,h.g,h.b);let o=e[s+1];if(!o){t.shrink(n);break}let c=Ts(o,"time",0),d=a.fromString(o.light),u=a.fromString(o.dark),m=r.curve;m&&(n=As(m,t,n,s,0,i,c,l.r,d.r,1),n=As(m,t,n,s,1,i,c,l.g,d.g,1),n=As(m,t,n,s,2,i,c,l.b,d.b,1),n=As(m,t,n,s,3,i,c,l.a,d.a,1),n=As(m,t,n,s,4,i,c,h.r,u.r,1),n=As(m,t,n,s,5,i,c,h.g,u.g,1),n=As(m,t,n,s,6,i,c,h.b,u.b,1)),i=c,l=d,h=u,r=o}n.push(t)}else if("rgb2"==t){let t=new j(s,6*s,o),r=e[0],i=Ts(r,"time",0),l=a.fromString(r.light),h=a.fromString(r.dark);for(let s=0,n=0;;s++){t.setFrame(s,i,l.r,l.g,l.b,h.r,h.g,h.b);let o=e[s+1];if(!o){t.shrink(n);break}let c=Ts(o,"time",0),d=a.fromString(o.light),u=a.fromString(o.dark),m=r.curve;m&&(n=As(m,t,n,s,0,i,c,l.r,d.r,1),n=As(m,t,n,s,1,i,c,l.g,d.g,1),n=As(m,t,n,s,2,i,c,l.b,d.b,1),n=As(m,t,n,s,3,i,c,h.r,u.r,1),n=As(m,t,n,s,4,i,c,h.g,u.g,1),n=As(m,t,n,s,5,i,c,h.b,u.b,1)),i=c,l=d,h=u,r=o}n.push(t)}}}if(t.bones)for(let e in t.bones){let i=t.bones[e],a=s.findBone(e);if(!a)throw new Error("Bone not found: "+e);let o=a.index;for(let t in i){let e=i[t],s=e.length;if(0!=s)if("rotate"===t)n.push(Cs(e,new X(s,s,o),0,1));else if("translate"===t){let t=new B(s,s<<1,o);n.push(Ss(e,t,"x","y",0,r))}else if("translatex"===t){let t=new E(s,s,o);n.push(Cs(e,t,0,r))}else if("translatey"===t){let t=new D(s,s,o);n.push(Cs(e,t,0,r))}else if("scale"===t){let t=new V(s,s<<1,o);n.push(Ss(e,t,"x","y",1,1))}else if("scalex"===t){let t=new L(s,s,o);n.push(Cs(e,t,1,1))}else if("scaley"===t){let t=new N(s,s,o);n.push(Cs(e,t,1,1))}else if("shear"===t){let t=new _(s,s<<1,o);n.push(Ss(e,t,"x","y",0,1))}else if("shearx"===t){let t=new O(s,s,o);n.push(Cs(e,t,0,1))}else if("sheary"===t){let t=new U(s,s,o);n.push(Cs(e,t,0,1))}else if("inherit"===t){let t=new q(s,a.index);for(let s=0;s<e.length;s++){let r=e[s];t.setFrame(s,Ts(r,"time",0),u.enumValue(Ht,Ts(r,"inherit","Normal")))}n.push(t)}}}if(t.ik)for(let e in t.ik){let i=t.ik[e],a=i[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 et(i.length,i.length<<1,l),c=Ts(a,"time",0),d=Ts(a,"mix",1),u=Ts(a,"softness",0)*r;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Ts(a,"bendPositive",!0)?1:-1,Ts(a,"compress",!1),Ts(a,"stretch",!1));let s=i[t+1];if(!s){h.shrink(e);break}let n=Ts(s,"time",0),o=Ts(s,"mix",1),l=Ts(s,"softness",0)*r,m=a.curve;m&&(e=As(m,h,e,t,0,c,n,d,o,1),e=As(m,h,e,t,1,c,n,u,l,r)),c=n,d=o,u=l,a=s}n.push(h)}if(t.transform)for(let e in t.transform){let r=t.transform[e],i=r[0];if(!i)continue;let a=s.findTransformConstraint(e);if(!a)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(a),l=new st(r.length,6*r.length,o),h=Ts(i,"time",0),c=Ts(i,"mixRotate",1),d=Ts(i,"mixX",1),u=Ts(i,"mixY",d),m=Ts(i,"mixScaleX",1),f=Ts(i,"mixScaleY",m),g=Ts(i,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,g);let s=r[t+1];if(!s){l.shrink(e);break}let n=Ts(s,"time",0),a=Ts(s,"mixRotate",1),o=Ts(s,"mixX",1),p=Ts(s,"mixY",o),x=Ts(s,"mixScaleX",1),b=Ts(s,"mixScaleY",x),w=Ts(s,"mixShearY",1),y=i.curve;y&&(e=As(y,l,e,t,0,h,n,c,a,1),e=As(y,l,e,t,1,h,n,d,o,1),e=As(y,l,e,t,2,h,n,u,p,1),e=As(y,l,e,t,3,h,n,m,x,1),e=As(y,l,e,t,4,h,n,f,b,1),e=As(y,l,e,t,5,h,n,g,w,1)),h=n,c=a,d=o,u=p,m=x,f=b,m=x,i=s}n.push(l)}if(t.path)for(let e in t.path){let i=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 i){let e=i[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new rt(l,l,o);n.push(Cs(e,t,0,a.positionMode==Zt.Fixed?r:1))}else if("spacing"===t){let t=new nt(l,l,o);n.push(Cs(e,t,0,a.spacingMode==ee.Length||a.spacingMode==ee.Fixed?r:1))}else if("mix"===t){let t=new it(l,3*l,o),r=Ts(s,"time",0),i=Ts(s,"mixRotate",1),a=Ts(s,"mixX",1),h=Ts(s,"mixY",a);for(let n=0,o=0;;n++){t.setFrame(n,r,i,a,h);let l=e[n+1];if(!l){t.shrink(o);break}let c=Ts(l,"time",0),d=Ts(l,"mixRotate",1),u=Ts(l,"mixX",1),m=Ts(l,"mixY",u),f=s.curve;f&&(o=As(f,t,o,n,0,r,c,i,d,1),o=As(f,t,o,n,1,r,c,a,u,1),o=As(f,t,o,n,2,r,c,h,m,1)),r=c,i=d,a=u,h=m,s=l}n.push(t)}}}if(t.physics)for(let e in t.physics){let r=t.physics[e],i=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);i=s.physicsConstraints.indexOf(t)}for(let t in r){let e=r[t],s=e[0];if(!s)continue;let a,o=e.length;if("reset"!=t){if("inertia"==t)a=new ot(o,o,i);else if("strength"==t)a=new lt(o,o,i);else if("damping"==t)a=new ht(o,o,i);else if("mass"==t)a=new ct(o,o,i);else if("wind"==t)a=new dt(o,o,i);else if("gravity"==t)a=new ut(o,o,i);else{if("mix"!=t)continue;a=new mt(o,o,i)}n.push(Cs(e,a,0,1))}else{const t=new gt(o,i);for(let r=0;null!=s;s=e[r+1],r++)t.setFrame(r,Ts(s,"time",0));n.push(t)}}}if(t.attachments)for(let e in t.attachments){let i=t.attachments[e],a=s.findSkin(e);if(!a)throw new Error("Skin not found: "+e);for(let t in i){let e=i[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],i=a.getAttachment(l,t);for(let t in s){let e=s[t],a=e[0];if(a)if("deform"==t){let t=i.bones,s=i.vertices,o=t?s.length/3*2:s.length,h=new J(e.length,e.length,l,i),c=Ts(a,"time",0);for(let n=0,i=0;;n++){let l,d=Ts(a,"vertices",null);if(d){l=u.newFloatArray(o);let e=Ts(a,"offset",0);if(u.arrayCopy(d,0,l,e,d.length),1!=r)for(let t=e,s=t+d.length;t<s;t++)l[t]*=r;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?u.newFloatArray(o):s;h.setFrame(n,c,l);let m=e[n+1];if(!m){h.shrink(i);break}let f=Ts(m,"time",0),g=a.curve;g&&(i=As(g,h,i,n,0,c,f,0,1,1)),c=f,a=m}n.push(h)}else if("sequence"==t){let t=new xt(e.length,l,i),s=0;for(let r=0;r<e.length;r++){let n=Ts(a,"delay",s),i=Ts(a,"time",0),o=b[Ts(a,"mode","hold")],l=Ts(a,"index",0);t.setFrame(r,i,o,l,n),s=n,a=e[r+1]}n.push(t)}}}}}if(t.drawOrder){let e=new tt(t.drawOrder.length),r=s.slots.length,i=0;for(let n=0;n<t.drawOrder.length;n++,i++){let a=t.drawOrder[n],o=null,l=Ts(a,"offsets",null);if(l){o=u.newArray(r,-1);let t=u.newArray(r-l.length,0),e=0,n=0;for(let r=0;r<l.length;r++){let i=l[r],a=s.findSlot(i.slot);if(!a)throw new Error("Slot not found: "+a);let h=a.index;for(;e!=h;)t[n++]=e++;o[e+i.offset]=e++}for(;e<r;)t[n++]=e++;for(let e=r-1;e>=0;e--)-1==o[e]&&(o[e]=t[--n])}e.setFrame(i,Ts(a,"time",0),o)}n.push(e)}if(t.events){let e=new Q(t.events.length),r=0;for(let n=0;n<t.events.length;n++,r++){let i=t.events[n],a=s.findEvent(i.name);if(!a)throw new Error("Event not found: "+i.name);let o=new le(u.toSinglePrecision(Ts(i,"time",0)),a);o.intValue=Ts(i,"int",a.intValue),o.floatValue=Ts(i,"float",a.floatValue),o.stringValue=Ts(i,"string",a.stringValue),o.data.audioPath&&(o.volume=Ts(i,"volume",1),o.balance=Ts(i,"balance",0)),e.setFrame(r,o)}n.push(e)}let i=0;for(let t=0,e=n.length;t<e;t++)i=Math.max(i,n[t].getDuration());s.animations.push(new I(e,n,i))}},vs=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};function Cs(t,e,s,r){let n=t[0],i=Ts(n,"time",0),a=Ts(n,"value",s)*r,o=0;for(let l=0;;l++){e.setFrame(l,i,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Ts(h,"time",0),d=Ts(h,"value",s)*r;n.curve&&(o=As(n.curve,e,o,l,0,i,c,a,d,r)),i=c,a=d,n=h}}function Ss(t,e,s,r,n,i){let a=t[0],o=Ts(a,"time",0),l=Ts(a,s,n)*i,h=Ts(a,r,n)*i,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=Ts(u,"time",0),f=Ts(u,s,n)*i,g=Ts(u,r,n)*i,p=a.curve;p&&(c=As(p,e,c,d,0,o,m,l,f,i),c=As(p,e,c,d,1,o,m,h,g,i)),o=m,l=f,h=g,a=u}}function As(t,e,s,r,n,i,a,o,l,h){if("stepped"==t)return e.setStepped(r),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,r,n,i,o,d,u,m,f,a,l),s+1}function Ts(t,e,s){return void 0!==t[e]?t[e]:s}void 0===Math.fround&&(Math.fround=(Ne=new Float32Array(1),function(t){return Ne[0]=t,Ne[0]}));var Is=class extends Lt{static from(t){return Is.textureMap.has(t)?Is.textureMap.get(t):new Is(t)}texture;constructor(e){super(e.resource),this.texture=t.Texture.from(e)}setFilters(t,e){if(!this.texture||!this.texture.source||!this.texture.source.style)return;const s=this.texture.source.style;s.minFilter=Is.toPixiTextureFilter(t),s.magFilter=Is.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=Is.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){if(!this.texture||!this.texture.source||!this.texture.source.style)return;const s=this.texture.source.style;s.addressModeU=Is.toPixiTextureWrap(t),s.addressModeV=Is.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case St.Nearest:case St.Linear:return!1;case St.MipMapNearestLinear:case St.MipMapNearestNearest:case St.MipMapLinearLinear:case St.MipMapLinearNearest:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case St.Nearest:case St.MipMapNearestLinear:case St.MipMapNearestNearest:return"nearest";case St.Linear:case St.MipMapLinearLinear:case St.MipMapLinearNearest:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case Tt.ClampToEdge:return"clamp-to-edge";case Tt.MirroredRepeat:return"mirror-repeat";case Tt.Repeat:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case ve.Normal:return"normal";case ve.Additive:return"add";case ve.Multiply:return"multiply";case ve.Screen:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Ms=Is;r(Ms,"textureMap",new Map);var Fs="spineTextureAtlasLoader",Ys={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:{id:Fs,name:Fs,extension:{type:t.ExtensionType.LoadParser,priority:t.LoaderParserPriority.Normal,name:Fs},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 r=t.checkExtension(s.src,".atlas"),n="string"==typeof e,i=s.parser===Fs||s.loadParser===Fs;return Promise.resolve((r||i)&&n)},unload(t){t.dispose()},async parse(e,s,r){const n=s.data||{};let i=t.path.dirname(s.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const a=new _t(e);if(n.images instanceof t.TextureSource||"string"==typeof n.images){const t=n.images;n.images={},n.images[a.pages[0].name]=t}const o=[];for(const e of a.pages){if(n.resolve){const t=n.resolve().then((t=>{e.setTexture(Ms.from(t.source))}));o.push(t);continue}const a=e.name,l=n?.images?n.images[a]:void 0;if(l instanceof t.TextureSource)e.setTexture(Ms.from(l));else{const h=l??t.path.normalize([...i.split(t.path.sep),a].join(t.path.sep)),c={src:t.copySearchParams(h,s.src),data:{...n.imageMetadata,alphaMode:e.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},d=r.load(c).then((t=>{e.setTexture(Ms.from(t.source))}));o.push(d)}}return await Promise.all(o),a}}};t.extensions.add(Ys);var Ps="spineSkeletonLoader";var Rs={extension:t.ExtensionType.Asset,loader:{id:Ps,name:Ps,extension:{type:t.ExtensionType.LoadParser,priority:t.LoaderParserPriority.Normal,name:Ps},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 r=t.checkExtension(s.src,".json")&&(n=e,Object.prototype.hasOwnProperty.call(n,"bones"));var n;const i=t.checkExtension(s.src,".skel")&&function(t){return t instanceof Uint8Array}(e),a=s.parser===Ps||s.loadParser===Ps;return Promise.resolve(r||i||a)}}};t.extensions.add(Rs);var Xs=new Float32Array(1),Bs=new Uint32Array(1),Es=class extends t.Geometry{constructor(){const e=new t.Buffer({data:Xs,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})})}},Ds={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 "}},Ls=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,Ds,t.generateTextureBatchBit(e),t.roundPixelsBit]}),resources:{batchSamplers:t.getBatchSamplersUniformGroup(e)}})}},Ns=null,_s=class extends t.Batcher{geometry=new Es;shader=Ns||(Ns=new Ls(this.maxTextures));name=_s.extension.name;vertexSize=7;packAttributes(e,s,r,n,i){const a=i<<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,b=t.Color.shared.setValue(e.darkColor).premultiply(x,!0).toPremultiplied(1,!1),w=e.attributeOffset,y=w+e.attributeSize;for(let t=w;t<y;t++){const e=2*t,i=f[e],o=f[e+1];s[n++]=l*i+c*o+u,s[n++]=d*o+h*i+m,s[n++]=g[e],s[n++]=g[e+1],r[n++]=p,r[n++]=b,r[n++]=a}}packQuadAttributes(t,e,s,r,n){const i=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,b=i.uvs,w=t.color,y=t.darkColor,k=n<<16|65535&t.roundPixels;e[r+0]=o*g+h*x+d,e[r+1]=c*x+l*g+u,e[r+2]=b.x0,e[r+3]=b.y0,s[r+4]=w,s[r+5]=y,s[r+6]=k,e[r+7]=o*f+h*x+d,e[r+8]=c*x+l*f+u,e[r+9]=b.x1,e[r+10]=b.y1,s[r+11]=w,s[r+12]=y,s[r+13]=k,e[r+14]=o*f+h*p+d,e[r+15]=c*p+l*f+u,e[r+16]=b.x2,e[r+17]=b.y2,s[r+18]=w,s[r+19]=y,s[r+20]=k,e[r+21]=o*g+h*p+d,e[r+22]=c*p+l*g+u,e[r+23]=b.x3,e[r+24]=b.y3,s[r+25]=w,s[r+26]=y,s[r+27]=k}},Os=_s;r(Os,"extension",{type:[t.ExtensionType.Batcher],name:"darkTint"}),t.extensions.add(Os);var Us=u.newFloatArray(8),qs=class{ctx;triangleRendering=!1;debugRendering=!1;vertices=u.newFloatArray(8192);tempColor=new a;constructor(t){this.ctx=t}draw(t){this.triangleRendering?this.drawTriangles(t):this.drawImages(t)}drawImages(t){let e=this.ctx,s=this.tempColor,r=t.color,n=t.drawOrder;this.debugRendering&&(e.strokeStyle="green");for(let t=0,i=n.length;t<i;t++){let i=n[t],a=i.bone;if(!a.active)continue;let o=i.getAttachment();if(!(o instanceof jt))continue;o.computeWorldVertices(i,Us,0,2);let l=o.region,h=l.texture.getImage(),c=i.color,d=o.color;s.set(r.r*c.r*d.r,r.g*c.g*d.g,r.b*c.b*d.b,r.a*c.a*d.a),e.save(),e.transform(a.a,a.c,a.b,a.d,a.worldX,a.worldY),e.translate(o.offset[0],o.offset[1]),e.rotate(o.rotation*Math.PI/180);let u=o.width/l.originalWidth;e.scale(u*o.scaleX,u*o.scaleY);let m=l.width,f=l.height;if(e.translate(m/2,f/2),90==o.region.degrees){let t=m;m=f,f=t,e.rotate(-Math.PI/2)}e.scale(1,-1),e.translate(-m/2,-f/2),e.globalAlpha=s.a,e.drawImage(h,h.width*l.u,h.height*l.v,m,f,0,0,m,f),this.debugRendering&&e.strokeRect(0,0,m,f),e.restore()}}drawTriangles(t){let e=this.ctx,s=this.tempColor,r=t.color,n=t.drawOrder,i=null,a=this.vertices,o=null;for(let t=0,h=n.length;t<h;t++){let h,c=n[t],d=c.getAttachment();if(d instanceof jt){let t=d;a=this.computeRegionVertices(c,t,!1),o=qs.QUAD_TRIANGLES,h=t.region.texture.getImage()}else{if(!(d instanceof Wt))continue;{let t=d;a=this.computeMeshVertices(c,t,!1),o=t.triangles,h=t.region.texture.getImage()}}if(h){c.data.blendMode!=i&&(i=c.data.blendMode);let t=c.color,n=d.color;s.set(r.r*t.r*n.r,r.g*t.g*n.g,r.b*t.b*n.b,r.a*t.a*n.a),e.globalAlpha=s.a;for(var l=0;l<o.length;l+=3){let t=8*o[l],s=8*o[l+1],r=8*o[l+2],n=a[t],i=a[t+1],c=a[t+6],d=a[t+7],u=a[s],m=a[s+1],f=a[s+6],g=a[s+7],p=a[r],x=a[r+1],b=a[r+6],w=a[r+7];this.drawTriangle(h,n,i,c,d,u,m,f,g,p,x,b,w),this.debugRendering&&(e.strokeStyle="green",e.beginPath(),e.moveTo(n,i),e.lineTo(u,m),e.lineTo(p,x),e.lineTo(n,i),e.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(t,e,s,r,n,i,a,o,l,h,c,d,u){let m=this.ctx;const f=t.width-1,g=t.height-1;r*=f,n*=g,o*=f,l*=g,d*=f,u*=g,m.beginPath(),m.moveTo(e,s),m.lineTo(i,a),m.lineTo(h,c),m.closePath();let p=(o-=r)*(u-=n)-(d-=r)*(l-=n);if(0==p)return;p=1/p;const x=(u*(i-=e)-l*(h-=e))*p,b=(u*(a-=s)-l*(c-=s))*p,w=(o*h-d*i)*p,y=(o*c-d*a)*p,k=e-x*r-w*n,v=s-b*r-y*n;m.save(),m.transform(x,b,w,y,k,v),m.clip(),m.drawImage(t,0,0),m.restore()}computeRegionVertices(t,e,s){let r=t.bone.skeleton.color,n=t.color,i=e.color,a=r.a*n.a*i.a,o=s?a:1,l=this.tempColor;l.set(r.r*n.r*i.r*o,r.g*n.g*i.g*o,r.b*n.b*i.b*o,a),e.computeWorldVertices(t,this.vertices,0,qs.VERTEX_SIZE);let h=this.vertices,c=e.uvs;return h[jt.C1R]=l.r,h[jt.C1G]=l.g,h[jt.C1B]=l.b,h[jt.C1A]=l.a,h[jt.U1]=c[0],h[jt.V1]=c[1],h[jt.C2R]=l.r,h[jt.C2G]=l.g,h[jt.C2B]=l.b,h[jt.C2A]=l.a,h[jt.U2]=c[2],h[jt.V2]=c[3],h[jt.C3R]=l.r,h[jt.C3G]=l.g,h[jt.C3B]=l.b,h[jt.C3A]=l.a,h[jt.U3]=c[4],h[jt.V3]=c[5],h[jt.C4R]=l.r,h[jt.C4G]=l.g,h[jt.C4B]=l.b,h[jt.C4A]=l.a,h[jt.U4]=c[6],h[jt.V4]=c[7],h}computeMeshVertices(t,e,s){let r=t.bone.skeleton.color,n=t.color,i=e.color,a=r.a*n.a*i.a,o=s?a:1,l=this.tempColor;l.set(r.r*n.r*i.r*o,r.g*n.g*i.g*o,r.b*n.b*i.b*o,a);let h=e.worldVerticesLength/2,c=this.vertices;c.length<e.worldVerticesLength&&(this.vertices=c=u.newFloatArray(e.worldVerticesLength)),e.computeWorldVertices(t,0,e.worldVerticesLength,c,0,qs.VERTEX_SIZE);let d=e.uvs;for(let t=0,e=0,s=2;t<h;t++)c[s++]=l.r,c[s++]=l.g,c[s++]=l.b,c[s++]=l.a,c[s++]=d[e++],c[s++]=d[e++],s+=2;return c}},Ws=qs;r(Ws,"QUAD_TRIANGLES",[0,1,2,2,3,0]),r(Ws,"VERTEX_SIZE",8);var zs=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 r;const n=t.a*s*255;if(16777215!==e){const s=e>>16&255,i=e>>8&255,a=255&e,o=t.r*a,l=t.g*i;r=n<<24|t.b*s<<16|l<<8|o}else r=n<<24|255*t.b<<16|255*t.g<<8|255*t.r;return r}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,r){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=r,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},Gs={0:"normal",1:"add",2:"multiply",3:"screen"},$s=class{renderer;canvasSkeletonRenderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(t){this.renderer=t}validateRenderable(e){if(this.renderer.type===t.RendererType.CANVAS)return!0;if(e._validateAndTransformAttachments(),e.spineAttachmentsDirty)return!0;if(e.spineTexturesDirty){const t=e.skeleton.drawOrder,s=this.gpuSpineData[e.uid];for(let r=0,n=t.length;r<n;r++){const n=t[r],i=n.getAttachment();if(i instanceof jt||i instanceof Wt){const t=e._getCachedData(n,i),r=s.slotBatches[t.id],a=t.texture;if(a!==r?.texture&&!r?._batcher.checkAndUpdateTexture(r,a))return!0}}}return!1}execute(e){if(this.renderer.type===t.RendererType.CANVAS){const t=this.renderer,s=(e.groupColorAlpha>>>24&255)/255,r=t.canvasContext,n=r.activeContext;n.save(),this.canvasSkeletonRenderer||(this.canvasSkeletonRenderer=new Ws(n),this.canvasSkeletonRenderer.triangleRendering=!0),r.setContextTransform(e.groupTransform,1==(t._roundPixels|e._roundPixels));const i=e.skeleton.color.a;e.skeleton.color.a*=s,this.canvasSkeletonRenderer.draw(e.skeleton),e.skeleton.color.a=i,n.restore()}}addRenderable(e,s){if(this.renderer.type===t.RendererType.CANVAS)return this.renderer.renderPipes.batch.break(s),void s.add(e);const r=this._getSpineData(e),n=this.renderer.renderPipes.batch,i=e.skeleton.drawOrder,a=this.renderer._roundPixels|e._roundPixels;e._validateAndTransformAttachments(),e.spineAttachmentsDirty=!1,e.spineTexturesDirty=!1;for(let t=0,o=i.length;t<o;t++){const o=i[t],l=o.getAttachment(),h=Gs[o.data.blendMode];let c=!1;if(l instanceof jt||l instanceof Wt){const t=e._getCachedData(o,l),i=r.slotBatches[t.id]||=new zs;i.setData(e,t,h,a),c=t.skipRender,c||n.addToBatch(i,s)}const d=e._slotsObject[o.data.name];if(d){const t=d.container;c||(t.includeInBuild=!0,t.collectRenderables(s,this.renderer,null)),t.includeInBuild=!1}}}updateRenderable(t){const e=this.gpuSpineData[t.uid];t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;const s=t.skeleton.drawOrder;for(let r=0,n=s.length;r<n;r++){const n=s[r],i=n.getAttachment();if(i instanceof jt||i instanceof Wt){const s=t._getCachedData(n,i);if(!s.skipRender){const t=e.slotBatches[s.id];t?._batcher?.updateElement(t)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null,this.canvasSkeletonRenderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};r($s,"extension",{type:[t.ExtensionType.WebGLPipes,t.ExtensionType.WebGPUPipes,t.ExtensionType.CanvasPipes],name:"spine"}),t.extensions.add($s);var js=new f;ke.yDown=!0;var Hs=new ys,Js=new m((()=>new t.Graphics)),Ks=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=!1;_ticker=t.Ticker.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!t&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=t}get ticker(){return this._ticker}set ticker(e){e=e??t.Ticker.shared,this._ticker!==e&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),e.add(this.internalUpdate,this)),this._ticker=e)}_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(t){t instanceof Ae&&(t={skeletonData:t}),super({}),this.allowChildren=!0;const e=t instanceof Ae?t:t.skeletonData;this.skeleton=new ke(e),this.state=new wt(new Et(e)),t?.ticker&&(this._ticker=t.ticker),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);this._boundsProvider=t.boundsProvider}update(t){this.internalUpdate(0,t)}internalUpdate(t,e){this._updateAndApplyState(e??this._ticker.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(js.set(e.x,e.y),t.parent){const e=t.parent.worldToLocal(js);t.x=e.x,t.y=-e.y}else t.x=js.x,t.y=js.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(ge.update),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!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,r=!1;for(let n=0;n<t.length;n++){const i=t[n].getAttachment();i&&(i!==e[s]&&(r=!0,e[s]=i),s++)}s!==e.length&&(r=!0,e.length=s),this.spineAttachmentsDirty||=r}currentClippingSlot;updateAndSetPixiMask(t,e){const s=t.attachment;if(s&&s instanceof Vt){const e=this.clippingSlotToPixiMasks[t.data.name]||={slot:t,vertices:new Array};return e.maskComputed=!1,void(this.currentClippingSlot=e)}let r=this.currentClippingSlot,n=this._slotsObject[t.data.name];if(r&&n){let t=r.mask;if(t||(t=Js.obtain(),r.mask=t,this.addChild(t)),!r.maskComputed){let e=r.slot,s=e.attachment;r.maskComputed=!0;const n=s.worldVerticesLength,i=r.vertices;s.computeWorldVertices(e,0,n,i,0,2),t.clear().poly(i).stroke({width:0}).fill({alpha:.25})}n.container.mask=t}else n?.container.mask&&(n.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 Vt&&e.maskComputed||!e.mask||(this.removeChild(e.mask),Js.free(e.mask),e.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const e=this.skeleton.drawOrder;for(let s=0;s<e.length;s++){const r=e[s];this.updateAndSetPixiMask(r,s===e.length-1);const n=r.getAttachment();if(n)if(n instanceof Wt||n instanceof jt){const e=this._getCachedData(r,n);n instanceof jt?n.computeWorldVertices(r,e.vertices,0,2):n.computeWorldVertices(r,0,n.worldVerticesLength,e.vertices,0,2),e.uvs.length<n.uvs.length&&(e.uvs=new Float32Array(n.uvs.length)),t.fastCopy(n.uvs.buffer,e.uvs.buffer);const s=r.bone.skeleton.color,i=r.color,a=n.color,o=s.a*i.a*a.a;if(e.color.set(s.r*i.r*a.r,s.g*i.g*a.g,s.b*i.b*a.b,o),0===this.alpha||0===o)e.skipRender||(this.spineAttachmentsDirty=!0),e.skipRender=!0;else{e.skipRender&&(this.spineAttachmentsDirty=!0),e.skipRender=e.clipped=!1,r.darkColor&&e.darkColor.setFromColor(r.darkColor);const s=n.region?.texture.texture||t.Texture.EMPTY;e.texture!==s&&(e.texture=s,this.spineTexturesDirty=!0),Hs.isClipping()&&this.updateClippingData(e)}}else if(n instanceof Vt){Hs.clipStart(r,n);continue}Hs.clipEndWithSlot(r)}Hs.clipEnd()}updateClippingData(t){t.clipped=!0,Hs.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:e,clippedUVs:s,clippedTriangles:r}=Hs,n=e.length/2,i=r.length;t.clippedData||(t.clippedData={vertices:new Float32Array(2*n),uvs:new Float32Array(2*n),vertexCount:n,indices:new Uint16Array(i),indicesCount:i},this.spineAttachmentsDirty=!0);const a=t.clippedData,o=a.vertexCount!==n||i!==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<i&&(a.indices=new Uint16Array(i)));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<i;t++)c[t]!==r[t]&&(this.spineAttachmentsDirty=!0,c[t]=r[t]);a.indicesCount=i}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(t){const{slot:e,container:s}=t,r=!t.followAttachmentTimeline||Boolean(e.attachment);if(s.visible=this.skeleton.drawOrder.includes(e)&&r,s.visible){let t=e.bone;const r=s.localTransform;r.a=t.a,r.b=t.c,r.c=-t.b,r.d=-t.d,r.tx=t.worldX,r.ty=t.worldY,s.setFromMatrix(r),s.alpha=this.skeleton.color.a*e.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 jt?(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 a(1,1,1,1),darkColor:new a(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 a(1,1,1,1),darkColor:new a(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._boundsProvider||(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,s){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 r={container:e,slot:t,followAttachmentTimeline:s?.followAttachmentTimeline||!1};this._slotsObject[t.data.name]=r,this.updateSlotObject(r)}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)}removeSlotObjects(){Object.entries(this._slotsObject).forEach((([t,e])=>{e&&e.container.removeFromParent(),delete this._slotsObject[t]}))}getSlotObject(t){return t=this.getSlotFromRef(t),this._slotsObject[t.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new bs;const t=this.skeletonBounds;if(t.update(this.skeleton,!0),this._boundsProvider){const t=this._boundsProvider.calculateBounds(this),e=this._bounds;e.clear(),e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height}else if(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 r=t[s],n=r.getAttachment();if(n&&(n instanceof jt||n instanceof Wt)){const t=this._getCachedData(r,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(t=!1){super.destroy(t),this._ticker.remove(this.internalUpdate,this),this._ticker=null,this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(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:r=1,darkTint:n,autoUpdate:i=!0,boundsProvider:a,ticker:o}){const l=`${e}-${s}-${r}`;if(t.Cache.has(l))return new Ks({skeletonData:t.Cache.get(l),darkTint:n,autoUpdate:i,boundsProvider:a,ticker:o});const h=t.Assets.get(e),c=t.Assets.get(s),d=new Kt(c),u=h instanceof Uint8Array?new Re(d):new ks(d);u.scale=r;const m=u.readSkeletonData(h);return t.Cache.set(l,m),new Ks({skeletonData:m,darkTint:n,autoUpdate:i,boundsProvider:a,ticker:o})}},Qs={AABBRectangleBoundsProvider:class{constructor(t,e,s,r){this.x=t,this.y=e,this.width=s,this.height=r}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},AlphaTimeline:G,Animation:I,AnimationState:wt,AnimationStateAdapter:class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},AnimationStateData:Et,AssetManagerBase:class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(t,e="",s=new oe){this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${r}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${r}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,r)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${r}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>{this.success(e,t,this.textureLoader(r))},r.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),r.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},r){let n=t.lastIndexOf("/"),i=n>=0?t.substring(0,n+1):"";t=this.start(t),this.downloader.downloadText(t,(n=>{try{let a=new _t(n),o=a.pages.length,l=!1;for(let n of a.pages)this.loadTexture(r?r[n.name]:i+n.name,((s,r)=>{l||(n.setTexture(r),0==--o&&this.success(e,t,a))}),((e,r)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,r)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${r}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},AtlasAttachmentLoader:Kt,Attachment:g,AttachmentTimeline:H,BinaryInput:Xe,BlendMode:ve,Bone:ie,BoneData:Qt,BoundingBoxAttachment:Dt,CURRENT:Bt,ClippingAttachment:Vt,Color:a,ConstraintData:ae,CurveTimeline:Y,CurveTimeline1:P,CurveTimeline2:R,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:J,Downloader:oe,DrawOrderTimeline:tt,Event:le,EventData:he,EventQueue:Ct,EventTimeline:Q,EventType:yt,FIRST:Ft,FakeTexture:class extends Lt{setFilters(t,e){}setWraps(t,e){}dispose(){}},HOLD_FIRST:Pt,HOLD_MIX:Rt,HOLD_SUBSEQUENT:Yt,IkConstraint:ce,IkConstraintData:de,IkConstraintTimeline:et,Inherit:Ht,InheritTimeline:q,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:Wt,MixBlend:v,MixDirection:S,PathAttachment:zt,PathConstraint:fe,PathConstraintData:ue,PathConstraintMixTimeline:it,PathConstraintPositionTimeline:rt,PathConstraintSpacingTimeline:nt,Physics:ge,PhysicsConstraintDampingTimeline:ht,PhysicsConstraintGravityTimeline:ut,PhysicsConstraintInertiaTimeline:ot,PhysicsConstraintMassTimeline:ct,PhysicsConstraintMixTimeline:mt,PhysicsConstraintResetTimeline:gt,PhysicsConstraintStrengthTimeline:lt,PhysicsConstraintTimeline:at,PhysicsConstraintWindTimeline:dt,PointAttachment:Gt,Pool:m,PositionMode:Zt,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:j,RGBA2Timeline:$,RGBATimeline:W,RGBTimeline:z,RegionAttachment:jt,RotateMode:re,RotateTimeline:X,SETUP:Xt,SUBSEQUENT:Mt,ScaleTimeline:V,ScaleXTimeline:L,ScaleYTimeline:N,SequenceTimeline:xt,SetupPoseBoundsProvider:class{constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new ke(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(ge.update);const s=e.getBoundsRect(this.clipping?new ys:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},ShearTimeline:_,ShearXTimeline:O,ShearYTimeline:U,Skeleton:ke,SkeletonBinary:Re,SkeletonBounds:bs,SkeletonClipping:ys,SkeletonData:Ae,SkeletonJson:ks,Skin:Ie,SkinEntry:Te,SkinsAndAnimationBoundsProvider:class{constructor(t,e=[],s=.05,r=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=r}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};const e=new wt(t.state.data),s=new ke(t.skeleton.data),r=this.clipping?new ys:void 0,n=s.data;if(this.skins.length>0){let t=new Ie("custom-skin");for(const e of this.skins){const s=n.findSkin(e);null!=s&&t.addSkin(s)}s.setSkin(t)}s.setToSetupPose();const i=null!=this.animation?n.findAnimation(this.animation):null;if(null==i){s.updateWorldTransform(ge.update);const t=s.getBoundsRect(r);return t.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:t}{let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,i,!1);const l=Math.max(i.duration/this.timeStep,1);for(let i=0;i<l;i++){const l=i>0?this.timeStep:0;e.update(l),e.apply(s),s.update(l),s.updateWorldTransform(ge.update);const h=s.getBoundsRect(r);t=Math.min(t,h.x),n=Math.min(n,h.y),a=Math.max(a,h.x+h.width),o=Math.max(o,h.y+h.height)}const h={x:t,y:n,width:a-t,height:o-n};return h.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:h}}},Slot:be,SlotData:Me,SpacingMode:ee,Spine:Ks,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:(r,n)=>{if(this.drawEvents){const r=Math.abs(e.scale.x||e.scale.y||1),i=new t.Text({text:n.data.name,style:{fontSize:this.eventFontSize/r,fill:this.eventFontColor,fontFamily:"monospace"}});i.scale.x=Math.sign(e.scale.x),i.anchor.set(.5),s.eventText.addChild(i),setTimeout((()=>{i.destroyed||i.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),r=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,r,s),this.drawPaths&&this.drawPathsFunc(t,e,r),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,r),this.drawClipping&&this.drawClippingFunc(t,e,r),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,r),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,r),this.drawEvents)for(const t of e.eventText.children)t.alpha-=.05,t.y-=2}drawBonesFunc(e,s,r,n){const i=e.skeleton,a=i.x,o=i.y,l=i.bones;s.skeletonXY.strokeStyle={width:r,color:this.skeletonXYColor};for(let e=0,i=l.length;e<i;e++){const i=l[e],h=i.data.length,c=a+i.worldX,d=o+i.worldY,u=a+h*i.a+i.worldX,m=o+h*i.b+i.worldY;if("root"===i.data.name||null===i.data.parent)continue;const f=Math.abs(c-u),g=Math.abs(d-m),p=Math.pow(f,2),x=g,b=Math.pow(g,2),w=Math.sqrt(p+b),y=Math.pow(w,2),k=Math.PI/180,v=Math.acos((y+b-p)/(2*x*w))||0;if(0===w)continue;const C=new t.Graphics;s.bones.addChild(C);const S=w/50/n;C.context.poly([0,0,0-S,w-3*S,0,w-S,0+S,w-3*S]).fill(this.bonesColor),C.x=c,C.y=d,C.pivot.y=w;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,w,1.2*S).fill({color:0,alpha:.6}).stroke({width:r+S/2.4,color:this.bonesColor})}const h=3*r;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 r=t.skeleton.slots;for(let t=0,s=r.length;t<s;t++){const s=r[t],n=s.getAttachment();if(null===n||!(n instanceof jt))continue;const i=n,a=new Float32Array(8);i.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 r=t.skeleton.slots;for(let t=0,s=r.length;t<s;t++){const s=r[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Wt))continue;const i=n,a=new Float32Array(i.worldVerticesLength),o=i.triangles;let l=i.hullLength;if(i.computeWorldVertices(s,0,i.worldVerticesLength,a,0,2),this.drawMeshTriangles)for(let t=0,s=o.length;t<s;t+=3){const s=2*o[t],r=2*o[t+1],n=2*o[t+2];e.meshTrianglesLine.context.moveTo(a[s],a[s+1]).lineTo(a[r],a[r+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 r=0,n=l;r<n;r+=2){const n=a[r],i=a[r+1];e.meshHullLine.context.moveTo(n,i).lineTo(t,s),t=n,s=i}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const r=t.skeleton.slots;for(let t=0,s=r.length;t<s;t++){const s=r[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Vt))continue;const i=n,a=i.worldVerticesLength,o=new Float32Array(a);i.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 r=new bs;r.update(t.skeleton,!0),r.minX!==1/0&&e.boundingBoxesRect.rect(r.minX,r.minY,r.getWidth(),r.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const n=r.polygons,i=(t,r,n)=>{if(n<3)throw new Error("Polygon must contain at least 3 vertices");const i=[],a=2*s;for(let s=0,r=t.length;s<r;s+=2){const r=t[s],n=t[s+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(r,n,a),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(r,n,a).fill({color:this.boundingBoxesCircleColor}),i.push(r,n)}e.boundingBoxesPolygon.poly(i).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];i(e,0,e.length)}}drawPathsFunc(t,e,s){const r=t.skeleton.slots;for(let t=0,s=r.length;t<s;t++){const s=r[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof zt))continue;const i=n;let a=i.worldVerticesLength;const o=new Float32Array(a);i.computeWorldVertices(s,0,a,o,0,2);let l=o[2],h=o[3],c=0,d=0;if(i.closed){const t=o[0],s=o[1],r=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,r,n,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(t,s),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(r,n)}a-=4;for(let t=4;t<a;t+=6){const s=o[t],r=o[t+1],n=o[t+2],i=o[t+3];c=o[t+4],d=o[t+5],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(s,r,n,i,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(s,r),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(n,i),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:$s,SpineTexture:Ms,StringSet:n,Texture:Lt,TextureAtlas:_t,TextureAtlasPage:Ut,TextureAtlasRegion:qt,TextureFilter:St,TextureRegion:Nt,TextureWrap:Tt,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:F,TrackEntry:vt,TransformConstraint:we,TransformConstraintData:Pe,TransformConstraintTimeline:st,TranslateTimeline:B,TranslateXTimeline:E,TranslateYTimeline:D,Triangulator:ws,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 Zs extends e.SpineSystem{init(){super.init({pixiSpine:Qs})}}class tr extends e.Spine{}exports.PixiSpine=Qs,exports.Spine=tr,exports.SpineSystem=Zs;
|