"use strict";(self.webpackChunkcoinflip=self.webpackChunkcoinflip||[]).push([[339],{339:(t,e,s)=>{s.r(e),s.d(e,{AttachmentType:()=>r.sf,BinaryInput:()=>r.YT,Color:()=>r.Il,DebugUtils:()=>r.hh,IntSet:()=>r.JS,Interpolation:()=>r.wf,MathUtils:()=>r.M8,MixBlend:()=>r.bq,MixDirection:()=>r.mJ,Pool:()=>r.Kg,PositionMode:()=>r.T,Pow:()=>r.pe,PowOut:()=>r.RN,RotateMode:()=>r.YK,SkeletonBounds:()=>Bs,SkeletonBoundsBase:()=>r.o$,Spine:()=>Hs,SpineBase:()=>r.Ww,SpineDebugRenderer:()=>r.J,SpineMesh:()=>r.RF,SpineSprite:()=>r.T0,StringSet:()=>r.PA,TextureAtlas:()=>r.Yi,TextureAtlasPage:()=>r.Rb,TextureAtlasRegion:()=>r.F$,TextureFilter:()=>r.Qb,TextureRegion:()=>r.QY,TextureWrap:()=>r.Df,TimeKeeper:()=>r.Tl,TransformMode:()=>r.Qe,Utils:()=>r.cQ,Vector2:()=>r.FM,WindowedMean:()=>r.dT,filterFromString:()=>r.u_,settings:()=>r.Xd,wrapFromString:()=>r.n0});var n={};s.r(n),s.d(n,{Animation:()=>R,AnimationState:()=>nt,AnimationStateAdapter2:()=>ht,AnimationStateData:()=>dt,AtlasAttachmentLoader:()=>ut,Attachment:()=>f,AttachmentTimeline:()=>O,Bone:()=>mt,BoneData:()=>ft,BoundingBoxAttachment:()=>x,ClippingAttachment:()=>b,ColorTimeline:()=>N,CurveTimeline:()=>Y,DeformTimeline:()=>$,DrawOrderTimeline:()=>U,Event:()=>gt,EventData:()=>pt,EventQueue:()=>ot,EventTimeline:()=>Q,EventType:()=>lt,IkConstraint:()=>xt,IkConstraintData:()=>bt,IkConstraintTimeline:()=>j,JitterEffect:()=>A,MeshAttachment:()=>w,PathAttachment:()=>M,PathConstraint:()=>Et,PathConstraintData:()=>wt,PathConstraintMixTimeline:()=>et,PathConstraintPositionTimeline:()=>K,PathConstraintSpacingTimeline:()=>Z,PointAttachment:()=>y,RegionAttachment:()=>k,RotateTimeline:()=>F,ScaleTimeline:()=>q,ShearTimeline:()=>D,Skeleton:()=>At,SkeletonBounds:()=>It,SkeletonData:()=>Tt,SkeletonJson:()=>Yt,Skin:()=>vt,Slot:()=>E,SlotData:()=>Rt,SpacingMode:()=>Mt,Spine:()=>Ft,SwirlEffect:()=>T,TimelineType:()=>C,TrackEntry:()=>rt,TransformConstraint:()=>St,TransformConstraintData:()=>Ct,TransformConstraintTimeline:()=>H,TranslateTimeline:()=>X,TwoColorTimeline:()=>W,VertexAttachment:()=>p});var a={};s.r(a),s.d(a,{AlphaTimeline:()=>de,Animation:()=>jt,AnimationState:()=>Re,AnimationStateAdapter:()=>Fe,AnimationStateData:()=>We,AtlasAttachmentLoader:()=>Oe,Attachment:()=>Pt,AttachmentTimeline:()=>fe,Bone:()=>_e,BoneData:()=>$e,BoundingBoxAttachment:()=>Dt,ClippingAttachment:()=>Bt,ConstraintData:()=>Qe,CurveTimeline:()=>Ht,CurveTimeline1:()=>Gt,CurveTimeline2:()=>Kt,DeformTimeline:()=>ge,DrawOrderTimeline:()=>we,Event:()=>Ue,EventData:()=>ze,EventQueue:()=>Ye,EventTimeline:()=>xe,EventType:()=>Ve,IkConstraint:()=>je,IkConstraintData:()=>Je,IkConstraintTimeline:()=>Me,MeshAttachment:()=>Nt,PathAttachment:()=>Lt,PathConstraint:()=>Ze,PathConstraintData:()=>He,PathConstraintMixTimeline:()=>ke,PathConstraintPositionTimeline:()=>Ee,PathConstraintSpacingTimeline:()=>Se,PointAttachment:()=>Wt,RGB2Timeline:()=>me,RGBA2Timeline:()=>ue,RGBATimeline:()=>he,RGBTimeline:()=>ce,RegionAttachment:()=>_t,RotateTimeline:()=>Zt,ScaleTimeline:()=>ne,ScaleXTimeline:()=>ae,ScaleYTimeline:()=>re,Sequence:()=>Qt,SequenceMode:()=>Ut,SequenceModeValues:()=>zt,SequenceTimeline:()=>Ie,ShearTimeline:()=>ie,ShearXTimeline:()=>oe,ShearYTimeline:()=>le,Skeleton:()=>ns,SkeletonBinary:()=>hs,SkeletonBounds:()=>Bs,SkeletonData:()=>as,SkeletonJson:()=>Ns,Skin:()=>ls,SkinEntry:()=>os,Slot:()=>ts,SlotData:()=>rs,SpacingMode:()=>Ge,Spine:()=>Qs,Timeline:()=>Jt,TrackEntry:()=>ve,TransformConstraint:()=>es,TransformConstraintData:()=>is,TransformConstraintTimeline:()=>ye,TranslateTimeline:()=>te,TranslateXTimeline:()=>ee,TranslateYTimeline:()=>se,VertexAttachment:()=>qt});var r=s(8766),i=s(2770),o=s(6951);const l={extension:o.nw.Asset,loader:{extension:{type:o.nw.LoadParser,priority:i.Q2.Normal},test:t=>(0,i.gN)(t,".atlas"),async load(t){const e=await o.Xd.ADAPTER.fetch(t);return await e.text()},testParse(t,e){const s=(0,i.gN)(e.src,".atlas"),n="string"==typeof t;return Promise.resolve(s&&n)},async parse(t,e,s){const n=e.data;let a=o.P6.path.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let i=null,l=null;const c=new Promise(((t,e)=>{i=t,l=e}));let d;const u=t=>{t||l("Something went terribly wrong loading a spine .atlas file\nMost likely your texture failed to load."),i(d)};if(n.image||n.images){const e=Object.assign(n.image?{default:n.image}:{},n.images);d=new r.Yi(t,((t,s)=>{const n=e[t]||e.default;n&&n.baseTexture?s(n.baseTexture):s(n)}),u)}else d=new r.Yi(t,h(s,a,n.imageMetadata),u);return await c},unload(t){t.dispose()}}},h=(t,e,s)=>async(n,a)=>{const r=o.P6.path.normalize([...e.split(o.P6.path.sep),n].join(o.P6.path.sep));a((await t.load({src:r,data:s})).baseTexture)};function c(t){return t.hasOwnProperty("bones")}o.Rw.add(l);class d{constructor(){}installLoader(){const t=this,e={extension:o.nw.Asset,loader:{extension:{type:o.nw.LoadParser,priority:i.Q2.Normal},test:t=>(0,i.gN)(t,".skel"),async load(t){const e=await o.Xd.ADAPTER.fetch(t);return await e.arrayBuffer()},testParse(t,e){const s=(0,i.gN)(e.src,".json")&&c(t),n=(0,i.gN)(e.src,".skel")&&t instanceof ArrayBuffer,a=!1===e.data?.spineAtlas;return Promise.resolve(s&&!a||n)},async parse(e,s,n){const a=o.P6.path.extname(s.src).toLowerCase(),l=o.P6.path.basename(s.src,a);let d=o.P6.path.dirname(s.src);d&&d.lastIndexOf("/")!==d.length-1&&(d+="/");let u=null,m=e;(0,i.gN)(s.src,".json")&&c(e)?u=t.createJsonParser():(u=t.createBinaryParser(),m=new Uint8Array(e));const f=s.data||{},g=f?.spineSkeletonScale??null;g&&(u.scale=g);const p=f.spineAtlas;if(p&&p.pages)return t.parseData(u,p,m);const x=f.atlasRawData;if(x){let e=null,s=null;const a=new Promise(((t,n)=>{e=t,s=n})),i=new r.Yi(x,h(n,d,f.imageMetadata),(t=>{t||s("Something went terribly wrong loading a spine .atlas file\nMost likely your texture failed to load."),e(i)})),o=await a;return t.parseData(u,o,m)}let b=f.spineAtlasFile;b||(b=`${d+l}.atlas`);const w=await n.load({src:b,data:f,alias:f.spineAtlasAlias});return t.parseData(u,w,m)}}};return o.Rw.add(e),e}}var u=s(5809),m=s.t(u,2);class f{constructor(t){if(null==t)throw new Error("name cannot be null.");this.name=t}}const g=class extends f{constructor(t){super(t),this.id=(65535&g.nextID++)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,n,a,r){s=a+(s>>1)*r;const i=t.bone.skeleton,o=t.attachmentVertices;let l=this.vertices;const h=this.bones;if(null==h){o.length>0&&(l=o);const i=t.bone.matrix,h=i.tx,c=i.ty,d=i.a,u=i.c,m=i.b,f=i.d;for(let t=e,i=a;i0&&(e%=this.duration));const l=this.timelines;for(let n=0,h=l.length;n>>1;for(;;){if(t[(r+1)*s]<=e?n=r+1:a=r,n==a)return(n+1)*s;r=n+a>>>1}}static linearSearch(t,e,s){for(let n=0,a=t.length-s;n<=a;n+=s)if(t[n]>e)return n;return-1}}var C=(t=>(t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor",t))(C||{});const v=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=r.cQ.newFloatArray((t-1)*v.BEZIER_SIZE)}getFrameCount(){return this.curves.length/v.BEZIER_SIZE+1}setLinear(t){this.curves[t*v.BEZIER_SIZE]=v.LINEAR}setStepped(t){this.curves[t*v.BEZIER_SIZE]=v.STEPPED}getCurveType(t){const e=t*v.BEZIER_SIZE;if(e==this.curves.length)return v.LINEAR;const s=this.curves[e];return s==v.LINEAR?v.LINEAR:s==v.STEPPED?v.STEPPED:v.BEZIER}setCurve(t,e,s,n,a){const r=.03*(2*-e+n),i=.03*(2*-s+a),o=.006*(3*(e-n)+1),l=.006*(3*(s-a)+1);let h=2*r+o,c=2*i+l,d=.3*e+r+.16666667*o,u=.3*s+i+.16666667*l,m=t*v.BEZIER_SIZE;const f=this.curves;f[m++]=v.BEZIER;let g=d,p=u;for(let t=m+v.BEZIER_SIZE-1;m=e){let a,r;return n==t?(a=0,r=0):(a=s[n-2],r=s[n-1]),r+(s[n+1]-r)*(e-a)/(i-a)}const o=s[n-1];return o+(1-o)*(e-i)/(1-i)}};let Y=v;Y.LINEAR=0,Y.STEPPED=1,Y.BEZIER=2,Y.BEZIER_SIZE=19;const V=class extends Y{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+V.ROTATION]=s}apply(t,e,s,n,a,i,o){const l=this.frames,h=t.bones[this.boneIndex];if(s=l[l.length-V.ENTRIES]){let t=l[l.length+V.PREV_ROTATION];switch(i){case r.bq.setup:h.rotation=h.data.rotation+t*a;break;case r.bq.first:case r.bq.replace:t+=h.data.rotation-h.rotation,t-=360*(16384-(16384.499999999996-t/360|0));case r.bq.add:h.rotation+=t*a}return}const c=R.binarySearch(l,s,V.ENTRIES),d=l[c+V.PREV_ROTATION],u=l[c],m=this.getCurvePercent((c>>1)-1,1-(s-u)/(l[c+V.PREV_TIME]-u));let f=l[c+V.ROTATION]-d;switch(f=d+(f-360*(16384-(16384.499999999996-f/360|0)))*m,i){case r.bq.setup:h.rotation=h.data.rotation+(f-360*(16384-(16384.499999999996-f/360|0)))*a;break;case r.bq.first:case r.bq.replace:f+=h.data.rotation-h.rotation;case r.bq.add:h.rotation+=(f-360*(16384-(16384.499999999996-f/360|0)))*a}}};let F=V;F.ENTRIES=2,F.PREV_TIME=-2,F.PREV_ROTATION=-1,F.ROTATION=1;const P=class extends Y{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t*P.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,s,n){t*=P.ENTRIES,this.frames[t]=e,this.frames[t+P.X]=s,this.frames[t+P.Y]=n}apply(t,e,s,n,a,i,o){const l=this.frames,h=t.bones[this.boneIndex];if(s=l[l.length-P.ENTRIES])c=l[l.length+P.PREV_X],d=l[l.length+P.PREV_Y];else{const t=R.binarySearch(l,s,P.ENTRIES);c=l[t+P.PREV_X],d=l[t+P.PREV_Y];const e=l[t],n=this.getCurvePercent(t/P.ENTRIES-1,1-(s-e)/(l[t+P.PREV_TIME]-e));c+=(l[t+P.X]-c)*n,d+=(l[t+P.Y]-d)*n}switch(i){case r.bq.setup:h.x=h.data.x+c*a,h.y=h.data.y+d*a;break;case r.bq.first:case r.bq.replace:h.x+=(h.data.x+c-h.x)*a,h.y+=(h.data.y+d-h.y)*a;break;case r.bq.add:h.x+=c*a,h.y+=d*a}}};let X=P;X.ENTRIES=3,X.PREV_TIME=-3,X.PREV_X=-2,X.PREV_Y=-1,X.X=1,X.Y=2;class q extends X{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,n,a,i,o){const l=this.frames,h=t.bones[this.boneIndex];if(s=l[l.length-q.ENTRIES])c=l[l.length+q.PREV_X]*h.data.scaleX,d=l[l.length+q.PREV_Y]*h.data.scaleY;else{const t=R.binarySearch(l,s,q.ENTRIES);c=l[t+q.PREV_X],d=l[t+q.PREV_Y];const e=l[t],n=this.getCurvePercent(t/q.ENTRIES-1,1-(s-e)/(l[t+q.PREV_TIME]-e));c=(c+(l[t+q.X]-c)*n)*h.data.scaleX,d=(d+(l[t+q.Y]-d)*n)*h.data.scaleY}if(1==a)i==r.bq.add?(h.scaleX+=c-h.data.scaleX,h.scaleY+=d-h.data.scaleY):(h.scaleX=c,h.scaleY=d);else{let t=0,e=0;if(o==r.mJ.mixOut)switch(i){case r.bq.setup:t=h.data.scaleX,e=h.data.scaleY,h.scaleX=t+(Math.abs(c)*r.M8.signum(t)-t)*a,h.scaleY=e+(Math.abs(d)*r.M8.signum(e)-e)*a;break;case r.bq.first:case r.bq.replace:t=h.scaleX,e=h.scaleY,h.scaleX=t+(Math.abs(c)*r.M8.signum(t)-t)*a,h.scaleY=e+(Math.abs(d)*r.M8.signum(e)-e)*a;break;case r.bq.add:t=h.scaleX,e=h.scaleY,h.scaleX=t+(Math.abs(c)*r.M8.signum(t)-h.data.scaleX)*a,h.scaleY=e+(Math.abs(d)*r.M8.signum(e)-h.data.scaleY)*a}else switch(i){case r.bq.setup:t=Math.abs(h.data.scaleX)*r.M8.signum(c),e=Math.abs(h.data.scaleY)*r.M8.signum(d),h.scaleX=t+(c-t)*a,h.scaleY=e+(d-e)*a;break;case r.bq.first:case r.bq.replace:t=Math.abs(h.scaleX)*r.M8.signum(c),e=Math.abs(h.scaleY)*r.M8.signum(d),h.scaleX=t+(c-t)*a,h.scaleY=e+(d-e)*a;break;case r.bq.add:t=r.M8.signum(c),e=r.M8.signum(d),h.scaleX=Math.abs(h.scaleX)*t+(c-Math.abs(h.data.scaleX)*t)*a,h.scaleY=Math.abs(h.scaleY)*e+(d-Math.abs(h.data.scaleY)*e)*a}}}}class D extends X{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,n,a,i,o){const l=this.frames,h=t.bones[this.boneIndex];if(s=l[l.length-D.ENTRIES])c=l[l.length+D.PREV_X],d=l[l.length+D.PREV_Y];else{const t=R.binarySearch(l,s,D.ENTRIES);c=l[t+D.PREV_X],d=l[t+D.PREV_Y];const e=l[t],n=this.getCurvePercent(t/D.ENTRIES-1,1-(s-e)/(l[t+D.PREV_TIME]-e));c+=(l[t+D.X]-c)*n,d+=(l[t+D.Y]-d)*n}switch(i){case r.bq.setup:h.shearX=h.data.shearX+c*a,h.shearY=h.data.shearY+d*a;break;case r.bq.first:case r.bq.replace:h.shearX+=(h.data.shearX+c-h.shearX)*a,h.shearY+=(h.data.shearY+d-h.shearY)*a;break;case r.bq.add:h.shearX+=c*a,h.shearY+=d*a}}}const B=class extends Y{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t*B.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,n,a,r){t*=B.ENTRIES,this.frames[t]=e,this.frames[t+B.R]=s,this.frames[t+B.G]=n,this.frames[t+B.B]=a,this.frames[t+B.A]=r}apply(t,e,s,n,a,i,o){const l=t.slots[this.slotIndex],h=this.frames;if(s=h[h.length-B.ENTRIES]){const t=h.length;c=h[t+B.PREV_R],d=h[t+B.PREV_G],u=h[t+B.PREV_B],m=h[t+B.PREV_A]}else{const t=R.binarySearch(h,s,B.ENTRIES);c=h[t+B.PREV_R],d=h[t+B.PREV_G],u=h[t+B.PREV_B],m=h[t+B.PREV_A];const e=h[t],n=this.getCurvePercent(t/B.ENTRIES-1,1-(s-e)/(h[t+B.PREV_TIME]-e));c+=(h[t+B.R]-c)*n,d+=(h[t+B.G]-d)*n,u+=(h[t+B.B]-u)*n,m+=(h[t+B.A]-m)*n}if(1==a)l.color.set(c,d,u,m);else{const t=l.color;i==r.bq.setup&&t.setFromColor(l.data.color),t.add((c-t.r)*a,(d-t.g)*a,(u-t.b)*a,(m-t.a)*a)}}};let N=B;N.ENTRIES=5,N.PREV_TIME=-5,N.PREV_R=-4,N.PREV_G=-3,N.PREV_B=-2,N.PREV_A=-1,N.R=1,N.G=2,N.B=3,N.A=4;const L=class extends Y{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t*L.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,n,a,r,i,o,l){t*=L.ENTRIES,this.frames[t]=e,this.frames[t+L.R]=s,this.frames[t+L.G]=n,this.frames[t+L.B]=a,this.frames[t+L.A]=r,this.frames[t+L.R2]=i,this.frames[t+L.G2]=o,this.frames[t+L.B2]=l}apply(t,e,s,n,a,i,o){const l=t.slots[this.slotIndex],h=this.frames;if(s=h[h.length-L.ENTRIES]){const t=h.length;c=h[t+L.PREV_R],d=h[t+L.PREV_G],u=h[t+L.PREV_B],m=h[t+L.PREV_A],f=h[t+L.PREV_R2],g=h[t+L.PREV_G2],p=h[t+L.PREV_B2]}else{const t=R.binarySearch(h,s,L.ENTRIES);c=h[t+L.PREV_R],d=h[t+L.PREV_G],u=h[t+L.PREV_B],m=h[t+L.PREV_A],f=h[t+L.PREV_R2],g=h[t+L.PREV_G2],p=h[t+L.PREV_B2];const e=h[t],n=this.getCurvePercent(t/L.ENTRIES-1,1-(s-e)/(h[t+L.PREV_TIME]-e));c+=(h[t+L.R]-c)*n,d+=(h[t+L.G]-d)*n,u+=(h[t+L.B]-u)*n,m+=(h[t+L.A]-m)*n,f+=(h[t+L.R2]-f)*n,g+=(h[t+L.G2]-g)*n,p+=(h[t+L.B2]-p)*n}if(1==a)l.color.set(c,d,u,m),l.darkColor.set(f,g,p,1);else{const t=l.color,e=l.darkColor;i==r.bq.setup&&(t.setFromColor(l.data.color),e.setFromColor(l.data.darkColor)),t.add((c-t.r)*a,(d-t.g)*a,(u-t.b)*a,(m-t.a)*a),e.add((f-e.r)*a,(g-e.g)*a,(p-e.b)*a,0)}}};let W=L;W.ENTRIES=8,W.PREV_TIME=-8,W.PREV_R=-7,W.PREV_G=-6,W.PREV_B=-5,W.PREV_A=-4,W.PREV_R2=-3,W.PREV_G2=-2,W.PREV_B2=-1,W.R=1,W.G=2,W.B=3,W.A=4,W.R2=5,W.G2=6,W.B2=7;class O{constructor(t){this.frames=r.cQ.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,n,a,i,o){const l=t.slots[this.slotIndex];if(o==r.mJ.mixOut&&i==r.bq.setup){const e=l.data.attachmentName;return void l.setAttachment(null==e?null:t.getAttachment(this.slotIndex,e))}const h=this.frames;if(s=h[h.length-1]?h.length-1:R.binarySearch(h,s,1)-1;const d=this.attachmentNames[c];t.slots[this.slotIndex].setAttachment(null==d?null:t.getAttachment(this.slotIndex,d))}}let _=null;class $ extends Y{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t),this.frameVertices=new Array(t),null==_&&(_=r.cQ.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,n,a,i,o){const l=t.slots[this.slotIndex],h=l.getAttachment();if(!(h instanceof p&&h.applyDeform(this.attachment)))return;const c=l.attachmentVertices;0==c.length&&(i=r.bq.setup);const d=this.frameVertices,u=d[0].length,m=this.frames;if(s=m[m.length-1]){const t=d[m.length-1];if(1==a)if(i==r.bq.add){const e=h;if(null==e.bones){const s=e.vertices;for(let e=0;es)this.apply(t,e,Number.MAX_VALUE,n,a,r,i),e=-1;else if(e>=o[l-1])return;if(s0&&o[h-1]==t;)h--}for(;h=o[h];h++)n.push(this.events[h])}}class U{constructor(t){this.frames=r.cQ.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,n,a,i,o){const l=t.drawOrder,h=t.slots;if(o==r.mJ.mixOut&&i==r.bq.setup)return void r.cQ.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);const c=this.frames;if(s=c[c.length-1]?c.length-1:R.binarySearch(c,s)-1;const u=this.drawOrders[d];if(null==u)r.cQ.arrayCopy(h,0,l,0,h.length);else for(let t=0,e=u.length;t=l[l.length-z.ENTRIES])return void(i==r.bq.setup?(h.mix=h.data.mix+(l[l.length+z.PREV_MIX]-h.data.mix)*a,o==r.mJ.mixOut?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[l.length+z.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+z.PREV_COMPRESS],h.stretch=0!=l[l.length+z.PREV_STRETCH])):(h.mix+=(l[l.length+z.PREV_MIX]-h.mix)*a,o==r.mJ.mixIn&&(h.bendDirection=l[l.length+z.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+z.PREV_COMPRESS],h.stretch=0!=l[l.length+z.PREV_STRETCH])));const c=R.binarySearch(l,s,z.ENTRIES),d=l[c+z.PREV_MIX],u=l[c],m=this.getCurvePercent(c/z.ENTRIES-1,1-(s-u)/(l[c+z.PREV_TIME]-u));i==r.bq.setup?(h.mix=h.data.mix+(d+(l[c+z.MIX]-d)*m-h.data.mix)*a,o==r.mJ.mixOut?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[c+z.PREV_BEND_DIRECTION],h.compress=0!=l[c+z.PREV_COMPRESS],h.stretch=0!=l[c+z.PREV_STRETCH])):(h.mix+=(d+(l[c+z.MIX]-d)*m-h.mix)*a,o==r.mJ.mixIn&&(h.bendDirection=l[c+z.PREV_BEND_DIRECTION],h.compress=0!=l[c+z.PREV_COMPRESS],h.stretch=0!=l[c+z.PREV_STRETCH]))}};let j=z;j.ENTRIES=5,j.PREV_TIME=-5,j.PREV_MIX=-4,j.PREV_BEND_DIRECTION=-3,j.PREV_COMPRESS=-2,j.PREV_STRETCH=-1,j.MIX=1,j.BEND_DIRECTION=2,j.COMPRESS=3,j.STRETCH=4;const J=class extends Y{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t*J.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,n,a,r){t*=J.ENTRIES,this.frames[t]=e,this.frames[t+J.ROTATE]=s,this.frames[t+J.TRANSLATE]=n,this.frames[t+J.SCALE]=a,this.frames[t+J.SHEAR]=r}apply(t,e,s,n,a,i,o){const l=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(s=l[l.length-J.ENTRIES]){const t=l.length;c=l[t+J.PREV_ROTATE],d=l[t+J.PREV_TRANSLATE],u=l[t+J.PREV_SCALE],m=l[t+J.PREV_SHEAR]}else{const t=R.binarySearch(l,s,J.ENTRIES);c=l[t+J.PREV_ROTATE],d=l[t+J.PREV_TRANSLATE],u=l[t+J.PREV_SCALE],m=l[t+J.PREV_SHEAR];const e=l[t],n=this.getCurvePercent(t/J.ENTRIES-1,1-(s-e)/(l[t+J.PREV_TIME]-e));c+=(l[t+J.ROTATE]-c)*n,d+=(l[t+J.TRANSLATE]-d)*n,u+=(l[t+J.SCALE]-u)*n,m+=(l[t+J.SHEAR]-m)*n}if(i==r.bq.setup){const t=h.data;h.rotateMix=t.rotateMix+(c-t.rotateMix)*a,h.translateMix=t.translateMix+(d-t.translateMix)*a,h.scaleMix=t.scaleMix+(u-t.scaleMix)*a,h.shearMix=t.shearMix+(m-t.shearMix)*a}else h.rotateMix+=(c-h.rotateMix)*a,h.translateMix+=(d-h.translateMix)*a,h.scaleMix+=(u-h.scaleMix)*a,h.shearMix+=(m-h.shearMix)*a}};let H=J;H.ENTRIES=5,H.PREV_TIME=-5,H.PREV_ROTATE=-4,H.PREV_TRANSLATE=-3,H.PREV_SCALE=-2,H.PREV_SHEAR=-1,H.ROTATE=1,H.TRANSLATE=2,H.SCALE=3,H.SHEAR=4;const G=class extends Y{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t*G.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=G.ENTRIES,this.frames[t]=e,this.frames[t+G.VALUE]=s}apply(t,e,s,n,a,i,o){const l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(s=l[l.length-G.ENTRIES])c=l[l.length+G.PREV_VALUE];else{const t=R.binarySearch(l,s,G.ENTRIES);c=l[t+G.PREV_VALUE];const e=l[t],n=this.getCurvePercent(t/G.ENTRIES-1,1-(s-e)/(l[t+G.PREV_TIME]-e));c+=(l[t+G.VALUE]-c)*n}i==r.bq.setup?h.position=h.data.position+(c-h.data.position)*a:h.position+=(c-h.position)*a}};let K=G;K.ENTRIES=2,K.PREV_TIME=-2,K.PREV_VALUE=-1,K.VALUE=1;class Z extends K{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,n,a,i,o){const l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(s=l[l.length-Z.ENTRIES])c=l[l.length+Z.PREV_VALUE];else{const t=R.binarySearch(l,s,Z.ENTRIES);c=l[t+Z.PREV_VALUE];const e=l[t],n=this.getCurvePercent(t/Z.ENTRIES-1,1-(s-e)/(l[t+Z.PREV_TIME]-e));c+=(l[t+Z.VALUE]-c)*n}i==r.bq.setup?h.spacing=h.data.spacing+(c-h.data.spacing)*a:h.spacing+=(c-h.spacing)*a}}const tt=class extends Y{constructor(t){super(t),this.frames=r.cQ.newFloatArray(t*tt.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,n){t*=tt.ENTRIES,this.frames[t]=e,this.frames[t+tt.ROTATE]=s,this.frames[t+tt.TRANSLATE]=n}apply(t,e,s,n,a,i,o){const l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(s=l[l.length-tt.ENTRIES])c=l[l.length+tt.PREV_ROTATE],d=l[l.length+tt.PREV_TRANSLATE];else{const t=R.binarySearch(l,s,tt.ENTRIES);c=l[t+tt.PREV_ROTATE],d=l[t+tt.PREV_TRANSLATE];const e=l[t],n=this.getCurvePercent(t/tt.ENTRIES-1,1-(s-e)/(l[t+tt.PREV_TIME]-e));c+=(l[t+tt.ROTATE]-c)*n,d+=(l[t+tt.TRANSLATE]-d)*n}i==r.bq.setup?(h.rotateMix=h.data.rotateMix+(c-h.data.rotateMix)*a,h.translateMix=h.data.translateMix+(d-h.data.translateMix)*a):(h.rotateMix+=(c-h.rotateMix)*a,h.translateMix+=(d-h.translateMix)*a)}};let et=tt;et.ENTRIES=3,et.PREV_TIME=-3,et.PREV_ROTATE=-2,et.PREV_TRANSLATE=-1,et.ROTATE=1,et.TRANSLATE=2;const st=class{constructor(t){this.tracks=new Array,this.events=new Array,this.listeners=new Array,this.queue=new ot(this),this.propertyIDs=new r.JS,this.animationsChanged=!1,this.timeScale=1,this.trackEntryPool=new r.Kg((()=>new rt)),this.data=t}update(t){t*=this.timeScale;const e=this.tracks;for(let s=0,n=e.length;s0){if(n.delay-=a,n.delay>0)continue;a=-n.delay,n.delay=0}let r=n.next;if(null!=r){const e=n.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime=0==n.timeScale?0:(e/n.timeScale+t)*r.timeScale,n.trackTime+=a,this.setCurrent(s,r,!0);null!=r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&null==n.mixingFrom){e[s]=null,this.queue.end(n),this.disposeNext(n);continue}if(null!=n.mixingFrom&&this.updateMixingFrom(n,t)){let t=n.mixingFrom;for(n.mixingFrom=null,null!=t&&(t.mixingTo=null);null!=t;)this.queue.end(t),t=t.mixingFrom}n.trackTime+=a}this.queue.drain()}updateMixingFrom(t,e){const s=t.mixingFrom;if(null==s)return!0;const n=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,null!=s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),n):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(null==t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const e=this.events,s=this.tracks;let n=!1;for(let a=0,i=s.length;a0)continue;n=!0;const o=0==a?r.bq.first:i.mixBlend;let l=i.alpha;null!=i.mixingFrom?l*=this.applyMixingFrom(i,t,o):i.trackTime>=i.trackEnd&&null==i.next&&(l=0);const h=i.animationLast,c=i.getAnimationTime(),d=i.animation.timelines.length,u=i.animation.timelines;if(0==a&&1==l||o==r.bq.add)for(let s=0;s1&&(a=1),s!=r.bq.first&&(s=n.mixBlend));const i=a0&&this.queueEvents(n,c),this.events.length=0,n.nextAnimationLast=c,n.nextTrackLast=n.trackTime,a}applyRotateTimeline(t,e,s,n,a,i,o,l){if(l&&(i[o]=0),1==n)return void t.apply(e,0,s,null,1,a,r.mJ.mixIn);const h=t,c=h.frames,d=e.bones[h.boneIndex];let u=0,m=0;if(s=c[c.length-F.ENTRIES])m=d.data.rotation+c[c.length+F.PREV_ROTATION];else{const t=R.binarySearch(c,s,F.ENTRIES),e=c[t+F.PREV_ROTATION],n=c[t],a=h.getCurvePercent((t>>1)-1,1-(s-n)/(c[t+F.PREV_TIME]-n));m=c[t+F.ROTATION]-e,m-=360*(16384-(16384.499999999996-m/360|0)),m=e+m*a+d.data.rotation,m-=360*(16384-(16384.499999999996-m/360|0))}let f=0,g=m-u;if(g-=360*(16384-(16384.499999999996-g/360|0)),0==g)f=i[o];else{let t=0,e=0;l?(t=0,e=g):(t=i[o],e=i[o+1]);const s=g>0;let n=t>=0;r.M8.signum(e)!=r.M8.signum(g)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*r.M8.signum(t)),n=s),f=g+t-t%360,n!=s&&(f+=360*r.M8.signum(t)),i[o]=f}i[o+1]=g,u+=f*n,d.rotation=u-360*(16384-(16384.499999999996-u/360|0))}queueEvents(t,e){const s=t.animationStart,n=t.animationEnd,a=n-s,r=t.trackLast%a,i=this.events;let o=0;const l=i.length;for(;on||this.queue.event(t,e)}let h=!1;for(h=t.loop?0==a||r>t.trackTime%a:e>=n&&t.animationLast=this.tracks.length)return;const e=this.tracks[t];if(null==e)return;this.queue.end(e),this.disposeNext(e);let s=e;for(;;){const t=s.mixingFrom;if(null==t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){const n=this.expandToIndex(t);this.tracks[t]=e,null!=n&&(s&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,null!=n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s){const n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,n,s)}setAnimationWith(t,e,s){if(null==e)throw new Error("animation cannot be null.");let n=!0,a=this.expandToIndex(t);null!=a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.disposeNext(a),a=a.mixingFrom,n=!1):this.disposeNext(a));const r=this.trackEntry(t,e,s,a);return this.setCurrent(t,r,n),this.queue.drain(),r}addAnimation(t,e,s,n){const a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,a,s,n)}addAnimationWith(t,e,s,n){if(null==e)throw new Error("animation cannot be null.");let a=this.expandToIndex(t);if(null!=a)for(;null!=a.next;)a=a.next;const r=this.trackEntry(t,e,s,a);if(null==a)this.setCurrent(t,r,!0),this.queue.drain();else if(a.next=r,n<=0){const t=a.animationEnd-a.animationStart;0!=t?(a.loop?n+=t*(1+(a.trackTime/t|0)):n+=Math.max(t,a.trackTime),n-=this.data.getMix(a.animation,e)):n=a.trackTime}return r.delay=n,r}setEmptyAnimation(t,e){const s=this.setAnimationWith(t,st.emptyAnimation,!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e,s){s<=0&&(s-=e);const n=this.addAnimationWith(t,st.emptyAnimation,!1,s);return n.mixDuration=e,n.trackEnd=e,n}setEmptyAnimations(t){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e0){a[r]=st.HOLD_MIX,i[r]=s;continue t}break}a[r]=st.HOLD}else a[r]=st.FIRST;else a[r]=st.SUBSEQUENT}}hasTimeline(t,e){const s=t.animation.timelines;for(let t=0,n=s.length;t=this.tracks.length?null:this.tracks[t]}addListener(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(t,e,s){st.deprecatedWarning1||(st.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,s)}addAnimationByName(t,e,s,n){st.deprecatedWarning2||(st.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,s,n)}hasAnimation(t){return null!==this.data.skeletonData.findAnimation(t)}hasAnimationByName(t){return st.deprecatedWarning3||(st.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let nt=st;nt.emptyAnimation=new R("",[],0),nt.SUBSEQUENT=0,nt.FIRST=1,nt.HOLD=2,nt.HOLD_MIX=3,nt.deprecatedWarning1=!1,nt.deprecatedWarning2=!1,nt.deprecatedWarning3=!1;const at=class{constructor(){this.mixBlend=r.bq.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 t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return at.deprecatedWarning1||(at.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){at.deprecatedWarning1||(at.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return at.deprecatedWarning2||(at.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){at.deprecatedWarning2||(at.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=t}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let rt=at;rt.deprecatedWarning1=!1,rt.deprecatedWarning2=!1;const it=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(lt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(lt.interrupt),this.objects.push(t)}end(t){this.objects.push(lt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(lt.dispose),this.objects.push(t)}complete(t){this.objects.push(lt.complete),this.objects.push(t)}event(t,e){this.objects.push(lt.event),this.objects.push(t),this.objects.push(e)}deprecateStuff(){return it.deprecatedWarning1||(it.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 t=this.objects,e=this.animState.listeners;for(let s=0;s(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(lt||{});class ht{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const ct=class{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){const n=this.skeletonData.findAnimation(t);if(null==n)throw new Error(`Animation not found: ${t}`);const a=this.skeletonData.findAnimation(e);if(null==a)throw new Error(`Animation not found: ${e}`);this.setMixWith(n,a,s)}setMixByName(t,e,s){ct.deprecatedWarning1||(ct.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(t,e,s)}setMixWith(t,e,s){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");const n=`${t.name}.${e.name}`;this.animationToMixTime[n]=s}getMix(t,e){const s=`${t.name}.${e.name}`,n=this.animationToMixTime[s];return void 0===n?this.defaultMix:n}};let dt=ct;dt.deprecatedWarning1=!1;class ut{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const n=this.atlas.findRegion(s);if(null==n)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const a=new k(e);return a.region=n,a}newMeshAttachment(t,e,s){const n=this.atlas.findRegion(s);if(null==n)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const a=new w(e);return a.region=n,a}newBoundingBoxAttachment(t,e){return new x(e)}newPathAttachment(t,e){return new M(e)}newPointAttachment(t,e){return new y(e)}newClippingAttachment(t,e){return new b(e)}}class mt{constructor(t,e,s){if(this.matrix=new o.y3,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=!0,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}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,e,s,n,a,i,o){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=n,this.ascaleY=a,this.ashearX=i,this.ashearY=o,this.appliedValid=!0;const l=this.parent,h=this.matrix,c=this.skeleton.scaleX,d=r.Xd.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(null==l){const l=this.skeleton,u=s+90+o;return h.a=r.M8.cosDeg(s+i)*n*c,h.c=r.M8.cosDeg(u)*a*c,h.b=r.M8.sinDeg(s+i)*n*d,h.d=r.M8.sinDeg(u)*a*d,h.tx=t*c+l.x,void(h.ty=e*d+l.y)}let u=l.matrix.a,m=l.matrix.c,f=l.matrix.b,g=l.matrix.d;switch(h.tx=u*t+m*e+l.matrix.tx,h.ty=f*t+g*e+l.matrix.ty,this.data.transformMode){case r.Qe.Normal:{const t=s+90+o,e=r.M8.cosDeg(s+i)*n,l=r.M8.cosDeg(t)*a,c=r.M8.sinDeg(s+i)*n,d=r.M8.sinDeg(t)*a;return h.a=u*e+m*c,h.c=u*l+m*d,h.b=f*e+g*c,void(h.d=f*l+g*d)}case r.Qe.OnlyTranslation:{const t=s+90+o;h.a=r.M8.cosDeg(s+i)*n,h.c=r.M8.cosDeg(t)*a,h.b=r.M8.sinDeg(s+i)*n,h.d=r.M8.sinDeg(t)*a;break}case r.Qe.NoRotationOrReflection:{let t=u*u+f*f,e=0;t>1e-4?(t=Math.abs(u*g-m*f)/t,m=f*t,g=u*t,e=Math.atan2(f,u)*r.M8.radDeg):(u=0,f=0,e=90-Math.atan2(g,m)*r.M8.radDeg);const l=s+i-e,c=s+o-e+90,d=r.M8.cosDeg(l)*n,p=r.M8.cosDeg(c)*a,x=r.M8.sinDeg(l)*n,b=r.M8.sinDeg(c)*a;h.a=u*d-m*x,h.c=u*p-m*b,h.b=f*d+g*x,h.d=f*p+g*b;break}case r.Qe.NoScale:case r.Qe.NoScaleOrReflection:{const t=r.M8.cosDeg(s),e=r.M8.sinDeg(s);let l=(u*t+m*e)/c,p=(f*t+g*e)/d,x=Math.sqrt(l*l+p*p);x>1e-5&&(x=1/x),l*=x,p*=x,x=Math.sqrt(l*l+p*p),this.data.transformMode==r.Qe.NoScale&&u*g-m*f<0!=(r.Xd.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);const b=Math.PI/2+Math.atan2(p,l),w=Math.cos(b)*x,M=Math.sin(b)*x,y=r.M8.cosDeg(i)*n,E=r.M8.cosDeg(90+o)*a,S=r.M8.sinDeg(i)*n,k=r.M8.sinDeg(90+o)*a;h.a=l*y+w*S,h.c=l*E+w*k,h.b=p*y+M*S,h.d=p*E+M*k;break}}h.a*=c,h.c*=c,h.b*=d,h.d*=d}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.M8.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*r.M8.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;const t=this.parent,e=this.matrix;if(null==t)return this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*r.M8.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,void(this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*r.M8.radDeg);const s=t.matrix,n=1/(s.a*s.d-s.b*s.c),a=e.tx-s.tx,i=e.ty-s.ty;this.ax=a*s.d*n-i*s.c*n,this.ay=i*s.a*n-a*s.b*n;const o=n*s.d,l=n*s.a,h=n*s.c,c=n*s.b,d=o*e.a-h*e.b,u=o*e.c-h*e.d,m=l*e.b-c*e.a,f=l*e.d-c*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){const t=d*f-u*m;this.ascaleY=t/this.ascaleX,this.ashearY=Math.atan2(d*u+m*f,t)*r.M8.radDeg,this.arotation=Math.atan2(m,d)*r.M8.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+f*f),this.ashearY=0,this.arotation=90-Math.atan2(f,u)*r.M8.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,n=e.c,a=e.b,r=e.d,i=1/(s*r-n*a),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*r*i-l*n*i,t.y=l*s*i-o*a*i,t}localToWorld(t){const e=this.matrix,s=t.x,n=t.y;return t.x=s*e.a+n*e.c+e.tx,t.y=s*e.b+n*e.d+e.ty,t}worldToLocalRotation(t){const e=r.M8.sinDeg(t),s=r.M8.cosDeg(t),n=this.matrix;return Math.atan2(n.a*e-n.b*s,n.d*s-n.c*e)*r.M8.radDeg}localToWorldRotation(t){const e=r.M8.sinDeg(t),s=r.M8.cosDeg(t),n=this.matrix;return Math.atan2(s*n.b+e*n.d,s*n.a+e*n.c)*r.M8.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,n=e.c,a=e.b,i=e.d,o=r.M8.cosDeg(t),l=r.M8.sinDeg(t);e.a=o*s-l*a,e.c=o*n-l*i,e.b=l*s+o*a,e.d=l*n+o*i,this.appliedValid=!1}}class ft{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=r.Qe.Normal,t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class gt{constructor(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class pt{constructor(t){this.name=t}}class xt{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s180?f-=360:f<-180&&(f+=360);let g=t.ascaleX,p=t.ascaleY;if(n||a){const e=t.data.length*g,s=Math.sqrt(u*u+m*m);if(n&&se&&e>1e-4){const t=(s/e-1)*o+1;g*=t,i&&(p*=t)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,g,p,t.ashearX,t.ashearY)}apply2(t,e,s,n,a,i,o){if(0==o)return void e.updateWorldTransform();t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,h=t.ay;let c=t.ascaleX,d=c,u=t.ascaleY,m=e.ascaleX;const f=t.matrix;let g=0,p=0,x=0;c<0?(c=-c,g=180,x=-1):(g=0,x=1),u<0&&(u=-u,x=-x),m<0?(m=-m,p=180):p=0;const b=e.ax;let w=0,M=0,y=0,E=f.a,S=f.c,k=f.b,A=f.d;const I=Math.abs(c-u)<=1e-4;I?(w=e.ay,M=E*b+S*w+f.tx,y=k*b+A*w+f.ty):(w=0,M=E*b+f.tx,y=k*b+f.ty);const T=t.parent.matrix;E=T.a,S=T.c,k=T.b,A=T.d;const R=1/(E*A-S*k);let C=s-T.tx,v=n-T.ty;const Y=(C*A-v*S)*R-l,V=(v*E-C*k)*R-h,F=Y*Y+V*V;C=M-T.tx,v=y-T.ty;const P=(C*A-v*S)*R-l,X=(v*E-C*k)*R-h,q=Math.sqrt(P*P+X*X);let D=e.data.length*m,B=0,N=0;t:if(I){D*=c;let t=(F-q*q-D*D)/(2*q*D);t<-1?t=-1:t>1&&(t=1,i&&q+D>1e-4&&(d*=(Math.sqrt(F)/(q+D)-1)*o+1)),N=Math.acos(t)*a,E=q+D*t,S=D*Math.sin(N),B=Math.atan2(V*E-Y*S,Y*E+V*S)}else{E=c*D,S=u*D;const t=E*E,e=S*S,s=Math.atan2(V,Y);k=e*q*q+t*F-t*e;const n=-2*e*q,i=e-t;if(A=n*n-4*i*k,A>=0){let t=Math.sqrt(A);n<0&&(t=-t),t=-(n+t)/2;const e=t/i,r=k/t,o=Math.abs(e)=-1&&k<=1&&(k=Math.acos(k),C=E*Math.cos(k)+q,v=S*Math.sin(k),A=C*C+v*v,Ag&&(m=k,g=A,f=C,p=v)),F<=(h+g)/2?(B=s-Math.atan2(d*a,l),N=o*a):(B=s-Math.atan2(p*a,f),N=m*a)}const L=Math.atan2(w,b)*x;let W=t.arotation;B=(B-L)*r.M8.radDeg+g-W,B>180?B-=360:B<-180&&(B+=360),t.updateWorldTransformWith(l,h,W+B*o,d,t.ascaleY,0,0),W=e.arotation,N=((N+L)*r.M8.radDeg-e.ashearX)*x+p-W,N>180?N-=360:N<-180&&(N+=360),e.updateWorldTransformWith(b,w,W+N*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class bt{constructor(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t}}class wt{constructor(t){this.order=0,this.bones=new Array,this.name=t}}var Mt=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t))(Mt||{});const yt=class{constructor(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,n=t.bones.length;s0;if(!(s>0||n))return;const a=this.data,i=a.spacingMode,o=i==Mt.Length,l=a.rotateMode,h=l==r.YK.Tangent,c=l==r.YK.ChainScale,d=this.bones.length,u=h?d:d+1,m=this.bones,f=r.cQ.setArraySize(this.spaces,u);let g=null;const p=this.spacing;if(c||o){c&&(g=r.cQ.setArraySize(this.lengths,d));for(let t=0,e=u-1;t0?r.M8.degRad:-r.M8.degRad}for(let t=0,a=3;tr.M8.PI?d-=r.M8.PI2:d<-r.M8.PI&&(d+=r.M8.PI2),d*=e,m=Math.cos(d),g=Math.sin(d),o.a=m*s-g*l,o.c=m*n-g*c,o.b=g*s+m*l,o.d=g*n+m*c}i.appliedValid=!1}}computeWorldPositions(t,e,s,n,a){const i=this.target;let o=this.position;const l=this.spaces,h=r.cQ.setArraySize(this.positions,3*e+2);let c=null;const d=t.closed;let u=t.worldVerticesLength,m=u/6,f=yt.NONE;if(!t.constantSpeed){const g=t.lengths;m-=d?1:2;const p=g[m];if(n&&(o*=p),a)for(let t=0;tp){f!=yt.AFTER&&(f=yt.AFTER,t.computeWorldVertices(i,u-6,4,c,0,2)),this.addAfterPosition(x-p,c,0,h,a);continue}}for(;;r++){const t=g[r];if(!(x>t)){if(0==r)x/=t;else{const e=g[r-1];x=(x-e)/(t-e)}break}}r!=f&&(f=r,d&&r==m?(t.computeWorldVertices(i,u-4,4,c,0,2),t.computeWorldVertices(i,0,4,c,4,2)):t.computeWorldVertices(i,6*r+2,8,c,0,2)),this.addCurvePosition(x,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],h,a,s||n>0&&0==e)}return h}d?(u+=2,c=r.cQ.setArraySize(this.world,u),t.computeWorldVertices(i,2,u-4,c,0,2),t.computeWorldVertices(i,0,2,c,u-4,2),c[u-2]=c[0],c[u-1]=c[1]):(m--,u-=4,c=r.cQ.setArraySize(this.world,u),t.computeWorldVertices(i,2,u,c,0,2));const g=r.cQ.setArraySize(this.curves,m);let p=0,x=c[0],b=c[1],w=0,M=0,y=0,E=0,S=0,k=0,A=0,I=0,T=0,R=0,C=0,v=0,Y=0,V=0;for(let t=0,e=2;tp){this.addAfterPosition(i-p,c,u-4,h,n);continue}}for(;;a++){const t=g[a];if(!(i>t)){if(0==a)i/=t;else{const e=g[a-1];i=(i-e)/(t-e)}break}}if(a!=f){f=a;let t=6*a;for(x=c[t],b=c[t+1],w=c[t+2],M=c[t+3],y=c[t+4],E=c[t+5],S=c[t+6],k=c[t+7],A=.03*(x-2*w+y),I=.03*(b-2*M+E),T=.006*(3*(w-y)-x+S),R=.006*(3*(M-E)-b+k),C=2*A+T,v=2*I+R,Y=.3*(w-x)+A+.16666667*T,V=.3*(M-b)+I+.16666667*R,P=Math.sqrt(Y*Y+V*V),F[0]=P,t=1;t<8;t++)Y+=C,V+=v,C+=T,v+=R,P+=Math.sqrt(Y*Y+V*V),F[t]=P;Y+=C,V+=v,P+=Math.sqrt(Y*Y+V*V),F[8]=P,Y+=C+T,V+=v+R,P+=Math.sqrt(Y*Y+V*V),F[9]=P,r=0}for(i*=P;;r++){const t=F[r];if(!(i>t)){if(0==r)i/=t;else{const e=F[r-1];i=r+(i-e)/(t-e)}break}}this.addCurvePosition(.1*i,x,b,w,M,y,E,S,k,h,n,s||t>0&&0==e)}return h}addBeforePosition(t,e,s,n,a){const r=e[s],i=e[s+1],o=e[s+2]-r,l=e[s+3]-i,h=Math.atan2(l,o);n[a]=r+t*Math.cos(h),n[a+1]=i+t*Math.sin(h),n[a+2]=h}addAfterPosition(t,e,s,n,a){const r=e[s+2],i=e[s+3],o=r-e[s],l=i-e[s+1],h=Math.atan2(l,o);n[a]=r+t*Math.cos(h),n[a+1]=i+t*Math.sin(h),n[a+2]=h}addCurvePosition(t,e,s,n,a,r,i,o,l,h,c,d){(0==t||isNaN(t))&&(t=1e-4);const u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,b=3*x,w=f*b,M=b*t,y=e*p+n*w+r*M+o*m,E=s*p+a*w+i*M+l*m;h[c]=y,h[c+1]=E,d&&(h[c+2]=Math.atan2(E-(s*g+a*x*2+i*u),y-(e*g+n*x*2+r*u)))}getOrder(){return this.data.order}};let Et=yt;Et.NONE=-1,Et.BEFORE=-2,Et.AFTER=-3,Et.epsilon=1e-5;class St{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new r.FM,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let s=0;s0?r.M8.degRad:-r.M8.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,f=this.bones;for(let i=0,d=f.length;ir.M8.PI?i-=r.M8.PI2:i<-r.M8.PI&&(i+=r.M8.PI2),i*=t;const l=Math.cos(i),c=Math.sin(i);p.a=l*e-c*n,p.c=l*s-c*a,p.b=c*e+l*n,p.d=c*s+l*a,g=!0}if(0!=e){const t=this.temp;a.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),p.tx+=(t.x-p.tx)*e,p.ty+=(t.y-p.ty)*e,g=!0}if(s>0){let t=Math.sqrt(p.a*p.a+p.b*p.b),e=Math.sqrt(o*o+h*h);t>1e-5&&(t=(t+(e-t+this.data.offsetScaleX)*s)/t),p.a*=t,p.b*=t,t=Math.sqrt(p.c*p.c+p.d*p.d),e=Math.sqrt(l*l+c*c),t>1e-5&&(t=(t+(e-t+this.data.offsetScaleY)*s)/t),p.c*=t,p.d*=t,g=!0}if(n>0){const t=p.c,e=p.d,s=Math.atan2(e,t);let a=Math.atan2(c,l)-Math.atan2(h,o)-(s-Math.atan2(p.b,p.a));a>r.M8.PI?a-=r.M8.PI2:a<-r.M8.PI&&(a+=r.M8.PI2),a=s+(a+m)*n;const i=Math.sqrt(t*t+e*e);p.c=Math.cos(a)*i,p.d=Math.sin(a)*i,g=!0}g&&(d.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,n=this.shearMix,a=this.target,i=a.matrix,o=i.a,l=i.c,h=i.b,c=i.d,d=o*c-l*h>0?r.M8.degRad:-r.M8.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,f=this.bones;for(let i=0,d=f.length;ir.M8.PI?i-=r.M8.PI2:i<-r.M8.PI&&(i+=r.M8.PI2),i*=t;const l=Math.cos(i),c=Math.sin(i);p.a=l*e-c*n,p.c=l*s-c*a,p.b=c*e+l*n,p.d=c*s+l*a,g=!0}if(0!=e){const t=this.temp;a.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),p.tx+=t.x*e,p.ty+=t.y*e,g=!0}if(s>0){let t=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleX)*s+1;p.a*=t,p.b*=t,t=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleY)*s+1,p.c*=t,p.d*=t,g=!0}if(n>0){let t=Math.atan2(c,l)-Math.atan2(h,o);t>r.M8.PI?t-=r.M8.PI2:t<-r.M8.PI&&(t+=r.M8.PI2);const e=p.c,s=p.d;t=Math.atan2(s,e)+(t-r.M8.PI/2+m)*n;const a=Math.sqrt(e*e+s*s);p.c=Math.cos(t)*a,p.d=Math.sin(t)*a,g=!0}g&&(d.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,n=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();const r=this.bones;for(let i=0,o=r.length;i0&&(d>1e-5&&(d=(d+(a.ascaleX-d+this.data.offsetScaleX)*s)/d),u>1e-5&&(u=(u+(a.ascaleY-u+this.data.offsetScaleY)*s)/u));const m=o.ashearY;if(n>0){let t=a.ashearY-m+this.data.offsetShearY;t-=360*(16384-(16384.499999999996-t/360|0)),o.shearY+=t*n}o.updateWorldTransformWith(h,c,l,d,u,o.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,n=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();const r=this.bones;for(let i=0,o=r.length;i0&&(d>1e-5&&(d*=(a.ascaleX-1+this.data.offsetScaleX)*s+1),u>1e-5&&(u*=(a.ascaleY-1+this.data.offsetScaleY)*s+1));let m=o.ashearY;n>0&&(m+=(a.ashearY+this.data.offsetShearY)*n),o.updateWorldTransformWith(h,c,l,d,u,o.ashearX,m)}}getOrder(){return this.data.order}}const kt=class{constructor(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e1){const t=s[s.length-1];this._updateCache.indexOf(t)>-1||this.updateCacheReset.push(t)}this._updateCache.push(t),this.sortReset(n.children),s[s.length-1].sorted=!0}sortPathConstraint(t){const e=t.target,s=e.data.index,n=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,s,n),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,n);for(let t=0,e=this.data.skins.length;t-1||this.updateCacheReset.push(s)}else for(let t=0;t= 0.");if(null==e)throw new Error("name cannot be null.");if(null==s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class Ct{constructor(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,null==t)throw new Error("name cannot be null.");this.name=t}}class vt{constructor(t){if(this.attachments=new Array,null==t)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,s){if(null==s)throw new Error("attachment cannot be null.");const n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let n=0;n=0;s--)-1==l[s]&&(l[s]=t[--a])}t.setFrame(n++,i.time,l)}a.push(t),i=Math.max(i,t.frames[t.getFrameCount()-1])}if(t.events){const e=new Q(t.events.length);let n=0;for(let a=0;a>1)*r;const i=t.bone.skeleton,o=t.deform;let l=this.vertices;const h=this.bones;if(!h){o.length>0&&(l=o);const i=t.bone.matrix,h=i.tx,c=i.ty,d=i.a,u=i.c,m=i.b,f=i.d;for(let t=e,i=a;i=this.regions.length&&(s=this.regions.length-1);const n=this.regions[s];e.region!=n&&(e.region=n)}getPath(t,e){let s=t;const n=(this.start+e).toString();for(let t=this.digits-n.length;t>0;t--)s+="0";return s+=n,s}static nextID(){return $t._nextID++}};let Qt=$t;Qt._nextID=0;var Ut=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(Ut||{});const zt=[0,1,2,3,4,5,6];class jt{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new r.PA,!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(let e=0;e0&&(e%=this.duration));const l=this.timelines;for(let n=0,h=l.length;ne)return n-1;return s-1}static search(t,e,s){const n=t.length;for(let a=s;ae)return a-s;return n-s}}class Ht extends Jt{constructor(t,e,s){super(t,s),this.curves=r.cQ.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+18*t;if(this.curves.length>e){const t=r.cQ.newFloatArray(e);r.cQ.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,n,a,r,i,o,l,h,c){const d=this.curves;let u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);const m=.03*(n-2*r+o),f=.03*(a-2*i+l),g=.006*(3*(r-o)-n+h),p=.006*(3*(i-l)-a+c);let x=2*m+g,b=2*f+p,w=.3*(r-n)+m+.16666667*g,M=.3*(i-a)+f+.16666667*p,y=n+w,E=a+M;for(let t=u+18;ut){const r=this.frames[e],i=this.frames[e+s];return i+(t-r)/(a[n]-r)*(a[n+1]-i)}const r=n+18;for(n+=2;n=t){const e=a[n-2],s=a[n-1];return s+(t-e)/(a[n]-e)*(a[n+1]-s)}e+=this.getFrameEntries();const i=a[r-2],o=a[r-1];return o+(t-i)/(this.frames[e]-i)*(this.frames[e+s]-o)}}class Gt extends Ht{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){const e=this.frames;let s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}const n=this.curves[s>>1];switch(n){case 0:const n=e[s],a=e[s+1];return a+(t-n)/(e[s+2]-n)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,n-2)}}class Kt extends Ht{constructor(t,e,s,n){super(t,e,[s,n])}getFrameEntries(){return 3}setFrame(t,e,s,n){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n}}class Zt extends Gt{constructor(t,e,s){super(t,e,`0|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,n,a,i,o){const l=t.bones[this.boneIndex];if(!l.active)return;if(s>2];switch(g){case 0:const t=h[f];d=h[f+1],u=h[f+2],m=h[f+3];const e=(s-t)/(h[f+4]-t);d+=(h[f+4+1]-d)*e,u+=(h[f+4+2]-u)*e,m+=(h[f+4+3]-m)*e;break;case 1:d=h[f+1],u=h[f+2],m=h[f+3];break;default:d=this.getBezierValue(s,f,1,g-2),u=this.getBezierValue(s,f,2,g+18-2),m=this.getBezierValue(s,f,3,g+36-2)}if(1==a)c.r=d,c.g=u,c.b=m;else{if(i==r.bq.setup){const t=l.data.color;c.r=t.r,c.g=t.g,c.b=t.b}c.r+=(d-c.r)*a,c.g+=(u-c.g)*a,c.b+=(m-c.b)*a}}}class de extends Gt{constructor(t,e,s){super(t,e,`8|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,n,a,i,o){const l=t.slots[this.slotIndex];if(!l.bone.active)return;const h=l.color;if(s>3];switch(M){case 0:const t=h[w];u=h[w+1],m=h[w+2],f=h[w+3],g=h[w+4],p=h[w+5],x=h[w+6],b=h[w+7];const e=(s-t)/(h[w+8]-t);u+=(h[w+8+1]-u)*e,m+=(h[w+8+2]-m)*e,f+=(h[w+8+3]-f)*e,g+=(h[w+8+4]-g)*e,p+=(h[w+8+5]-p)*e,x+=(h[w+8+6]-x)*e,b+=(h[w+8+7]-b)*e;break;case 1:u=h[w+1],m=h[w+2],f=h[w+3],g=h[w+4],p=h[w+5],x=h[w+6],b=h[w+7];break;default:u=this.getBezierValue(s,w,1,M-2),m=this.getBezierValue(s,w,2,M+18-2),f=this.getBezierValue(s,w,3,M+36-2),g=this.getBezierValue(s,w,4,M+54-2),p=this.getBezierValue(s,w,5,M+72-2),x=this.getBezierValue(s,w,6,M+90-2),b=this.getBezierValue(s,w,7,M+108-2)}if(1==a)c.set(u,m,f,g),d.r=p,d.g=x,d.b=b;else{if(i==r.bq.setup){c.setFromColor(l.data.color);const t=l.data.darkColor;d.r=t.r,d.g=t.g,d.b=t.b}c.add((u-c.r)*a,(m-c.g)*a,(f-c.b)*a,(g-c.a)*a),d.r+=(p-d.r)*a,d.g+=(x-d.g)*a,d.b+=(b-d.b)*a}}}class me extends Ht{constructor(t,e,s){super(t,e,[`7|${s}`,`9|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,n,a,r,i,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=a,this.frames[t+4]=r,this.frames[t+5]=i,this.frames[t+6]=o}apply(t,e,s,n,a,i,o){const l=t.slots[this.slotIndex];if(!l.bone.active)return;const h=this.frames,c=l.color,d=l.darkColor;if(st){const a=this.frames[e];return s[n+1]*(t-a)/(s[n]-a)}const a=n+18;for(n+=2;n=t){const e=s[n-2],a=s[n-1];return a+(t-e)/(s[n]-e)*(s[n+1]-a)}const r=s[a-2],i=s[a-1];return i+(1-i)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,n,a,i,o){const l=t.slots[this.slotIndex];if(!l.bone.active)return;const h=l.getAttachment();if(!h)return;if(!(h instanceof qt)||h.timelineAttachment!=this.attachment)return;const c=l.deform;0==c.length&&(i=r.bq.setup);const d=this.vertices,u=d[0].length,m=this.frames;if(s=m[m.length-1]){const t=d[m.length-1];if(1==a)if(i==r.bq.add){const e=h;if(e.bones)for(let e=0;es)this.apply(t,e,Number.MAX_VALUE,n,a,r,i),e=-1;else if(e>=o[l-1])return;if(s0&&o[h-1]==t;)h--}for(;h=o[h];h++)n.push(this.events[h])}};let xe=pe;xe.propertyIds=["12"];const be=class extends Jt{constructor(t){super(t,be.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,n,a,i,o){if(o==r.mJ.mixOut)return void(i==r.bq.setup&&r.cQ.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s>2];switch(f){case 0:const t=h[m];c=h[m+1],d=h[m+2],u=h[m+3];const e=(s-t)/(h[m+4]-t);c+=(h[m+4+1]-c)*e,d+=(h[m+4+2]-d)*e,u+=(h[m+4+3]-u)*e;break;case 1:c=h[m+1],d=h[m+2],u=h[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(i==r.bq.setup){const t=l.data;l.mixRotate=t.mixRotate+(c-t.mixRotate)*a,l.mixX=t.mixX+(d-t.mixX)*a,l.mixY=t.mixY+(u-t.mixY)*a}else l.mixRotate+=(c-l.mixRotate)*a,l.mixX+=(d-l.mixX)*a,l.mixY+=(u-l.mixY)*a}}const Ae=class extends Jt{constructor(t,e,s){super(t,[`19|${e}|${s.sequence.id}`]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return Ae.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,n,a){const r=this.frames;r[t*=Ae.ENTRIES]=e,r[t+Ae.MODE]=s|n<<4,r[t+Ae.DELAY]=a}apply(t,e,s,n,a,i,o){const l=t.slots[this.slotIndex];if(!l.bone.active)return;const h=l.attachment,c=this.attachment;if(!(h==c||h instanceof qt&&h.timelineAttachment==c))return;const d=this.frames;if(s>4;const x=this.attachment.sequence.regions.length,b=zt[15&f];if(b!=Ut.hold)switch(p+=(s-m)/g+1e-5|0,b){case Ut.once:p=Math.min(x-1,p);break;case Ut.loop:p%=x;break;case Ut.pingpong:{const t=(x<<1)-2;p=0==t?0:p%t,p>=x&&(p=t-p);break}case Ut.onceReverse:p=Math.max(x-1-p,0);break;case Ut.loopReverse:p=x-1-p%x;break;case Ut.pingpongReverse:{const t=(x<<1)-2;p=0==t?0:(p+x-1)%t,p>=x&&(p=t-p)}}l.sequenceIndex=p}};let Ie=Ae;Ie.ENTRIES=3,Ie.MODE=1,Ie.DELAY=2;const Te=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Ye(this),this.propertyIDs=new r.PA,this.animationsChanged=!1,this.trackEntryPool=new r.Kg((()=>new ve)),this.data=t}static emptyAnimation(){return Te._emptyAnimation}update(t){t*=this.timeScale;const e=this.tracks;for(let s=0,n=e.length;s0){if(n.delay-=a,n.delay>0)continue;a=-n.delay,n.delay=0}let r=n.next;if(r){const e=n.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime+=0==n.timeScale?0:(e/n.timeScale+t)*r.timeScale,n.trackTime+=a,this.setCurrent(s,r,!0);r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){e[s]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,t)){let t=n.mixingFrom;for(n.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}n.trackTime+=a}this.queue.drain()}updateMixingFrom(t,e){const s=t.mixingFrom;if(!s)return!0;const n=this.updateMixingFrom(s,e);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=s.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),n):(s.trackTime+=e*s.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const e=this.events,s=this.tracks;let n=!1;for(let a=0,i=s.length;a0)continue;n=!0;const o=0==a?r.bq.first:i.mixBlend;let l=i.alpha;i.mixingFrom?l*=this.applyMixingFrom(i,t,o):i.trackTime>=i.trackEnd&&!i.next&&(l=0);const h=i.animationLast,c=i.getAnimationTime();let d=c,u=e;i.reverse&&(d=i.animation.duration-d,u=null);const m=i.animation.timelines,f=m.length;if(0==a&&1==l||o==r.bq.add)for(let e=0;e1&&(a=1),s!=r.bq.first&&(s=n.mixBlend));const i=a0&&this.queueEvents(n,m),this.events.length=0,n.nextAnimationLast=m,n.nextTrackLast=n.trackTime,a}applyAttachmentTimeline(t,e,s,n,a){const i=e.slots[t.slotIndex];i.bone.active&&(s0;let n=t>=0;r.M8.signum(e)!=r.M8.signum(m)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*r.M8.signum(t)),n=s),u=m+t-t%360,n!=s&&(u+=360*r.M8.signum(t)),i[o]=u}i[o+1]=m,h.rotation=c+u*n}queueEvents(t,e){const s=t.animationStart,n=t.animationEnd,a=n-s,r=t.trackLast%a,i=this.events;let o=0;const l=i.length;for(;on||this.queue.event(t,e)}let h=!1;for(h=t.loop?0==a||r>t.trackTime%a:e>=n&&t.animationLast=this.tracks.length)return;const e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){const t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){const n=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,n&&(s&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){const n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,n,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let n=!0,a=this.expandToIndex(t);a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,n=!1):this.clearNext(a));const r=this.trackEntry(t,e,s,a);return this.setCurrent(t,r,n),this.queue.drain(),r}addAnimation(t,e,s=!1,n=0){const a=this.data.skeletonData.findAnimation(e);if(!a)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,a,s,n)}addAnimationWith(t,e,s=!1,n=0){if(!e)throw new Error("animation cannot be null.");let a=this.expandToIndex(t);if(a)for(;a.next;)a=a.next;const r=this.trackEntry(t,e,s,a);return a?(a.next=r,r.previous=a,n<=0&&(n+=a.getTrackComplete()-r.mixDuration)):(this.setCurrent(t,r,!0),this.queue.drain()),r.delay=n,r}setEmptyAnimation(t,e=0){const s=this.setAnimationWith(t,Te.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){const n=this.addAnimationWith(t,Te.emptyAnimation(),!1,s);return s<=0&&(n.delay+=n.mixDuration-e),n.mixDuration=e,n.trackEnd=e,n}setEmptyAnimations(t=0){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e0){a[o]=Be,r[o]=s;continue t}break}a[o]=De}else a[o]=Pe}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(t,e,s){Te.deprecatedWarning1||(Te.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,s)}addAnimationByName(t,e,s,n){Te.deprecatedWarning2||(Te.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,s,n)}hasAnimation(t){return null!==this.data.skeletonData.findAnimation(t)}hasAnimationByName(t){return Te.deprecatedWarning3||(Te.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let Re=Te;Re._emptyAnimation=new jt("",[],0),Re.deprecatedWarning1=!1,Re.deprecatedWarning2=!1,Re.deprecatedWarning3=!1;const Ce=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.attachmentThreshold=0,this.drawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this.mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=r.bq.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.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){const t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(Ve||{});class Fe{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const Pe=0,Xe=1,qe=2,De=3,Be=4,Ne=1,Le=2;class We{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);const a=this.skeletonData.findAnimation(e);if(!a)throw new Error(`Animation not found: ${e}`);this.setMixWith(n,a,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const n=`${t.name}.${e.name}`;this.animationToMixTime[n]=s}getMix(t,e){const s=`${t.name}.${e.name}`,n=this.animationToMixTime[s];return void 0===n?this.defaultMix:n}}class Oe{constructor(t){this.atlas=t}loadSequence(t,e,s){const n=s.regions;for(let a=0,r=n.length;a1e-4?(t=Math.abs(u*g-m*f)/t,u/=c,f/=d,m=f*t,g=u*t,e=Math.atan2(f,u)*r.M8.radDeg):(u=0,f=0,e=90-Math.atan2(g,m)*r.M8.radDeg);const l=s+i-e,p=s+o-e+90,x=r.M8.cosDeg(l)*n,b=r.M8.cosDeg(p)*a,w=r.M8.sinDeg(l)*n,M=r.M8.sinDeg(p)*a;h.a=u*x-m*w,h.c=u*b-m*M,h.b=f*x+g*w,h.d=f*b+g*M;break}case r.Qe.NoScale:case r.Qe.NoScaleOrReflection:{const t=r.M8.cosDeg(s),e=r.M8.sinDeg(s);let l=(u*t+m*e)/c,p=(f*t+g*e)/d,x=Math.sqrt(l*l+p*p);x>1e-5&&(x=1/x),l*=x,p*=x,x=Math.sqrt(l*l+p*p),this.data.transformMode==r.Qe.NoScale&&u*g-m*f<0!=(c<0!=d<0)&&(x=-x);const b=Math.PI/2+Math.atan2(p,l),w=Math.cos(b)*x,M=Math.sin(b)*x,y=r.M8.cosDeg(i)*n,E=r.M8.cosDeg(90+o)*a,S=r.M8.sinDeg(i)*n,k=r.M8.sinDeg(90+o)*a;h.a=l*y+w*S,h.c=l*E+w*k,h.b=p*y+M*S,h.d=p*E+M*k;break}}h.a*=c,h.c*=c,h.b*=d,h.d*=d}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.M8.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*r.M8.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.b*t.b)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.c*t.c+t.d*t.d)}updateAppliedTransform(){const t=this.parent,e=this.matrix;if(!t)return this.ax=e.tx-this.skeleton.x,this.ay=e.ty-this.skeleton.y,this.arotation=Math.atan2(e.b,e.a)*r.M8.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,void(this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*r.M8.radDeg);const s=t.matrix,n=1/(s.a*s.d-s.b*s.c),a=e.tx-s.tx,i=e.ty-s.ty;this.ax=a*s.d*n-i*s.c*n,this.ay=i*s.a*n-a*s.b*n;const o=n*s.d,l=n*s.a,h=n*s.c,c=n*s.b,d=o*e.a-h*e.b,u=o*e.c-h*e.d,m=l*e.b-c*e.a,f=l*e.d-c*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){const t=d*f-u*m;this.ascaleY=t/this.ascaleX,this.ashearY=Math.atan2(d*u+m*f,t)*r.M8.radDeg,this.arotation=Math.atan2(m,d)*r.M8.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+f*f),this.ashearY=0,this.arotation=90-Math.atan2(f,u)*r.M8.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,n=e.c,a=e.b,r=e.d,i=1/(s*r-n*a),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*r*i-l*n*i,t.y=l*s*i-o*a*i,t}localToWorld(t){const e=this.matrix,s=t.x,n=t.y;return t.x=s*e.a+n*e.c+e.tx,t.y=s*e.b+n*e.d+e.ty,t}worldToLocalRotation(t){const e=r.M8.sinDeg(t),s=r.M8.cosDeg(t),n=this.matrix;return Math.atan2(n.a*e-n.b*s,n.d*s-n.c*e)*r.M8.radDeg}localToWorldRotation(t){t-=this.rotation-this.shearX;const e=r.M8.sinDeg(t),s=r.M8.cosDeg(t),n=this.matrix;return Math.atan2(s*n.b+e*n.d,s*n.a+e*n.c)*r.M8.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,n=e.c,a=e.b,i=e.d,o=r.M8.cosDeg(t),l=r.M8.sinDeg(t);e.a=o*s-l*a,e.c=o*n-l*i,e.b=l*s+o*a,e.d=l*n+o*i}}class $e{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=r.Qe.Normal,this.skinRequired=!1,this.color=new r.Il,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}}class Qe{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}class Ue{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class ze{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class je{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s180?m-=360:m<-180&&(m+=360);let b=t.ascaleX,w=t.ascaleY;if(n||a){switch(t.data.transformMode){case r.Qe.NoScale:case r.Qe.NoScaleOrReflection:f=e-t.worldX,g=s-t.worldY}const l=t.data.length*b,h=Math.sqrt(f*f+g*g);if(n&&hl&&l>1e-4){const t=(h/l-1)*o+1;b*=t,i&&(w*=t)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*o,b,w,t.ashearX,t.ashearY)}apply2(t,e,s,n,a,i,o,l,h){const c=t.ax,d=t.ay;let u=t.ascaleX,m=t.ascaleY,f=u,g=m,p=e.ascaleX;const x=t.matrix;let b=0,w=0,M=0;u<0?(u=-u,b=180,M=-1):(b=0,M=1),m<0&&(m=-m,M=-M),p<0?(p=-p,w=180):w=0;const y=e.ax;let E=0,S=0,k=0,A=x.a,I=x.c,T=x.b,R=x.d;const C=Math.abs(u-m)<=1e-4;!C||i?(E=0,S=A*y+x.tx,k=T*y+x.ty):(E=e.ay,S=A*y+I*E+x.tx,k=T*y+R*E+x.ty);const v=t.parent.matrix;if(!v)throw new Error("IK parent must itself have a parent.");A=v.a,I=v.c,T=v.b,R=v.d;const Y=1/(A*R-I*T);let V=S-v.tx,F=k-v.ty;const P=(V*R-F*I)*Y-c,X=(F*A-V*T)*Y-d,q=Math.sqrt(P*P+X*X);let D,B,N=e.data.length*p;if(q<1e-4)return this.apply1(t,s,n,!1,i,!1,h),void e.updateWorldTransformWith(y,E,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);V=s-v.tx,F=n-v.ty;let L=(V*R-F*I)*Y-c,W=(F*A-V*T)*Y-d,O=L*L+W*W;if(0!=l){l*=u*(p+1)*.5;const t=Math.sqrt(O),e=t-q-N*u+l;if(e>0){let s=Math.min(1,e/(2*l))-1;s=(e-l*(1-s*s))/t,L-=s*L,W-=s*W,O=L*L+W*W}}t:if(C){N*=u;let t=(O-q*q-N*N)/(2*q*N);t<-1?(t=-1,B=Math.PI*a):t>1?(t=1,B=0,i&&(A=(Math.sqrt(O)/(q+N)-1)*h+1,f*=A,o&&(g*=A))):B=Math.acos(t)*a,A=q+N*t,I=N*Math.sin(B),D=Math.atan2(W*A-L*I,L*A+W*I)}else{A=u*N,I=m*N;const t=A*A,e=I*I,s=Math.atan2(W,L);T=e*q*q+t*O-t*e;const n=-2*e*q,i=e-t;if(R=n*n-4*i*T,R>=0){let t=Math.sqrt(R);n<0&&(t=-t),t=.5*-(n+t);const e=t/i,r=T/t,o=Math.abs(e)=-1&&T<=1&&(T=Math.acos(T),V=A*Math.cos(T)+q,F=I*Math.sin(T),R=V*V+F*F,Rg&&(d=T,g=R,f=V,p=F)),O<=.5*(h+g)?(D=s-Math.atan2(c*a,l),B=o*a):(D=s-Math.atan2(p*a,f),B=d*a)}const _=Math.atan2(E,y)*M;let $=t.arotation;D=(D-_)*r.M8.radDeg+b-$,D>180?D-=360:D<-180&&(D+=360),t.updateWorldTransformWith(c,d,$+D*h,f,g,0,0),$=e.arotation,B=((B+_)*r.M8.radDeg-e.ashearX)*M+w-$,B>180?B-=360:B<-180&&(B+=360),e.updateWorldTransformWith(y,E,$+B*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class Je extends Qe{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class He extends Qe{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=r.T.Fixed,this.spacingMode=Ge.Fixed,this.rotateMode=r.YK.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Ge=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Ge||{});const Ke=class{constructor(t,e){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,n=t.bones.length;s0){t=c/t*m;for(let e=1;e0?r.M8.degRad:-r.M8.degRad}for(let t=0,a=3;t0){const s=c.a,n=c.c,o=c.b,l=c.d;let u=0,m=0,w=0;if(u=i?f[a-1]:0==d[t+1]?f[a+2]:Math.atan2(y,M),u-=Math.atan2(o,s),b){m=Math.cos(u),w=Math.sin(u);const t=h.data.length;g+=(t*(m*s-w*o)-M)*e,p+=(t*(w*s+m*o)-y)*e}else u+=x;u>r.M8.PI?u-=r.M8.PI2:u<-r.M8.PI&&(u+=r.M8.PI2),u*=e,m=Math.cos(u),w=Math.sin(u),c.a=m*s-w*o,c.c=m*n-w*l,c.b=w*s+m*o,c.d=w*n+m*l}h.updateAppliedTransform()}}computeWorldPositions(t,e,s){const n=this.target;let a=this.position;const i=this.spaces,o=r.cQ.setArraySize(this.positions,3*e+2);let l=this.world;const h=t.closed;let c=t.worldVerticesLength,d=c/6,u=Ke.NONE;if(!t.constantSpeed){const m=t.lengths;d-=h?1:2;const f=m[d];let g;switch(this.data.positionMode==r.T.Percent&&(a*=f),this.data.spacingMode){case Ge.Percent:g=f;break;case Ge.Proportional:g=f/e;break;default:g=1}l=r.cQ.setArraySize(this.world,8);for(let r=0,p=0,x=0;rf){u!=Ke.AFTER&&(u=Ke.AFTER,t.computeWorldVertices(n,c-6,4,l,0,2)),this.addAfterPosition(b-f,l,0,o,p);continue}}for(;;x++){const t=m[x];if(!(b>t)){if(0==x)b/=t;else{const e=m[x-1];b=(b-e)/(t-e)}break}}x!=u&&(u=x,h&&x==d?(t.computeWorldVertices(n,c-4,4,l,0,2),t.computeWorldVertices(n,0,4,l,4,2)):t.computeWorldVertices(n,6*x+2,8,l,0,2)),this.addCurvePosition(b,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],o,p,s||r>0&&0==e)}return o}h?(c+=2,l=r.cQ.setArraySize(this.world,c),t.computeWorldVertices(n,2,c-4,l,0,2),t.computeWorldVertices(n,0,2,l,c-4,2),l[c-2]=l[0],l[c-1]=l[1]):(d--,c-=4,l=r.cQ.setArraySize(this.world,c),t.computeWorldVertices(n,2,c,l,0,2));const m=r.cQ.setArraySize(this.curves,d);let f,g=0,p=l[0],x=l[1],b=0,w=0,M=0,y=0,E=0,S=0,k=0,A=0,I=0,T=0,R=0,C=0,v=0,Y=0;for(let t=0,e=2;tg){this.addAfterPosition(P-g,l,c-4,o,n);continue}}for(;;r++){const t=m[r];if(!(P>t)){if(0==r)P/=t;else{const e=m[r-1];P=(P-e)/(t-e)}break}}if(r!=u){u=r;let t=6*r;for(p=l[t],x=l[t+1],b=l[t+2],w=l[t+3],M=l[t+4],y=l[t+5],E=l[t+6],S=l[t+7],k=.03*(p-2*b+M),A=.03*(x-2*w+y),I=.006*(3*(b-M)-p+E),T=.006*(3*(w-y)-x+S),R=2*k+I,C=2*A+T,v=.3*(b-p)+k+.16666667*I,Y=.3*(w-x)+A+.16666667*T,F=Math.sqrt(v*v+Y*Y),V[0]=F,t=1;t<8;t++)v+=R,Y+=C,R+=I,C+=T,F+=Math.sqrt(v*v+Y*Y),V[t]=F;v+=R,Y+=C,F+=Math.sqrt(v*v+Y*Y),V[8]=F,v+=R+I,Y+=C+T,F+=Math.sqrt(v*v+Y*Y),V[9]=F,d=0}for(P*=F;;d++){const t=V[d];if(!(P>t)){if(0==d)P/=t;else{const e=V[d-1];P=d+(P-e)/(t-e)}break}}this.addCurvePosition(.1*P,p,x,b,w,M,y,E,S,o,n,s||t>0&&0==e)}return o}addBeforePosition(t,e,s,n,a){const r=e[s],i=e[s+1],o=e[s+2]-r,l=e[s+3]-i,h=Math.atan2(l,o);n[a]=r+t*Math.cos(h),n[a+1]=i+t*Math.sin(h),n[a+2]=h}addAfterPosition(t,e,s,n,a){const r=e[s+2],i=e[s+3],o=r-e[s],l=i-e[s+1],h=Math.atan2(l,o);n[a]=r+t*Math.cos(h),n[a+1]=i+t*Math.sin(h),n[a+2]=h}addCurvePosition(t,e,s,n,a,r,i,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(a-s,n-e));const u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,b=3*x,w=f*b,M=b*t,y=e*p+n*w+r*M+o*m,E=s*p+a*w+i*M+l*m;h[c]=y,h[c+1]=E,d&&(h[c+2]=t<.001?Math.atan2(a-s,n-e):Math.atan2(E-(s*g+a*x*2+i*u),y-(e*g+n*x*2+r*u)))}};let Ze=Ke;Ze.NONE=-1,Ze.BEFORE=-2,Ze.AFTER=-3,Ze.epsilon=1e-5;class ts{constructor(t,e){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new r.Il,this.darkColor=t.darkColor?new r.Il:null,this.setToSetupPose(),this.blendMode=this.data.blendMode}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof qt&&this.attachment instanceof qt&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}class es{constructor(t,e){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new r.FM,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY,this.bones=new Array;for(let s=0;s0?r.M8.degRad:-r.M8.degRad,g=this.data.offsetRotation*f,p=this.data.offsetShearY*f,x=this.bones;for(let h=0,f=x.length;hr.M8.PI?i-=r.M8.PI2:i<-r.M8.PI&&(i+=r.M8.PI2),i*=t;const o=Math.cos(i),l=Math.sin(i);b.a=o*e-l*n,b.c=o*s-l*a,b.b=l*e+o*n,b.d=l*s+o*a}if(o){const t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),b.tx+=(t.x-b.tx)*e,b.ty+=(t.y-b.ty)*s}if(0!=n){let t=Math.sqrt(b.a*b.a+b.b*b.b);0!=t&&(t=(t+(Math.sqrt(c*c+u*u)-t+this.data.offsetScaleX)*n)/t),b.a*=t,b.b*=t}if(0!=a){let t=Math.sqrt(b.c*b.c+b.d*b.d);0!=t&&(t=(t+(Math.sqrt(d*d+m*m)-t+this.data.offsetScaleY)*a)/t),b.c*=t,b.d*=t}if(i>0){const t=b.c,e=b.d,s=Math.atan2(e,t);let n=Math.atan2(m,d)-Math.atan2(u,c)-(s-Math.atan2(b.b,b.a));n>r.M8.PI?n-=r.M8.PI2:n<-r.M8.PI&&(n+=r.M8.PI2),n=s+(n+p)*i;const a=Math.sqrt(t*t+e*e);b.c=Math.cos(n)*a,b.d=Math.sin(n)*a}f.updateAppliedTransform()}}applyRelativeWorld(){const t=this.mixRotate,e=this.mixX,s=this.mixY,n=this.mixScaleX,a=this.mixScaleY,i=this.mixShearY,o=0!=e||0!=s,l=this.target,h=l.matrix,c=h.a,d=h.c,u=h.b,m=h.d,f=c*m-d*u>0?r.M8.degRad:-r.M8.degRad,g=this.data.offsetRotation*f,p=this.data.offsetShearY*f,x=this.bones;for(let h=0,f=x.length;hr.M8.PI?i-=r.M8.PI2:i<-r.M8.PI&&(i+=r.M8.PI2),i*=t;const o=Math.cos(i),l=Math.sin(i);b.a=o*e-l*n,b.c=o*s-l*a,b.b=l*e+o*n,b.d=l*s+o*a}if(o){const t=this.temp;l.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),b.tx+=t.x*e,b.ty+=t.y*s}if(0!=n){const t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleX)*n+1;b.a*=t,b.b*=t}if(0!=a){const t=(Math.sqrt(d*d+m*m)-1+this.data.offsetScaleY)*a+1;b.c*=t,b.d*=t}if(i>0){let t=Math.atan2(m,d)-Math.atan2(u,c);t>r.M8.PI?t-=r.M8.PI2:t<-r.M8.PI&&(t+=r.M8.PI2);const e=b.c,s=b.d;t=Math.atan2(s,e)+(t-r.M8.PI/2+p)*i;const n=Math.sqrt(e*e+s*s);b.c=Math.cos(t)*n,b.d=Math.sin(t)*n}f.updateAppliedTransform()}}applyAbsoluteLocal(){const t=this.mixRotate,e=this.mixX,s=this.mixY,n=this.mixScaleX,a=this.mixScaleY,r=this.mixShearY,i=this.target,o=this.bones;for(let l=0,h=o.length;l= 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}}class is extends Qe{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class os{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class ls{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}addSkin(t){for(let e=0;e>4,t.readFloat())}n.push(e);break}}}}}const i=t.readInt(!0);if(i>0){const e=new we(i),a=s.slots.length;for(let s=0;s=0;t--)o[t]=-1;const l=r.cQ.newArray(a-i,0);let h=0,c=0;for(let e=0;e=0;t--)-1==o[t]&&(o[t]=l[--c]);e.setFrame(s,n,o)}n.push(e)}const o=t.readInt(!0);if(o>0){const e=new xe(o);for(let n=0;n=0;e--)-1==l[e]&&(l[e]=t[--a])}e.setFrame(i,$s(o,"time",0),l)}a.push(e)}if(t.events){const e=new xe(t.events.length);let n=0;for(let a=0;a(t[t.UNKNOWN=0]="UNKNOWN",t[t.VER37=37]="VER37",t[t.VER38=38]="VER38",t[t.VER40=40]="VER40",t[t.VER41=41]="VER41",t))(Us||{});function zs(t){const e=t.substr(0,3),s=Math.floor(10*Number(e)+.001);return"3.7"===e?37:"3.8"===e?38:"4.0"===e?40:"4.1"===e?41:s<37?37:0}class js{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,n=this.readVersionOldFormat(e),a=zs(n);if(a===Us.VER38&&(s=new u.SkeletonBinary(new u.AtlasAttachmentLoader(t))),n=this.readVersionNewFormat(e),a=zs(n),a!==Us.VER40&&a!==Us.VER41||(s=new hs(new Oe(t))),!s){const t=`Unsupported version of spine model ${n}, please update pixi-spine`;console.error(t)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new r.YT(t);let s;try{e.readString(),s=e.readString()}catch(t){s=""}return s||""}readVersionNewFormat(t){const e=new r.YT(t);let s;e.readInt32(),e.readInt32();try{s=e.readString()}catch(t){s=""}return s||""}}class Js{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,n=zs(s);let a=null;if(n===Us.VER37&&(a=new Yt(new ut(t))),n===Us.VER38&&(a=new u.SkeletonJson(new u.AtlasAttachmentLoader(t))),n!==Us.VER40&&n!==Us.VER41||(a=new Ns(new Oe(t))),!a){const t=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(t)}return a.scale=this.scale,a.readSkeletonData(e)}}class Hs extends r.Ww{createSkeleton(t){const e=zs(t.version);let s=null;if(e===Us.VER37&&(s=n),e===Us.VER38&&(s=m),e!==Us.VER40&&e!==Us.VER41||(s=a),!s){const e=`Cant detect version of spine model ${t.version}`;console.error(e)}this.skeleton=new s.Skeleton(t),this.skeleton.updateWorldTransform(),this.stateData=new s.AnimationStateData(t),this.state=new s.AnimationState(this.stateData)}}(new class extends d{createBinaryParser(){return new js}createJsonParser(){return new Js}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}).installLoader()}}]);