UNPKG

@pixi-spine/runtime-3.8

Version:

Pixi runtime for spine 3.8 models

9 lines 112 kB
/*! * @pixi-spine/runtime-3.8 - v4.0.6 * Compiled Mon, 24 Mar 2025 11:44:59 UTC * * @pixi-spine/runtime-3.8 is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license * * Copyright 2025, Ivan Igorevich Popelyshev <ivan.popelyshev@gmail.com>, All Rights Reserved */import{Utils as V,AttachmentType as pt,Color as W,MathUtils as R,PowOut as Xe,MixBlend as A,MixDirection as xt,IntSet as Ye,Pool as Oe,settings as ne,TransformMode as z,RotateMode as Tt,PositionMode as Vt,Vector2 as De,BinaryInput as Be,SkeletonBoundsBase as Le,SpineBase as _e}from"@pixi-spine/base";import{Matrix as We,BLEND_MODES as Pt}from"@pixi/core";class se{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}}const Ve=class extends se{constructor(e){super(e),this.id=(Ve.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(e,t){this.computeWorldVertices(e,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(e,t,s,n,r,l){s=r+(s>>1)*l;const c=e.bone.skeleton,o=e.deform;let a=this.vertices;const i=this.bones;if(i==null){o.length>0&&(a=o);const d=e.bone.matrix,m=d.tx,g=d.ty,w=d.a,p=d.c,E=d.b,x=d.d;for(let b=t,I=r;I<s;b+=2,I+=l){const S=a[b],M=a[b+1];n[I]=S*w+M*p+m,n[I+1]=S*E+M*x+g}return}let h=0,u=0;for(let d=0;d<t;d+=2){const m=i[h];h+=m+1,u+=m}const f=c.bones;if(o.length==0)for(let d=r,m=u*3;d<s;d+=l){let g=0,w=0,p=i[h++];for(p+=h;h<p;h++,m+=3){const E=f[i[h]].matrix,x=a[m],b=a[m+1],I=a[m+2];g+=(x*E.a+b*E.c+E.tx)*I,w+=(x*E.b+b*E.d+E.ty)*I}n[d]=g,n[d+1]=w}else{const d=o;for(let m=r,g=u*3,w=u<<1;m<s;m+=l){let p=0,E=0,x=i[h++];for(x+=h;h<x;h++,g+=3,w+=2){const b=f[i[h]].matrix,I=a[g]+d[w],S=a[g+1]+d[w+1],M=a[g+2];p+=(I*b.a+S*b.c+b.tx)*M,E+=(I*b.b+S*b.d+b.ty)*M}n[m]=p,n[m+1]=E}}}copyTo(e){this.bones!=null?(e.bones=new Array(this.bones.length),V.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices!=null?(e.vertices=V.newFloatArray(this.vertices.length),V.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)):e.vertices=null,e.worldVerticesLength=this.worldVerticesLength,e.deformAttachment=this.deformAttachment}};let Ft=Ve;Ft.nextID=0;class Qt extends Ft{constructor(t){super(t),this.type=pt.BoundingBox,this.color=new W(1,1,1,1)}copy(){const t=new Qt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Kt extends Ft{constructor(t){super(t),this.type=pt.Clipping,this.color=new W(.2275,.2275,.8078,1)}copy(){const t=new Kt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Dt extends Ft{constructor(t){super(t),this.type=pt.Mesh,this.color=new W(1,1,1,1),this.tempColor=new W(0,0,0,0)}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh!=null)return this.newLinkedMesh();const t=new Dt(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),V.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),V.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),V.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new Dt(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(this.parentMesh!=null?this.parentMesh:this),t}}class Yt extends Ft{constructor(t){super(t),this.type=pt.Path,this.closed=!1,this.constantSpeed=!1,this.color=new W(1,1,1,1)}copy(){const t=new Yt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),V.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Jt extends Ft{constructor(t){super(t),this.type=pt.Point,this.color=new W(.38,.94,0,1)}computeWorldPosition(t,s){const n=t.matrix;return s.x=this.x*n.a+this.y*n.c+t.worldX,s.y=this.x*n.b+this.y*n.d+t.worldY,s}computeWorldRotation(t){const s=t.matrix,n=R.cosDeg(this.rotation),r=R.sinDeg(this.rotation),l=n*s.a+r*s.c,c=n*s.b+r*s.d;return Math.atan2(c,l)*R.radDeg}copy(){const t=new Jt(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class ae{constructor(t,s){if(this.deform=new Array,t==null)throw new Error("data cannot be null.");if(s==null)throw new Error("bone cannot be null.");this.data=t,this.bone=s,this.color=new W,this.darkColor=t.darkColor==null?null:new W,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}}const et=class extends se{constructor(e){super(e),this.type=pt.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new W(1,1,1,1),this.offset=V.newFloatArray(8),this.uvs=V.newFloatArray(8),this.tempColor=new W(1,1,1,1)}updateOffset(){const e=this.width/this.region.originalWidth*this.scaleX,t=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*e,n=-this.height/2*this.scaleY+this.region.offsetY*t,r=s+this.region.width*e,l=n+this.region.height*t,c=this.rotation*Math.PI/180,o=Math.cos(c),a=Math.sin(c),i=s*o+this.x,h=s*a,u=n*o+this.y,f=n*a,d=r*o+this.x,m=r*a,g=l*o+this.y,w=l*a,p=this.offset;p[et.OX1]=i-f,p[et.OY1]=u+h,p[et.OX2]=i-w,p[et.OY2]=g+h,p[et.OX3]=d-w,p[et.OY3]=g+m,p[et.OX4]=d-f,p[et.OY4]=u+m}setRegion(e){this.region=e;const t=this.uvs;e.rotate?(t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v,t[0]=e.u2,t[1]=e.v2):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,s,n){const r=this.offset,l=e instanceof ae?e.bone.matrix:e.matrix,c=l.tx,o=l.ty,a=l.a,i=l.c,h=l.b,u=l.d;let f=0,d=0;f=r[et.OX1],d=r[et.OY1],t[s]=f*a+d*i+c,t[s+1]=f*h+d*u+o,s+=n,f=r[et.OX2],d=r[et.OY2],t[s]=f*a+d*i+c,t[s+1]=f*h+d*u+o,s+=n,f=r[et.OX3],d=r[et.OY3],t[s]=f*a+d*i+c,t[s+1]=f*h+d*u+o,s+=n,f=r[et.OX4],d=r[et.OY4],t[s]=f*a+d*i+c,t[s+1]=f*h+d*u+o}copy(){const e=new et(this.name);return e.region=this.region,e.rendererObject=this.rendererObject,e.path=this.path,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,V.arrayCopy(this.uvs,0,e.uvs,0,8),V.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e}};let N=et;N.OX1=0,N.OY1=1,N.OX2=2,N.OY2=3,N.OX3=4,N.OY3=5,N.OX4=6,N.OY4=7,N.X1=0,N.Y1=1,N.C1R=2,N.C1G=3,N.C1B=4,N.C1A=5,N.U1=6,N.V1=7,N.X2=8,N.Y2=9,N.C2R=10,N.C2G=11,N.C2B=12,N.C2A=13,N.U2=14,N.V2=15,N.X3=16,N.Y3=17,N.C3R=18,N.C3G=19,N.C3B=20,N.C3A=21,N.U3=22,N.V3=23,N.X4=24,N.Y4=25,N.C4R=26,N.C4G=27,N.C4B=28,N.C4A=29,N.U4=30,N.V4=31;class qe{constructor(t,s){this.jitterX=0,this.jitterY=0,this.jitterX=t,this.jitterY=s}begin(t){}transform(t,s,n,r){t.x+=R.randomTriangular(-this.jitterX,this.jitterY),t.y+=R.randomTriangular(-this.jitterX,this.jitterY)}end(){}}const Ce=class{constructor(e){this.centerX=0,this.centerY=0,this.radius=0,this.angle=0,this.worldX=0,this.worldY=0,this.radius=e}begin(e){this.worldX=e.x+this.centerX,this.worldY=e.y+this.centerY}transform(e,t,s,n){const r=this.angle*R.degreesToRadians,l=e.x-this.worldX,c=e.y-this.worldY,o=Math.sqrt(l*l+c*c);if(o<this.radius){const a=Ce.interpolation.apply(0,r,(this.radius-o)/this.radius),i=Math.cos(a),h=Math.sin(a);e.x=i*l-h*c+this.worldX,e.y=h*l+i*c+this.worldY}}end(){}};let ke=Ce;ke.interpolation=new Xe(2);class Q{constructor(t,s,n){if(t==null)throw new Error("name cannot be null.");if(s==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=s,this.timelineIds=[];for(let r=0;r<s.length;r++)this.timelineIds[s[r].getPropertyId()]=!0;this.duration=n}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,s,n,r,l,c,o,a){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(n%=this.duration,s>0&&(s%=this.duration));const i=this.timelines;for(let h=0,u=i.length;h<u;h++)i[h].apply(t,s,n,l,c,o,a)}static binarySearch(t,s,n=1){let r=0,l=t.length/n-2;if(l==0)return n;let c=l>>>1;for(;;){if(t[(c+1)*n]<=s?r=c+1:l=c,r==l)return(r+1)*n;c=r+l>>>1}}static linearSearch(t,s,n){for(let r=0,l=t.length-n;r<=l;r+=n)if(t[r]>s)return r;return-1}}var Pe=(e=>(e[e.rotate=0]="rotate",e[e.translate=1]="translate",e[e.scale=2]="scale",e[e.shear=3]="shear",e[e.attachment=4]="attachment",e[e.color=5]="color",e[e.deform=6]="deform",e[e.event=7]="event",e[e.drawOrder=8]="drawOrder",e[e.ikConstraint=9]="ikConstraint",e[e.transformConstraint=10]="transformConstraint",e[e.pathConstraintPosition=11]="pathConstraintPosition",e[e.pathConstraintSpacing=12]="pathConstraintSpacing",e[e.pathConstraintMix=13]="pathConstraintMix",e[e.twoColor=14]="twoColor",e))(Pe||{});const K=class{constructor(e){if(e<=0)throw new Error(`frameCount must be > 0: ${e}`);this.curves=V.newFloatArray((e-1)*K.BEZIER_SIZE)}getFrameCount(){return this.curves.length/K.BEZIER_SIZE+1}setLinear(e){this.curves[e*K.BEZIER_SIZE]=K.LINEAR}setStepped(e){this.curves[e*K.BEZIER_SIZE]=K.STEPPED}getCurveType(e){const t=e*K.BEZIER_SIZE;if(t==this.curves.length)return K.LINEAR;const s=this.curves[t];return s==K.LINEAR?K.LINEAR:s==K.STEPPED?K.STEPPED:K.BEZIER}setCurve(e,t,s,n,r){const l=(-t*2+n)*.03,c=(-s*2+r)*.03,o=((t-n)*3+1)*.006,a=((s-r)*3+1)*.006;let i=l*2+o,h=c*2+a,u=t*.3+l+o*.16666667,f=s*.3+c+a*.16666667,d=e*K.BEZIER_SIZE;const m=this.curves;m[d++]=K.BEZIER;let g=u,w=f;for(let p=d+K.BEZIER_SIZE-1;d<p;d+=2)m[d]=g,m[d+1]=w,u+=i,f+=h,i+=o,h+=a,g+=u,w+=f}getCurvePercent(e,t){t=R.clamp(t,0,1);const s=this.curves;let n=e*K.BEZIER_SIZE;const r=s[n];if(r==K.LINEAR)return t;if(r==K.STEPPED)return 0;n++;let l=0;for(let o=n,a=n+K.BEZIER_SIZE-1;n<a;n+=2)if(l=s[n],l>=t){let i,h;return n==o?(i=0,h=0):(i=s[n-2],h=s[n-1]),h+(s[n+1]-h)*(t-i)/(l-i)}const c=s[n-1];return c+(1-c)*(t-l)/(1-l)}};let ut=K;ut.LINEAR=0,ut.STEPPED=1,ut.BEZIER=2,ut.BEZIER_SIZE=10*2-1;const Nt=class extends ut{constructor(t){super(t),this.frames=V.newFloatArray(t<<1)}getPropertyId(){return(0<<24)+this.boneIndex}setFrame(t,s,n){t<<=1,this.frames[t]=s,this.frames[t+Nt.ROTATION]=n}apply(t,s,n,r,l,c,o){const a=this.frames,i=t.bones[this.boneIndex];if(!i.active)return;if(n<a[0]){switch(c){case A.setup:i.rotation=i.data.rotation;return;case A.first:const g=i.data.rotation-i.rotation;i.rotation+=(g-(16384-(16384.499999999996-g/360|0))*360)*l}return}if(n>=a[a.length-Nt.ENTRIES]){let g=a[a.length+Nt.PREV_ROTATION];switch(c){case A.setup:i.rotation=i.data.rotation+g*l;break;case A.first:case A.replace:g+=i.data.rotation-i.rotation,g-=(16384-(16384.499999999996-g/360|0))*360;case A.add:i.rotation+=g*l}return}const h=Q.binarySearch(a,n,Nt.ENTRIES),u=a[h+Nt.PREV_ROTATION],f=a[h],d=this.getCurvePercent((h>>1)-1,1-(n-f)/(a[h+Nt.PREV_TIME]-f));let m=a[h+Nt.ROTATION]-u;switch(m=u+(m-(16384-(16384.499999999996-m/360|0))*360)*d,c){case A.setup:i.rotation=i.data.rotation+(m-(16384-(16384.499999999996-m/360|0))*360)*l;break;case A.first:case A.replace:m+=i.data.rotation-i.rotation;case A.add:i.rotation+=(m-(16384-(16384.499999999996-m/360|0))*360)*l}}};let st=Nt;st.ENTRIES=2,st.PREV_TIME=-2,st.PREV_ROTATION=-1,st.ROTATION=1;const ot=class extends ut{constructor(e){super(e),this.frames=V.newFloatArray(e*ot.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(e,t,s,n){e*=ot.ENTRIES,this.frames[e]=t,this.frames[e+ot.X]=s,this.frames[e+ot.Y]=n}apply(e,t,s,n,r,l,c){const o=this.frames,a=e.bones[this.boneIndex];if(!a.active)return;if(s<o[0]){switch(l){case A.setup:a.x=a.data.x,a.y=a.data.y;return;case A.first:a.x+=(a.data.x-a.x)*r,a.y+=(a.data.y-a.y)*r}return}let i=0,h=0;if(s>=o[o.length-ot.ENTRIES])i=o[o.length+ot.PREV_X],h=o[o.length+ot.PREV_Y];else{const u=Q.binarySearch(o,s,ot.ENTRIES);i=o[u+ot.PREV_X],h=o[u+ot.PREV_Y];const f=o[u],d=this.getCurvePercent(u/ot.ENTRIES-1,1-(s-f)/(o[u+ot.PREV_TIME]-f));i+=(o[u+ot.X]-i)*d,h+=(o[u+ot.Y]-h)*d}switch(l){case A.setup:a.x=a.data.x+i*r,a.y=a.data.y+h*r;break;case A.first:case A.replace:a.x+=(a.data.x+i-a.x)*r,a.y+=(a.data.y+h-a.y)*r;break;case A.add:a.x+=i*r,a.y+=h*r}}};let Et=ot;Et.ENTRIES=3,Et.PREV_TIME=-3,Et.PREV_X=-2,Et.PREV_Y=-1,Et.X=1,Et.Y=2;class mt extends Et{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,s,n,r,l,c,o){const a=this.frames,i=t.bones[this.boneIndex];if(!i.active)return;if(n<a[0]){switch(c){case A.setup:i.scaleX=i.data.scaleX,i.scaleY=i.data.scaleY;return;case A.first:i.scaleX+=(i.data.scaleX-i.scaleX)*l,i.scaleY+=(i.data.scaleY-i.scaleY)*l}return}let h=0,u=0;if(n>=a[a.length-mt.ENTRIES])h=a[a.length+mt.PREV_X]*i.data.scaleX,u=a[a.length+mt.PREV_Y]*i.data.scaleY;else{const f=Q.binarySearch(a,n,mt.ENTRIES);h=a[f+mt.PREV_X],u=a[f+mt.PREV_Y];const d=a[f],m=this.getCurvePercent(f/mt.ENTRIES-1,1-(n-d)/(a[f+mt.PREV_TIME]-d));h=(h+(a[f+mt.X]-h)*m)*i.data.scaleX,u=(u+(a[f+mt.Y]-u)*m)*i.data.scaleY}if(l==1)c==A.add?(i.scaleX+=h-i.data.scaleX,i.scaleY+=u-i.data.scaleY):(i.scaleX=h,i.scaleY=u);else{let f=0,d=0;if(o==xt.mixOut)switch(c){case A.setup:f=i.data.scaleX,d=i.data.scaleY,i.scaleX=f+(Math.abs(h)*R.signum(f)-f)*l,i.scaleY=d+(Math.abs(u)*R.signum(d)-d)*l;break;case A.first:case A.replace:f=i.scaleX,d=i.scaleY,i.scaleX=f+(Math.abs(h)*R.signum(f)-f)*l,i.scaleY=d+(Math.abs(u)*R.signum(d)-d)*l;break;case A.add:f=i.scaleX,d=i.scaleY,i.scaleX=f+(Math.abs(h)*R.signum(f)-i.data.scaleX)*l,i.scaleY=d+(Math.abs(u)*R.signum(d)-i.data.scaleY)*l}else switch(c){case A.setup:f=Math.abs(i.data.scaleX)*R.signum(h),d=Math.abs(i.data.scaleY)*R.signum(u),i.scaleX=f+(h-f)*l,i.scaleY=d+(u-d)*l;break;case A.first:case A.replace:f=Math.abs(i.scaleX)*R.signum(h),d=Math.abs(i.scaleY)*R.signum(u),i.scaleX=f+(h-f)*l,i.scaleY=d+(u-d)*l;break;case A.add:f=R.signum(h),d=R.signum(u),i.scaleX=Math.abs(i.scaleX)*f+(h-Math.abs(i.data.scaleX)*f)*l,i.scaleY=Math.abs(i.scaleY)*d+(u-Math.abs(i.data.scaleY)*d)*l}}}}class gt extends Et{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,s,n,r,l,c,o){const a=this.frames,i=t.bones[this.boneIndex];if(!i.active)return;if(n<a[0]){switch(c){case A.setup:i.shearX=i.data.shearX,i.shearY=i.data.shearY;return;case A.first:i.shearX+=(i.data.shearX-i.shearX)*l,i.shearY+=(i.data.shearY-i.shearY)*l}return}let h=0,u=0;if(n>=a[a.length-gt.ENTRIES])h=a[a.length+gt.PREV_X],u=a[a.length+gt.PREV_Y];else{const f=Q.binarySearch(a,n,gt.ENTRIES);h=a[f+gt.PREV_X],u=a[f+gt.PREV_Y];const d=a[f],m=this.getCurvePercent(f/gt.ENTRIES-1,1-(n-d)/(a[f+gt.PREV_TIME]-d));h=h+(a[f+gt.X]-h)*m,u=u+(a[f+gt.Y]-u)*m}switch(c){case A.setup:i.shearX=i.data.shearX+h*l,i.shearY=i.data.shearY+u*l;break;case A.first:case A.replace:i.shearX+=(i.data.shearX+h-i.shearX)*l,i.shearY+=(i.data.shearY+u-i.shearY)*l;break;case A.add:i.shearX+=h*l,i.shearY+=u*l}}}const $=class extends ut{constructor(e){super(e),this.frames=V.newFloatArray(e*$.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(e,t,s,n,r,l){e*=$.ENTRIES,this.frames[e]=t,this.frames[e+$.R]=s,this.frames[e+$.G]=n,this.frames[e+$.B]=r,this.frames[e+$.A]=l}apply(e,t,s,n,r,l,c){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const a=this.frames;if(s<a[0]){switch(l){case A.setup:o.color.setFromColor(o.data.color);return;case A.first:const d=o.color,m=o.data.color;d.add((m.r-d.r)*r,(m.g-d.g)*r,(m.b-d.b)*r,(m.a-d.a)*r)}return}let i=0,h=0,u=0,f=0;if(s>=a[a.length-$.ENTRIES]){const d=a.length;i=a[d+$.PREV_R],h=a[d+$.PREV_G],u=a[d+$.PREV_B],f=a[d+$.PREV_A]}else{const d=Q.binarySearch(a,s,$.ENTRIES);i=a[d+$.PREV_R],h=a[d+$.PREV_G],u=a[d+$.PREV_B],f=a[d+$.PREV_A];const m=a[d],g=this.getCurvePercent(d/$.ENTRIES-1,1-(s-m)/(a[d+$.PREV_TIME]-m));i+=(a[d+$.R]-i)*g,h+=(a[d+$.G]-h)*g,u+=(a[d+$.B]-u)*g,f+=(a[d+$.A]-f)*g}if(r==1)o.color.set(i,h,u,f);else{const d=o.color;l==A.setup&&d.setFromColor(o.data.color),d.add((i-d.r)*r,(h-d.g)*r,(u-d.b)*r,(f-d.a)*r)}}};let lt=$;lt.ENTRIES=5,lt.PREV_TIME=-5,lt.PREV_R=-4,lt.PREV_G=-3,lt.PREV_B=-2,lt.PREV_A=-1,lt.R=1,lt.G=2,lt.B=3,lt.A=4;const D=class extends ut{constructor(t){super(t),this.frames=V.newFloatArray(t*D.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,s,n,r,l,c,o,a,i){t*=D.ENTRIES,this.frames[t]=s,this.frames[t+D.R]=n,this.frames[t+D.G]=r,this.frames[t+D.B]=l,this.frames[t+D.A]=c,this.frames[t+D.R2]=o,this.frames[t+D.G2]=a,this.frames[t+D.B2]=i}apply(t,s,n,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const i=this.frames;if(n<i[0]){switch(c){case A.setup:a.color.setFromColor(a.data.color),a.darkColor.setFromColor(a.data.darkColor);return;case A.first:const p=a.color,E=a.darkColor,x=a.data.color,b=a.data.darkColor;p.add((x.r-p.r)*l,(x.g-p.g)*l,(x.b-p.b)*l,(x.a-p.a)*l),E.add((b.r-E.r)*l,(b.g-E.g)*l,(b.b-E.b)*l,0)}return}let h=0,u=0,f=0,d=0,m=0,g=0,w=0;if(n>=i[i.length-D.ENTRIES]){const p=i.length;h=i[p+D.PREV_R],u=i[p+D.PREV_G],f=i[p+D.PREV_B],d=i[p+D.PREV_A],m=i[p+D.PREV_R2],g=i[p+D.PREV_G2],w=i[p+D.PREV_B2]}else{const p=Q.binarySearch(i,n,D.ENTRIES);h=i[p+D.PREV_R],u=i[p+D.PREV_G],f=i[p+D.PREV_B],d=i[p+D.PREV_A],m=i[p+D.PREV_R2],g=i[p+D.PREV_G2],w=i[p+D.PREV_B2];const E=i[p],x=this.getCurvePercent(p/D.ENTRIES-1,1-(n-E)/(i[p+D.PREV_TIME]-E));h+=(i[p+D.R]-h)*x,u+=(i[p+D.G]-u)*x,f+=(i[p+D.B]-f)*x,d+=(i[p+D.A]-d)*x,m+=(i[p+D.R2]-m)*x,g+=(i[p+D.G2]-g)*x,w+=(i[p+D.B2]-w)*x}if(l==1)a.color.set(h,u,f,d),a.darkColor.set(m,g,w,1);else{const p=a.color,E=a.darkColor;c==A.setup&&(p.setFromColor(a.data.color),E.setFromColor(a.data.darkColor)),p.add((h-p.r)*l,(u-p.g)*l,(f-p.b)*l,(d-p.a)*l),E.add((m-E.r)*l,(g-E.g)*l,(w-E.b)*l,0)}}};let J=D;J.ENTRIES=8,J.PREV_TIME=-8,J.PREV_R=-7,J.PREV_G=-6,J.PREV_B=-5,J.PREV_A=-4,J.PREV_R2=-3,J.PREV_G2=-2,J.PREV_B2=-1,J.R=1,J.G=2,J.B=3,J.A=4,J.R2=5,J.G2=6,J.B2=7;class vt{constructor(t){this.frames=V.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,s,n){this.frames[t]=s,this.attachmentNames[t]=n}apply(t,s,n,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;if(o==xt.mixOut){c==A.setup&&this.setAttachment(t,a,a.data.attachmentName);return}const i=this.frames;if(n<i[0]){(c==A.setup||c==A.first)&&this.setAttachment(t,a,a.data.attachmentName);return}let h=0;n>=i[i.length-1]?h=i.length-1:h=Q.binarySearch(i,n,1)-1;const u=this.attachmentNames[h];t.slots[this.slotIndex].setAttachment(u==null?null:t.getAttachment(this.slotIndex,u))}setAttachment(t,s,n){s.setAttachment(n==null?null:t.getAttachment(this.slotIndex,n))}}let Fe=null;class re extends ut{constructor(t){super(t),this.frames=V.newFloatArray(t),this.frameVertices=new Array(t),Fe==null&&(Fe=V.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,s,n){this.frames[t]=s,this.frameVertices[t]=n}apply(t,s,n,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const i=a.getAttachment();if(!(i instanceof Ft)||i.deformAttachment!=this.attachment)return;const h=a.deform;h.length==0&&(c=A.setup);const u=this.frameVertices,f=u[0].length,d=this.frames;if(n<d[0]){const b=i;switch(c){case A.setup:h.length=0;return;case A.first:if(l==1){h.length=0;break}const I=V.setArraySize(h,f);if(b.bones==null){const S=b.vertices;for(let M=0;M<f;M++)I[M]+=(S[M]-I[M])*l}else{l=1-l;for(let S=0;S<f;S++)I[S]*=l}}return}const m=V.setArraySize(h,f);if(n>=d[d.length-1]){const b=u[d.length-1];if(l==1)if(c==A.add){const I=i;if(I.bones==null){const S=I.vertices;for(let M=0;M<f;M++)m[M]+=b[M]-S[M]}else for(let S=0;S<f;S++)m[S]+=b[S]}else V.arrayCopy(b,0,m,0,f);else switch(c){case A.setup:{const S=i;if(S.bones==null){const M=S.vertices;for(let T=0;T<f;T++){const y=M[T];m[T]=y+(b[T]-y)*l}}else for(let M=0;M<f;M++)m[M]=b[M]*l;break}case A.first:case A.replace:for(let S=0;S<f;S++)m[S]+=(b[S]-m[S])*l;break;case A.add:const I=i;if(I.bones==null){const S=I.vertices;for(let M=0;M<f;M++)m[M]+=(b[M]-S[M])*l}else for(let S=0;S<f;S++)m[S]+=b[S]*l}return}const g=Q.binarySearch(d,n),w=u[g-1],p=u[g],E=d[g],x=this.getCurvePercent(g-1,1-(n-E)/(d[g-1]-E));if(l==1)if(c==A.add){const b=i;if(b.bones==null){const I=b.vertices;for(let S=0;S<f;S++){const M=w[S];m[S]+=M+(p[S]-M)*x-I[S]}}else for(let I=0;I<f;I++){const S=w[I];m[I]+=S+(p[I]-S)*x}}else for(let b=0;b<f;b++){const I=w[b];m[b]=I+(p[b]-I)*x}else switch(c){case A.setup:{const I=i;if(I.bones==null){const S=I.vertices;for(let M=0;M<f;M++){const T=w[M],y=S[M];m[M]=y+(T+(p[M]-T)*x-y)*l}}else for(let S=0;S<f;S++){const M=w[S];m[S]=(M+(p[S]-M)*x)*l}break}case A.first:case A.replace:for(let I=0;I<f;I++){const S=w[I];m[I]+=(S+(p[I]-S)*x-m[I])*l}break;case A.add:const b=i;if(b.bones==null){const I=b.vertices;for(let S=0;S<f;S++){const M=w[S];m[S]+=(M+(p[S]-M)*x-I[S])*l}}else for(let I=0;I<f;I++){const S=w[I];m[I]+=(S+(p[I]-S)*x)*l}}}}class Gt{constructor(t){this.frames=V.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,n,r,l,c,o){if(r==null)return;const a=this.frames,i=this.frames.length;if(s>n)this.apply(t,s,Number.MAX_VALUE,r,l,c,o),s=-1;else if(s>=a[i-1])return;if(n<a[0])return;let h=0;if(s<a[0])h=0;else{h=Q.binarySearch(a,s);const u=a[h];for(;h>0&&a[h-1]==u;)h--}for(;h<i&&n>=a[h];h++)r.push(this.events[h])}}class _t{constructor(t){this.frames=V.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,s,n){this.frames[t]=s,this.drawOrders[t]=n}apply(t,s,n,r,l,c,o){const a=t.drawOrder,i=t.slots;if(o==xt.mixOut&&c==A.setup){V.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const h=this.frames;if(n<h[0]){(c==A.setup||c==A.first)&&V.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let u=0;n>=h[h.length-1]?u=h.length-1:u=Q.binarySearch(h,n)-1;const f=this.drawOrders[u];if(f==null)V.arrayCopy(i,0,a,0,i.length);else for(let d=0,m=f.length;d<m;d++)a[d]=i[f[d]]}}const B=class extends ut{constructor(e){super(e),this.frames=V.newFloatArray(e*B.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(e,t,s,n,r,l,c){e*=B.ENTRIES,this.frames[e]=t,this.frames[e+B.MIX]=s,this.frames[e+B.SOFTNESS]=n,this.frames[e+B.BEND_DIRECTION]=r,this.frames[e+B.COMPRESS]=l?1:0,this.frames[e+B.STRETCH]=c?1:0}apply(e,t,s,n,r,l,c){const o=this.frames,a=e.ikConstraints[this.ikConstraintIndex];if(!a.active)return;if(s<o[0]){switch(l){case A.setup:a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case A.first:a.mix+=(a.data.mix-a.mix)*r,a.softness+=(a.data.softness-a.softness)*r,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}if(s>=o[o.length-B.ENTRIES]){l==A.setup?(a.mix=a.data.mix+(o[o.length+B.PREV_MIX]-a.data.mix)*r,a.softness=a.data.softness+(o[o.length+B.PREV_SOFTNESS]-a.data.softness)*r,c==xt.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=o[o.length+B.PREV_BEND_DIRECTION],a.compress=o[o.length+B.PREV_COMPRESS]!=0,a.stretch=o[o.length+B.PREV_STRETCH]!=0)):(a.mix+=(o[o.length+B.PREV_MIX]-a.mix)*r,a.softness+=(o[o.length+B.PREV_SOFTNESS]-a.softness)*r,c==xt.mixIn&&(a.bendDirection=o[o.length+B.PREV_BEND_DIRECTION],a.compress=o[o.length+B.PREV_COMPRESS]!=0,a.stretch=o[o.length+B.PREV_STRETCH]!=0));return}const i=Q.binarySearch(o,s,B.ENTRIES),h=o[i+B.PREV_MIX],u=o[i+B.PREV_SOFTNESS],f=o[i],d=this.getCurvePercent(i/B.ENTRIES-1,1-(s-f)/(o[i+B.PREV_TIME]-f));l==A.setup?(a.mix=a.data.mix+(h+(o[i+B.MIX]-h)*d-a.data.mix)*r,a.softness=a.data.softness+(u+(o[i+B.SOFTNESS]-u)*d-a.data.softness)*r,c==xt.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=o[i+B.PREV_BEND_DIRECTION],a.compress=o[i+B.PREV_COMPRESS]!=0,a.stretch=o[i+B.PREV_STRETCH]!=0)):(a.mix+=(h+(o[i+B.MIX]-h)*d-a.mix)*r,a.softness+=(u+(o[i+B.SOFTNESS]-u)*d-a.softness)*r,c==xt.mixIn&&(a.bendDirection=o[i+B.PREV_BEND_DIRECTION],a.compress=o[i+B.PREV_COMPRESS]!=0,a.stretch=o[i+B.PREV_STRETCH]!=0))}};let at=B;at.ENTRIES=6,at.PREV_TIME=-6,at.PREV_MIX=-5,at.PREV_SOFTNESS=-4,at.PREV_BEND_DIRECTION=-3,at.PREV_COMPRESS=-2,at.PREV_STRETCH=-1,at.MIX=1,at.SOFTNESS=2,at.BEND_DIRECTION=3,at.COMPRESS=4,at.STRETCH=5;const H=class extends ut{constructor(e){super(e),this.frames=V.newFloatArray(e*H.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(e,t,s,n,r,l){e*=H.ENTRIES,this.frames[e]=t,this.frames[e+H.ROTATE]=s,this.frames[e+H.TRANSLATE]=n,this.frames[e+H.SCALE]=r,this.frames[e+H.SHEAR]=l}apply(e,t,s,n,r,l,c){const o=this.frames,a=e.transformConstraints[this.transformConstraintIndex];if(!a.active)return;if(s<o[0]){const d=a.data;switch(l){case A.setup:a.rotateMix=d.rotateMix,a.translateMix=d.translateMix,a.scaleMix=d.scaleMix,a.shearMix=d.shearMix;return;case A.first:a.rotateMix+=(d.rotateMix-a.rotateMix)*r,a.translateMix+=(d.translateMix-a.translateMix)*r,a.scaleMix+=(d.scaleMix-a.scaleMix)*r,a.shearMix+=(d.shearMix-a.shearMix)*r}return}let i=0,h=0,u=0,f=0;if(s>=o[o.length-H.ENTRIES]){const d=o.length;i=o[d+H.PREV_ROTATE],h=o[d+H.PREV_TRANSLATE],u=o[d+H.PREV_SCALE],f=o[d+H.PREV_SHEAR]}else{const d=Q.binarySearch(o,s,H.ENTRIES);i=o[d+H.PREV_ROTATE],h=o[d+H.PREV_TRANSLATE],u=o[d+H.PREV_SCALE],f=o[d+H.PREV_SHEAR];const m=o[d],g=this.getCurvePercent(d/H.ENTRIES-1,1-(s-m)/(o[d+H.PREV_TIME]-m));i+=(o[d+H.ROTATE]-i)*g,h+=(o[d+H.TRANSLATE]-h)*g,u+=(o[d+H.SCALE]-u)*g,f+=(o[d+H.SHEAR]-f)*g}if(l==A.setup){const d=a.data;a.rotateMix=d.rotateMix+(i-d.rotateMix)*r,a.translateMix=d.translateMix+(h-d.translateMix)*r,a.scaleMix=d.scaleMix+(u-d.scaleMix)*r,a.shearMix=d.shearMix+(f-d.shearMix)*r}else a.rotateMix+=(i-a.rotateMix)*r,a.translateMix+=(h-a.translateMix)*r,a.scaleMix+=(u-a.scaleMix)*r,a.shearMix+=(f-a.shearMix)*r}};let ht=H;ht.ENTRIES=5,ht.PREV_TIME=-5,ht.PREV_ROTATE=-4,ht.PREV_TRANSLATE=-3,ht.PREV_SCALE=-2,ht.PREV_SHEAR=-1,ht.ROTATE=1,ht.TRANSLATE=2,ht.SCALE=3,ht.SHEAR=4;const St=class extends ut{constructor(e){super(e),this.frames=V.newFloatArray(e*St.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(e,t,s){e*=St.ENTRIES,this.frames[e]=t,this.frames[e+St.VALUE]=s}apply(e,t,s,n,r,l,c){const o=this.frames,a=e.pathConstraints[this.pathConstraintIndex];if(!a.active)return;if(s<o[0]){switch(l){case A.setup:a.position=a.data.position;return;case A.first:a.position+=(a.data.position-a.position)*r}return}let i=0;if(s>=o[o.length-St.ENTRIES])i=o[o.length+St.PREV_VALUE];else{const h=Q.binarySearch(o,s,St.ENTRIES);i=o[h+St.PREV_VALUE];const u=o[h],f=this.getCurvePercent(h/St.ENTRIES-1,1-(s-u)/(o[h+St.PREV_TIME]-u));i+=(o[h+St.VALUE]-i)*f}l==A.setup?a.position=a.data.position+(i-a.data.position)*r:a.position+=(i-a.position)*r}};let Rt=St;Rt.ENTRIES=2,Rt.PREV_TIME=-2,Rt.PREV_VALUE=-1,Rt.VALUE=1;class It extends Rt{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,s,n,r,l,c,o){const a=this.frames,i=t.pathConstraints[this.pathConstraintIndex];if(!i.active)return;if(n<a[0]){switch(c){case A.setup:i.spacing=i.data.spacing;return;case A.first:i.spacing+=(i.data.spacing-i.spacing)*l}return}let h=0;if(n>=a[a.length-It.ENTRIES])h=a[a.length+It.PREV_VALUE];else{const u=Q.binarySearch(a,n,It.ENTRIES);h=a[u+It.PREV_VALUE];const f=a[u],d=this.getCurvePercent(u/It.ENTRIES-1,1-(n-f)/(a[u+It.PREV_TIME]-f));h+=(a[u+It.VALUE]-h)*d}c==A.setup?i.spacing=i.data.spacing+(h-i.data.spacing)*l:i.spacing+=(h-i.spacing)*l}}const ct=class extends ut{constructor(e){super(e),this.frames=V.newFloatArray(e*ct.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(e,t,s,n){e*=ct.ENTRIES,this.frames[e]=t,this.frames[e+ct.ROTATE]=s,this.frames[e+ct.TRANSLATE]=n}apply(e,t,s,n,r,l,c){const o=this.frames,a=e.pathConstraints[this.pathConstraintIndex];if(!a.active)return;if(s<o[0]){switch(l){case A.setup:a.rotateMix=a.data.rotateMix,a.translateMix=a.data.translateMix;return;case A.first:a.rotateMix+=(a.data.rotateMix-a.rotateMix)*r,a.translateMix+=(a.data.translateMix-a.translateMix)*r}return}let i=0,h=0;if(s>=o[o.length-ct.ENTRIES])i=o[o.length+ct.PREV_ROTATE],h=o[o.length+ct.PREV_TRANSLATE];else{const u=Q.binarySearch(o,s,ct.ENTRIES);i=o[u+ct.PREV_ROTATE],h=o[u+ct.PREV_TRANSLATE];const f=o[u],d=this.getCurvePercent(u/ct.ENTRIES-1,1-(s-f)/(o[u+ct.PREV_TIME]-f));i+=(o[u+ct.ROTATE]-i)*d,h+=(o[u+ct.TRANSLATE]-h)*d}l==A.setup?(a.rotateMix=a.data.rotateMix+(i-a.data.rotateMix)*r,a.translateMix=a.data.translateMix+(h-a.data.translateMix)*r):(a.rotateMix+=(i-a.rotateMix)*r,a.translateMix+=(h-a.translateMix)*r)}};let Mt=ct;Mt.ENTRIES=3,Mt.PREV_TIME=-3,Mt.PREV_ROTATE=-2,Mt.PREV_TRANSLATE=-1,Mt.ROTATE=1,Mt.TRANSLATE=2;const G=class{constructor(e){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new oe(this),this.propertyIDs=new Ye,this.animationsChanged=!1,this.trackEntryPool=new Oe(()=>new jt),this.data=e}update(e){e*=this.timeScale;const t=this.tracks;for(let s=0,n=t.length;s<n;s++){const r=t[s];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let l=e*r.timeScale;if(r.delay>0){if(r.delay-=l,r.delay>0)continue;l=-r.delay,r.delay=0}let c=r.next;if(c!=null){const o=r.trackLast-c.delay;if(o>=0){for(c.delay=0,c.trackTime+=r.timeScale==0?0:(o/r.timeScale+e)*c.timeScale,r.trackTime+=l,this.setCurrent(s,c,!0);c.mixingFrom!=null;)c.mixTime+=e,c=c.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&r.mixingFrom==null){t[s]=null,this.queue.end(r),this.disposeNext(r);continue}if(r.mixingFrom!=null&&this.updateMixingFrom(r,e)){let o=r.mixingFrom;for(r.mixingFrom=null,o!=null&&(o.mixingTo=null);o!=null;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=l}this.queue.drain()}updateMixingFrom(e,t){const s=e.mixingFrom;if(s==null)return!0;const n=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),n):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(e==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,s=this.tracks;let n=!1;for(let c=0,o=s.length;c<o;c++){const a=s[c];if(a==null||a.delay>0)continue;n=!0;const i=c==0?A.first:a.mixBlend;let h=a.alpha;a.mixingFrom!=null?h*=this.applyMixingFrom(a,e,i):a.trackTime>=a.trackEnd&&a.next==null&&(h=0);const u=a.animationLast,f=a.getAnimationTime(),d=a.animation.timelines.length,m=a.animation.timelines;if(c==0&&h==1||i==A.add)for(let g=0;g<d;g++){V.webkit602BugfixHelper(h,i);const w=m[g];w instanceof vt?this.applyAttachmentTimeline(w,e,f,i,!0):w.apply(e,u,f,t,h,i,xt.mixIn)}else{const g=a.timelineMode,w=a.timelinesRotation.length==0;w&&V.setArraySize(a.timelinesRotation,d<<1,null);const p=a.timelinesRotation;for(let E=0;E<d;E++){const x=m[E],b=g[E]==G.SUBSEQUENT?i:A.setup;x instanceof st?this.applyRotateTimeline(x,e,f,h,b,p,E<<1,w):x instanceof vt?this.applyAttachmentTimeline(x,e,f,i,!0):(V.webkit602BugfixHelper(h,i),x.apply(e,u,f,t,h,b,xt.mixIn))}}this.queueEvents(a,f),t.length=0,a.nextAnimationLast=f,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+G.SETUP,l=e.slots;for(let c=0,o=e.slots.length;c<o;c++){const a=l[c];if(a.attachmentState==r){const i=a.data.attachmentName;a.setAttachment(i==null?null:e.getAttachment(a.data.index,i))}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(e,t,s){const n=e.mixingFrom;n.mixingFrom!=null&&this.applyMixingFrom(n,t,s);let r=0;e.mixDuration==0?(r=1,s==A.first&&(s=A.setup)):(r=e.mixTime/e.mixDuration,r>1&&(r=1),s!=A.first&&(s=n.mixBlend));const l=r<n.eventThreshold?this.events:null,c=r<n.attachmentThreshold,o=r<n.drawOrderThreshold,a=n.animationLast,i=n.getAnimationTime(),h=n.animation.timelines.length,u=n.animation.timelines,f=n.alpha*e.interruptAlpha,d=f*(1-r);if(s==A.add)for(let m=0;m<h;m++)u[m].apply(t,a,i,l,d,s,xt.mixOut);else{const m=n.timelineMode,g=n.timelineHoldMix,w=n.timelinesRotation.length==0;w&&V.setArraySize(n.timelinesRotation,h<<1,null);const p=n.timelinesRotation;n.totalAlpha=0;for(let E=0;E<h;E++){const x=u[E];let b=xt.mixOut,I,S=0;switch(m[E]){case G.SUBSEQUENT:if(!o&&x instanceof _t)continue;I=s,S=d;break;case G.FIRST:I=A.setup,S=d;break;case G.HOLD_SUBSEQUENT:I=s,S=f;break;case G.HOLD_FIRST:I=A.setup,S=f;break;default:I=A.setup;const M=g[E];S=f*Math.max(0,1-M.mixTime/M.mixDuration);break}n.totalAlpha+=S,x instanceof st?this.applyRotateTimeline(x,t,i,S,I,p,E<<1,w):x instanceof vt?this.applyAttachmentTimeline(x,t,i,I,c):(V.webkit602BugfixHelper(S,s),o&&x instanceof _t&&I==A.setup&&(b=xt.mixIn),x.apply(t,a,i,l,S,I,b))}}return e.mixDuration>0&&this.queueEvents(n,i),this.events.length=0,n.nextAnimationLast=i,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,t,s,n,r){const l=t.slots[e.slotIndex];if(!l.bone.active)return;const c=e.frames;if(s<c[0])(n==A.setup||n==A.first)&&this.setAttachment(t,l,l.data.attachmentName,r);else{let o;s>=c[c.length-1]?o=c.length-1:o=Q.binarySearch(c,s)-1,this.setAttachment(t,l,e.attachmentNames[o],r)}l.attachmentState<=this.unkeyedState&&(l.attachmentState=this.unkeyedState+G.SETUP)}setAttachment(e,t,s,n){t.setAttachment(s==null?null:e.getAttachment(t.data.index,s)),n&&(t.attachmentState=this.unkeyedState+G.CURRENT)}applyRotateTimeline(e,t,s,n,r,l,c,o){if(o&&(l[c]=0),n==1){e.apply(t,0,s,null,1,r,xt.mixIn);return}const a=e,i=a.frames,h=t.bones[a.boneIndex];if(!h.active)return;let u=0,f=0;if(s<i[0])switch(r){case A.setup:h.rotation=h.data.rotation;default:return;case A.first:u=h.rotation,f=h.data.rotation}else if(u=r==A.setup?h.data.rotation:h.rotation,s>=i[i.length-st.ENTRIES])f=h.data.rotation+i[i.length+st.PREV_ROTATION];else{const g=Q.binarySearch(i,s,st.ENTRIES),w=i[g+st.PREV_ROTATION],p=i[g],E=a.getCurvePercent((g>>1)-1,1-(s-p)/(i[g+st.PREV_TIME]-p));f=i[g+st.ROTATION]-w,f-=(16384-(16384.499999999996-f/360|0))*360,f=w+f*E+h.data.rotation,f-=(16384-(16384.499999999996-f/360|0))*360}let d=0,m=f-u;if(m-=(16384-(16384.499999999996-m/360|0))*360,m==0)d=l[c];else{let g=0,w=0;o?(g=0,w=m):(g=l[c],w=l[c+1]);const p=m>0;let E=g>=0;R.signum(w)!=R.signum(m)&&Math.abs(w)<=90&&(Math.abs(g)>180&&(g+=360*R.signum(g)),E=p),d=m+g-g%360,E!=p&&(d+=360*R.signum(g)),l[c]=d}l[c+1]=m,u+=d*n,h.rotation=u-(16384-(16384.499999999996-u/360|0))*360}queueEvents(e,t){const s=e.animationStart,n=e.animationEnd,r=n-s,l=e.trackLast%r,c=this.events;let o=0;const a=c.length;for(;o<a;o++){const h=c[o];if(h.time<l)break;h.time>n||this.queue.event(e,h)}let i=!1;for(e.loop?i=r==0||l>e.trackTime%r:i=t>=n&&e.animationLast<n,i&&this.queue.complete(e);o<a;o++)c[o].time<s||this.queue.event(e,c[o])}clearTracks(){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;const t=this.tracks[e];if(t==null)return;this.queue.end(t),this.disposeNext(t);let s=t;for(;;){const n=s.mixingFrom;if(n==null)break;this.queue.end(n),s.mixingFrom=null,s.mixingTo=null,s=n}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){const n=this.expandToIndex(e);this.tracks[e]=t,n!=null&&(s&&this.queue.interrupt(n),t.mixingFrom=n,n.mixingTo=t,t.mixTime=0,n.mixingFrom!=null&&n.mixDuration>0&&(t.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s){const n=this.data.skeletonData.findAnimation(t);if(n==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(e,n,s)}setAnimationWith(e,t,s){if(t==null)throw new Error("animation cannot be null.");let n=!0,r=this.expandToIndex(e);r!=null&&(r.nextTrackLast==-1?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,n=!1):this.disposeNext(r));const l=this.trackEntry(e,t,s,r);return this.setCurrent(e,l,n),this.queue.drain(),l}addAnimation(e,t,s,n){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(e,r,s,n)}addAnimationWith(e,t,s,n){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r!=null)for(;r.next!=null;)r=r.next;const l=this.trackEntry(e,t,s,r);if(r==null)this.setCurrent(e,l,!0),this.queue.drain();else if(r.next=l,n<=0){const c=r.animationEnd-r.animationStart;c!=0?(r.loop?n+=c*(1+(r.trackTime/c|0)):n+=Math.max(c,r.trackTime),n-=this.data.getMix(r.animation,t)):n=r.trackTime}return l.delay=n,l}setEmptyAnimation(e,t){const s=this.setAnimationWith(e,G.emptyAnimation,!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t,s){s<=0&&(s-=t);const n=this.addAnimationWith(e,G.emptyAnimation,!1,s);return n.mixDuration=t,n.trackEnd=t,n}setEmptyAnimations(e){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++){const r=this.tracks[s];r!=null&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(V.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,n){const r=this.trackEntryPool.obtain();return r.trackIndex=e,r.animation=t,r.loop=s,r.holdPrevious=!1,r.eventThreshold=0,r.attachmentThreshold=0,r.drawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.interruptAlpha=1,r.mixTime=0,r.mixDuration=n==null?0:this.data.getMix(n.animation,t),r.mixBlend=A.replace,r}disposeNext(e){let t=e.next;for(;t!=null;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let e=0,t=this.tracks.length;e<t;e++){let s=this.tracks[e];if(s!=null){for(;s.mixingFrom!=null;)s=s.mixingFrom;do(s.mixingFrom==null||s.mixBlend!=A.add)&&this.computeHold(s),s=s.mixingTo;while(s!=null)}}}computeHold(e){const t=e.mixingTo,s=e.animation.timelines,n=e.animation.timelines.length,r=V.setArraySize(e.timelineMode,n);e.timelineHoldMix.length=0;const l=V.setArraySize(e.timelineHoldMix,n),c=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let o=0;o<n;o++)r[o]=c.add(s[o].getPropertyId())?G.HOLD_FIRST:G.HOLD_SUBSEQUENT;return}t:for(let o=0;o<n;o++){const a=s[o],i=a.getPropertyId();if(!c.add(i))r[o]=G.SUBSEQUENT;else if(t==null||a instanceof vt||a instanceof _t||a instanceof Gt||!t.animation.hasTimeline(i))r[o]=G.FIRST;else{for(let h=t.mixingTo;h!=null;h=h.mixingTo)if(!h.animation.hasTimeline(i)){if(e.mixDuration>0){r[o]=G.HOLD_MIX,l[o]=h;continue t}break}r[o]=G.HOLD_FIRST}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(e==null)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){const t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(e,t,s){G.deprecatedWarning1||(G.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(e,t,s)}addAnimationByName(e,t,s,n){G.deprecatedWarning2||(G.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(e,t,s,n)}hasAnimation(e){return this.data.skeletonData.findAnimation(e)!==null}hasAnimationByName(e){return G.deprecatedWarning3||(G.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(e)}};let wt=G;wt.emptyAnimation=new Q("<empty>",[],0),wt.SUBSEQUENT=0,wt.FIRST=1,wt.HOLD_SUBSEQUENT=2,wt.HOLD_FIRST=3,wt.HOLD_MIX=4,wt.SETUP=1,wt.CURRENT=2,wt.deprecatedWarning1=!1,wt.deprecatedWarning2=!1,wt.deprecatedWarning3=!1;const Ct=class{constructor(){this.mixBlend=A.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=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){const e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ct.deprecatedWarning1||(Ct.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(e){Ct.deprecatedWarning1||(Ct.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=e}get endTime(){return Ct.deprecatedWarning2||(Ct.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(e){Ct.deprecatedWarning2||(Ct.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=e}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let jt=Ct;jt.deprecatedWarning1=!1,jt.deprecatedWarning2=!1;const ie=class{constructor(e){this.objects=[],this.drainDisabled=!1,this.animState=e}start(e){this.objects.push(ft.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ft.interrupt),this.objects.push(e)}end(e){this.objects.push(ft.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ft.dispose),this.objects.push(e)}complete(e){this.objects.push(ft.complete),this.objects.push(e)}event(e,t){this.objects.push(ft.event),this.objects.push(e),this.objects.push(t)}deprecateStuff(){return ie.deprecatedWarning1||(ie.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){const n=e[s],r=e[s+1];switch(n){case ft.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let o=0;o<t.length;o++)t[o].start&&t[o].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case ft.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<t.length;o++)t[o].interrupt&&t[o].interrupt(r);break;case ft.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let o=0;o<t.length;o++)t[o].end&&t[o].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case ft.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<t.length;o++)t[o].dispose&&t[o].dispose(r);this.animState.trackEntryPool.free(r);break;case ft.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<t.length;o++)t[o].complete&&t[o].complete(r);const l=R.toInt(r.loopsCount());r.onComplete&&this.deprecateStuff()&&r.onComplete(r.trackIndex,l),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(r.trackIndex,l);break;case ft.event:const c=e[s+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,c);for(let o=0;o<t.length;o++)t[o].event&&t[o].event(r,c);r.onEvent&&this.deprecateStuff()&&r.onEvent(r.trackIndex,c),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(r.trackIndex,c);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let oe=ie;oe.deprecatedWarning1=!1;var ft=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(ft||{});class Ue{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,s){}}const le=class{constructor(e){if(this.animationToMixTime={},this.defaultMix=0,e==null)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){const n=this.skeletonData.findAnimation(e);if(n==null)throw new Error(`Animation not found: ${e}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(n,r,s)}setMixByName(e,t,s){le.deprecatedWarning1||(le.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(e,t,s)}setMixWith(e,t,s){if(e==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const n=`${e.name}.${t.name}`;this.animationToMixTime[n]=s}getMix(e,t){const s=`${e.name}.${t.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}};let he=le;he.deprecatedWarning1=!1;class $e{constructor(t){this.atlas=t}newRegionAttachment(t,s,n){const r=this.atlas.findRegion(n);if(r==null)throw new Error(`Region not found in atlas: ${n} (region attachment: ${s})`);const l=new N(s);return l.region=r,l}newMeshAttachment(t,s,n){const r=this.atlas.findRegion(n);if(r==null)throw new Error(`Region not found in atlas: ${n} (mesh attachment: ${s})`);const l=new Dt(s);return l.region=r,l}newBoundingBoxAttachment(t,s){return new Qt(s)}newPathAttachment(t,s){return new Yt(s)}newPointAttachment(t,s){return new Jt(s)}newClippingAttachment(t,s){return new Kt(s)}}class ce{constructor(t,s,n){if(this.matrix=new We,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!1,t==null)throw new Error("data cannot be null.");if(s==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=s,this.parent=n,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,s,n,r,l,c,o){this.ax=t,this.ay=s,this.arotation=n,this.ascaleX=r,this.ascaleY=l,this.ashearX=c,this.ashearY=o,this.appliedValid=!0;const a=this.parent,i=this.matrix,h=this.skeleton.scaleX,u=ne.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(a==null){const w=this.skeleton,p=n+90+o;i.a=R.cosDeg(n+c)*r*h,i.c=R.cosDeg(p)*l*h,i.b=R.sinDeg(n+c)*r*u,i.d=R.sinDeg(p)*l*u,i.tx=t*h+w.x,i.ty=s*u+w.y;return}let f=a.matrix.a,d=a.matrix.c,m=a.matrix.b,g=a.matrix.d;switch(i.tx=f*t+d*s+a.matrix.tx,i.ty=m*t+g*s+a.matrix.ty,this.data.transformMode){case z.Normal:{const w=n+90+o,p=R.cosDeg(n+c)*r,E=R.cosDeg(w)*l,x=R.sinDeg(n+c)*r,b=R.sinDeg(w)*l;i.a=f*p+d*x,i.c=f*E+d*b,i.b=m*p+g*x,i.d=m*E+g*b;return}case z.OnlyTranslation:{const w=n+90+o;i.a=R.cosDeg(n+c)*r,i.c=R.cosDeg(w)*l,i.b=R.sinDeg(n+c)*r,i.d=R.sinDeg(w)*l;break}case z.NoRotationOrReflection:{let w=f*f+m*m,p=0;w>1e-4?(w=Math.abs(f*g-d*m)/w,f/=this.skeleton.scaleX,m/=this.skeleton.scaleY,d=m*w,g=f*w,p=Math.atan2(m,f)*R.radDeg):(f=0,m=0,p=90-Math.atan2(g,d)*R.radDeg);const E=n+c-p,x=n+o-p+90,b=R.cosDeg(E)*r,I=R.cosDeg(x)*l,S=R.sinDeg(E)*r,M=R.sinDeg(x)*l;i.a=f*b-d*S,i.c=f*I-d*M,i.b=m*b+g*S,i.d=m*I+g*M;break}case z.NoScale:case z.NoScaleOrReflection:{const w=R.cosDeg(n),p=R.sinDeg(n);let E=(f*w+d*p)/h,x=(m*w+g*p)/u,b=Math.sqrt(E*E+x*x);b>1e-5&&(b=1/b),E*=b,x*=b,b=Math.sqrt(E*E+x*x),this.data.transformMode==z.NoScale&&f*g-d*m<0!=(ne.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b);const I=Math.PI/2+Math.atan2(x,E),S=Math.cos(I)*b,M=Math.sin(I)*b,T=R.cosDeg(c)*r,y=R.cosDeg(90+o)*l,C=R.sinDeg(c)*r,O=R.sinDeg(90+o)*l;i.a=E*T+S*C,i.c=E*y+S*O,i.b=x*T+M*C,i.d=x*y+M*O;break}}i.a*=h,i.c*=h,i.b*=u,i.d*=u}setToSetupPose(){const 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}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*R.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*R.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldSc