@esotericsoftware/spine-pixi-v8 4.2.105 → 4.2.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Spine.js +3 -1
- package/dist/esm/spine-pixi-v8.min.mjs +4 -4
- package/dist/esm/spine-pixi-v8.mjs +2 -0
- package/dist/esm/spine-pixi-v8.mjs.map +2 -2
- package/dist/iife/spine-pixi-v8.js +2 -0
- package/dist/iife/spine-pixi-v8.js.map +2 -2
- package/dist/iife/spine-pixi-v8.min.js +3 -3
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";if(typeof window<"u"&&window.PIXI){const t=window.require;window.require=e=>{if(t)return t(e);if(e.startsWith("@pixi/")||e.startsWith("pixi.js"))return window.PIXI}}var gr=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},gt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},N=class Re{r;g;b;a;static WHITE=new Re(1,1,1,1);static RED=new Re(1,0,0,1);static GREEN=new Re(0,1,0,1);static BLUE=new Re(0,0,1,1);static MAGENTA=new Re(1,0,1,1);constructor(e=0,s=0,i=0,r=0){this.r=e,this.g=s,this.b=i,this.a=r}set(e,s,i,r){return this.r=e,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,i,r){return this.r+=e,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new Re){return s.setFromString(e)}},B=class be{static PI=3.1415927;static PI2=be.PI*2;static invPI2=1/be.PI2;static radiansToDegrees=180/be.PI;static radDeg=be.radiansToDegrees;static degreesToRadians=be.PI/180;static degRad=be.degreesToRadians;static clamp(e,s,i){return e<s?s:e>i?i:e}static cosDeg(e){return Math.cos(e*be.degRad)}static sinDeg(e){return Math.sin(e*be.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*be.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return be.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,i){let r=Math.random(),l=s-e;return r<=(i-e)/l?e+Math.sqrt(r*l*(i-e)):s-Math.sqrt((1-r)*l*(s-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Is=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},Ms=class extends Is{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},pr=class extends Ms{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},E=class Oe{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,i,r,l){for(let o=s,n=r;o<s+l;o++,n++)i[n]=e[o]}static arrayFill(e,s,i,r){for(let l=s;l<i;l++)e[l]=r}static setArraySize(e,s,i=0){let r=e.length;if(r==s)return e;if(e.length=s,r<s)for(let l=r;l<s;l++)e[l]=i;return e}static ensureArrayCapacity(e,s,i=0){return e.length>=s?e:Oe.setArraySize(e,s,i)}static newArray(e,s){let i=new Array(e);for(let r=0;r<e;r++)i[r]=s;return i}static newFloatArray(e){if(Oe.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(e){if(Oe.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(e){return Oe.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Oe.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,i=!0){for(var r=0;r<e.length;r++)if(e[r]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},xr=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)}}},Ee=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}},qe=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 t!=0&&(this.x/=t,this.y/=t),this}},br=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)}},wr=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}},pt=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},we=class nr extends pt{static nextID=0;id=nr.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,i,r,l,o){i=l+(i>>1)*o;let n=e.bone.skeleton,a=e.deform,h=this.vertices,c=this.bones;if(!c){a.length>0&&(h=a);let u=e.bone,p=u.worldX,b=u.worldY,w=u.a,g=u.b,x=u.c,y=u.d;for(let v=s,C=l;C<i;v+=2,C+=o){let A=h[v],k=h[v+1];r[C]=A*w+k*g+p,r[C+1]=A*x+k*y+b}return}let d=0,f=0;for(let u=0;u<s;u+=2){let p=c[d];d+=p+1,f+=p}let m=n.bones;if(a.length==0)for(let u=l,p=f*3;u<i;u+=o){let b=0,w=0,g=c[d++];for(g+=d;d<g;d++,p+=3){let x=m[c[d]],y=h[p],v=h[p+1],C=h[p+2];b+=(y*x.a+v*x.b+x.worldX)*C,w+=(y*x.c+v*x.d+x.worldY)*C}r[u]=b,r[u+1]=w}else{let u=a;for(let p=l,b=f*3,w=f<<1;p<i;p+=o){let g=0,x=0,y=c[d++];for(y+=d;d<y;d++,b+=3,w+=2){let v=m[c[d]],C=h[b]+u[w],A=h[b+1]+u[w+1],k=h[b+2];g+=(C*v.a+A*v.b+v.worldX)*k,x+=(C*v.c+A*v.d+v.worldY)*k}r[p]=g,r[p+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},Ys=class ht{static _nextID=0;id=ht.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new ht(this.regions.length);return E.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(e,s){let i=e,r=(this.start+s).toString();for(let l=this.digits-r.length;l>0;l--)i+="0";return i+=r,i}static nextID(){return ht._nextID++}},se;(function(t){t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse"})(se||(se={}));var Fs=[se.hold,se.once,se.loop,se.pingpong,se.onceReverse,se.loopReverse,se.pingpongReverse],Ze=class{name;timelines=[];timelineIds=new gt;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,r,l,o,n){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let h=0,c=a.length;h<c;h++)a[h].apply(t,e,s,r,l,o,n)}},P;(function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"})(P||(P={}));var re;(function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"})(re||(re={}));var U={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},J=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=E.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let r=s;r<i;r+=s)if(t[r]>e)return r-s;return i-s}},ue=class extends J{curves;constructor(t,e,s){super(t,s),this.curves=E.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=E.newFloatArray(e);E.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,r,l,o,n,a,h,c){let d=this.curves,f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);let m=(i-l*2+n)*.03,u=(r-o*2+a)*.03,p=((l-n)*3-i+h)*.006,b=((o-a)*3-r+c)*.006,w=m*2+p,g=u*2+b,x=(l-i)*.3+m+p*.16666667,y=(o-r)*.3+u+b*.16666667,v=i+x,C=r+y;for(let A=f+18;f<A;f+=2)d[f]=v,d[f+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getBezierValue(t,e,s,i){let r=this.curves;if(r[i]>t){let a=this.frames[e],h=this.frames[e+s];return h+(t-a)/(r[i]-a)*(r[i+1]-h)}let l=i+18;for(i+=2;i<l;i+=2)if(r[i]>=t){let a=r[i-2],h=r[i-1];return h+(t-a)/(r[i]-a)*(r[i+1]-h)}e+=this.getFrameEntries();let o=r[l-2],n=r[l-1];return n+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-n)}},ce=class extends ue{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=e[s],l=e[s+1];return l+(t-r)/(e[s+2]-r)*(e[s+2+1]-l);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case P.setup:return r;case P.first:return i+(r-i)*e}return i}let l=this.getCurveValue(t);switch(s){case P.setup:return r+l*e;case P.first:case P.replace:l+=r-i}return i+l*e}getAbsoluteValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case P.setup:return r;case P.first:return i+(r-i)*e}return i}let l=this.getCurveValue(t);return s==P.setup?r+(l-r)*e:i+(l-i)*e}getAbsoluteValue2(t,e,s,i,r,l){if(t<this.frames[0]){switch(s){case P.setup:return r;case P.first:return i+(r-i)*e}return i}return s==P.setup?r+(l-r)*e:i+(l-i)*e}getScaleValue(t,e,s,i,r,l){const o=this.frames;if(t<o[0]){switch(s){case P.setup:return l;case P.first:return r+(l-r)*e}return r}let n=this.getCurveValue(t)*l;if(e==1)return s==P.add?r+n-l:n;if(i==re.mixOut)switch(s){case P.setup:return l+(Math.abs(n)*B.signum(l)-l)*e;case P.first:case P.replace:return r+(Math.abs(n)*B.signum(r)-r)*e}else{let a=0;switch(s){case P.setup:return a=Math.abs(l)*B.signum(n),a+(n-a)*e;case P.first:case P.replace:return a=Math.abs(r)*B.signum(n),a+(n-a)*e}}return r+(n-l)*e}},et=class extends ue{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}},We=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,l,n.rotation,n.data.rotation))}},xt=class extends et{boneIndex=0;constructor(t,e,s){super(t,e,U.x+"|"+s,U.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case P.setup:n.x=n.data.x,n.y=n.data.y;return;case P.first:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let h=0,c=0,d=J.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];h=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*u,c+=(a[d+3+2]-c)*u;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(l){case P.setup:n.x=n.data.x+h*r,n.y=n.data.y+c*r;break;case P.first:case P.replace:n.x+=(n.data.x+h-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case P.add:n.x+=h*r,n.y+=c*r}}},bt=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,l,n.x,n.data.x))}},wt=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,l,n.y,n.data.y))}},yt=class extends et{boneIndex=0;constructor(t,e,s){super(t,e,U.scaleX+"|"+s,U.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case P.setup:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case P.first:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let h,c,d=J.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];h=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*u,c+=(a[d+3+2]-c)*u;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(h*=n.data.scaleX,c*=n.data.scaleY,r==1)l==P.add?(n.scaleX+=h-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=h,n.scaleY=c);else{let m=0,u=0;if(o==re.mixOut)switch(l){case P.setup:m=n.data.scaleX,u=n.data.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*B.signum(u)-u)*r;break;case P.first:case P.replace:m=n.scaleX,u=n.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*B.signum(u)-u)*r;break;case P.add:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(l){case P.setup:m=Math.abs(n.data.scaleX)*B.signum(h),u=Math.abs(n.data.scaleY)*B.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=u+(c-u)*r;break;case P.first:case P.replace:m=Math.abs(n.scaleX)*B.signum(h),u=Math.abs(n.scaleY)*B.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=u+(c-u)*r;break;case P.add:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},vt=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,l,o,n.scaleX,n.data.scaleX))}},Ct=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,l,o,n.scaleY,n.data.scaleY))}},At=class extends et{boneIndex=0;constructor(t,e,s){super(t,e,U.shearX+"|"+s,U.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case P.setup:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case P.first:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let h=0,c=0,d=J.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];h=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*u,c+=(a[d+3+2]-c)*u;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(l){case P.setup:n.shearX=n.data.shearX+h*r,n.shearY=n.data.shearY+c*r;break;case P.first:case P.replace:n.shearX+=(n.data.shearX+h-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case P.add:n.shearX+=h*r,n.shearY+=c*r}}},St=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,l,n.shearX,n.data.shearX))}},kt=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,l,n.shearY,n.data.shearY))}},Tt=class extends J{boneIndex=0;constructor(t,e){super(t,[U.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;if(o==re.mixOut){l==P.setup&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(l==P.setup||l==P.first)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[J.search(a,s,2)+1]}},It=class extends ue{slotIndex=0;constructor(t,e,s){super(t,e,[U.rgb+"|"+s,U.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,r,l){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let b=n.data.color;switch(l){case P.setup:h.setFromColor(b);return;case P.first:h.add((b.r-h.r)*r,(b.g-h.g)*r,(b.b-h.b)*r,(b.a-h.a)*r)}return}let c=0,d=0,f=0,m=0,u=J.search(a,s,5),p=this.curves[u/5];switch(p){case 0:let b=a[u];c=a[u+1],d=a[u+2],f=a[u+3],m=a[u+4];let w=(s-b)/(a[u+5]-b);c+=(a[u+5+1]-c)*w,d+=(a[u+5+2]-d)*w,f+=(a[u+5+3]-f)*w,m+=(a[u+5+4]-m)*w;break;case 1:c=a[u+1],d=a[u+2],f=a[u+3],m=a[u+4];break;default:c=this.getBezierValue(s,u,1,p-2),d=this.getBezierValue(s,u,2,p+18-2),f=this.getBezierValue(s,u,3,p+18*2-2),m=this.getBezierValue(s,u,4,p+18*3-2)}r==1?h.set(c,d,f,m):(l==P.setup&&h.setFromColor(n.data.color),h.add((c-h.r)*r,(d-h.g)*r,(f-h.b)*r,(m-h.a)*r))}},Mt=class extends ue{slotIndex=0;constructor(t,e,s){super(t,e,[U.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let p=n.data.color;switch(l){case P.setup:h.r=p.r,h.g=p.g,h.b=p.b;return;case P.first:h.r+=(p.r-h.r)*r,h.g+=(p.g-h.g)*r,h.b+=(p.b-h.b)*r}return}let c=0,d=0,f=0,m=J.search(a,s,4),u=this.curves[m>>2];switch(u){case 0:let p=a[m];c=a[m+1],d=a[m+2],f=a[m+3];let b=(s-p)/(a[m+4]-p);c+=(a[m+4+1]-c)*b,d+=(a[m+4+2]-d)*b,f+=(a[m+4+3]-f)*b;break;case 1:c=a[m+1],d=a[m+2],f=a[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),d=this.getBezierValue(s,m,2,u+18-2),f=this.getBezierValue(s,m,3,u+18*2-2)}if(r==1)h.r=c,h.g=d,h.b=f;else{if(l==P.setup){let p=n.data.color;h.r=p.r,h.g=p.g,h.b=p.b}h.r+=(c-h.r)*r,h.g+=(d-h.g)*r,h.b+=(f-h.b)*r}}},Yt=class extends ce{slotIndex=0;constructor(t,e,s){super(t,e,U.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(l){case P.setup:a.a=c.a;return;case P.first:a.a+=(c.a-a.a)*r}return}let h=this.getCurveValue(s);r==1?a.a=h:(l==P.setup&&(a.a=n.data.color.a),a.a+=(h-a.a)*r)}},Ft=class extends ue{slotIndex=0;constructor(t,e,s){super(t,e,[U.rgb+"|"+s,U.alpha+"|"+s,U.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,r,l,o,n,a){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l,this.frames[t+5]=o,this.frames[t+6]=n,this.frames[t+7]=a}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case P.setup:h.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case P.first:h.add((y.r-h.r)*r,(y.g-h.g)*r,(y.b-h.b)*r,(y.a-h.a)*r),c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,f=0,m=0,u=0,p=0,b=0,w=0,g=J.search(a,s,8),x=this.curves[g>>3];switch(x){case 0:let y=a[g];d=a[g+1],f=a[g+2],m=a[g+3],u=a[g+4],p=a[g+5],b=a[g+6],w=a[g+7];let v=(s-y)/(a[g+8]-y);d+=(a[g+8+1]-d)*v,f+=(a[g+8+2]-f)*v,m+=(a[g+8+3]-m)*v,u+=(a[g+8+4]-u)*v,p+=(a[g+8+5]-p)*v,b+=(a[g+8+6]-b)*v,w+=(a[g+8+7]-w)*v;break;case 1:d=a[g+1],f=a[g+2],m=a[g+3],u=a[g+4],p=a[g+5],b=a[g+6],w=a[g+7];break;default:d=this.getBezierValue(s,g,1,x-2),f=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),u=this.getBezierValue(s,g,4,x+18*3-2),p=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2),w=this.getBezierValue(s,g,7,x+18*6-2)}if(r==1)h.set(d,f,m,u),c.r=p,c.g=b,c.b=w;else{if(l==P.setup){h.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}h.add((d-h.r)*r,(f-h.g)*r,(m-h.b)*r,(u-h.a)*r),c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},Pt=class extends ue{slotIndex=0;constructor(t,e,s){super(t,e,[U.rgb+"|"+s,U.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,l,o,n){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l,this.frames[t+5]=o,this.frames[t+6]=n}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case P.setup:h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case P.first:h.r+=(y.r-h.r)*r,h.g+=(y.g-h.g)*r,h.b+=(y.b-h.b)*r,c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,f=0,m=0,u=0,p=0,b=0,w=0,g=J.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let y=a[g];d=a[g+1],f=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];let v=(s-y)/(a[g+7]-y);d+=(a[g+7+1]-d)*v,f+=(a[g+7+2]-f)*v,m+=(a[g+7+3]-m)*v,p+=(a[g+7+4]-p)*v,b+=(a[g+7+5]-b)*v,w+=(a[g+7+6]-w)*v;break;case 1:d=a[g+1],f=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];break;default:d=this.getBezierValue(s,g,1,x-2),f=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),w=this.getBezierValue(s,g,6,x+18*5-2)}if(r==1)h.r=d,h.g=f,h.b=m,c.r=p,c.g=b,c.b=w;else{if(l==P.setup){let y=n.data.color,v=n.data.darkColor;h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}h.r+=(d-h.r)*r,h.g+=(f-h.g)*r,h.b+=(m-h.b)*r,c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},Fe=class extends J{slotIndex=0;attachmentNames;constructor(t,e){super(t,[U.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(n.bone.active){if(o==re.mixOut){l==P.setup&&this.setAttachment(t,n,n.data.attachmentName);return}if(s<this.frames[0]){(l==P.setup||l==P.first)&&this.setAttachment(t,n,n.data.attachmentName);return}this.setAttachment(t,n,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},Rt=class extends ue{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[U.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,r,l,o,n,a,h,c){let d=this.curves,f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);let m=(i-l*2+n)*.03,u=a*.03-o*.06,p=((l-n)*3-i+h)*.006,b=(o-a+.33333333)*.018,w=m*2+p,g=u*2+b,x=(l-i)*.3+m+p*.16666667,y=o*.3+u+b*.16666667,v=i+x,C=y;for(let A=f+18;f<A;f+=2)d[f]=v,d[f+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let n=this.frames[e];return(t-n)/(this.frames[e+this.getFrameEntries()]-n);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 r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=t){let n=s[i-2],a=s[i-1];return a+(t-n)/(s[i]-n)*(s[i+1]-a)}let l=s[r-2],o=s[r-1];return o+(1-o)*(t-l)/(this.frames[e+this.getFrameEntries()]-l)}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof we)||a.timelineAttachment!=this.attachment)return;let h=n.deform;h.length==0&&(l=P.setup);let c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(l){case P.setup:h.length=0;return;case P.first:if(r==1){h.length=0;return}h.length=d;let g=a;if(g.bones){r=1-r;for(var m=0;m<d;m++)h[m]*=r}else{let x=g.vertices;for(var m=0;m<d;m++)h[m]+=(x[m]-h[m])*r}}return}if(h.length=d,s>=f[f.length-1]){let g=c[f.length-1];if(r==1)if(l==P.add){let x=a;if(x.bones)for(let y=0;y<d;y++)h[y]+=g[y];else{let y=x.vertices;for(let v=0;v<d;v++)h[v]+=g[v]-y[v]}}else E.arrayCopy(g,0,h,0,d);else switch(l){case P.setup:{let y=a;if(y.bones)for(let v=0;v<d;v++)h[v]=g[v]*r;else{let v=y.vertices;for(let C=0;C<d;C++){let A=v[C];h[C]=A+(g[C]-A)*r}}break}case P.first:case P.replace:for(let y=0;y<d;y++)h[y]+=(g[y]-h[y])*r;break;case P.add:let x=a;if(x.bones)for(let y=0;y<d;y++)h[y]+=g[y]*r;else{let y=x.vertices;for(let v=0;v<d;v++)h[v]+=(g[v]-y[v])*r}}return}let u=J.search1(f,s),p=this.getCurvePercent(s,u),b=c[u],w=c[u+1];if(r==1)if(l==P.add){let g=a;if(g.bones)for(let x=0;x<d;x++){let y=b[x];h[x]+=y+(w[x]-y)*p}else{let x=g.vertices;for(let y=0;y<d;y++){let v=b[y];h[y]+=v+(w[y]-v)*p-x[y]}}}else for(let g=0;g<d;g++){let x=b[g];h[g]=x+(w[g]-x)*p}else switch(l){case P.setup:{let x=a;if(x.bones)for(let y=0;y<d;y++){let v=b[y];h[y]=(v+(w[y]-v)*p)*r}else{let y=x.vertices;for(let v=0;v<d;v++){let C=b[v],A=y[v];h[v]=A+(C+(w[v]-C)*p-A)*r}}break}case P.first:case P.replace:for(let x=0;x<d;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p-h[x])*r}break;case P.add:let g=a;if(g.bones)for(let x=0;x<d;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p)*r}else{let x=g.vertices;for(let y=0;y<d;y++){let v=b[y];h[y]+=(v+(w[y]-v)*p-x[y])*r}}}}},tt=class ar extends J{static propertyIds=[""+U.event];events;constructor(e){super(e,ar.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,i,r,l,o,n){if(!r)return;let a=this.frames,h=this.frames.length;if(s>i)this.apply(e,s,Number.MAX_VALUE,r,l,o,n),s=-1;else if(s>=a[h-1])return;if(i<a[0])return;let c=0;if(s<a[0])c=0;else{c=J.search1(a,s)+1;let d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<h&&i>=a[c];c++)r.push(this.events[c])}},Le=class or extends J{static propertyIds=[""+U.drawOrder];drawOrders;constructor(e){super(e,or.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,i){this.frames[e]=s,this.drawOrders[e]=i}apply(e,s,i,r,l,o,n){if(n==re.mixOut){o==P.setup&&E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(o==P.setup||o==P.first)&&E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let a=J.search1(this.frames,i),h=this.drawOrders[a];if(!h)E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,d=e.slots;for(let f=0,m=h.length;f<m;f++)c[f]=d[h[f]]}}},Xt=class extends ue{constraintIndex=0;constructor(t,e,s){super(t,e,[U.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,r,l,o){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l?1:0,this.frames[t+5]=o?1:0}apply(t,e,s,i,r,l,o){let n=t.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case P.setup:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case P.first:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let h=0,c=0,d=J.search(a,s,6),f=this.curves[d/6];switch(f){case 0:let m=a[d];h=a[d+1],c=a[d+2];let u=(s-m)/(a[d+6]-m);h+=(a[d+6+1]-h)*u,c+=(a[d+6+2]-c)*u;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}l==P.setup?(n.mix=n.data.mix+(h-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,o==re.mixOut?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0)):(n.mix+=(h-n.mix)*r,n.softness+=(c-n.softness)*r,o==re.mixIn&&(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0))}},Bt=class extends ue{constraintIndex=0;constructor(t,e,s){super(t,e,[U.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,l,o,n){let a=this.frames;t*=7,a[t]=e,a[t+1]=s,a[t+2]=i,a[t+3]=r,a[t+4]=l,a[t+5]=o,a[t+6]=n}apply(t,e,s,i,r,l,o){let n=t.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let w=n.data;switch(l){case P.setup:n.mixRotate=w.mixRotate,n.mixX=w.mixX,n.mixY=w.mixY,n.mixScaleX=w.mixScaleX,n.mixScaleY=w.mixScaleY,n.mixShearY=w.mixShearY;return;case P.first:n.mixRotate+=(w.mixRotate-n.mixRotate)*r,n.mixX+=(w.mixX-n.mixX)*r,n.mixY+=(w.mixY-n.mixY)*r,n.mixScaleX+=(w.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(w.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(w.mixShearY-n.mixShearY)*r}return}let h,c,d,f,m,u,p=J.search(a,s,7),b=this.curves[p/7];switch(b){case 0:let w=a[p];h=a[p+1],c=a[p+2],d=a[p+3],f=a[p+4],m=a[p+5],u=a[p+6];let g=(s-w)/(a[p+7]-w);h+=(a[p+7+1]-h)*g,c+=(a[p+7+2]-c)*g,d+=(a[p+7+3]-d)*g,f+=(a[p+7+4]-f)*g,m+=(a[p+7+5]-m)*g,u+=(a[p+7+6]-u)*g;break;case 1:h=a[p+1],c=a[p+2],d=a[p+3],f=a[p+4],m=a[p+5],u=a[p+6];break;default:h=this.getBezierValue(s,p,1,b-2),c=this.getBezierValue(s,p,2,b+18-2),d=this.getBezierValue(s,p,3,b+18*2-2),f=this.getBezierValue(s,p,4,b+18*3-2),m=this.getBezierValue(s,p,5,b+18*4-2),u=this.getBezierValue(s,p,6,b+18*5-2)}if(l==P.setup){let w=n.data;n.mixRotate=w.mixRotate+(h-w.mixRotate)*r,n.mixX=w.mixX+(c-w.mixX)*r,n.mixY=w.mixY+(d-w.mixY)*r,n.mixScaleX=w.mixScaleX+(f-w.mixScaleX)*r,n.mixScaleY=w.mixScaleY+(m-w.mixScaleY)*r,n.mixShearY=w.mixShearY+(u-w.mixShearY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r,n.mixScaleX+=(f-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(u-n.mixShearY)*r}},Et=class extends ce{constraintIndex=0;constructor(t,e,s){super(t,e,U.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,l,n.position,n.data.position))}},Lt=class extends ce{constraintIndex=0;constructor(t,e,s){super(t,e,U.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,l,n.spacing,n.data.spacing))}},Vt=class extends ue{constraintIndex=0;constructor(t,e,s){super(t,e,[U.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){let l=this.frames;t<<=2,l[t]=e,l[t+1]=s,l[t+2]=i,l[t+3]=r}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case P.setup:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case P.first:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let h,c,d,f=J.search(a,s,4),m=this.curves[f>>2];switch(m){case 0:let u=a[f];h=a[f+1],c=a[f+2],d=a[f+3];let p=(s-u)/(a[f+4]-u);h+=(a[f+4+1]-h)*p,c+=(a[f+4+2]-c)*p,d+=(a[f+4+3]-d)*p;break;case 1:h=a[f+1],c=a[f+2],d=a[f+3];break;default:h=this.getBezierValue(s,f,1,m-2),c=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(l==P.setup){let u=n.data;n.mixRotate=u.mixRotate+(h-u.mixRotate)*r,n.mixX=u.mixX+(c-u.mixX)*r,n.mixY=u.mixY+(d-u.mixY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r}},Te=class extends ce{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const h of t.physicsConstraints)h.active&&this.global(h.data)&&this.set(h,this.getAbsoluteValue2(s,r,l,this.get(h),this.setup(h),a))}else n=t.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,l,this.get(n),this.setup(n)))}},Dt=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},Nt=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},Ot=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},_t=class extends Te{constructor(t,e,s){super(t,e,s,U.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}},Ut=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},qt=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},Wt=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},zt=class lr extends J{static propertyIds=[U.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,lr.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,i,r,l,o,n){let a;if(this.constraintIndex!=-1&&(a=e.physicsConstraints[this.constraintIndex],!a.active))return;const h=this.frames;if(s>i)this.apply(e,s,Number.MAX_VALUE,[],l,o,n),s=-1;else if(s>=h[h.length-1])return;if(!(i<h[0])&&(s<h[0]||i>=h[J.search1(h,s)+1]))if(a!=null)a.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},Gt=class Me extends J{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,i){super(e,[U.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return Me.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,i,r,l){let o=this.frames;e*=Me.ENTRIES,o[e]=s,o[e+Me.MODE]=i|r<<4,o[e+Me.DELAY]=l}apply(e,s,i,r,l,o,n){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let h=a.attachment,c=this.attachment;if(h!=c&&(!(h instanceof we)||h.timelineAttachment!=c))return;if(n==re.mixOut){o==P.setup&&(a.sequenceIndex=-1);return}let d=this.frames;if(i<d[0]){(o==P.setup||o==P.first)&&(a.sequenceIndex=-1);return}let f=J.search(d,i,Me.ENTRIES),m=d[f],u=d[f+Me.MODE],p=d[f+Me.DELAY];if(!this.attachment.sequence)return;let b=u>>4,w=this.attachment.sequence.regions.length,g=Fs[u&15];if(g!=se.hold)switch(b+=(i-m)/p+1e-5|0,g){case se.once:b=Math.min(w-1,b);break;case se.loop:b%=w;break;case se.pingpong:{let x=(w<<1)-2;b=x==0?0:b%x,b>=w&&(b=x-b);break}case se.onceReverse:b=Math.max(w-1-b,0);break;case se.loopReverse:b=w-1-b%w;break;case se.pingpongReverse:{let x=(w<<1)-2;b=x==0?0:(b+w-1)%x,b>=w&&(b=x-b)}}a.sequenceIndex=b}},Ht=class ct{static _emptyAnimation=new Ze("<empty>",[],0);static emptyAnimation(){return ct._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Rs(this);propertyIDs=new gt;animationsChanged=!1;trackEntryPool=new Ee(()=>new Ps);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(!l)continue;l.animationLast=l.nextAnimationLast,l.trackLast=l.nextTrackLast;let o=e*l.timeScale;if(l.delay>0){if(l.delay-=o,l.delay>0)continue;o=-l.delay,l.delay=0}let n=l.next;if(n){let a=l.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=l.timeScale==0?0:(a/l.timeScale+e)*n.timeScale,l.trackTime+=o,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=e,n=n.mixingFrom;continue}}else if(l.trackLast>=l.trackEnd&&!l.mixingFrom){s[i]=null,this.queue.end(l),this.clearNext(l);continue}if(l.mixingFrom&&this.updateMixingFrom(l,e)){let a=l.mixingFrom;for(l.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}l.trackTime+=o}this.queue.drain()}updateMixingFrom(e,s){let i=e.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let f=0,m=i.length;f<m;f++){let u=i[f];if(!u||u.delay>0)continue;r=!0;let p=f==0?P.first:u.mixBlend,b=u.alpha;u.mixingFrom?b*=this.applyMixingFrom(u,e,p):u.trackTime>=u.trackEnd&&!u.next&&(b=0);let w=b>=u.alphaAttachmentThreshold,g=u.animationLast,x=u.getAnimationTime(),y=x,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let C=u.animation.timelines,A=C.length;if(f==0&&b==1||p==P.add){f==0&&(w=!0);for(let k=0;k<A;k++){E.webkit602BugfixHelper(b,p);var l=C[k];l instanceof Fe?this.applyAttachmentTimeline(l,e,y,p,w):l.apply(e,g,y,v,b,p,re.mixIn)}}else{let k=u.timelineMode,T=u.shortestRotation,Y=!T&&u.timelinesRotation.length!=A<<1;Y&&(u.timelinesRotation.length=A<<1);for(let M=0;M<A;M++){let R=C[M],X=k[M]==st?p:P.setup;!T&&R instanceof We?this.applyRotateTimeline(R,e,y,b,X,u.timelinesRotation,M<<1,Y):R instanceof Fe?this.applyAttachmentTimeline(R,e,y,p,w):(E.webkit602BugfixHelper(b,p),R.apply(e,g,y,v,b,X,re.mixIn))}}this.queueEvents(u,x),s.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+Jt,n=e.slots,a=0,h=e.slots.length;a<h;a++){var c=n[a];if(c.attachmentState==o){var d=c.data.attachmentName;c.setAttachment(d?e.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,s,i){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let l=0;e.mixDuration==0?(l=1,i==P.first&&(i=P.setup)):(l=e.mixTime/e.mixDuration,l>1&&(l=1),i!=P.first&&(i=r.mixBlend));let o=l<r.mixAttachmentThreshold,n=l<r.mixDrawOrderThreshold,a=r.animation.timelines,h=a.length,c=r.alpha*e.interruptAlpha,d=c*(1-l),f=r.animationLast,m=r.getAnimationTime(),u=m,p=null;if(r.reverse?u=r.animation.duration-u:l<r.eventThreshold&&(p=this.events),i==P.add)for(let b=0;b<h;b++)a[b].apply(s,f,u,p,d,i,re.mixOut);else{let b=r.timelineMode,w=r.timelineHoldMix,g=r.shortestRotation,x=!g&&r.timelinesRotation.length!=h<<1;x&&(r.timelinesRotation.length=h<<1),r.totalAlpha=0;for(let y=0;y<h;y++){let v=a[y],C=re.mixOut,A,k=0;switch(b[y]){case st:if(!n&&v instanceof Le)continue;A=i,k=d;break;case $t:A=P.setup,k=d;break;case jt:A=i,k=c;break;case rt:A=P.setup,k=c;break;default:A=P.setup;let T=w[y];k=c*Math.max(0,1-T.mixTime/T.mixDuration);break}r.totalAlpha+=k,!g&&v instanceof We?this.applyRotateTimeline(v,s,u,k,A,r.timelinesRotation,y<<1,x):v instanceof Fe?this.applyAttachmentTimeline(v,s,u,A,o&&k>=r.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,i),n&&v instanceof Le&&A==P.setup&&(C=re.mixIn),v.apply(s,f,u,p,k,A,C))}}return e.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,l}applyAttachmentTimeline(e,s,i,r,l){var o=s.slots[e.slotIndex];o.bone.active&&(i<e.frames[0]?(r==P.setup||r==P.first)&&this.setAttachment(s,o,o.data.attachmentName,l):this.setAttachment(s,o,e.attachmentNames[J.search1(e.frames,i)],l),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Jt))}setAttachment(e,s,i,r){s.setAttachment(i?e.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+Bs)}applyRotateTimeline(e,s,i,r,l,o,n,a){if(a&&(o[n]=0),r==1){e.apply(s,0,i,null,1,l,re.mixIn);return}let h=s.bones[e.boneIndex];if(!h.active)return;let c=e.frames,d=0,f=0;if(i<c[0])switch(l){case P.setup:h.rotation=h.data.rotation;default:return;case P.first:d=h.rotation,f=h.data.rotation}else d=l==P.setup?h.data.rotation:h.rotation,f=h.data.rotation+e.getCurveValue(i);let m=0,u=f-d;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[n];else{let p=0,b=0;a?(p=0,b=u):(p=o[n],b=o[n+1]);let w=p-p%360;m=u+w;let g=u>=0,x=p>=0;Math.abs(b)<=90&&B.signum(b)!=B.signum(u)&&(Math.abs(p-w)>180?(m+=360*B.signum(p),x=g):w!=0?m-=360*B.signum(p):x=g),x!=g&&(m+=360*B.signum(p)),o[n]=m}o[n+1]=u,h.rotation=d+m*r}queueEvents(e,s){let i=e.animationStart,r=e.animationEnd,l=r-i,o=e.trackLast%l,n=this.events,a=0,h=n.length;for(;a<h;a++){let d=n[a];if(d.time<o)break;d.time>r||this.queue.event(e,d)}let c=!1;if(e.loop)if(l==0)c=!0;else{const d=Math.floor(e.trackTime/l);c=d>0&&d>Math.floor(e.trackLast/l)}else c=s>=r&&e.animationLast<r;for(c&&this.queue.complete(e);a<h;a++){let d=n[a];d.time<i||this.queue.event(e,d)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,i){let r=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,r,i)}setAnimationWith(e,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,l=this.expandToIndex(e);l&&(l.nextTrackLast==-1?(this.tracks[e]=l.mixingFrom,this.queue.interrupt(l),this.queue.end(l),this.clearNext(l),l=l.mixingFrom,r=!1):this.clearNext(l));let o=this.trackEntry(e,s,i,l);return this.setCurrent(e,o,r),this.queue.drain(),o}addAnimation(e,s,i=!1,r=0){let l=this.data.skeletonData.findAnimation(s);if(!l)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,l,i,r)}addAnimationWith(e,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let l=this.expandToIndex(e);if(l)for(;l.next;)l=l.next;let o=this.trackEntry(e,s,i,l);return l?(l.next=o,o.previous=l,r<=0&&(r=Math.max(r+l.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),r<0&&(r=0)),o.delay=r,o}setEmptyAnimation(e,s=0){let i=this.setAnimationWith(e,ct.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(e,s=0,i=0){let r=this.addAnimationWith(e,ct.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let l=this.tracks[i];l&&this.setEmptyAnimation(l.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(E.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,i,r){let l=this.trackEntryPool.obtain();return l.reset(),l.trackIndex=e,l.animation=s,l.loop=i,l.holdPrevious=!1,l.reverse=!1,l.shortestRotation=!1,l.eventThreshold=0,l.alphaAttachmentThreshold=0,l.mixAttachmentThreshold=0,l.mixDrawOrderThreshold=0,l.animationStart=0,l.animationEnd=s.duration,l.animationLast=-1,l.nextAnimationLast=-1,l.delay=0,l.trackTime=0,l.trackLast=-1,l.nextTrackLast=-1,l.trackEnd=Number.MAX_VALUE,l.timeScale=1,l.alpha=1,l.mixTime=0,l.mixDuration=r?this.data.getMix(r.animation,s):0,l.interruptAlpha=1,l.totalAlpha=0,l.mixBlend=P.replace,l}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=P.add)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let s=e.mixingTo,i=e.animation.timelines,r=e.animation.timelines.length,l=e.timelineMode;l.length=r;let o=e.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<r;a++)l[a]=n.addAll(i[a].getPropertyIds())?rt:jt;return}e:for(let a=0;a<r;a++){let h=i[a],c=h.getPropertyIds();if(!n.addAll(c))l[a]=st;else if(!s||h instanceof Fe||h instanceof Le||h instanceof tt||!s.animation.hasTimeline(c))l[a]=$t;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){l[a]=Xs,o[a]=d;continue e}break}l[a]=rt}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ps=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=P.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 t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Rs=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(le.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(le.interrupt),this.objects.push(t)}end(t){this.objects.push(le.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(le.dispose),this.objects.push(t)}complete(t){this.objects.push(le.complete),this.objects.push(t)}event(t,e){this.objects.push(le.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],r=t[s+1];switch(i){case le.start:r.listener&&r.listener.start&&r.listener.start(r);for(let o=0;o<e.length;o++){let n=e[o];n.start&&n.start(r)}break;case le.interrupt:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<e.length;o++){let n=e[o];n.interrupt&&n.interrupt(r)}break;case le.end:r.listener&&r.listener.end&&r.listener.end(r);for(let o=0;o<e.length;o++){let n=e[o];n.end&&n.end(r)}case le.dispose:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<e.length;o++){let n=e[o];n.dispose&&n.dispose(r)}this.animState.trackEntryPool.free(r);break;case le.complete:r.listener&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<e.length;o++){let n=e[o];n.complete&&n.complete(r)}break;case le.event:let l=t[s+++2];r.listener&&r.listener.event&&r.listener.event(r,l);for(let o=0;o<e.length;o++){let n=e[o];n.event&&n.event(r,l)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},le;(function(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"})(le||(le={}));var yr=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},st=0,$t=1,jt=2,rt=3,Xs=4,Jt=1,Bs=2,Es=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);this.setMixWith(i,r,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},Kt=class hr extends we{color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new hr(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Pe=class cr extends we{endSlot=null;color=new N(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new cr(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Qt=class{_image;constructor(t){this._image=t}getImage(){return this._image}},te;(function(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"})(te||(te={}));var ye;(function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"})(ye||(ye={}));var Ls=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},vr=class extends Qt{setFilters(t,e){}setWraps(t,e){}dispose(){}},it=class{pages=new Array;regions=new Array;constructor(t){let e=new Cr(t),s=new Array(4),i={};i.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},i.format=()=>{},i.filter=h=>{h.minFilter=E.enumValue(te,s[1]),h.magFilter=E.enumValue(te,s[2])},i.repeat=h=>{s[1].indexOf("x")!=-1&&(h.uWrap=ye.Repeat),s[1].indexOf("y")!=-1&&(h.vWrap=ye.Repeat)},i.pma=h=>{h.pma=s[1]=="true"};var r={};r.xy=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2])},r.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},r.bounds=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2]),h.width=parseInt(s[3]),h.height=parseInt(s[4])},r.offset=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2])},r.orig=h=>{h.originalWidth=parseInt(s[1]),h.originalHeight=parseInt(s[2])},r.offsets=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2]),h.originalWidth=parseInt(s[3]),h.originalHeight=parseInt(s[4])},r.rotate=h=>{let c=s[1];c=="true"?h.degrees=90:c!="false"&&(h.degrees=parseInt(c))},r.index=h=>{h.index=parseInt(s[1])};let l=e.readLine();for(;l&&l.trim().length==0;)l=e.readLine();for(;!(!l||l.trim().length==0||e.readEntry(s,l)==0);)l=e.readLine();let o=null,n=null,a=null;for(;l!==null;)if(l.trim().length==0)o=null,l=e.readLine();else if(o){let h=new Zt(o,l);for(;;){let c=e.readEntry(s,l=e.readLine());if(c==0)break;let d=r[s[0]];if(d)d(h);else{n||(n=[]),a||(a=[]),n.push(s[0]);let f=[];for(let m=0;m<c;m++)f.push(parseInt(s[m+1]));a.push(f)}}h.originalWidth==0&&h.originalHeight==0&&(h.originalWidth=h.width,h.originalHeight=h.height),n&&n.length>0&&a&&a.length>0&&(h.names=n,h.values=a,n=null,a=null),h.u=h.x/o.width,h.v=h.y/o.height,h.degrees==90?(h.u2=(h.x+h.height)/o.width,h.v2=(h.y+h.width)/o.height):(h.u2=(h.x+h.width)/o.width,h.v2=(h.y+h.height)/o.height),this.regions.push(h)}else{for(o=new Vs(l.trim());e.readEntry(s,l=e.readLine())!=0;){let h=i[s[0]];h&&h(o)}this.pages.push(o)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},Cr=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,r=s+1;;i++){let l=e.indexOf(",",r);if(l==-1)return t[i]=e.substr(r).trim(),i;if(t[i]=e.substr(r,l-r).trim(),r=l+1,i==4)return 4}}},Vs=class{name;minFilter=te.Nearest;magFilter=te.Nearest;uWrap=ye.ClampToEdge;vWrap=ye.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}},Zt=class extends Ls{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)}},me=class ws extends we{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new N(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new N(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=E.newFloatArray(e.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,l=this.region.v,o=0,n=0;if(this.region instanceof Zt){let a=this.region,h=a.page,c=h.width,d=h.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,l-=(a.originalWidth-a.offsetX-a.width)/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let f=0;f<i;f+=2)s[f]=r+e[f+1]*o,s[f+1]=l+(1-e[f])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,l-=a.offsetY/d,o=a.originalWidth/c,n=a.originalHeight/d;for(let f=0;f<i;f+=2)s[f]=r+(1-e[f])*o,s[f+1]=l+(1-e[f+1])*n;return;case 270:r-=a.offsetY/c,l-=a.offsetX/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let f=0;f<i;f+=2)s[f]=r+(1-e[f+1])*o,s[f+1]=l+e[f]*n;return}r-=a.offsetX/c,l-=(a.originalHeight-a.offsetY-a.height)/d,o=a.originalWidth/c,n=a.originalHeight/d}else this.region?(o=this.region.u2-r,n=this.region.v2-l):(r=l=0,o=n=1);for(let a=0;a<i;a+=2)s[a]=r+e[a]*o,s[a+1]=l+e[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ws(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,i,r,l,o){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,i,r,l,o)}newLinkedMesh(){let e=new ws(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ve=class dr extends we{lengths=[];closed=!1;constantSpeed=!1;color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new dr(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Ds=class fr extends we{x=0;y=0;rotation=0;color=new N(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*B.degRad,i=Math.cos(s),r=Math.sin(s),l=i*e.a+r*e.b,o=i*e.c+r*e.d;return B.atan2Deg(o,l)}copy(){let e=new fr(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},W=class ur extends pt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new N(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new N(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,l=-this.width/2*this.scaleX+this.region.offsetX*i,o=-this.height/2*this.scaleY+this.region.offsetY*r,n=l+this.region.width*i,a=o+this.region.height*r,h=this.rotation*B.degRad,c=Math.cos(h),d=Math.sin(h),f=this.x,m=this.y,u=l*c+f,p=l*d,b=o*c+m,w=o*d,g=n*c+f,x=n*d,y=a*c+m,v=a*d,C=this.offset;C[0]=u-w,C[1]=b+p,C[2]=u-v,C[3]=y+p,C[4]=g-v,C[5]=y+x,C[6]=g-w,C[7]=b+x,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,i,r){this.sequence!=null&&this.sequence.apply(e,this);let l=e.bone,o=this.offset,n=l.worldX,a=l.worldY,h=l.a,c=l.b,d=l.c,f=l.d,m=0,u=0;m=o[0],u=o[1],s[i]=m*h+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=o[2],u=o[3],s[i]=m*h+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=o[4],u=o[5],s[i]=m*h+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=o[6],u=o[7],s[i]=m*h+u*c+n,s[i+1]=m*d+u*f+a}copy(){let e=new ur(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,E.arrayCopy(this.uvs,0,e.uvs,0,8),E.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Ns=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let r=0,l=i.length;r<l;r++){let o=s.getPath(e,r),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+t+")");i[r]=n}}newRegionAttachment(t,e,s,i){let r=new W(e,s);if(i!=null)this.loadSequence(e,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");r.region=l}return r}newMeshAttachment(t,e,s,i){let r=new me(e,s);if(i!=null)this.loadSequence(e,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");r.region=l}return r}newBoundingBoxAttachment(t,e){return new Kt(e)}newPathAttachment(t,e){return new Ve(e)}newPointAttachment(t,e){return new Ds(e)}newClippingAttachment(t,e){return new Pe(e)}},es=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Q.Normal;skinRequired=!1;color=new N;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}},Q;(function(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"})(Q||(Q={}));var ts=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=Q.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,i,r,l,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=l,this.ashearY=o;let n=this.parent;if(!n){let f=this.skeleton;const m=f.scaleX,u=f.scaleY,p=(s+l)*B.degRad,b=(s+90+o)*B.degRad;this.a=Math.cos(p)*i*m,this.b=Math.cos(b)*r*m,this.c=Math.sin(p)*i*u,this.d=Math.sin(b)*r*u,this.worldX=t*m+f.x,this.worldY=e*u+f.y;return}let a=n.a,h=n.b,c=n.c,d=n.d;switch(this.worldX=a*t+h*e+n.worldX,this.worldY=c*t+d*e+n.worldY,this.inherit){case Q.Normal:{const f=(s+l)*B.degRad,m=(s+90+o)*B.degRad,u=Math.cos(f)*i,p=Math.cos(m)*r,b=Math.sin(f)*i,w=Math.sin(m)*r;this.a=a*u+h*b,this.b=a*p+h*w,this.c=c*u+d*b,this.d=c*p+d*w;return}case Q.OnlyTranslation:{const f=(s+l)*B.degRad,m=(s+90+o)*B.degRad;this.a=Math.cos(f)*i,this.b=Math.cos(m)*r,this.c=Math.sin(f)*i,this.d=Math.sin(m)*r;break}case Q.NoRotationOrReflection:{let f=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=f,c*=m;let u=a*a+c*c,p=0;u>1e-4?(u=Math.abs(a*d*m-h*f*c)/u,h=c*u,d=a*u,p=Math.atan2(c,a)*B.radDeg):(a=0,c=0,p=90-Math.atan2(d,h)*B.radDeg);const b=(s+l-p)*B.degRad,w=(s+o-p+90)*B.degRad,g=Math.cos(b)*i,x=Math.cos(w)*r,y=Math.sin(b)*i,v=Math.sin(w)*r;this.a=a*g-h*y,this.b=a*x-h*v,this.c=c*g+d*y,this.d=c*x+d*v;break}case Q.NoScale:case Q.NoScaleOrReflection:{s*=B.degRad;const f=Math.cos(s),m=Math.sin(s);let u=(a*f+h*m)/this.skeleton.scaleX,p=(c*f+d*m)/this.skeleton.scaleY,b=Math.sqrt(u*u+p*p);b>1e-5&&(b=1/b),u*=b,p*=b,b=Math.sqrt(u*u+p*p),this.inherit==Q.NoScale&&a*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(p,u);const w=Math.cos(s)*b,g=Math.sin(s)*b;l*=B.degRad,o=(90+o)*B.degRad;const x=Math.cos(l)*i,y=Math.cos(o)*r,v=Math.sin(l)*i,C=Math.sin(o)*r;this.a=u*x+w*v,this.b=u*y+w*C,this.c=p*x+g*v,this.d=p*y+g*C;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*B.radDeg;return}let e=t.a,s=t.b,i=t.c,r=t.d,l=1/(e*r-s*i),o=r*l,n=s*l,a=i*l,h=e*l,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*o-d*n,this.ay=d*h-c*a;let f,m,u,p;if(this.inherit==Q.OnlyTranslation)f=this.a,m=this.b,u=this.c,p=this.d;else{switch(this.inherit){case Q.NoRotationOrReflection:{let y=Math.abs(e*r-s*i)/(e*e+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,r=e*this.skeleton.scaleY*y/this.skeleton.scaleX,l=1/(e*r-s*i),o=r*l,n=s*l;break}case Q.NoScale:case Q.NoScaleOrReflection:let b=B.cosDeg(this.rotation),w=B.sinDeg(this.rotation);e=(e*b+s*w)/this.skeleton.scaleX,i=(i*b+r*w)/this.skeleton.scaleY;let g=Math.sqrt(e*e+i*i);g>1e-5&&(g=1/g),e*=g,i*=g,g=Math.sqrt(e*e+i*i),this.inherit==Q.NoScale&&l<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=B.PI/2+Math.atan2(i,e);s=Math.cos(x)*g,r=Math.sin(x)*g,l=1/(e*r-s*i),o=r*l,n=s*l,a=i*l,h=e*l}f=o*this.a-n*this.c,m=o*this.b-n*this.d,u=h*this.c-a*this.a,p=h*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+u*u),this.ascaleX>1e-4){let b=f*p-m*u;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(f*m+u*p,b)*B.radDeg,this.arotation=Math.atan2(u,f)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,m)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*B.radDeg}rotateWorld(t){t*=B.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,r=this.b;this.a=s*i-e*this.c,this.b=s*r-e*this.d,this.c=e*i+s*this.c,this.d=e*r+s*this.d}},ze=class{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Ar=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new _s,i=new Os){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadBinary(t,l=>{this.success(e,t,l),i(l)},(l,o)=>{const n=`Couldn't load binary ${t}: status ${l}, ${o}`;this.error(s,t,n),r(n)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,i=>{this.success(e,t,i)},(i,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${i}, ${r}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadJson(t,l=>{this.success(e,t,l),i(l)},(l,o)=>{const n=`Couldn't load JSON ${t}: status ${l}, ${o}`;this.error(s,t,n),r(n)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],r=i!==void 0;return r&&(this.cache.assetsLoaded[t]=i.then(l=>(l=l instanceof Image||l instanceof ImageBitmap?this.textureLoader(l):l,this.success(e,t,l),l)).catch(l=>this.error(s,t,l))),r}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(t,n);this.success(e,t,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(t,n);this.success(e,t,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),n.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let r=t.lastIndexOf("/"),l=r>=0?t.substring(0,r+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((o,n)=>{this.downloader.downloadText(t,a=>{try{const h=this.createTextureAtlas(t,a);let c=h.pages.length,d=!1;for(let f of h.pages)this.loadTexture(i?i[f.name]:l+f.name,(m,u)=>{d||(f.setTexture(u),--c==0&&(this.success(e,t,h),o(h)))},(m,u)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,p),n(p)}d=!0})}catch(h){const c=`Couldn't parse texture atlas ${t}: ${h.message}`;this.error(s,t,c),n(c)}},(a,h)=>{const c=`Couldn't load texture atlas ${t}: status ${a}, ${h}`;this.error(s,t,c),n(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,l)=>{this.downloader.downloadText(t,o=>{try{const n=this.createTextureAtlas(t,o);this.success(e,t,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${t}: ${n.message}`;this.error(s,t,a),l(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${t}: status ${o}, ${n}`;this.error(s,t,a),l(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(i,r)=>e(r),(i,r)=>s(r))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
|
|
2
|
-
`+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof it){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new it(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&i()},s}},Os=class dt{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=dt.AVAILABLE_CACHES.get(e);if(s)return s;const i=new dt;return dt.AVAILABLE_CACHES.set(e,i),i}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},_s=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=e.charCodeAt(r);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToString(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||t,!0);let l=()=>{this.finish(t,r.status,r.responseText)};r.onload=l,r.onerror=l,r.send()}downloadJson(t,e,s){this.downloadText(t,i=>{e(JSON.parse(i))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||t,!0),r.responseType="arraybuffer";let l=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(t,200,new Uint8Array(r.response)):l()},r.onerror=l,r.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let r=e==200||e==0?[s]:[e,s];for(let l=r.length-1,o=i.length;l<o;l+=2)i[l].apply(null,r)}},ss=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}},rs=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},Us=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,i,r,l,o){let n=t.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,h=n.b,c=n.c,d=n.d,f=-t.ashearX-t.arotation,m=0,u=0;switch(t.inherit){case Q.OnlyTranslation:m=(e-t.worldX)*B.signum(t.skeleton.scaleX),u=(s-t.worldY)*B.signum(t.skeleton.scaleY);break;case Q.NoRotationOrReflection:let w=Math.abs(a*d-h*c)/Math.max(1e-4,a*a+c*c),g=a/t.skeleton.scaleX,x=c/t.skeleton.scaleY;h=-x*w*t.skeleton.scaleX,d=g*w*t.skeleton.scaleY,f+=Math.atan2(x,g)*B.radDeg;default:let y=e-n.worldX,v=s-n.worldY,C=a*d-h*c;Math.abs(C)<=1e-4?(m=0,u=0):(m=(y*d-v*h)/C-t.ax,u=(v*a-y*c)/C-t.ay)}f+=Math.atan2(u,m)*B.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let p=t.ascaleX,b=t.ascaleY;if(i||r){switch(t.inherit){case Q.NoScale:case Q.NoScaleOrReflection:m=e-t.worldX,u=s-t.worldY}const w=t.data.length*p;if(w>1e-4){const g=m*m+u*u;if(i&&g<w*w||r&&g>w*w){const x=(Math.sqrt(g)/w-1)*o+1;p*=x,l&&(b*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,p,b,t.ashearX,t.ashearY)}apply2(t,e,s,i,r,l,o,n,a){if(t.inherit!=Q.Normal||e.inherit!=Q.Normal)return;let h=t.ax,c=t.ay,d=t.ascaleX,f=t.ascaleY,m=d,u=f,p=e.ascaleX,b=0,w=0,g=0;d<0?(d=-d,b=180,g=-1):(b=0,g=1),f<0&&(f=-f,g=-g),p<0?(p=-p,w=180):w=0;let x=e.ax,y=0,v=0,C=0,A=t.a,k=t.b,T=t.c,Y=t.d,M=Math.abs(d-f)<=1e-4;!M||l?(y=0,v=A*x+t.worldX,C=T*x+t.worldY):(y=e.ay,v=A*x+k*y+t.worldX,C=T*x+Y*y+t.worldY);let R=t.parent;if(!R)throw new Error("IK parent must itself have a parent.");A=R.a,k=R.b,T=R.c,Y=R.d;let X=A*Y-k*T,I=v-R.worldX,F=C-R.worldY;X=Math.abs(X)<=1e-4?0:1/X;let L=(I*Y-F*k)*X-h,O=(F*A-I*T)*X-c,D=Math.sqrt(L*L+O*O),_=e.data.length*p,j,G;if(D<1e-4){this.apply1(t,s,i,!1,l,!1,a),e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}I=s-R.worldX,F=i-R.worldY;let K=(I*Y-F*k)*X-h,V=(F*A-I*T)*X-c,q=K*K+V*V;if(n!=0){n*=d*(p+1)*.5;let Z=Math.sqrt(q),ie=Z-D-_*d+n;if(ie>0){let ne=Math.min(1,ie/(n*2))-1;ne=(ie-n*(1-ne*ne))/Z,K-=ne*K,V-=ne*V,q=K*K+V*V}}e:if(M){_*=d;let Z=(q-D*D-_*_)/(2*D*_);Z<-1?(Z=-1,G=Math.PI*r):Z>1?(Z=1,G=0,l&&(A=(Math.sqrt(q)/(D+_)-1)*a+1,m*=A,o&&(u*=A))):G=Math.acos(Z)*r,A=D+_*Z,k=_*Math.sin(G),j=Math.atan2(V*A-K*k,K*A+V*k)}else{A=d*_,k=f*_;let Z=A*A,ie=k*k,ne=Math.atan2(V,K);T=ie*D*D+Z*q-Z*ie;let fe=-2*ie*D,Xe=ie-Z;if(Y=fe*fe-4*Xe*T,Y>=0){let Be=Math.sqrt(Y);fe<0&&(Be=-Be),Be=-(fe+Be)*.5;let Ue=Be/Xe,Ts=T/Be,Qe=Math.abs(Ue)<Math.abs(Ts)?Ue:Ts;if(Ue=q-Qe*Qe,Ue>=0){F=Math.sqrt(Ue)*r,j=ne-Math.atan2(F,Qe),G=Math.atan2(F/f,(Qe-D)/d);break e}}let _e=B.PI,Je=D-A,ut=Je*Je,As=0,Ss=0,Ke=D+A,mt=Ke*Ke,ks=0;T=-A*D/(Z-ie),T>=-1&&T<=1&&(T=Math.acos(T),I=A*Math.cos(T)+D,F=k*Math.sin(T),Y=I*I+F*F,Y<ut&&(_e=T,ut=Y,Je=I,As=F),Y>mt&&(Ss=T,mt=Y,Ke=I,ks=F)),q<=(ut+mt)*.5?(j=ne-Math.atan2(As*r,Je),G=_e*r):(j=ne-Math.atan2(ks*r,Ke),G=Ss*r)}let $=Math.atan2(y,x)*g,oe=t.arotation;j=(j-$)*B.radDeg+b-oe,j>180?j-=360:j<-180&&(j+=360),t.updateWorldTransformWith(h,c,oe+j*a,m,u,0,0),oe=e.arotation,G=((G+$)*B.radDeg-e.ashearX)*g+w-oe,G>180?G-=360:G<-180&&(G+=360),e.updateWorldTransformWith(x,y,oe+G*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},is=class extends ze{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)}},ns=class extends ze{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=ge.Fixed;spacingMode=ee.Fixed;rotateMode=Ie.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},ge;(function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"})(ge||(ge={}));var ee;(function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"})(ee||(ee={}));var Ie;(function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"})(Ie||(Ie={}));var qs=class Ye{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0,l=e.bones.length;r<l;r++){let o=s.findBone(e.bones[r].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(o)}let i=s.findSlot(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=i,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof Ve))return;let i=this.mixRotate,r=this.mixX,l=this.mixY;if(i==0&&r==0&&l==0)return;let o=this.data,n=o.rotateMode==Ie.Tangent,a=o.rotateMode==Ie.ChainScale,h=this.bones,c=h.length,d=n?c:c+1,f=E.setArraySize(this.spaces,d),m=a?this.lengths=E.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case ee.Percent:if(a)for(let C=0,A=d-1;C<A;C++){let k=h[C],T=k.data.length,Y=T*k.a,M=T*k.c;m[C]=Math.sqrt(Y*Y+M*M)}E.arrayFill(f,1,d,u);break;case ee.Proportional:let y=0;for(let C=0,A=d-1;C<A;){let k=h[C],T=k.data.length;if(T<Ye.epsilon)a&&(m[C]=0),f[++C]=u;else{let Y=T*k.a,M=T*k.c,R=Math.sqrt(Y*Y+M*M);a&&(m[C]=R),f[++C]=R,y+=R}}if(y>0){y=d/y*u;for(let C=1;C<d;C++)f[C]*=y}break;default:let v=o.spacingMode==ee.Length;for(let C=0,A=d-1;C<A;){let k=h[C],T=k.data.length;if(T<Ye.epsilon)a&&(m[C]=0),f[++C]=u;else{let Y=T*k.a,M=T*k.c,R=Math.sqrt(Y*Y+M*M);a&&(m[C]=R),f[++C]=(v?T+u:u)*R/T}}}let p=this.computeWorldPositions(s,d,n),b=p[0],w=p[1],g=o.offsetRotation,x=!1;if(g==0)x=o.rotateMode==Ie.Chain;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?B.degRad:-B.degRad}for(let y=0,v=3;y<c;y++,v+=3){let C=h[y];C.worldX+=(b-C.worldX)*r,C.worldY+=(w-C.worldY)*l;let A=p[v],k=p[v+1],T=A-b,Y=k-w;if(a){let M=m[y];if(M!=0){let R=(Math.sqrt(T*T+Y*Y)/M-1)*i+1;C.a*=R,C.c*=R}}if(b=A,w=k,i>0){let M=C.a,R=C.b,X=C.c,I=C.d,F=0,L=0,O=0;if(n?F=p[v-1]:f[y+1]==0?F=p[v+2]:F=Math.atan2(Y,T),F-=Math.atan2(X,M),x){L=Math.cos(F),O=Math.sin(F);let D=C.data.length;b+=(D*(L*M-O*X)-T)*i,w+=(D*(O*M+L*X)-Y)*i}else F+=g;F>B.PI?F-=B.PI2:F<-B.PI&&(F+=B.PI2),F*=i,L=Math.cos(F),O=Math.sin(F),C.a=L*M-O*X,C.b=L*R-O*I,C.c=O*M+L*X,C.d=O*R+L*I}C.updateAppliedTransform()}}computeWorldPositions(e,s,i){let r=this.target,l=this.position,o=this.spaces,n=E.setArraySize(this.positions,s*3+2),a=this.world,h=e.closed,c=e.worldVerticesLength,d=c/6,f=Ye.NONE;if(!e.constantSpeed){let D=e.lengths;d-=h?1:2;let _=D[d];this.data.positionMode==ge.Percent&&(l*=_);let j;switch(this.data.spacingMode){case ee.Percent:j=_;break;case ee.Proportional:j=_/s;break;default:j=1}a=E.setArraySize(this.world,8);for(let G=0,K=0,V=0;G<s;G++,K+=3){let q=o[G]*j;l+=q;let $=l;if(h)$%=_,$<0&&($+=_),V=0;else if($<0){f!=Ye.BEFORE&&(f=Ye.BEFORE,e.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition($,a,0,n,K);continue}else if($>_){f!=Ye.AFTER&&(f=Ye.AFTER,e.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition($-_,a,0,n,K);continue}for(;;V++){let oe=D[V];if(!($>oe)){if(V==0)$/=oe;else{let Z=D[V-1];$=($-Z)/(oe-Z)}break}}V!=f&&(f=V,h&&V==d?(e.computeWorldVertices(r,c-4,4,a,0,2),e.computeWorldVertices(r,0,4,a,4,2)):e.computeWorldVertices(r,V*6+2,8,a,0,2)),this.addCurvePosition($,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,K,i||G>0&&q==0)}return n}h?(c+=2,a=E.setArraySize(this.world,c),e.computeWorldVertices(r,2,c-4,a,0,2),e.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=E.setArraySize(this.world,c),e.computeWorldVertices(r,2,c,a,0,2));let m=E.setArraySize(this.curves,d),u=0,p=a[0],b=a[1],w=0,g=0,x=0,y=0,v=0,C=0,A=0,k=0,T=0,Y=0,M=0,R=0,X=0,I=0;for(let D=0,_=2;D<d;D++,_+=6)w=a[_],g=a[_+1],x=a[_+2],y=a[_+3],v=a[_+4],C=a[_+5],A=(p-w*2+x)*.1875,k=(b-g*2+y)*.1875,T=((w-x)*3-p+v)*.09375,Y=((g-y)*3-b+C)*.09375,M=A*2+T,R=k*2+Y,X=(w-p)*.75+A+T*.16666667,I=(g-b)*.75+k+Y*.16666667,u+=Math.sqrt(X*X+I*I),X+=M,I+=R,M+=T,R+=Y,u+=Math.sqrt(X*X+I*I),X+=M,I+=R,u+=Math.sqrt(X*X+I*I),X+=M+T,I+=R+Y,u+=Math.sqrt(X*X+I*I),m[D]=u,p=v,b=C;this.data.positionMode==ge.Percent&&(l*=u);let F;switch(this.data.spacingMode){case ee.Percent:F=u;break;case ee.Proportional:F=u/s;break;default:F=1}let L=this.segments,O=0;for(let D=0,_=0,j=0,G=0;D<s;D++,_+=3){let K=o[D]*F;l+=K;let V=l;if(h)V%=u,V<0&&(V+=u),j=0;else if(V<0){this.addBeforePosition(V,a,0,n,_);continue}else if(V>u){this.addAfterPosition(V-u,a,c-4,n,_);continue}for(;;j++){let q=m[j];if(!(V>q)){if(j==0)V/=q;else{let $=m[j-1];V=(V-$)/(q-$)}break}}if(j!=f){f=j;let q=j*6;for(p=a[q],b=a[q+1],w=a[q+2],g=a[q+3],x=a[q+4],y=a[q+5],v=a[q+6],C=a[q+7],A=(p-w*2+x)*.03,k=(b-g*2+y)*.03,T=((w-x)*3-p+v)*.006,Y=((g-y)*3-b+C)*.006,M=A*2+T,R=k*2+Y,X=(w-p)*.3+A+T*.16666667,I=(g-b)*.3+k+Y*.16666667,O=Math.sqrt(X*X+I*I),L[0]=O,q=1;q<8;q++)X+=M,I+=R,M+=T,R+=Y,O+=Math.sqrt(X*X+I*I),L[q]=O;X+=M,I+=R,O+=Math.sqrt(X*X+I*I),L[8]=O,X+=M+T,I+=R+Y,O+=Math.sqrt(X*X+I*I),L[9]=O,G=0}for(V*=O;;G++){let q=L[G];if(!(V>q)){if(G==0)V/=q;else{let $=L[G-1];V=G+(V-$)/(q-$)}break}}this.addCurvePosition(V*.1,p,b,w,g,x,y,v,C,n,_,i||D>0&&K==0)}return n}addBeforePosition(e,s,i,r,l){let o=s[i],n=s[i+1],a=s[i+2]-o,h=s[i+3]-n,c=Math.atan2(h,a);r[l]=o+e*Math.cos(c),r[l+1]=n+e*Math.sin(c),r[l+2]=c}addAfterPosition(e,s,i,r,l){let o=s[i+2],n=s[i+3],a=o-s[i],h=n-s[i+1],c=Math.atan2(h,a);r[l]=o+e*Math.cos(c),r[l+1]=n+e*Math.sin(c),r[l+2]=c}addCurvePosition(e,s,i,r,l,o,n,a,h,c,d,f){if(e==0||isNaN(e)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(l-i,r-s);return}let m=e*e,u=m*e,p=1-e,b=p*p,w=b*p,g=p*e,x=g*3,y=p*x,v=x*e,C=s*w+r*y+o*v+a*u,A=i*w+l*y+n*v+h*u;c[d]=C,c[d+1]=A,f&&(e<.001?c[d+2]=Math.atan2(l-i,r-s):c[d+2]=Math.atan2(A-(i*b+l*g*2+n*m),C-(s*b+r*g*2+o*m)))}},Sr=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(t){case de.none:return;case de.reset:this.reset();case de.update:const a=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=a.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let f=this.remaining,m=this.inertia,u=this.data.step,p=this.skeleton.data.referenceScale,b=-1,w=this.data.limit*h,g=w*Math.abs(a.scaleY);if(w*=Math.abs(a.scaleX),s||i){if(s){const x=(this.ux-c)*m;this.xOffset+=x>w?w:x<-w?-w:x,this.ux=c}if(i){const x=(this.uy-d)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=d}if(f>=u){b=Math.pow(this.damping,60*u);const x=this.massInverse*u,y=this.strength,v=this.wind*p*a.scaleX,C=this.gravity*p*a.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*u,this.xVelocity*=b),i&&(this.yVelocity-=(C+this.yOffset*y)*x,this.yOffset+=this.yVelocity*u,this.yVelocity*=b),f-=u;while(f>=u)}s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r||l){let x=Math.atan2(o.c,o.a),y=0,v=0,C=0,A=this.cx-o.worldX,k=this.cy-o.worldY;if(A>w?A=w:A<-w&&(A=-w),k>g?k=g:k<-g&&(k=-g),r){C=(this.data.rotate+this.data.shearX)*e;let T=Math.atan2(k+this.ty,A+this.tx)-x-this.rotateOffset*C;this.rotateOffset+=(T-Math.ceil(T*B.invPI2-.5)*B.PI2)*m,T=this.rotateOffset*C+x,y=Math.cos(T),v=Math.sin(T),l&&(T=n*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(A*y+k*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=n*o.getWorldScaleX();T>0&&(this.scaleOffset+=(A*y+k*v)*m/T)}if(f=this.remaining,f>=u){b==-1&&(b=Math.pow(this.damping,60*u));const T=this.massInverse*u,Y=this.strength,M=this.wind,R=De.yDown?-this.gravity:this.gravity,X=n/p;for(;;)if(f-=u,l&&(this.scaleVelocity+=(M*y-R*v-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=b),r){if(this.rotateVelocity-=((M*v+R*y)*X+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=b,f<u)break;const I=this.rotateOffset*C+x;y=Math.cos(I),v=Math.sin(I)}else if(f<u)break}}this.remaining=f}this.cx=o.worldX,this.cy=o.worldY;break;case de.pose:s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r){let a=this.rotateOffset*e,h=0,c=0,d=0;if(this.data.shearX>0){let f=0;this.data.rotate>0&&(f=a*this.data.rotate,h=Math.sin(f),c=Math.cos(f),d=o.b,o.b=c*d-h*o.d,o.d=h*d+c*o.d),f+=a*this.data.shearX,h=Math.sin(f),c=Math.cos(f),d=o.a,o.a=c*d-h*o.c,o.c=h*d+c*o.c}else a*=this.data.rotate,h=Math.sin(a),c=Math.cos(a),d=o.a,o.a=c*d-h*o.c,o.c=h*d+c*o.c,d=o.b,o.b=c*d-h*o.d,o.d=h*d+c*o.d}if(l){const a=1+this.scaleOffset*e*this.data.scaleX;o.a*=a,o.c*=a}t!=de.pose&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*B.degRad,r=Math.cos(i),l=Math.sin(i),o=this.cx-t,n=this.cy-e;this.translate(o*r-n*l-o,o*l+n*r-n)}},Ws=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 N,this.darkColor=t.darkColor?new N:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof we)||!(this.attachment instanceof we)||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}},zs=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new qe;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=e!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,d=n.d,f=a*d-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(t!=0){let x=g.a,y=g.b,v=g.c,C=g.d,A=Math.atan2(c,a)-Math.atan2(v,x)+m;A>B.PI?A-=B.PI2:A<-B.PI&&(A+=B.PI2),A*=t;let k=Math.cos(A),T=Math.sin(A);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(x.x-g.worldX)*e,g.worldY+=(x.y-g.worldY)*s}if(i!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(a*a+c*c)-x+this.data.offsetScaleX)*i)/x),g.a*=x,g.c*=x}if(r!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(h*h+d*d)-x+this.data.offsetScaleY)*r)/x),g.b*=x,g.d*=x}if(l>0){let x=g.b,y=g.d,v=Math.atan2(y,x),C=Math.atan2(d,h)-Math.atan2(c,a)-(v-Math.atan2(g.c,g.a));C>B.PI?C-=B.PI2:C<-B.PI&&(C+=B.PI2),C=v+(C+u)*l;let A=Math.sqrt(x*x+y*y);g.b=Math.cos(C)*A,g.d=Math.sin(C)*A}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=e!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,d=n.d,f=a*d-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(t!=0){let x=g.a,y=g.b,v=g.c,C=g.d,A=Math.atan2(c,a)+m;A>B.PI?A-=B.PI2:A<-B.PI&&(A+=B.PI2),A*=t;let k=Math.cos(A),T=Math.sin(A);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=x.x*e,g.worldY+=x.y*s}if(i!=0){let x=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=x,g.c*=x}if(r!=0){let x=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*r+1;g.b*=x,g.d*=x}if(l>0){let x=Math.atan2(d,h)-Math.atan2(c,a);x>B.PI?x-=B.PI2:x<-B.PI&&(x+=B.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-B.PI/2+u)*l;let C=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*C,g.d=Math.sin(x)*C}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],d=c.arotation;t!=0&&(d+=(o.arotation-d+this.data.offsetRotation)*t);let f=c.ax,m=c.ay;f+=(o.ax-f+this.data.offsetX)*e,m+=(o.ay-m+this.data.offsetY)*s;let u=c.ascaleX,p=c.ascaleY;i!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*i)/u),r!=0&&p!=0&&(p=(p+(o.ascaleY-p+this.data.offsetScaleY)*r)/p);let b=c.ashearY;l!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*l),c.updateWorldTransformWith(f,m,d,u,p,c.ashearX,b)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],d=c.arotation+(o.arotation+this.data.offsetRotation)*t,f=c.ax+(o.ax+this.data.offsetX)*e,m=c.ay+(o.ay+this.data.offsetY)*s,u=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),p=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*l;c.updateWorldTransformWith(f,m,d,u,p,c.ashearX,b)}}},De=class ys{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return ys.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let i=e.bones[s],r;if(!i.parent)r=new ts(i,this,null);else{let l=this.bones[i.parent.index];r=new ts(i,this,l),l.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let i=e.slots[s],r=this.bones[i.boneData.index],l=new Ws(i,r);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let i=e.ikConstraints[s];this.ikConstraints.push(new Us(i,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let i=e.transformConstraints[s];this.transformConstraints.push(new zs(i,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let i=e.pathConstraints[s];this.pathConstraints.push(new qs(i,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let i=e.physicsConstraints[s];this.physicsConstraints.push(new Sr(i,this))}this.color=new N(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let f=0,m=s.length;f<m;f++){let u=s[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let p=this.bones[f[m].index];do p.sorted=!1,p.active=!0,p=p.parent;while(p)}}let i=this.ikConstraints,r=this.transformConstraints,l=this.pathConstraints,o=this.physicsConstraints,n=i.length,a=r.length,h=l.length,c=this.physicsConstraints.length,d=n+a+h+c;e:for(let f=0;f<d;f++){for(let m=0;m<n;m++){let u=i[m];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let m=0;m<a;m++){let u=r[m];if(u.data.order==f){this.sortTransformConstraint(u);continue e}}for(let m=0;m<h;m++){let u=l[m];if(u.data.order==f){this.sortPathConstraint(u);continue e}}for(let m=0;m<c;m++){const u=o[m];if(u.data.order==f){this.sortPhysicsConstraint(u);continue e}}}for(let f=0,m=s.length;f<m;f++)this.sortBone(s[f])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let i=e.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(e),this.sortReset(r.children);else{let l=i[i.length-1];this.sortBone(l),this._updateCache.push(e),this.sortReset(r.children),l.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let a=0,h=this.data.skins.length;a<h;a++)this.sortPathConstraintAttachment(this.data.skins[a],i,r);let l=s.getAttachment();l instanceof Ve&&this.sortPathConstraintAttachmentWith(l,r);let o=e.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(e);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,i=s.length;if(e.data.local)for(let r=0;r<i;r++){let l=s[r];this.sortBone(l.parent),this.sortBone(l)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(e);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(e,s,i){let r=e.attachments[s];if(r)for(let l in r)this.sortPathConstraintAttachmentWith(r[l],i)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof Ve))return;let i=e.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let l=0,o=i.length;l<o;){let n=i[l++];for(n+=l;l<n;)this.sortBone(r[i[l++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&E.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,i=e.length;s<i;s++){let r=e[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,l=s.length;r<l;r++){let o=s[r];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let i=this._updateCache;for(let r=0,l=i.length;r<l;r++)i[r].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let b=1,w=i.length;b<w;b++){let g=i[b];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let l=s.a,o=s.b,n=s.c,a=s.d;r.worldX=l*this.x+o*this.y+s.worldX,r.worldY=n*this.x+a*this.y+s.worldY;const h=(r.rotation+r.shearX)*B.degRad,c=(r.rotation+90+r.shearY)*B.degRad,d=Math.cos(h)*r.scaleX,f=Math.cos(c)*r.scaleY,m=Math.sin(h)*r.scaleX,u=Math.sin(c)*r.scaleY;r.a=(l*d+o*m)*this.scaleX,r.b=(l*f+o*u)*this.scaleX,r.c=(n*d+a*m)*this.scaleY,r.d=(n*f+a*u)*this.scaleY;let p=this._updateCache;for(let b=0,w=p.length;b<w;b++){let g=p[b];g!=r&&g.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;E.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,i=e.length;s<i;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==e)return l}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==e)return l}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i],o=l.data.attachmentName;if(o){let n=e.getAttachment(i,o);n&&l.setAttachment(n)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,l=i.length;r<l;r++){let o=i[r];if(o.data.name==e){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+e);o.setAttachment(n);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new qe,i=new qe;return this.getBounds(s,i,void 0,e),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(e,s,i=new Array(2),r=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let l=this.drawOrder,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let c=0,d=l.length;c<d;c++){let f=l[c];if(!f.bone.active)continue;let m=0,u=null,p=null,b=f.getAttachment();if(b instanceof W)m=8,u=E.setArraySize(i,m,0),b.computeWorldVertices(f,u,0,2),p=ys.quadTriangles;else if(b instanceof me){let w=b;m=w.worldVerticesLength,u=E.setArraySize(i,m,0),w.computeWorldVertices(f,0,m,u,0,2),p=w.triangles}else if(b instanceof Pe&&r!=null){r.clipStart(f,b);continue}if(u&&p){r!=null&&r.isClipping()&&(r.clipTriangles(u,p,p.length),u=r.clippedVertices,m=r.clippedVertices.length);for(let w=0,g=u.length;w<g;w+=2){let x=u[w],y=u[w+1];o=Math.min(o,x),n=Math.min(n,y),a=Math.max(a,x),h=Math.max(h,y)}}r?.clipEndWithSlot(f)}r?.clipEnd(),e.set(o,n),s.set(a-o,h-n)}update(e){this.time+=e}physicsTranslate(e,s){const i=this.physicsConstraints;for(let r=0,l=i.length;r<l;r++)i[r].translate(e,s)}physicsRotate(e,s,i){const r=this.physicsConstraints;for(let l=0,o=r.length;l<o;l++)r[l].rotate(e,s,i)}},de;(function(t){t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose"})(de||(de={}));var Gs=class extends ze{_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)}},Ge=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}},as=class{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},He=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new N(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];s.attachment&&(s.attachment instanceof me?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new as(e,i,r))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new as(t,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let r=t.slots[i],l=r.getAttachment();if(l&&s<e.attachments.length){let o=e.attachments[s];for(let n in o){let a=o[n];if(l==a){let h=this.getAttachment(s,n);h&&r.setAttachment(h);break}}}s++}}},os=class{index=0;name;boneData;color=new N(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Ae.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}},Ae;(function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"})(Ae||(Ae={}));var ls=class extends ze{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}},Hs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ge;s.name="";let i=new $s(t),r=i.readInt32(),l=i.readInt32();s.hash=l==0&&r==0?null:l.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=h==0?null:s.bones[i.readInt(!0)],f=new es(h,c,d);f.rotation=i.readFloat(),f.x=i.readFloat()*e,f.y=i.readFloat()*e,f.scaleX=i.readFloat(),f.scaleY=i.readFloat(),f.shearX=i.readFloat(),f.shearY=i.readFloat(),f.length=i.readFloat()*e,f.inherit=i.readByte(),f.skinRequired=i.readBoolean(),o&&(N.rgba8888ToColor(f.color,i.readInt32()),f.icon=i.readString()??void 0,f.visible=i.readBoolean()),s.bones.push(f)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],f=new os(h,c,d);N.rgba8888ToColor(f.color,i.readInt32());let m=i.readInt32();m!=-1&&N.rgb888ToColor(f.darkColor=new N,m),f.attachmentName=i.readStringRef(),f.blendMode=i.readInt(!0),o&&(f.visible=i.readBoolean()),s.slots.push(f)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new is(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.bendDirection=(m&2)!=0?1:-1,f.compress=(m&4)!=0,f.stretch=(m&8)!=0,f.uniform=(m&16)!=0,(m&32)!=0&&(f.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(f.softness=i.readFloat()*e),s.ikConstraints.push(f)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new ls(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.local=(m&2)!=0,f.relative=(m&4)!=0,(m&8)!=0&&(f.offsetRotation=i.readFloat()),(m&16)!=0&&(f.offsetX=i.readFloat()*e),(m&32)!=0&&(f.offsetY=i.readFloat()*e),(m&64)!=0&&(f.offsetScaleX=i.readFloat()),(m&128)!=0&&(f.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(f.offsetShearY=i.readFloat()),(m&2)!=0&&(f.mixRotate=i.readFloat()),(m&4)!=0&&(f.mixX=i.readFloat()),(m&8)!=0&&(f.mixY=i.readFloat()),(m&16)!=0&&(f.mixScaleX=i.readFloat()),(m&32)!=0&&(f.mixScaleY=i.readFloat()),(m&64)!=0&&(f.mixShearY=i.readFloat()),s.transformConstraints.push(f)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new ns(d);f.order=i.readInt(!0),f.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.slots[i.readInt(!0)];const m=i.readByte();f.positionMode=m&1,f.spacingMode=m>>1&3,f.rotateMode=m>>3&3,(m&128)!=0&&(f.offsetRotation=i.readFloat()),f.position=i.readFloat(),f.positionMode==ge.Fixed&&(f.position*=e),f.spacing=i.readFloat(),(f.spacingMode==ee.Length||f.spacingMode==ee.Fixed)&&(f.spacing*=e),f.mixRotate=i.readFloat(),f.mixX=i.readFloat(),f.mixY=i.readFloat(),s.pathConstraints.push(f)}n=i.readInt(!0);for(let h=0,c;h<n;h++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new Gs(d);f.order=i.readInt(!0),f.bone=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,(m&2)!=0&&(f.x=i.readFloat()),(m&4)!=0&&(f.y=i.readFloat()),(m&8)!=0&&(f.rotate=i.readFloat()),(m&16)!=0&&(f.scaleX=i.readFloat()),(m&32)!=0&&(f.shearX=i.readFloat()),f.limit=((m&64)!=0?i.readFloat():5e3)*e,f.step=1/i.readUnsignedByte(),f.inertia=i.readFloat(),f.strength=i.readFloat(),f.damping=i.readFloat(),f.massInverse=(m&128)!=0?i.readFloat():1,f.wind=i.readFloat(),f.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(f.inertiaGlobal=!0),(m&2)!=0&&(f.strengthGlobal=!0),(m&4)!=0&&(f.dampingGlobal=!0),(m&8)!=0&&(f.massGlobal=!0),(m&16)!=0&&(f.windGlobal=!0),(m&32)!=0&&(f.gravityGlobal=!0),(m&64)!=0&&(f.mixGlobal=!0),f.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(f)}let a=this.readSkin(i,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let h=s.skins.length;for(E.setArraySize(s.skins,n=h+i.readInt(!0));h<n;h++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[h]=c}}n=this.linkedMeshes.length;for(let h=0;h<n;h++){let c=this.linkedMeshes[h];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(c.slotIndex,c.parent);if(!f)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?f:c.mesh,c.mesh.setParentMesh(f),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new rs(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(t,e,s,i){let r=null,l=0;if(s){if(l=t.readInt(!0),l==0)return null;r=new He("default")}else{let o=t.readString();if(!o)throw new Error("Skin name must not be null.");r=new He(o),i&&N.rgba8888ToColor(r.color,t.readInt32()),r.bones.length=t.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=e.bones[t.readInt(!0)];for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.physicsConstraints[t.readInt(!0)]);l=t.readInt(!0)}for(let o=0;o<l;o++){let n=t.readInt(!0);for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,r,n,c,i);d&&r.setAttachment(n,c,d)}}return r}readAttachment(t,e,s,i,r,l){let o=this.scale,n=t.readByte();const a=(n&8)!=0?t.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case Se.Region:{let h=(n&16)!=0?t.readStringRef():null;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null;let f=(n&128)!=0?t.readFloat():0,m=t.readFloat(),u=t.readFloat(),p=t.readFloat(),b=t.readFloat(),w=t.readFloat(),g=t.readFloat();h||(h=a);let x=this.attachmentLoader.newRegionAttachment(s,a,h,d);return x?(x.path=h,x.x=m*o,x.y=u*o,x.scaleX=p,x.scaleY=b,x.rotation=f,x.width=w*o,x.height=g*o,N.rgba8888ToColor(x.color,c),x.sequence=d,d==null&&x.updateRegion(),x):null}case Se.BoundingBox:{let h=this.readVertices(t,(n&16)!=0),c=l?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);return d?(d.worldVerticesLength=h.length,d.vertices=h.vertices,d.bones=h.bones,l&&N.rgba8888ToColor(d.color,c),d):null}case Se.Mesh:{let h=(n&16)!=0?t.readStringRef():a;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,f=t.readInt(!0),m=this.readVertices(t,(n&128)!=0),u=this.readFloatArray(t,m.length,1),p=this.readShortArray(t,(m.length-f-2)*3);let b=[],w=0,g=0;l&&(b=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),g=t.readFloat()),h||(h=a);let x=this.attachmentLoader.newMeshAttachment(s,a,h,d);return x?(x.path=h,N.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=p,x.regionUVs=u,d==null&&x.updateRegion(),x.hullLength=f<<1,x.sequence=d,l&&(x.edges=b,x.width=w*o,x.height=g*o),x):null}case Se.LinkedMesh:{const h=(n&16)!=0?t.readStringRef():a;if(h==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,f=(n&128)!=0,m=t.readInt(!0),u=t.readStringRef();let p=0,b=0;l&&(p=t.readFloat(),b=t.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,a,h,d);return w?(w.path=h,N.rgba8888ToColor(w.color,c),w.sequence=d,l&&(w.width=p*o,w.height=b*o),this.linkedMeshes.push(new kr(w,m,i,u,f)),w):null}case Se.Path:{const h=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(t,(n&64)!=0),f=E.newArray(d.length/6,0);for(let p=0,b=f.length;p<b;p++)f[p]=t.readFloat()*o;const m=l?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,a);return u?(u.closed=h,u.constantSpeed=c,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=f,l&&N.rgba8888ToColor(u.color,m),u):null}case Se.Point:{const h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=l?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*o,m.y=d*o,m.rotation=h,l&&N.rgba8888ToColor(m.color,f),m):null}case Se.Clipping:{const h=t.readInt(!0),c=this.readVertices(t,(n&16)!=0);let d=l?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,a);return f?(f.endSlot=e.slots[h],f.worldVerticesLength=c.length,f.vertices=c.vertices,f.bones=c.bones,l&&N.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){let e=new Ys(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),r=new Tr;if(r.length=i<<1,!e)return r.vertices=this.readFloatArray(t,r.length,s),r;let l=new Array,o=new Array;for(let n=0;n<i;n++){let a=t.readInt(!0);o.push(a);for(let h=0;h<a;h++)o.push(t.readInt(!0)),l.push(t.readFloat()*s),l.push(t.readFloat()*s),l.push(t.readFloat())}return r.vertices=E.toFloatArray(l),r.bones=o,r}readFloatArray(t,e,s){let i=new Array(e);if(s==1)for(let r=0;r<e;r++)i[r]=t.readFloat();else for(let r=0;r<e;r++)i[r]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,r=this.scale;for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){let m=t.readByte(),u=t.readInt(!0),p=u-1;switch(m){case Dr:{let b=new Fe(u,c);for(let w=0;w<u;w++)b.setFrame(w,t.readFloat(),t.readStringRef());i.push(b);break}case Nr:{let b=t.readInt(!0),w=new It(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let A=0,k=0;w.setFrame(A,g,x,y,v,C),A!=p;A++){let T=t.readFloat(),Y=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255;switch(t.readByte()){case ve:w.setStepped(A);break;case Ce:z(t,w,k++,A,0,g,T,x,Y,1),z(t,w,k++,A,1,g,T,y,M,1),z(t,w,k++,A,2,g,T,v,R,1),z(t,w,k++,A,3,g,T,C,X,1)}g=T,x=Y,y=M,v=R,C=X}i.push(w);break}case Or:{let b=t.readInt(!0),w=new Mt(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let C=0,A=0;w.setFrame(C,g,x,y,v),C!=p;C++){let k=t.readFloat(),T=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;switch(t.readByte()){case ve:w.setStepped(C);break;case Ce:z(t,w,A++,C,0,g,k,x,T,1),z(t,w,A++,C,1,g,k,y,Y,1),z(t,w,A++,C,2,g,k,v,M,1)}g=k,x=T,y=Y,v=M}i.push(w);break}case _r:{let b=t.readInt(!0),w=new Ft(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;for(let Y=0,M=0;w.setFrame(Y,g,x,y,v,C,A,k,T),Y!=p;Y++){let R=t.readFloat(),X=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255;switch(t.readByte()){case ve:w.setStepped(Y);break;case Ce:z(t,w,M++,Y,0,g,R,x,X,1),z(t,w,M++,Y,1,g,R,y,I,1),z(t,w,M++,Y,2,g,R,v,F,1),z(t,w,M++,Y,3,g,R,C,L,1),z(t,w,M++,Y,4,g,R,A,O,1),z(t,w,M++,Y,5,g,R,k,D,1),z(t,w,M++,Y,6,g,R,T,_,1)}g=R,x=X,y=I,v=F,C=L,A=O,k=D,T=_}i.push(w);break}case Ur:{let b=t.readInt(!0),w=new Pt(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,x,y,v,C,A,k),T!=p;T++){let M=t.readFloat(),R=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case ve:w.setStepped(T);break;case Ce:z(t,w,Y++,T,0,g,M,x,R,1),z(t,w,Y++,T,1,g,M,y,X,1),z(t,w,Y++,T,2,g,M,v,I,1),z(t,w,Y++,T,3,g,M,C,F,1),z(t,w,Y++,T,4,g,M,A,L,1),z(t,w,Y++,T,5,g,M,k,O,1)}g=M,x=R,y=X,v=I,C=F,A=L,k=O}i.push(w);break}case qr:{let b=new Yt(u,t.readInt(!0),c),w=t.readFloat(),g=t.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,w,g),x!=p;x++){let v=t.readFloat(),C=t.readUnsignedByte()/255;switch(t.readByte()){case ve:b.setStepped(x);break;case Ce:z(t,b,y++,x,0,w,v,g,C,1)}w=v,g=C}i.push(b)}}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){let m=t.readByte(),u=t.readInt(!0);if(m==Vr){let b=new Tt(u,c);for(let w=0;w<u;w++)b.setFrame(w,t.readFloat(),t.readByte());i.push(b);continue}let p=t.readInt(!0);switch(m){case Ir:i.push(ae(t,new We(u,p,c),1));break;case Mr:i.push(hs(t,new xt(u,p,c),r));break;case Yr:i.push(ae(t,new bt(u,p,c),r));break;case Fr:i.push(ae(t,new wt(u,p,c),r));break;case Pr:i.push(hs(t,new yt(u,p,c),1));break;case Rr:i.push(ae(t,new vt(u,p,c),1));break;case Xr:i.push(ae(t,new Ct(u,p,c),1));break;case Br:i.push(hs(t,new At(u,p,c),1));break;case Er:i.push(ae(t,new St(u,p,c),1));break;case Lr:i.push(ae(t,new kt(u,p,c),1))}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=t.readInt(!0),f=d-1,m=new Xt(d,t.readInt(!0),c),u=t.readByte(),p=t.readFloat(),b=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,w=(u&4)!=0?t.readFloat()*r:0;for(let g=0,x=0;m.setFrame(g,p,b,w,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=f;g++){u=t.readByte();const y=t.readFloat(),v=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,C=(u&4)!=0?t.readFloat()*r:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(z(t,m,x++,g,0,p,y,b,v,1),z(t,m,x++,g,1,p,y,w,C,r)),p=y,b=v,w=C}i.push(m)}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=t.readInt(!0),f=d-1,m=new Bt(d,t.readInt(!0),c),u=t.readFloat(),p=t.readFloat(),b=t.readFloat(),w=t.readFloat(),g=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,C=0;m.setFrame(v,u,p,b,w,g,x,y),v!=f;v++){let A=t.readFloat(),k=t.readFloat(),T=t.readFloat(),Y=t.readFloat(),M=t.readFloat(),R=t.readFloat(),X=t.readFloat();switch(t.readByte()){case ve:m.setStepped(v);break;case Ce:z(t,m,C++,v,0,u,A,p,k,1),z(t,m,C++,v,1,u,A,b,T,1),z(t,m,C++,v,2,u,A,w,Y,1),z(t,m,C++,v,3,u,A,g,M,1),z(t,m,C++,v,4,u,A,x,R,1),z(t,m,C++,v,5,u,A,y,X,1)}u=A,p=k,b=T,w=Y,g=M,x=R,y=X}i.push(m)}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readByte(),p=t.readInt(!0),b=t.readInt(!0);switch(u){case Gr:i.push(ae(t,new Et(p,b,c),d.positionMode==ge.Fixed?r:1));break;case Hr:i.push(ae(t,new Lt(p,b,c),d.spacingMode==ee.Length||d.spacingMode==ee.Fixed?r:1));break;case $r:let w=new Vt(p,b,c),g=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let C=0,A=0,k=w.getFrameCount()-1;w.setFrame(C,g,x,y,v),C!=k;C++){let T=t.readFloat(),Y=t.readFloat(),M=t.readFloat(),R=t.readFloat();switch(t.readByte()){case ve:w.setStepped(C);break;case Ce:z(t,w,A++,C,0,g,T,x,Y,1),z(t,w,A++,C,1,g,T,y,M,1),z(t,w,A++,C,2,g,T,v,R,1)}g=T,x=Y,y=M,v=R}i.push(w)}}}for(let a=0,h=t.readInt(!0);a<h;a++){const c=t.readInt(!0)-1;for(let d=0,f=t.readInt(!0);d<f;d++){const m=t.readByte(),u=t.readInt(!0);if(m==si){const b=new zt(u,c);for(let w=0;w<u;w++)b.setFrame(w,t.readFloat());i.push(b);continue}const p=t.readInt(!0);switch(m){case jr:i.push(ae(t,new Dt(u,p,c),1));break;case Jr:i.push(ae(t,new Nt(u,p,c),1));break;case Kr:i.push(ae(t,new Ot(u,p,c),1));break;case Qr:i.push(ae(t,new _t(u,p,c),1));break;case Zr:i.push(ae(t,new Ut(u,p,c),1));break;case ei:i.push(ae(t,new qt(u,p,c),1));break;case ti:i.push(ae(t,new Wt(u,p,c),1))}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){let m=t.readInt(!0);for(let u=0,p=t.readInt(!0);u<p;u++){let b=t.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let w=c.getAttachment(m,b),g=t.readByte(),x=t.readInt(!0),y=x-1;switch(g){case Wr:{let v=w,C=v.bones,A=v.vertices,k=C?A.length/3*2:A.length,T=t.readInt(!0),Y=new Rt(x,T,m,v),M=t.readFloat();for(let R=0,X=0;;R++){let I,F=t.readInt(!0);if(F==0)I=C?E.newFloatArray(k):A;else{I=E.newFloatArray(k);let O=t.readInt(!0);if(F+=O,r==1)for(let D=O;D<F;D++)I[D]=t.readFloat();else for(let D=O;D<F;D++)I[D]=t.readFloat()*r;if(!C)for(let D=0,_=I.length;D<_;D++)I[D]+=A[D]}if(Y.setFrame(R,M,I),R==y)break;let L=t.readFloat();switch(t.readByte()){case ve:Y.setStepped(R);break;case Ce:z(t,Y,X++,R,0,M,L,0,1,1)}M=L}i.push(Y);break}case zr:{let v=new Gt(x,m,w);for(let C=0;C<x;C++){let A=t.readFloat(),k=t.readInt32();v.setFrame(C,A,Fs[k&15],k>>4,t.readFloat())}i.push(v);break}}}}}let l=t.readInt(!0);if(l>0){let a=new Le(l),h=s.slots.length;for(let c=0;c<l;c++){let d=t.readFloat(),f=t.readInt(!0),m=E.newArray(h,0);for(let w=h-1;w>=0;w--)m[w]=-1;let u=E.newArray(h-f,0),p=0,b=0;for(let w=0;w<f;w++){let g=t.readInt(!0);for(;p!=g;)u[b++]=p++;m[p+t.readInt(!0)]=p++}for(;p<h;)u[b++]=p++;for(let w=h-1;w>=0;w--)m[w]==-1&&(m[w]=u[--b]);a.setFrame(c,d,m)}i.push(a)}let o=t.readInt(!0);if(o>0){let a=new tt(o);for(let h=0;h<o;h++){let c=t.readFloat(),d=s.events[t.readInt(!0)],f=new ss(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readString(),f.stringValue==null&&(f.stringValue=d.stringValue),f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),a.setFrame(h,f)}i.push(a)}let n=0;for(let a=0,h=i.length;a<h;a++)n=Math.max(n,i[a].getDuration());return new Ze(e,i,n)}},$s=class{strings;index;buffer;constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let i=0;i<t;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:e+=String.fromCharCode(r),i++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},kr=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},Tr=class{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}},Se;(function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"})(Se||(Se={}));function ae(t,e,s){let i=t.readFloat(),r=t.readFloat()*s;for(let l=0,o=0,n=e.getFrameCount()-1;e.setFrame(l,i,r),l!=n;l++){let a=t.readFloat(),h=t.readFloat()*s;switch(t.readByte()){case ve:e.setStepped(l);break;case Ce:z(t,e,o++,l,0,i,a,r,h,s)}i=a,r=h}return e}function hs(t,e,s){let i=t.readFloat(),r=t.readFloat()*s,l=t.readFloat()*s;for(let o=0,n=0,a=e.getFrameCount()-1;e.setFrame(o,i,r,l),o!=a;o++){let h=t.readFloat(),c=t.readFloat()*s,d=t.readFloat()*s;switch(t.readByte()){case ve:e.setStepped(o);break;case Ce:z(t,e,n++,o,0,i,h,r,c,s),z(t,e,n++,o,1,i,h,l,d,s)}i=h,r=c,l=d}return e}function z(t,e,s,i,r,l,o,n,a,h){e.setBezier(s,i,r,l,n,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,o,a)}var Ir=0,Mr=1,Yr=2,Fr=3,Pr=4,Rr=5,Xr=6,Br=7,Er=8,Lr=9,Vr=10,Dr=0,Nr=1,Or=2,_r=3,Ur=4,qr=5,Wr=0,zr=1,Gr=0,Hr=1,$r=2,jr=0,Jr=1,Kr=2,Qr=4,Zr=5,ei=6,ti=7,si=8,ve=1,Ce=2,cs=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Ee(()=>E.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,l=t.slots,o=l.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n<o;n++){let a=l[n];if(!a.bone.active)continue;let h=a.getAttachment();if(h instanceof Kt){let c=h;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=E.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(a,0,c.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let l=0,o=r.length;l<o;l++){let n=r[l],a=n;for(let h=0,c=n.length;h<c;h+=2){let d=a[h],f=a[h+1];t=Math.min(t,d),e=Math.min(e,f),s=Math.max(s,d),i=Math.max(i,f)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let r=this.minX,l=this.minY,o=this.maxX,n=this.maxY;if(t<=r&&s<=r||e<=l&&i<=l||t>=o&&s>=o||e>=n&&i>=n)return!1;let a=(i-e)/(s-t),h=a*(r-t)+e;if(h>l&&h<n||(h=a*(o-t)+e,h>l&&h<n))return!0;let c=(l-e)/a+t;return c>r&&c<o||(c=(n-e)/a+t,c>r&&c<o)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,r=t.length,l=r-2,o=!1;for(let n=0;n<r;n+=2){let a=i[n+1],h=i[l+1];if(a<s&&h>=s||h<s&&a>=s){let c=i[n];c+(s-a)/(h-a)*(i[l]-c)<e&&(o=!o)}l=n}return o}intersectsSegment(t,e,s,i){let r=this.polygons;for(let l=0,o=r.length;l<o;l++)if(this.intersectsSegmentPolygon(r[l],t,e,s,i))return this.boundingBoxes[l];return null}intersectsSegmentPolygon(t,e,s,i,r){let l=t,o=t.length,n=e-i,a=s-r,h=e*r-s*i,c=l[o-2],d=l[o-1];for(let f=0;f<o;f+=2){let m=l[f],u=l[f+1],p=c*u-d*m,b=c-m,w=d-u,g=n*w-a*b,x=(h*b-n*p)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let y=(h*w-a*p)/g;if((y>=d&&y<=u||y>=u&&y<=d)&&(y>=s&&y<=r||y>=r&&y<=s))return!0}c=m,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},js=class he{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Ee(()=>new Array);polygonIndicesPool=new Ee(()=>new Array);triangulate(e){let s=e,i=e.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<i;n++)r[n]=n;let l=this.isConcaveArray;l.length=0;for(let n=0,a=i;n<a;++n)l[n]=he.isConcave(n,i,s,r);let o=this.triangles;for(o.length=0;i>3;){let n=i-1,a=0,h=1;for(;;){e:if(!l[a]){let f=r[n]<<1,m=r[a]<<1,u=r[h]<<1,p=s[f],b=s[f+1],w=s[m],g=s[m+1],x=s[u],y=s[u+1];for(let v=(h+1)%i;v!=n;v=(v+1)%i){if(!l[v])continue;let C=r[v]<<1,A=s[C],k=s[C+1];if(he.positiveArea(x,y,p,b,A,k)&&he.positiveArea(p,b,w,g,A,k)&&he.positiveArea(w,g,x,y,A,k))break e}break}if(h==0){do{if(!l[a])break;a--}while(a>0);break}n=a,a=h,h=(h+1)%i}o.push(r[(i+a-1)%i]),o.push(r[a]),o.push(r[(a+1)%i]),r.splice(a,1),l.splice(a,1),i--;let c=(i+a-1)%i,d=a==i?0:a;l[c]=he.isConcave(c,i,s,r),l[d]=he.isConcave(d,i,s,r)}return i==3&&(o.push(r[2]),o.push(r[0]),o.push(r[1])),o}decompose(e,s){let i=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let l=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(l),l.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,h=0;for(let c=0,d=s.length;c<d;c+=3){let f=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,p=i[f],b=i[f+1],w=i[m],g=i[m+1],x=i[u],y=i[u+1],v=!1;if(a==f){let C=n.length-4,A=he.winding(n[C],n[C+1],n[C+2],n[C+3],x,y),k=he.winding(x,y,n[0],n[1],n[2],n[3]);A==h&&k==h&&(n.push(x),n.push(y),o.push(u),v=!0)}v||(n.length>0?(r.push(n),l.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(p),n.push(b),n.push(w),n.push(g),n.push(x),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(f),o.push(m),o.push(u),h=he.winding(p,b,w,g,x,y),a=f)}n.length>0&&(r.push(n),l.push(o));for(let c=0,d=r.length;c<d;c++){if(o=l[c],o.length==0)continue;let f=o[0],m=o[o.length-1];n=r[c];let u=n.length-4,p=n[u],b=n[u+1],w=n[u+2],g=n[u+3],x=n[0],y=n[1],v=n[2],C=n[3],A=he.winding(p,b,w,g,x,y);for(let k=0;k<d;k++){if(k==c)continue;let T=l[k];if(T.length!=3)continue;let Y=T[0],M=T[1],R=T[2],X=r[k],I=X[X.length-2],F=X[X.length-1];if(Y!=f||M!=m)continue;let L=he.winding(p,b,w,g,I,F),O=he.winding(I,F,x,y,v,C);L==A&&O==A&&(X.length=0,T.length=0,n.push(I),n.push(F),o.push(R),p=w,b=g,w=I,g=F,k=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),o=l[c],l.splice(c,1),this.polygonIndicesPool.free(o));return r}static isConcave(e,s,i,r){let l=r[(s+e-1)%s]<<1,o=r[e]<<1,n=r[(e+1)%s]<<1;return!this.positiveArea(i[l],i[l+1],i[o],i[o+1],i[n],i[n+1])}static positiveArea(e,s,i,r,l,o){return e*(o-r)+i*(s-o)+l*(r-s)>=0}static winding(e,s,i,r,l,o){let n=i-e,a=r-s;return l*a-o*n+n*s-e*a>=0?1:-1}},nt=class vs{triangulator=new js;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=E.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,0,i,r,0,2);let l=this.clippingPolygon;vs.makeClockwise(l);let o=this.clippingPolygons=this.triangulator.decompose(l,this.triangulator.triangulate(l));for(let n=0,a=o.length;n<a;n++){let h=o[n];vs.makeClockwise(h),h.push(h[0]),h.push(h[1])}return o.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,i,r,l,o,n,a){let h,c,d,f,m,u;typeof s=="number"?(h=i,c=r,d=l,f=o,m=n,u=a):(h=s,c=i,d=r,f=l,m=o,u=n),d&&f&&m&&typeof u=="boolean"?this.clipTrianglesRender(e,h,c,d,f,m,u):this.clipTrianglesNoRender(e,h,c)}clipTrianglesNoRender(e,s,i){let r=this.clipOutput,l=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,h=0;l.length=0,o.length=0;for(let c=0;c<i;c+=3){let d=s[c]<<1,f=e[d],m=e[d+1];d=s[c+1]<<1;let u=e[d],p=e[d+1];d=s[c+2]<<1;let b=e[d],w=e[d+1];for(let g=0;g<a;g++){let x=l.length;if(this.clip(f,m,u,p,b,w,n[g],r)){let y=r.length;if(y==0)continue;let v=y>>1,C=this.clipOutput,A=E.setArraySize(l,x+v*2);for(let T=0;T<y;T+=2,x+=2){let Y=C[T],M=C[T+1];A[x]=Y,A[x+1]=M}x=o.length;let k=E.setArraySize(o,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)k[x]=h,k[x+1]=h+T,k[x+2]=h+T+1;h+=v+1}else{let y=E.setArraySize(l,x+6);y[x]=f,y[x+1]=m,y[x+2]=u,y[x+3]=p,y[x+4]=b,y[x+5]=w,x=o.length;let v=E.setArraySize(o,x+3);v[x]=h,v[x+1]=h+1,v[x+2]=h+2,h+=3;break}}}}clipTrianglesRender(e,s,i,r,l,o,n){let a=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,f=d.length,m=n?12:8,u=0;h.length=0,c.length=0;for(let p=0;p<i;p+=3){let b=s[p]<<1,w=e[b],g=e[b+1],x=r[b],y=r[b+1];b=s[p+1]<<1;let v=e[b],C=e[b+1],A=r[b],k=r[b+1];b=s[p+2]<<1;let T=e[b],Y=e[b+1],M=r[b],R=r[b+1];for(let X=0;X<f;X++){let I=h.length;if(this.clip(w,g,v,C,T,Y,d[X],a)){let F=a.length;if(F==0)continue;let L=C-Y,O=T-v,D=w-T,_=Y-g,j=1/(L*D+O*(g-Y)),G=F>>1,K=this.clipOutput,V=E.setArraySize(h,I+G*m);for(let $=0;$<F;$+=2,I+=m){let oe=K[$],Z=K[$+1];V[I]=oe,V[I+1]=Z,V[I+2]=l.r,V[I+3]=l.g,V[I+4]=l.b,V[I+5]=l.a;let ie=oe-T,ne=Z-Y,fe=(L*ie+O*ne)*j,Xe=(_*ie+D*ne)*j,_e=1-fe-Xe;V[I+6]=x*fe+A*Xe+M*_e,V[I+7]=y*fe+k*Xe+R*_e,n&&(V[I+8]=o.r,V[I+9]=o.g,V[I+10]=o.b,V[I+11]=o.a)}I=c.length;let q=E.setArraySize(c,I+3*(G-2));G--;for(let $=1;$<G;$++,I+=3)q[I]=u,q[I+1]=u+$,q[I+2]=u+$+1;u+=G+1}else{let F=E.setArraySize(h,I+3*m);F[I]=w,F[I+1]=g,F[I+2]=l.r,F[I+3]=l.g,F[I+4]=l.b,F[I+5]=l.a,n?(F[I+6]=x,F[I+7]=y,F[I+8]=o.r,F[I+9]=o.g,F[I+10]=o.b,F[I+11]=o.a,F[I+12]=v,F[I+13]=C,F[I+14]=l.r,F[I+15]=l.g,F[I+16]=l.b,F[I+17]=l.a,F[I+18]=A,F[I+19]=k,F[I+20]=o.r,F[I+21]=o.g,F[I+22]=o.b,F[I+23]=o.a,F[I+24]=T,F[I+25]=Y,F[I+26]=l.r,F[I+27]=l.g,F[I+28]=l.b,F[I+29]=l.a,F[I+30]=M,F[I+31]=R,F[I+32]=o.r,F[I+33]=o.g,F[I+34]=o.b,F[I+35]=o.a):(F[I+6]=x,F[I+7]=y,F[I+8]=v,F[I+9]=C,F[I+10]=l.r,F[I+11]=l.g,F[I+12]=l.b,F[I+13]=l.a,F[I+14]=A,F[I+15]=k,F[I+16]=T,F[I+17]=Y,F[I+18]=l.r,F[I+19]=l.g,F[I+20]=l.b,F[I+21]=l.a,F[I+22]=M,F[I+23]=R),I=c.length;let L=E.setArraySize(c,I+3);L[I]=u,L[I+1]=u+1,L[I+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(e,s,i,r){let l=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,h=this.clippingPolygons,c=h.length,d=0;o.length=0,n.length=0,a.length=0;for(let f=0;f<i;f+=3){let m=s[f]<<1,u=e[m],p=e[m+1],b=r[m],w=r[m+1];m=s[f+1]<<1;let g=e[m],x=e[m+1],y=r[m],v=r[m+1];m=s[f+2]<<1;let C=e[m],A=e[m+1],k=r[m],T=r[m+1];for(let Y=0;Y<c;Y++){let M=o.length;if(this.clip(u,p,g,x,C,A,h[Y],l)){let R=l.length;if(R==0)continue;let X=x-A,I=C-g,F=u-C,L=A-p,O=1/(X*F+I*(p-A)),D=R>>1,_=this.clipOutput,j=E.setArraySize(o,M+D*2),G=E.setArraySize(n,M+D*2);for(let V=0;V<R;V+=2,M+=2){let q=_[V],$=_[V+1];j[M]=q,j[M+1]=$;let oe=q-C,Z=$-A,ie=(X*oe+I*Z)*O,ne=(L*oe+F*Z)*O,fe=1-ie-ne;G[M]=b*ie+y*ne+k*fe,G[M+1]=w*ie+v*ne+T*fe}M=a.length;let K=E.setArraySize(a,M+3*(D-2));D--;for(let V=1;V<D;V++,M+=3)K[M]=d,K[M+1]=d+V,K[M+2]=d+V+1;d+=D+1}else{let R=E.setArraySize(o,M+6);R[M]=u,R[M+1]=p,R[M+2]=g,R[M+3]=x,R[M+4]=C,R[M+5]=A;let X=E.setArraySize(n,M+3*2);X[M]=b,X[M+1]=w,X[M+2]=y,X[M+3]=v,X[M+4]=k,X[M+5]=T,M=a.length;let I=E.setArraySize(a,M+3);I[M]=d,I[M+1]=d+1,I[M+2]=d+2,d+=3;break}}}}clip(e,s,i,r,l,o,n,a){let h=a,c=!1,d;n.length%4>=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(e),d.push(s),d.push(i),d.push(r),d.push(l),d.push(o),d.push(e),d.push(s),a.length=0;let f=n.length-4,m=n;for(let u=0;;u+=2){let p=m[u],b=m[u+1],w=p-m[u+2],g=b-m[u+3],x=a.length,y=d;for(let C=0,A=d.length-2;C<A;){let k=y[C],T=y[C+1];C+=2;let Y=y[C],M=y[C+1],R=g*(p-Y)>w*(b-M),X=g*(p-k)-w*(b-T);if(X>0){if(R){a.push(Y),a.push(M);continue}let I=Y-k,F=M-T,L=X/(I*g-F*w);if(L>=0&&L<=1)a.push(k+I*L),a.push(T+F*L);else{a.push(Y),a.push(M);continue}}else if(R){let I=Y-k,F=M-T,L=X/(I*g-F*w);if(L>=0&&L<=1)a.push(k+I*L),a.push(T+F*L),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(x==a.length)return h.length=0,!0;if(a.push(a[0]),a.push(a[1]),u==f)break;let v=a;a=d,a.length=0,d=v}if(h!=a){h.length=0;for(let u=0,p=a.length-2;u<p;u++)h[u]=a[u]}else h.length=h.length-2;return c}static makeClockwise(e){let s=e,i=e.length,r=s[i-2]*s[1]-s[0]*s[i-1],l=0,o=0,n=0,a=0;for(let h=0,c=i-3;h<c;h+=2)l=s[h],o=s[h+1],n=s[h+2],a=s[h+3],r+=l*a-n*o;if(!(r<0))for(let h=0,c=i-2,d=i>>1;h<d;h+=2){let f=s[h],m=s[h+1],u=c-h;s[h]=s[u],s[h+1]=s[u+1],s[u]=f,s[u+1]=m}}},Js=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ge,i=typeof t=="string"?JSON.parse(t):t,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=S(r,"referenceScale",100)*e,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let l=0;l<i.bones.length;l++){let o=i.bones[l],n=null,a=S(o,"parent",null);a&&(n=s.findBone(a));let h=new es(s.bones.length,o.name,n);h.length=S(o,"length",0)*e,h.x=S(o,"x",0)*e,h.y=S(o,"y",0)*e,h.rotation=S(o,"rotation",0),h.scaleX=S(o,"scaleX",1),h.scaleY=S(o,"scaleY",1),h.shearX=S(o,"shearX",0),h.shearY=S(o,"shearY",0),h.inherit=E.enumValue(Q,S(o,"inherit","Normal")),h.skinRequired=S(o,"skin",!1);let c=S(o,"color",null);c&&h.color.setFromString(c),s.bones.push(h)}if(i.slots)for(let l=0;l<i.slots.length;l++){let o=i.slots[l],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let h=new os(s.slots.length,n,a),c=S(o,"color",null);c&&h.color.setFromString(c);let d=S(o,"dark",null);d&&(h.darkColor=N.fromString(d)),h.attachmentName=S(o,"attachment",null),h.blendMode=E.enumValue(Ae,S(o,"blend","normal")),h.visible=S(o,"visible",!0),s.slots.push(h)}if(i.ik)for(let l=0;l<i.ik.length;l++){let o=i.ik[l],n=new is(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let c=s.findBone(o.bones[h]);if(!c)throw new Error(`Couldn't find bone ${o.bones[h]} for IK constraint ${o.name}.`);n.bones.push(c)}let a=s.findBone(o.target);if(!a)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);n.target=a,n.mix=S(o,"mix",1),n.softness=S(o,"softness",0)*e,n.bendDirection=S(o,"bendPositive",!0)?1:-1,n.compress=S(o,"compress",!1),n.stretch=S(o,"stretch",!1),n.uniform=S(o,"uniform",!1),s.ikConstraints.push(n)}if(i.transform)for(let l=0;l<i.transform.length;l++){let o=i.transform[l],n=new ls(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);n.bones.push(f)}let a=o.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=h,n.local=S(o,"local",!1),n.relative=S(o,"relative",!1),n.offsetRotation=S(o,"rotation",0),n.offsetX=S(o,"x",0)*e,n.offsetY=S(o,"y",0)*e,n.offsetScaleX=S(o,"scaleX",0),n.offsetScaleY=S(o,"scaleY",0),n.offsetShearY=S(o,"shearY",0),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),n.mixScaleX=S(o,"mixScaleX",1),n.mixScaleY=S(o,"mixScaleY",n.mixScaleX),n.mixShearY=S(o,"mixShearY",1),s.transformConstraints.push(n)}if(i.path)for(let l=0;l<i.path.length;l++){let o=i.path[l],n=new ns(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);n.bones.push(f)}let a=o.target,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=h,n.positionMode=E.enumValue(ge,S(o,"positionMode","Percent")),n.spacingMode=E.enumValue(ee,S(o,"spacingMode","Length")),n.rotateMode=E.enumValue(Ie,S(o,"rotateMode","Tangent")),n.offsetRotation=S(o,"rotation",0),n.position=S(o,"position",0),n.positionMode==ge.Fixed&&(n.position*=e),n.spacing=S(o,"spacing",0),(n.spacingMode==ee.Length||n.spacingMode==ee.Fixed)&&(n.spacing*=e),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let l=0;l<i.physics.length;l++){const o=i.physics[l],n=new Gs(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);const a=o.bone,h=s.findBone(a);if(h==null)throw new Error("Physics bone not found: "+a);n.bone=h,n.x=S(o,"x",0),n.y=S(o,"y",0),n.rotate=S(o,"rotate",0),n.scaleX=S(o,"scaleX",0),n.shearX=S(o,"shearX",0),n.limit=S(o,"limit",5e3)*e,n.step=1/S(o,"fps",60),n.inertia=S(o,"inertia",1),n.strength=S(o,"strength",100),n.damping=S(o,"damping",1),n.massInverse=1/S(o,"mass",1),n.wind=S(o,"wind",0),n.gravity=S(o,"gravity",0),n.mix=S(o,"mix",1),n.inertiaGlobal=S(o,"inertiaGlobal",!1),n.strengthGlobal=S(o,"strengthGlobal",!1),n.dampingGlobal=S(o,"dampingGlobal",!1),n.massGlobal=S(o,"massGlobal",!1),n.windGlobal=S(o,"windGlobal",!1),n.gravityGlobal=S(o,"gravityGlobal",!1),n.mixGlobal=S(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(i.skins)for(let l=0;l<i.skins.length;l++){let o=i.skins[l],n=new He(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let h=o.bones[a],c=s.findBone(h);if(!c)throw new Error(`Couldn't find bone ${h} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let h=o.ik[a],c=s.findIkConstraint(h);if(!c)throw new Error(`Couldn't find IK constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let h=o.transform[a],c=s.findTransformConstraint(h);if(!c)throw new Error(`Couldn't find transform constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let h=o.path[a],c=s.findPathConstraint(h);if(!c)throw new Error(`Couldn't find path constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let h=o.physics[a],c=s.findPhysicsConstraint(h);if(!c)throw new Error(`Couldn't find physics constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let d in c){let f=this.readAttachment(c[d],n,h.index,d,s);f&&n.setAttachment(h.index,d,f)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let l=0,o=this.linkedMeshes.length;l<o;l++){let n=this.linkedMeshes[l],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let h=a.getAttachment(n.slotIndex,n.parent);if(!h)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?h:n.mesh,n.mesh.setParentMesh(h),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let l in i.events){let o=i.events[l],n=new rs(l);n.intValue=S(o,"int",0),n.floatValue=S(o,"float",0),n.stringValue=S(o,"string",""),n.audioPath=S(o,"audio",null),n.audioPath&&(n.volume=S(o,"volume",1),n.balance=S(o,"balance",0)),s.events.push(n)}if(i.animations)for(let l in i.animations){let o=i.animations[l];this.readAnimation(o,l,s)}return s}readAttachment(t,e,s,i,r){let l=this.scale;switch(i=S(t,"name",i),S(t,"type","region")){case"region":{let o=S(t,"path",i),n=this.readSequence(S(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,o,n);if(!a)return null;a.path=o,a.x=S(t,"x",0)*l,a.y=S(t,"y",0)*l,a.scaleX=S(t,"scaleX",1),a.scaleY=S(t,"scaleY",1),a.rotation=S(t,"rotation",0),a.width=t.width*l,a.height=t.height*l,a.sequence=n;let h=S(t,"color",null);return h&&a.color.setFromString(h),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!o)return null;this.readVertices(t,o,t.vertexCount<<1);let n=S(t,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=S(t,"path",i),n=this.readSequence(S(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,i,o,n);if(!a)return null;a.path=o;let h=S(t,"color",null);h&&a.color.setFromString(h),a.width=S(t,"width",0)*l,a.height=S(t,"height",0)*l,a.sequence=n;let c=S(t,"parent",null);if(c)return this.linkedMeshes.push(new ri(a,S(t,"skin",null),s,c,S(t,"timelines",!0))),a;let d=t.uvs;return this.readVertices(t,a,d.length),a.triangles=t.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=S(t,"edges",null),a.hullLength=S(t,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(e,i);if(!o)return null;o.closed=S(t,"closed",!1),o.constantSpeed=S(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,o,n<<1);let a=E.newArray(n/3,0);for(let c=0;c<t.lengths.length;c++)a[c]=t.lengths[c]*l;o.lengths=a;let h=S(t,"color",null);return h&&o.color.setFromString(h),o}case"point":{let o=this.attachmentLoader.newPointAttachment(e,i);if(!o)return null;o.x=S(t,"x",0)*l,o.y=S(t,"y",0)*l,o.rotation=S(t,"rotation",0);let n=S(t,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(e,i);if(!o)return null;let n=S(t,"end",null);n&&(o.endSlot=r.findSlot(n));let a=t.vertexCount;this.readVertices(t,o,a<<1);let h=S(t,"color",null);return h&&o.color.setFromString(h),o}}return null}readSequence(t){if(t==null)return null;let e=new Ys(S(t,"count",0));return e.start=S(t,"start",1),e.digits=S(t,"digits",0),e.setupIndex=S(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let r=t.vertices;if(s==r.length){let n=E.toFloatArray(r);if(i!=1)for(let a=0,h=r.length;a<h;a++)n[a]*=i;e.vertices=n;return}let l=new Array,o=new Array;for(let n=0,a=r.length;n<a;){let h=r[n++];o.push(h);for(let c=n+h*4;n<c;n+=4)o.push(r[n]),l.push(r[n+1]*i),l.push(r[n+2]*i),l.push(r[n+3])}e.bones=o,e.vertices=E.toFloatArray(l)}readAnimation(t,e,s){let i=this.scale,r=new Array;if(t.slots)for(let o in t.slots){let n=t.slots[o],a=s.findSlot(o);if(!a)throw new Error("Slot not found: "+o);let h=a.index;for(let c in n){let d=n[c];if(!d)continue;let f=d.length;if(c=="attachment"){let m=new Fe(f,h);for(let u=0;u<f;u++){let p=d[u];m.setFrame(u,S(p,"time",0),S(p,"name",null))}r.push(m)}else if(c=="rgba"){let m=new It(f,f<<2,h),u=d[0],p=S(u,"time",0),b=N.fromString(u.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b,b.a);let x=d[w+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=N.fromString(x.color),C=u.curve;C&&(g=H(C,m,g,w,0,p,y,b.r,v.r,1),g=H(C,m,g,w,1,p,y,b.g,v.g,1),g=H(C,m,g,w,2,p,y,b.b,v.b,1),g=H(C,m,g,w,3,p,y,b.a,v.a,1)),p=y,b=v,u=x}r.push(m)}else if(c=="rgb"){let m=new Mt(f,f*3,h),u=d[0],p=S(u,"time",0),b=N.fromString(u.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b);let x=d[w+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=N.fromString(x.color),C=u.curve;C&&(g=H(C,m,g,w,0,p,y,b.r,v.r,1),g=H(C,m,g,w,1,p,y,b.g,v.g,1),g=H(C,m,g,w,2,p,y,b.b,v.b,1)),p=y,b=v,u=x}r.push(m)}else if(c=="alpha")r.push(pe(d,new Yt(f,f,h),0,1));else if(c=="rgba2"){let m=new Ft(f,f*7,h),u=d[0],p=S(u,"time",0),b=N.fromString(u.light),w=N.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,b.a,w.r,w.g,w.b);let y=d[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),C=N.fromString(y.light),A=N.fromString(y.dark),k=u.curve;k&&(x=H(k,m,x,g,0,p,v,b.r,C.r,1),x=H(k,m,x,g,1,p,v,b.g,C.g,1),x=H(k,m,x,g,2,p,v,b.b,C.b,1),x=H(k,m,x,g,3,p,v,b.a,C.a,1),x=H(k,m,x,g,4,p,v,w.r,A.r,1),x=H(k,m,x,g,5,p,v,w.g,A.g,1),x=H(k,m,x,g,6,p,v,w.b,A.b,1)),p=v,b=C,w=A,u=y}r.push(m)}else if(c=="rgb2"){let m=new Pt(f,f*6,h),u=d[0],p=S(u,"time",0),b=N.fromString(u.light),w=N.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,w.r,w.g,w.b);let y=d[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),C=N.fromString(y.light),A=N.fromString(y.dark),k=u.curve;k&&(x=H(k,m,x,g,0,p,v,b.r,C.r,1),x=H(k,m,x,g,1,p,v,b.g,C.g,1),x=H(k,m,x,g,2,p,v,b.b,C.b,1),x=H(k,m,x,g,3,p,v,w.r,A.r,1),x=H(k,m,x,g,4,p,v,w.g,A.g,1),x=H(k,m,x,g,5,p,v,w.b,A.b,1)),p=v,b=C,w=A,u=y}r.push(m)}}}if(t.bones)for(let o in t.bones){let n=t.bones[o],a=s.findBone(o);if(!a)throw new Error("Bone not found: "+o);let h=a.index;for(let c in n){let d=n[c],f=d.length;if(f!=0){if(c==="rotate")r.push(pe(d,new We(f,f,h),0,1));else if(c==="translate"){let m=new xt(f,f<<1,h);r.push(ds(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new bt(f,f,h);r.push(pe(d,m,0,i))}else if(c==="translatey"){let m=new wt(f,f,h);r.push(pe(d,m,0,i))}else if(c==="scale"){let m=new yt(f,f<<1,h);r.push(ds(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new vt(f,f,h);r.push(pe(d,m,1,1))}else if(c==="scaley"){let m=new Ct(f,f,h);r.push(pe(d,m,1,1))}else if(c==="shear"){let m=new At(f,f<<1,h);r.push(ds(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new St(f,f,h);r.push(pe(d,m,0,1))}else if(c==="sheary"){let m=new kt(f,f,h);r.push(pe(d,m,0,1))}else if(c==="inherit"){let m=new Tt(f,a.index);for(let u=0;u<d.length;u++){let p=d[u];m.setFrame(u,S(p,"time",0),E.enumValue(Q,S(p,"inherit","Normal")))}r.push(m)}}}}if(t.ik)for(let o in t.ik){let n=t.ik[o],a=n[0];if(!a)continue;let h=s.findIkConstraint(o);if(!h)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(h),d=new Xt(n.length,n.length<<1,c),f=S(a,"time",0),m=S(a,"mix",1),u=S(a,"softness",0)*i;for(let p=0,b=0;;p++){d.setFrame(p,f,m,u,S(a,"bendPositive",!0)?1:-1,S(a,"compress",!1),S(a,"stretch",!1));let w=n[p+1];if(!w){d.shrink(b);break}let g=S(w,"time",0),x=S(w,"mix",1),y=S(w,"softness",0)*i,v=a.curve;v&&(b=H(v,d,b,p,0,f,g,m,x,1),b=H(v,d,b,p,1,f,g,u,y,i)),f=g,m=x,u=y,a=w}r.push(d)}if(t.transform)for(let o in t.transform){let n=t.transform[o],a=n[0];if(!a)continue;let h=s.findTransformConstraint(o);if(!h)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(h),d=new Bt(n.length,n.length*6,c),f=S(a,"time",0),m=S(a,"mixRotate",1),u=S(a,"mixX",1),p=S(a,"mixY",u),b=S(a,"mixScaleX",1),w=S(a,"mixScaleY",b),g=S(a,"mixShearY",1);for(let x=0,y=0;;x++){d.setFrame(x,f,m,u,p,b,w,g);let v=n[x+1];if(!v){d.shrink(y);break}let C=S(v,"time",0),A=S(v,"mixRotate",1),k=S(v,"mixX",1),T=S(v,"mixY",k),Y=S(v,"mixScaleX",1),M=S(v,"mixScaleY",Y),R=S(v,"mixShearY",1),X=a.curve;X&&(y=H(X,d,y,x,0,f,C,m,A,1),y=H(X,d,y,x,1,f,C,u,k,1),y=H(X,d,y,x,2,f,C,p,T,1),y=H(X,d,y,x,3,f,C,b,Y,1),y=H(X,d,y,x,4,f,C,w,M,1),y=H(X,d,y,x,5,f,C,g,R,1)),f=C,m=A,u=k,p=T,b=Y,w=M,b=Y,a=v}r.push(d)}if(t.path)for(let o in t.path){let n=t.path[o],a=s.findPathConstraint(o);if(!a)throw new Error("Path constraint not found: "+o);let h=s.pathConstraints.indexOf(a);for(let c in n){let d=n[c],f=d[0];if(!f)continue;let m=d.length;if(c==="position"){let u=new Et(m,m,h);r.push(pe(d,u,0,a.positionMode==ge.Fixed?i:1))}else if(c==="spacing"){let u=new Lt(m,m,h);r.push(pe(d,u,0,a.spacingMode==ee.Length||a.spacingMode==ee.Fixed?i:1))}else if(c==="mix"){let u=new Vt(m,m*3,h),p=S(f,"time",0),b=S(f,"mixRotate",1),w=S(f,"mixX",1),g=S(f,"mixY",w);for(let x=0,y=0;;x++){u.setFrame(x,p,b,w,g);let v=d[x+1];if(!v){u.shrink(y);break}let C=S(v,"time",0),A=S(v,"mixRotate",1),k=S(v,"mixX",1),T=S(v,"mixY",k),Y=f.curve;Y&&(y=H(Y,u,y,x,0,p,C,b,A,1),y=H(Y,u,y,x,1,p,C,w,k,1),y=H(Y,u,y,x,2,p,C,g,T,1)),p=C,b=A,w=k,g=T,f=v}r.push(u)}}}if(t.physics)for(let o in t.physics){let n=t.physics[o],a=-1;if(o.length>0){let h=s.findPhysicsConstraint(o);if(!h)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(h)}for(let h in n){let c=n[h],d=c[0];if(!d)continue;let f=c.length;if(h=="reset"){const u=new zt(f,a);for(let p=0;d!=null;d=c[p+1],p++)u.setFrame(p,S(d,"time",0));r.push(u);continue}let m;if(h=="inertia")m=new Dt(f,f,a);else if(h=="strength")m=new Nt(f,f,a);else if(h=="damping")m=new Ot(f,f,a);else if(h=="mass")m=new _t(f,f,a);else if(h=="wind")m=new Ut(f,f,a);else if(h=="gravity")m=new qt(f,f,a);else if(h=="mix")m=new Wt(f,f,a);else continue;r.push(pe(c,m,0,1))}}if(t.attachments)for(let o in t.attachments){let n=t.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let h in n){let c=n[h],d=s.findSlot(h);if(!d)throw new Error("Slot not found: "+h);let f=d.index;for(let m in c){let u=c[m],p=a.getAttachment(f,m);for(let b in u){let w=u[b],g=w[0];if(g){if(b=="deform"){let x=p.bones,y=p.vertices,v=x?y.length/3*2:y.length,C=new Rt(w.length,w.length,f,p),A=S(g,"time",0);for(let k=0,T=0;;k++){let Y,M=S(g,"vertices",null);if(!M)Y=x?E.newFloatArray(v):y;else{Y=E.newFloatArray(v);let F=S(g,"offset",0);if(E.arrayCopy(M,0,Y,F,M.length),i!=1)for(let L=F,O=L+M.length;L<O;L++)Y[L]*=i;if(!x)for(let L=0;L<v;L++)Y[L]+=y[L]}C.setFrame(k,A,Y);let R=w[k+1];if(!R){C.shrink(T);break}let X=S(R,"time",0),I=g.curve;I&&(T=H(I,C,T,k,0,A,X,0,1,1)),A=X,g=R}r.push(C)}else if(b=="sequence"){let x=new Gt(w.length,f,p),y=0;for(let v=0;v<w.length;v++){let C=S(g,"delay",y),A=S(g,"time",0),k=se[S(g,"mode","hold")],T=S(g,"index",0);x.setFrame(v,A,k,T,C),y=C,g=w[v+1]}r.push(x)}}}}}}if(t.drawOrder){let o=new Le(t.drawOrder.length),n=s.slots.length,a=0;for(let h=0;h<t.drawOrder.length;h++,a++){let c=t.drawOrder[h],d=null,f=S(c,"offsets",null);if(f){d=E.newArray(n,-1);let m=E.newArray(n-f.length,0),u=0,p=0;for(let b=0;b<f.length;b++){let w=f[b],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;u!=x;)m[p++]=u++;d[u+w.offset]=u++}for(;u<n;)m[p++]=u++;for(let b=n-1;b>=0;b--)d[b]==-1&&(d[b]=m[--p])}o.setFrame(a,S(c,"time",0),d)}r.push(o)}if(t.events){let o=new tt(t.events.length),n=0;for(let a=0;a<t.events.length;a++,n++){let h=t.events[a],c=s.findEvent(h.name);if(!c)throw new Error("Event not found: "+h.name);let d=new ss(E.toSinglePrecision(S(h,"time",0)),c);d.intValue=S(h,"int",c.intValue),d.floatValue=S(h,"float",c.floatValue),d.stringValue=S(h,"string",c.stringValue),d.data.audioPath&&(d.volume=S(h,"volume",1),d.balance=S(h,"balance",0)),o.setFrame(n,d)}r.push(o)}let l=0;for(let o=0,n=r.length;o<n;o++)l=Math.max(l,r[o].getDuration());s.animations.push(new Ze(e,r,l))}},ri=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function pe(t,e,s,i){let r=t[0],l=S(r,"time",0),o=S(r,"value",s)*i,n=0;for(let a=0;;a++){e.setFrame(a,l,o);let h=t[a+1];if(!h)return e.shrink(n),e;let c=S(h,"time",0),d=S(h,"value",s)*i;r.curve&&(n=H(r.curve,e,n,a,0,l,c,o,d,i)),l=c,o=d,r=h}}function ds(t,e,s,i,r,l){let o=t[0],n=S(o,"time",0),a=S(o,s,r)*l,h=S(o,i,r)*l,c=0;for(let d=0;;d++){e.setFrame(d,n,a,h);let f=t[d+1];if(!f)return e.shrink(c),e;let m=S(f,"time",0),u=S(f,s,r)*l,p=S(f,i,r)*l,b=o.curve;b&&(c=H(b,e,c,d,0,n,m,a,u,l),c=H(b,e,c,d,1,n,m,h,p,l)),n=m,a=u,h=p,o=f}}function H(t,e,s,i,r,l,o,n,a,h){if(t=="stepped")return e.setStepped(i),s;let c=r<<2,d=t[c],f=t[c+1]*h,m=t[c+2],u=t[c+3]*h;return e.setBezier(s,i,r,l,n,d,f,m,u,o,a),s+1}function S(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));import{checkExtension as fs,copySearchParams as ii,DOMAdapter as ni,ExtensionType as Ks,extensions as ai,LoaderParserPriority as oi,path as at,Resolver as li,TextureSource as Qs}from"pixi.js";import{Texture as hi}from"pixi.js";var us=class ke extends Qt{static textureMap=new Map;static from(e){return ke.textureMap.has(e)?ke.textureMap.get(e):new ke(e)}texture;constructor(e){super(e.resource),this.texture=hi.from(e)}setFilters(e,s){const i=this.texture.source.style;i.minFilter=ke.toPixiTextureFilter(e),i.magFilter=ke.toPixiTextureFilter(s),this.texture.source.autoGenerateMipmaps=ke.toPixiMipMap(e),this.texture.source.updateMipmaps()}setWraps(e,s){const i=this.texture.source.style;i.addressModeU=ke.toPixiTextureWrap(e),i.addressModeV=ke.toPixiTextureWrap(s)}dispose(){this.texture.destroy()}static toPixiMipMap(e){switch(e){case te.Nearest:case te.Linear:return!1;case te.MipMapNearestLinear:case te.MipMapNearestNearest:case te.MipMapLinearLinear:case te.MipMapLinearNearest:return!0;default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureFilter(e){switch(e){case te.Nearest:case te.MipMapNearestLinear:case te.MipMapNearestNearest:return"nearest";case te.Linear:case te.MipMapLinearLinear:case te.MipMapLinearNearest:return"linear";default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureWrap(e){switch(e){case ye.ClampToEdge:return"clamp-to-edge";case ye.MirroredRepeat:return"mirror-repeat";case ye.Repeat:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(e)}`)}}static toPixiBlending(e){switch(e){case Ae.Normal:return"normal";case Ae.Additive:return"add";case Ae.Multiply:return"multiply";case Ae.Screen:return"screen";default:throw new Error(`Unknown blendMode: ${String(e)}`)}}},$e="spineTextureAtlasLoader",ci={extension:Ks.Asset,resolver:{test:t=>fs(t,".atlas"),parse:t=>{const e=t.split(".");return{resolution:parseFloat(li.RETINA_PREFIX?.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{id:$e,name:$e,extension:{type:Ks.LoadParser,priority:oi.Normal,name:$e},test(t){return fs(t,".atlas")},async load(t){return await(await ni.get().fetch(t)).text()},testParse(t,e){const s=fs(e.src,".atlas"),i=typeof t=="string",r=e.parser===$e||e.loadParser===$e;return Promise.resolve((s||r)&&i)},unload(t){t.dispose()},async parse(t,e,s){const i=e.data||{};let r=at.dirname(e.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");const l=new it(t);if(i.images instanceof Qs||typeof i.images=="string"){const n=i.images;i.images={},i.images[l.pages[0].name]=n}const o=[];for(const n of l.pages){const a=n.name,h=i?.images?i.images[a]:void 0;if(h instanceof Qs)n.setTexture(us.from(h));else{const c=h??at.normalize([...r.split(at.sep),a].join(at.sep)),d={src:ii(c,e.src),data:{...i.imageMetadata,alphaMode:n.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},f=s.load(d).then(m=>{n.setTexture(us.from(m.source))});o.push(f)}}return await Promise.all(o),l}}};ai.add(ci);import{checkExtension as ms,DOMAdapter as di,ExtensionType as Zs,extensions as fi,LoaderParserPriority as ui}from"pixi.js";var je="spineSkeletonLoader";function mi(t){return Object.prototype.hasOwnProperty.call(t,"bones")}function gi(t){return t instanceof Uint8Array}var pi={extension:Zs.Asset,loader:{id:je,name:je,extension:{type:Zs.LoadParser,priority:ui.Normal,name:je},test(t){return ms(t,".skel")},async load(t){const e=await di.get().fetch(t);return new Uint8Array(await e.arrayBuffer())},testParse(t,e){const s=ms(e.src,".json")&&mi(t),i=ms(e.src,".skel")&&gi(t),r=e.parser===je||e.loadParser===je;return Promise.resolve(s||i||r)}}};fi.add(pi);import{Batcher as xi,Color as bi,extensions as wi,ExtensionType as yi}from"pixi.js";import{Buffer as er,BufferUsage as ot,Geometry as vi}from"pixi.js";var Ci=new Float32Array(1),Ai=new Uint32Array(1),Si=class extends vi{constructor(){const e=new er({data:Ci,label:"attribute-batch-buffer",usage:ot.VERTEX|ot.COPY_DST,shrinkToFit:!1}),s=new er({data:Ai,label:"index-batch-buffer",usage:ot.INDEX|ot.COPY_DST,shrinkToFit:!1}),i=7*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:4*4},aDarkColor:{buffer:e,format:"unorm8x4",stride:i,offset:5*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:6*4}},indexBuffer:s})}};import{colorBit as ki,colorBitGl as Ti,compileHighShaderGlProgram as Ii,compileHighShaderGpuProgram as Mi,generateTextureBatchBit as Yi,generateTextureBatchBitGl as Fi,getBatchSamplersUniformGroup as Pi,roundPixelsBit as Ri,roundPixelsBitGl as Xi,Shader as Bi}from"pixi.js";var Ei={name:"color-bit",vertex:{header:`
|
|
1
|
+
"use strict";if(typeof window<"u"&&window.PIXI){const t=window.require;window.require=e=>{if(t)return t(e);if(e.startsWith("@pixi/")||e.startsWith("pixi.js"))return window.PIXI}}var pr=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},gt=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},N=class Re{r;g;b;a;static WHITE=new Re(1,1,1,1);static RED=new Re(1,0,0,1);static GREEN=new Re(0,1,0,1);static BLUE=new Re(0,0,1,1);static MAGENTA=new Re(1,0,1,1);constructor(e=0,s=0,i=0,r=0){this.r=e,this.g=s,this.b=i,this.a=r}set(e,s,i,r){return this.r=e,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,i,r){return this.r+=e,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,s=new Re){return s.setFromString(e)}},B=class be{static PI=3.1415927;static PI2=be.PI*2;static invPI2=1/be.PI2;static radiansToDegrees=180/be.PI;static radDeg=be.radiansToDegrees;static degreesToRadians=be.PI/180;static degRad=be.degreesToRadians;static clamp(e,s,i){return e<s?s:e>i?i:e}static cosDeg(e){return Math.cos(e*be.degRad)}static sinDeg(e){return Math.sin(e*be.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*be.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return be.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,i){let r=Math.random(),l=s-e;return r<=(i-e)/l?e+Math.sqrt(r*l*(i-e)):s-Math.sqrt((1-r)*l*(s-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Is=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},Ms=class extends Is{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},xr=class extends Ms{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},E=class Oe{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,i,r,l){for(let o=s,n=r;o<s+l;o++,n++)i[n]=e[o]}static arrayFill(e,s,i,r){for(let l=s;l<i;l++)e[l]=r}static setArraySize(e,s,i=0){let r=e.length;if(r==s)return e;if(e.length=s,r<s)for(let l=r;l<s;l++)e[l]=i;return e}static ensureArrayCapacity(e,s,i=0){return e.length>=s?e:Oe.setArraySize(e,s,i)}static newArray(e,s){let i=new Array(e);for(let r=0;r<e;r++)i[r]=s;return i}static newFloatArray(e){if(Oe.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(e){if(Oe.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let s=new Array(e);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(e){return Oe.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Oe.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,s){}static contains(e,s,i=!0){for(var r=0;r<e.length;r++)if(e[r]==s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},br=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)}}},Ee=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}},qe=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 t!=0&&(this.x/=t,this.y/=t),this}},wr=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)}},yr=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}},pt=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},we=class ar extends pt{static nextID=0;id=ar.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,s,i,r,l,o){i=l+(i>>1)*o;let n=e.bone.skeleton,a=e.deform,h=this.vertices,c=this.bones;if(!c){a.length>0&&(h=a);let u=e.bone,p=u.worldX,b=u.worldY,w=u.a,g=u.b,x=u.c,y=u.d;for(let v=s,C=l;C<i;v+=2,C+=o){let A=h[v],k=h[v+1];r[C]=A*w+k*g+p,r[C+1]=A*x+k*y+b}return}let d=0,f=0;for(let u=0;u<s;u+=2){let p=c[d];d+=p+1,f+=p}let m=n.bones;if(a.length==0)for(let u=l,p=f*3;u<i;u+=o){let b=0,w=0,g=c[d++];for(g+=d;d<g;d++,p+=3){let x=m[c[d]],y=h[p],v=h[p+1],C=h[p+2];b+=(y*x.a+v*x.b+x.worldX)*C,w+=(y*x.c+v*x.d+x.worldY)*C}r[u]=b,r[u+1]=w}else{let u=a;for(let p=l,b=f*3,w=f<<1;p<i;p+=o){let g=0,x=0,y=c[d++];for(y+=d;d<y;d++,b+=3,w+=2){let v=m[c[d]],C=h[b]+u[w],A=h[b+1]+u[w+1],k=h[b+2];g+=(C*v.a+A*v.b+v.worldX)*k,x+=(C*v.c+A*v.d+v.worldY)*k}r[p]=g,r[p+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),E.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=E.newFloatArray(this.vertices.length),E.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},Ys=class ht{static _nextID=0;id=ht.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new ht(this.regions.length);return E.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,s){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(e,s){let i=e,r=(this.start+s).toString();for(let l=this.digits-r.length;l>0;l--)i+="0";return i+=r,i}static nextID(){return ht._nextID++}},se;(function(t){t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse"})(se||(se={}));var Fs=[se.hold,se.once,se.loop,se.pingpong,se.onceReverse,se.loopReverse,se.pingpongReverse],Ze=class{name;timelines=[];timelineIds=new gt;duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,r,l,o,n){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let h=0,c=a.length;h<c;h++)a[h].apply(t,e,s,r,l,o,n)}},P;(function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"})(P||(P={}));var re;(function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"})(re||(re={}));var U={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},J=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=E.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let r=s;r<i;r+=s)if(t[r]>e)return r-s;return i-s}},ue=class extends J{curves;constructor(t,e,s){super(t,s),this.curves=E.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let s=E.newFloatArray(e);E.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,i,r,l,o,n,a,h,c){let d=this.curves,f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);let m=(i-l*2+n)*.03,u=(r-o*2+a)*.03,p=((l-n)*3-i+h)*.006,b=((o-a)*3-r+c)*.006,w=m*2+p,g=u*2+b,x=(l-i)*.3+m+p*.16666667,y=(o-r)*.3+u+b*.16666667,v=i+x,C=r+y;for(let A=f+18;f<A;f+=2)d[f]=v,d[f+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getBezierValue(t,e,s,i){let r=this.curves;if(r[i]>t){let a=this.frames[e],h=this.frames[e+s];return h+(t-a)/(r[i]-a)*(r[i+1]-h)}let l=i+18;for(i+=2;i<l;i+=2)if(r[i]>=t){let a=r[i-2],h=r[i-1];return h+(t-a)/(r[i]-a)*(r[i+1]-h)}e+=this.getFrameEntries();let o=r[l-2],n=r[l-1];return n+(t-o)/(this.frames[e]-o)*(this.frames[e+s]-n)}},ce=class extends ue{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let r=2;r<=s;r+=2)if(e[r]>t){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=e[s],l=e[s+1];return l+(t-r)/(e[s+2]-r)*(e[s+2+1]-l);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case P.setup:return r;case P.first:return i+(r-i)*e}return i}let l=this.getCurveValue(t);switch(s){case P.setup:return r+l*e;case P.first:case P.replace:l+=r-i}return i+l*e}getAbsoluteValue(t,e,s,i,r){if(t<this.frames[0]){switch(s){case P.setup:return r;case P.first:return i+(r-i)*e}return i}let l=this.getCurveValue(t);return s==P.setup?r+(l-r)*e:i+(l-i)*e}getAbsoluteValue2(t,e,s,i,r,l){if(t<this.frames[0]){switch(s){case P.setup:return r;case P.first:return i+(r-i)*e}return i}return s==P.setup?r+(l-r)*e:i+(l-i)*e}getScaleValue(t,e,s,i,r,l){const o=this.frames;if(t<o[0]){switch(s){case P.setup:return l;case P.first:return r+(l-r)*e}return r}let n=this.getCurveValue(t)*l;if(e==1)return s==P.add?r+n-l:n;if(i==re.mixOut)switch(s){case P.setup:return l+(Math.abs(n)*B.signum(l)-l)*e;case P.first:case P.replace:return r+(Math.abs(n)*B.signum(r)-r)*e}else{let a=0;switch(s){case P.setup:return a=Math.abs(l)*B.signum(n),a+(n-a)*e;case P.first:case P.replace:return a=Math.abs(r)*B.signum(n),a+(n-a)*e}}return r+(n-l)*e}},et=class extends ue{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}},We=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.rotate+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,l,n.rotation,n.data.rotation))}},xt=class extends et{boneIndex=0;constructor(t,e,s){super(t,e,U.x+"|"+s,U.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case P.setup:n.x=n.data.x,n.y=n.data.y;return;case P.first:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let h=0,c=0,d=J.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];h=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*u,c+=(a[d+3+2]-c)*u;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(l){case P.setup:n.x=n.data.x+h*r,n.y=n.data.y+c*r;break;case P.first:case P.replace:n.x+=(n.data.x+h-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case P.add:n.x+=h*r,n.y+=c*r}}},bt=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.x+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,l,n.x,n.data.x))}},wt=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.y+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,l,n.y,n.data.y))}},yt=class extends et{boneIndex=0;constructor(t,e,s){super(t,e,U.scaleX+"|"+s,U.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case P.setup:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case P.first:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let h,c,d=J.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];h=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*u,c+=(a[d+3+2]-c)*u;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(h*=n.data.scaleX,c*=n.data.scaleY,r==1)l==P.add?(n.scaleX+=h-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=h,n.scaleY=c);else{let m=0,u=0;if(o==re.mixOut)switch(l){case P.setup:m=n.data.scaleX,u=n.data.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*B.signum(u)-u)*r;break;case P.first:case P.replace:m=n.scaleX,u=n.scaleY,n.scaleX=m+(Math.abs(h)*B.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*B.signum(u)-u)*r;break;case P.add:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(l){case P.setup:m=Math.abs(n.data.scaleX)*B.signum(h),u=Math.abs(n.data.scaleY)*B.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=u+(c-u)*r;break;case P.first:case P.replace:m=Math.abs(n.scaleX)*B.signum(h),u=Math.abs(n.scaleY)*B.signum(c),n.scaleX=m+(h-m)*r,n.scaleY=u+(c-u)*r;break;case P.add:n.scaleX+=(h-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},vt=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.scaleX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,l,o,n.scaleX,n.data.scaleX))}},Ct=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.scaleY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,l,o,n.scaleY,n.data.scaleY))}},At=class extends et{boneIndex=0;constructor(t,e,s){super(t,e,U.shearX+"|"+s,U.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case P.setup:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case P.first:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let h=0,c=0,d=J.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];h=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);h+=(a[d+3+1]-h)*u,c+=(a[d+3+2]-c)*u;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(l){case P.setup:n.shearX=n.data.shearX+h*r,n.shearY=n.data.shearY+c*r;break;case P.first:case P.replace:n.shearX+=(n.data.shearX+h-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case P.add:n.shearX+=h*r,n.shearY+=c*r}}},St=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.shearX+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,l,n.shearX,n.data.shearX))}},kt=class extends ce{boneIndex=0;constructor(t,e,s){super(t,e,U.shearY+"|"+s),this.boneIndex=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,l,n.shearY,n.data.shearY))}},Tt=class extends J{boneIndex=0;constructor(t,e){super(t,[U.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,r,l,o){let n=t.bones[this.boneIndex];if(!n.active)return;if(o==re.mixOut){l==P.setup&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(l==P.setup||l==P.first)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[J.search(a,s,2)+1]}},It=class extends ue{slotIndex=0;constructor(t,e,s){super(t,e,[U.rgb+"|"+s,U.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,r,l){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let b=n.data.color;switch(l){case P.setup:h.setFromColor(b);return;case P.first:h.add((b.r-h.r)*r,(b.g-h.g)*r,(b.b-h.b)*r,(b.a-h.a)*r)}return}let c=0,d=0,f=0,m=0,u=J.search(a,s,5),p=this.curves[u/5];switch(p){case 0:let b=a[u];c=a[u+1],d=a[u+2],f=a[u+3],m=a[u+4];let w=(s-b)/(a[u+5]-b);c+=(a[u+5+1]-c)*w,d+=(a[u+5+2]-d)*w,f+=(a[u+5+3]-f)*w,m+=(a[u+5+4]-m)*w;break;case 1:c=a[u+1],d=a[u+2],f=a[u+3],m=a[u+4];break;default:c=this.getBezierValue(s,u,1,p-2),d=this.getBezierValue(s,u,2,p+18-2),f=this.getBezierValue(s,u,3,p+18*2-2),m=this.getBezierValue(s,u,4,p+18*3-2)}r==1?h.set(c,d,f,m):(l==P.setup&&h.setFromColor(n.data.color),h.add((c-h.r)*r,(d-h.g)*r,(f-h.b)*r,(m-h.a)*r))}},Mt=class extends ue{slotIndex=0;constructor(t,e,s){super(t,e,[U.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color;if(s<a[0]){let p=n.data.color;switch(l){case P.setup:h.r=p.r,h.g=p.g,h.b=p.b;return;case P.first:h.r+=(p.r-h.r)*r,h.g+=(p.g-h.g)*r,h.b+=(p.b-h.b)*r}return}let c=0,d=0,f=0,m=J.search(a,s,4),u=this.curves[m>>2];switch(u){case 0:let p=a[m];c=a[m+1],d=a[m+2],f=a[m+3];let b=(s-p)/(a[m+4]-p);c+=(a[m+4+1]-c)*b,d+=(a[m+4+2]-d)*b,f+=(a[m+4+3]-f)*b;break;case 1:c=a[m+1],d=a[m+2],f=a[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),d=this.getBezierValue(s,m,2,u+18-2),f=this.getBezierValue(s,m,3,u+18*2-2)}if(r==1)h.r=c,h.g=d,h.b=f;else{if(l==P.setup){let p=n.data.color;h.r=p.r,h.g=p.g,h.b=p.b}h.r+=(c-h.r)*r,h.g+=(d-h.g)*r,h.b+=(f-h.b)*r}}},Yt=class extends ce{slotIndex=0;constructor(t,e,s){super(t,e,U.alpha+"|"+s),this.slotIndex=s}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(l){case P.setup:a.a=c.a;return;case P.first:a.a+=(c.a-a.a)*r}return}let h=this.getCurveValue(s);r==1?a.a=h:(l==P.setup&&(a.a=n.data.color.a),a.a+=(h-a.a)*r)}},Ft=class extends ue{slotIndex=0;constructor(t,e,s){super(t,e,[U.rgb+"|"+s,U.alpha+"|"+s,U.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,r,l,o,n,a){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l,this.frames[t+5]=o,this.frames[t+6]=n,this.frames[t+7]=a}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case P.setup:h.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case P.first:h.add((y.r-h.r)*r,(y.g-h.g)*r,(y.b-h.b)*r,(y.a-h.a)*r),c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,f=0,m=0,u=0,p=0,b=0,w=0,g=J.search(a,s,8),x=this.curves[g>>3];switch(x){case 0:let y=a[g];d=a[g+1],f=a[g+2],m=a[g+3],u=a[g+4],p=a[g+5],b=a[g+6],w=a[g+7];let v=(s-y)/(a[g+8]-y);d+=(a[g+8+1]-d)*v,f+=(a[g+8+2]-f)*v,m+=(a[g+8+3]-m)*v,u+=(a[g+8+4]-u)*v,p+=(a[g+8+5]-p)*v,b+=(a[g+8+6]-b)*v,w+=(a[g+8+7]-w)*v;break;case 1:d=a[g+1],f=a[g+2],m=a[g+3],u=a[g+4],p=a[g+5],b=a[g+6],w=a[g+7];break;default:d=this.getBezierValue(s,g,1,x-2),f=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),u=this.getBezierValue(s,g,4,x+18*3-2),p=this.getBezierValue(s,g,5,x+18*4-2),b=this.getBezierValue(s,g,6,x+18*5-2),w=this.getBezierValue(s,g,7,x+18*6-2)}if(r==1)h.set(d,f,m,u),c.r=p,c.g=b,c.b=w;else{if(l==P.setup){h.setFromColor(n.data.color);let y=n.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}h.add((d-h.r)*r,(f-h.g)*r,(m-h.b)*r,(u-h.a)*r),c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},Pt=class extends ue{slotIndex=0;constructor(t,e,s){super(t,e,[U.rgb+"|"+s,U.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,l,o,n){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l,this.frames[t+5]=o,this.frames[t+6]=n}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,h=n.color,c=n.darkColor;if(s<a[0]){let y=n.data.color,v=n.data.darkColor;switch(l){case P.setup:h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case P.first:h.r+=(y.r-h.r)*r,h.g+=(y.g-h.g)*r,h.b+=(y.b-h.b)*r,c.r+=(v.r-c.r)*r,c.g+=(v.g-c.g)*r,c.b+=(v.b-c.b)*r}return}let d=0,f=0,m=0,u=0,p=0,b=0,w=0,g=J.search(a,s,7),x=this.curves[g/7];switch(x){case 0:let y=a[g];d=a[g+1],f=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];let v=(s-y)/(a[g+7]-y);d+=(a[g+7+1]-d)*v,f+=(a[g+7+2]-f)*v,m+=(a[g+7+3]-m)*v,p+=(a[g+7+4]-p)*v,b+=(a[g+7+5]-b)*v,w+=(a[g+7+6]-w)*v;break;case 1:d=a[g+1],f=a[g+2],m=a[g+3],p=a[g+4],b=a[g+5],w=a[g+6];break;default:d=this.getBezierValue(s,g,1,x-2),f=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),b=this.getBezierValue(s,g,5,x+18*4-2),w=this.getBezierValue(s,g,6,x+18*5-2)}if(r==1)h.r=d,h.g=f,h.b=m,c.r=p,c.g=b,c.b=w;else{if(l==P.setup){let y=n.data.color,v=n.data.darkColor;h.r=y.r,h.g=y.g,h.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}h.r+=(d-h.r)*r,h.g+=(f-h.g)*r,h.b+=(m-h.b)*r,c.r+=(p-c.r)*r,c.g+=(b-c.g)*r,c.b+=(w-c.b)*r}}},Fe=class extends J{slotIndex=0;attachmentNames;constructor(t,e){super(t,[U.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(n.bone.active){if(o==re.mixOut){l==P.setup&&this.setAttachment(t,n,n.data.attachmentName);return}if(s<this.frames[0]){(l==P.setup||l==P.first)&&this.setAttachment(t,n,n.data.attachmentName);return}this.setAttachment(t,n,this.attachmentNames[J.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},Rt=class extends ue{slotIndex=0;attachment;vertices;constructor(t,e,s,i){super(t,e,[U.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,r,l,o,n,a,h,c){let d=this.curves,f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);let m=(i-l*2+n)*.03,u=a*.03-o*.06,p=((l-n)*3-i+h)*.006,b=(o-a+.33333333)*.018,w=m*2+p,g=u*2+b,x=(l-i)*.3+m+p*.16666667,y=o*.3+u+b*.16666667,v=i+x,C=y;for(let A=f+18;f<A;f+=2)d[f]=v,d[f+1]=C,x+=w,y+=g,w+=p,g+=b,v+=x,C+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let n=this.frames[e];return(t-n)/(this.frames[e+this.getFrameEntries()]-n);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 r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=t){let n=s[i-2],a=s[i-1];return a+(t-n)/(s[i]-n)*(s[i+1]-a)}let l=s[r-2],o=s[r-1];return o+(1-o)*(t-l)/(this.frames[e+this.getFrameEntries()]-l)}apply(t,e,s,i,r,l,o){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof we)||a.timelineAttachment!=this.attachment)return;let h=n.deform;h.length==0&&(l=P.setup);let c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(l){case P.setup:h.length=0;return;case P.first:if(r==1){h.length=0;return}h.length=d;let g=a;if(g.bones){r=1-r;for(var m=0;m<d;m++)h[m]*=r}else{let x=g.vertices;for(var m=0;m<d;m++)h[m]+=(x[m]-h[m])*r}}return}if(h.length=d,s>=f[f.length-1]){let g=c[f.length-1];if(r==1)if(l==P.add){let x=a;if(x.bones)for(let y=0;y<d;y++)h[y]+=g[y];else{let y=x.vertices;for(let v=0;v<d;v++)h[v]+=g[v]-y[v]}}else E.arrayCopy(g,0,h,0,d);else switch(l){case P.setup:{let y=a;if(y.bones)for(let v=0;v<d;v++)h[v]=g[v]*r;else{let v=y.vertices;for(let C=0;C<d;C++){let A=v[C];h[C]=A+(g[C]-A)*r}}break}case P.first:case P.replace:for(let y=0;y<d;y++)h[y]+=(g[y]-h[y])*r;break;case P.add:let x=a;if(x.bones)for(let y=0;y<d;y++)h[y]+=g[y]*r;else{let y=x.vertices;for(let v=0;v<d;v++)h[v]+=(g[v]-y[v])*r}}return}let u=J.search1(f,s),p=this.getCurvePercent(s,u),b=c[u],w=c[u+1];if(r==1)if(l==P.add){let g=a;if(g.bones)for(let x=0;x<d;x++){let y=b[x];h[x]+=y+(w[x]-y)*p}else{let x=g.vertices;for(let y=0;y<d;y++){let v=b[y];h[y]+=v+(w[y]-v)*p-x[y]}}}else for(let g=0;g<d;g++){let x=b[g];h[g]=x+(w[g]-x)*p}else switch(l){case P.setup:{let x=a;if(x.bones)for(let y=0;y<d;y++){let v=b[y];h[y]=(v+(w[y]-v)*p)*r}else{let y=x.vertices;for(let v=0;v<d;v++){let C=b[v],A=y[v];h[v]=A+(C+(w[v]-C)*p-A)*r}}break}case P.first:case P.replace:for(let x=0;x<d;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p-h[x])*r}break;case P.add:let g=a;if(g.bones)for(let x=0;x<d;x++){let y=b[x];h[x]+=(y+(w[x]-y)*p)*r}else{let x=g.vertices;for(let y=0;y<d;y++){let v=b[y];h[y]+=(v+(w[y]-v)*p-x[y])*r}}}}},tt=class or extends J{static propertyIds=[""+U.event];events;constructor(e){super(e,or.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,i,r,l,o,n){if(!r)return;let a=this.frames,h=this.frames.length;if(s>i)this.apply(e,s,Number.MAX_VALUE,r,l,o,n),s=-1;else if(s>=a[h-1])return;if(i<a[0])return;let c=0;if(s<a[0])c=0;else{c=J.search1(a,s)+1;let d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<h&&i>=a[c];c++)r.push(this.events[c])}},Le=class lr extends J{static propertyIds=[""+U.drawOrder];drawOrders;constructor(e){super(e,lr.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,s,i){this.frames[e]=s,this.drawOrders[e]=i}apply(e,s,i,r,l,o,n){if(n==re.mixOut){o==P.setup&&E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(o==P.setup||o==P.first)&&E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let a=J.search1(this.frames,i),h=this.drawOrders[a];if(!h)E.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,d=e.slots;for(let f=0,m=h.length;f<m;f++)c[f]=d[h[f]]}}},Xt=class extends ue{constraintIndex=0;constructor(t,e,s){super(t,e,[U.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,r,l,o){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=r,this.frames[t+4]=l?1:0,this.frames[t+5]=o?1:0}apply(t,e,s,i,r,l,o){let n=t.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case P.setup:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case P.first:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let h=0,c=0,d=J.search(a,s,6),f=this.curves[d/6];switch(f){case 0:let m=a[d];h=a[d+1],c=a[d+2];let u=(s-m)/(a[d+6]-m);h+=(a[d+6+1]-h)*u,c+=(a[d+6+2]-c)*u;break;case 1:h=a[d+1],c=a[d+2];break;default:h=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}l==P.setup?(n.mix=n.data.mix+(h-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,o==re.mixOut?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0)):(n.mix+=(h-n.mix)*r,n.softness+=(c-n.softness)*r,o==re.mixIn&&(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0))}},Bt=class extends ue{constraintIndex=0;constructor(t,e,s){super(t,e,[U.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,r,l,o,n){let a=this.frames;t*=7,a[t]=e,a[t+1]=s,a[t+2]=i,a[t+3]=r,a[t+4]=l,a[t+5]=o,a[t+6]=n}apply(t,e,s,i,r,l,o){let n=t.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let w=n.data;switch(l){case P.setup:n.mixRotate=w.mixRotate,n.mixX=w.mixX,n.mixY=w.mixY,n.mixScaleX=w.mixScaleX,n.mixScaleY=w.mixScaleY,n.mixShearY=w.mixShearY;return;case P.first:n.mixRotate+=(w.mixRotate-n.mixRotate)*r,n.mixX+=(w.mixX-n.mixX)*r,n.mixY+=(w.mixY-n.mixY)*r,n.mixScaleX+=(w.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(w.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(w.mixShearY-n.mixShearY)*r}return}let h,c,d,f,m,u,p=J.search(a,s,7),b=this.curves[p/7];switch(b){case 0:let w=a[p];h=a[p+1],c=a[p+2],d=a[p+3],f=a[p+4],m=a[p+5],u=a[p+6];let g=(s-w)/(a[p+7]-w);h+=(a[p+7+1]-h)*g,c+=(a[p+7+2]-c)*g,d+=(a[p+7+3]-d)*g,f+=(a[p+7+4]-f)*g,m+=(a[p+7+5]-m)*g,u+=(a[p+7+6]-u)*g;break;case 1:h=a[p+1],c=a[p+2],d=a[p+3],f=a[p+4],m=a[p+5],u=a[p+6];break;default:h=this.getBezierValue(s,p,1,b-2),c=this.getBezierValue(s,p,2,b+18-2),d=this.getBezierValue(s,p,3,b+18*2-2),f=this.getBezierValue(s,p,4,b+18*3-2),m=this.getBezierValue(s,p,5,b+18*4-2),u=this.getBezierValue(s,p,6,b+18*5-2)}if(l==P.setup){let w=n.data;n.mixRotate=w.mixRotate+(h-w.mixRotate)*r,n.mixX=w.mixX+(c-w.mixX)*r,n.mixY=w.mixY+(d-w.mixY)*r,n.mixScaleX=w.mixScaleX+(f-w.mixScaleX)*r,n.mixScaleY=w.mixScaleY+(m-w.mixScaleY)*r,n.mixShearY=w.mixShearY+(u-w.mixShearY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r,n.mixScaleX+=(f-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(u-n.mixShearY)*r}},Et=class extends ce{constraintIndex=0;constructor(t,e,s){super(t,e,U.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,l,n.position,n.data.position))}},Lt=class extends ce{constraintIndex=0;constructor(t,e,s){super(t,e,U.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,l,n.spacing,n.data.spacing))}},Vt=class extends ue{constraintIndex=0;constructor(t,e,s){super(t,e,[U.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,r){let l=this.frames;t<<=2,l[t]=e,l[t+1]=s,l[t+2]=i,l[t+3]=r}apply(t,e,s,i,r,l,o){let n=t.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(l){case P.setup:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case P.first:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let h,c,d,f=J.search(a,s,4),m=this.curves[f>>2];switch(m){case 0:let u=a[f];h=a[f+1],c=a[f+2],d=a[f+3];let p=(s-u)/(a[f+4]-u);h+=(a[f+4+1]-h)*p,c+=(a[f+4+2]-c)*p,d+=(a[f+4+3]-d)*p;break;case 1:h=a[f+1],c=a[f+2],d=a[f+3];break;default:h=this.getBezierValue(s,f,1,m-2),c=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(l==P.setup){let u=n.data;n.mixRotate=u.mixRotate+(h-u.mixRotate)*r,n.mixX=u.mixX+(c-u.mixX)*r,n.mixY=u.mixY+(d-u.mixY)*r}else n.mixRotate+=(h-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r}},Te=class extends ce{constraintIndex=0;constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=s}apply(t,e,s,i,r,l,o){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const h of t.physicsConstraints)h.active&&this.global(h.data)&&this.set(h,this.getAbsoluteValue2(s,r,l,this.get(h),this.setup(h),a))}else n=t.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,l,this.get(n),this.setup(n)))}},Dt=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},Nt=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},Ot=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},_t=class extends Te{constructor(t,e,s){super(t,e,s,U.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}},Ut=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},qt=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},Wt=class extends Te{constructor(t,e,s){super(t,e,s,U.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},zt=class hr extends J{static propertyIds=[U.physicsConstraintReset.toString()];constraintIndex;constructor(e,s){super(e,hr.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,i,r,l,o,n){let a;if(this.constraintIndex!=-1&&(a=e.physicsConstraints[this.constraintIndex],!a.active))return;const h=this.frames;if(s>i)this.apply(e,s,Number.MAX_VALUE,[],l,o,n),s=-1;else if(s>=h[h.length-1])return;if(!(i<h[0])&&(s<h[0]||i>=h[J.search1(h,s)+1]))if(a!=null)a.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},Gt=class Me extends J{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,i){super(e,[U.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return Me.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,i,r,l){let o=this.frames;e*=Me.ENTRIES,o[e]=s,o[e+Me.MODE]=i|r<<4,o[e+Me.DELAY]=l}apply(e,s,i,r,l,o,n){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let h=a.attachment,c=this.attachment;if(h!=c&&(!(h instanceof we)||h.timelineAttachment!=c))return;if(n==re.mixOut){o==P.setup&&(a.sequenceIndex=-1);return}let d=this.frames;if(i<d[0]){(o==P.setup||o==P.first)&&(a.sequenceIndex=-1);return}let f=J.search(d,i,Me.ENTRIES),m=d[f],u=d[f+Me.MODE],p=d[f+Me.DELAY];if(!this.attachment.sequence)return;let b=u>>4,w=this.attachment.sequence.regions.length,g=Fs[u&15];if(g!=se.hold)switch(b+=(i-m)/p+1e-5|0,g){case se.once:b=Math.min(w-1,b);break;case se.loop:b%=w;break;case se.pingpong:{let x=(w<<1)-2;b=x==0?0:b%x,b>=w&&(b=x-b);break}case se.onceReverse:b=Math.max(w-1-b,0);break;case se.loopReverse:b=w-1-b%w;break;case se.pingpongReverse:{let x=(w<<1)-2;b=x==0?0:(b+w-1)%x,b>=w&&(b=x-b)}}a.sequenceIndex=b}},Ht=class ct{static _emptyAnimation=new Ze("<empty>",[],0);static emptyAnimation(){return ct._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Rs(this);propertyIDs=new gt;animationsChanged=!1;trackEntryPool=new Ee(()=>new Ps);constructor(e){this.data=e}update(e){e*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(!l)continue;l.animationLast=l.nextAnimationLast,l.trackLast=l.nextTrackLast;let o=e*l.timeScale;if(l.delay>0){if(l.delay-=o,l.delay>0)continue;o=-l.delay,l.delay=0}let n=l.next;if(n){let a=l.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=l.timeScale==0?0:(a/l.timeScale+e)*n.timeScale,l.trackTime+=o,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=e,n=n.mixingFrom;continue}}else if(l.trackLast>=l.trackEnd&&!l.mixingFrom){s[i]=null,this.queue.end(l),this.clearNext(l);continue}if(l.mixingFrom&&this.updateMixingFrom(l,e)){let a=l.mixingFrom;for(l.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}l.trackTime+=o}this.queue.drain()}updateMixingFrom(e,s){let i=e.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,e.mixTime+=s,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let f=0,m=i.length;f<m;f++){let u=i[f];if(!u||u.delay>0)continue;r=!0;let p=f==0?P.first:u.mixBlend,b=u.alpha;u.mixingFrom?b*=this.applyMixingFrom(u,e,p):u.trackTime>=u.trackEnd&&!u.next&&(b=0);let w=b>=u.alphaAttachmentThreshold,g=u.animationLast,x=u.getAnimationTime(),y=x,v=s;u.reverse&&(y=u.animation.duration-y,v=null);let C=u.animation.timelines,A=C.length;if(f==0&&b==1||p==P.add){f==0&&(w=!0);for(let k=0;k<A;k++){E.webkit602BugfixHelper(b,p);var l=C[k];l instanceof Fe?this.applyAttachmentTimeline(l,e,y,p,w):l.apply(e,g,y,v,b,p,re.mixIn)}}else{let k=u.timelineMode,T=u.shortestRotation,Y=!T&&u.timelinesRotation.length!=A<<1;Y&&(u.timelinesRotation.length=A<<1);for(let M=0;M<A;M++){let R=C[M],X=k[M]==st?p:P.setup;!T&&R instanceof We?this.applyRotateTimeline(R,e,y,b,X,u.timelinesRotation,M<<1,Y):R instanceof Fe?this.applyAttachmentTimeline(R,e,y,p,w):(E.webkit602BugfixHelper(b,p),R.apply(e,g,y,v,b,X,re.mixIn))}}this.queueEvents(u,x),s.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var o=this.unkeyedState+Jt,n=e.slots,a=0,h=e.slots.length;a<h;a++){var c=n[a];if(c.attachmentState==o){var d=c.data.attachmentName;c.setAttachment(d?e.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,s,i){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let l=0;e.mixDuration==0?(l=1,i==P.first&&(i=P.setup)):(l=e.mixTime/e.mixDuration,l>1&&(l=1),i!=P.first&&(i=r.mixBlend));let o=l<r.mixAttachmentThreshold,n=l<r.mixDrawOrderThreshold,a=r.animation.timelines,h=a.length,c=r.alpha*e.interruptAlpha,d=c*(1-l),f=r.animationLast,m=r.getAnimationTime(),u=m,p=null;if(r.reverse?u=r.animation.duration-u:l<r.eventThreshold&&(p=this.events),i==P.add)for(let b=0;b<h;b++)a[b].apply(s,f,u,p,d,i,re.mixOut);else{let b=r.timelineMode,w=r.timelineHoldMix,g=r.shortestRotation,x=!g&&r.timelinesRotation.length!=h<<1;x&&(r.timelinesRotation.length=h<<1),r.totalAlpha=0;for(let y=0;y<h;y++){let v=a[y],C=re.mixOut,A,k=0;switch(b[y]){case st:if(!n&&v instanceof Le)continue;A=i,k=d;break;case $t:A=P.setup,k=d;break;case jt:A=i,k=c;break;case rt:A=P.setup,k=c;break;default:A=P.setup;let T=w[y];k=c*Math.max(0,1-T.mixTime/T.mixDuration);break}r.totalAlpha+=k,!g&&v instanceof We?this.applyRotateTimeline(v,s,u,k,A,r.timelinesRotation,y<<1,x):v instanceof Fe?this.applyAttachmentTimeline(v,s,u,A,o&&k>=r.alphaAttachmentThreshold):(E.webkit602BugfixHelper(k,i),n&&v instanceof Le&&A==P.setup&&(C=re.mixIn),v.apply(s,f,u,p,k,A,C))}}return e.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,l}applyAttachmentTimeline(e,s,i,r,l){var o=s.slots[e.slotIndex];o.bone.active&&(i<e.frames[0]?(r==P.setup||r==P.first)&&this.setAttachment(s,o,o.data.attachmentName,l):this.setAttachment(s,o,e.attachmentNames[J.search1(e.frames,i)],l),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+Jt))}setAttachment(e,s,i,r){s.setAttachment(i?e.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+Bs)}applyRotateTimeline(e,s,i,r,l,o,n,a){if(a&&(o[n]=0),r==1){e.apply(s,0,i,null,1,l,re.mixIn);return}let h=s.bones[e.boneIndex];if(!h.active)return;let c=e.frames,d=0,f=0;if(i<c[0])switch(l){case P.setup:h.rotation=h.data.rotation;default:return;case P.first:d=h.rotation,f=h.data.rotation}else d=l==P.setup?h.data.rotation:h.rotation,f=h.data.rotation+e.getCurveValue(i);let m=0,u=f-d;if(u-=Math.ceil(u/360-.5)*360,u==0)m=o[n];else{let p=0,b=0;a?(p=0,b=u):(p=o[n],b=o[n+1]);let w=p-p%360;m=u+w;let g=u>=0,x=p>=0;Math.abs(b)<=90&&B.signum(b)!=B.signum(u)&&(Math.abs(p-w)>180?(m+=360*B.signum(p),x=g):w!=0?m-=360*B.signum(p):x=g),x!=g&&(m+=360*B.signum(p)),o[n]=m}o[n+1]=u,h.rotation=d+m*r}queueEvents(e,s){let i=e.animationStart,r=e.animationEnd,l=r-i,o=e.trackLast%l,n=this.events,a=0,h=n.length;for(;a<h;a++){let d=n[a];if(d.time<o)break;d.time>r||this.queue.event(e,d)}let c=!1;if(e.loop)if(l==0)c=!0;else{const d=Math.floor(e.trackTime/l);c=d>0&&d>Math.floor(e.trackLast/l)}else c=s>=r&&e.animationLast<r;for(c&&this.queue.complete(e);a<h;a++){let d=n[a];d.time<i||this.queue.event(e,d)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(e,s,i){let r=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(e,r,i)}setAnimationWith(e,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,l=this.expandToIndex(e);l&&(l.nextTrackLast==-1?(this.tracks[e]=l.mixingFrom,this.queue.interrupt(l),this.queue.end(l),this.clearNext(l),l=l.mixingFrom,r=!1):this.clearNext(l));let o=this.trackEntry(e,s,i,l);return this.setCurrent(e,o,r),this.queue.drain(),o}addAnimation(e,s,i=!1,r=0){let l=this.data.skeletonData.findAnimation(s);if(!l)throw new Error("Animation not found: "+s);return this.addAnimationWith(e,l,i,r)}addAnimationWith(e,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let l=this.expandToIndex(e);if(l)for(;l.next;)l=l.next;let o=this.trackEntry(e,s,i,l);return l?(l.next=o,o.previous=l,r<=0&&(r=Math.max(r+l.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),r<0&&(r=0)),o.delay=r,o}setEmptyAnimation(e,s=0){let i=this.setAnimationWith(e,ct.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(e,s=0,i=0){let r=this.addAnimationWith(e,ct.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(e=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let l=this.tracks[i];l&&this.setEmptyAnimation(l.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(E.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,i,r){let l=this.trackEntryPool.obtain();return l.reset(),l.trackIndex=e,l.animation=s,l.loop=i,l.holdPrevious=!1,l.reverse=!1,l.shortestRotation=!1,l.eventThreshold=0,l.alphaAttachmentThreshold=0,l.mixAttachmentThreshold=0,l.mixDrawOrderThreshold=0,l.animationStart=0,l.animationEnd=s.duration,l.animationLast=-1,l.nextAnimationLast=-1,l.delay=0,l.trackTime=0,l.trackLast=-1,l.nextTrackLast=-1,l.trackEnd=Number.MAX_VALUE,l.timeScale=1,l.alpha=1,l.mixTime=0,l.mixDuration=r?this.data.getMix(r.animation,s):0,l.interruptAlpha=1,l.totalAlpha=0,l.mixBlend=P.replace,l}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=P.add)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let s=e.mixingTo,i=e.animation.timelines,r=e.animation.timelines.length,l=e.timelineMode;l.length=r;let o=e.timelineHoldMix;o.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<r;a++)l[a]=n.addAll(i[a].getPropertyIds())?rt:jt;return}e:for(let a=0;a<r;a++){let h=i[a],c=h.getPropertyIds();if(!n.addAll(c))l[a]=st;else if(!s||h instanceof Fe||h instanceof Le||h instanceof tt||!s.animation.hasTimeline(c))l[a]=$t;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){l[a]=Xs,o[a]=d;continue e}break}l[a]=rt}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ps=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}mixBlend=P.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 t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Rs=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(le.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(le.interrupt),this.objects.push(t)}end(t){this.objects.push(le.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(le.dispose),this.objects.push(t)}complete(t){this.objects.push(le.complete),this.objects.push(t)}event(t,e){this.objects.push(le.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],r=t[s+1];switch(i){case le.start:r.listener&&r.listener.start&&r.listener.start(r);for(let o=0;o<e.length;o++){let n=e[o];n.start&&n.start(r)}break;case le.interrupt:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<e.length;o++){let n=e[o];n.interrupt&&n.interrupt(r)}break;case le.end:r.listener&&r.listener.end&&r.listener.end(r);for(let o=0;o<e.length;o++){let n=e[o];n.end&&n.end(r)}case le.dispose:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<e.length;o++){let n=e[o];n.dispose&&n.dispose(r)}this.animState.trackEntryPool.free(r);break;case le.complete:r.listener&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<e.length;o++){let n=e[o];n.complete&&n.complete(r)}break;case le.event:let l=t[s+++2];r.listener&&r.listener.event&&r.listener.event(r,l);for(let o=0;o<e.length;o++){let n=e[o];n.event&&n.event(r,l)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},le;(function(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"})(le||(le={}));var vr=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},st=0,$t=1,jt=2,rt=3,Xs=4,Jt=1,Bs=2,Es=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);this.setMixWith(i,r,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},Kt=class cr extends we{color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new cr(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},Pe=class dr extends we{endSlot=null;color=new N(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new dr(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Qt=class{_image;constructor(t){this._image=t}getImage(){return this._image}},te;(function(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"})(te||(te={}));var ye;(function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"})(ye||(ye={}));var Ls=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Cr=class extends Qt{setFilters(t,e){}setWraps(t,e){}dispose(){}},it=class{pages=new Array;regions=new Array;constructor(t){let e=new Ar(t),s=new Array(4),i={};i.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},i.format=()=>{},i.filter=h=>{h.minFilter=E.enumValue(te,s[1]),h.magFilter=E.enumValue(te,s[2])},i.repeat=h=>{s[1].indexOf("x")!=-1&&(h.uWrap=ye.Repeat),s[1].indexOf("y")!=-1&&(h.vWrap=ye.Repeat)},i.pma=h=>{h.pma=s[1]=="true"};var r={};r.xy=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2])},r.size=h=>{h.width=parseInt(s[1]),h.height=parseInt(s[2])},r.bounds=h=>{h.x=parseInt(s[1]),h.y=parseInt(s[2]),h.width=parseInt(s[3]),h.height=parseInt(s[4])},r.offset=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2])},r.orig=h=>{h.originalWidth=parseInt(s[1]),h.originalHeight=parseInt(s[2])},r.offsets=h=>{h.offsetX=parseInt(s[1]),h.offsetY=parseInt(s[2]),h.originalWidth=parseInt(s[3]),h.originalHeight=parseInt(s[4])},r.rotate=h=>{let c=s[1];c=="true"?h.degrees=90:c!="false"&&(h.degrees=parseInt(c))},r.index=h=>{h.index=parseInt(s[1])};let l=e.readLine();for(;l&&l.trim().length==0;)l=e.readLine();for(;!(!l||l.trim().length==0||e.readEntry(s,l)==0);)l=e.readLine();let o=null,n=null,a=null;for(;l!==null;)if(l.trim().length==0)o=null,l=e.readLine();else if(o){let h=new Zt(o,l);for(;;){let c=e.readEntry(s,l=e.readLine());if(c==0)break;let d=r[s[0]];if(d)d(h);else{n||(n=[]),a||(a=[]),n.push(s[0]);let f=[];for(let m=0;m<c;m++)f.push(parseInt(s[m+1]));a.push(f)}}h.originalWidth==0&&h.originalHeight==0&&(h.originalWidth=h.width,h.originalHeight=h.height),n&&n.length>0&&a&&a.length>0&&(h.names=n,h.values=a,n=null,a=null),h.u=h.x/o.width,h.v=h.y/o.height,h.degrees==90?(h.u2=(h.x+h.height)/o.width,h.v2=(h.y+h.width)/o.height):(h.u2=(h.x+h.width)/o.width,h.v2=(h.y+h.height)/o.height),this.regions.push(h)}else{for(o=new Vs(l.trim());e.readEntry(s,l=e.readLine())!=0;){let h=i[s[0]];h&&h(o)}this.pages.push(o)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},Ar=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let i=1,r=s+1;;i++){let l=e.indexOf(",",r);if(l==-1)return t[i]=e.substr(r).trim(),i;if(t[i]=e.substr(r,l-r).trim(),r=l+1,i==4)return 4}}},Vs=class{name;minFilter=te.Nearest;magFilter=te.Nearest;uWrap=ye.ClampToEdge;vWrap=ye.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}},Zt=class extends Ls{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)}},me=class ws extends we{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new N(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new N(0,0,0,0);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=E.newFloatArray(e.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,l=this.region.v,o=0,n=0;if(this.region instanceof Zt){let a=this.region,h=a.page,c=h.width,d=h.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,l-=(a.originalWidth-a.offsetX-a.width)/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let f=0;f<i;f+=2)s[f]=r+e[f+1]*o,s[f+1]=l+(1-e[f])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,l-=a.offsetY/d,o=a.originalWidth/c,n=a.originalHeight/d;for(let f=0;f<i;f+=2)s[f]=r+(1-e[f])*o,s[f+1]=l+(1-e[f+1])*n;return;case 270:r-=a.offsetY/c,l-=a.offsetX/d,o=a.originalHeight/c,n=a.originalWidth/d;for(let f=0;f<i;f+=2)s[f]=r+(1-e[f+1])*o,s[f+1]=l+e[f]*n;return}r-=a.offsetX/c,l-=(a.originalHeight-a.offsetY-a.height)/d,o=a.originalWidth/c,n=a.originalHeight/d}else this.region?(o=this.region.u2-r,n=this.region.v2-l):(r=l=0,o=n=1);for(let a=0;a<i;a+=2)s[a]=r+e[a]*o,s[a+1]=l+e[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new ws(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),E.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?E.newFloatArray(this.uvs.length):new Array(this.uvs.length),E.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),E.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),E.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,s,i,r,l,o){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,s,i,r,l,o)}newLinkedMesh(){let e=new ws(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},Ve=class fr extends we{lengths=[];closed=!1;constantSpeed=!1;color=new N(1,1,1,1);constructor(e){super(e)}copy(){let e=new fr(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),E.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Ds=class ur extends we{x=0;y=0;rotation=0;color=new N(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*B.degRad,i=Math.cos(s),r=Math.sin(s),l=i*e.a+r*e.b,o=i*e.c+r*e.d;return B.atan2Deg(o,l)}copy(){let e=new ur(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},W=class mr extends pt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new N(1,1,1,1);path;region=null;sequence=null;offset=E.newFloatArray(8);uvs=E.newFloatArray(8);tempColor=new N(1,1,1,1);constructor(e,s){super(e),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,s=this.uvs;if(e==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,l=-this.width/2*this.scaleX+this.region.offsetX*i,o=-this.height/2*this.scaleY+this.region.offsetY*r,n=l+this.region.width*i,a=o+this.region.height*r,h=this.rotation*B.degRad,c=Math.cos(h),d=Math.sin(h),f=this.x,m=this.y,u=l*c+f,p=l*d,b=o*c+m,w=o*d,g=n*c+f,x=n*d,y=a*c+m,v=a*d,C=this.offset;C[0]=u-w,C[1]=b+p,C[2]=u-v,C[3]=y+p,C[4]=g-v,C[5]=y+x,C[6]=g-w,C[7]=b+x,e.degrees==90?(s[0]=e.u2,s[1]=e.v2,s[2]=e.u,s[3]=e.v2,s[4]=e.u,s[5]=e.v,s[6]=e.u2,s[7]=e.v):(s[0]=e.u,s[1]=e.v2,s[2]=e.u,s[3]=e.v,s[4]=e.u2,s[5]=e.v,s[6]=e.u2,s[7]=e.v2)}computeWorldVertices(e,s,i,r){this.sequence!=null&&this.sequence.apply(e,this);let l=e.bone,o=this.offset,n=l.worldX,a=l.worldY,h=l.a,c=l.b,d=l.c,f=l.d,m=0,u=0;m=o[0],u=o[1],s[i]=m*h+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=o[2],u=o[3],s[i]=m*h+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=o[4],u=o[5],s[i]=m*h+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=o[6],u=o[7],s[i]=m*h+u*c+n,s[i+1]=m*d+u*f+a}copy(){let e=new mr(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,E.arrayCopy(this.uvs,0,e.uvs,0,8),E.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Ns=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let r=0,l=i.length;r<l;r++){let o=s.getPath(e,r),n=this.atlas.findRegion(o);if(n==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+t+")");i[r]=n}}newRegionAttachment(t,e,s,i){let r=new W(e,s);if(i!=null)this.loadSequence(e,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");r.region=l}return r}newMeshAttachment(t,e,s,i){let r=new me(e,s);if(i!=null)this.loadSequence(e,s,i);else{let l=this.atlas.findRegion(s);if(!l)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");r.region=l}return r}newBoundingBoxAttachment(t,e){return new Kt(e)}newPathAttachment(t,e){return new Ve(e)}newPointAttachment(t,e){return new Ds(e)}newClippingAttachment(t,e){return new Pe(e)}},es=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=Q.Normal;skinRequired=!1;color=new N;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}},Q;(function(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"})(Q||(Q={}));var ts=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=Q.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,i,r,l,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=l,this.ashearY=o;let n=this.parent;if(!n){let f=this.skeleton;const m=f.scaleX,u=f.scaleY,p=(s+l)*B.degRad,b=(s+90+o)*B.degRad;this.a=Math.cos(p)*i*m,this.b=Math.cos(b)*r*m,this.c=Math.sin(p)*i*u,this.d=Math.sin(b)*r*u,this.worldX=t*m+f.x,this.worldY=e*u+f.y;return}let a=n.a,h=n.b,c=n.c,d=n.d;switch(this.worldX=a*t+h*e+n.worldX,this.worldY=c*t+d*e+n.worldY,this.inherit){case Q.Normal:{const f=(s+l)*B.degRad,m=(s+90+o)*B.degRad,u=Math.cos(f)*i,p=Math.cos(m)*r,b=Math.sin(f)*i,w=Math.sin(m)*r;this.a=a*u+h*b,this.b=a*p+h*w,this.c=c*u+d*b,this.d=c*p+d*w;return}case Q.OnlyTranslation:{const f=(s+l)*B.degRad,m=(s+90+o)*B.degRad;this.a=Math.cos(f)*i,this.b=Math.cos(m)*r,this.c=Math.sin(f)*i,this.d=Math.sin(m)*r;break}case Q.NoRotationOrReflection:{let f=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=f,c*=m;let u=a*a+c*c,p=0;u>1e-4?(u=Math.abs(a*d*m-h*f*c)/u,h=c*u,d=a*u,p=Math.atan2(c,a)*B.radDeg):(a=0,c=0,p=90-Math.atan2(d,h)*B.radDeg);const b=(s+l-p)*B.degRad,w=(s+o-p+90)*B.degRad,g=Math.cos(b)*i,x=Math.cos(w)*r,y=Math.sin(b)*i,v=Math.sin(w)*r;this.a=a*g-h*y,this.b=a*x-h*v,this.c=c*g+d*y,this.d=c*x+d*v;break}case Q.NoScale:case Q.NoScaleOrReflection:{s*=B.degRad;const f=Math.cos(s),m=Math.sin(s);let u=(a*f+h*m)/this.skeleton.scaleX,p=(c*f+d*m)/this.skeleton.scaleY,b=Math.sqrt(u*u+p*p);b>1e-5&&(b=1/b),u*=b,p*=b,b=Math.sqrt(u*u+p*p),this.inherit==Q.NoScale&&a*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(p,u);const w=Math.cos(s)*b,g=Math.sin(s)*b;l*=B.degRad,o=(90+o)*B.degRad;const x=Math.cos(l)*i,y=Math.cos(o)*r,v=Math.sin(l)*i,C=Math.sin(o)*r;this.a=u*x+w*v,this.b=u*y+w*C,this.c=p*x+g*v,this.d=p*y+g*C;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*B.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*B.radDeg;return}let e=t.a,s=t.b,i=t.c,r=t.d,l=1/(e*r-s*i),o=r*l,n=s*l,a=i*l,h=e*l,c=this.worldX-t.worldX,d=this.worldY-t.worldY;this.ax=c*o-d*n,this.ay=d*h-c*a;let f,m,u,p;if(this.inherit==Q.OnlyTranslation)f=this.a,m=this.b,u=this.c,p=this.d;else{switch(this.inherit){case Q.NoRotationOrReflection:{let y=Math.abs(e*r-s*i)/(e*e+i*i);s=-i*this.skeleton.scaleX*y/this.skeleton.scaleY,r=e*this.skeleton.scaleY*y/this.skeleton.scaleX,l=1/(e*r-s*i),o=r*l,n=s*l;break}case Q.NoScale:case Q.NoScaleOrReflection:let b=B.cosDeg(this.rotation),w=B.sinDeg(this.rotation);e=(e*b+s*w)/this.skeleton.scaleX,i=(i*b+r*w)/this.skeleton.scaleY;let g=Math.sqrt(e*e+i*i);g>1e-5&&(g=1/g),e*=g,i*=g,g=Math.sqrt(e*e+i*i),this.inherit==Q.NoScale&&l<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let x=B.PI/2+Math.atan2(i,e);s=Math.cos(x)*g,r=Math.sin(x)*g,l=1/(e*r-s*i),o=r*l,n=s*l,a=i*l,h=e*l}f=o*this.a-n*this.c,m=o*this.b-n*this.d,u=h*this.c-a*this.a,p=h*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+u*u),this.ascaleX>1e-4){let b=f*p-m*u;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(f*m+u*p,b)*B.radDeg,this.arotation=Math.atan2(u,f)*B.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,m)*B.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*B.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*B.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*B.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=B.sinDeg(t),s=B.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*B.radDeg}rotateWorld(t){t*=B.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,r=this.b;this.a=s*i-e*this.c,this.b=s*r-e*this.d,this.c=e*i+s*this.c,this.d=e*r+s*this.d}},ze=class{name;order;skinRequired;constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},Sr=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",s=new _s,i=new Os){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=i}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadBinary(t,l=>{this.success(e,t,l),i(l)},(l,o)=>{const n=`Couldn't load binary ${t}: status ${l}, ${o}`;this.error(s,t,n),r(n)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,i=>{this.success(e,t,i)},(i,r)=>{this.error(s,t,`Couldn't load text ${t}: status ${i}, ${r}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{this.downloader.downloadJson(t,l=>{this.success(e,t,l),i(l)},(l,o)=>{const n=`Couldn't load JSON ${t}: status ${l}, ${o}`;this.error(s,t,n),r(n)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[t],r=i!==void 0;return r&&(this.cache.assetsLoaded[t]=i.then(l=>(l=l instanceof Image||l instanceof ImageBitmap?this.textureLoader(l):l,this.success(e,t,l),l)).catch(l=>this.error(s,t,l))),r}loadTexture(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(t,n);this.success(e,t,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(t,n);this.success(e,t,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),n.src=t}}))}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let r=t.lastIndexOf("/"),l=r>=0?t.substring(0,r+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((o,n)=>{this.downloader.downloadText(t,a=>{try{const h=this.createTextureAtlas(t,a);let c=h.pages.length,d=!1;for(let f of h.pages)this.loadTexture(i?i[f.name]:l+f.name,(m,u)=>{d||(f.setTexture(u),--c==0&&(this.success(e,t,h),o(h)))},(m,u)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${m}`;this.error(s,t,p),n(p)}d=!0})}catch(h){const c=`Couldn't parse texture atlas ${t}: ${h.message}`;this.error(s,t,c),n(c)}},(a,h)=>{const c=`Couldn't load texture atlas ${t}: status ${a}, ${h}`;this.error(s,t,c),n(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{},i){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,l)=>{this.downloader.downloadText(t,o=>{try{const n=this.createTextureAtlas(t,o);this.success(e,t,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${t}: ${n.message}`;this.error(s,t,a),l(a)}},(o,n)=>{const a=`Couldn't load texture atlas ${t}: status ${o}, ${n}`;this.error(s,t,a),l(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(i,r)=>e(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(i,r)=>e(r),(i,r)=>s(r))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?`
|
|
2
|
+
`+s:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof it){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e){const s=new it(e);return s.dispose=()=>{if(!(this.cache.assetsRefCount[t]<=0)){this.disposeAssetInternal(t);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(t,e){const s=this.textureLoader(e),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(t)&&i()},s}},Os=class dt{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=dt.AVAILABLE_CACHES.get(e);if(s)return s;const i=new dt;return dt.AVAILABLE_CACHES.set(e,i),i}async addAsset(e,s){this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=await s}},_s=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=e.charCodeAt(r);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToString(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||t,!0);let l=()=>{this.finish(t,r.status,r.responseText)};r.onload=l,r.onerror=l,r.send()}downloadJson(t,e,s){this.downloadText(t,i=>{e(JSON.parse(i))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const i=this.rawDataUris[t];if(i&&!i.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(i))}catch(o){this.finish(t,400,JSON.stringify(o))}return}let r=new XMLHttpRequest;r.open("GET",i||t,!0),r.responseType="arraybuffer";let l=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(t,200,new Uint8Array(r.response)):l()},r.onerror=l,r.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let r=e==200||e==0?[s]:[e,s];for(let l=r.length-1,o=i.length;l<o;l+=2)i[l].apply(null,r)}},ss=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}},rs=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},Us=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,s,i,r,l,o){let n=t.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,h=n.b,c=n.c,d=n.d,f=-t.ashearX-t.arotation,m=0,u=0;switch(t.inherit){case Q.OnlyTranslation:m=(e-t.worldX)*B.signum(t.skeleton.scaleX),u=(s-t.worldY)*B.signum(t.skeleton.scaleY);break;case Q.NoRotationOrReflection:let w=Math.abs(a*d-h*c)/Math.max(1e-4,a*a+c*c),g=a/t.skeleton.scaleX,x=c/t.skeleton.scaleY;h=-x*w*t.skeleton.scaleX,d=g*w*t.skeleton.scaleY,f+=Math.atan2(x,g)*B.radDeg;default:let y=e-n.worldX,v=s-n.worldY,C=a*d-h*c;Math.abs(C)<=1e-4?(m=0,u=0):(m=(y*d-v*h)/C-t.ax,u=(v*a-y*c)/C-t.ay)}f+=Math.atan2(u,m)*B.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let p=t.ascaleX,b=t.ascaleY;if(i||r){switch(t.inherit){case Q.NoScale:case Q.NoScaleOrReflection:m=e-t.worldX,u=s-t.worldY}const w=t.data.length*p;if(w>1e-4){const g=m*m+u*u;if(i&&g<w*w||r&&g>w*w){const x=(Math.sqrt(g)/w-1)*o+1;p*=x,l&&(b*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,p,b,t.ashearX,t.ashearY)}apply2(t,e,s,i,r,l,o,n,a){if(t.inherit!=Q.Normal||e.inherit!=Q.Normal)return;let h=t.ax,c=t.ay,d=t.ascaleX,f=t.ascaleY,m=d,u=f,p=e.ascaleX,b=0,w=0,g=0;d<0?(d=-d,b=180,g=-1):(b=0,g=1),f<0&&(f=-f,g=-g),p<0?(p=-p,w=180):w=0;let x=e.ax,y=0,v=0,C=0,A=t.a,k=t.b,T=t.c,Y=t.d,M=Math.abs(d-f)<=1e-4;!M||l?(y=0,v=A*x+t.worldX,C=T*x+t.worldY):(y=e.ay,v=A*x+k*y+t.worldX,C=T*x+Y*y+t.worldY);let R=t.parent;if(!R)throw new Error("IK parent must itself have a parent.");A=R.a,k=R.b,T=R.c,Y=R.d;let X=A*Y-k*T,I=v-R.worldX,F=C-R.worldY;X=Math.abs(X)<=1e-4?0:1/X;let L=(I*Y-F*k)*X-h,O=(F*A-I*T)*X-c,D=Math.sqrt(L*L+O*O),_=e.data.length*p,j,G;if(D<1e-4){this.apply1(t,s,i,!1,l,!1,a),e.updateWorldTransformWith(x,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}I=s-R.worldX,F=i-R.worldY;let K=(I*Y-F*k)*X-h,V=(F*A-I*T)*X-c,q=K*K+V*V;if(n!=0){n*=d*(p+1)*.5;let Z=Math.sqrt(q),ie=Z-D-_*d+n;if(ie>0){let ne=Math.min(1,ie/(n*2))-1;ne=(ie-n*(1-ne*ne))/Z,K-=ne*K,V-=ne*V,q=K*K+V*V}}e:if(M){_*=d;let Z=(q-D*D-_*_)/(2*D*_);Z<-1?(Z=-1,G=Math.PI*r):Z>1?(Z=1,G=0,l&&(A=(Math.sqrt(q)/(D+_)-1)*a+1,m*=A,o&&(u*=A))):G=Math.acos(Z)*r,A=D+_*Z,k=_*Math.sin(G),j=Math.atan2(V*A-K*k,K*A+V*k)}else{A=d*_,k=f*_;let Z=A*A,ie=k*k,ne=Math.atan2(V,K);T=ie*D*D+Z*q-Z*ie;let fe=-2*ie*D,Xe=ie-Z;if(Y=fe*fe-4*Xe*T,Y>=0){let Be=Math.sqrt(Y);fe<0&&(Be=-Be),Be=-(fe+Be)*.5;let Ue=Be/Xe,Ts=T/Be,Qe=Math.abs(Ue)<Math.abs(Ts)?Ue:Ts;if(Ue=q-Qe*Qe,Ue>=0){F=Math.sqrt(Ue)*r,j=ne-Math.atan2(F,Qe),G=Math.atan2(F/f,(Qe-D)/d);break e}}let _e=B.PI,Je=D-A,ut=Je*Je,As=0,Ss=0,Ke=D+A,mt=Ke*Ke,ks=0;T=-A*D/(Z-ie),T>=-1&&T<=1&&(T=Math.acos(T),I=A*Math.cos(T)+D,F=k*Math.sin(T),Y=I*I+F*F,Y<ut&&(_e=T,ut=Y,Je=I,As=F),Y>mt&&(Ss=T,mt=Y,Ke=I,ks=F)),q<=(ut+mt)*.5?(j=ne-Math.atan2(As*r,Je),G=_e*r):(j=ne-Math.atan2(ks*r,Ke),G=Ss*r)}let $=Math.atan2(y,x)*g,oe=t.arotation;j=(j-$)*B.radDeg+b-oe,j>180?j-=360:j<-180&&(j+=360),t.updateWorldTransformWith(h,c,oe+j*a,m,u,0,0),oe=e.arotation,G=((G+$)*B.radDeg-e.ashearX)*g+w-oe,G>180?G-=360:G<-180&&(G+=360),e.updateWorldTransformWith(x,y,oe+G*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},is=class extends ze{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)}},ns=class extends ze{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=ge.Fixed;spacingMode=ee.Fixed;rotateMode=Ie.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},ge;(function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"})(ge||(ge={}));var ee;(function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"})(ee||(ee={}));var Ie;(function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"})(Ie||(Ie={}));var qs=class Ye{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,s){if(!e)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0,l=e.bones.length;r<l;r++){let o=s.findBone(e.bones[r].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(o)}let i=s.findSlot(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=i,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let s=this.target.getAttachment();if(!(s instanceof Ve))return;let i=this.mixRotate,r=this.mixX,l=this.mixY;if(i==0&&r==0&&l==0)return;let o=this.data,n=o.rotateMode==Ie.Tangent,a=o.rotateMode==Ie.ChainScale,h=this.bones,c=h.length,d=n?c:c+1,f=E.setArraySize(this.spaces,d),m=a?this.lengths=E.setArraySize(this.lengths,c):[],u=this.spacing;switch(o.spacingMode){case ee.Percent:if(a)for(let C=0,A=d-1;C<A;C++){let k=h[C],T=k.data.length,Y=T*k.a,M=T*k.c;m[C]=Math.sqrt(Y*Y+M*M)}E.arrayFill(f,1,d,u);break;case ee.Proportional:let y=0;for(let C=0,A=d-1;C<A;){let k=h[C],T=k.data.length;if(T<Ye.epsilon)a&&(m[C]=0),f[++C]=u;else{let Y=T*k.a,M=T*k.c,R=Math.sqrt(Y*Y+M*M);a&&(m[C]=R),f[++C]=R,y+=R}}if(y>0){y=d/y*u;for(let C=1;C<d;C++)f[C]*=y}break;default:let v=o.spacingMode==ee.Length;for(let C=0,A=d-1;C<A;){let k=h[C],T=k.data.length;if(T<Ye.epsilon)a&&(m[C]=0),f[++C]=u;else{let Y=T*k.a,M=T*k.c,R=Math.sqrt(Y*Y+M*M);a&&(m[C]=R),f[++C]=(v?T+u:u)*R/T}}}let p=this.computeWorldPositions(s,d,n),b=p[0],w=p[1],g=o.offsetRotation,x=!1;if(g==0)x=o.rotateMode==Ie.Chain;else{x=!1;let y=this.target.bone;g*=y.a*y.d-y.b*y.c>0?B.degRad:-B.degRad}for(let y=0,v=3;y<c;y++,v+=3){let C=h[y];C.worldX+=(b-C.worldX)*r,C.worldY+=(w-C.worldY)*l;let A=p[v],k=p[v+1],T=A-b,Y=k-w;if(a){let M=m[y];if(M!=0){let R=(Math.sqrt(T*T+Y*Y)/M-1)*i+1;C.a*=R,C.c*=R}}if(b=A,w=k,i>0){let M=C.a,R=C.b,X=C.c,I=C.d,F=0,L=0,O=0;if(n?F=p[v-1]:f[y+1]==0?F=p[v+2]:F=Math.atan2(Y,T),F-=Math.atan2(X,M),x){L=Math.cos(F),O=Math.sin(F);let D=C.data.length;b+=(D*(L*M-O*X)-T)*i,w+=(D*(O*M+L*X)-Y)*i}else F+=g;F>B.PI?F-=B.PI2:F<-B.PI&&(F+=B.PI2),F*=i,L=Math.cos(F),O=Math.sin(F),C.a=L*M-O*X,C.b=L*R-O*I,C.c=O*M+L*X,C.d=O*R+L*I}C.updateAppliedTransform()}}computeWorldPositions(e,s,i){let r=this.target,l=this.position,o=this.spaces,n=E.setArraySize(this.positions,s*3+2),a=this.world,h=e.closed,c=e.worldVerticesLength,d=c/6,f=Ye.NONE;if(!e.constantSpeed){let D=e.lengths;d-=h?1:2;let _=D[d];this.data.positionMode==ge.Percent&&(l*=_);let j;switch(this.data.spacingMode){case ee.Percent:j=_;break;case ee.Proportional:j=_/s;break;default:j=1}a=E.setArraySize(this.world,8);for(let G=0,K=0,V=0;G<s;G++,K+=3){let q=o[G]*j;l+=q;let $=l;if(h)$%=_,$<0&&($+=_),V=0;else if($<0){f!=Ye.BEFORE&&(f=Ye.BEFORE,e.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition($,a,0,n,K);continue}else if($>_){f!=Ye.AFTER&&(f=Ye.AFTER,e.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition($-_,a,0,n,K);continue}for(;;V++){let oe=D[V];if(!($>oe)){if(V==0)$/=oe;else{let Z=D[V-1];$=($-Z)/(oe-Z)}break}}V!=f&&(f=V,h&&V==d?(e.computeWorldVertices(r,c-4,4,a,0,2),e.computeWorldVertices(r,0,4,a,4,2)):e.computeWorldVertices(r,V*6+2,8,a,0,2)),this.addCurvePosition($,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,K,i||G>0&&q==0)}return n}h?(c+=2,a=E.setArraySize(this.world,c),e.computeWorldVertices(r,2,c-4,a,0,2),e.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=E.setArraySize(this.world,c),e.computeWorldVertices(r,2,c,a,0,2));let m=E.setArraySize(this.curves,d),u=0,p=a[0],b=a[1],w=0,g=0,x=0,y=0,v=0,C=0,A=0,k=0,T=0,Y=0,M=0,R=0,X=0,I=0;for(let D=0,_=2;D<d;D++,_+=6)w=a[_],g=a[_+1],x=a[_+2],y=a[_+3],v=a[_+4],C=a[_+5],A=(p-w*2+x)*.1875,k=(b-g*2+y)*.1875,T=((w-x)*3-p+v)*.09375,Y=((g-y)*3-b+C)*.09375,M=A*2+T,R=k*2+Y,X=(w-p)*.75+A+T*.16666667,I=(g-b)*.75+k+Y*.16666667,u+=Math.sqrt(X*X+I*I),X+=M,I+=R,M+=T,R+=Y,u+=Math.sqrt(X*X+I*I),X+=M,I+=R,u+=Math.sqrt(X*X+I*I),X+=M+T,I+=R+Y,u+=Math.sqrt(X*X+I*I),m[D]=u,p=v,b=C;this.data.positionMode==ge.Percent&&(l*=u);let F;switch(this.data.spacingMode){case ee.Percent:F=u;break;case ee.Proportional:F=u/s;break;default:F=1}let L=this.segments,O=0;for(let D=0,_=0,j=0,G=0;D<s;D++,_+=3){let K=o[D]*F;l+=K;let V=l;if(h)V%=u,V<0&&(V+=u),j=0;else if(V<0){this.addBeforePosition(V,a,0,n,_);continue}else if(V>u){this.addAfterPosition(V-u,a,c-4,n,_);continue}for(;;j++){let q=m[j];if(!(V>q)){if(j==0)V/=q;else{let $=m[j-1];V=(V-$)/(q-$)}break}}if(j!=f){f=j;let q=j*6;for(p=a[q],b=a[q+1],w=a[q+2],g=a[q+3],x=a[q+4],y=a[q+5],v=a[q+6],C=a[q+7],A=(p-w*2+x)*.03,k=(b-g*2+y)*.03,T=((w-x)*3-p+v)*.006,Y=((g-y)*3-b+C)*.006,M=A*2+T,R=k*2+Y,X=(w-p)*.3+A+T*.16666667,I=(g-b)*.3+k+Y*.16666667,O=Math.sqrt(X*X+I*I),L[0]=O,q=1;q<8;q++)X+=M,I+=R,M+=T,R+=Y,O+=Math.sqrt(X*X+I*I),L[q]=O;X+=M,I+=R,O+=Math.sqrt(X*X+I*I),L[8]=O,X+=M+T,I+=R+Y,O+=Math.sqrt(X*X+I*I),L[9]=O,G=0}for(V*=O;;G++){let q=L[G];if(!(V>q)){if(G==0)V/=q;else{let $=L[G-1];V=G+(V-$)/(q-$)}break}}this.addCurvePosition(V*.1,p,b,w,g,x,y,v,C,n,_,i||D>0&&K==0)}return n}addBeforePosition(e,s,i,r,l){let o=s[i],n=s[i+1],a=s[i+2]-o,h=s[i+3]-n,c=Math.atan2(h,a);r[l]=o+e*Math.cos(c),r[l+1]=n+e*Math.sin(c),r[l+2]=c}addAfterPosition(e,s,i,r,l){let o=s[i+2],n=s[i+3],a=o-s[i],h=n-s[i+1],c=Math.atan2(h,a);r[l]=o+e*Math.cos(c),r[l+1]=n+e*Math.sin(c),r[l+2]=c}addCurvePosition(e,s,i,r,l,o,n,a,h,c,d,f){if(e==0||isNaN(e)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(l-i,r-s);return}let m=e*e,u=m*e,p=1-e,b=p*p,w=b*p,g=p*e,x=g*3,y=p*x,v=x*e,C=s*w+r*y+o*v+a*u,A=i*w+l*y+n*v+h*u;c[d]=C,c[d+1]=A,f&&(e<.001?c[d+2]=Math.atan2(l-i,r-s):c[d+2]=Math.atan2(A-(i*b+l*g*2+n*m),C-(s*b+r*g*2+o*m)))}},kr=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone,n=o.data.length;switch(t){case de.none:return;case de.reset:this.reset();case de.update:const a=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=a.time;const c=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let f=this.remaining,m=this.inertia,u=this.data.step,p=this.skeleton.data.referenceScale,b=-1,w=this.data.limit*h,g=w*Math.abs(a.scaleY);if(w*=Math.abs(a.scaleX),s||i){if(s){const x=(this.ux-c)*m;this.xOffset+=x>w?w:x<-w?-w:x,this.ux=c}if(i){const x=(this.uy-d)*m;this.yOffset+=x>g?g:x<-g?-g:x,this.uy=d}if(f>=u){b=Math.pow(this.damping,60*u);const x=this.massInverse*u,y=this.strength,v=this.wind*p*a.scaleX,C=this.gravity*p*a.scaleY;do s&&(this.xVelocity+=(v-this.xOffset*y)*x,this.xOffset+=this.xVelocity*u,this.xVelocity*=b),i&&(this.yVelocity-=(C+this.yOffset*y)*x,this.yOffset+=this.yVelocity*u,this.yVelocity*=b),f-=u;while(f>=u)}s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r||l){let x=Math.atan2(o.c,o.a),y=0,v=0,C=0,A=this.cx-o.worldX,k=this.cy-o.worldY;if(A>w?A=w:A<-w&&(A=-w),k>g?k=g:k<-g&&(k=-g),r){C=(this.data.rotate+this.data.shearX)*e;let T=Math.atan2(k+this.ty,A+this.tx)-x-this.rotateOffset*C;this.rotateOffset+=(T-Math.ceil(T*B.invPI2-.5)*B.PI2)*m,T=this.rotateOffset*C+x,y=Math.cos(T),v=Math.sin(T),l&&(T=n*o.getWorldScaleX(),T>0&&(this.scaleOffset+=(A*y+k*v)*m/T))}else{y=Math.cos(x),v=Math.sin(x);const T=n*o.getWorldScaleX();T>0&&(this.scaleOffset+=(A*y+k*v)*m/T)}if(f=this.remaining,f>=u){b==-1&&(b=Math.pow(this.damping,60*u));const T=this.massInverse*u,Y=this.strength,M=this.wind,R=De.yDown?-this.gravity:this.gravity,X=n/p;for(;;)if(f-=u,l&&(this.scaleVelocity+=(M*y-R*v-this.scaleOffset*Y)*T,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=b),r){if(this.rotateVelocity-=((M*v+R*y)*X+this.rotateOffset*Y)*T,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=b,f<u)break;const I=this.rotateOffset*C+x;y=Math.cos(I),v=Math.sin(I)}else if(f<u)break}}this.remaining=f}this.cx=o.worldX,this.cy=o.worldY;break;case de.pose:s&&(o.worldX+=this.xOffset*e*this.data.x),i&&(o.worldY+=this.yOffset*e*this.data.y)}if(r){let a=this.rotateOffset*e,h=0,c=0,d=0;if(this.data.shearX>0){let f=0;this.data.rotate>0&&(f=a*this.data.rotate,h=Math.sin(f),c=Math.cos(f),d=o.b,o.b=c*d-h*o.d,o.d=h*d+c*o.d),f+=a*this.data.shearX,h=Math.sin(f),c=Math.cos(f),d=o.a,o.a=c*d-h*o.c,o.c=h*d+c*o.c}else a*=this.data.rotate,h=Math.sin(a),c=Math.cos(a),d=o.a,o.a=c*d-h*o.c,o.c=h*d+c*o.c,d=o.b,o.b=c*d-h*o.d,o.d=h*d+c*o.d}if(l){const a=1+this.scaleOffset*e*this.data.scaleX;o.a*=a,o.c*=a}t!=de.pose&&(this.tx=n*o.a,this.ty=n*o.c),o.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*B.degRad,r=Math.cos(i),l=Math.sin(i),o=this.cx-t,n=this.cy-e;this.translate(o*r-n*l-o,o*l+n*r-n)}},Ws=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 N,this.darkColor=t.darkColor?new N:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof we)||!(this.attachment instanceof we)||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}},zs=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new qe;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let i=0;i<t.bones.length;i++){let r=e.findBone(t.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[i].name}.`);this.bones.push(r)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=e!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,d=n.d,f=a*d-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(t!=0){let x=g.a,y=g.b,v=g.c,C=g.d,A=Math.atan2(c,a)-Math.atan2(v,x)+m;A>B.PI?A-=B.PI2:A<-B.PI&&(A+=B.PI2),A*=t;let k=Math.cos(A),T=Math.sin(A);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(x.x-g.worldX)*e,g.worldY+=(x.y-g.worldY)*s}if(i!=0){let x=Math.sqrt(g.a*g.a+g.c*g.c);x!=0&&(x=(x+(Math.sqrt(a*a+c*c)-x+this.data.offsetScaleX)*i)/x),g.a*=x,g.c*=x}if(r!=0){let x=Math.sqrt(g.b*g.b+g.d*g.d);x!=0&&(x=(x+(Math.sqrt(h*h+d*d)-x+this.data.offsetScaleY)*r)/x),g.b*=x,g.d*=x}if(l>0){let x=g.b,y=g.d,v=Math.atan2(y,x),C=Math.atan2(d,h)-Math.atan2(c,a)-(v-Math.atan2(g.c,g.a));C>B.PI?C-=B.PI2:C<-B.PI&&(C+=B.PI2),C=v+(C+u)*l;let A=Math.sqrt(x*x+y*y);g.b=Math.cos(C)*A,g.d=Math.sin(C)*A}g.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=e!=0||s!=0,n=this.target,a=n.a,h=n.b,c=n.c,d=n.d,f=a*d-h*c>0?B.degRad:-B.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,p=this.bones;for(let b=0,w=p.length;b<w;b++){let g=p[b];if(t!=0){let x=g.a,y=g.b,v=g.c,C=g.d,A=Math.atan2(c,a)+m;A>B.PI?A-=B.PI2:A<-B.PI&&(A+=B.PI2),A*=t;let k=Math.cos(A),T=Math.sin(A);g.a=k*x-T*v,g.b=k*y-T*C,g.c=T*x+k*v,g.d=T*y+k*C}if(o){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.worldX+=x.x*e,g.worldY+=x.y*s}if(i!=0){let x=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;g.a*=x,g.c*=x}if(r!=0){let x=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*r+1;g.b*=x,g.d*=x}if(l>0){let x=Math.atan2(d,h)-Math.atan2(c,a);x>B.PI?x-=B.PI2:x<-B.PI&&(x+=B.PI2);let y=g.b,v=g.d;x=Math.atan2(v,y)+(x-B.PI/2+u)*l;let C=Math.sqrt(y*y+v*v);g.b=Math.cos(x)*C,g.d=Math.sin(x)*C}g.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],d=c.arotation;t!=0&&(d+=(o.arotation-d+this.data.offsetRotation)*t);let f=c.ax,m=c.ay;f+=(o.ax-f+this.data.offsetX)*e,m+=(o.ay-m+this.data.offsetY)*s;let u=c.ascaleX,p=c.ascaleY;i!=0&&u!=0&&(u=(u+(o.ascaleX-u+this.data.offsetScaleX)*i)/u),r!=0&&p!=0&&(p=(p+(o.ascaleY-p+this.data.offsetScaleY)*r)/p);let b=c.ashearY;l!=0&&(b+=(o.ashearY-b+this.data.offsetShearY)*l),c.updateWorldTransformWith(f,m,d,u,p,c.ashearX,b)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,l=this.mixShearY,o=this.target,n=this.bones;for(let a=0,h=n.length;a<h;a++){let c=n[a],d=c.arotation+(o.arotation+this.data.offsetRotation)*t,f=c.ax+(o.ax+this.data.offsetX)*e,m=c.ay+(o.ay+this.data.offsetY)*s,u=c.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*i+1),p=c.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),b=c.ashearY+(o.ashearY+this.data.offsetShearY)*l;c.updateWorldTransformWith(f,m,d,u,p,c.ashearX,b)}}},De=class ys{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return ys.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let i=e.bones[s],r;if(!i.parent)r=new ts(i,this,null);else{let l=this.bones[i.parent.index];r=new ts(i,this,l),l.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<e.slots.length;s++){let i=e.slots[s],r=this.bones[i.boneData.index],l=new Ws(i,r);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(let s=0;s<e.ikConstraints.length;s++){let i=e.ikConstraints[s];this.ikConstraints.push(new Us(i,this))}this.transformConstraints=new Array;for(let s=0;s<e.transformConstraints.length;s++){let i=e.transformConstraints[s];this.transformConstraints.push(new zs(i,this))}this.pathConstraints=new Array;for(let s=0;s<e.pathConstraints.length;s++){let i=e.pathConstraints[s];this.pathConstraints.push(new qs(i,this))}this.physicsConstraints=new Array;for(let s=0;s<e.physicsConstraints.length;s++){let i=e.physicsConstraints[s];this.physicsConstraints.push(new kr(i,this))}this.color=new N(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let s=this.bones;for(let f=0,m=s.length;f<m;f++){let u=s[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let p=this.bones[f[m].index];do p.sorted=!1,p.active=!0,p=p.parent;while(p)}}let i=this.ikConstraints,r=this.transformConstraints,l=this.pathConstraints,o=this.physicsConstraints,n=i.length,a=r.length,h=l.length,c=this.physicsConstraints.length,d=n+a+h+c;e:for(let f=0;f<d;f++){for(let m=0;m<n;m++){let u=i[m];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let m=0;m<a;m++){let u=r[m];if(u.data.order==f){this.sortTransformConstraint(u);continue e}}for(let m=0;m<h;m++){let u=l[m];if(u.data.order==f){this.sortPathConstraint(u);continue e}}for(let m=0;m<c;m++){const u=o[m];if(u.data.order==f){this.sortPhysicsConstraint(u);continue e}}}for(let f=0,m=s.length;f<m;f++)this.sortBone(s[f])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target;this.sortBone(s);let i=e.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(e),this.sortReset(r.children);else{let l=i[i.length-1];this.sortBone(l),this._updateCache.push(e),this.sortReset(r.children),l.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;let s=e.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let a=0,h=this.data.skins.length;a<h;a++)this.sortPathConstraintAttachment(this.data.skins[a],i,r);let l=s.getAttachment();l instanceof Ve&&this.sortPathConstraintAttachmentWith(l,r);let o=e.bones,n=o.length;for(let a=0;a<n;a++)this.sortBone(o[a]);this._updateCache.push(e);for(let a=0;a<n;a++)this.sortReset(o[a].children);for(let a=0;a<n;a++)o[a].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&E.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let s=e.bones,i=s.length;if(e.data.local)for(let r=0;r<i;r++){let l=s[r];this.sortBone(l.parent),this.sortBone(l)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(e);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(e,s,i){let r=e.attachments[s];if(r)for(let l in r)this.sortPathConstraintAttachmentWith(r[l],i)}sortPathConstraintAttachmentWith(e,s){if(!(e instanceof Ve))return;let i=e.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let l=0,o=i.length;l<o;){let n=i[l++];for(n+=l;l<n;)this.sortBone(r[i[l++]])}}}sortPhysicsConstraint(e){const s=e.bone;e.active=s.active&&(!e.data.skinRequired||this.skin!=null&&E.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(s),this._updateCache.push(e),this.sortReset(s.children),s.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,i=e.length;s<i;s++){let r=e[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,l=s.length;r<l;r++){let o=s[r];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let i=this._updateCache;for(let r=0,l=i.length;r<l;r++)i[r].update(e)}updateWorldTransformWith(e,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let b=1,w=i.length;b<w;b++){let g=i[b];g.ax=g.x,g.ay=g.y,g.arotation=g.rotation,g.ascaleX=g.scaleX,g.ascaleY=g.scaleY,g.ashearX=g.shearX,g.ashearY=g.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let l=s.a,o=s.b,n=s.c,a=s.d;r.worldX=l*this.x+o*this.y+s.worldX,r.worldY=n*this.x+a*this.y+s.worldY;const h=(r.rotation+r.shearX)*B.degRad,c=(r.rotation+90+r.shearY)*B.degRad,d=Math.cos(h)*r.scaleX,f=Math.cos(c)*r.scaleY,m=Math.sin(h)*r.scaleX,u=Math.sin(c)*r.scaleY;r.a=(l*d+o*m)*this.scaleX,r.b=(l*f+o*u)*this.scaleX,r.c=(n*d+a*m)*this.scaleY,r.d=(n*f+a*u)*this.scaleY;let p=this._updateCache;for(let b=0,w=p.length;b<w;b++){let g=p[b];g!=r&&g.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;E.arrayCopy(e,0,this.drawOrder,0,e.length);for(let s=0,i=e.length;s<i;s++)e[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==e)return l}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i];if(l.data.name==e)return l}return null}setSkinByName(e){let s=this.data.findSkin(e);if(!s)throw new Error("Skin not found: "+e);this.setSkin(s)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let l=s[i],o=l.data.attachmentName;if(o){let n=e.getAttachment(i,o);n&&l.setAttachment(n)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,s){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,s)}getAttachment(e,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,l=i.length;r<l;r++){let o=i[r];if(o.data.name==e){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+e);o.setAttachment(n);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==e)??null}getBoundsRect(e){let s=new qe,i=new qe;return this.getBounds(s,i,void 0,e),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(e,s,i=new Array(2),r=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let l=this.drawOrder,o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let c=0,d=l.length;c<d;c++){let f=l[c];if(!f.bone.active)continue;let m=0,u=null,p=null,b=f.getAttachment();if(b instanceof W)m=8,u=E.setArraySize(i,m,0),b.computeWorldVertices(f,u,0,2),p=ys.quadTriangles;else if(b instanceof me){let w=b;m=w.worldVerticesLength,u=E.setArraySize(i,m,0),w.computeWorldVertices(f,0,m,u,0,2),p=w.triangles}else if(b instanceof Pe&&r!=null){r.clipStart(f,b);continue}if(u&&p){r!=null&&r.isClipping()&&(r.clipTriangles(u,p,p.length),u=r.clippedVertices,m=r.clippedVertices.length);for(let w=0,g=u.length;w<g;w+=2){let x=u[w],y=u[w+1];o=Math.min(o,x),n=Math.min(n,y),a=Math.max(a,x),h=Math.max(h,y)}}r?.clipEndWithSlot(f)}r?.clipEnd(),e.set(o,n),s.set(a-o,h-n)}update(e){this.time+=e}physicsTranslate(e,s){const i=this.physicsConstraints;for(let r=0,l=i.length;r<l;r++)i[r].translate(e,s)}physicsRotate(e,s,i){const r=this.physicsConstraints;for(let l=0,o=r.length;l<o;l++)r[l].rotate(e,s,i)}},de;(function(t){t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose"})(de||(de={}));var Gs=class extends ze{_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)}},Ge=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let r=e[s];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const r=e[s];if(r.name==t)return r}return null}},as=class{slotIndex;name;attachment;constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},He=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new N(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let i=0;i<t.bones.length;i++){let r=t.bones[i],l=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){l=!0;break}l||this.bones.push(r)}for(let i=0;i<t.constraints.length;i++){let r=t.constraints[i],l=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){l=!0;break}l||this.constraints.push(r)}let e=t.getAttachments();for(let i=0;i<e.length;i++){var s=e[i];s.attachment&&(s.attachment instanceof me?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new as(e,i,r))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new as(t,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let r=t.slots[i],l=r.getAttachment();if(l&&s<e.attachments.length){let o=e.attachments[s];for(let n in o){let a=o[n];if(l==a){let h=this.getAttachment(s,n);h&&r.setAttachment(h);break}}}s++}}},os=class{index=0;name;boneData;color=new N(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Ae.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}},Ae;(function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"})(Ae||(Ae={}));var ls=class extends ze{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(t){super(t,0,!1)}},Hs=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ge;s.name="";let i=new $s(t),r=i.readInt32(),l=i.readInt32();s.hash=l==0&&r==0?null:l.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*e;let o=i.readBoolean();o&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=h==0?null:s.bones[i.readInt(!0)],f=new es(h,c,d);f.rotation=i.readFloat(),f.x=i.readFloat()*e,f.y=i.readFloat()*e,f.scaleX=i.readFloat(),f.scaleY=i.readFloat(),f.shearX=i.readFloat(),f.shearY=i.readFloat(),f.length=i.readFloat()*e,f.inherit=i.readByte(),f.skinRequired=i.readBoolean(),o&&(N.rgba8888ToColor(f.color,i.readInt32()),f.icon=i.readString()??void 0,f.visible=i.readBoolean()),s.bones.push(f)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],f=new os(h,c,d);N.rgba8888ToColor(f.color,i.readInt32());let m=i.readInt32();m!=-1&&N.rgb888ToColor(f.darkColor=new N,m),f.attachmentName=i.readStringRef(),f.blendMode=i.readInt(!0),o&&(f.visible=i.readBoolean()),s.slots.push(f)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new is(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.bendDirection=(m&2)!=0?1:-1,f.compress=(m&4)!=0,f.stretch=(m&8)!=0,f.uniform=(m&16)!=0,(m&32)!=0&&(f.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(f.softness=i.readFloat()*e),s.ikConstraints.push(f)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new ls(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.local=(m&2)!=0,f.relative=(m&4)!=0,(m&8)!=0&&(f.offsetRotation=i.readFloat()),(m&16)!=0&&(f.offsetX=i.readFloat()*e),(m&32)!=0&&(f.offsetY=i.readFloat()*e),(m&64)!=0&&(f.offsetScaleX=i.readFloat()),(m&128)!=0&&(f.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(f.offsetShearY=i.readFloat()),(m&2)!=0&&(f.mixRotate=i.readFloat()),(m&4)!=0&&(f.mixX=i.readFloat()),(m&8)!=0&&(f.mixY=i.readFloat()),(m&16)!=0&&(f.mixScaleX=i.readFloat()),(m&32)!=0&&(f.mixScaleY=i.readFloat()),(m&64)!=0&&(f.mixShearY=i.readFloat()),s.transformConstraints.push(f)}n=i.readInt(!0);for(let h=0,c;h<n;h++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new ns(d);f.order=i.readInt(!0),f.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.slots[i.readInt(!0)];const m=i.readByte();f.positionMode=m&1,f.spacingMode=m>>1&3,f.rotateMode=m>>3&3,(m&128)!=0&&(f.offsetRotation=i.readFloat()),f.position=i.readFloat(),f.positionMode==ge.Fixed&&(f.position*=e),f.spacing=i.readFloat(),(f.spacingMode==ee.Length||f.spacingMode==ee.Fixed)&&(f.spacing*=e),f.mixRotate=i.readFloat(),f.mixX=i.readFloat(),f.mixY=i.readFloat(),s.pathConstraints.push(f)}n=i.readInt(!0);for(let h=0,c;h<n;h++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new Gs(d);f.order=i.readInt(!0),f.bone=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,(m&2)!=0&&(f.x=i.readFloat()),(m&4)!=0&&(f.y=i.readFloat()),(m&8)!=0&&(f.rotate=i.readFloat()),(m&16)!=0&&(f.scaleX=i.readFloat()),(m&32)!=0&&(f.shearX=i.readFloat()),f.limit=((m&64)!=0?i.readFloat():5e3)*e,f.step=1/i.readUnsignedByte(),f.inertia=i.readFloat(),f.strength=i.readFloat(),f.damping=i.readFloat(),f.massInverse=(m&128)!=0?i.readFloat():1,f.wind=i.readFloat(),f.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(f.inertiaGlobal=!0),(m&2)!=0&&(f.strengthGlobal=!0),(m&4)!=0&&(f.dampingGlobal=!0),(m&8)!=0&&(f.massGlobal=!0),(m&16)!=0&&(f.windGlobal=!0),(m&32)!=0&&(f.gravityGlobal=!0),(m&64)!=0&&(f.mixGlobal=!0),f.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(f)}let a=this.readSkin(i,s,!0,o);a&&(s.defaultSkin=a,s.skins.push(a));{let h=s.skins.length;for(E.setArraySize(s.skins,n=h+i.readInt(!0));h<n;h++){let c=this.readSkin(i,s,!1,o);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[h]=c}}n=this.linkedMeshes.length;for(let h=0;h<n;h++){let c=this.linkedMeshes[h];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(c.slotIndex,c.parent);if(!f)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?f:c.mesh,c.mesh.setParentMesh(f),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new rs(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}n=i.readInt(!0);for(let h=0;h<n;h++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(t,e,s,i){let r=null,l=0;if(s){if(l=t.readInt(!0),l==0)return null;r=new He("default")}else{let o=t.readString();if(!o)throw new Error("Skin name must not be null.");r=new He(o),i&&N.rgba8888ToColor(r.color,t.readInt32()),r.bones.length=t.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=e.bones[t.readInt(!0)];for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.physicsConstraints[t.readInt(!0)]);l=t.readInt(!0)}for(let o=0;o<l;o++){let n=t.readInt(!0);for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(t,e,r,n,c,i);d&&r.setAttachment(n,c,d)}}return r}readAttachment(t,e,s,i,r,l){let o=this.scale,n=t.readByte();const a=(n&8)!=0?t.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case Se.Region:{let h=(n&16)!=0?t.readStringRef():null;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null;let f=(n&128)!=0?t.readFloat():0,m=t.readFloat(),u=t.readFloat(),p=t.readFloat(),b=t.readFloat(),w=t.readFloat(),g=t.readFloat();h||(h=a);let x=this.attachmentLoader.newRegionAttachment(s,a,h,d);return x?(x.path=h,x.x=m*o,x.y=u*o,x.scaleX=p,x.scaleY=b,x.rotation=f,x.width=w*o,x.height=g*o,N.rgba8888ToColor(x.color,c),x.sequence=d,d==null&&x.updateRegion(),x):null}case Se.BoundingBox:{let h=this.readVertices(t,(n&16)!=0),c=l?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);return d?(d.worldVerticesLength=h.length,d.vertices=h.vertices,d.bones=h.bones,l&&N.rgba8888ToColor(d.color,c),d):null}case Se.Mesh:{let h=(n&16)!=0?t.readStringRef():a;const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,f=t.readInt(!0),m=this.readVertices(t,(n&128)!=0),u=this.readFloatArray(t,m.length,1),p=this.readShortArray(t,(m.length-f-2)*3);let b=[],w=0,g=0;l&&(b=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),g=t.readFloat()),h||(h=a);let x=this.attachmentLoader.newMeshAttachment(s,a,h,d);return x?(x.path=h,N.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=p,x.regionUVs=u,d==null&&x.updateRegion(),x.hullLength=f<<1,x.sequence=d,l&&(x.edges=b,x.width=w*o,x.height=g*o),x):null}case Se.LinkedMesh:{const h=(n&16)!=0?t.readStringRef():a;if(h==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?t.readInt32():4294967295,d=(n&64)!=0?this.readSequence(t):null,f=(n&128)!=0,m=t.readInt(!0),u=t.readStringRef();let p=0,b=0;l&&(p=t.readFloat(),b=t.readFloat());let w=this.attachmentLoader.newMeshAttachment(s,a,h,d);return w?(w.path=h,N.rgba8888ToColor(w.color,c),w.sequence=d,l&&(w.width=p*o,w.height=b*o),this.linkedMeshes.push(new Tr(w,m,i,u,f)),w):null}case Se.Path:{const h=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(t,(n&64)!=0),f=E.newArray(d.length/6,0);for(let p=0,b=f.length;p<b;p++)f[p]=t.readFloat()*o;const m=l?t.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,a);return u?(u.closed=h,u.constantSpeed=c,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=f,l&&N.rgba8888ToColor(u.color,m),u):null}case Se.Point:{const h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=l?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*o,m.y=d*o,m.rotation=h,l&&N.rgba8888ToColor(m.color,f),m):null}case Se.Clipping:{const h=t.readInt(!0),c=this.readVertices(t,(n&16)!=0);let d=l?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,a);return f?(f.endSlot=e.slots[h],f.worldVerticesLength=c.length,f.vertices=c.vertices,f.bones=c.bones,l&&N.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){let e=new Ys(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),r=new Ir;if(r.length=i<<1,!e)return r.vertices=this.readFloatArray(t,r.length,s),r;let l=new Array,o=new Array;for(let n=0;n<i;n++){let a=t.readInt(!0);o.push(a);for(let h=0;h<a;h++)o.push(t.readInt(!0)),l.push(t.readFloat()*s),l.push(t.readFloat()*s),l.push(t.readFloat())}return r.vertices=E.toFloatArray(l),r.bones=o,r}readFloatArray(t,e,s){let i=new Array(e);if(s==1)for(let r=0;r<e;r++)i[r]=t.readFloat();else for(let r=0;r<e;r++)i[r]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,r=this.scale;for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){let m=t.readByte(),u=t.readInt(!0),p=u-1;switch(m){case Nr:{let b=new Fe(u,c);for(let w=0;w<u;w++)b.setFrame(w,t.readFloat(),t.readStringRef());i.push(b);break}case Or:{let b=t.readInt(!0),w=new It(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255;for(let A=0,k=0;w.setFrame(A,g,x,y,v,C),A!=p;A++){let T=t.readFloat(),Y=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255;switch(t.readByte()){case ve:w.setStepped(A);break;case Ce:z(t,w,k++,A,0,g,T,x,Y,1),z(t,w,k++,A,1,g,T,y,M,1),z(t,w,k++,A,2,g,T,v,R,1),z(t,w,k++,A,3,g,T,C,X,1)}g=T,x=Y,y=M,v=R,C=X}i.push(w);break}case _r:{let b=t.readInt(!0),w=new Mt(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255;for(let C=0,A=0;w.setFrame(C,g,x,y,v),C!=p;C++){let k=t.readFloat(),T=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;switch(t.readByte()){case ve:w.setStepped(C);break;case Ce:z(t,w,A++,C,0,g,k,x,T,1),z(t,w,A++,C,1,g,k,y,Y,1),z(t,w,A++,C,2,g,k,v,M,1)}g=k,x=T,y=Y,v=M}i.push(w);break}case Ur:{let b=t.readInt(!0),w=new Ft(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255;for(let Y=0,M=0;w.setFrame(Y,g,x,y,v,C,A,k,T),Y!=p;Y++){let R=t.readFloat(),X=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255;switch(t.readByte()){case ve:w.setStepped(Y);break;case Ce:z(t,w,M++,Y,0,g,R,x,X,1),z(t,w,M++,Y,1,g,R,y,I,1),z(t,w,M++,Y,2,g,R,v,F,1),z(t,w,M++,Y,3,g,R,C,L,1),z(t,w,M++,Y,4,g,R,A,O,1),z(t,w,M++,Y,5,g,R,k,D,1),z(t,w,M++,Y,6,g,R,T,_,1)}g=R,x=X,y=I,v=F,C=L,A=O,k=D,T=_}i.push(w);break}case qr:{let b=t.readInt(!0),w=new Pt(u,b,c),g=t.readFloat(),x=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let T=0,Y=0;w.setFrame(T,g,x,y,v,C,A,k),T!=p;T++){let M=t.readFloat(),R=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case ve:w.setStepped(T);break;case Ce:z(t,w,Y++,T,0,g,M,x,R,1),z(t,w,Y++,T,1,g,M,y,X,1),z(t,w,Y++,T,2,g,M,v,I,1),z(t,w,Y++,T,3,g,M,C,F,1),z(t,w,Y++,T,4,g,M,A,L,1),z(t,w,Y++,T,5,g,M,k,O,1)}g=M,x=R,y=X,v=I,C=F,A=L,k=O}i.push(w);break}case Wr:{let b=new Yt(u,t.readInt(!0),c),w=t.readFloat(),g=t.readUnsignedByte()/255;for(let x=0,y=0;b.setFrame(x,w,g),x!=p;x++){let v=t.readFloat(),C=t.readUnsignedByte()/255;switch(t.readByte()){case ve:b.setStepped(x);break;case Ce:z(t,b,y++,x,0,w,v,g,C,1)}w=v,g=C}i.push(b)}}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){let m=t.readByte(),u=t.readInt(!0);if(m==Dr){let b=new Tt(u,c);for(let w=0;w<u;w++)b.setFrame(w,t.readFloat(),t.readByte());i.push(b);continue}let p=t.readInt(!0);switch(m){case Mr:i.push(ae(t,new We(u,p,c),1));break;case Yr:i.push(hs(t,new xt(u,p,c),r));break;case Fr:i.push(ae(t,new bt(u,p,c),r));break;case Pr:i.push(ae(t,new wt(u,p,c),r));break;case Rr:i.push(hs(t,new yt(u,p,c),1));break;case Xr:i.push(ae(t,new vt(u,p,c),1));break;case Br:i.push(ae(t,new Ct(u,p,c),1));break;case Er:i.push(hs(t,new At(u,p,c),1));break;case Lr:i.push(ae(t,new St(u,p,c),1));break;case Vr:i.push(ae(t,new kt(u,p,c),1))}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=t.readInt(!0),f=d-1,m=new Xt(d,t.readInt(!0),c),u=t.readByte(),p=t.readFloat(),b=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,w=(u&4)!=0?t.readFloat()*r:0;for(let g=0,x=0;m.setFrame(g,p,b,w,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),g!=f;g++){u=t.readByte();const y=t.readFloat(),v=(u&1)!=0?(u&2)!=0?t.readFloat():1:0,C=(u&4)!=0?t.readFloat()*r:0;(u&64)!=0?m.setStepped(g):(u&128)!=0&&(z(t,m,x++,g,0,p,y,b,v,1),z(t,m,x++,g,1,p,y,w,C,r)),p=y,b=v,w=C}i.push(m)}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=t.readInt(!0),f=d-1,m=new Bt(d,t.readInt(!0),c),u=t.readFloat(),p=t.readFloat(),b=t.readFloat(),w=t.readFloat(),g=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,C=0;m.setFrame(v,u,p,b,w,g,x,y),v!=f;v++){let A=t.readFloat(),k=t.readFloat(),T=t.readFloat(),Y=t.readFloat(),M=t.readFloat(),R=t.readFloat(),X=t.readFloat();switch(t.readByte()){case ve:m.setStepped(v);break;case Ce:z(t,m,C++,v,0,u,A,p,k,1),z(t,m,C++,v,1,u,A,b,T,1),z(t,m,C++,v,2,u,A,w,Y,1),z(t,m,C++,v,3,u,A,g,M,1),z(t,m,C++,v,4,u,A,x,R,1),z(t,m,C++,v,5,u,A,y,X,1)}u=A,p=k,b=T,w=Y,g=M,x=R,y=X}i.push(m)}for(let a=0,h=t.readInt(!0);a<h;a++){let c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,m=t.readInt(!0);f<m;f++){const u=t.readByte(),p=t.readInt(!0),b=t.readInt(!0);switch(u){case Hr:i.push(ae(t,new Et(p,b,c),d.positionMode==ge.Fixed?r:1));break;case $r:i.push(ae(t,new Lt(p,b,c),d.spacingMode==ee.Length||d.spacingMode==ee.Fixed?r:1));break;case jr:let w=new Vt(p,b,c),g=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat();for(let C=0,A=0,k=w.getFrameCount()-1;w.setFrame(C,g,x,y,v),C!=k;C++){let T=t.readFloat(),Y=t.readFloat(),M=t.readFloat(),R=t.readFloat();switch(t.readByte()){case ve:w.setStepped(C);break;case Ce:z(t,w,A++,C,0,g,T,x,Y,1),z(t,w,A++,C,1,g,T,y,M,1),z(t,w,A++,C,2,g,T,v,R,1)}g=T,x=Y,y=M,v=R}i.push(w)}}}for(let a=0,h=t.readInt(!0);a<h;a++){const c=t.readInt(!0)-1;for(let d=0,f=t.readInt(!0);d<f;d++){const m=t.readByte(),u=t.readInt(!0);if(m==ri){const b=new zt(u,c);for(let w=0;w<u;w++)b.setFrame(w,t.readFloat());i.push(b);continue}const p=t.readInt(!0);switch(m){case Jr:i.push(ae(t,new Dt(u,p,c),1));break;case Kr:i.push(ae(t,new Nt(u,p,c),1));break;case Qr:i.push(ae(t,new Ot(u,p,c),1));break;case Zr:i.push(ae(t,new _t(u,p,c),1));break;case ei:i.push(ae(t,new Ut(u,p,c),1));break;case ti:i.push(ae(t,new qt(u,p,c),1));break;case si:i.push(ae(t,new Wt(u,p,c),1))}}}for(let a=0,h=t.readInt(!0);a<h;a++){let c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){let m=t.readInt(!0);for(let u=0,p=t.readInt(!0);u<p;u++){let b=t.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let w=c.getAttachment(m,b),g=t.readByte(),x=t.readInt(!0),y=x-1;switch(g){case zr:{let v=w,C=v.bones,A=v.vertices,k=C?A.length/3*2:A.length,T=t.readInt(!0),Y=new Rt(x,T,m,v),M=t.readFloat();for(let R=0,X=0;;R++){let I,F=t.readInt(!0);if(F==0)I=C?E.newFloatArray(k):A;else{I=E.newFloatArray(k);let O=t.readInt(!0);if(F+=O,r==1)for(let D=O;D<F;D++)I[D]=t.readFloat();else for(let D=O;D<F;D++)I[D]=t.readFloat()*r;if(!C)for(let D=0,_=I.length;D<_;D++)I[D]+=A[D]}if(Y.setFrame(R,M,I),R==y)break;let L=t.readFloat();switch(t.readByte()){case ve:Y.setStepped(R);break;case Ce:z(t,Y,X++,R,0,M,L,0,1,1)}M=L}i.push(Y);break}case Gr:{let v=new Gt(x,m,w);for(let C=0;C<x;C++){let A=t.readFloat(),k=t.readInt32();v.setFrame(C,A,Fs[k&15],k>>4,t.readFloat())}i.push(v);break}}}}}let l=t.readInt(!0);if(l>0){let a=new Le(l),h=s.slots.length;for(let c=0;c<l;c++){let d=t.readFloat(),f=t.readInt(!0),m=E.newArray(h,0);for(let w=h-1;w>=0;w--)m[w]=-1;let u=E.newArray(h-f,0),p=0,b=0;for(let w=0;w<f;w++){let g=t.readInt(!0);for(;p!=g;)u[b++]=p++;m[p+t.readInt(!0)]=p++}for(;p<h;)u[b++]=p++;for(let w=h-1;w>=0;w--)m[w]==-1&&(m[w]=u[--b]);a.setFrame(c,d,m)}i.push(a)}let o=t.readInt(!0);if(o>0){let a=new tt(o);for(let h=0;h<o;h++){let c=t.readFloat(),d=s.events[t.readInt(!0)],f=new ss(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readString(),f.stringValue==null&&(f.stringValue=d.stringValue),f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),a.setFrame(h,f)}i.push(a)}let n=0;for(let a=0,h=i.length;a<h;a++)n=Math.max(n,i[a].getDuration());return new Ze(e,i,n)}},$s=class{strings;index;buffer;constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",s=0;for(let i=0;i<t;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:e+=String.fromCharCode(r),i++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},Tr=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},Ir=class{bones;vertices;length;constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}},Se;(function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"})(Se||(Se={}));function ae(t,e,s){let i=t.readFloat(),r=t.readFloat()*s;for(let l=0,o=0,n=e.getFrameCount()-1;e.setFrame(l,i,r),l!=n;l++){let a=t.readFloat(),h=t.readFloat()*s;switch(t.readByte()){case ve:e.setStepped(l);break;case Ce:z(t,e,o++,l,0,i,a,r,h,s)}i=a,r=h}return e}function hs(t,e,s){let i=t.readFloat(),r=t.readFloat()*s,l=t.readFloat()*s;for(let o=0,n=0,a=e.getFrameCount()-1;e.setFrame(o,i,r,l),o!=a;o++){let h=t.readFloat(),c=t.readFloat()*s,d=t.readFloat()*s;switch(t.readByte()){case ve:e.setStepped(o);break;case Ce:z(t,e,n++,o,0,i,h,r,c,s),z(t,e,n++,o,1,i,h,l,d,s)}i=h,r=c,l=d}return e}function z(t,e,s,i,r,l,o,n,a,h){e.setBezier(s,i,r,l,n,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,o,a)}var Mr=0,Yr=1,Fr=2,Pr=3,Rr=4,Xr=5,Br=6,Er=7,Lr=8,Vr=9,Dr=10,Nr=0,Or=1,_r=2,Ur=3,qr=4,Wr=5,zr=0,Gr=1,Hr=0,$r=1,jr=2,Jr=0,Kr=1,Qr=2,Zr=4,ei=5,ti=6,si=7,ri=8,ve=1,Ce=2,cs=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Ee(()=>E.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,l=t.slots,o=l.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n<o;n++){let a=l[n];if(!a.bone.active)continue;let h=a.getAttachment();if(h instanceof Kt){let c=h;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=E.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(a,0,c.worldVerticesLength,d,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let l=0,o=r.length;l<o;l++){let n=r[l],a=n;for(let h=0,c=n.length;h<c;h+=2){let d=a[h],f=a[h+1];t=Math.min(t,d),e=Math.min(e,f),s=Math.max(s,d),i=Math.max(i,f)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let r=this.minX,l=this.minY,o=this.maxX,n=this.maxY;if(t<=r&&s<=r||e<=l&&i<=l||t>=o&&s>=o||e>=n&&i>=n)return!1;let a=(i-e)/(s-t),h=a*(r-t)+e;if(h>l&&h<n||(h=a*(o-t)+e,h>l&&h<n))return!0;let c=(l-e)/a+t;return c>r&&c<o||(c=(n-e)/a+t,c>r&&c<o)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,r=t.length,l=r-2,o=!1;for(let n=0;n<r;n+=2){let a=i[n+1],h=i[l+1];if(a<s&&h>=s||h<s&&a>=s){let c=i[n];c+(s-a)/(h-a)*(i[l]-c)<e&&(o=!o)}l=n}return o}intersectsSegment(t,e,s,i){let r=this.polygons;for(let l=0,o=r.length;l<o;l++)if(this.intersectsSegmentPolygon(r[l],t,e,s,i))return this.boundingBoxes[l];return null}intersectsSegmentPolygon(t,e,s,i,r){let l=t,o=t.length,n=e-i,a=s-r,h=e*r-s*i,c=l[o-2],d=l[o-1];for(let f=0;f<o;f+=2){let m=l[f],u=l[f+1],p=c*u-d*m,b=c-m,w=d-u,g=n*w-a*b,x=(h*b-n*p)/g;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let y=(h*w-a*p)/g;if((y>=d&&y<=u||y>=u&&y<=d)&&(y>=s&&y<=r||y>=r&&y<=s))return!0}c=m,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},js=class he{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Ee(()=>new Array);polygonIndicesPool=new Ee(()=>new Array);triangulate(e){let s=e,i=e.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<i;n++)r[n]=n;let l=this.isConcaveArray;l.length=0;for(let n=0,a=i;n<a;++n)l[n]=he.isConcave(n,i,s,r);let o=this.triangles;for(o.length=0;i>3;){let n=i-1,a=0,h=1;for(;;){e:if(!l[a]){let f=r[n]<<1,m=r[a]<<1,u=r[h]<<1,p=s[f],b=s[f+1],w=s[m],g=s[m+1],x=s[u],y=s[u+1];for(let v=(h+1)%i;v!=n;v=(v+1)%i){if(!l[v])continue;let C=r[v]<<1,A=s[C],k=s[C+1];if(he.positiveArea(x,y,p,b,A,k)&&he.positiveArea(p,b,w,g,A,k)&&he.positiveArea(w,g,x,y,A,k))break e}break}if(h==0){do{if(!l[a])break;a--}while(a>0);break}n=a,a=h,h=(h+1)%i}o.push(r[(i+a-1)%i]),o.push(r[a]),o.push(r[(a+1)%i]),r.splice(a,1),l.splice(a,1),i--;let c=(i+a-1)%i,d=a==i?0:a;l[c]=he.isConcave(c,i,s,r),l[d]=he.isConcave(d,i,s,r)}return i==3&&(o.push(r[2]),o.push(r[0]),o.push(r[1])),o}decompose(e,s){let i=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let l=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(l),l.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,h=0;for(let c=0,d=s.length;c<d;c+=3){let f=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,p=i[f],b=i[f+1],w=i[m],g=i[m+1],x=i[u],y=i[u+1],v=!1;if(a==f){let C=n.length-4,A=he.winding(n[C],n[C+1],n[C+2],n[C+3],x,y),k=he.winding(x,y,n[0],n[1],n[2],n[3]);A==h&&k==h&&(n.push(x),n.push(y),o.push(u),v=!0)}v||(n.length>0?(r.push(n),l.push(o)):(this.polygonPool.free(n),this.polygonIndicesPool.free(o)),n=this.polygonPool.obtain(),n.length=0,n.push(p),n.push(b),n.push(w),n.push(g),n.push(x),n.push(y),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(f),o.push(m),o.push(u),h=he.winding(p,b,w,g,x,y),a=f)}n.length>0&&(r.push(n),l.push(o));for(let c=0,d=r.length;c<d;c++){if(o=l[c],o.length==0)continue;let f=o[0],m=o[o.length-1];n=r[c];let u=n.length-4,p=n[u],b=n[u+1],w=n[u+2],g=n[u+3],x=n[0],y=n[1],v=n[2],C=n[3],A=he.winding(p,b,w,g,x,y);for(let k=0;k<d;k++){if(k==c)continue;let T=l[k];if(T.length!=3)continue;let Y=T[0],M=T[1],R=T[2],X=r[k],I=X[X.length-2],F=X[X.length-1];if(Y!=f||M!=m)continue;let L=he.winding(p,b,w,g,I,F),O=he.winding(I,F,x,y,v,C);L==A&&O==A&&(X.length=0,T.length=0,n.push(I),n.push(F),o.push(R),p=w,b=g,w=I,g=F,k=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),o=l[c],l.splice(c,1),this.polygonIndicesPool.free(o));return r}static isConcave(e,s,i,r){let l=r[(s+e-1)%s]<<1,o=r[e]<<1,n=r[(e+1)%s]<<1;return!this.positiveArea(i[l],i[l+1],i[o],i[o+1],i[n],i[n+1])}static positiveArea(e,s,i,r,l,o){return e*(o-r)+i*(s-o)+l*(r-s)>=0}static winding(e,s,i,r,l,o){let n=i-e,a=r-s;return l*a-o*n+n*s-e*a>=0?1:-1}},nt=class vs{triangulator=new js;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=E.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(e,0,i,r,0,2);let l=this.clippingPolygon;vs.makeClockwise(l);let o=this.clippingPolygons=this.triangulator.decompose(l,this.triangulator.triangulate(l));for(let n=0,a=o.length;n<a;n++){let h=o[n];vs.makeClockwise(h),h.push(h[0]),h.push(h[1])}return o.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,s,i,r,l,o,n,a){let h,c,d,f,m,u;typeof s=="number"?(h=i,c=r,d=l,f=o,m=n,u=a):(h=s,c=i,d=r,f=l,m=o,u=n),d&&f&&m&&typeof u=="boolean"?this.clipTrianglesRender(e,h,c,d,f,m,u):this.clipTrianglesNoRender(e,h,c)}clipTrianglesNoRender(e,s,i){let r=this.clipOutput,l=this.clippedVertices,o=this.clippedTriangles,n=this.clippingPolygons,a=n.length,h=0;l.length=0,o.length=0;for(let c=0;c<i;c+=3){let d=s[c]<<1,f=e[d],m=e[d+1];d=s[c+1]<<1;let u=e[d],p=e[d+1];d=s[c+2]<<1;let b=e[d],w=e[d+1];for(let g=0;g<a;g++){let x=l.length;if(this.clip(f,m,u,p,b,w,n[g],r)){let y=r.length;if(y==0)continue;let v=y>>1,C=this.clipOutput,A=E.setArraySize(l,x+v*2);for(let T=0;T<y;T+=2,x+=2){let Y=C[T],M=C[T+1];A[x]=Y,A[x+1]=M}x=o.length;let k=E.setArraySize(o,x+3*(v-2));v--;for(let T=1;T<v;T++,x+=3)k[x]=h,k[x+1]=h+T,k[x+2]=h+T+1;h+=v+1}else{let y=E.setArraySize(l,x+6);y[x]=f,y[x+1]=m,y[x+2]=u,y[x+3]=p,y[x+4]=b,y[x+5]=w,x=o.length;let v=E.setArraySize(o,x+3);v[x]=h,v[x+1]=h+1,v[x+2]=h+2,h+=3;break}}}}clipTrianglesRender(e,s,i,r,l,o,n){let a=this.clipOutput,h=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,f=d.length,m=n?12:8,u=0;h.length=0,c.length=0;for(let p=0;p<i;p+=3){let b=s[p]<<1,w=e[b],g=e[b+1],x=r[b],y=r[b+1];b=s[p+1]<<1;let v=e[b],C=e[b+1],A=r[b],k=r[b+1];b=s[p+2]<<1;let T=e[b],Y=e[b+1],M=r[b],R=r[b+1];for(let X=0;X<f;X++){let I=h.length;if(this.clip(w,g,v,C,T,Y,d[X],a)){let F=a.length;if(F==0)continue;let L=C-Y,O=T-v,D=w-T,_=Y-g,j=1/(L*D+O*(g-Y)),G=F>>1,K=this.clipOutput,V=E.setArraySize(h,I+G*m);for(let $=0;$<F;$+=2,I+=m){let oe=K[$],Z=K[$+1];V[I]=oe,V[I+1]=Z,V[I+2]=l.r,V[I+3]=l.g,V[I+4]=l.b,V[I+5]=l.a;let ie=oe-T,ne=Z-Y,fe=(L*ie+O*ne)*j,Xe=(_*ie+D*ne)*j,_e=1-fe-Xe;V[I+6]=x*fe+A*Xe+M*_e,V[I+7]=y*fe+k*Xe+R*_e,n&&(V[I+8]=o.r,V[I+9]=o.g,V[I+10]=o.b,V[I+11]=o.a)}I=c.length;let q=E.setArraySize(c,I+3*(G-2));G--;for(let $=1;$<G;$++,I+=3)q[I]=u,q[I+1]=u+$,q[I+2]=u+$+1;u+=G+1}else{let F=E.setArraySize(h,I+3*m);F[I]=w,F[I+1]=g,F[I+2]=l.r,F[I+3]=l.g,F[I+4]=l.b,F[I+5]=l.a,n?(F[I+6]=x,F[I+7]=y,F[I+8]=o.r,F[I+9]=o.g,F[I+10]=o.b,F[I+11]=o.a,F[I+12]=v,F[I+13]=C,F[I+14]=l.r,F[I+15]=l.g,F[I+16]=l.b,F[I+17]=l.a,F[I+18]=A,F[I+19]=k,F[I+20]=o.r,F[I+21]=o.g,F[I+22]=o.b,F[I+23]=o.a,F[I+24]=T,F[I+25]=Y,F[I+26]=l.r,F[I+27]=l.g,F[I+28]=l.b,F[I+29]=l.a,F[I+30]=M,F[I+31]=R,F[I+32]=o.r,F[I+33]=o.g,F[I+34]=o.b,F[I+35]=o.a):(F[I+6]=x,F[I+7]=y,F[I+8]=v,F[I+9]=C,F[I+10]=l.r,F[I+11]=l.g,F[I+12]=l.b,F[I+13]=l.a,F[I+14]=A,F[I+15]=k,F[I+16]=T,F[I+17]=Y,F[I+18]=l.r,F[I+19]=l.g,F[I+20]=l.b,F[I+21]=l.a,F[I+22]=M,F[I+23]=R),I=c.length;let L=E.setArraySize(c,I+3);L[I]=u,L[I+1]=u+1,L[I+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(e,s,i,r){let l=this.clipOutput,o=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,h=this.clippingPolygons,c=h.length,d=0;o.length=0,n.length=0,a.length=0;for(let f=0;f<i;f+=3){let m=s[f]<<1,u=e[m],p=e[m+1],b=r[m],w=r[m+1];m=s[f+1]<<1;let g=e[m],x=e[m+1],y=r[m],v=r[m+1];m=s[f+2]<<1;let C=e[m],A=e[m+1],k=r[m],T=r[m+1];for(let Y=0;Y<c;Y++){let M=o.length;if(this.clip(u,p,g,x,C,A,h[Y],l)){let R=l.length;if(R==0)continue;let X=x-A,I=C-g,F=u-C,L=A-p,O=1/(X*F+I*(p-A)),D=R>>1,_=this.clipOutput,j=E.setArraySize(o,M+D*2),G=E.setArraySize(n,M+D*2);for(let V=0;V<R;V+=2,M+=2){let q=_[V],$=_[V+1];j[M]=q,j[M+1]=$;let oe=q-C,Z=$-A,ie=(X*oe+I*Z)*O,ne=(L*oe+F*Z)*O,fe=1-ie-ne;G[M]=b*ie+y*ne+k*fe,G[M+1]=w*ie+v*ne+T*fe}M=a.length;let K=E.setArraySize(a,M+3*(D-2));D--;for(let V=1;V<D;V++,M+=3)K[M]=d,K[M+1]=d+V,K[M+2]=d+V+1;d+=D+1}else{let R=E.setArraySize(o,M+6);R[M]=u,R[M+1]=p,R[M+2]=g,R[M+3]=x,R[M+4]=C,R[M+5]=A;let X=E.setArraySize(n,M+3*2);X[M]=b,X[M+1]=w,X[M+2]=y,X[M+3]=v,X[M+4]=k,X[M+5]=T,M=a.length;let I=E.setArraySize(a,M+3);I[M]=d,I[M+1]=d+1,I[M+2]=d+2,d+=3;break}}}}clip(e,s,i,r,l,o,n,a){let h=a,c=!1,d;n.length%4>=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(e),d.push(s),d.push(i),d.push(r),d.push(l),d.push(o),d.push(e),d.push(s),a.length=0;let f=n.length-4,m=n;for(let u=0;;u+=2){let p=m[u],b=m[u+1],w=p-m[u+2],g=b-m[u+3],x=a.length,y=d;for(let C=0,A=d.length-2;C<A;){let k=y[C],T=y[C+1];C+=2;let Y=y[C],M=y[C+1],R=g*(p-Y)>w*(b-M),X=g*(p-k)-w*(b-T);if(X>0){if(R){a.push(Y),a.push(M);continue}let I=Y-k,F=M-T,L=X/(I*g-F*w);if(L>=0&&L<=1)a.push(k+I*L),a.push(T+F*L);else{a.push(Y),a.push(M);continue}}else if(R){let I=Y-k,F=M-T,L=X/(I*g-F*w);if(L>=0&&L<=1)a.push(k+I*L),a.push(T+F*L),a.push(Y),a.push(M);else{a.push(Y),a.push(M);continue}}c=!0}if(x==a.length)return h.length=0,!0;if(a.push(a[0]),a.push(a[1]),u==f)break;let v=a;a=d,a.length=0,d=v}if(h!=a){h.length=0;for(let u=0,p=a.length-2;u<p;u++)h[u]=a[u]}else h.length=h.length-2;return c}static makeClockwise(e){let s=e,i=e.length,r=s[i-2]*s[1]-s[0]*s[i-1],l=0,o=0,n=0,a=0;for(let h=0,c=i-3;h<c;h+=2)l=s[h],o=s[h+1],n=s[h+2],a=s[h+3],r+=l*a-n*o;if(!(r<0))for(let h=0,c=i-2,d=i>>1;h<d;h+=2){let f=s[h],m=s[h+1],u=c-h;s[h]=s[u],s[h+1]=s[u+1],s[u]=f,s[u+1]=m}}},Js=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,s=new Ge,i=typeof t=="string"?JSON.parse(t):t,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=S(r,"referenceScale",100)*e,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let l=0;l<i.bones.length;l++){let o=i.bones[l],n=null,a=S(o,"parent",null);a&&(n=s.findBone(a));let h=new es(s.bones.length,o.name,n);h.length=S(o,"length",0)*e,h.x=S(o,"x",0)*e,h.y=S(o,"y",0)*e,h.rotation=S(o,"rotation",0),h.scaleX=S(o,"scaleX",1),h.scaleY=S(o,"scaleY",1),h.shearX=S(o,"shearX",0),h.shearY=S(o,"shearY",0),h.inherit=E.enumValue(Q,S(o,"inherit","Normal")),h.skinRequired=S(o,"skin",!1);let c=S(o,"color",null);c&&h.color.setFromString(c),s.bones.push(h)}if(i.slots)for(let l=0;l<i.slots.length;l++){let o=i.slots[l],n=o.name,a=s.findBone(o.bone);if(!a)throw new Error(`Couldn't find bone ${o.bone} for slot ${n}`);let h=new os(s.slots.length,n,a),c=S(o,"color",null);c&&h.color.setFromString(c);let d=S(o,"dark",null);d&&(h.darkColor=N.fromString(d)),h.attachmentName=S(o,"attachment",null),h.blendMode=E.enumValue(Ae,S(o,"blend","normal")),h.visible=S(o,"visible",!0),s.slots.push(h)}if(i.ik)for(let l=0;l<i.ik.length;l++){let o=i.ik[l],n=new is(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);for(let h=0;h<o.bones.length;h++){let c=s.findBone(o.bones[h]);if(!c)throw new Error(`Couldn't find bone ${o.bones[h]} for IK constraint ${o.name}.`);n.bones.push(c)}let a=s.findBone(o.target);if(!a)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);n.target=a,n.mix=S(o,"mix",1),n.softness=S(o,"softness",0)*e,n.bendDirection=S(o,"bendPositive",!0)?1:-1,n.compress=S(o,"compress",!1),n.stretch=S(o,"stretch",!1),n.uniform=S(o,"uniform",!1),s.ikConstraints.push(n)}if(i.transform)for(let l=0;l<i.transform.length;l++){let o=i.transform[l],n=new ls(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);n.bones.push(f)}let a=o.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for transform constraint ${o.name}.`);n.target=h,n.local=S(o,"local",!1),n.relative=S(o,"relative",!1),n.offsetRotation=S(o,"rotation",0),n.offsetX=S(o,"x",0)*e,n.offsetY=S(o,"y",0)*e,n.offsetScaleX=S(o,"scaleX",0),n.offsetScaleY=S(o,"scaleY",0),n.offsetShearY=S(o,"shearY",0),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),n.mixScaleX=S(o,"mixScaleX",1),n.mixScaleY=S(o,"mixScaleY",n.mixScaleX),n.mixShearY=S(o,"mixShearY",1),s.transformConstraints.push(n)}if(i.path)for(let l=0;l<i.path.length;l++){let o=i.path[l],n=new ns(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let d=o.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);n.bones.push(f)}let a=o.target,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find target slot ${a} for path constraint ${o.name}.`);n.target=h,n.positionMode=E.enumValue(ge,S(o,"positionMode","Percent")),n.spacingMode=E.enumValue(ee,S(o,"spacingMode","Length")),n.rotateMode=E.enumValue(Ie,S(o,"rotateMode","Tangent")),n.offsetRotation=S(o,"rotation",0),n.position=S(o,"position",0),n.positionMode==ge.Fixed&&(n.position*=e),n.spacing=S(o,"spacing",0),(n.spacingMode==ee.Length||n.spacingMode==ee.Fixed)&&(n.spacing*=e),n.mixRotate=S(o,"mixRotate",1),n.mixX=S(o,"mixX",1),n.mixY=S(o,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let l=0;l<i.physics.length;l++){const o=i.physics[l],n=new Gs(o.name);n.order=S(o,"order",0),n.skinRequired=S(o,"skin",!1);const a=o.bone,h=s.findBone(a);if(h==null)throw new Error("Physics bone not found: "+a);n.bone=h,n.x=S(o,"x",0),n.y=S(o,"y",0),n.rotate=S(o,"rotate",0),n.scaleX=S(o,"scaleX",0),n.shearX=S(o,"shearX",0),n.limit=S(o,"limit",5e3)*e,n.step=1/S(o,"fps",60),n.inertia=S(o,"inertia",1),n.strength=S(o,"strength",100),n.damping=S(o,"damping",1),n.massInverse=1/S(o,"mass",1),n.wind=S(o,"wind",0),n.gravity=S(o,"gravity",0),n.mix=S(o,"mix",1),n.inertiaGlobal=S(o,"inertiaGlobal",!1),n.strengthGlobal=S(o,"strengthGlobal",!1),n.dampingGlobal=S(o,"dampingGlobal",!1),n.massGlobal=S(o,"massGlobal",!1),n.windGlobal=S(o,"windGlobal",!1),n.gravityGlobal=S(o,"gravityGlobal",!1),n.mixGlobal=S(o,"mixGlobal",!1),s.physicsConstraints.push(n)}if(i.skins)for(let l=0;l<i.skins.length;l++){let o=i.skins[l],n=new He(o.name);if(o.bones)for(let a=0;a<o.bones.length;a++){let h=o.bones[a],c=s.findBone(h);if(!c)throw new Error(`Couldn't find bone ${h} for skin ${o.name}.`);n.bones.push(c)}if(o.ik)for(let a=0;a<o.ik.length;a++){let h=o.ik[a],c=s.findIkConstraint(h);if(!c)throw new Error(`Couldn't find IK constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.transform)for(let a=0;a<o.transform.length;a++){let h=o.transform[a],c=s.findTransformConstraint(h);if(!c)throw new Error(`Couldn't find transform constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.path)for(let a=0;a<o.path.length;a++){let h=o.path[a],c=s.findPathConstraint(h);if(!c)throw new Error(`Couldn't find path constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}if(o.physics)for(let a=0;a<o.physics.length;a++){let h=o.physics[a],c=s.findPhysicsConstraint(h);if(!c)throw new Error(`Couldn't find physics constraint ${h} for skin ${o.name}.`);n.constraints.push(c)}for(let a in o.attachments){let h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for skin ${o.name}.`);let c=o.attachments[a];for(let d in c){let f=this.readAttachment(c[d],n,h.index,d,s);f&&n.setAttachment(h.index,d,f)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let l=0,o=this.linkedMeshes.length;l<o;l++){let n=this.linkedMeshes[l],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let h=a.getAttachment(n.slotIndex,n.parent);if(!h)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?h:n.mesh,n.mesh.setParentMesh(h),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let l in i.events){let o=i.events[l],n=new rs(l);n.intValue=S(o,"int",0),n.floatValue=S(o,"float",0),n.stringValue=S(o,"string",""),n.audioPath=S(o,"audio",null),n.audioPath&&(n.volume=S(o,"volume",1),n.balance=S(o,"balance",0)),s.events.push(n)}if(i.animations)for(let l in i.animations){let o=i.animations[l];this.readAnimation(o,l,s)}return s}readAttachment(t,e,s,i,r){let l=this.scale;switch(i=S(t,"name",i),S(t,"type","region")){case"region":{let o=S(t,"path",i),n=this.readSequence(S(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,o,n);if(!a)return null;a.path=o,a.x=S(t,"x",0)*l,a.y=S(t,"y",0)*l,a.scaleX=S(t,"scaleX",1),a.scaleY=S(t,"scaleY",1),a.rotation=S(t,"rotation",0),a.width=t.width*l,a.height=t.height*l,a.sequence=n;let h=S(t,"color",null);return h&&a.color.setFromString(h),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!o)return null;this.readVertices(t,o,t.vertexCount<<1);let n=S(t,"color",null);return n&&o.color.setFromString(n),o}case"mesh":case"linkedmesh":{let o=S(t,"path",i),n=this.readSequence(S(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,i,o,n);if(!a)return null;a.path=o;let h=S(t,"color",null);h&&a.color.setFromString(h),a.width=S(t,"width",0)*l,a.height=S(t,"height",0)*l,a.sequence=n;let c=S(t,"parent",null);if(c)return this.linkedMeshes.push(new ii(a,S(t,"skin",null),s,c,S(t,"timelines",!0))),a;let d=t.uvs;return this.readVertices(t,a,d.length),a.triangles=t.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=S(t,"edges",null),a.hullLength=S(t,"hull",0)*2,a}case"path":{let o=this.attachmentLoader.newPathAttachment(e,i);if(!o)return null;o.closed=S(t,"closed",!1),o.constantSpeed=S(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,o,n<<1);let a=E.newArray(n/3,0);for(let c=0;c<t.lengths.length;c++)a[c]=t.lengths[c]*l;o.lengths=a;let h=S(t,"color",null);return h&&o.color.setFromString(h),o}case"point":{let o=this.attachmentLoader.newPointAttachment(e,i);if(!o)return null;o.x=S(t,"x",0)*l,o.y=S(t,"y",0)*l,o.rotation=S(t,"rotation",0);let n=S(t,"color",null);return n&&o.color.setFromString(n),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(e,i);if(!o)return null;let n=S(t,"end",null);n&&(o.endSlot=r.findSlot(n));let a=t.vertexCount;this.readVertices(t,o,a<<1);let h=S(t,"color",null);return h&&o.color.setFromString(h),o}}return null}readSequence(t){if(t==null)return null;let e=new Ys(S(t,"count",0));return e.start=S(t,"start",1),e.digits=S(t,"digits",0),e.setupIndex=S(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let r=t.vertices;if(s==r.length){let n=E.toFloatArray(r);if(i!=1)for(let a=0,h=r.length;a<h;a++)n[a]*=i;e.vertices=n;return}let l=new Array,o=new Array;for(let n=0,a=r.length;n<a;){let h=r[n++];o.push(h);for(let c=n+h*4;n<c;n+=4)o.push(r[n]),l.push(r[n+1]*i),l.push(r[n+2]*i),l.push(r[n+3])}e.bones=o,e.vertices=E.toFloatArray(l)}readAnimation(t,e,s){let i=this.scale,r=new Array;if(t.slots)for(let o in t.slots){let n=t.slots[o],a=s.findSlot(o);if(!a)throw new Error("Slot not found: "+o);let h=a.index;for(let c in n){let d=n[c];if(!d)continue;let f=d.length;if(c=="attachment"){let m=new Fe(f,h);for(let u=0;u<f;u++){let p=d[u];m.setFrame(u,S(p,"time",0),S(p,"name",null))}r.push(m)}else if(c=="rgba"){let m=new It(f,f<<2,h),u=d[0],p=S(u,"time",0),b=N.fromString(u.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b,b.a);let x=d[w+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=N.fromString(x.color),C=u.curve;C&&(g=H(C,m,g,w,0,p,y,b.r,v.r,1),g=H(C,m,g,w,1,p,y,b.g,v.g,1),g=H(C,m,g,w,2,p,y,b.b,v.b,1),g=H(C,m,g,w,3,p,y,b.a,v.a,1)),p=y,b=v,u=x}r.push(m)}else if(c=="rgb"){let m=new Mt(f,f*3,h),u=d[0],p=S(u,"time",0),b=N.fromString(u.color);for(let w=0,g=0;;w++){m.setFrame(w,p,b.r,b.g,b.b);let x=d[w+1];if(!x){m.shrink(g);break}let y=S(x,"time",0),v=N.fromString(x.color),C=u.curve;C&&(g=H(C,m,g,w,0,p,y,b.r,v.r,1),g=H(C,m,g,w,1,p,y,b.g,v.g,1),g=H(C,m,g,w,2,p,y,b.b,v.b,1)),p=y,b=v,u=x}r.push(m)}else if(c=="alpha")r.push(pe(d,new Yt(f,f,h),0,1));else if(c=="rgba2"){let m=new Ft(f,f*7,h),u=d[0],p=S(u,"time",0),b=N.fromString(u.light),w=N.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,b.a,w.r,w.g,w.b);let y=d[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),C=N.fromString(y.light),A=N.fromString(y.dark),k=u.curve;k&&(x=H(k,m,x,g,0,p,v,b.r,C.r,1),x=H(k,m,x,g,1,p,v,b.g,C.g,1),x=H(k,m,x,g,2,p,v,b.b,C.b,1),x=H(k,m,x,g,3,p,v,b.a,C.a,1),x=H(k,m,x,g,4,p,v,w.r,A.r,1),x=H(k,m,x,g,5,p,v,w.g,A.g,1),x=H(k,m,x,g,6,p,v,w.b,A.b,1)),p=v,b=C,w=A,u=y}r.push(m)}else if(c=="rgb2"){let m=new Pt(f,f*6,h),u=d[0],p=S(u,"time",0),b=N.fromString(u.light),w=N.fromString(u.dark);for(let g=0,x=0;;g++){m.setFrame(g,p,b.r,b.g,b.b,w.r,w.g,w.b);let y=d[g+1];if(!y){m.shrink(x);break}let v=S(y,"time",0),C=N.fromString(y.light),A=N.fromString(y.dark),k=u.curve;k&&(x=H(k,m,x,g,0,p,v,b.r,C.r,1),x=H(k,m,x,g,1,p,v,b.g,C.g,1),x=H(k,m,x,g,2,p,v,b.b,C.b,1),x=H(k,m,x,g,3,p,v,w.r,A.r,1),x=H(k,m,x,g,4,p,v,w.g,A.g,1),x=H(k,m,x,g,5,p,v,w.b,A.b,1)),p=v,b=C,w=A,u=y}r.push(m)}}}if(t.bones)for(let o in t.bones){let n=t.bones[o],a=s.findBone(o);if(!a)throw new Error("Bone not found: "+o);let h=a.index;for(let c in n){let d=n[c],f=d.length;if(f!=0){if(c==="rotate")r.push(pe(d,new We(f,f,h),0,1));else if(c==="translate"){let m=new xt(f,f<<1,h);r.push(ds(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new bt(f,f,h);r.push(pe(d,m,0,i))}else if(c==="translatey"){let m=new wt(f,f,h);r.push(pe(d,m,0,i))}else if(c==="scale"){let m=new yt(f,f<<1,h);r.push(ds(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new vt(f,f,h);r.push(pe(d,m,1,1))}else if(c==="scaley"){let m=new Ct(f,f,h);r.push(pe(d,m,1,1))}else if(c==="shear"){let m=new At(f,f<<1,h);r.push(ds(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new St(f,f,h);r.push(pe(d,m,0,1))}else if(c==="sheary"){let m=new kt(f,f,h);r.push(pe(d,m,0,1))}else if(c==="inherit"){let m=new Tt(f,a.index);for(let u=0;u<d.length;u++){let p=d[u];m.setFrame(u,S(p,"time",0),E.enumValue(Q,S(p,"inherit","Normal")))}r.push(m)}}}}if(t.ik)for(let o in t.ik){let n=t.ik[o],a=n[0];if(!a)continue;let h=s.findIkConstraint(o);if(!h)throw new Error("IK Constraint not found: "+o);let c=s.ikConstraints.indexOf(h),d=new Xt(n.length,n.length<<1,c),f=S(a,"time",0),m=S(a,"mix",1),u=S(a,"softness",0)*i;for(let p=0,b=0;;p++){d.setFrame(p,f,m,u,S(a,"bendPositive",!0)?1:-1,S(a,"compress",!1),S(a,"stretch",!1));let w=n[p+1];if(!w){d.shrink(b);break}let g=S(w,"time",0),x=S(w,"mix",1),y=S(w,"softness",0)*i,v=a.curve;v&&(b=H(v,d,b,p,0,f,g,m,x,1),b=H(v,d,b,p,1,f,g,u,y,i)),f=g,m=x,u=y,a=w}r.push(d)}if(t.transform)for(let o in t.transform){let n=t.transform[o],a=n[0];if(!a)continue;let h=s.findTransformConstraint(o);if(!h)throw new Error("Transform constraint not found: "+o);let c=s.transformConstraints.indexOf(h),d=new Bt(n.length,n.length*6,c),f=S(a,"time",0),m=S(a,"mixRotate",1),u=S(a,"mixX",1),p=S(a,"mixY",u),b=S(a,"mixScaleX",1),w=S(a,"mixScaleY",b),g=S(a,"mixShearY",1);for(let x=0,y=0;;x++){d.setFrame(x,f,m,u,p,b,w,g);let v=n[x+1];if(!v){d.shrink(y);break}let C=S(v,"time",0),A=S(v,"mixRotate",1),k=S(v,"mixX",1),T=S(v,"mixY",k),Y=S(v,"mixScaleX",1),M=S(v,"mixScaleY",Y),R=S(v,"mixShearY",1),X=a.curve;X&&(y=H(X,d,y,x,0,f,C,m,A,1),y=H(X,d,y,x,1,f,C,u,k,1),y=H(X,d,y,x,2,f,C,p,T,1),y=H(X,d,y,x,3,f,C,b,Y,1),y=H(X,d,y,x,4,f,C,w,M,1),y=H(X,d,y,x,5,f,C,g,R,1)),f=C,m=A,u=k,p=T,b=Y,w=M,b=Y,a=v}r.push(d)}if(t.path)for(let o in t.path){let n=t.path[o],a=s.findPathConstraint(o);if(!a)throw new Error("Path constraint not found: "+o);let h=s.pathConstraints.indexOf(a);for(let c in n){let d=n[c],f=d[0];if(!f)continue;let m=d.length;if(c==="position"){let u=new Et(m,m,h);r.push(pe(d,u,0,a.positionMode==ge.Fixed?i:1))}else if(c==="spacing"){let u=new Lt(m,m,h);r.push(pe(d,u,0,a.spacingMode==ee.Length||a.spacingMode==ee.Fixed?i:1))}else if(c==="mix"){let u=new Vt(m,m*3,h),p=S(f,"time",0),b=S(f,"mixRotate",1),w=S(f,"mixX",1),g=S(f,"mixY",w);for(let x=0,y=0;;x++){u.setFrame(x,p,b,w,g);let v=d[x+1];if(!v){u.shrink(y);break}let C=S(v,"time",0),A=S(v,"mixRotate",1),k=S(v,"mixX",1),T=S(v,"mixY",k),Y=f.curve;Y&&(y=H(Y,u,y,x,0,p,C,b,A,1),y=H(Y,u,y,x,1,p,C,w,k,1),y=H(Y,u,y,x,2,p,C,g,T,1)),p=C,b=A,w=k,g=T,f=v}r.push(u)}}}if(t.physics)for(let o in t.physics){let n=t.physics[o],a=-1;if(o.length>0){let h=s.findPhysicsConstraint(o);if(!h)throw new Error("Physics constraint not found: "+o);a=s.physicsConstraints.indexOf(h)}for(let h in n){let c=n[h],d=c[0];if(!d)continue;let f=c.length;if(h=="reset"){const u=new zt(f,a);for(let p=0;d!=null;d=c[p+1],p++)u.setFrame(p,S(d,"time",0));r.push(u);continue}let m;if(h=="inertia")m=new Dt(f,f,a);else if(h=="strength")m=new Nt(f,f,a);else if(h=="damping")m=new Ot(f,f,a);else if(h=="mass")m=new _t(f,f,a);else if(h=="wind")m=new Ut(f,f,a);else if(h=="gravity")m=new qt(f,f,a);else if(h=="mix")m=new Wt(f,f,a);else continue;r.push(pe(c,m,0,1))}}if(t.attachments)for(let o in t.attachments){let n=t.attachments[o],a=s.findSkin(o);if(!a)throw new Error("Skin not found: "+o);for(let h in n){let c=n[h],d=s.findSlot(h);if(!d)throw new Error("Slot not found: "+h);let f=d.index;for(let m in c){let u=c[m],p=a.getAttachment(f,m);for(let b in u){let w=u[b],g=w[0];if(g){if(b=="deform"){let x=p.bones,y=p.vertices,v=x?y.length/3*2:y.length,C=new Rt(w.length,w.length,f,p),A=S(g,"time",0);for(let k=0,T=0;;k++){let Y,M=S(g,"vertices",null);if(!M)Y=x?E.newFloatArray(v):y;else{Y=E.newFloatArray(v);let F=S(g,"offset",0);if(E.arrayCopy(M,0,Y,F,M.length),i!=1)for(let L=F,O=L+M.length;L<O;L++)Y[L]*=i;if(!x)for(let L=0;L<v;L++)Y[L]+=y[L]}C.setFrame(k,A,Y);let R=w[k+1];if(!R){C.shrink(T);break}let X=S(R,"time",0),I=g.curve;I&&(T=H(I,C,T,k,0,A,X,0,1,1)),A=X,g=R}r.push(C)}else if(b=="sequence"){let x=new Gt(w.length,f,p),y=0;for(let v=0;v<w.length;v++){let C=S(g,"delay",y),A=S(g,"time",0),k=se[S(g,"mode","hold")],T=S(g,"index",0);x.setFrame(v,A,k,T,C),y=C,g=w[v+1]}r.push(x)}}}}}}if(t.drawOrder){let o=new Le(t.drawOrder.length),n=s.slots.length,a=0;for(let h=0;h<t.drawOrder.length;h++,a++){let c=t.drawOrder[h],d=null,f=S(c,"offsets",null);if(f){d=E.newArray(n,-1);let m=E.newArray(n-f.length,0),u=0,p=0;for(let b=0;b<f.length;b++){let w=f[b],g=s.findSlot(w.slot);if(!g)throw new Error("Slot not found: "+g);let x=g.index;for(;u!=x;)m[p++]=u++;d[u+w.offset]=u++}for(;u<n;)m[p++]=u++;for(let b=n-1;b>=0;b--)d[b]==-1&&(d[b]=m[--p])}o.setFrame(a,S(c,"time",0),d)}r.push(o)}if(t.events){let o=new tt(t.events.length),n=0;for(let a=0;a<t.events.length;a++,n++){let h=t.events[a],c=s.findEvent(h.name);if(!c)throw new Error("Event not found: "+h.name);let d=new ss(E.toSinglePrecision(S(h,"time",0)),c);d.intValue=S(h,"int",c.intValue),d.floatValue=S(h,"float",c.floatValue),d.stringValue=S(h,"string",c.stringValue),d.data.audioPath&&(d.volume=S(h,"volume",1),d.balance=S(h,"balance",0)),o.setFrame(n,d)}r.push(o)}let l=0;for(let o=0,n=r.length;o<n;o++)l=Math.max(l,r[o].getDuration());s.animations.push(new Ze(e,r,l))}},ii=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,s,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function pe(t,e,s,i){let r=t[0],l=S(r,"time",0),o=S(r,"value",s)*i,n=0;for(let a=0;;a++){e.setFrame(a,l,o);let h=t[a+1];if(!h)return e.shrink(n),e;let c=S(h,"time",0),d=S(h,"value",s)*i;r.curve&&(n=H(r.curve,e,n,a,0,l,c,o,d,i)),l=c,o=d,r=h}}function ds(t,e,s,i,r,l){let o=t[0],n=S(o,"time",0),a=S(o,s,r)*l,h=S(o,i,r)*l,c=0;for(let d=0;;d++){e.setFrame(d,n,a,h);let f=t[d+1];if(!f)return e.shrink(c),e;let m=S(f,"time",0),u=S(f,s,r)*l,p=S(f,i,r)*l,b=o.curve;b&&(c=H(b,e,c,d,0,n,m,a,u,l),c=H(b,e,c,d,1,n,m,h,p,l)),n=m,a=u,h=p,o=f}}function H(t,e,s,i,r,l,o,n,a,h){if(t=="stepped")return e.setStepped(i),s;let c=r<<2,d=t[c],f=t[c+1]*h,m=t[c+2],u=t[c+3]*h;return e.setBezier(s,i,r,l,n,d,f,m,u,o,a),s+1}function S(t,e,s){return t[e]!==void 0?t[e]:s}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));import{checkExtension as fs,copySearchParams as ni,DOMAdapter as ai,ExtensionType as Ks,extensions as oi,LoaderParserPriority as li,path as at,Resolver as hi,TextureSource as Qs}from"pixi.js";import{Texture as ci}from"pixi.js";var us=class ke extends Qt{static textureMap=new Map;static from(e){return ke.textureMap.has(e)?ke.textureMap.get(e):new ke(e)}texture;constructor(e){super(e.resource),this.texture=ci.from(e)}setFilters(e,s){const i=this.texture.source.style;i.minFilter=ke.toPixiTextureFilter(e),i.magFilter=ke.toPixiTextureFilter(s),this.texture.source.autoGenerateMipmaps=ke.toPixiMipMap(e),this.texture.source.updateMipmaps()}setWraps(e,s){const i=this.texture.source.style;i.addressModeU=ke.toPixiTextureWrap(e),i.addressModeV=ke.toPixiTextureWrap(s)}dispose(){this.texture.destroy()}static toPixiMipMap(e){switch(e){case te.Nearest:case te.Linear:return!1;case te.MipMapNearestLinear:case te.MipMapNearestNearest:case te.MipMapLinearLinear:case te.MipMapLinearNearest:return!0;default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureFilter(e){switch(e){case te.Nearest:case te.MipMapNearestLinear:case te.MipMapNearestNearest:return"nearest";case te.Linear:case te.MipMapLinearLinear:case te.MipMapLinearNearest:return"linear";default:throw new Error(`Unknown texture filter: ${String(e)}`)}}static toPixiTextureWrap(e){switch(e){case ye.ClampToEdge:return"clamp-to-edge";case ye.MirroredRepeat:return"mirror-repeat";case ye.Repeat:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(e)}`)}}static toPixiBlending(e){switch(e){case Ae.Normal:return"normal";case Ae.Additive:return"add";case Ae.Multiply:return"multiply";case Ae.Screen:return"screen";default:throw new Error(`Unknown blendMode: ${String(e)}`)}}},$e="spineTextureAtlasLoader",di={extension:Ks.Asset,resolver:{test:t=>fs(t,".atlas"),parse:t=>{const e=t.split(".");return{resolution:parseFloat(hi.RETINA_PREFIX?.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{id:$e,name:$e,extension:{type:Ks.LoadParser,priority:li.Normal,name:$e},test(t){return fs(t,".atlas")},async load(t){return await(await ai.get().fetch(t)).text()},testParse(t,e){const s=fs(e.src,".atlas"),i=typeof t=="string",r=e.parser===$e||e.loadParser===$e;return Promise.resolve((s||r)&&i)},unload(t){t.dispose()},async parse(t,e,s){const i=e.data||{};let r=at.dirname(e.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");const l=new it(t);if(i.images instanceof Qs||typeof i.images=="string"){const n=i.images;i.images={},i.images[l.pages[0].name]=n}const o=[];for(const n of l.pages){const a=n.name,h=i?.images?i.images[a]:void 0;if(h instanceof Qs)n.setTexture(us.from(h));else{const c=h??at.normalize([...r.split(at.sep),a].join(at.sep)),d={src:ni(c,e.src),data:{...i.imageMetadata,alphaMode:n.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"}},f=s.load(d).then(m=>{n.setTexture(us.from(m.source))});o.push(f)}}return await Promise.all(o),l}}};oi.add(di);import{checkExtension as ms,DOMAdapter as fi,ExtensionType as Zs,extensions as ui,LoaderParserPriority as mi}from"pixi.js";var je="spineSkeletonLoader";function gi(t){return Object.prototype.hasOwnProperty.call(t,"bones")}function pi(t){return t instanceof Uint8Array}var xi={extension:Zs.Asset,loader:{id:je,name:je,extension:{type:Zs.LoadParser,priority:mi.Normal,name:je},test(t){return ms(t,".skel")},async load(t){const e=await fi.get().fetch(t);return new Uint8Array(await e.arrayBuffer())},testParse(t,e){const s=ms(e.src,".json")&&gi(t),i=ms(e.src,".skel")&&pi(t),r=e.parser===je||e.loadParser===je;return Promise.resolve(s||i||r)}}};ui.add(xi);import{Batcher as bi,Color as wi,extensions as yi,ExtensionType as vi}from"pixi.js";import{Buffer as er,BufferUsage as ot,Geometry as Ci}from"pixi.js";var Ai=new Float32Array(1),Si=new Uint32Array(1),ki=class extends Ci{constructor(){const e=new er({data:Ai,label:"attribute-batch-buffer",usage:ot.VERTEX|ot.COPY_DST,shrinkToFit:!1}),s=new er({data:Si,label:"index-batch-buffer",usage:ot.INDEX|ot.COPY_DST,shrinkToFit:!1}),i=7*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:4*4},aDarkColor:{buffer:e,format:"unorm8x4",stride:i,offset:5*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:6*4}},indexBuffer:s})}};import{colorBit as Ti,colorBitGl as Ii,compileHighShaderGlProgram as Mi,compileHighShaderGpuProgram as Yi,generateTextureBatchBit as Fi,generateTextureBatchBitGl as Pi,getBatchSamplersUniformGroup as Ri,roundPixelsBit as Xi,roundPixelsBitGl as Bi,Shader as Ei}from"pixi.js";var Li={name:"color-bit",vertex:{header:`
|
|
3
3
|
@in aDarkColor: vec4<f32>;
|
|
4
4
|
@out vDarkColor: vec4<f32>;
|
|
5
5
|
`,main:`
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
finalColor = vec4<f32>(rgb, alpha);
|
|
15
15
|
|
|
16
|
-
`}},
|
|
16
|
+
`}},Vi={name:"color-bit",vertex:{header:`
|
|
17
17
|
in vec4 aDarkColor;
|
|
18
18
|
out vec4 vDarkColor;
|
|
19
19
|
`,main:`
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
|
|
25
25
|
finalColor.a = outColor.a * vColor.a;
|
|
26
26
|
finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;
|
|
27
|
-
`}},Vi=class extends Bi{constructor(t){const e=Ii({name:"dark-tint-batch",bits:[Ti,Li,Fi(t),Xi]}),s=Mi({name:"dark-tint-batch",bits:[ki,Ei,Yi(t),Ri]});super({glProgram:e,gpuProgram:s,resources:{batchSamplers:Pi(t)}})}},tr=null,Di=class mr extends xi{static extension={type:[yi.Batcher],name:"darkTint"};geometry=new Si;shader=tr||(tr=new Vi(this.maxTextures));name=mr.extension.name;vertexSize=7;packAttributes(e,s,i,r,l){const o=l<<16|e.roundPixels&65535,n=e.transform,a=n.a,h=n.b,c=n.c,d=n.d,f=n.tx,m=n.ty,{positions:u,uvs:p}=e,b=e.color,w=(b>>24&255)/255,g=bi.shared.setValue(e.darkColor).premultiply(w,!0).toPremultiplied(1,!1),x=e.attributeOffset,y=x+e.attributeSize;for(let v=x;v<y;v++){const C=v*2,A=u[C],k=u[C+1];s[r++]=a*A+c*k+f,s[r++]=d*k+h*A+m,s[r++]=p[C],s[r++]=p[C+1],i[r++]=b,i[r++]=g,i[r++]=o}}packQuadAttributes(e,s,i,r,l){const o=e.texture,n=e.transform,a=n.a,h=n.b,c=n.c,d=n.d,f=n.tx,m=n.ty,u=e.bounds,p=u.maxX,b=u.minX,w=u.maxY,g=u.minY,x=o.uvs,y=e.color,v=e.darkColor,C=l<<16|e.roundPixels&65535;s[r+0]=a*b+c*g+f,s[r+1]=d*g+h*b+m,s[r+2]=x.x0,s[r+3]=x.y0,i[r+4]=y,i[r+5]=v,i[r+6]=C,s[r+7]=a*p+c*g+f,s[r+8]=d*g+h*p+m,s[r+9]=x.x1,s[r+10]=x.y1,i[r+11]=y,i[r+12]=v,i[r+13]=C,s[r+14]=a*p+c*w+f,s[r+15]=d*w+h*p+m,s[r+16]=x.x2,s[r+17]=x.y2,i[r+18]=y,i[r+19]=v,i[r+20]=C,s[r+21]=a*b+c*w+f,s[r+22]=d*w+h*b+m,s[r+23]=x.x3,s[r+24]=x.y3,i[r+25]=y,i[r+26]=v,i[r+27]=C}};wi.add(Di);var Ni=E.newFloatArray(8),Oi=class ft{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=E.newFloatArray(8*1024);tempColor=new N;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let s=this.ctx,i=this.tempColor,r=e.color,l=e.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let o=0,n=l.length;o<n;o++){let a=l[o],h=a.bone;if(!h.active)continue;let c=a.getAttachment();if(!(c instanceof W))continue;c.computeWorldVertices(a,Ni,0,2);let d=c.region,f=d.texture.getImage(),m=a.color,u=c.color;i.set(r.r*m.r*u.r,r.g*m.g*u.g,r.b*m.b*u.b,r.a*m.a*u.a),s.save(),s.transform(h.a,h.c,h.b,h.d,h.worldX,h.worldY),s.translate(c.offset[0],c.offset[1]),s.rotate(c.rotation*Math.PI/180);let p=c.width/d.originalWidth;s.scale(p*c.scaleX,p*c.scaleY);let b=d.width,w=d.height;if(s.translate(b/2,w/2),c.region.degrees==90){let g=b;b=w,w=g,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-b/2,-w/2),s.globalAlpha=i.a,s.drawImage(f,f.width*d.u,f.height*d.v,b,w,0,0,b,w),this.debugRendering&&s.strokeRect(0,0,b,w),s.restore()}}drawTriangles(e){let s=this.ctx,i=this.tempColor,r=e.color,l=e.drawOrder,o=null,n=this.vertices,a=null;for(let c=0,d=l.length;c<d;c++){let f=l[c],m=f.getAttachment(),u,p;if(m instanceof W){let b=m;n=this.computeRegionVertices(f,b,!1),a=ft.QUAD_TRIANGLES,u=b.region.texture.getImage()}else if(m instanceof me){let b=m;n=this.computeMeshVertices(f,b,!1),a=b.triangles,u=b.region.texture.getImage()}else continue;if(u){f.data.blendMode!=o&&(o=f.data.blendMode);let b=f.color,w=m.color;i.set(r.r*b.r*w.r,r.g*b.g*w.g,r.b*b.b*w.b,r.a*b.a*w.a),s.globalAlpha=i.a;for(var h=0;h<a.length;h+=3){let g=a[h]*8,x=a[h+1]*8,y=a[h+2]*8,v=n[g],C=n[g+1],A=n[g+6],k=n[g+7],T=n[x],Y=n[x+1],M=n[x+6],R=n[x+7],X=n[y],I=n[y+1],F=n[y+6],L=n[y+7];this.drawTriangle(u,v,C,A,k,T,Y,M,R,X,I,F,L),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(v,C),s.lineTo(T,Y),s.lineTo(X,I),s.lineTo(v,C),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,i,r,l,o,n,a,h,c,d,f,m){let u=this.ctx;const p=e.width-1,b=e.height-1;r*=p,l*=b,a*=p,h*=b,f*=p,m*=b,u.beginPath(),u.moveTo(s,i),u.lineTo(o,n),u.lineTo(c,d),u.closePath(),o-=s,n-=i,c-=s,d-=i,a-=r,h-=l,f-=r,m-=l;let w=a*m-f*h;if(w==0)return;w=1/w;const g=(m*o-h*c)*w,x=(m*n-h*d)*w,y=(a*c-f*o)*w,v=(a*d-f*n)*w,C=s-g*r-y*l,A=i-x*r-v*l;u.save(),u.transform(g,x,y,v,C,A),u.clip(),u.drawImage(e,0,0),u.restore()}computeRegionVertices(e,s,i){let r=e.bone.skeleton.color,l=e.color,o=s.color,n=r.a*l.a*o.a,a=i?n:1,h=this.tempColor;h.set(r.r*l.r*o.r*a,r.g*l.g*o.g*a,r.b*l.b*o.b*a,n),s.computeWorldVertices(e,this.vertices,0,ft.VERTEX_SIZE);let c=this.vertices,d=s.uvs;return c[W.C1R]=h.r,c[W.C1G]=h.g,c[W.C1B]=h.b,c[W.C1A]=h.a,c[W.U1]=d[0],c[W.V1]=d[1],c[W.C2R]=h.r,c[W.C2G]=h.g,c[W.C2B]=h.b,c[W.C2A]=h.a,c[W.U2]=d[2],c[W.V2]=d[3],c[W.C3R]=h.r,c[W.C3G]=h.g,c[W.C3B]=h.b,c[W.C3A]=h.a,c[W.U3]=d[4],c[W.V3]=d[5],c[W.C4R]=h.r,c[W.C4G]=h.g,c[W.C4B]=h.b,c[W.C4A]=h.a,c[W.U4]=d[6],c[W.V4]=d[7],c}computeMeshVertices(e,s,i){let r=e.bone.skeleton.color,l=e.color,o=s.color,n=r.a*l.a*o.a,a=i?n:1,h=this.tempColor;h.set(r.r*l.r*o.r*a,r.g*l.g*o.g*a,r.b*l.b*o.b*a,n);let c=s.worldVerticesLength/2,d=this.vertices;d.length<s.worldVerticesLength&&(this.vertices=d=E.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(e,0,s.worldVerticesLength,d,0,ft.VERTEX_SIZE);let f=s.uvs;for(let m=0,u=0,p=2;m<c;m++)d[p++]=h.r,d[p++]=h.g,d[p++]=h.b,d[p++]=h.a,d[p++]=f[u++],d[p++]=f[u++],p+=2;return d}};import{ExtensionType as gs,extensions as _i,RendererType as ps}from"pixi.js";var Ui=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 i;const r=t.a*s*255;if(e!==16777215){const l=e>>16&255,o=e>>8&255,n=e&255,a=t.r*n,h=t.g*o,c=t.b*l;i=r<<24|c<<16|h<<8|a}else i=r<<24|t.b*255<<16|t.g*255<<8|t.r*255;return i}get darkColor(){const t=this.data.darkColor;return t.b*255<<16|t.g*255<<8|t.r*255}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 r=e.clippedData;this.indexSize=r.indicesCount,this.attributeSize=r.vertexCount,this.positions=r.vertices,this.indices=r.indices,this.uvs=r.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"}},qi={0:"normal",1:"add",2:"multiply",3:"screen"},sr=class{static extension={type:[gs.WebGLPipes,gs.WebGPUPipes,gs.CanvasPipes],name:"spine"};renderer;canvasSkeletonRenderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(t){this.renderer=t}validateRenderable(t){if(this.renderer.type===ps.CANVAS||(t._validateAndTransformAttachments(),t.spineAttachmentsDirty))return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let i=0,r=e.length;i<r;i++){const l=e[i],o=l.getAttachment();if(o instanceof W||o instanceof me){const n=t._getCachedData(l,o),a=s.slotBatches[n.id],h=n.texture;if(h!==a?.texture&&!a?._batcher.checkAndUpdateTexture(a,h))return!0}}}return!1}execute(t){if(this.renderer.type===ps.CANVAS){const e=this.renderer,s=(t.groupColorAlpha>>>24&255)/255,i=e.canvasContext,r=i.activeContext;r.save(),this.canvasSkeletonRenderer||(this.canvasSkeletonRenderer=new Oi(r),this.canvasSkeletonRenderer.triangleRendering=!0),i.setContextTransform(t.groupTransform,(e._roundPixels|t._roundPixels)===1);const l=t.skeleton.color.a;t.skeleton.color.a*=s,this.canvasSkeletonRenderer.draw(t.skeleton),t.skeleton.color.a=l,r.restore()}}addRenderable(t,e){if(this.renderer.type===ps.CANVAS){this.renderer.renderPipes.batch.break(e),e.add(t);return}const s=this._getSpineData(t),i=this.renderer.renderPipes.batch,r=t.skeleton.drawOrder,l=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;for(let o=0,n=r.length;o<n;o++){const a=r[o],h=a.getAttachment(),c=qi[a.data.blendMode];let d=!1;if(h instanceof W||h instanceof me){const m=t._getCachedData(a,h),u=s.slotBatches[m.id]||=new Ui;u.setData(t,m,c,l),d=m.skipRender,d||i.addToBatch(u,e)}const f=t._slotsObject[a.data.name];if(f){const m=f.container;d||(m.includeInBuild=!0,m.collectRenderables(e,this.renderer,null)),m.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 i=0,r=s.length;i<r;i++){const l=s[i],o=l.getAttachment();if(o instanceof W||o instanceof me){const n=t._getCachedData(l,o);if(!n.skipRender){const a=e.slotBatches[n.id];a?._batcher?.updateElement(a)}}}}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]}};_i.add(sr);import{Assets as rr,Cache as xs,Container as Wi,fastCopy as zi,Graphics as Gi,Texture as Hi,Ticker as $i,ViewContainer as ji}from"pixi.js";var lt=new qe;De.yDown=!0;var Ne=new nt,Ji=class{constructor(t,e,s,i){this.x=t,this.y=e,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Ki=class{constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new De(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(de.update);const s=e.getBoundsRect(this.clipping?new nt:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},Qi=class{constructor(t,e=[],s=.05,i=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=i}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};const e=new Ht(t.state.data),s=new De(t.skeleton.data),i=this.clipping?new nt:void 0,r=s.data;if(this.skins.length>0){let o=new He("custom-skin");for(const n of this.skins){const a=r.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const l=this.animation!=null?r.findAnimation(this.animation):null;if(l==null){s.updateWorldTransform(de.update);const o=s.getBoundsRect(i);return o.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:o}else{let o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,l,!1);const c=Math.max(l.duration/this.timeStep,1);for(let f=0;f<c;f++){const m=f>0?this.timeStep:0;e.update(m),e.apply(s),s.update(m),s.updateWorldTransform(de.update);const u=s.getBoundsRect(i);o=Math.min(o,u.x),n=Math.min(n,u.y),a=Math.max(a,u.x+u.width),h=Math.max(h,u.y+u.height)}const d={x:o,y:n,width:a-o,height:h-n};return d.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},ir=new Ee(()=>new Gi),Zi=class Cs extends ji{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(e){let s;if(typeof e=="number"?s=this.skeleton.slots[e]:typeof e=="string"?s=this.skeleton.findSlot(e):s=e,!s)throw new Error(`No slot found with the given slot reference: ${e}`);return s}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(e){this._debug&&this._debug.unregisterSpine(this),e&&e.registerSpine(this),this._debug=e}_autoUpdate=!1;_ticker=$i.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!e&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=e}get ticker(){return this._ticker}set ticker(e){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(e){this._boundsProvider=e,e&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(e){e instanceof Ge&&(e={skeletonData:e}),super({}),this.allowChildren=!0;const s=e instanceof Ge?e:e.skeletonData;this.skeleton=new De(s),this.state=new Ht(new Es(s)),e?.ticker&&(this._ticker=e.ticker),this.autoUpdate=e?.autoUpdate??!0,this.darkTint=e?.darkTint===void 0?this.skeleton.slots.some(r=>!!r.data.darkColor):e?.darkTint;const i=this.skeleton.slots;for(let r=0;r<i.length;r++)this.attachmentCacheData[r]=Object.create(null);this._boundsProvider=e.boundsProvider}update(e){this.internalUpdate(0,e)}internalUpdate(e,s){this._updateAndApplyState(s??this._ticker.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(e,s){const i=e;if(typeof e=="string"&&(e=this.skeleton.findBone(e)),!e)throw Error(`Cant set bone position, bone ${String(i)} not found`);if(lt.set(s.x,s.y),e.parent){const r=e.parent.worldToLocal(lt);e.x=r.x,e.y=-r.y}else e.x=lt.x,e.y=lt.y}getBonePosition(e,s){const i=e;return typeof e=="string"&&(e=this.skeleton.findBone(e)),e?(s||(s={x:0,y:0}),s.x=e.worldX,s.y=e.worldY,s):(console.error(`Cant set bone position! Bone ${String(i)} not found`),s)}_updateAndApplyState(e){this.hasNeverUpdated=!1,this.state.update(e),this.skeleton.update(e);const{skeleton:s}=this;this.state.apply(s),this.beforeUpdateWorldTransforms(this),s.updateWorldTransform(de.update),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const e=this.skeleton.drawOrder,s=this._lastAttachments;let i=0,r=!1;for(let l=0;l<e.length;l++){const n=e[l].getAttachment();n&&(n!==s[i]&&(r=!0,s[i]=n),i++)}i!==s.length&&(r=!0,s.length=i),this.spineAttachmentsDirty||=r}currentClippingSlot;updateAndSetPixiMask(e,s){const i=e.attachment;if(i&&i instanceof Pe){const o=this.clippingSlotToPixiMasks[e.data.name]||={slot:e,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let r=this.currentClippingSlot,l=this._slotsObject[e.data.name];if(r&&l){let o=r.mask;if(o||(o=ir.obtain(),r.mask=o,this.addChild(o)),!r.maskComputed){let n=r.slot,a=n.attachment;r.maskComputed=!0;const h=a.worldVerticesLength,c=r.vertices;a.computeWorldVertices(n,0,h,c,0,2),o.clear().poly(c).stroke({width:0}).fill({alpha:.25})}l.container.mask=o}else l?.container.mask&&(l.container.mask=null);if(r&&r.slot.attachment.endSlot==e.data&&(this.currentClippingSlot=void 0),s){for(const o in this.clippingSlotToPixiMasks){const n=this.clippingSlotToPixiMasks[o];(!(n.slot.attachment instanceof Pe)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),ir.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const e=this.skeleton.drawOrder;for(let s=0;s<e.length;s++){const i=e[s];this.updateAndSetPixiMask(i,s===e.length-1);const r=i.getAttachment();if(r){if(r instanceof me||r instanceof W){const l=this._getCachedData(i,r);r instanceof W?r.computeWorldVertices(i,l.vertices,0,2):r.computeWorldVertices(i,0,r.worldVerticesLength,l.vertices,0,2),l.uvs.length<r.uvs.length&&(l.uvs=new Float32Array(r.uvs.length)),zi(r.uvs.buffer,l.uvs.buffer);const n=i.bone.skeleton.color,a=i.color,h=r.color,c=n.a*a.a*h.a;if(l.color.set(n.r*a.r*h.r,n.g*a.g*h.g,n.b*a.b*h.b,c),this.alpha===0||c===0)l.skipRender||(this.spineAttachmentsDirty=!0),l.skipRender=!0;else{l.skipRender&&(this.spineAttachmentsDirty=!0),l.skipRender=l.clipped=!1,i.darkColor&&l.darkColor.setFromColor(i.darkColor);const d=r.region?.texture.texture||Hi.EMPTY;l.texture!==d&&(l.texture=d,this.spineTexturesDirty=!0),Ne.isClipping()&&this.updateClippingData(l)}}else if(r instanceof Pe){Ne.clipStart(i,r);continue}}Ne.clipEndWithSlot(i)}Ne.clipEnd()}updateClippingData(e){e.clipped=!0,Ne.clipTrianglesUnpacked(e.vertices,e.indices,e.indices.length,e.uvs);const{clippedVertices:s,clippedUVs:i,clippedTriangles:r}=Ne,l=s.length/2,o=r.length;e.clippedData||(e.clippedData={vertices:new Float32Array(l*2),uvs:new Float32Array(l*2),vertexCount:l,indices:new Uint16Array(o),indicesCount:o},this.spineAttachmentsDirty=!0);const n=e.clippedData,a=n.vertexCount!==l||o!==n.indicesCount;e.skipRender=l===0,a&&(this.spineAttachmentsDirty=!0,n.vertexCount<l&&(n.vertices=new Float32Array(l*2),n.uvs=new Float32Array(l*2)),n.indices.length<o&&(n.indices=new Uint16Array(o)));const{vertices:h,uvs:c,indices:d}=n;for(let f=0;f<l;f++)h[f*2]=s[f*2],h[f*2+1]=s[f*2+1],c[f*2]=i[f*2],c[f*2+1]=i[f*2+1];n.vertexCount=l;for(let f=0;f<o;f++)d[f]!==r[f]&&(this.spineAttachmentsDirty=!0,d[f]=r[f]);n.indicesCount=o}updateSlotObjects(){for(const e in this._slotsObject){const s=this._slotsObject[e];s&&this.updateSlotObject(s)}}updateSlotObject(e){const{slot:s,container:i}=e,r=e.followAttachmentTimeline?!!s.attachment:!0;if(i.visible=this.skeleton.drawOrder.includes(s)&&r,i.visible){let l=s.bone;const o=i.localTransform;o.a=l.a,o.b=l.c,o.c=-l.b,o.d=-l.d,o.tx=l.worldX,o.ty=l.worldY,i.setFromMatrix(o),i.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(e,s){return this.attachmentCacheData[e.data.index][s.name]||this.initCachedData(e,s)}initCachedData(e,s){let i;return s instanceof W?(i=new Float32Array(8),this.attachmentCacheData[e.data.index][s.name]={id:`${e.data.index}-${s.name}`,vertices:i,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(s.uvs.length),color:new N(1,1,1,1),darkColor:new N(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}):(i=new Float32Array(s.worldVerticesLength),this.attachmentCacheData[e.data.index][s.name]={id:`${e.data.index}-${s.name}`,vertices:i,clipped:!1,indices:s.triangles,uvs:new Float32Array(s.uvs.length),color:new N(1,1,1,1),darkColor:new N(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}),this.attachmentCacheData[e.data.index][s.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(e,s,i){e=this.getSlotFromRef(e);for(const l in this._slotsObject)this._slotsObject[l]?.container===s&&this.removeSlotObject(this._slotsObject[l].slot);this.removeSlotObject(e),s.includeInBuild=!1,this.addChild(s);const r={container:s,slot:e,followAttachmentTimeline:i?.followAttachmentTimeline||!1};this._slotsObject[e.data.name]=r,this.updateSlotObject(r)}removeSlotObject(e){let s;if(e instanceof Wi){for(const i in this._slotsObject)if(this._slotsObject[i]?.container===e){this._slotsObject[i]=null,s=e;break}}else{const i=this.getSlotFromRef(e);s=this._slotsObject[i.data.name]?.container,this._slotsObject[i.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([e,s])=>{s&&s.container.removeFromParent(),delete this._slotsObject[e]})}getSlotObject(e){return e=this.getSlotFromRef(e),this._slotsObject[e.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new cs;const e=this.skeletonBounds;if(e.update(this.skeleton,!0),this._boundsProvider){const s=this._boundsProvider.calculateBounds(this),i=this._bounds;i.clear(),i.x=s.x,i.y=s.y,i.width=s.width,i.height=s.height}else if(e.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const s=this.skeleton.drawOrder,i=this._bounds;i.clear();for(let r=0;r<s.length;r++){const l=s[r],o=l.getAttachment();if(o&&(o instanceof W||o instanceof me)){const n=this._getCachedData(l,o);i.addVertexData(n.vertices,0,n.vertices.length)}}}else this._bounds.minX=e.minX,this._bounds.minY=e.minY,this._bounds.maxX=e.maxX,this._bounds.maxY=e.maxY}addBounds(e){e.addBounds(this.bounds)}destroy(e=!1){super.destroy(e),this._ticker.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(e){this.worldTransform.apply(e,e)}pixiWorldCoordinatesToSkeleton(e){this.worldTransform.applyInverse(e,e)}pixiWorldCoordinatesToBone(e,s){this.pixiWorldCoordinatesToSkeleton(e),s.parent?s.parent.worldToLocal(e):s.worldToLocal(e)}static from({skeleton:e,atlas:s,scale:i=1,darkTint:r,autoUpdate:l=!0,boundsProvider:o,ticker:n}){const a=`${e}-${s}-${i}`;if(xs.has(a))return new Cs({skeletonData:xs.get(a),darkTint:r,autoUpdate:l,boundsProvider:o,ticker:n});const h=rr.get(e),c=rr.get(s),d=new Ns(c),f=h instanceof Uint8Array?new Hs(d):new Js(d);f.scale=i;const m=f.readSkeletonData(h);return xs.set(a,m),new Cs({skeletonData:m,darkTint:r,autoUpdate:l,boundsProvider:o,ticker:n})}};import{Container as bs,Graphics as xe,Text as en}from"pixi.js";var tn=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(t){if(this.registeredSpines.has(t)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);return}const e={parentDebugContainer:new bs,bones:new bs,skeletonXY:new xe,regionAttachmentsShape:new xe,meshTrianglesLine:new xe,meshHullLine:new xe,clippingPolygon:new xe,boundingBoxesRect:new xe,boundingBoxesCircle:new xe,boundingBoxesPolygon:new xe,pathsCurve:new xe,pathsLine:new xe,eventText:new bs,eventCallback:{event:(s,i)=>{if(this.drawEvents){const r=Math.abs(t.scale.x||t.scale.y||1),l=new en({text:i.data.name,style:{fontSize:this.eventFontSize/r,fill:this.eventFontColor,fontFamily:"monospace"}});l.scale.x=Math.sign(t.scale.x),l.anchor.set(.5),e.eventText.addChild(l),setTimeout(()=>{l.destroyed||l.destroy()},250)}}}};e.parentDebugContainer.addChild(e.bones),e.parentDebugContainer.addChild(e.skeletonXY),e.parentDebugContainer.addChild(e.regionAttachmentsShape),e.parentDebugContainer.addChild(e.meshTrianglesLine),e.parentDebugContainer.addChild(e.meshHullLine),e.parentDebugContainer.addChild(e.clippingPolygon),e.parentDebugContainer.addChild(e.boundingBoxesRect),e.parentDebugContainer.addChild(e.boundingBoxesCircle),e.parentDebugContainer.addChild(e.boundingBoxesPolygon),e.parentDebugContainer.addChild(e.pathsCurve),e.parentDebugContainer.addChild(e.pathsLine),e.parentDebugContainer.addChild(e.eventText),e.parentDebugContainer.zIndex=9999999,e.parentDebugContainer.accessibleChildren=!1,e.parentDebugContainer.eventMode="none",e.parentDebugContainer.interactiveChildren=!1,t.addChild(e.parentDebugContainer),t.state.addListener(e.eventCallback),this.registeredSpines.set(t,e)}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 r=e.bones.children.length;r>0;r--)e.bones.children[r-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 r of e.eventText.children)r.alpha-=.05,r.y-=2}drawBonesFunc(t,e,s,i){const r=t.skeleton,l=r.x,o=r.y,n=r.bones;e.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let h=0,c=n.length;h<c;h++){const d=n[h],f=d.data.length,m=l+d.worldX,u=o+d.worldY,p=l+f*d.a+d.worldX,b=o+f*d.b+d.worldY;if(d.data.name==="root"||d.data.parent===null)continue;const w=Math.abs(m-p),g=Math.abs(u-b),x=Math.pow(w,2),y=g,v=Math.pow(g,2),C=Math.sqrt(x+v),A=Math.pow(C,2),k=Math.PI/180,T=Math.acos((A+v-x)/(2*y*C))||0;if(C===0)continue;const Y=new xe;e.bones.addChild(Y);const M=C/50/i;Y.context.poly([0,0,0-M,C-M*3,0,C-M,0+M,C-M*3]).fill(this.bonesColor),Y.x=m,Y.y=u,Y.pivot.y=C;let R=0;m<p&&u<b?R=-T+180*k:m>p&&u<b?R=180*k+T:m>p&&u>b?R=-T:m<p&&u>b?R=T:u===b&&m<p?R=90*k:u===b&&m>p?R=-90*k:m===p&&u<b?R=180*k:m===p&&u>b&&(R=0),Y.rotation=R,Y.circle(0,C,M*1.2).fill({color:0,alpha:.6}).stroke({width:s+M/2.4,color:this.bonesColor})}const a=s*3;e.skeletonXY.context.moveTo(l-a,o-a).lineTo(l+a,o+a).moveTo(l+a,o-a).lineTo(l-a,o+a).stroke()}drawRegionAttachmentsFunc(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l],a=n.getAttachment();if(a===null||!(a instanceof W))continue;const h=a,c=new Float32Array(8);h.computeWorldVertices(n,c,0,2),e.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof me))continue;const h=a,c=new Float32Array(h.worldVerticesLength),d=h.triangles;let f=h.hullLength;if(h.computeWorldVertices(n,0,h.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let m=0,u=d.length;m<u;m+=3){const p=d[m]*2,b=d[m+1]*2,w=d[m+2]*2;e.meshTrianglesLine.context.moveTo(c[p],c[p+1]).lineTo(c[b],c[b+1]).lineTo(c[w],c[w+1])}if(this.drawMeshHull&&f>0){f=(f>>1)*2;let m=c[f-2],u=c[f-1];for(let p=0,b=f;p<b;p+=2){const w=c[p],g=c[p+1];e.meshHullLine.context.moveTo(w,g).lineTo(m,u),m=w,u=g}}}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 l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof Pe))continue;const h=a,c=h.worldVerticesLength,d=new Float32Array(c);h.computeWorldVertices(n,0,c,d,0,2),e.clippingPolygon.poly(Array.from(d))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const i=new cs;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 r=i.polygons,l=(o,n,a)=>{if(a<3)throw new Error("Polygon must contain at least 3 vertices");const h=[],c=s*2;for(let d=0,f=o.length;d<f;d+=2){const m=o[d],u=o[d+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(m,u,c),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(m,u,c).fill({color:this.boundingBoxesCircleColor}),h.push(m,u)}e.boundingBoxesPolygon.poly(h).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let o=0,n=r.length;o<n;o++){const a=r[o];l(a,0,a.length)}}drawPathsFunc(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof Ve))continue;const h=a;let c=h.worldVerticesLength;const d=new Float32Array(c);h.computeWorldVertices(n,0,c,d,0,2);let f=d[2],m=d[3],u=0,p=0;if(h.closed){const b=d[0],w=d[1],g=d[c-2],x=d[c-1];u=d[c-4],p=d[c-3],e.pathsCurve.moveTo(f,m),e.pathsCurve.bezierCurveTo(b,w,g,x,u,p),e.pathsLine.moveTo(f,m),e.pathsLine.lineTo(b,w),e.pathsLine.moveTo(u,p),e.pathsLine.lineTo(g,x)}c-=4;for(let b=4;b<c;b+=6){const w=d[b],g=d[b+1],x=d[b+2],y=d[b+3];u=d[b+4],p=d[b+5],e.pathsCurve.moveTo(f,m),e.pathsCurve.bezierCurveTo(w,g,x,y,u,p),e.pathsLine.moveTo(f,m),e.pathsLine.lineTo(w,g),e.pathsLine.moveTo(u,p),e.pathsLine.lineTo(x,y),f=u,m=p}}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))}};export{Ji as AABBRectangleBoundsProvider,Yt as AlphaTimeline,Ze as Animation,Ht as AnimationState,yr as AnimationStateAdapter,Es as AnimationStateData,Os as AssetCache,Ar as AssetManagerBase,Ns as AtlasAttachmentLoader,pt as Attachment,Fe as AttachmentTimeline,$s as BinaryInput,Ae as BlendMode,ts as Bone,es as BoneData,Kt as BoundingBoxAttachment,Bs as CURRENT,Pe as ClippingAttachment,N as Color,ze as ConstraintData,ue as CurveTimeline,ce as CurveTimeline1,et as CurveTimeline2,xr as DebugUtils,Rt as DeformTimeline,_s as Downloader,Le as DrawOrderTimeline,ss as Event,rs as EventData,Rs as EventQueue,tt as EventTimeline,le as EventType,$t as FIRST,vr as FakeTexture,rt as HOLD_FIRST,Xs as HOLD_MIX,jt as HOLD_SUBSEQUENT,Us as IkConstraint,is as IkConstraintData,Xt as IkConstraintTimeline,Q as Inherit,Tt as InheritTimeline,gr as IntSet,Is as Interpolation,B as MathUtils,me as MeshAttachment,P as MixBlend,re as MixDirection,Ve as PathAttachment,qs as PathConstraint,ns as PathConstraintData,Vt as PathConstraintMixTimeline,Et as PathConstraintPositionTimeline,Lt as PathConstraintSpacingTimeline,de as Physics,Ot as PhysicsConstraintDampingTimeline,qt as PhysicsConstraintGravityTimeline,Dt as PhysicsConstraintInertiaTimeline,_t as PhysicsConstraintMassTimeline,Wt as PhysicsConstraintMixTimeline,zt as PhysicsConstraintResetTimeline,Nt as PhysicsConstraintStrengthTimeline,Te as PhysicsConstraintTimeline,Ut as PhysicsConstraintWindTimeline,Ds as PointAttachment,Ee as Pool,ge as PositionMode,Ms as Pow,pr as PowOut,Pt as RGB2Timeline,Ft as RGBA2Timeline,It as RGBATimeline,Mt as RGBTimeline,W as RegionAttachment,Ie as RotateMode,We as RotateTimeline,Jt as SETUP,st as SUBSEQUENT,yt as ScaleTimeline,vt as ScaleXTimeline,Ct as ScaleYTimeline,Gt as SequenceTimeline,Ki as SetupPoseBoundsProvider,At as ShearTimeline,St as ShearXTimeline,kt as ShearYTimeline,De as Skeleton,Hs as SkeletonBinary,cs as SkeletonBounds,nt as SkeletonClipping,Ge as SkeletonData,Js as SkeletonJson,He as Skin,as as SkinEntry,Qi as SkinsAndAnimationBoundsProvider,Ws as Slot,os as SlotData,ee as SpacingMode,Zi as Spine,tn as SpineDebugRenderer,sr as SpinePipe,us as SpineTexture,gt as StringSet,Qt as Texture,it as TextureAtlas,Vs as TextureAtlasPage,Zt as TextureAtlasRegion,te as TextureFilter,Ls as TextureRegion,ye as TextureWrap,br as TimeKeeper,J as Timeline,Ps as TrackEntry,zs as TransformConstraint,ls as TransformConstraintData,Bt as TransformConstraintTimeline,xt as TranslateTimeline,bt as TranslateXTimeline,wt as TranslateYTimeline,js as Triangulator,E as Utils,qe as Vector2,we as VertexAttachment,wr as WindowedMean};
|
|
27
|
+
`}},Di=class extends Ei{constructor(t){const e=Mi({name:"dark-tint-batch",bits:[Ii,Vi,Pi(t),Bi]}),s=Yi({name:"dark-tint-batch",bits:[Ti,Li,Fi(t),Xi]});super({glProgram:e,gpuProgram:s,resources:{batchSamplers:Ri(t)}})}},tr=null,Ni=class gr extends bi{static extension={type:[vi.Batcher],name:"darkTint"};geometry=new ki;shader=tr||(tr=new Di(this.maxTextures));name=gr.extension.name;vertexSize=7;packAttributes(e,s,i,r,l){const o=l<<16|e.roundPixels&65535,n=e.transform,a=n.a,h=n.b,c=n.c,d=n.d,f=n.tx,m=n.ty,{positions:u,uvs:p}=e,b=e.color,w=(b>>24&255)/255,g=wi.shared.setValue(e.darkColor).premultiply(w,!0).toPremultiplied(1,!1),x=e.attributeOffset,y=x+e.attributeSize;for(let v=x;v<y;v++){const C=v*2,A=u[C],k=u[C+1];s[r++]=a*A+c*k+f,s[r++]=d*k+h*A+m,s[r++]=p[C],s[r++]=p[C+1],i[r++]=b,i[r++]=g,i[r++]=o}}packQuadAttributes(e,s,i,r,l){const o=e.texture,n=e.transform,a=n.a,h=n.b,c=n.c,d=n.d,f=n.tx,m=n.ty,u=e.bounds,p=u.maxX,b=u.minX,w=u.maxY,g=u.minY,x=o.uvs,y=e.color,v=e.darkColor,C=l<<16|e.roundPixels&65535;s[r+0]=a*b+c*g+f,s[r+1]=d*g+h*b+m,s[r+2]=x.x0,s[r+3]=x.y0,i[r+4]=y,i[r+5]=v,i[r+6]=C,s[r+7]=a*p+c*g+f,s[r+8]=d*g+h*p+m,s[r+9]=x.x1,s[r+10]=x.y1,i[r+11]=y,i[r+12]=v,i[r+13]=C,s[r+14]=a*p+c*w+f,s[r+15]=d*w+h*p+m,s[r+16]=x.x2,s[r+17]=x.y2,i[r+18]=y,i[r+19]=v,i[r+20]=C,s[r+21]=a*b+c*w+f,s[r+22]=d*w+h*b+m,s[r+23]=x.x3,s[r+24]=x.y3,i[r+25]=y,i[r+26]=v,i[r+27]=C}};yi.add(Ni);var Oi=E.newFloatArray(8),_i=class ft{static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;ctx;triangleRendering=!1;debugRendering=!1;vertices=E.newFloatArray(8*1024);tempColor=new N;constructor(e){this.ctx=e}draw(e){this.triangleRendering?this.drawTriangles(e):this.drawImages(e)}drawImages(e){let s=this.ctx,i=this.tempColor,r=e.color,l=e.drawOrder;this.debugRendering&&(s.strokeStyle="green");for(let o=0,n=l.length;o<n;o++){let a=l[o],h=a.bone;if(!h.active)continue;let c=a.getAttachment();if(!(c instanceof W))continue;c.computeWorldVertices(a,Oi,0,2);let d=c.region,f=d.texture.getImage(),m=a.color,u=c.color;i.set(r.r*m.r*u.r,r.g*m.g*u.g,r.b*m.b*u.b,r.a*m.a*u.a),s.save(),s.transform(h.a,h.c,h.b,h.d,h.worldX,h.worldY),s.translate(c.offset[0],c.offset[1]),s.rotate(c.rotation*Math.PI/180);let p=c.width/d.originalWidth;s.scale(p*c.scaleX,p*c.scaleY);let b=d.width,w=d.height;if(s.translate(b/2,w/2),c.region.degrees==90){let g=b;b=w,w=g,s.rotate(-Math.PI/2)}s.scale(1,-1),s.translate(-b/2,-w/2),s.globalAlpha=i.a,s.drawImage(f,f.width*d.u,f.height*d.v,b,w,0,0,b,w),this.debugRendering&&s.strokeRect(0,0,b,w),s.restore()}}drawTriangles(e){let s=this.ctx,i=this.tempColor,r=e.color,l=e.drawOrder,o=null,n=this.vertices,a=null;for(let c=0,d=l.length;c<d;c++){let f=l[c],m=f.getAttachment(),u,p;if(m instanceof W){let b=m;n=this.computeRegionVertices(f,b,!1),a=ft.QUAD_TRIANGLES,u=b.region.texture.getImage()}else if(m instanceof me){let b=m;n=this.computeMeshVertices(f,b,!1),a=b.triangles,u=b.region.texture.getImage()}else continue;if(u){f.data.blendMode!=o&&(o=f.data.blendMode);let b=f.color,w=m.color;i.set(r.r*b.r*w.r,r.g*b.g*w.g,r.b*b.b*w.b,r.a*b.a*w.a),s.globalAlpha=i.a;for(var h=0;h<a.length;h+=3){let g=a[h]*8,x=a[h+1]*8,y=a[h+2]*8,v=n[g],C=n[g+1],A=n[g+6],k=n[g+7],T=n[x],Y=n[x+1],M=n[x+6],R=n[x+7],X=n[y],I=n[y+1],F=n[y+6],L=n[y+7];this.drawTriangle(u,v,C,A,k,T,Y,M,R,X,I,F,L),this.debugRendering&&(s.strokeStyle="green",s.beginPath(),s.moveTo(v,C),s.lineTo(T,Y),s.lineTo(X,I),s.lineTo(v,C),s.stroke())}}}this.ctx.globalAlpha=1}drawTriangle(e,s,i,r,l,o,n,a,h,c,d,f,m){let u=this.ctx;const p=e.width-1,b=e.height-1;r*=p,l*=b,a*=p,h*=b,f*=p,m*=b,u.beginPath(),u.moveTo(s,i),u.lineTo(o,n),u.lineTo(c,d),u.closePath(),o-=s,n-=i,c-=s,d-=i,a-=r,h-=l,f-=r,m-=l;let w=a*m-f*h;if(w==0)return;w=1/w;const g=(m*o-h*c)*w,x=(m*n-h*d)*w,y=(a*c-f*o)*w,v=(a*d-f*n)*w,C=s-g*r-y*l,A=i-x*r-v*l;u.save(),u.transform(g,x,y,v,C,A),u.clip(),u.drawImage(e,0,0),u.restore()}computeRegionVertices(e,s,i){let r=e.bone.skeleton.color,l=e.color,o=s.color,n=r.a*l.a*o.a,a=i?n:1,h=this.tempColor;h.set(r.r*l.r*o.r*a,r.g*l.g*o.g*a,r.b*l.b*o.b*a,n),s.computeWorldVertices(e,this.vertices,0,ft.VERTEX_SIZE);let c=this.vertices,d=s.uvs;return c[W.C1R]=h.r,c[W.C1G]=h.g,c[W.C1B]=h.b,c[W.C1A]=h.a,c[W.U1]=d[0],c[W.V1]=d[1],c[W.C2R]=h.r,c[W.C2G]=h.g,c[W.C2B]=h.b,c[W.C2A]=h.a,c[W.U2]=d[2],c[W.V2]=d[3],c[W.C3R]=h.r,c[W.C3G]=h.g,c[W.C3B]=h.b,c[W.C3A]=h.a,c[W.U3]=d[4],c[W.V3]=d[5],c[W.C4R]=h.r,c[W.C4G]=h.g,c[W.C4B]=h.b,c[W.C4A]=h.a,c[W.U4]=d[6],c[W.V4]=d[7],c}computeMeshVertices(e,s,i){let r=e.bone.skeleton.color,l=e.color,o=s.color,n=r.a*l.a*o.a,a=i?n:1,h=this.tempColor;h.set(r.r*l.r*o.r*a,r.g*l.g*o.g*a,r.b*l.b*o.b*a,n);let c=s.worldVerticesLength/2,d=this.vertices;d.length<s.worldVerticesLength&&(this.vertices=d=E.newFloatArray(s.worldVerticesLength)),s.computeWorldVertices(e,0,s.worldVerticesLength,d,0,ft.VERTEX_SIZE);let f=s.uvs;for(let m=0,u=0,p=2;m<c;m++)d[p++]=h.r,d[p++]=h.g,d[p++]=h.b,d[p++]=h.a,d[p++]=f[u++],d[p++]=f[u++],p+=2;return d}};import{ExtensionType as gs,extensions as Ui,RendererType as ps}from"pixi.js";var qi=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 i;const r=t.a*s*255;if(e!==16777215){const l=e>>16&255,o=e>>8&255,n=e&255,a=t.r*n,h=t.g*o,c=t.b*l;i=r<<24|c<<16|h<<8|a}else i=r<<24|t.b*255<<16|t.g*255<<8|t.r*255;return i}get darkColor(){const t=this.data.darkColor;return t.b*255<<16|t.g*255<<8|t.r*255}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 r=e.clippedData;this.indexSize=r.indicesCount,this.attributeSize=r.vertexCount,this.positions=r.vertices,this.indices=r.indices,this.uvs=r.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"}},Wi={0:"normal",1:"add",2:"multiply",3:"screen"},sr=class{static extension={type:[gs.WebGLPipes,gs.WebGPUPipes,gs.CanvasPipes],name:"spine"};renderer;canvasSkeletonRenderer;gpuSpineData={};_destroyRenderableBound=this.destroyRenderable.bind(this);constructor(t){this.renderer=t}validateRenderable(t){if(this.renderer.type===ps.CANVAS||(t._validateAndTransformAttachments(),t.spineAttachmentsDirty))return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let i=0,r=e.length;i<r;i++){const l=e[i],o=l.getAttachment();if(o instanceof W||o instanceof me){const n=t._getCachedData(l,o),a=s.slotBatches[n.id],h=n.texture;if(h!==a?.texture&&!a?._batcher.checkAndUpdateTexture(a,h))return!0}}}return!1}execute(t){if(this.renderer.type===ps.CANVAS){const e=this.renderer,s=(t.groupColorAlpha>>>24&255)/255,i=e.canvasContext,r=i.activeContext;r.save(),this.canvasSkeletonRenderer||(this.canvasSkeletonRenderer=new _i(r),this.canvasSkeletonRenderer.triangleRendering=!0),i.setContextTransform(t.groupTransform,(e._roundPixels|t._roundPixels)===1);const l=t.skeleton.color.a;t.skeleton.color.a*=s,this.canvasSkeletonRenderer.draw(t.skeleton),t.skeleton.color.a=l,r.restore()}}addRenderable(t,e){if(this.renderer.type===ps.CANVAS){this.renderer.renderPipes.batch.break(e),e.add(t);return}const s=this._getSpineData(t),i=this.renderer.renderPipes.batch,r=t.skeleton.drawOrder,l=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments(),t.spineAttachmentsDirty=!1,t.spineTexturesDirty=!1;for(let o=0,n=r.length;o<n;o++){const a=r[o],h=a.getAttachment(),c=Wi[a.data.blendMode];let d=!1;if(h instanceof W||h instanceof me){const m=t._getCachedData(a,h),u=s.slotBatches[m.id]||=new qi;u.setData(t,m,c,l),d=m.skipRender,d||i.addToBatch(u,e)}const f=t._slotsObject[a.data.name];if(f){const m=f.container;d||(m.includeInBuild=!0,m.collectRenderables(e,this.renderer,null)),m.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 i=0,r=s.length;i<r;i++){const l=s[i],o=l.getAttachment();if(o instanceof W||o instanceof me){const n=t._getCachedData(l,o);if(!n.skipRender){const a=e.slotBatches[n.id];a?._batcher?.updateElement(a)}}}}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]}};Ui.add(sr);import{Assets as rr,Cache as xs,Container as zi,fastCopy as Gi,Graphics as Hi,Texture as $i,Ticker as ir,ViewContainer as ji}from"pixi.js";var lt=new qe;De.yDown=!0;var Ne=new nt,Ji=class{constructor(t,e,s,i){this.x=t,this.y=e,this.width=s,this.height=i}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Ki=class{constructor(t=!1){this.clipping=t}calculateBounds(t){if(!t.skeleton)return{x:0,y:0,width:0,height:0};const e=new De(t.skeleton.data);e.setToSetupPose(),e.updateWorldTransform(de.update);const s=e.getBoundsRect(this.clipping?new nt:void 0);return s.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},Qi=class{constructor(t,e=[],s=.05,i=!1){this.animation=t,this.skins=e,this.timeStep=s,this.clipping=i}calculateBounds(t){if(!t.skeleton||!t.state)return{x:0,y:0,width:0,height:0};const e=new Ht(t.state.data),s=new De(t.skeleton.data),i=this.clipping?new nt:void 0,r=s.data;if(this.skins.length>0){let o=new He("custom-skin");for(const n of this.skins){const a=r.findSkin(n);a!=null&&o.addSkin(a)}s.setSkin(o)}s.setToSetupPose();const l=this.animation!=null?r.findAnimation(this.animation):null;if(l==null){s.updateWorldTransform(de.update);const o=s.getBoundsRect(i);return o.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:o}else{let o=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;e.clearTracks(),e.setAnimationWith(0,l,!1);const c=Math.max(l.duration/this.timeStep,1);for(let f=0;f<c;f++){const m=f>0?this.timeStep:0;e.update(m),e.apply(s),s.update(m),s.updateWorldTransform(de.update);const u=s.getBoundsRect(i);o=Math.min(o,u.x),n=Math.min(n,u.y),a=Math.max(a,u.x+u.width),h=Math.max(h,u.y+u.height)}const d={x:o,y:n,width:a-o,height:h-n};return d.width==Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},nr=new Ee(()=>new Hi),Zi=class Cs extends ji{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(e){let s;if(typeof e=="number"?s=this.skeleton.slots[e]:typeof e=="string"?s=this.skeleton.findSlot(e):s=e,!s)throw new Error(`No slot found with the given slot reference: ${e}`);return s}spineAttachmentsDirty=!0;spineTexturesDirty=!0;_lastAttachments=[];_stateChanged=!0;attachmentCacheData=[];get debug(){return this._debug}set debug(e){this._debug&&this._debug.unregisterSpine(this),e&&e.registerSpine(this),this._debug=e}_autoUpdate=!1;_ticker=ir.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!e&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=e}get ticker(){return this._ticker}set ticker(e){e=e??ir.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(e){this._boundsProvider=e,e&&(this._boundsDirty=!1),this.updateBounds()}hasNeverUpdated=!0;constructor(e){e instanceof Ge&&(e={skeletonData:e}),super({}),this.allowChildren=!0;const s=e instanceof Ge?e:e.skeletonData;this.skeleton=new De(s),this.state=new Ht(new Es(s)),e?.ticker&&(this._ticker=e.ticker),this.autoUpdate=e?.autoUpdate??!0,this.darkTint=e?.darkTint===void 0?this.skeleton.slots.some(r=>!!r.data.darkColor):e?.darkTint;const i=this.skeleton.slots;for(let r=0;r<i.length;r++)this.attachmentCacheData[r]=Object.create(null);this._boundsProvider=e.boundsProvider}update(e){this.internalUpdate(0,e)}internalUpdate(e,s){this._updateAndApplyState(s??this._ticker.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(e,s){const i=e;if(typeof e=="string"&&(e=this.skeleton.findBone(e)),!e)throw Error(`Cant set bone position, bone ${String(i)} not found`);if(lt.set(s.x,s.y),e.parent){const r=e.parent.worldToLocal(lt);e.x=r.x,e.y=-r.y}else e.x=lt.x,e.y=lt.y}getBonePosition(e,s){const i=e;return typeof e=="string"&&(e=this.skeleton.findBone(e)),e?(s||(s={x:0,y:0}),s.x=e.worldX,s.y=e.worldY,s):(console.error(`Cant set bone position! Bone ${String(i)} not found`),s)}_updateAndApplyState(e){this.hasNeverUpdated=!1,this.state.update(e),this.skeleton.update(e);const{skeleton:s}=this;this.state.apply(s),this.beforeUpdateWorldTransforms(this),s.updateWorldTransform(de.update),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const e=this.skeleton.drawOrder,s=this._lastAttachments;let i=0,r=!1;for(let l=0;l<e.length;l++){const n=e[l].getAttachment();n&&(n!==s[i]&&(r=!0,s[i]=n),i++)}i!==s.length&&(r=!0,s.length=i),this.spineAttachmentsDirty||=r}currentClippingSlot;updateAndSetPixiMask(e,s){const i=e.attachment;if(i&&i instanceof Pe){const o=this.clippingSlotToPixiMasks[e.data.name]||={slot:e,vertices:new Array};o.maskComputed=!1,this.currentClippingSlot=o;return}let r=this.currentClippingSlot,l=this._slotsObject[e.data.name];if(r&&l){let o=r.mask;if(o||(o=nr.obtain(),r.mask=o,this.addChild(o)),!r.maskComputed){let n=r.slot,a=n.attachment;r.maskComputed=!0;const h=a.worldVerticesLength,c=r.vertices;a.computeWorldVertices(n,0,h,c,0,2),o.clear().poly(c).stroke({width:0}).fill({alpha:.25})}l.container.mask=o}else l?.container.mask&&(l.container.mask=null);if(r&&r.slot.attachment.endSlot==e.data&&(this.currentClippingSlot=void 0),s){for(const o in this.clippingSlotToPixiMasks){const n=this.clippingSlotToPixiMasks[o];(!(n.slot.attachment instanceof Pe)||!n.maskComputed)&&n.mask&&(this.removeChild(n.mask),nr.free(n.mask),n.mask=void 0)}this.currentClippingSlot=void 0}}transformAttachments(){const e=this.skeleton.drawOrder;for(let s=0;s<e.length;s++){const i=e[s];this.updateAndSetPixiMask(i,s===e.length-1);const r=i.getAttachment();if(r){if(r instanceof me||r instanceof W){const l=this._getCachedData(i,r);r instanceof W?r.computeWorldVertices(i,l.vertices,0,2):r.computeWorldVertices(i,0,r.worldVerticesLength,l.vertices,0,2),l.uvs.length<r.uvs.length&&(l.uvs=new Float32Array(r.uvs.length)),Gi(r.uvs.buffer,l.uvs.buffer);const n=i.bone.skeleton.color,a=i.color,h=r.color,c=n.a*a.a*h.a;if(l.color.set(n.r*a.r*h.r,n.g*a.g*h.g,n.b*a.b*h.b,c),this.alpha===0||c===0)l.skipRender||(this.spineAttachmentsDirty=!0),l.skipRender=!0;else{l.skipRender&&(this.spineAttachmentsDirty=!0),l.skipRender=l.clipped=!1,i.darkColor&&l.darkColor.setFromColor(i.darkColor);const d=r.region?.texture.texture||$i.EMPTY;l.texture!==d&&(l.texture=d,this.spineTexturesDirty=!0),Ne.isClipping()&&this.updateClippingData(l)}}else if(r instanceof Pe){Ne.clipStart(i,r);continue}}Ne.clipEndWithSlot(i)}Ne.clipEnd()}updateClippingData(e){e.clipped=!0,Ne.clipTrianglesUnpacked(e.vertices,e.indices,e.indices.length,e.uvs);const{clippedVertices:s,clippedUVs:i,clippedTriangles:r}=Ne,l=s.length/2,o=r.length;e.clippedData||(e.clippedData={vertices:new Float32Array(l*2),uvs:new Float32Array(l*2),vertexCount:l,indices:new Uint16Array(o),indicesCount:o},this.spineAttachmentsDirty=!0);const n=e.clippedData,a=n.vertexCount!==l||o!==n.indicesCount;e.skipRender=l===0,a&&(this.spineAttachmentsDirty=!0,n.vertexCount<l&&(n.vertices=new Float32Array(l*2),n.uvs=new Float32Array(l*2)),n.indices.length<o&&(n.indices=new Uint16Array(o)));const{vertices:h,uvs:c,indices:d}=n;for(let f=0;f<l;f++)h[f*2]=s[f*2],h[f*2+1]=s[f*2+1],c[f*2]=i[f*2],c[f*2+1]=i[f*2+1];n.vertexCount=l;for(let f=0;f<o;f++)d[f]!==r[f]&&(this.spineAttachmentsDirty=!0,d[f]=r[f]);n.indicesCount=o}updateSlotObjects(){for(const e in this._slotsObject){const s=this._slotsObject[e];s&&this.updateSlotObject(s)}}updateSlotObject(e){const{slot:s,container:i}=e,r=e.followAttachmentTimeline?!!s.attachment:!0;if(i.visible=this.skeleton.drawOrder.includes(s)&&r,i.visible){let l=s.bone;const o=i.localTransform;o.a=l.a,o.b=l.c,o.c=-l.b,o.d=-l.d,o.tx=l.worldX,o.ty=l.worldY,i.setFromMatrix(o),i.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(e,s){return this.attachmentCacheData[e.data.index][s.name]||this.initCachedData(e,s)}initCachedData(e,s){let i;return s instanceof W?(i=new Float32Array(8),this.attachmentCacheData[e.data.index][s.name]={id:`${e.data.index}-${s.name}`,vertices:i,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(s.uvs.length),color:new N(1,1,1,1),darkColor:new N(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}):(i=new Float32Array(s.worldVerticesLength),this.attachmentCacheData[e.data.index][s.name]={id:`${e.data.index}-${s.name}`,vertices:i,clipped:!1,indices:s.triangles,uvs:new Float32Array(s.uvs.length),color:new N(1,1,1,1),darkColor:new N(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:s.region?.texture.texture}),this.attachmentCacheData[e.data.index][s.name]}onViewUpdate(){if(this._didViewChangeTick++,this._boundsProvider||(this._boundsDirty=!0),this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),this.debug?.renderDebug(this)}addSlotObject(e,s,i){e=this.getSlotFromRef(e);for(const l in this._slotsObject)this._slotsObject[l]?.container===s&&this.removeSlotObject(this._slotsObject[l].slot);this.removeSlotObject(e),s.includeInBuild=!1,this.addChild(s);const r={container:s,slot:e,followAttachmentTimeline:i?.followAttachmentTimeline||!1};this._slotsObject[e.data.name]=r,this.updateSlotObject(r)}removeSlotObject(e){let s;if(e instanceof zi){for(const i in this._slotsObject)if(this._slotsObject[i]?.container===e){this._slotsObject[i]=null,s=e;break}}else{const i=this.getSlotFromRef(e);s=this._slotsObject[i.data.name]?.container,this._slotsObject[i.data.name]=null}s&&(this.removeChild(s),s.includeInBuild=!0)}removeSlotObjects(){Object.entries(this._slotsObject).forEach(([e,s])=>{s&&s.container.removeFromParent(),delete this._slotsObject[e]})}getSlotObject(e){return e=this.getSlotFromRef(e),this._slotsObject[e.data.name]?.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||=new cs;const e=this.skeletonBounds;if(e.update(this.skeleton,!0),this._boundsProvider){const s=this._boundsProvider.calculateBounds(this),i=this._bounds;i.clear(),i.x=s.x,i.y=s.y,i.width=s.width,i.height=s.height}else if(e.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const s=this.skeleton.drawOrder,i=this._bounds;i.clear();for(let r=0;r<s.length;r++){const l=s[r],o=l.getAttachment();if(o&&(o instanceof W||o instanceof me)){const n=this._getCachedData(l,o);i.addVertexData(n.vertices,0,n.vertices.length)}}}else this._bounds.minX=e.minX,this._bounds.minY=e.minY,this._bounds.maxX=e.maxX,this._bounds.maxY=e.maxY}addBounds(e){e.addBounds(this.bounds)}destroy(e=!1){super.destroy(e),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(e){this.worldTransform.apply(e,e)}pixiWorldCoordinatesToSkeleton(e){this.worldTransform.applyInverse(e,e)}pixiWorldCoordinatesToBone(e,s){this.pixiWorldCoordinatesToSkeleton(e),s.parent?s.parent.worldToLocal(e):s.worldToLocal(e)}static from({skeleton:e,atlas:s,scale:i=1,darkTint:r,autoUpdate:l=!0,boundsProvider:o,ticker:n}){const a=`${e}-${s}-${i}`;if(xs.has(a))return new Cs({skeletonData:xs.get(a),darkTint:r,autoUpdate:l,boundsProvider:o,ticker:n});const h=rr.get(e),c=rr.get(s),d=new Ns(c),f=h instanceof Uint8Array?new Hs(d):new Js(d);f.scale=i;const m=f.readSkeletonData(h);return xs.set(a,m),new Cs({skeletonData:m,darkTint:r,autoUpdate:l,boundsProvider:o,ticker:n})}};import{Container as bs,Graphics as xe,Text as en}from"pixi.js";var tn=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(t){if(this.registeredSpines.has(t)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);return}const e={parentDebugContainer:new bs,bones:new bs,skeletonXY:new xe,regionAttachmentsShape:new xe,meshTrianglesLine:new xe,meshHullLine:new xe,clippingPolygon:new xe,boundingBoxesRect:new xe,boundingBoxesCircle:new xe,boundingBoxesPolygon:new xe,pathsCurve:new xe,pathsLine:new xe,eventText:new bs,eventCallback:{event:(s,i)=>{if(this.drawEvents){const r=Math.abs(t.scale.x||t.scale.y||1),l=new en({text:i.data.name,style:{fontSize:this.eventFontSize/r,fill:this.eventFontColor,fontFamily:"monospace"}});l.scale.x=Math.sign(t.scale.x),l.anchor.set(.5),e.eventText.addChild(l),setTimeout(()=>{l.destroyed||l.destroy()},250)}}}};e.parentDebugContainer.addChild(e.bones),e.parentDebugContainer.addChild(e.skeletonXY),e.parentDebugContainer.addChild(e.regionAttachmentsShape),e.parentDebugContainer.addChild(e.meshTrianglesLine),e.parentDebugContainer.addChild(e.meshHullLine),e.parentDebugContainer.addChild(e.clippingPolygon),e.parentDebugContainer.addChild(e.boundingBoxesRect),e.parentDebugContainer.addChild(e.boundingBoxesCircle),e.parentDebugContainer.addChild(e.boundingBoxesPolygon),e.parentDebugContainer.addChild(e.pathsCurve),e.parentDebugContainer.addChild(e.pathsLine),e.parentDebugContainer.addChild(e.eventText),e.parentDebugContainer.zIndex=9999999,e.parentDebugContainer.accessibleChildren=!1,e.parentDebugContainer.eventMode="none",e.parentDebugContainer.interactiveChildren=!1,t.addChild(e.parentDebugContainer),t.state.addListener(e.eventCallback),this.registeredSpines.set(t,e)}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 r=e.bones.children.length;r>0;r--)e.bones.children[r-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 r of e.eventText.children)r.alpha-=.05,r.y-=2}drawBonesFunc(t,e,s,i){const r=t.skeleton,l=r.x,o=r.y,n=r.bones;e.skeletonXY.strokeStyle={width:s,color:this.skeletonXYColor};for(let h=0,c=n.length;h<c;h++){const d=n[h],f=d.data.length,m=l+d.worldX,u=o+d.worldY,p=l+f*d.a+d.worldX,b=o+f*d.b+d.worldY;if(d.data.name==="root"||d.data.parent===null)continue;const w=Math.abs(m-p),g=Math.abs(u-b),x=Math.pow(w,2),y=g,v=Math.pow(g,2),C=Math.sqrt(x+v),A=Math.pow(C,2),k=Math.PI/180,T=Math.acos((A+v-x)/(2*y*C))||0;if(C===0)continue;const Y=new xe;e.bones.addChild(Y);const M=C/50/i;Y.context.poly([0,0,0-M,C-M*3,0,C-M,0+M,C-M*3]).fill(this.bonesColor),Y.x=m,Y.y=u,Y.pivot.y=C;let R=0;m<p&&u<b?R=-T+180*k:m>p&&u<b?R=180*k+T:m>p&&u>b?R=-T:m<p&&u>b?R=T:u===b&&m<p?R=90*k:u===b&&m>p?R=-90*k:m===p&&u<b?R=180*k:m===p&&u>b&&(R=0),Y.rotation=R,Y.circle(0,C,M*1.2).fill({color:0,alpha:.6}).stroke({width:s+M/2.4,color:this.bonesColor})}const a=s*3;e.skeletonXY.context.moveTo(l-a,o-a).lineTo(l+a,o+a).moveTo(l+a,o-a).lineTo(l-a,o+a).stroke()}drawRegionAttachmentsFunc(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l],a=n.getAttachment();if(a===null||!(a instanceof W))continue;const h=a,c=new Float32Array(8);h.computeWorldVertices(n,c,0,2),e.regionAttachmentsShape.poly(Array.from(c.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof me))continue;const h=a,c=new Float32Array(h.worldVerticesLength),d=h.triangles;let f=h.hullLength;if(h.computeWorldVertices(n,0,h.worldVerticesLength,c,0,2),this.drawMeshTriangles)for(let m=0,u=d.length;m<u;m+=3){const p=d[m]*2,b=d[m+1]*2,w=d[m+2]*2;e.meshTrianglesLine.context.moveTo(c[p],c[p+1]).lineTo(c[b],c[b+1]).lineTo(c[w],c[w+1])}if(this.drawMeshHull&&f>0){f=(f>>1)*2;let m=c[f-2],u=c[f-1];for(let p=0,b=f;p<b;p+=2){const w=c[p],g=c[p+1];e.meshHullLine.context.moveTo(w,g).lineTo(m,u),m=w,u=g}}}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 l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof Pe))continue;const h=a,c=h.worldVerticesLength,d=new Float32Array(c);h.computeWorldVertices(n,0,c,d,0,2),e.clippingPolygon.poly(Array.from(d))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const i=new cs;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 r=i.polygons,l=(o,n,a)=>{if(a<3)throw new Error("Polygon must contain at least 3 vertices");const h=[],c=s*2;for(let d=0,f=o.length;d<f;d+=2){const m=o[d],u=o[d+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(m,u,c),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(m,u,c).fill({color:this.boundingBoxesCircleColor}),h.push(m,u)}e.boundingBoxesPolygon.poly(h).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let o=0,n=r.length;o<n;o++){const a=r[o];l(a,0,a.length)}}drawPathsFunc(t,e,s){const r=t.skeleton.slots;for(let l=0,o=r.length;l<o;l++){const n=r[l];if(!n.bone.active)continue;const a=n.getAttachment();if(a===null||!(a instanceof Ve))continue;const h=a;let c=h.worldVerticesLength;const d=new Float32Array(c);h.computeWorldVertices(n,0,c,d,0,2);let f=d[2],m=d[3],u=0,p=0;if(h.closed){const b=d[0],w=d[1],g=d[c-2],x=d[c-1];u=d[c-4],p=d[c-3],e.pathsCurve.moveTo(f,m),e.pathsCurve.bezierCurveTo(b,w,g,x,u,p),e.pathsLine.moveTo(f,m),e.pathsLine.lineTo(b,w),e.pathsLine.moveTo(u,p),e.pathsLine.lineTo(g,x)}c-=4;for(let b=4;b<c;b+=6){const w=d[b],g=d[b+1],x=d[b+2],y=d[b+3];u=d[b+4],p=d[b+5],e.pathsCurve.moveTo(f,m),e.pathsCurve.bezierCurveTo(w,g,x,y,u,p),e.pathsLine.moveTo(f,m),e.pathsLine.lineTo(w,g),e.pathsLine.moveTo(u,p),e.pathsLine.lineTo(x,y),f=u,m=p}}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))}};export{Ji as AABBRectangleBoundsProvider,Yt as AlphaTimeline,Ze as Animation,Ht as AnimationState,vr as AnimationStateAdapter,Es as AnimationStateData,Os as AssetCache,Sr as AssetManagerBase,Ns as AtlasAttachmentLoader,pt as Attachment,Fe as AttachmentTimeline,$s as BinaryInput,Ae as BlendMode,ts as Bone,es as BoneData,Kt as BoundingBoxAttachment,Bs as CURRENT,Pe as ClippingAttachment,N as Color,ze as ConstraintData,ue as CurveTimeline,ce as CurveTimeline1,et as CurveTimeline2,br as DebugUtils,Rt as DeformTimeline,_s as Downloader,Le as DrawOrderTimeline,ss as Event,rs as EventData,Rs as EventQueue,tt as EventTimeline,le as EventType,$t as FIRST,Cr as FakeTexture,rt as HOLD_FIRST,Xs as HOLD_MIX,jt as HOLD_SUBSEQUENT,Us as IkConstraint,is as IkConstraintData,Xt as IkConstraintTimeline,Q as Inherit,Tt as InheritTimeline,pr as IntSet,Is as Interpolation,B as MathUtils,me as MeshAttachment,P as MixBlend,re as MixDirection,Ve as PathAttachment,qs as PathConstraint,ns as PathConstraintData,Vt as PathConstraintMixTimeline,Et as PathConstraintPositionTimeline,Lt as PathConstraintSpacingTimeline,de as Physics,Ot as PhysicsConstraintDampingTimeline,qt as PhysicsConstraintGravityTimeline,Dt as PhysicsConstraintInertiaTimeline,_t as PhysicsConstraintMassTimeline,Wt as PhysicsConstraintMixTimeline,zt as PhysicsConstraintResetTimeline,Nt as PhysicsConstraintStrengthTimeline,Te as PhysicsConstraintTimeline,Ut as PhysicsConstraintWindTimeline,Ds as PointAttachment,Ee as Pool,ge as PositionMode,Ms as Pow,xr as PowOut,Pt as RGB2Timeline,Ft as RGBA2Timeline,It as RGBATimeline,Mt as RGBTimeline,W as RegionAttachment,Ie as RotateMode,We as RotateTimeline,Jt as SETUP,st as SUBSEQUENT,yt as ScaleTimeline,vt as ScaleXTimeline,Ct as ScaleYTimeline,Gt as SequenceTimeline,Ki as SetupPoseBoundsProvider,At as ShearTimeline,St as ShearXTimeline,kt as ShearYTimeline,De as Skeleton,Hs as SkeletonBinary,cs as SkeletonBounds,nt as SkeletonClipping,Ge as SkeletonData,Js as SkeletonJson,He as Skin,as as SkinEntry,Qi as SkinsAndAnimationBoundsProvider,Ws as Slot,os as SlotData,ee as SpacingMode,Zi as Spine,tn as SpineDebugRenderer,sr as SpinePipe,us as SpineTexture,gt as StringSet,Qt as Texture,it as TextureAtlas,Vs as TextureAtlasPage,Zt as TextureAtlasRegion,te as TextureFilter,Ls as TextureRegion,ye as TextureWrap,wr as TimeKeeper,J as Timeline,Ps as TrackEntry,zs as TransformConstraint,ls as TransformConstraintData,Bt as TransformConstraintTimeline,xt as TranslateTimeline,bt as TranslateXTimeline,wt as TranslateYTimeline,js as Triangulator,E as Utils,qe as Vector2,we as VertexAttachment,yr as WindowedMean};
|