"use strict";(self.webpackChunktotem=self.webpackChunktotem||[]).push([[808],{5808:(t,e,n)=>{n.r(e),n.d(e,{AttachmentType:()=>i,BinaryInput:()=>o,Color:()=>k,DebugUtils:()=>N,IntSet:()=>A,Interpolation:()=>V,MathUtils:()=>C,MixBlend:()=>l,MixDirection:()=>h,Pool:()=>X,PositionMode:()=>c,Pow:()=>v,PowOut:()=>P,RotateMode:()=>d,SkeletonBounds:()=>tr,SkeletonBoundsBase:()=>_,Spine:()=>ur,SpineBase:()=>Z,SpineDebugRenderer:()=>K,SpineMesh:()=>G,SpineSprite:()=>z,StringSet:()=>T,TextureAtlas:()=>E,TextureAtlasPage:()=>S,TextureAtlasRegion:()=>M,TextureFilter:()=>p,TextureRegion:()=>w,TextureWrap:()=>x,TimeKeeper:()=>B,TransformMode:()=>u,Utils:()=>Y,Vector2:()=>D,WindowedMean:()=>L,filterFromString:()=>f,settings:()=>O,wrapFromString:()=>g});var s={};n.r(s),n.d(s,{Animation:()=>xt,AnimationState:()=>Ht,AnimationStateAdapter:()=>Qt,AnimationStateData:()=>te,AtlasAttachmentLoader:()=>ee,Attachment:()=>st,AttachmentTimeline:()=>vt,Bone:()=>ne,BoneData:()=>se,BoundingBoxAttachment:()=>it,ClippingAttachment:()=>ot,ColorTimeline:()=>Rt,ConstraintData:()=>ae,CurveTimeline:()=>Et,DeformTimeline:()=>Ft,DrawOrderTimeline:()=>Nt,Event:()=>re,EventData:()=>ie,EventQueue:()=>Zt,EventTimeline:()=>Yt,EventType:()=>Kt,IkConstraint:()=>oe,IkConstraintData:()=>le,IkConstraintTimeline:()=>Dt,JitterEffect:()=>ft,MeshAttachment:()=>lt,PathAttachment:()=>ht,PathConstraint:()=>ue,PathConstraintData:()=>he,PathConstraintMixTimeline:()=>$t,PathConstraintPositionTimeline:()=>Ot,PathConstraintSpacingTimeline:()=>Wt,PointAttachment:()=>ct,RegionAttachment:()=>mt,RotateTimeline:()=>St,ScaleTimeline:()=>Tt,ShearTimeline:()=>It,Skeleton:()=>ge,SkeletonBinary:()=>Se,SkeletonBounds:()=>Te,SkeletonData:()=>pe,SkeletonJson:()=>Ie,Skin:()=>Ee,SkinEntry:()=>be,Slot:()=>dt,SlotData:()=>xe,SpacingMode:()=>ce,Spine:()=>Re,SwirlEffect:()=>pt,TimelineType:()=>wt,TrackEntry:()=>Gt,TransformConstraint:()=>me,TransformConstraintData:()=>we,TransformConstraintTimeline:()=>Lt,TranslateTimeline:()=>At,TwoColorTimeline:()=>Vt,VertexAttachment:()=>rt});var a={};n.r(a),n.d(a,{Animation:()=>qe,AnimationState:()=>bn,AnimationStateAdapter2:()=>Tn,AnimationStateData:()=>kn,AtlasAttachmentLoader:()=>Rn,Attachment:()=>Ce,AttachmentTimeline:()=>sn,Bone:()=>Cn,BoneData:()=>Vn,BoundingBoxAttachment:()=>Pe,ClippingAttachment:()=>Fe,ColorTimeline:()=>tn,CurveTimeline:()=>He,DeformTimeline:()=>rn,DrawOrderTimeline:()=>ln,Event:()=>vn,EventData:()=>Pn,EventQueue:()=>Mn,EventTimeline:()=>on,EventType:()=>An,IkConstraint:()=>Fn,IkConstraintData:()=>Yn,IkConstraintTimeline:()=>cn,JitterEffect:()=>_e,MeshAttachment:()=>Ye,PathAttachment:()=>Ne,PathConstraint:()=>Bn,PathConstraintData:()=>Nn,PathConstraintMixTimeline:()=>xn,PathConstraintPositionTimeline:()=>fn,PathConstraintSpacingTimeline:()=>gn,PointAttachment:()=>Xe,RegionAttachment:()=>Le,RotateTimeline:()=>Ge,ScaleTimeline:()=>Ke,ShearTimeline:()=>Qe,Skeleton:()=>On,SkeletonBounds:()=>Wn,SkeletonData:()=>qn,SkeletonJson:()=>zn,Skin:()=>Hn,Slot:()=>De,SlotData:()=>$n,SpacingMode:()=>Xn,Spine:()=>jn,SwirlEffect:()=>We,TimelineType:()=>$e,TrackEntry:()=>yn,TransformConstraint:()=>Ln,TransformConstraintData:()=>Un,TransformConstraintTimeline:()=>un,TranslateTimeline:()=>Ze,TwoColorTimeline:()=>nn,VertexAttachment:()=>ve});var r={};n.r(r),n.d(r,{AlphaTimeline:()=>ks,Animation:()=>cs,AnimationState:()=>$s,AnimationStateAdapter:()=>js,AnimationStateData:()=>sa,AtlasAttachmentLoader:()=>aa,Attachment:()=>Zn,AttachmentTimeline:()=>Vs,Bone:()=>ra,BoneData:()=>ia,BoundingBoxAttachment:()=>Jn,ClippingAttachment:()=>ts,ConstraintData:()=>oa,CurveTimeline:()=>us,CurveTimeline1:()=>ms,CurveTimeline2:()=>fs,DeformTimeline:()=>vs,DrawOrderTimeline:()=>Ns,Event:()=>la,EventData:()=>ha,EventQueue:()=>zs,EventTimeline:()=>Fs,EventType:()=>Gs,IkConstraint:()=>ca,IkConstraintData:()=>da,IkConstraintTimeline:()=>Xs,MeshAttachment:()=>es,PathAttachment:()=>ns,PathConstraint:()=>ga,PathConstraintData:()=>ua,PathConstraintMixTimeline:()=>_s,PathConstraintPositionTimeline:()=>Bs,PathConstraintSpacingTimeline:()=>Ls,PointAttachment:()=>ss,RGB2Timeline:()=>Cs,RGBA2Timeline:()=>Rs,RGBATimeline:()=>Ts,RGBTimeline:()=>Is,RegionAttachment:()=>rs,RotateTimeline:()=>gs,ScaleTimeline:()=>bs,ScaleXTimeline:()=>Es,ScaleYTimeline:()=>ys,Sequence:()=>os,SequenceMode:()=>ls,SequenceModeValues:()=>hs,SequenceTimeline:()=>Ws,ShearTimeline:()=>Ss,ShearXTimeline:()=>Ms,ShearYTimeline:()=>As,Skeleton:()=>ba,SkeletonBinary:()=>Ta,SkeletonBounds:()=>tr,SkeletonData:()=>Ea,SkeletonJson:()=>er,Skin:()=>Aa,SkinEntry:()=>Ma,Slot:()=>pa,SlotData:()=>ya,SpacingMode:()=>ma,Spine:()=>or,Timeline:()=>ds,TrackEntry:()=>Hs,TransformConstraint:()=>xa,TransformConstraintData:()=>Sa,TransformConstraintTimeline:()=>Ds,TranslateTimeline:()=>ps,TranslateXTimeline:()=>xs,TranslateYTimeline:()=>ws,VertexAttachment:()=>Qn});var i=(t=>(t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping",t))(i||{});class o{constructor(t,e=new Array,n=0,s=new DataView(t.buffer)){this.strings=e,this.index=n,this.buffer=s}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),n=127&e;return 0!=(128&e)&&(e=this.readByte(),n|=(127&e)<<7,0!=(128&e)&&(e=this.readByte(),n|=(127&e)<<14,0!=(128&e)&&(e=this.readByte(),n|=(127&e)<<21,0!=(128&e)&&(e=this.readByte(),n|=(127&e)<<28)))),t?n:n>>>1^-(1&n)}readStringRef(){const t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let n=0;n>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),n+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),n+=3;break;default:e+=String.fromCharCode(t),n++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}}var l=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(l||{}),h=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(h||{}),c=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(c||{}),d=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(d||{}),u=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(u||{}),m=n(6951);function f(t){switch(t.toLowerCase()){case"nearest":return p.Nearest;case"linear":return p.Linear;case"mipmap":return p.MipMap;case"mipmapnearestnearest":return p.MipMapNearestNearest;case"mipmaplinearnearest":return p.MipMapLinearNearest;case"mipmapnearestlinear":return p.MipMapNearestLinear;case"mipmaplinearlinear":return p.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${t}`)}}function g(t){switch(t.toLowerCase()){case"mirroredtepeat":return x.MirroredRepeat;case"clamptoedge":return x.ClampToEdge;case"repeat":return x.Repeat;default:throw new Error(`Unknown texture wrap ${t}`)}}var p=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(p||{}),x=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(x||{});class w{constructor(){this.size=null,this.names=null,this.values=null,this.renderObject=null}get width(){const t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){const t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture._uvs.x0}get v(){return this.texture._uvs.y0}get u2(){return this.texture._uvs.x2}get v2(){return this.texture._uvs.y2}get offsetX(){const t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){const t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){const t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return 0!==this.texture.rotate}get degrees(){return(360-45*this.texture.rotate)%360}}class b{constructor(){this.x=0,this.y=0,this.width=0,this.height=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.rotate=0,this.index=0}}class E{constructor(t,e,n){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,n)}addTexture(t,e){const n=this.pages;let s=null;for(let t=0;t{r.width=parseInt(a[1]),r.height=parseInt(a[2])},i.format=()=>{},i.filter=()=>{r.minFilter=f(a[1]),r.magFilter=f(a[2])},i.repeat=()=>{-1!=a[1].indexOf("x")&&(r.uWrap=x.Repeat),-1!=a[1].indexOf("y")&&(r.vWrap=x.Repeat)},i.pma=()=>{r.pma="true"==a[1]};const l={xy:()=>{o.x=parseInt(a[1]),o.y=parseInt(a[2])},size:()=>{o.width=parseInt(a[1]),o.height=parseInt(a[2])},bounds:()=>{o.x=parseInt(a[1]),o.y=parseInt(a[2]),o.width=parseInt(a[3]),o.height=parseInt(a[4])},offset:()=>{o.offsetX=parseInt(a[1]),o.offsetY=parseInt(a[2])},orig:()=>{o.originalWidth=parseInt(a[1]),o.originalHeight=parseInt(a[2])},offsets:()=>{o.offsetX=parseInt(a[1]),o.offsetY=parseInt(a[2]),o.originalWidth=parseInt(a[3]),o.originalHeight=parseInt(a[4])},rotate:()=>{const t=a[1];let e=0;e="true"==t.toLocaleLowerCase()?6:"false"==t.toLocaleLowerCase()?0:(720-parseFloat(t))%360/45,o.rotate=e},index:()=>{o.index=parseInt(a[1])}};let h=s.readLine();for(;null!=h&&0==h.trim().length;)h=s.readLine();for(;null!=h&&0!=h.trim().length&&0!=s.readEntry(a,h);)h=s.readLine();const c=()=>{for(;;){if(null==h)return n&&n(this);if(0==h.trim().length)r=null,h=s.readLine();else{if(null===r){for(r=new S,r.name=h.trim();0!=s.readEntry(a,h=s.readLine());){const t=i[a[0]];t&&t()}this.pages.push(r),e(r.name,(t=>{if(null===t)return this.pages.splice(this.pages.indexOf(r),1),n&&n(null);r.baseTexture=t,r.pma&&(t.alphaMode=m.iw.PMA),t.valid||t.setSize(r.width,r.height),r.setFilters(),r.width&&r.height||(r.width=t.realWidth,r.height=t.realHeight,r.width&&r.height||console.log(`ERROR spine atlas page ${r.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),c()}));break}{o=new b;const t=new M;t.name=h,t.page=r;let e=null,n=null;for(;;){const t=s.readEntry(a,h=s.readLine());if(0==t)break;const r=l[a[0]];if(r)r();else{null==e&&(e=[],n=[]),e.push(a[0]);const s=[];for(let e=0;e=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(null==e)return 0;if(0==(e=e.trim()).length)return 0;const n=e.indexOf(":");if(-1==n)return 0;t[0]=e.substr(0,n).trim();for(let s=1,a=n+1;;s++){const n=e.indexOf(",",a);if(-1==n)return t[s]=e.substr(a).trim(),s;if(t[s]=e.substr(a,n-a).trim(),a=n+1,4==s)return 4}}}class S{constructor(){this.minFilter=p.Nearest,this.magFilter=p.Nearest,this.uWrap=x.ClampToEdge,this.vWrap=x.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==p.Linear?t.scaleMode=m.aH.LINEAR:this.minFilter==p.Nearest?t.scaleMode=m.aH.NEAREST:(t.mipmap=m.KI.POW2,e==p.MipMapNearestNearest?t.scaleMode=m.aH.NEAREST:t.scaleMode=m.aH.LINEAR)}}class M extends w{}class A{constructor(){this.array=new Array}add(t){const e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}}class T{constructor(){this.entries={},this.size=0}add(t){const e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){const e=this.size;for(let e=0,n=t.length;e1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}static fromString(t){return(new I).setFromString(t)}};let k=I;k.WHITE=new I(1,1,1,1),k.RED=new I(1,0,0,1),k.GREEN=new I(0,1,0,1),k.BLUE=new I(0,0,1,1),k.MAGENTA=new I(1,0,1,1);const R=class{static clamp(t,e,n){return tn?n:t}static cosDeg(t){return Math.cos(t*R.degRad)}static sinDeg(t){return Math.sin(t*R.degRad)}static signum(t){return Math.sign(t)}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){const e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}static randomTriangular(t,e){return R.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,n){const s=Math.random(),a=e-t;return s<=(n-t)/a?t+Math.sqrt(s*a*(n-t)):e-Math.sqrt((1-s)*a*(e-n))}static isPowerOfTwo(t){return t&&0==(t&t-1)}};let C=R;C.PI=3.1415927,C.PI2=2*R.PI,C.radiansToDegrees=180/R.PI,C.radDeg=R.radiansToDegrees,C.degreesToRadians=R.PI/180,C.degRad=R.degreesToRadians;class V{apply(t,e,n){return t+(e-t)*this.applyInternal(n)}}class v extends V{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}class P extends v{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const F=class{static arrayCopy(t,e,n,s,a){for(let r=e,i=s;r=e?t:F.setArraySize(t,e,n)}static newArray(t,e){const n=new Array(t);for(let s=0;s0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;ethis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class L{constructor(t=32){this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;eY.newFloatArray(16)))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");const n=this.boundingBoxes,s=this.polygons,a=this.polygonPool,r=t.slots,o=r.length;n.length=0,a.freeAll(s),s.length=0;for(let t=0;t=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,n,s){const a=this.minX,r=this.minY,i=this.maxX,o=this.maxY;if(t<=a&&n<=a||e<=r&&s<=r||t>=i&&n>=i||e>=o&&s>=o)return!1;const l=(s-e)/(n-t);let h=l*(a-t)+e;if(h>r&&hr&&ha&&ca&&ct.minX&&this.minYt.minY}containsPoint(t,e){const n=this.polygons;for(let s=0,a=n.length;s=n||o=n){const l=s[t];l+(n-a)/(o-a)*(s[r]-l)=c&&x<=i||x>=i&&x<=c)&&(x>=e&&x<=s||x>=s&&x<=e)){const t=(h*g-l*m)/p;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=n&&t<=a||t>=a&&t<=n))return!0}c=i,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}}const O={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0};var W=n(8820),q=n(2274),$=n(5638),U=n(3879);const H=[0,0,0];class z extends q.j{constructor(){super(...arguments),this.region=null,this.attachment=null}}class G extends $.AL{constructor(t,e,n,s,a){super(t,e,n,s,a),this.region=null,this.attachment=null}}const j=class extends W.W2{constructor(t){if(super(),!t)throw new Error("The spineData param is required.");if("string"==typeof t)throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=t,this.createSkeleton(t),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;te&&(t=e),this.state.update(t),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const n=this.skeleton.slots,s=this.color;let a=null,r=null;s?(a=s.light,r=s.dark):a=this.tintRgb;for(let t=0,e=n.length;t0;t--)e.bones.children[t-1].destroy({children:!0,texture:!0,baseTexture:!0});const n=t.scale.x||t.scale.y||1,s=this.lineWidth/n;this.drawBones&&this.drawBonesFunc(t,e,s,n),this.drawPaths&&this.drawPathsFunc(t,e,s),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,s),this.drawClipping&&this.drawClippingFunc(t,e,s),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,s),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,s)}drawBonesFunc(t,e,n,s){const a=t.skeleton,r=a.x,i=a.y,o=a.bones;e.skeletonXY.lineStyle(n,this.skeletonXYColor,1);for(let t=0,a=o.length;td&&cd&&c>u?A=-y:hu?A=y:c===u&&hd?A=-90*E:h===d&&cu&&(A=0),S.rotation=A,S.lineStyle(n+M/2.4,this.bonesColor,1),S.beginFill(0,.6),S.drawCircle(0,w,1.2*M),S.endFill()}const l=3*n;e.skeletonXY.moveTo(r-l,i-l),e.skeletonXY.lineTo(r+l,i+l),e.skeletonXY.moveTo(r+l,i-l),e.skeletonXY.lineTo(r-l,i+l)}drawRegionAttachmentsFunc(t,e,n){const s=t.skeleton.slots;e.regionAttachmentsShape.lineStyle(n,this.regionAttachmentsColor,1);for(let t=0,n=s.length;t0){h=2*(h>>1);let t=o[h-2],n=o[h-1];for(let s=0,a=h;s{if(e.boundingBoxesPolygon.lineStyle(n,this.boundingBoxesPolygonColor,1),e.boundingBoxesPolygon.beginFill(this.boundingBoxesPolygonColor,.1),a<3)throw new Error("Polygon must contain at least 3 vertices");const r=[],i=2*n;for(let n=0,s=t.length;n(0,Q.gN)(t,".atlas"),async load(t){const e=await m.Xd.ADAPTER.fetch(t);return await e.text()},testParse(t,e){const n=(0,Q.gN)(e.src,".atlas"),s="string"==typeof t;return Promise.resolve(n&&s)},async parse(t,e,n){const s=e.data;let a=m.P6.path.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let r=null,i=null;const o=new Promise(((t,e)=>{r=t,i=e}));let l;const h=t=>{t||i("Something went terribly wrong loading a spine .atlas file\nMost likely your texture failed to load."),r(l)};if(s.image||s.images){const e=Object.assign(s.image?{default:s.image}:{},s.images);l=new E(t,((t,n)=>{const s=e[t]||e.default;s&&s.baseTexture?n(s.baseTexture):n(s)}),h)}else l=new E(t,tt(n,a,s.imageMetadata),h);return await o},unload(t){t.dispose()}}},tt=(t,e,n)=>async(s,a)=>{const r=m.P6.path.normalize([...e.split(m.P6.path.sep),s].join(m.P6.path.sep));a((await t.load({src:r,data:n})).baseTexture)};function et(t){return t.hasOwnProperty("bones")}m.Rw.add(J);class nt{constructor(){}installLoader(){const t=this,e={extension:m.nw.Asset,loader:{extension:{type:m.nw.LoadParser,priority:Q.Q2.Normal},test:t=>(0,Q.gN)(t,".skel"),async load(t){const e=await m.Xd.ADAPTER.fetch(t);return await e.arrayBuffer()},testParse(t,e){const n=(0,Q.gN)(e.src,".json")&&et(t),s=(0,Q.gN)(e.src,".skel")&&t instanceof ArrayBuffer,a=!1===e.data?.spineAtlas;return Promise.resolve(n&&!a||s)},async parse(e,n,s){const a=m.P6.path.extname(n.src).toLowerCase(),r=m.P6.path.basename(n.src,a);let i=m.P6.path.dirname(n.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let o=null,l=e;(0,Q.gN)(n.src,".json")&&et(e)?o=t.createJsonParser():(o=t.createBinaryParser(),l=new Uint8Array(e));const h=n.data||{},c=h?.spineSkeletonScale??null;c&&(o.scale=c);const d=h.spineAtlas;if(d&&d.pages)return t.parseData(o,d,l);const u=h.atlasRawData;if(u){let e=null,n=null;const a=new Promise(((t,s)=>{e=t,n=s})),r=new E(u,tt(s,i,h.imageMetadata),(t=>{t||n("Something went terribly wrong loading a spine .atlas file\nMost likely your texture failed to load."),e(r)})),c=await a;return t.parseData(o,c,l)}let f=h.spineAtlasFile;f||(f=`${i+r}.atlas`);const g=await s.load({src:f,data:h,alias:h.spineAtlasAlias});return t.parseData(o,g,l)}}};return m.Rw.add(e),e}}class st{constructor(t){if(null==t)throw new Error("name cannot be null.");this.name=t}}const at=class extends st{constructor(t){super(t),this.id=(65535&at.nextID++)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,n,s,a,r){n=a+(n>>1)*r;const i=t.bone.skeleton,o=t.deform;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 s=0,h=l.length;s>>1;for(;;){if(t[(r+1)*n]<=e?s=r+1:a=r,s==a)return(s+1)*n;r=s+a>>>1}}static linearSearch(t,e,n){for(let s=0,a=t.length-n;s<=a;s+=n)if(t[s]>e)return s;return-1}}var wt=(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))(wt||{});const bt=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=Y.newFloatArray((t-1)*bt.BEZIER_SIZE)}getFrameCount(){return this.curves.length/bt.BEZIER_SIZE+1}setLinear(t){this.curves[t*bt.BEZIER_SIZE]=bt.LINEAR}setStepped(t){this.curves[t*bt.BEZIER_SIZE]=bt.STEPPED}getCurveType(t){const e=t*bt.BEZIER_SIZE;if(e==this.curves.length)return bt.LINEAR;const n=this.curves[e];return n==bt.LINEAR?bt.LINEAR:n==bt.STEPPED?bt.STEPPED:bt.BEZIER}setCurve(t,e,n,s,a){const r=.03*(2*-e+s),i=.03*(2*-n+a),o=.006*(3*(e-s)+1),l=.006*(3*(n-a)+1);let h=2*r+o,c=2*i+l,d=.3*e+r+.16666667*o,u=.3*n+i+.16666667*l,m=t*bt.BEZIER_SIZE;const f=this.curves;f[m++]=bt.BEZIER;let g=d,p=u;for(let t=m+bt.BEZIER_SIZE-1;m=e){let a,i;return s==t?(a=0,i=0):(a=n[s-2],i=n[s-1]),i+(n[s+1]-i)*(e-a)/(r-a)}const i=n[s-1];return i+(1-i)*(e-r)/(1-r)}};let Et=bt;Et.LINEAR=0,Et.STEPPED=1,Et.BEZIER=2,Et.BEZIER_SIZE=19;const yt=class extends Et{constructor(t){super(t),this.frames=Y.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+yt.ROTATION]=n}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.bones[this.boneIndex];if(!h.active)return;if(n=o[o.length-yt.ENTRIES]){let t=o[o.length+yt.PREV_ROTATION];switch(r){case l.setup:h.rotation=h.data.rotation+t*a;break;case l.first:case l.replace:t+=h.data.rotation-h.rotation,t-=360*(16384-(16384.499999999996-t/360|0));case l.add:h.rotation+=t*a}return}const c=xt.binarySearch(o,n,yt.ENTRIES),d=o[c+yt.PREV_ROTATION],u=o[c],m=this.getCurvePercent((c>>1)-1,1-(n-u)/(o[c+yt.PREV_TIME]-u));let f=o[c+yt.ROTATION]-d;switch(f=d+(f-360*(16384-(16384.499999999996-f/360|0)))*m,r){case l.setup:h.rotation=h.data.rotation+(f-360*(16384-(16384.499999999996-f/360|0)))*a;break;case l.first:case l.replace:f+=h.data.rotation-h.rotation;case l.add:h.rotation+=(f-360*(16384-(16384.499999999996-f/360|0)))*a}}};let St=yt;St.ENTRIES=2,St.PREV_TIME=-2,St.PREV_ROTATION=-1,St.ROTATION=1;const Mt=class extends Et{constructor(t){super(t),this.frames=Y.newFloatArray(t*Mt.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,n,s){t*=Mt.ENTRIES,this.frames[t]=e,this.frames[t+Mt.X]=n,this.frames[t+Mt.Y]=s}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.bones[this.boneIndex];if(!h.active)return;if(n=o[o.length-Mt.ENTRIES])c=o[o.length+Mt.PREV_X],d=o[o.length+Mt.PREV_Y];else{const t=xt.binarySearch(o,n,Mt.ENTRIES);c=o[t+Mt.PREV_X],d=o[t+Mt.PREV_Y];const e=o[t],s=this.getCurvePercent(t/Mt.ENTRIES-1,1-(n-e)/(o[t+Mt.PREV_TIME]-e));c+=(o[t+Mt.X]-c)*s,d+=(o[t+Mt.Y]-d)*s}switch(r){case l.setup:h.x=h.data.x+c*a,h.y=h.data.y+d*a;break;case l.first:case l.replace:h.x+=(h.data.x+c-h.x)*a,h.y+=(h.data.y+d-h.y)*a;break;case l.add:h.x+=c*a,h.y+=d*a}}};let At=Mt;At.ENTRIES=3,At.PREV_TIME=-3,At.PREV_X=-2,At.PREV_Y=-1,At.X=1,At.Y=2;class Tt extends At{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,n,s,a,r,i){const o=this.frames,c=t.bones[this.boneIndex];if(!c.active)return;if(n=o[o.length-Tt.ENTRIES])d=o[o.length+Tt.PREV_X]*c.data.scaleX,u=o[o.length+Tt.PREV_Y]*c.data.scaleY;else{const t=xt.binarySearch(o,n,Tt.ENTRIES);d=o[t+Tt.PREV_X],u=o[t+Tt.PREV_Y];const e=o[t],s=this.getCurvePercent(t/Tt.ENTRIES-1,1-(n-e)/(o[t+Tt.PREV_TIME]-e));d=(d+(o[t+Tt.X]-d)*s)*c.data.scaleX,u=(u+(o[t+Tt.Y]-u)*s)*c.data.scaleY}if(1==a)r==l.add?(c.scaleX+=d-c.data.scaleX,c.scaleY+=u-c.data.scaleY):(c.scaleX=d,c.scaleY=u);else{let t=0,e=0;if(i==h.mixOut)switch(r){case l.setup:t=c.data.scaleX,e=c.data.scaleY,c.scaleX=t+(Math.abs(d)*C.signum(t)-t)*a,c.scaleY=e+(Math.abs(u)*C.signum(e)-e)*a;break;case l.first:case l.replace:t=c.scaleX,e=c.scaleY,c.scaleX=t+(Math.abs(d)*C.signum(t)-t)*a,c.scaleY=e+(Math.abs(u)*C.signum(e)-e)*a;break;case l.add:t=c.scaleX,e=c.scaleY,c.scaleX=t+(Math.abs(d)*C.signum(t)-c.data.scaleX)*a,c.scaleY=e+(Math.abs(u)*C.signum(e)-c.data.scaleY)*a}else switch(r){case l.setup:t=Math.abs(c.data.scaleX)*C.signum(d),e=Math.abs(c.data.scaleY)*C.signum(u),c.scaleX=t+(d-t)*a,c.scaleY=e+(u-e)*a;break;case l.first:case l.replace:t=Math.abs(c.scaleX)*C.signum(d),e=Math.abs(c.scaleY)*C.signum(u),c.scaleX=t+(d-t)*a,c.scaleY=e+(u-e)*a;break;case l.add:t=C.signum(d),e=C.signum(u),c.scaleX=Math.abs(c.scaleX)*t+(d-Math.abs(c.data.scaleX)*t)*a,c.scaleY=Math.abs(c.scaleY)*e+(u-Math.abs(c.data.scaleY)*e)*a}}}}class It extends At{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.bones[this.boneIndex];if(!h.active)return;if(n=o[o.length-It.ENTRIES])c=o[o.length+It.PREV_X],d=o[o.length+It.PREV_Y];else{const t=xt.binarySearch(o,n,It.ENTRIES);c=o[t+It.PREV_X],d=o[t+It.PREV_Y];const e=o[t],s=this.getCurvePercent(t/It.ENTRIES-1,1-(n-e)/(o[t+It.PREV_TIME]-e));c+=(o[t+It.X]-c)*s,d+=(o[t+It.Y]-d)*s}switch(r){case l.setup:h.shearX=h.data.shearX+c*a,h.shearY=h.data.shearY+d*a;break;case l.first:case l.replace:h.shearX+=(h.data.shearX+c-h.shearX)*a,h.shearY+=(h.data.shearY+d-h.shearY)*a;break;case l.add:h.shearX+=c*a,h.shearY+=d*a}}}const kt=class extends Et{constructor(t){super(t),this.frames=Y.newFloatArray(t*kt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,n,s,a,r){t*=kt.ENTRIES,this.frames[t]=e,this.frames[t+kt.R]=n,this.frames[t+kt.G]=s,this.frames[t+kt.B]=a,this.frames[t+kt.A]=r}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames;if(n=h[h.length-kt.ENTRIES]){const t=h.length;c=h[t+kt.PREV_R],d=h[t+kt.PREV_G],u=h[t+kt.PREV_B],m=h[t+kt.PREV_A]}else{const t=xt.binarySearch(h,n,kt.ENTRIES);c=h[t+kt.PREV_R],d=h[t+kt.PREV_G],u=h[t+kt.PREV_B],m=h[t+kt.PREV_A];const e=h[t],s=this.getCurvePercent(t/kt.ENTRIES-1,1-(n-e)/(h[t+kt.PREV_TIME]-e));c+=(h[t+kt.R]-c)*s,d+=(h[t+kt.G]-d)*s,u+=(h[t+kt.B]-u)*s,m+=(h[t+kt.A]-m)*s}if(1==a)o.color.set(c,d,u,m);else{const t=o.color;r==l.setup&&t.setFromColor(o.data.color),t.add((c-t.r)*a,(d-t.g)*a,(u-t.b)*a,(m-t.a)*a)}}};let Rt=kt;Rt.ENTRIES=5,Rt.PREV_TIME=-5,Rt.PREV_R=-4,Rt.PREV_G=-3,Rt.PREV_B=-2,Rt.PREV_A=-1,Rt.R=1,Rt.G=2,Rt.B=3,Rt.A=4;const Ct=class extends Et{constructor(t){super(t),this.frames=Y.newFloatArray(t*Ct.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,n,s,a,r,i,o,l){t*=Ct.ENTRIES,this.frames[t]=e,this.frames[t+Ct.R]=n,this.frames[t+Ct.G]=s,this.frames[t+Ct.B]=a,this.frames[t+Ct.A]=r,this.frames[t+Ct.R2]=i,this.frames[t+Ct.G2]=o,this.frames[t+Ct.B2]=l}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames;if(n=h[h.length-Ct.ENTRIES]){const t=h.length;c=h[t+Ct.PREV_R],d=h[t+Ct.PREV_G],u=h[t+Ct.PREV_B],m=h[t+Ct.PREV_A],f=h[t+Ct.PREV_R2],g=h[t+Ct.PREV_G2],p=h[t+Ct.PREV_B2]}else{const t=xt.binarySearch(h,n,Ct.ENTRIES);c=h[t+Ct.PREV_R],d=h[t+Ct.PREV_G],u=h[t+Ct.PREV_B],m=h[t+Ct.PREV_A],f=h[t+Ct.PREV_R2],g=h[t+Ct.PREV_G2],p=h[t+Ct.PREV_B2];const e=h[t],s=this.getCurvePercent(t/Ct.ENTRIES-1,1-(n-e)/(h[t+Ct.PREV_TIME]-e));c+=(h[t+Ct.R]-c)*s,d+=(h[t+Ct.G]-d)*s,u+=(h[t+Ct.B]-u)*s,m+=(h[t+Ct.A]-m)*s,f+=(h[t+Ct.R2]-f)*s,g+=(h[t+Ct.G2]-g)*s,p+=(h[t+Ct.B2]-p)*s}if(1==a)o.color.set(c,d,u,m),o.darkColor.set(f,g,p,1);else{const t=o.color,e=o.darkColor;r==l.setup&&(t.setFromColor(o.data.color),e.setFromColor(o.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 Vt=Ct;Vt.ENTRIES=8,Vt.PREV_TIME=-8,Vt.PREV_R=-7,Vt.PREV_G=-6,Vt.PREV_B=-5,Vt.PREV_A=-4,Vt.PREV_R2=-3,Vt.PREV_G2=-2,Vt.PREV_B2=-1,Vt.R=1,Vt.G=2,Vt.B=3,Vt.A=4,Vt.R2=5,Vt.G2=6,Vt.B2=7;class vt{constructor(t){this.frames=Y.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex];if(!o.bone.active)return;if(i==h.mixOut)return void(r==l.setup&&this.setAttachment(t,o,o.data.attachmentName));const c=this.frames;if(n=c[c.length-1]?c.length-1:xt.binarySearch(c,n,1)-1;const u=this.attachmentNames[d];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}setAttachment(t,e,n){e.setAttachment(null==n?null:t.getAttachment(this.slotIndex,n))}}let Pt=null;class Ft extends Et{constructor(t){super(t),this.frames=Y.newFloatArray(t),this.frameVertices=new Array(t),null==Pt&&(Pt=Y.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,n){this.frames[t]=e,this.frameVertices[t]=n}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const h=o.getAttachment();if(!(h instanceof rt)||h.deformAttachment!=this.attachment)return;const c=o.deform;0==c.length&&(r=l.setup);const d=this.frameVertices,u=d[0].length,m=this.frames;if(n=m[m.length-1]){const t=d[m.length-1];if(1==a)if(r==l.add){const e=h;if(null==e.bones){const n=e.vertices;for(let e=0;en)this.apply(t,e,Number.MAX_VALUE,s,a,r,i),e=-1;else if(e>=o[l-1])return;if(n0&&o[h-1]==t;)h--}for(;h=o[h];h++)s.push(this.events[h])}}class Nt{constructor(t){this.frames=Y.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,n){this.frames[t]=e,this.drawOrders[t]=n}apply(t,e,n,s,a,r,i){const o=t.drawOrder,c=t.slots;if(i==h.mixOut&&r==l.setup)return void Y.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);const d=this.frames;if(n=d[d.length-1]?d.length-1:xt.binarySearch(d,n)-1;const m=this.drawOrders[u];if(null==m)Y.arrayCopy(c,0,o,0,c.length);else for(let t=0,e=m.length;t=o[o.length-Xt.ENTRIES])return void(r==l.setup?(c.mix=c.data.mix+(o[o.length+Xt.PREV_MIX]-c.data.mix)*a,c.softness=c.data.softness+(o[o.length+Xt.PREV_SOFTNESS]-c.data.softness)*a,i==h.mixOut?(c.bendDirection=c.data.bendDirection,c.compress=c.data.compress,c.stretch=c.data.stretch):(c.bendDirection=o[o.length+Xt.PREV_BEND_DIRECTION],c.compress=0!=o[o.length+Xt.PREV_COMPRESS],c.stretch=0!=o[o.length+Xt.PREV_STRETCH])):(c.mix+=(o[o.length+Xt.PREV_MIX]-c.mix)*a,c.softness+=(o[o.length+Xt.PREV_SOFTNESS]-c.softness)*a,i==h.mixIn&&(c.bendDirection=o[o.length+Xt.PREV_BEND_DIRECTION],c.compress=0!=o[o.length+Xt.PREV_COMPRESS],c.stretch=0!=o[o.length+Xt.PREV_STRETCH])));const d=xt.binarySearch(o,n,Xt.ENTRIES),u=o[d+Xt.PREV_MIX],m=o[d+Xt.PREV_SOFTNESS],f=o[d],g=this.getCurvePercent(d/Xt.ENTRIES-1,1-(n-f)/(o[d+Xt.PREV_TIME]-f));r==l.setup?(c.mix=c.data.mix+(u+(o[d+Xt.MIX]-u)*g-c.data.mix)*a,c.softness=c.data.softness+(m+(o[d+Xt.SOFTNESS]-m)*g-c.data.softness)*a,i==h.mixOut?(c.bendDirection=c.data.bendDirection,c.compress=c.data.compress,c.stretch=c.data.stretch):(c.bendDirection=o[d+Xt.PREV_BEND_DIRECTION],c.compress=0!=o[d+Xt.PREV_COMPRESS],c.stretch=0!=o[d+Xt.PREV_STRETCH])):(c.mix+=(u+(o[d+Xt.MIX]-u)*g-c.mix)*a,c.softness+=(m+(o[d+Xt.SOFTNESS]-m)*g-c.softness)*a,i==h.mixIn&&(c.bendDirection=o[d+Xt.PREV_BEND_DIRECTION],c.compress=0!=o[d+Xt.PREV_COMPRESS],c.stretch=0!=o[d+Xt.PREV_STRETCH]))}};let Dt=Xt;Dt.ENTRIES=6,Dt.PREV_TIME=-6,Dt.PREV_MIX=-5,Dt.PREV_SOFTNESS=-4,Dt.PREV_BEND_DIRECTION=-3,Dt.PREV_COMPRESS=-2,Dt.PREV_STRETCH=-1,Dt.MIX=1,Dt.SOFTNESS=2,Dt.BEND_DIRECTION=3,Dt.COMPRESS=4,Dt.STRETCH=5;const Bt=class extends Et{constructor(t){super(t),this.frames=Y.newFloatArray(t*Bt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,n,s,a,r){t*=Bt.ENTRIES,this.frames[t]=e,this.frames[t+Bt.ROTATE]=n,this.frames[t+Bt.TRANSLATE]=s,this.frames[t+Bt.SCALE]=a,this.frames[t+Bt.SHEAR]=r}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(!h.active)return;if(n=o[o.length-Bt.ENTRIES]){const t=o.length;c=o[t+Bt.PREV_ROTATE],d=o[t+Bt.PREV_TRANSLATE],u=o[t+Bt.PREV_SCALE],m=o[t+Bt.PREV_SHEAR]}else{const t=xt.binarySearch(o,n,Bt.ENTRIES);c=o[t+Bt.PREV_ROTATE],d=o[t+Bt.PREV_TRANSLATE],u=o[t+Bt.PREV_SCALE],m=o[t+Bt.PREV_SHEAR];const e=o[t],s=this.getCurvePercent(t/Bt.ENTRIES-1,1-(n-e)/(o[t+Bt.PREV_TIME]-e));c+=(o[t+Bt.ROTATE]-c)*s,d+=(o[t+Bt.TRANSLATE]-d)*s,u+=(o[t+Bt.SCALE]-u)*s,m+=(o[t+Bt.SHEAR]-m)*s}if(r==l.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 Lt=Bt;Lt.ENTRIES=5,Lt.PREV_TIME=-5,Lt.PREV_ROTATE=-4,Lt.PREV_TRANSLATE=-3,Lt.PREV_SCALE=-2,Lt.PREV_SHEAR=-1,Lt.ROTATE=1,Lt.TRANSLATE=2,Lt.SCALE=3,Lt.SHEAR=4;const _t=class extends Et{constructor(t){super(t),this.frames=Y.newFloatArray(t*_t.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,n){t*=_t.ENTRIES,this.frames[t]=e,this.frames[t+_t.VALUE]=n}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(n=o[o.length-_t.ENTRIES])c=o[o.length+_t.PREV_VALUE];else{const t=xt.binarySearch(o,n,_t.ENTRIES);c=o[t+_t.PREV_VALUE];const e=o[t],s=this.getCurvePercent(t/_t.ENTRIES-1,1-(n-e)/(o[t+_t.PREV_TIME]-e));c+=(o[t+_t.VALUE]-c)*s}r==l.setup?h.position=h.data.position+(c-h.data.position)*a:h.position+=(c-h.position)*a}};let Ot=_t;Ot.ENTRIES=2,Ot.PREV_TIME=-2,Ot.PREV_VALUE=-1,Ot.VALUE=1;class Wt extends Ot{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(n=o[o.length-Wt.ENTRIES])c=o[o.length+Wt.PREV_VALUE];else{const t=xt.binarySearch(o,n,Wt.ENTRIES);c=o[t+Wt.PREV_VALUE];const e=o[t],s=this.getCurvePercent(t/Wt.ENTRIES-1,1-(n-e)/(o[t+Wt.PREV_TIME]-e));c+=(o[t+Wt.VALUE]-c)*s}r==l.setup?h.spacing=h.data.spacing+(c-h.data.spacing)*a:h.spacing+=(c-h.spacing)*a}}const qt=class extends Et{constructor(t){super(t),this.frames=Y.newFloatArray(t*qt.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,n,s){t*=qt.ENTRIES,this.frames[t]=e,this.frames[t+qt.ROTATE]=n,this.frames[t+qt.TRANSLATE]=s}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(n=o[o.length-qt.ENTRIES])c=o[o.length+qt.PREV_ROTATE],d=o[o.length+qt.PREV_TRANSLATE];else{const t=xt.binarySearch(o,n,qt.ENTRIES);c=o[t+qt.PREV_ROTATE],d=o[t+qt.PREV_TRANSLATE];const e=o[t],s=this.getCurvePercent(t/qt.ENTRIES-1,1-(n-e)/(o[t+qt.PREV_TIME]-e));c+=(o[t+qt.ROTATE]-c)*s,d+=(o[t+qt.TRANSLATE]-d)*s}r==l.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 $t=qt;$t.ENTRIES=3,$t.PREV_TIME=-3,$t.PREV_ROTATE=-2,$t.PREV_TRANSLATE=-1,$t.ROTATE=1,$t.TRANSLATE=2;const Ut=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Zt(this),this.propertyIDs=new A,this.animationsChanged=!1,this.trackEntryPool=new X((()=>new Gt)),this.data=t}update(t){t*=this.timeScale;const e=this.tracks;for(let n=0,s=e.length;n0){if(s.delay-=a,s.delay>0)continue;a=-s.delay,s.delay=0}let r=s.next;if(null!=r){const e=s.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime+=0==s.timeScale?0:(e/s.timeScale+t)*r.timeScale,s.trackTime+=a,this.setCurrent(n,r,!0);null!=r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(s.trackLast>=s.trackEnd&&null==s.mixingFrom){e[n]=null,this.queue.end(s),this.disposeNext(s);continue}if(null!=s.mixingFrom&&this.updateMixingFrom(s,t)){let t=s.mixingFrom;for(s.mixingFrom=null,null!=t&&(t.mixingTo=null);null!=t;)this.queue.end(t),t=t.mixingFrom}s.trackTime+=a}this.queue.drain()}updateMixingFrom(t,e){const n=t.mixingFrom;if(null==n)return!0;const s=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,null!=n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),s):(n.trackTime+=e*n.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,n=this.tracks;let s=!1;for(let a=0,r=n.length;a0)continue;s=!0;const i=0==a?l.first:r.mixBlend;let o=r.alpha;null!=r.mixingFrom?o*=this.applyMixingFrom(r,t,i):r.trackTime>=r.trackEnd&&null==r.next&&(o=0);const c=r.animationLast,d=r.getAnimationTime(),u=r.animation.timelines.length,m=r.animation.timelines;if(0==a&&1==o||i==l.add)for(let n=0;n1&&(a=1),n!=l.first&&(n=s.mixBlend));const r=a0&&this.queueEvents(s,d),this.events.length=0,s.nextAnimationLast=d,s.nextTrackLast=s.trackTime,a}applyAttachmentTimeline(t,e,n,s,a){const r=e.slots[t.slotIndex];if(!r.bone.active)return;const i=t.frames;if(n=i[i.length-1]?i.length-1:xt.binarySearch(i,n)-1,this.setAttachment(e,r,t.attachmentNames[s],a)}r.attachmentState<=this.unkeyedState&&(r.attachmentState=this.unkeyedState+Ut.SETUP)}setAttachment(t,e,n,s){e.setAttachment(null==n?null:t.getAttachment(e.data.index,n)),s&&(e.attachmentState=this.unkeyedState+Ut.CURRENT)}applyRotateTimeline(t,e,n,s,a,r,i,o){if(o&&(r[i]=0),1==s)return void t.apply(e,0,n,null,1,a,h.mixIn);const c=t,d=c.frames,u=e.bones[c.boneIndex];if(!u.active)return;let m=0,f=0;if(n=d[d.length-St.ENTRIES])f=u.data.rotation+d[d.length+St.PREV_ROTATION];else{const t=xt.binarySearch(d,n,St.ENTRIES),e=d[t+St.PREV_ROTATION],s=d[t],a=c.getCurvePercent((t>>1)-1,1-(n-s)/(d[t+St.PREV_TIME]-s));f=d[t+St.ROTATION]-e,f-=360*(16384-(16384.499999999996-f/360|0)),f=e+f*a+u.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}let g=0,p=f-m;if(p-=360*(16384-(16384.499999999996-p/360|0)),0==p)g=r[i];else{let t=0,e=0;o?(t=0,e=p):(t=r[i],e=r[i+1]);const n=p>0;let s=t>=0;C.signum(e)!=C.signum(p)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*C.signum(t)),s=n),g=p+t-t%360,s!=n&&(g+=360*C.signum(t)),r[i]=g}r[i+1]=p,m+=g*s,u.rotation=m-360*(16384-(16384.499999999996-m/360|0))}queueEvents(t,e){const n=t.animationStart,s=t.animationEnd,a=s-n,r=t.trackLast%a,i=this.events;let o=0;const l=i.length;for(;os||this.queue.event(t,e)}let h=!1;for(h=t.loop?0==a||r>t.trackTime%a:e>=s&&t.animationLast=this.tracks.length)return;const e=this.tracks[t];if(null==e)return;this.queue.end(e),this.disposeNext(e);let n=e;for(;;){const t=n.mixingFrom;if(null==t)break;this.queue.end(t),n.mixingFrom=null,n.mixingTo=null,n=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,n){const s=this.expandToIndex(t);this.tracks[t]=e,null!=s&&(n&&this.queue.interrupt(s),e.mixingFrom=s,s.mixingTo=e,e.mixTime=0,null!=s.mixingFrom&&s.mixDuration>0&&(e.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,n){const s=this.data.skeletonData.findAnimation(e);if(null==s)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,s,n)}setAnimationWith(t,e,n){if(null==e)throw new Error("animation cannot be null.");let s=!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,s=!1):this.disposeNext(a));const r=this.trackEntry(t,e,n,a);return this.setCurrent(t,r,s),this.queue.drain(),r}addAnimation(t,e,n,s){const a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,a,n,s)}addAnimationWith(t,e,n,s){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,n,a);if(null==a)this.setCurrent(t,r,!0),this.queue.drain();else if(a.next=r,s<=0){const t=a.animationEnd-a.animationStart;0!=t?(a.loop?s+=t*(1+(a.trackTime/t|0)):s+=Math.max(t,a.trackTime),s-=this.data.getMix(a.animation,e)):s=a.trackTime}return r.delay=s,r}setEmptyAnimation(t,e){const n=this.setAnimationWith(t,Ut.emptyAnimation,!1);return n.mixDuration=e,n.trackEnd=e,n}addEmptyAnimation(t,e,n){n<=0&&(n-=e);const s=this.addAnimationWith(t,Ut.emptyAnimation,!1,n);return s.mixDuration=e,s.trackEnd=e,s}setEmptyAnimations(t){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,n=this.tracks.length;e0){a[o]=Ut.HOLD_MIX,r[o]=n;continue t}break}a[o]=Ut.HOLD_FIRST}else a[o]=Ut.SUBSEQUENT}}getCurrent(t){return 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,n){Ut.deprecatedWarning1||(Ut.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,n)}addAnimationByName(t,e,n,s){Ut.deprecatedWarning2||(Ut.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,n,s)}hasAnimation(t){return null!==this.data.skeletonData.findAnimation(t)}hasAnimationByName(t){return Ut.deprecatedWarning3||(Ut.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let Ht=Ut;Ht.emptyAnimation=new xt("",[],0),Ht.SUBSEQUENT=0,Ht.FIRST=1,Ht.HOLD_SUBSEQUENT=2,Ht.HOLD_FIRST=3,Ht.HOLD_MIX=4,Ht.SETUP=1,Ht.CURRENT=2,Ht.deprecatedWarning1=!1,Ht.deprecatedWarning2=!1,Ht.deprecatedWarning3=!1;const zt=class{constructor(){this.mixBlend=l.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 zt.deprecatedWarning1||(zt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){zt.deprecatedWarning1||(zt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return zt.deprecatedWarning2||(zt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){zt.deprecatedWarning2||(zt.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 Gt=zt;Gt.deprecatedWarning1=!1,Gt.deprecatedWarning2=!1;const jt=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(Kt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Kt.interrupt),this.objects.push(t)}end(t){this.objects.push(Kt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Kt.dispose),this.objects.push(t)}complete(t){this.objects.push(Kt.complete),this.objects.push(t)}event(t,e){this.objects.push(Kt.event),this.objects.push(t),this.objects.push(e)}deprecateStuff(){return jt.deprecatedWarning1||(jt.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 n=0;n(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))(Kt||{});class Qt{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const Jt=class{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,n){const s=this.skeletonData.findAnimation(t);if(null==s)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(s,a,n)}setMixByName(t,e,n){Jt.deprecatedWarning1||(Jt.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(t,e,n)}setMixWith(t,e,n){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");const s=`${t.name}.${e.name}`;this.animationToMixTime[s]=n}getMix(t,e){const n=`${t.name}.${e.name}`,s=this.animationToMixTime[n];return void 0===s?this.defaultMix:s}};let te=Jt;te.deprecatedWarning1=!1;class ee{constructor(t){this.atlas=t}newRegionAttachment(t,e,n){const s=this.atlas.findRegion(n);if(null==s)throw new Error(`Region not found in atlas: ${n} (region attachment: ${e})`);const a=new mt(e);return a.region=s,a}newMeshAttachment(t,e,n){const s=this.atlas.findRegion(n);if(null==s)throw new Error(`Region not found in atlas: ${n} (mesh attachment: ${e})`);const a=new lt(e);return a.region=s,a}newBoundingBoxAttachment(t,e){return new it(e)}newPathAttachment(t,e){return new ht(e)}newPointAttachment(t,e){return new ct(e)}newClippingAttachment(t,e){return new ot(e)}}class ne{constructor(t,e,n){if(this.matrix=new m.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=!1,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=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,e,n,s,a,r,i){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=s,this.ascaleY=a,this.ashearX=r,this.ashearY=i,this.appliedValid=!0;const o=this.parent,l=this.matrix,h=this.skeleton.scaleX,c=O.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(null==o){const o=this.skeleton,d=n+90+i;return l.a=C.cosDeg(n+r)*s*h,l.c=C.cosDeg(d)*a*h,l.b=C.sinDeg(n+r)*s*c,l.d=C.sinDeg(d)*a*c,l.tx=t*h+o.x,void(l.ty=e*c+o.y)}let d=o.matrix.a,m=o.matrix.c,f=o.matrix.b,g=o.matrix.d;switch(l.tx=d*t+m*e+o.matrix.tx,l.ty=f*t+g*e+o.matrix.ty,this.data.transformMode){case u.Normal:{const t=n+90+i,e=C.cosDeg(n+r)*s,o=C.cosDeg(t)*a,h=C.sinDeg(n+r)*s,c=C.sinDeg(t)*a;return l.a=d*e+m*h,l.c=d*o+m*c,l.b=f*e+g*h,void(l.d=f*o+g*c)}case u.OnlyTranslation:{const t=n+90+i;l.a=C.cosDeg(n+r)*s,l.c=C.cosDeg(t)*a,l.b=C.sinDeg(n+r)*s,l.d=C.sinDeg(t)*a;break}case u.NoRotationOrReflection:{let t=d*d+f*f,e=0;t>1e-4?(t=Math.abs(d*g-m*f)/t,d/=this.skeleton.scaleX,f/=this.skeleton.scaleY,m=f*t,g=d*t,e=Math.atan2(f,d)*C.radDeg):(d=0,f=0,e=90-Math.atan2(g,m)*C.radDeg);const o=n+r-e,h=n+i-e+90,c=C.cosDeg(o)*s,u=C.cosDeg(h)*a,p=C.sinDeg(o)*s,x=C.sinDeg(h)*a;l.a=d*c-m*p,l.c=d*u-m*x,l.b=f*c+g*p,l.d=f*u+g*x;break}case u.NoScale:case u.NoScaleOrReflection:{const t=C.cosDeg(n),e=C.sinDeg(n);let o=(d*t+m*e)/h,p=(f*t+g*e)/c,x=Math.sqrt(o*o+p*p);x>1e-5&&(x=1/x),o*=x,p*=x,x=Math.sqrt(o*o+p*p),this.data.transformMode==u.NoScale&&d*g-m*f<0!=(O.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);const w=Math.PI/2+Math.atan2(p,o),b=Math.cos(w)*x,E=Math.sin(w)*x,y=C.cosDeg(r)*s,S=C.cosDeg(90+i)*a,M=C.sinDeg(r)*s,A=C.sinDeg(90+i)*a;l.a=o*y+b*M,l.c=o*S+b*A,l.b=p*y+E*M,l.d=p*S+E*A;break}}l.a*=h,l.c*=h,l.b*=c,l.d*=c}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)*C.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*C.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)*C.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)*C.radDeg);const n=t.matrix,s=1/(n.a*n.d-n.b*n.c),a=e.tx-n.tx,r=e.ty-n.ty;this.ax=a*n.d*s-r*n.c*s,this.ay=r*n.a*s-a*n.b*s;const i=s*n.d,o=s*n.a,l=s*n.c,h=s*n.b,c=i*e.a-l*e.b,d=i*e.c-l*e.d,u=o*e.b-h*e.a,m=o*e.d-h*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+u*u),this.ascaleX>1e-4){const t=c*m-d*u;this.ascaleY=t/this.ascaleX,this.ashearY=Math.atan2(c*d+u*m,t)*C.radDeg,this.arotation=Math.atan2(u,c)*C.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,d)*C.radDeg}worldToLocal(t){const e=this.matrix,n=e.a,s=e.c,a=e.b,r=e.d,i=1/(n*r-s*a),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*r*i-l*s*i,t.y=l*n*i-o*a*i,t}localToWorld(t){const e=this.matrix,n=t.x,s=t.y;return t.x=n*e.a+s*e.c+e.tx,t.y=n*e.b+s*e.d+e.ty,t}worldToLocalRotation(t){const e=C.sinDeg(t),n=C.cosDeg(t),s=this.matrix;return Math.atan2(s.a*e-s.b*n,s.d*n-s.c*e)*C.radDeg}localToWorldRotation(t){const e=C.sinDeg(t),n=C.cosDeg(t),s=this.matrix;return Math.atan2(n*s.b+e*s.d,n*s.a+e*s.c)*C.radDeg}rotateWorld(t){const e=this.matrix,n=e.a,s=e.c,a=e.b,r=e.d,i=C.cosDeg(t),o=C.sinDeg(t);e.a=i*n-o*a,e.c=i*s-o*r,e.b=o*n+i*a,e.d=o*s+i*r,this.appliedValid=!1}}class se{constructor(t,e,n){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=u.Normal,this.skinRequired=!1,this.color=new k,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=n}}class ae{constructor(t,e,n){this.name=t,this.order=e,this.skinRequired=n}}class re{constructor(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class ie{constructor(t){this.name=t}}class oe{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!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.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let n=0;n180?m-=360:m<-180&&(m+=360);let p=t.ascaleX,x=t.ascaleY;if(s||a){switch(t.data.transformMode){case u.NoScale:case u.NoScaleOrReflection:f=e-t.worldX,g=n-t.worldY}const o=t.data.length*p,l=Math.sqrt(f*f+g*g);if(s&&lo&&o>1e-4){const t=(l/o-1)*i+1;p*=t,r&&(x*=t)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*i,p,x,t.ashearX,t.ashearY)}apply2(t,e,n,s,a,r,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 w=e.ax;let b=0,E=0,y=0,S=f.a,M=f.c,A=f.b,T=f.d;const I=Math.abs(c-u)<=1e-4;I?(b=e.ay,E=S*w+M*b+f.tx,y=A*w+T*b+f.ty):(b=0,E=S*w+f.tx,y=A*w+f.ty);const k=t.parent.matrix;S=k.a,M=k.c,A=k.b,T=k.d;const R=1/(S*T-M*A);let V=E-k.tx,v=y-k.ty;const P=(V*T-v*M)*R-l,F=(v*S-V*A)*R-h,Y=Math.sqrt(P*P+F*F);let N,X,D=e.data.length*m;if(Y<1e-4)return this.apply1(t,n,s,!1,r,!1,o),void e.updateWorldTransformWith(w,b,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);V=n-k.tx,v=s-k.ty;let B=(V*T-v*M)*R-l,L=(v*S-V*A)*R-h,_=B*B+L*L;if(0!=i){i*=c*(m+1)/2;const t=Math.sqrt(_),e=t-Y-D*c+i;if(e>0){let n=Math.min(1,e/(2*i))-1;n=(e-i*(1-n*n))/t,B-=n*B,L-=n*L,_=B*B+L*L}}t:if(I){D*=c;let t=(_-Y*Y-D*D)/(2*Y*D);t<-1?t=-1:t>1&&(t=1,r&&(d*=(Math.sqrt(_)/(Y+D)-1)*o+1)),X=Math.acos(t)*a,S=Y+D*t,M=D*Math.sin(X),N=Math.atan2(L*S-B*M,B*S+L*M)}else{S=c*D,M=u*D;const t=S*S,e=M*M,n=Math.atan2(L,B);A=e*Y*Y+t*_-t*e;const s=-2*e*Y,r=e-t;if(T=s*s-4*r*A,T>=0){let t=Math.sqrt(T);s<0&&(t=-t),t=-(s+t)/2;const e=t/r,i=A/t,o=Math.abs(e)=-1&&A<=1&&(A=Math.acos(A),V=S*Math.cos(A)+Y,v=M*Math.sin(A),T=V*V+v*v,Tf&&(d=A,f=T,m=V,g=v)),_<=(l+f)/2?(N=n-Math.atan2(h*a,o),X=i*a):(N=n-Math.atan2(g*a,m),X=d*a)}const O=Math.atan2(b,w)*x;let W=t.arotation;N=(N-O)*C.radDeg+g-W,N>180?N-=360:N<-180&&(N+=360),t.updateWorldTransformWith(l,h,W+N*o,d,t.ascaleY,0,0),W=e.arotation,X=((X+O)*C.radDeg-e.ashearX)*x+p-W,X>180?X-=360:X<-180&&(X+=360),e.updateWorldTransformWith(w,b,W+X*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class le extends ae{constructor(t){super(t,0,!1),this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}}class he extends ae{constructor(t){super(t,0,!1),this.bones=new Array}}var ce=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t))(ce||{});const de=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,this.active=!1,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 n=0,s=t.bones.length;n0;if(!(n>0||s))return;const a=this.data,r=a.spacingMode,i=r==ce.Length,o=a.rotateMode,l=o==d.Tangent,h=o==d.ChainScale,u=this.bones.length,m=l?u:u+1,f=this.bones,g=Y.setArraySize(this.spaces,m);let p=null;const x=this.spacing;if(h||i){h&&(p=Y.setArraySize(this.lengths,u));for(let t=0,e=m-1;t0?C.degRad:-C.degRad}for(let t=0,a=3;tC.PI?c-=C.PI2:c<-C.PI&&(c+=C.PI2),c*=e,m=Math.cos(c),f=Math.sin(c),i.a=m*n-f*o,i.c=m*s-f*h,i.b=f*n+m*o,i.d=f*s+m*h}r.appliedValid=!1}}computeWorldPositions(t,e,n,s,a){const r=this.target;let i=this.position;const o=this.spaces,l=Y.setArraySize(this.positions,3*e+2);let h=null;const c=t.closed;let d=t.worldVerticesLength,u=d/6,m=de.NONE;if(!t.constantSpeed){const f=t.lengths;u-=c?1:2;const g=f[u];if(s&&(i*=g),a)for(let t=0;tg){m!=de.AFTER&&(m=de.AFTER,t.computeWorldVertices(r,d-6,4,h,0,2)),this.addAfterPosition(x-g,h,0,l,a);continue}}for(;;p++){const t=f[p];if(!(x>t)){if(0==p)x/=t;else{const e=f[p-1];x=(x-e)/(t-e)}break}}p!=m&&(m=p,c&&p==u?(t.computeWorldVertices(r,d-4,4,h,0,2),t.computeWorldVertices(r,0,4,h,4,2)):t.computeWorldVertices(r,6*p+2,8,h,0,2)),this.addCurvePosition(x,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],l,a,n||s>0&&0==e)}return l}c?(d+=2,h=Y.setArraySize(this.world,d),t.computeWorldVertices(r,2,d-4,h,0,2),t.computeWorldVertices(r,0,2,h,d-4,2),h[d-2]=h[0],h[d-1]=h[1]):(u--,d-=4,h=Y.setArraySize(this.world,d),t.computeWorldVertices(r,2,d,h,0,2));const f=Y.setArraySize(this.curves,u);let g=0,p=h[0],x=h[1],w=0,b=0,E=0,y=0,S=0,M=0,A=0,T=0,I=0,k=0,R=0,C=0,V=0,v=0;for(let t=0,e=2;tg){this.addAfterPosition(u-g,h,d-4,l,s);continue}}for(;;a++){const t=f[a];if(!(u>t)){if(0==a)u/=t;else{const e=f[a-1];u=(u-e)/(t-e)}break}}if(a!=m){m=a;let t=6*a;for(p=h[t],x=h[t+1],w=h[t+2],b=h[t+3],E=h[t+4],y=h[t+5],S=h[t+6],M=h[t+7],A=.03*(p-2*w+E),T=.03*(x-2*b+y),I=.006*(3*(w-E)-p+S),k=.006*(3*(b-y)-x+M),R=2*A+I,C=2*T+k,V=.3*(w-p)+A+.16666667*I,v=.3*(b-x)+T+.16666667*k,F=Math.sqrt(V*V+v*v),P[0]=F,t=1;t<8;t++)V+=R,v+=C,R+=I,C+=k,F+=Math.sqrt(V*V+v*v),P[t]=F;V+=R,v+=C,F+=Math.sqrt(V*V+v*v),P[8]=F,V+=R+I,v+=C+k,F+=Math.sqrt(V*V+v*v),P[9]=F,r=0}for(u*=F;;r++){const t=P[r];if(!(u>t)){if(0==r)u/=t;else{const e=P[r-1];u=r+(u-e)/(t-e)}break}}this.addCurvePosition(.1*u,p,x,w,b,E,y,S,M,l,s,n||t>0&&0==e)}return l}addBeforePosition(t,e,n,s,a){const r=e[n],i=e[n+1],o=e[n+2]-r,l=e[n+3]-i,h=Math.atan2(l,o);s[a]=r+t*Math.cos(h),s[a+1]=i+t*Math.sin(h),s[a+2]=h}addAfterPosition(t,e,n,s,a){const r=e[n+2],i=e[n+3],o=r-e[n],l=i-e[n+1],h=Math.atan2(l,o);s[a]=r+t*Math.cos(h),s[a+1]=i+t*Math.sin(h),s[a+2]=h}addCurvePosition(t,e,n,s,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,w=3*x,b=f*w,E=w*t,y=e*p+s*b+r*E+o*m,S=n*p+a*b+i*E+l*m;h[c]=y,h[c+1]=S,d&&(h[c+2]=Math.atan2(S-(n*g+a*x*2+i*u),y-(e*g+s*x*2+r*u)))}};let ue=de;ue.NONE=-1,ue.BEFORE=-2,ue.AFTER=-3,ue.epsilon=1e-5;class me{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new D,this.active=!1,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 n=0;n0?C.degRad:-C.degRad,d=this.data.offsetRotation*c,u=this.data.offsetShearY*c,m=this.bones;for(let r=0,c=m.length;rC.PI?r-=C.PI2:r<-C.PI&&(r+=C.PI2),r*=t;const o=Math.cos(r),h=Math.sin(r);g.a=o*e-h*s,g.c=o*n-h*a,g.b=h*e+o*s,g.d=h*n+o*a,f=!0}if(0!=e){const t=this.temp;a.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.tx+=(t.x-g.tx)*e,g.ty+=(t.y-g.ty)*e,f=!0}if(n>0){let t=Math.sqrt(g.a*g.a+g.b*g.b),e=Math.sqrt(i*i+l*l);t>1e-5&&(t=(t+(e-t+this.data.offsetScaleX)*n)/t),g.a*=t,g.b*=t,t=Math.sqrt(g.c*g.c+g.d*g.d),e=Math.sqrt(o*o+h*h),t>1e-5&&(t=(t+(e-t+this.data.offsetScaleY)*n)/t),g.c*=t,g.d*=t,f=!0}if(s>0){const t=g.c,e=g.d,n=Math.atan2(e,t);let a=Math.atan2(h,o)-Math.atan2(l,i)-(n-Math.atan2(g.b,g.a));a>C.PI?a-=C.PI2:a<-C.PI&&(a+=C.PI2),a=n+(a+u)*s;const r=Math.sqrt(t*t+e*e);g.c=Math.cos(a)*r,g.d=Math.sin(a)*r,f=!0}f&&(c.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,n=this.scaleMix,s=this.shearMix,a=this.target,r=a.matrix,i=r.a,o=r.c,l=r.b,h=r.d,c=i*h-o*l>0?C.degRad:-C.degRad,d=this.data.offsetRotation*c,u=this.data.offsetShearY*c,m=this.bones;for(let r=0,c=m.length;rC.PI?r-=C.PI2:r<-C.PI&&(r+=C.PI2),r*=t;const o=Math.cos(r),h=Math.sin(r);g.a=o*e-h*s,g.c=o*n-h*a,g.b=h*e+o*s,g.d=h*n+o*a,f=!0}if(0!=e){const t=this.temp;a.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.tx+=t.x*e,g.ty+=t.y*e,f=!0}if(n>0){let t=(Math.sqrt(i*i+l*l)-1+this.data.offsetScaleX)*n+1;g.a*=t,g.b*=t,t=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleY)*n+1,g.c*=t,g.d*=t,f=!0}if(s>0){let t=Math.atan2(h,o)-Math.atan2(l,i);t>C.PI?t-=C.PI2:t<-C.PI&&(t+=C.PI2);const e=g.c,n=g.d;t=Math.atan2(n,e)+(t-C.PI/2+u)*s;const a=Math.sqrt(e*e+n*n);g.c=Math.cos(t)*a,g.d=Math.sin(t)*a,f=!0}f&&(c.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,n=this.scaleMix,s=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)*n)/d),u>1e-5&&(u=(u+(a.ascaleY-u+this.data.offsetScaleY)*n)/u));const m=o.ashearY;if(s>0){let t=a.ashearY-m+this.data.offsetShearY;t-=360*(16384-(16384.499999999996-t/360|0)),o.shearY+=t*s}o.updateWorldTransformWith(h,c,l,d,u,o.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,n=this.scaleMix,s=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)*n+1),u>1e-5&&(u*=(a.ascaleY-1+this.data.offsetScaleY)*n+1));let m=o.ashearY;s>0&&(m+=(a.ashearY+this.data.offsetShearY)*s),o.updateWorldTransformWith(h,c,l,d,u,o.ashearX,m)}}}const fe=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=n[n.length-1];this._updateCache.indexOf(t)>-1||this.updateCacheReset.push(t)}this._updateCache.push(t),this.sortReset(s.children),n[n.length-1].sorted=!0}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||null!=this.skin&&Y.contains(this.skin.constraints,t.data,!0)),!t.active)return;const e=t.target,n=e.data.index,s=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,n,s),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,s);for(let t=0,e=this.data.skins.length;t-1||this.updateCacheReset.push(n)}else for(let t=0;t= 0.");if(null==e)throw new Error("name cannot be null.");if(null==n)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=n}}class we extends ae{constructor(t){super(t,0,!1),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}}class be{constructor(t,e,n){this.slotIndex=t,this.name=e,this.attachment=n}}class Ee{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,null==t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,n){if(null==n)throw new Error("attachment cannot be null.");const s=this.attachments;t>=s.length&&(s.length=t+1),s[t]||(s[t]={}),s[t][e]=n}addSkin(t){for(let e=0;e0){const e=new Nt(l),a=n.slots.length;for(let n=0;n=0;t--)i[t]=-1;const o=Y.newArray(a-r,0);let l=0,h=0;for(let e=0;e=0;t--)-1==i[t]&&(i[t]=o[--h]);e.setFrame(n,s,i)}s.push(e),r=Math.max(r,e.frames[l-1])}const h=t.readInt(!0);if(h>0){const e=new Yt(h);for(let s=0;s=0;n--)-1==o[n]&&(o[n]=t[--a])}t.setFrame(s++,this.getValue(r,"time",0),o)}a.push(t),r=Math.max(r,t.frames[t.getFrameCount()-1])}if(t.events){const e=new Yt(t.events.length);let s=0;for(let a=0;a>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 s=0,h=l.length;s>>1;for(;;){if(t[(r+1)*n]<=e?s=r+1:a=r,s==a)return(s+1)*n;r=s+a>>>1}}static linearSearch(t,e,n){for(let s=0,a=t.length-n;s<=a;s+=n)if(t[s]>e)return s;return-1}}var $e=(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))($e||{});const Ue=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=Y.newFloatArray((t-1)*Ue.BEZIER_SIZE)}getFrameCount(){return this.curves.length/Ue.BEZIER_SIZE+1}setLinear(t){this.curves[t*Ue.BEZIER_SIZE]=Ue.LINEAR}setStepped(t){this.curves[t*Ue.BEZIER_SIZE]=Ue.STEPPED}getCurveType(t){const e=t*Ue.BEZIER_SIZE;if(e==this.curves.length)return Ue.LINEAR;const n=this.curves[e];return n==Ue.LINEAR?Ue.LINEAR:n==Ue.STEPPED?Ue.STEPPED:Ue.BEZIER}setCurve(t,e,n,s,a){const r=.03*(2*-e+s),i=.03*(2*-n+a),o=.006*(3*(e-s)+1),l=.006*(3*(n-a)+1);let h=2*r+o,c=2*i+l,d=.3*e+r+.16666667*o,u=.3*n+i+.16666667*l,m=t*Ue.BEZIER_SIZE;const f=this.curves;f[m++]=Ue.BEZIER;let g=d,p=u;for(let t=m+Ue.BEZIER_SIZE-1;m=e){let a,i;return s==t?(a=0,i=0):(a=n[s-2],i=n[s-1]),i+(n[s+1]-i)*(e-a)/(r-a)}const i=n[s-1];return i+(1-i)*(e-r)/(1-r)}};let He=Ue;He.LINEAR=0,He.STEPPED=1,He.BEZIER=2,He.BEZIER_SIZE=19;const ze=class extends He{constructor(t){super(t),this.frames=Y.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+ze.ROTATION]=n}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.bones[this.boneIndex];if(n=o[o.length-ze.ENTRIES]){let t=o[o.length+ze.PREV_ROTATION];switch(r){case l.setup:h.rotation=h.data.rotation+t*a;break;case l.first:case l.replace:t+=h.data.rotation-h.rotation,t-=360*(16384-(16384.499999999996-t/360|0));case l.add:h.rotation+=t*a}return}const c=qe.binarySearch(o,n,ze.ENTRIES),d=o[c+ze.PREV_ROTATION],u=o[c],m=this.getCurvePercent((c>>1)-1,1-(n-u)/(o[c+ze.PREV_TIME]-u));let f=o[c+ze.ROTATION]-d;switch(f=d+(f-360*(16384-(16384.499999999996-f/360|0)))*m,r){case l.setup:h.rotation=h.data.rotation+(f-360*(16384-(16384.499999999996-f/360|0)))*a;break;case l.first:case l.replace:f+=h.data.rotation-h.rotation;case l.add:h.rotation+=(f-360*(16384-(16384.499999999996-f/360|0)))*a}}};let Ge=ze;Ge.ENTRIES=2,Ge.PREV_TIME=-2,Ge.PREV_ROTATION=-1,Ge.ROTATION=1;const je=class extends He{constructor(t){super(t),this.frames=Y.newFloatArray(t*je.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,n,s){t*=je.ENTRIES,this.frames[t]=e,this.frames[t+je.X]=n,this.frames[t+je.Y]=s}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.bones[this.boneIndex];if(n=o[o.length-je.ENTRIES])c=o[o.length+je.PREV_X],d=o[o.length+je.PREV_Y];else{const t=qe.binarySearch(o,n,je.ENTRIES);c=o[t+je.PREV_X],d=o[t+je.PREV_Y];const e=o[t],s=this.getCurvePercent(t/je.ENTRIES-1,1-(n-e)/(o[t+je.PREV_TIME]-e));c+=(o[t+je.X]-c)*s,d+=(o[t+je.Y]-d)*s}switch(r){case l.setup:h.x=h.data.x+c*a,h.y=h.data.y+d*a;break;case l.first:case l.replace:h.x+=(h.data.x+c-h.x)*a,h.y+=(h.data.y+d-h.y)*a;break;case l.add:h.x+=c*a,h.y+=d*a}}};let Ze=je;Ze.ENTRIES=3,Ze.PREV_TIME=-3,Ze.PREV_X=-2,Ze.PREV_Y=-1,Ze.X=1,Ze.Y=2;class Ke extends Ze{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,n,s,a,r,i){const o=this.frames,c=t.bones[this.boneIndex];if(n=o[o.length-Ke.ENTRIES])d=o[o.length+Ke.PREV_X]*c.data.scaleX,u=o[o.length+Ke.PREV_Y]*c.data.scaleY;else{const t=qe.binarySearch(o,n,Ke.ENTRIES);d=o[t+Ke.PREV_X],u=o[t+Ke.PREV_Y];const e=o[t],s=this.getCurvePercent(t/Ke.ENTRIES-1,1-(n-e)/(o[t+Ke.PREV_TIME]-e));d=(d+(o[t+Ke.X]-d)*s)*c.data.scaleX,u=(u+(o[t+Ke.Y]-u)*s)*c.data.scaleY}if(1==a)r==l.add?(c.scaleX+=d-c.data.scaleX,c.scaleY+=u-c.data.scaleY):(c.scaleX=d,c.scaleY=u);else{let t=0,e=0;if(i==h.mixOut)switch(r){case l.setup:t=c.data.scaleX,e=c.data.scaleY,c.scaleX=t+(Math.abs(d)*C.signum(t)-t)*a,c.scaleY=e+(Math.abs(u)*C.signum(e)-e)*a;break;case l.first:case l.replace:t=c.scaleX,e=c.scaleY,c.scaleX=t+(Math.abs(d)*C.signum(t)-t)*a,c.scaleY=e+(Math.abs(u)*C.signum(e)-e)*a;break;case l.add:t=c.scaleX,e=c.scaleY,c.scaleX=t+(Math.abs(d)*C.signum(t)-c.data.scaleX)*a,c.scaleY=e+(Math.abs(u)*C.signum(e)-c.data.scaleY)*a}else switch(r){case l.setup:t=Math.abs(c.data.scaleX)*C.signum(d),e=Math.abs(c.data.scaleY)*C.signum(u),c.scaleX=t+(d-t)*a,c.scaleY=e+(u-e)*a;break;case l.first:case l.replace:t=Math.abs(c.scaleX)*C.signum(d),e=Math.abs(c.scaleY)*C.signum(u),c.scaleX=t+(d-t)*a,c.scaleY=e+(u-e)*a;break;case l.add:t=C.signum(d),e=C.signum(u),c.scaleX=Math.abs(c.scaleX)*t+(d-Math.abs(c.data.scaleX)*t)*a,c.scaleY=Math.abs(c.scaleY)*e+(u-Math.abs(c.data.scaleY)*e)*a}}}}class Qe extends Ze{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.bones[this.boneIndex];if(n=o[o.length-Qe.ENTRIES])c=o[o.length+Qe.PREV_X],d=o[o.length+Qe.PREV_Y];else{const t=qe.binarySearch(o,n,Qe.ENTRIES);c=o[t+Qe.PREV_X],d=o[t+Qe.PREV_Y];const e=o[t],s=this.getCurvePercent(t/Qe.ENTRIES-1,1-(n-e)/(o[t+Qe.PREV_TIME]-e));c+=(o[t+Qe.X]-c)*s,d+=(o[t+Qe.Y]-d)*s}switch(r){case l.setup:h.shearX=h.data.shearX+c*a,h.shearY=h.data.shearY+d*a;break;case l.first:case l.replace:h.shearX+=(h.data.shearX+c-h.shearX)*a,h.shearY+=(h.data.shearY+d-h.shearY)*a;break;case l.add:h.shearX+=c*a,h.shearY+=d*a}}}const Je=class extends He{constructor(t){super(t),this.frames=Y.newFloatArray(t*Je.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,n,s,a,r){t*=Je.ENTRIES,this.frames[t]=e,this.frames[t+Je.R]=n,this.frames[t+Je.G]=s,this.frames[t+Je.B]=a,this.frames[t+Je.A]=r}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex],h=this.frames;if(n=h[h.length-Je.ENTRIES]){const t=h.length;c=h[t+Je.PREV_R],d=h[t+Je.PREV_G],u=h[t+Je.PREV_B],m=h[t+Je.PREV_A]}else{const t=qe.binarySearch(h,n,Je.ENTRIES);c=h[t+Je.PREV_R],d=h[t+Je.PREV_G],u=h[t+Je.PREV_B],m=h[t+Je.PREV_A];const e=h[t],s=this.getCurvePercent(t/Je.ENTRIES-1,1-(n-e)/(h[t+Je.PREV_TIME]-e));c+=(h[t+Je.R]-c)*s,d+=(h[t+Je.G]-d)*s,u+=(h[t+Je.B]-u)*s,m+=(h[t+Je.A]-m)*s}if(1==a)o.color.set(c,d,u,m);else{const t=o.color;r==l.setup&&t.setFromColor(o.data.color),t.add((c-t.r)*a,(d-t.g)*a,(u-t.b)*a,(m-t.a)*a)}}};let tn=Je;tn.ENTRIES=5,tn.PREV_TIME=-5,tn.PREV_R=-4,tn.PREV_G=-3,tn.PREV_B=-2,tn.PREV_A=-1,tn.R=1,tn.G=2,tn.B=3,tn.A=4;const en=class extends He{constructor(t){super(t),this.frames=Y.newFloatArray(t*en.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,n,s,a,r,i,o,l){t*=en.ENTRIES,this.frames[t]=e,this.frames[t+en.R]=n,this.frames[t+en.G]=s,this.frames[t+en.B]=a,this.frames[t+en.A]=r,this.frames[t+en.R2]=i,this.frames[t+en.G2]=o,this.frames[t+en.B2]=l}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex],h=this.frames;if(n=h[h.length-en.ENTRIES]){const t=h.length;c=h[t+en.PREV_R],d=h[t+en.PREV_G],u=h[t+en.PREV_B],m=h[t+en.PREV_A],f=h[t+en.PREV_R2],g=h[t+en.PREV_G2],p=h[t+en.PREV_B2]}else{const t=qe.binarySearch(h,n,en.ENTRIES);c=h[t+en.PREV_R],d=h[t+en.PREV_G],u=h[t+en.PREV_B],m=h[t+en.PREV_A],f=h[t+en.PREV_R2],g=h[t+en.PREV_G2],p=h[t+en.PREV_B2];const e=h[t],s=this.getCurvePercent(t/en.ENTRIES-1,1-(n-e)/(h[t+en.PREV_TIME]-e));c+=(h[t+en.R]-c)*s,d+=(h[t+en.G]-d)*s,u+=(h[t+en.B]-u)*s,m+=(h[t+en.A]-m)*s,f+=(h[t+en.R2]-f)*s,g+=(h[t+en.G2]-g)*s,p+=(h[t+en.B2]-p)*s}if(1==a)o.color.set(c,d,u,m),o.darkColor.set(f,g,p,1);else{const t=o.color,e=o.darkColor;r==l.setup&&(t.setFromColor(o.data.color),e.setFromColor(o.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 nn=en;nn.ENTRIES=8,nn.PREV_TIME=-8,nn.PREV_R=-7,nn.PREV_G=-6,nn.PREV_B=-5,nn.PREV_A=-4,nn.PREV_R2=-3,nn.PREV_G2=-2,nn.PREV_B2=-1,nn.R=1,nn.G=2,nn.B=3,nn.A=4,nn.R2=5,nn.G2=6,nn.B2=7;class sn{constructor(t){this.frames=Y.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex];if(i==h.mixOut&&r==l.setup){const e=o.data.attachmentName;return void o.setAttachment(null==e?null:t.getAttachment(this.slotIndex,e))}const c=this.frames;if(n=c[c.length-1]?c.length-1:qe.binarySearch(c,n,1)-1;const u=this.attachmentNames[d];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}}let an=null;class rn extends He{constructor(t){super(t),this.frames=Y.newFloatArray(t),this.frameVertices=new Array(t),null==an&&(an=Y.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,n){this.frames[t]=e,this.frameVertices[t]=n}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex],h=o.getAttachment();if(!(h instanceof ve&&h.applyDeform(this.attachment)))return;const c=o.attachmentVertices;0==c.length&&(r=l.setup);const d=this.frameVertices,u=d[0].length,m=this.frames;if(n=m[m.length-1]){const t=d[m.length-1];if(1==a)if(r==l.add){const e=h;if(null==e.bones){const n=e.vertices;for(let e=0;en)this.apply(t,e,Number.MAX_VALUE,s,a,r,i),e=-1;else if(e>=o[l-1])return;if(n0&&o[h-1]==t;)h--}for(;h=o[h];h++)s.push(this.events[h])}}class ln{constructor(t){this.frames=Y.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,n){this.frames[t]=e,this.drawOrders[t]=n}apply(t,e,n,s,a,r,i){const o=t.drawOrder,c=t.slots;if(i==h.mixOut&&r==l.setup)return void Y.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);const d=this.frames;if(n=d[d.length-1]?d.length-1:qe.binarySearch(d,n)-1;const m=this.drawOrders[u];if(null==m)Y.arrayCopy(c,0,o,0,c.length);else for(let t=0,e=m.length;t=o[o.length-hn.ENTRIES])return void(r==l.setup?(c.mix=c.data.mix+(o[o.length+hn.PREV_MIX]-c.data.mix)*a,i==h.mixOut?(c.bendDirection=c.data.bendDirection,c.compress=c.data.compress,c.stretch=c.data.stretch):(c.bendDirection=o[o.length+hn.PREV_BEND_DIRECTION],c.compress=0!=o[o.length+hn.PREV_COMPRESS],c.stretch=0!=o[o.length+hn.PREV_STRETCH])):(c.mix+=(o[o.length+hn.PREV_MIX]-c.mix)*a,i==h.mixIn&&(c.bendDirection=o[o.length+hn.PREV_BEND_DIRECTION],c.compress=0!=o[o.length+hn.PREV_COMPRESS],c.stretch=0!=o[o.length+hn.PREV_STRETCH])));const d=qe.binarySearch(o,n,hn.ENTRIES),u=o[d+hn.PREV_MIX],m=o[d],f=this.getCurvePercent(d/hn.ENTRIES-1,1-(n-m)/(o[d+hn.PREV_TIME]-m));r==l.setup?(c.mix=c.data.mix+(u+(o[d+hn.MIX]-u)*f-c.data.mix)*a,i==h.mixOut?(c.bendDirection=c.data.bendDirection,c.compress=c.data.compress,c.stretch=c.data.stretch):(c.bendDirection=o[d+hn.PREV_BEND_DIRECTION],c.compress=0!=o[d+hn.PREV_COMPRESS],c.stretch=0!=o[d+hn.PREV_STRETCH])):(c.mix+=(u+(o[d+hn.MIX]-u)*f-c.mix)*a,i==h.mixIn&&(c.bendDirection=o[d+hn.PREV_BEND_DIRECTION],c.compress=0!=o[d+hn.PREV_COMPRESS],c.stretch=0!=o[d+hn.PREV_STRETCH]))}};let cn=hn;cn.ENTRIES=5,cn.PREV_TIME=-5,cn.PREV_MIX=-4,cn.PREV_BEND_DIRECTION=-3,cn.PREV_COMPRESS=-2,cn.PREV_STRETCH=-1,cn.MIX=1,cn.BEND_DIRECTION=2,cn.COMPRESS=3,cn.STRETCH=4;const dn=class extends He{constructor(t){super(t),this.frames=Y.newFloatArray(t*dn.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,n,s,a,r){t*=dn.ENTRIES,this.frames[t]=e,this.frames[t+dn.ROTATE]=n,this.frames[t+dn.TRANSLATE]=s,this.frames[t+dn.SCALE]=a,this.frames[t+dn.SHEAR]=r}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(n=o[o.length-dn.ENTRIES]){const t=o.length;c=o[t+dn.PREV_ROTATE],d=o[t+dn.PREV_TRANSLATE],u=o[t+dn.PREV_SCALE],m=o[t+dn.PREV_SHEAR]}else{const t=qe.binarySearch(o,n,dn.ENTRIES);c=o[t+dn.PREV_ROTATE],d=o[t+dn.PREV_TRANSLATE],u=o[t+dn.PREV_SCALE],m=o[t+dn.PREV_SHEAR];const e=o[t],s=this.getCurvePercent(t/dn.ENTRIES-1,1-(n-e)/(o[t+dn.PREV_TIME]-e));c+=(o[t+dn.ROTATE]-c)*s,d+=(o[t+dn.TRANSLATE]-d)*s,u+=(o[t+dn.SCALE]-u)*s,m+=(o[t+dn.SHEAR]-m)*s}if(r==l.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 un=dn;un.ENTRIES=5,un.PREV_TIME=-5,un.PREV_ROTATE=-4,un.PREV_TRANSLATE=-3,un.PREV_SCALE=-2,un.PREV_SHEAR=-1,un.ROTATE=1,un.TRANSLATE=2,un.SCALE=3,un.SHEAR=4;const mn=class extends He{constructor(t){super(t),this.frames=Y.newFloatArray(t*mn.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,n){t*=mn.ENTRIES,this.frames[t]=e,this.frames[t+mn.VALUE]=n}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(n=o[o.length-mn.ENTRIES])c=o[o.length+mn.PREV_VALUE];else{const t=qe.binarySearch(o,n,mn.ENTRIES);c=o[t+mn.PREV_VALUE];const e=o[t],s=this.getCurvePercent(t/mn.ENTRIES-1,1-(n-e)/(o[t+mn.PREV_TIME]-e));c+=(o[t+mn.VALUE]-c)*s}r==l.setup?h.position=h.data.position+(c-h.data.position)*a:h.position+=(c-h.position)*a}};let fn=mn;fn.ENTRIES=2,fn.PREV_TIME=-2,fn.PREV_VALUE=-1,fn.VALUE=1;class gn extends fn{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(n=o[o.length-gn.ENTRIES])c=o[o.length+gn.PREV_VALUE];else{const t=qe.binarySearch(o,n,gn.ENTRIES);c=o[t+gn.PREV_VALUE];const e=o[t],s=this.getCurvePercent(t/gn.ENTRIES-1,1-(n-e)/(o[t+gn.PREV_TIME]-e));c+=(o[t+gn.VALUE]-c)*s}r==l.setup?h.spacing=h.data.spacing+(c-h.data.spacing)*a:h.spacing+=(c-h.spacing)*a}}const pn=class extends He{constructor(t){super(t),this.frames=Y.newFloatArray(t*pn.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,n,s){t*=pn.ENTRIES,this.frames[t]=e,this.frames[t+pn.ROTATE]=n,this.frames[t+pn.TRANSLATE]=s}apply(t,e,n,s,a,r,i){const o=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(n=o[o.length-pn.ENTRIES])c=o[o.length+pn.PREV_ROTATE],d=o[o.length+pn.PREV_TRANSLATE];else{const t=qe.binarySearch(o,n,pn.ENTRIES);c=o[t+pn.PREV_ROTATE],d=o[t+pn.PREV_TRANSLATE];const e=o[t],s=this.getCurvePercent(t/pn.ENTRIES-1,1-(n-e)/(o[t+pn.PREV_TIME]-e));c+=(o[t+pn.ROTATE]-c)*s,d+=(o[t+pn.TRANSLATE]-d)*s}r==l.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 xn=pn;xn.ENTRIES=3,xn.PREV_TIME=-3,xn.PREV_ROTATE=-2,xn.PREV_TRANSLATE=-1,xn.ROTATE=1,xn.TRANSLATE=2;const wn=class{constructor(t){this.tracks=new Array,this.events=new Array,this.listeners=new Array,this.queue=new Mn(this),this.propertyIDs=new A,this.animationsChanged=!1,this.timeScale=1,this.trackEntryPool=new X((()=>new yn)),this.data=t}update(t){t*=this.timeScale;const e=this.tracks;for(let n=0,s=e.length;n0){if(s.delay-=a,s.delay>0)continue;a=-s.delay,s.delay=0}let r=s.next;if(null!=r){const e=s.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime=0==s.timeScale?0:(e/s.timeScale+t)*r.timeScale,s.trackTime+=a,this.setCurrent(n,r,!0);null!=r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(s.trackLast>=s.trackEnd&&null==s.mixingFrom){e[n]=null,this.queue.end(s),this.disposeNext(s);continue}if(null!=s.mixingFrom&&this.updateMixingFrom(s,t)){let t=s.mixingFrom;for(s.mixingFrom=null,null!=t&&(t.mixingTo=null);null!=t;)this.queue.end(t),t=t.mixingFrom}s.trackTime+=a}this.queue.drain()}updateMixingFrom(t,e){const n=t.mixingFrom;if(null==n)return!0;const s=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,null!=n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),s):(n.trackTime+=e*n.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,n=this.tracks;let s=!1;for(let a=0,r=n.length;a0)continue;s=!0;const i=0==a?l.first:r.mixBlend;let o=r.alpha;null!=r.mixingFrom?o*=this.applyMixingFrom(r,t,i):r.trackTime>=r.trackEnd&&null==r.next&&(o=0);const c=r.animationLast,d=r.getAnimationTime(),u=r.animation.timelines.length,m=r.animation.timelines;if(0==a&&1==o||i==l.add)for(let n=0;n1&&(a=1),n!=l.first&&(n=s.mixBlend));const r=a0&&this.queueEvents(s,d),this.events.length=0,s.nextAnimationLast=d,s.nextTrackLast=s.trackTime,a}applyRotateTimeline(t,e,n,s,a,r,i,o){if(o&&(r[i]=0),1==s)return void t.apply(e,0,n,null,1,a,h.mixIn);const c=t,d=c.frames,u=e.bones[c.boneIndex];let m=0,f=0;if(n=d[d.length-Ge.ENTRIES])f=u.data.rotation+d[d.length+Ge.PREV_ROTATION];else{const t=qe.binarySearch(d,n,Ge.ENTRIES),e=d[t+Ge.PREV_ROTATION],s=d[t],a=c.getCurvePercent((t>>1)-1,1-(n-s)/(d[t+Ge.PREV_TIME]-s));f=d[t+Ge.ROTATION]-e,f-=360*(16384-(16384.499999999996-f/360|0)),f=e+f*a+u.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}let g=0,p=f-m;if(p-=360*(16384-(16384.499999999996-p/360|0)),0==p)g=r[i];else{let t=0,e=0;o?(t=0,e=p):(t=r[i],e=r[i+1]);const n=p>0;let s=t>=0;C.signum(e)!=C.signum(p)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*C.signum(t)),s=n),g=p+t-t%360,s!=n&&(g+=360*C.signum(t)),r[i]=g}r[i+1]=p,m+=g*s,u.rotation=m-360*(16384-(16384.499999999996-m/360|0))}queueEvents(t,e){const n=t.animationStart,s=t.animationEnd,a=s-n,r=t.trackLast%a,i=this.events;let o=0;const l=i.length;for(;os||this.queue.event(t,e)}let h=!1;for(h=t.loop?0==a||r>t.trackTime%a:e>=s&&t.animationLast=this.tracks.length)return;const e=this.tracks[t];if(null==e)return;this.queue.end(e),this.disposeNext(e);let n=e;for(;;){const t=n.mixingFrom;if(null==t)break;this.queue.end(t),n.mixingFrom=null,n.mixingTo=null,n=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,n){const s=this.expandToIndex(t);this.tracks[t]=e,null!=s&&(n&&this.queue.interrupt(s),e.mixingFrom=s,s.mixingTo=e,e.mixTime=0,null!=s.mixingFrom&&s.mixDuration>0&&(e.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,n){const s=this.data.skeletonData.findAnimation(e);if(null==s)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,s,n)}setAnimationWith(t,e,n){if(null==e)throw new Error("animation cannot be null.");let s=!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,s=!1):this.disposeNext(a));const r=this.trackEntry(t,e,n,a);return this.setCurrent(t,r,s),this.queue.drain(),r}addAnimation(t,e,n,s){const a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,a,n,s)}addAnimationWith(t,e,n,s){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,n,a);if(null==a)this.setCurrent(t,r,!0),this.queue.drain();else if(a.next=r,s<=0){const t=a.animationEnd-a.animationStart;0!=t?(a.loop?s+=t*(1+(a.trackTime/t|0)):s+=Math.max(t,a.trackTime),s-=this.data.getMix(a.animation,e)):s=a.trackTime}return r.delay=s,r}setEmptyAnimation(t,e){const n=this.setAnimationWith(t,wn.emptyAnimation,!1);return n.mixDuration=e,n.trackEnd=e,n}addEmptyAnimation(t,e,n){n<=0&&(n-=e);const s=this.addAnimationWith(t,wn.emptyAnimation,!1,n);return s.mixDuration=e,s.trackEnd=e,s}setEmptyAnimations(t){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,n=this.tracks.length;e0){a[o]=wn.HOLD_MIX,r[o]=n;continue t}break}a[o]=wn.HOLD}else a[o]=wn.FIRST;else a[o]=wn.SUBSEQUENT}}hasTimeline(t,e){const n=t.animation.timelines;for(let t=0,s=n.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,n){wn.deprecatedWarning1||(wn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,n)}addAnimationByName(t,e,n,s){wn.deprecatedWarning2||(wn.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,n,s)}hasAnimation(t){return null!==this.data.skeletonData.findAnimation(t)}hasAnimationByName(t){return wn.deprecatedWarning3||(wn.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let bn=wn;bn.emptyAnimation=new qe("",[],0),bn.SUBSEQUENT=0,bn.FIRST=1,bn.HOLD=2,bn.HOLD_MIX=3,bn.deprecatedWarning1=!1,bn.deprecatedWarning2=!1,bn.deprecatedWarning3=!1;const En=class{constructor(){this.mixBlend=l.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 En.deprecatedWarning1||(En.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(t){En.deprecatedWarning1||(En.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=t}get endTime(){return En.deprecatedWarning2||(En.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(t){En.deprecatedWarning2||(En.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 yn=En;yn.deprecatedWarning1=!1,yn.deprecatedWarning2=!1;const Sn=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(An.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(An.interrupt),this.objects.push(t)}end(t){this.objects.push(An.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(An.dispose),this.objects.push(t)}complete(t){this.objects.push(An.complete),this.objects.push(t)}event(t,e){this.objects.push(An.event),this.objects.push(t),this.objects.push(e)}deprecateStuff(){return Sn.deprecatedWarning1||(Sn.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 n=0;n(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))(An||{});class Tn{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const In=class{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,n){const s=this.skeletonData.findAnimation(t);if(null==s)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(s,a,n)}setMixByName(t,e,n){In.deprecatedWarning1||(In.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(t,e,n)}setMixWith(t,e,n){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");const s=`${t.name}.${e.name}`;this.animationToMixTime[s]=n}getMix(t,e){const n=`${t.name}.${e.name}`,s=this.animationToMixTime[n];return void 0===s?this.defaultMix:s}};let kn=In;kn.deprecatedWarning1=!1;class Rn{constructor(t){this.atlas=t}newRegionAttachment(t,e,n){const s=this.atlas.findRegion(n);if(null==s)throw new Error(`Region not found in atlas: ${n} (region attachment: ${e})`);const a=new Le(e);return a.region=s,a}newMeshAttachment(t,e,n){const s=this.atlas.findRegion(n);if(null==s)throw new Error(`Region not found in atlas: ${n} (mesh attachment: ${e})`);const a=new Ye(e);return a.region=s,a}newBoundingBoxAttachment(t,e){return new Pe(e)}newPathAttachment(t,e){return new Ne(e)}newPointAttachment(t,e){return new Xe(e)}newClippingAttachment(t,e){return new Fe(e)}}class Cn{constructor(t,e,n){if(this.matrix=new m.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=n,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,n,s,a,r,i){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=s,this.ascaleY=a,this.ashearX=r,this.ashearY=i,this.appliedValid=!0;const o=this.parent,l=this.matrix,h=this.skeleton.scaleX,c=O.yDown?-this.skeleton.scaleY:this.skeleton.scaleY;if(null==o){const o=this.skeleton,d=n+90+i;return l.a=C.cosDeg(n+r)*s*h,l.c=C.cosDeg(d)*a*h,l.b=C.sinDeg(n+r)*s*c,l.d=C.sinDeg(d)*a*c,l.tx=t*h+o.x,void(l.ty=e*c+o.y)}let d=o.matrix.a,m=o.matrix.c,f=o.matrix.b,g=o.matrix.d;switch(l.tx=d*t+m*e+o.matrix.tx,l.ty=f*t+g*e+o.matrix.ty,this.data.transformMode){case u.Normal:{const t=n+90+i,e=C.cosDeg(n+r)*s,o=C.cosDeg(t)*a,h=C.sinDeg(n+r)*s,c=C.sinDeg(t)*a;return l.a=d*e+m*h,l.c=d*o+m*c,l.b=f*e+g*h,void(l.d=f*o+g*c)}case u.OnlyTranslation:{const t=n+90+i;l.a=C.cosDeg(n+r)*s,l.c=C.cosDeg(t)*a,l.b=C.sinDeg(n+r)*s,l.d=C.sinDeg(t)*a;break}case u.NoRotationOrReflection:{let t=d*d+f*f,e=0;t>1e-4?(t=Math.abs(d*g-m*f)/t,m=f*t,g=d*t,e=Math.atan2(f,d)*C.radDeg):(d=0,f=0,e=90-Math.atan2(g,m)*C.radDeg);const o=n+r-e,h=n+i-e+90,c=C.cosDeg(o)*s,u=C.cosDeg(h)*a,p=C.sinDeg(o)*s,x=C.sinDeg(h)*a;l.a=d*c-m*p,l.c=d*u-m*x,l.b=f*c+g*p,l.d=f*u+g*x;break}case u.NoScale:case u.NoScaleOrReflection:{const t=C.cosDeg(n),e=C.sinDeg(n);let o=(d*t+m*e)/h,p=(f*t+g*e)/c,x=Math.sqrt(o*o+p*p);x>1e-5&&(x=1/x),o*=x,p*=x,x=Math.sqrt(o*o+p*p),this.data.transformMode==u.NoScale&&d*g-m*f<0!=(O.yDown?this.skeleton.scaleX<0!=this.skeleton.scaleY>0:this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);const w=Math.PI/2+Math.atan2(p,o),b=Math.cos(w)*x,E=Math.sin(w)*x,y=C.cosDeg(r)*s,S=C.cosDeg(90+i)*a,M=C.sinDeg(r)*s,A=C.sinDeg(90+i)*a;l.a=o*y+b*M,l.c=o*S+b*A,l.b=p*y+E*M,l.d=p*S+E*A;break}}l.a*=h,l.c*=h,l.b*=c,l.d*=c}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)*C.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*C.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)*C.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)*C.radDeg);const n=t.matrix,s=1/(n.a*n.d-n.b*n.c),a=e.tx-n.tx,r=e.ty-n.ty;this.ax=a*n.d*s-r*n.c*s,this.ay=r*n.a*s-a*n.b*s;const i=s*n.d,o=s*n.a,l=s*n.c,h=s*n.b,c=i*e.a-l*e.b,d=i*e.c-l*e.d,u=o*e.b-h*e.a,m=o*e.d-h*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+u*u),this.ascaleX>1e-4){const t=c*m-d*u;this.ascaleY=t/this.ascaleX,this.ashearY=Math.atan2(c*d+u*m,t)*C.radDeg,this.arotation=Math.atan2(u,c)*C.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,d)*C.radDeg}worldToLocal(t){const e=this.matrix,n=e.a,s=e.c,a=e.b,r=e.d,i=1/(n*r-s*a),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*r*i-l*s*i,t.y=l*n*i-o*a*i,t}localToWorld(t){const e=this.matrix,n=t.x,s=t.y;return t.x=n*e.a+s*e.c+e.tx,t.y=n*e.b+s*e.d+e.ty,t}worldToLocalRotation(t){const e=C.sinDeg(t),n=C.cosDeg(t),s=this.matrix;return Math.atan2(s.a*e-s.b*n,s.d*n-s.c*e)*C.radDeg}localToWorldRotation(t){const e=C.sinDeg(t),n=C.cosDeg(t),s=this.matrix;return Math.atan2(n*s.b+e*s.d,n*s.a+e*s.c)*C.radDeg}rotateWorld(t){const e=this.matrix,n=e.a,s=e.c,a=e.b,r=e.d,i=C.cosDeg(t),o=C.sinDeg(t);e.a=i*n-o*a,e.c=i*s-o*r,e.b=o*n+i*a,e.d=o*s+i*r,this.appliedValid=!1}}class Vn{constructor(t,e,n){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=u.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=n}}class vn{constructor(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e}}class Pn{constructor(t){this.name=t}}class Fn{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 n=0;n180?m-=360:m<-180&&(m+=360);let f=t.ascaleX,g=t.ascaleY;if(s||a){const e=t.data.length*f,n=Math.sqrt(d*d+u*u);if(s&&ne&&e>1e-4){const t=(n/e-1)*i+1;f*=t,r&&(g*=t)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*i,f,g,t.ashearX,t.ashearY)}apply2(t,e,n,s,a,r,i){if(0==i)return void e.updateWorldTransform();t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const o=t.ax,l=t.ay;let h=t.ascaleX,c=h,d=t.ascaleY,u=e.ascaleX;const m=t.matrix;let f=0,g=0,p=0;h<0?(h=-h,f=180,p=-1):(f=0,p=1),d<0&&(d=-d,p=-p),u<0?(u=-u,g=180):g=0;const x=e.ax;let w=0,b=0,E=0,y=m.a,S=m.c,M=m.b,A=m.d;const T=Math.abs(h-d)<=1e-4;T?(w=e.ay,b=y*x+S*w+m.tx,E=M*x+A*w+m.ty):(w=0,b=y*x+m.tx,E=M*x+m.ty);const I=t.parent.matrix;y=I.a,S=I.c,M=I.b,A=I.d;const k=1/(y*A-S*M);let R=n-I.tx,V=s-I.ty;const v=(R*A-V*S)*k-o,P=(V*y-R*M)*k-l,F=v*v+P*P;R=b-I.tx,V=E-I.ty;const Y=(R*A-V*S)*k-o,N=(V*y-R*M)*k-l,X=Math.sqrt(Y*Y+N*N);let D=e.data.length*u,B=0,L=0;t:if(T){D*=h;let t=(F-X*X-D*D)/(2*X*D);t<-1?t=-1:t>1&&(t=1,r&&X+D>1e-4&&(c*=(Math.sqrt(F)/(X+D)-1)*i+1)),L=Math.acos(t)*a,y=X+D*t,S=D*Math.sin(L),B=Math.atan2(P*y-v*S,v*y+P*S)}else{y=h*D,S=d*D;const t=y*y,e=S*S,n=Math.atan2(P,v);M=e*X*X+t*F-t*e;const s=-2*e*X,r=e-t;if(A=s*s-4*r*M,A>=0){let t=Math.sqrt(A);s<0&&(t=-t),t=-(s+t)/2;const e=t/r,i=M/t,o=Math.abs(e)=-1&&M<=1&&(M=Math.acos(M),R=y*Math.cos(M)+X,V=S*Math.sin(M),A=R*R+V*V,Af&&(u=M,f=A,m=R,g=V)),F<=(l+f)/2?(B=n-Math.atan2(c*a,o),L=i*a):(B=n-Math.atan2(g*a,m),L=u*a)}const _=Math.atan2(w,x)*p;let O=t.arotation;B=(B-_)*C.radDeg+f-O,B>180?B-=360:B<-180&&(B+=360),t.updateWorldTransformWith(o,l,O+B*i,c,t.ascaleY,0,0),O=e.arotation,L=((L+_)*C.radDeg-e.ashearX)*p+g-O,L>180?L-=360:L<-180&&(L+=360),e.updateWorldTransformWith(x,w,O+L*i,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class Yn{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 Nn{constructor(t){this.order=0,this.bones=new Array,this.name=t}}var Xn=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t))(Xn||{});const Dn=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 n=0,s=t.bones.length;n0;if(!(n>0||s))return;const a=this.data,r=a.spacingMode,i=r==Xn.Length,o=a.rotateMode,l=o==d.Tangent,h=o==d.ChainScale,u=this.bones.length,m=l?u:u+1,f=this.bones,g=Y.setArraySize(this.spaces,m);let p=null;const x=this.spacing;if(h||i){h&&(p=Y.setArraySize(this.lengths,u));for(let t=0,e=m-1;t0?C.degRad:-C.degRad}for(let t=0,a=3;tC.PI?c-=C.PI2:c<-C.PI&&(c+=C.PI2),c*=e,m=Math.cos(c),f=Math.sin(c),i.a=m*n-f*o,i.c=m*s-f*h,i.b=f*n+m*o,i.d=f*s+m*h}r.appliedValid=!1}}computeWorldPositions(t,e,n,s,a){const r=this.target;let i=this.position;const o=this.spaces,l=Y.setArraySize(this.positions,3*e+2);let h=null;const c=t.closed;let d=t.worldVerticesLength,u=d/6,m=Dn.NONE;if(!t.constantSpeed){const f=t.lengths;u-=c?1:2;const g=f[u];if(s&&(i*=g),a)for(let t=0;tg){m!=Dn.AFTER&&(m=Dn.AFTER,t.computeWorldVertices(r,d-6,4,h,0,2)),this.addAfterPosition(x-g,h,0,l,a);continue}}for(;;p++){const t=f[p];if(!(x>t)){if(0==p)x/=t;else{const e=f[p-1];x=(x-e)/(t-e)}break}}p!=m&&(m=p,c&&p==u?(t.computeWorldVertices(r,d-4,4,h,0,2),t.computeWorldVertices(r,0,4,h,4,2)):t.computeWorldVertices(r,6*p+2,8,h,0,2)),this.addCurvePosition(x,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],l,a,n||s>0&&0==e)}return l}c?(d+=2,h=Y.setArraySize(this.world,d),t.computeWorldVertices(r,2,d-4,h,0,2),t.computeWorldVertices(r,0,2,h,d-4,2),h[d-2]=h[0],h[d-1]=h[1]):(u--,d-=4,h=Y.setArraySize(this.world,d),t.computeWorldVertices(r,2,d,h,0,2));const f=Y.setArraySize(this.curves,u);let g=0,p=h[0],x=h[1],w=0,b=0,E=0,y=0,S=0,M=0,A=0,T=0,I=0,k=0,R=0,C=0,V=0,v=0;for(let t=0,e=2;tg){this.addAfterPosition(u-g,h,d-4,l,s);continue}}for(;;a++){const t=f[a];if(!(u>t)){if(0==a)u/=t;else{const e=f[a-1];u=(u-e)/(t-e)}break}}if(a!=m){m=a;let t=6*a;for(p=h[t],x=h[t+1],w=h[t+2],b=h[t+3],E=h[t+4],y=h[t+5],S=h[t+6],M=h[t+7],A=.03*(p-2*w+E),T=.03*(x-2*b+y),I=.006*(3*(w-E)-p+S),k=.006*(3*(b-y)-x+M),R=2*A+I,C=2*T+k,V=.3*(w-p)+A+.16666667*I,v=.3*(b-x)+T+.16666667*k,F=Math.sqrt(V*V+v*v),P[0]=F,t=1;t<8;t++)V+=R,v+=C,R+=I,C+=k,F+=Math.sqrt(V*V+v*v),P[t]=F;V+=R,v+=C,F+=Math.sqrt(V*V+v*v),P[8]=F,V+=R+I,v+=C+k,F+=Math.sqrt(V*V+v*v),P[9]=F,r=0}for(u*=F;;r++){const t=P[r];if(!(u>t)){if(0==r)u/=t;else{const e=P[r-1];u=r+(u-e)/(t-e)}break}}this.addCurvePosition(.1*u,p,x,w,b,E,y,S,M,l,s,n||t>0&&0==e)}return l}addBeforePosition(t,e,n,s,a){const r=e[n],i=e[n+1],o=e[n+2]-r,l=e[n+3]-i,h=Math.atan2(l,o);s[a]=r+t*Math.cos(h),s[a+1]=i+t*Math.sin(h),s[a+2]=h}addAfterPosition(t,e,n,s,a){const r=e[n+2],i=e[n+3],o=r-e[n],l=i-e[n+1],h=Math.atan2(l,o);s[a]=r+t*Math.cos(h),s[a+1]=i+t*Math.sin(h),s[a+2]=h}addCurvePosition(t,e,n,s,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,w=3*x,b=f*w,E=w*t,y=e*p+s*b+r*E+o*m,S=n*p+a*b+i*E+l*m;h[c]=y,h[c+1]=S,d&&(h[c+2]=Math.atan2(S-(n*g+a*x*2+i*u),y-(e*g+s*x*2+r*u)))}getOrder(){return this.data.order}};let Bn=Dn;Bn.NONE=-1,Bn.BEFORE=-2,Bn.AFTER=-3,Bn.epsilon=1e-5;class Ln{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new D,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 n=0;n0?C.degRad:-C.degRad,d=this.data.offsetRotation*c,u=this.data.offsetShearY*c,m=this.bones;for(let r=0,c=m.length;rC.PI?r-=C.PI2:r<-C.PI&&(r+=C.PI2),r*=t;const o=Math.cos(r),h=Math.sin(r);g.a=o*e-h*s,g.c=o*n-h*a,g.b=h*e+o*s,g.d=h*n+o*a,f=!0}if(0!=e){const t=this.temp;a.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.tx+=(t.x-g.tx)*e,g.ty+=(t.y-g.ty)*e,f=!0}if(n>0){let t=Math.sqrt(g.a*g.a+g.b*g.b),e=Math.sqrt(i*i+l*l);t>1e-5&&(t=(t+(e-t+this.data.offsetScaleX)*n)/t),g.a*=t,g.b*=t,t=Math.sqrt(g.c*g.c+g.d*g.d),e=Math.sqrt(o*o+h*h),t>1e-5&&(t=(t+(e-t+this.data.offsetScaleY)*n)/t),g.c*=t,g.d*=t,f=!0}if(s>0){const t=g.c,e=g.d,n=Math.atan2(e,t);let a=Math.atan2(h,o)-Math.atan2(l,i)-(n-Math.atan2(g.b,g.a));a>C.PI?a-=C.PI2:a<-C.PI&&(a+=C.PI2),a=n+(a+u)*s;const r=Math.sqrt(t*t+e*e);g.c=Math.cos(a)*r,g.d=Math.sin(a)*r,f=!0}f&&(c.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,n=this.scaleMix,s=this.shearMix,a=this.target,r=a.matrix,i=r.a,o=r.c,l=r.b,h=r.d,c=i*h-o*l>0?C.degRad:-C.degRad,d=this.data.offsetRotation*c,u=this.data.offsetShearY*c,m=this.bones;for(let r=0,c=m.length;rC.PI?r-=C.PI2:r<-C.PI&&(r+=C.PI2),r*=t;const o=Math.cos(r),h=Math.sin(r);g.a=o*e-h*s,g.c=o*n-h*a,g.b=h*e+o*s,g.d=h*n+o*a,f=!0}if(0!=e){const t=this.temp;a.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),g.tx+=t.x*e,g.ty+=t.y*e,f=!0}if(n>0){let t=(Math.sqrt(i*i+l*l)-1+this.data.offsetScaleX)*n+1;g.a*=t,g.b*=t,t=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleY)*n+1,g.c*=t,g.d*=t,f=!0}if(s>0){let t=Math.atan2(h,o)-Math.atan2(l,i);t>C.PI?t-=C.PI2:t<-C.PI&&(t+=C.PI2);const e=g.c,n=g.d;t=Math.atan2(n,e)+(t-C.PI/2+u)*s;const a=Math.sqrt(e*e+n*n);g.c=Math.cos(t)*a,g.d=Math.sin(t)*a,f=!0}f&&(c.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,n=this.scaleMix,s=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)*n)/d),u>1e-5&&(u=(u+(a.ascaleY-u+this.data.offsetScaleY)*n)/u));const m=o.ashearY;if(s>0){let t=a.ashearY-m+this.data.offsetShearY;t-=360*(16384-(16384.499999999996-t/360|0)),o.shearY+=t*s}o.updateWorldTransformWith(h,c,l,d,u,o.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,n=this.scaleMix,s=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)*n+1),u>1e-5&&(u*=(a.ascaleY-1+this.data.offsetScaleY)*n+1));let m=o.ashearY;s>0&&(m+=(a.ashearY+this.data.offsetShearY)*s),o.updateWorldTransformWith(h,c,l,d,u,o.ashearX,m)}}getOrder(){return this.data.order}}const _n=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=n[n.length-1];this._updateCache.indexOf(t)>-1||this.updateCacheReset.push(t)}this._updateCache.push(t),this.sortReset(s.children),n[n.length-1].sorted=!0}sortPathConstraint(t){const e=t.target,n=e.data.index,s=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,n,s),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,s);for(let t=0,e=this.data.skins.length;t-1||this.updateCacheReset.push(n)}else for(let t=0;t= 0.");if(null==e)throw new Error("name cannot be null.");if(null==n)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=n}}class Un{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 Hn{constructor(t){if(this.attachments=new Array,null==t)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,n){if(null==n)throw new Error("attachment cannot be null.");const s=this.attachments;t>=s.length&&(s.length=t+1),s[t]||(s[t]={}),s[t][e]=n}getAttachment(t,e){const n=this.attachments[t];return n?n[e]:null}attachAll(t,e){let n=0;for(let s=0;s=0;n--)-1==o[n]&&(o[n]=t[--a])}t.setFrame(s++,r.time,o)}a.push(t),r=Math.max(r,t.frames[t.getFrameCount()-1])}if(t.events){const e=new on(t.events.length);let s=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&&(n=this.regions.length-1);const s=this.regions[n];e.region!=s&&(e.region=s)}getPath(t,e){let n=t;const s=(this.start+e).toString();for(let t=this.digits-s.length;t>0;t--)n+="0";return n+=s,n}static nextID(){return is._nextID++}};let os=is;os._nextID=0;var ls=(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))(ls||{});const hs=[0,1,2,3,4,5,6];class cs{constructor(t,e,n){if(this.timelines=[],this.timelineIds=new T,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=n}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 s=0,h=l.length;se)return s-1;return n-1}static search(t,e,n){const s=t.length;for(let a=n;ae)return a-n;return s-n}}class us extends ds{constructor(t,e,n){super(t,n),this.curves=Y.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=Y.newFloatArray(e);Y.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,n,s,a,r,i,o,l,h,c){const d=this.curves;let u=this.getFrameCount()+18*t;0==n&&(d[e]=2+u);const m=.03*(s-2*r+o),f=.03*(a-2*i+l),g=.006*(3*(r-o)-s+h),p=.006*(3*(i-l)-a+c);let x=2*m+g,w=2*f+p,b=.3*(r-s)+m+.16666667*g,E=.3*(i-a)+f+.16666667*p,y=s+b,S=a+E;for(let t=u+18;ut){const r=this.frames[e],i=this.frames[e+n];return i+(t-r)/(a[s]-r)*(a[s+1]-i)}const r=s+18;for(s+=2;s=t){const e=a[s-2],n=a[s-1];return n+(t-e)/(a[s]-e)*(a[s+1]-n)}e+=this.getFrameEntries();const i=a[r-2],o=a[r-1];return o+(t-i)/(this.frames[e]-i)*(this.frames[e+n]-o)}}class ms extends us{constructor(t,e,n){super(t,e,[n])}getFrameEntries(){return 2}setFrame(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+1]=n}getCurveValue(t){const e=this.frames;let n=e.length-2;for(let s=2;s<=n;s+=2)if(e[s]>t){n=s-2;break}const s=this.curves[n>>1];switch(s){case 0:const s=e[n],a=e[n+1];return a+(t-s)/(e[n+2]-s)*(e[n+2+1]-a);case 1:return e[n+1]}return this.getBezierValue(t,n,1,s-2)}}class fs extends us{constructor(t,e,n,s){super(t,e,[n,s])}getFrameEntries(){return 3}setFrame(t,e,n,s){t*=3,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=s}}class gs extends ms{constructor(t,e,n){super(t,e,`0|${n}`),this.boneIndex=0,this.boneIndex=n}apply(t,e,n,s,a,r,i){const o=t.bones[this.boneIndex];if(!o.active)return;if(n>2];switch(g){case 0:const t=h[f];d=h[f+1],u=h[f+2],m=h[f+3];const e=(n-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(n,f,1,g-2),u=this.getBezierValue(n,f,2,g+18-2),m=this.getBezierValue(n,f,3,g+36-2)}if(1==a)c.r=d,c.g=u,c.b=m;else{if(r==l.setup){const t=o.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 ks extends ms{constructor(t,e,n){super(t,e,`8|${n}`),this.slotIndex=0,this.slotIndex=n}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const h=o.color;if(n>3];switch(E){case 0:const t=h[b];u=h[b+1],m=h[b+2],f=h[b+3],g=h[b+4],p=h[b+5],x=h[b+6],w=h[b+7];const e=(n-t)/(h[b+8]-t);u+=(h[b+8+1]-u)*e,m+=(h[b+8+2]-m)*e,f+=(h[b+8+3]-f)*e,g+=(h[b+8+4]-g)*e,p+=(h[b+8+5]-p)*e,x+=(h[b+8+6]-x)*e,w+=(h[b+8+7]-w)*e;break;case 1:u=h[b+1],m=h[b+2],f=h[b+3],g=h[b+4],p=h[b+5],x=h[b+6],w=h[b+7];break;default:u=this.getBezierValue(n,b,1,E-2),m=this.getBezierValue(n,b,2,E+18-2),f=this.getBezierValue(n,b,3,E+36-2),g=this.getBezierValue(n,b,4,E+54-2),p=this.getBezierValue(n,b,5,E+72-2),x=this.getBezierValue(n,b,6,E+90-2),w=this.getBezierValue(n,b,7,E+108-2)}if(1==a)c.set(u,m,f,g),d.r=p,d.g=x,d.b=w;else{if(r==l.setup){c.setFromColor(o.data.color);const t=o.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+=(w-d.b)*a}}}class Cs extends us{constructor(t,e,n){super(t,e,[`7|${n}`,`9|${n}`]),this.slotIndex=0,this.slotIndex=n}getFrameEntries(){return 7}setFrame(t,e,n,s,a,r,i,o){t*=7,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=s,this.frames[t+3]=a,this.frames[t+4]=r,this.frames[t+5]=i,this.frames[t+6]=o}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames,c=o.color,d=o.darkColor;if(nt){const a=this.frames[e];return n[s+1]*(t-a)/(n[s]-a)}const a=s+18;for(s+=2;s=t){const e=n[s-2],a=n[s-1];return a+(t-e)/(n[s]-e)*(n[s+1]-a)}const r=n[a-2],i=n[a-1];return i+(1-i)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const h=o.getAttachment();if(!h)return;if(!(h instanceof Qn)||h.timelineAttachment!=this.attachment)return;const c=o.deform;0==c.length&&(r=l.setup);const d=this.vertices,u=d[0].length,m=this.frames;if(n=m[m.length-1]){const t=d[m.length-1];if(1==a)if(r==l.add){const e=h;if(e.bones)for(let e=0;en)this.apply(t,e,Number.MAX_VALUE,s,a,r,i),e=-1;else if(e>=o[l-1])return;if(n0&&o[h-1]==t;)h--}for(;h=o[h];h++)s.push(this.events[h])}};let Fs=Ps;Fs.propertyIds=["12"];const Ys=class extends ds{constructor(t){super(t,Ys.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,n){this.frames[t]=e,this.drawOrders[t]=n}apply(t,e,n,s,a,r,i){if(i==h.mixOut)return void(r==l.setup&&Y.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(n>2];switch(f){case 0:const t=h[m];c=h[m+1],d=h[m+2],u=h[m+3];const e=(n-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(n,m,1,f-2),d=this.getBezierValue(n,m,2,f+18-2),u=this.getBezierValue(n,m,3,f+36-2)}if(r==l.setup){const t=o.data;o.mixRotate=t.mixRotate+(c-t.mixRotate)*a,o.mixX=t.mixX+(d-t.mixX)*a,o.mixY=t.mixY+(u-t.mixY)*a}else o.mixRotate+=(c-o.mixRotate)*a,o.mixX+=(d-o.mixX)*a,o.mixY+=(u-o.mixY)*a}}const Os=class extends ds{constructor(t,e,n){super(t,[`19|${e}|${n.sequence.id}`]),this.slotIndex=e,this.attachment=n}getFrameEntries(){return Os.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,n,s,a){const r=this.frames;r[t*=Os.ENTRIES]=e,r[t+Os.MODE]=n|s<<4,r[t+Os.DELAY]=a}apply(t,e,n,s,a,r,i){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const h=o.attachment,c=this.attachment;if(!(h==c||h instanceof Qn&&h.timelineAttachment==c))return;const d=this.frames;if(n>4;const x=this.attachment.sequence.regions.length,w=hs[15&f];if(w!=ls.hold)switch(p+=(n-m)/g+1e-5|0,w){case ls.once:p=Math.min(x-1,p);break;case ls.loop:p%=x;break;case ls.pingpong:{const t=(x<<1)-2;p=0==t?0:p%t,p>=x&&(p=t-p);break}case ls.onceReverse:p=Math.max(x-1-p,0);break;case ls.loopReverse:p=x-1-p%x;break;case ls.pingpongReverse:{const t=(x<<1)-2;p=0==t?0:(p+x-1)%t,p>=x&&(p=t-p)}}o.sequenceIndex=p}};let Ws=Os;Ws.ENTRIES=3,Ws.MODE=1,Ws.DELAY=2;const qs=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new zs(this),this.propertyIDs=new T,this.animationsChanged=!1,this.trackEntryPool=new X((()=>new Hs)),this.data=t}static emptyAnimation(){return qs._emptyAnimation}update(t){t*=this.timeScale;const e=this.tracks;for(let n=0,s=e.length;n0){if(s.delay-=a,s.delay>0)continue;a=-s.delay,s.delay=0}let r=s.next;if(r){const e=s.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime+=0==s.timeScale?0:(e/s.timeScale+t)*r.timeScale,s.trackTime+=a,this.setCurrent(n,r,!0);r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(s.trackLast>=s.trackEnd&&!s.mixingFrom){e[n]=null,this.queue.end(s),this.clearNext(s);continue}if(s.mixingFrom&&this.updateMixingFrom(s,t)){let t=s.mixingFrom;for(s.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}s.trackTime+=a}this.queue.drain()}updateMixingFrom(t,e){const n=t.mixingFrom;if(!n)return!0;const s=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),s):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const e=this.events,n=this.tracks;let s=!1;for(let a=0,r=n.length;a0)continue;s=!0;const i=0==a?l.first:r.mixBlend;let o=r.alpha;r.mixingFrom?o*=this.applyMixingFrom(r,t,i):r.trackTime>=r.trackEnd&&!r.next&&(o=0);const c=r.animationLast,d=r.getAnimationTime();let u=d,m=e;r.reverse&&(u=r.animation.duration-u,m=null);const f=r.animation.timelines,g=f.length;if(0==a&&1==o||i==l.add)for(let e=0;e1&&(a=1),n!=l.first&&(n=s.mixBlend));const r=a0&&this.queueEvents(s,f),this.events.length=0,s.nextAnimationLast=f,s.nextTrackLast=s.trackTime,a}applyAttachmentTimeline(t,e,n,s,a){const r=e.slots[t.slotIndex];r.bone.active&&(n0;let s=t>=0;C.signum(e)!=C.signum(f)&&Math.abs(e)<=90&&(Math.abs(t)>180&&(t+=360*C.signum(t)),s=n),m=f+t-t%360,s!=n&&(m+=360*C.signum(t)),r[i]=m}r[i+1]=f,c.rotation=d+m*s}queueEvents(t,e){const n=t.animationStart,s=t.animationEnd,a=s-n,r=t.trackLast%a,i=this.events;let o=0;const l=i.length;for(;os||this.queue.event(t,e)}let h=!1;for(h=t.loop?0==a||r>t.trackTime%a:e>=s&&t.animationLast=this.tracks.length)return;const e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let n=e;for(;;){const t=n.mixingFrom;if(!t)break;this.queue.end(t),n.mixingFrom=null,n.mixingTo=null,n=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,n){const s=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,s&&(n&&this.queue.interrupt(s),e.mixingFrom=s,s.mixingTo=e,e.mixTime=0,s.mixingFrom&&s.mixDuration>0&&(e.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,n=!1){const s=this.data.skeletonData.findAnimation(e);if(!s)throw new Error(`Animation not found: ${e}`);return this.setAnimationWith(t,s,n)}setAnimationWith(t,e,n=!1){if(!e)throw new Error("animation cannot be null.");let s=!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,s=!1):this.clearNext(a));const r=this.trackEntry(t,e,n,a);return this.setCurrent(t,r,s),this.queue.drain(),r}addAnimation(t,e,n=!1,s=0){const a=this.data.skeletonData.findAnimation(e);if(!a)throw new Error(`Animation not found: ${e}`);return this.addAnimationWith(t,a,n,s)}addAnimationWith(t,e,n=!1,s=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,n,a);return a?(a.next=r,r.previous=a,s<=0&&(s+=a.getTrackComplete()-r.mixDuration)):(this.setCurrent(t,r,!0),this.queue.drain()),r.delay=s,r}setEmptyAnimation(t,e=0){const n=this.setAnimationWith(t,qs.emptyAnimation(),!1);return n.mixDuration=e,n.trackEnd=e,n}addEmptyAnimation(t,e=0,n=0){const s=this.addAnimationWith(t,qs.emptyAnimation(),!1,n);return n<=0&&(s.delay+=s.mixDuration-e),s.mixDuration=e,s.trackEnd=e,s}setEmptyAnimations(t=0){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,n=this.tracks.length;e0){a[o]=ta,r[o]=n;continue t}break}a[o]=Js}else a[o]=Zs}}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,n){qs.deprecatedWarning1||(qs.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(t,e,n)}addAnimationByName(t,e,n,s){qs.deprecatedWarning2||(qs.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(t,e,n,s)}hasAnimation(t){return null!==this.data.skeletonData.findAnimation(t)}hasAnimationByName(t){return qs.deprecatedWarning3||(qs.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(t)}};let $s=qs;$s._emptyAnimation=new cs("",[],0),$s.deprecatedWarning1=!1,$s.deprecatedWarning2=!1,$s.deprecatedWarning3=!1;const Us=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=l.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))(Gs||{});class js{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}}const Zs=0,Ks=1,Qs=2,Js=3,ta=4,ea=1,na=2;class sa{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,n){const s=this.skeletonData.findAnimation(t);if(!s)throw new Error(`Animation not found: ${t}`);const a=this.skeletonData.findAnimation(e);if(!a)throw new Error(`Animation not found: ${e}`);this.setMixWith(s,a,n)}setMixWith(t,e,n){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const s=`${t.name}.${e.name}`;this.animationToMixTime[s]=n}getMix(t,e){const n=`${t.name}.${e.name}`,s=this.animationToMixTime[n];return void 0===s?this.defaultMix:s}}class aa{constructor(t){this.atlas=t}loadSequence(t,e,n){const s=n.regions;for(let a=0,r=s.length;a1e-4?(t=Math.abs(d*g-m*f)/t,d/=h,f/=c,m=f*t,g=d*t,e=Math.atan2(f,d)*C.radDeg):(d=0,f=0,e=90-Math.atan2(g,m)*C.radDeg);const o=n+r-e,u=n+i-e+90,p=C.cosDeg(o)*s,x=C.cosDeg(u)*a,w=C.sinDeg(o)*s,b=C.sinDeg(u)*a;l.a=d*p-m*w,l.c=d*x-m*b,l.b=f*p+g*w,l.d=f*x+g*b;break}case u.NoScale:case u.NoScaleOrReflection:{const t=C.cosDeg(n),e=C.sinDeg(n);let o=(d*t+m*e)/h,p=(f*t+g*e)/c,x=Math.sqrt(o*o+p*p);x>1e-5&&(x=1/x),o*=x,p*=x,x=Math.sqrt(o*o+p*p),this.data.transformMode==u.NoScale&&d*g-m*f<0!=(h<0!=c<0)&&(x=-x);const w=Math.PI/2+Math.atan2(p,o),b=Math.cos(w)*x,E=Math.sin(w)*x,y=C.cosDeg(r)*s,S=C.cosDeg(90+i)*a,M=C.sinDeg(r)*s,A=C.sinDeg(90+i)*a;l.a=o*y+b*M,l.c=o*S+b*A,l.b=p*y+E*M,l.d=p*S+E*A;break}}l.a*=h,l.c*=h,l.b*=c,l.d*=c}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)*C.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*C.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)*C.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)*C.radDeg);const n=t.matrix,s=1/(n.a*n.d-n.b*n.c),a=e.tx-n.tx,r=e.ty-n.ty;this.ax=a*n.d*s-r*n.c*s,this.ay=r*n.a*s-a*n.b*s;const i=s*n.d,o=s*n.a,l=s*n.c,h=s*n.b,c=i*e.a-l*e.b,d=i*e.c-l*e.d,u=o*e.b-h*e.a,m=o*e.d-h*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+u*u),this.ascaleX>1e-4){const t=c*m-d*u;this.ascaleY=t/this.ascaleX,this.ashearY=Math.atan2(c*d+u*m,t)*C.radDeg,this.arotation=Math.atan2(u,c)*C.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,d)*C.radDeg}worldToLocal(t){const e=this.matrix,n=e.a,s=e.c,a=e.b,r=e.d,i=1/(n*r-s*a),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*r*i-l*s*i,t.y=l*n*i-o*a*i,t}localToWorld(t){const e=this.matrix,n=t.x,s=t.y;return t.x=n*e.a+s*e.c+e.tx,t.y=n*e.b+s*e.d+e.ty,t}worldToLocalRotation(t){const e=C.sinDeg(t),n=C.cosDeg(t),s=this.matrix;return Math.atan2(s.a*e-s.b*n,s.d*n-s.c*e)*C.radDeg}localToWorldRotation(t){t-=this.rotation-this.shearX;const e=C.sinDeg(t),n=C.cosDeg(t),s=this.matrix;return Math.atan2(n*s.b+e*s.d,n*s.a+e*s.c)*C.radDeg}rotateWorld(t){const e=this.matrix,n=e.a,s=e.c,a=e.b,r=e.d,i=C.cosDeg(t),o=C.sinDeg(t);e.a=i*n-o*a,e.c=i*s-o*r,e.b=o*n+i*a,e.d=o*s+i*r}}class ia{constructor(t,e,n){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=u.Normal,this.skinRequired=!1,this.color=new k,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=n}}class oa{constructor(t,e,n){this.name=t,this.order=e,this.skinRequired=n}}class la{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 ha{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class ca{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 n=0;n180?m-=360:m<-180&&(m+=360);let w=t.ascaleX,b=t.ascaleY;if(s||a){switch(t.data.transformMode){case u.NoScale:case u.NoScaleOrReflection:f=e-t.worldX,g=n-t.worldY}const o=t.data.length*w,l=Math.sqrt(f*f+g*g);if(s&&lo&&o>1e-4){const t=(l/o-1)*i+1;w*=t,r&&(b*=t)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+m*i,w,b,t.ashearX,t.ashearY)}apply2(t,e,n,s,a,r,i,o,l){const h=t.ax,c=t.ay;let d=t.ascaleX,u=t.ascaleY,m=d,f=u,g=e.ascaleX;const p=t.matrix;let x=0,w=0,b=0;d<0?(d=-d,x=180,b=-1):(x=0,b=1),u<0&&(u=-u,b=-b),g<0?(g=-g,w=180):w=0;const E=e.ax;let y=0,S=0,M=0,A=p.a,T=p.c,I=p.b,k=p.d;const R=Math.abs(d-u)<=1e-4;!R||r?(y=0,S=A*E+p.tx,M=I*E+p.ty):(y=e.ay,S=A*E+T*y+p.tx,M=I*E+k*y+p.ty);const V=t.parent.matrix;if(!V)throw new Error("IK parent must itself have a parent.");A=V.a,T=V.c,I=V.b,k=V.d;const v=1/(A*k-T*I);let P=S-V.tx,F=M-V.ty;const Y=(P*k-F*T)*v-h,N=(F*A-P*I)*v-c,X=Math.sqrt(Y*Y+N*N);let D,B,L=e.data.length*g;if(X<1e-4)return this.apply1(t,n,s,!1,r,!1,l),void e.updateWorldTransformWith(E,y,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);P=n-V.tx,F=s-V.ty;let _=(P*k-F*T)*v-h,O=(F*A-P*I)*v-c,W=_*_+O*O;if(0!=o){o*=d*(g+1)*.5;const t=Math.sqrt(W),e=t-X-L*d+o;if(e>0){let n=Math.min(1,e/(2*o))-1;n=(e-o*(1-n*n))/t,_-=n*_,O-=n*O,W=_*_+O*O}}t:if(R){L*=d;let t=(W-X*X-L*L)/(2*X*L);t<-1?(t=-1,B=Math.PI*a):t>1?(t=1,B=0,r&&(A=(Math.sqrt(W)/(X+L)-1)*l+1,m*=A,i&&(f*=A))):B=Math.acos(t)*a,A=X+L*t,T=L*Math.sin(B),D=Math.atan2(O*A-_*T,_*A+O*T)}else{A=d*L,T=u*L;const t=A*A,e=T*T,n=Math.atan2(O,_);I=e*X*X+t*W-t*e;const s=-2*e*X,r=e-t;if(k=s*s-4*r*I,k>=0){let t=Math.sqrt(k);s<0&&(t=-t),t=.5*-(s+t);const e=t/r,i=I/t,o=Math.abs(e)=-1&&I<=1&&(I=Math.acos(I),P=A*Math.cos(I)+X,F=T*Math.sin(I),k=P*P+F*F,kf&&(c=I,f=k,m=P,g=F)),W<=.5*(l+f)?(D=n-Math.atan2(h*a,o),B=i*a):(D=n-Math.atan2(g*a,m),B=c*a)}const q=Math.atan2(y,E)*b;let $=t.arotation;D=(D-q)*C.radDeg+x-$,D>180?D-=360:D<-180&&(D+=360),t.updateWorldTransformWith(h,c,$+D*l,m,f,0,0),$=e.arotation,B=((B+q)*C.radDeg-e.ashearX)*b+w-$,B>180?B-=360:B<-180&&(B+=360),e.updateWorldTransformWith(E,y,$+B*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}class da extends oa{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 ua extends oa{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=c.Fixed,this.spacingMode=ma.Fixed,this.rotateMode=d.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 ma=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(ma||{});const fa=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 n=0,s=t.bones.length;n0){t=h/t*m;for(let e=1;e0?C.degRad:-C.degRad}for(let t=0,a=3;t0){const n=h.a,s=h.c,i=h.b,o=h.d;let d=0,u=0,m=0;if(d=r?f[a-1]:0==c[t+1]?f[a+2]:Math.atan2(E,b),d-=Math.atan2(i,n),w){u=Math.cos(d),m=Math.sin(d);const t=l.data.length;g+=(t*(u*n-m*i)-b)*e,p+=(t*(m*n+u*i)-E)*e}else d+=x;d>C.PI?d-=C.PI2:d<-C.PI&&(d+=C.PI2),d*=e,u=Math.cos(d),m=Math.sin(d),h.a=u*n-m*i,h.c=u*s-m*o,h.b=m*n+u*i,h.d=m*s+u*o}l.updateAppliedTransform()}}computeWorldPositions(t,e,n){const s=this.target;let a=this.position;const r=this.spaces,i=Y.setArraySize(this.positions,3*e+2);let o=this.world;const l=t.closed;let h=t.worldVerticesLength,d=h/6,u=fa.NONE;if(!t.constantSpeed){const m=t.lengths;d-=l?1:2;const f=m[d];let g;switch(this.data.positionMode==c.Percent&&(a*=f),this.data.spacingMode){case ma.Percent:g=f;break;case ma.Proportional:g=f/e;break;default:g=1}o=Y.setArraySize(this.world,8);for(let c=0,p=0,x=0;cf){u!=fa.AFTER&&(u=fa.AFTER,t.computeWorldVertices(s,h-6,4,o,0,2)),this.addAfterPosition(w-f,o,0,i,p);continue}}for(;;x++){const t=m[x];if(!(w>t)){if(0==x)w/=t;else{const e=m[x-1];w=(w-e)/(t-e)}break}}x!=u&&(u=x,l&&x==d?(t.computeWorldVertices(s,h-4,4,o,0,2),t.computeWorldVertices(s,0,4,o,4,2)):t.computeWorldVertices(s,6*x+2,8,o,0,2)),this.addCurvePosition(w,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],i,p,n||c>0&&0==e)}return i}l?(h+=2,o=Y.setArraySize(this.world,h),t.computeWorldVertices(s,2,h-4,o,0,2),t.computeWorldVertices(s,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(d--,h-=4,o=Y.setArraySize(this.world,h),t.computeWorldVertices(s,2,h,o,0,2));const m=Y.setArraySize(this.curves,d);let f,g=0,p=o[0],x=o[1],w=0,b=0,E=0,y=0,S=0,M=0,A=0,T=0,I=0,k=0,R=0,C=0,V=0,v=0;for(let t=0,e=2;tg){this.addAfterPosition(Y-g,o,h-4,i,s);continue}}for(;;c++){const t=m[c];if(!(Y>t)){if(0==c)Y/=t;else{const e=m[c-1];Y=(Y-e)/(t-e)}break}}if(c!=u){u=c;let t=6*c;for(p=o[t],x=o[t+1],w=o[t+2],b=o[t+3],E=o[t+4],y=o[t+5],S=o[t+6],M=o[t+7],A=.03*(p-2*w+E),T=.03*(x-2*b+y),I=.006*(3*(w-E)-p+S),k=.006*(3*(b-y)-x+M),R=2*A+I,C=2*T+k,V=.3*(w-p)+A+.16666667*I,v=.3*(b-x)+T+.16666667*k,F=Math.sqrt(V*V+v*v),P[0]=F,t=1;t<8;t++)V+=R,v+=C,R+=I,C+=k,F+=Math.sqrt(V*V+v*v),P[t]=F;V+=R,v+=C,F+=Math.sqrt(V*V+v*v),P[8]=F,V+=R+I,v+=C+k,F+=Math.sqrt(V*V+v*v),P[9]=F,d=0}for(Y*=F;;d++){const t=P[d];if(!(Y>t)){if(0==d)Y/=t;else{const e=P[d-1];Y=d+(Y-e)/(t-e)}break}}this.addCurvePosition(.1*Y,p,x,w,b,E,y,S,M,i,s,n||t>0&&0==e)}return i}addBeforePosition(t,e,n,s,a){const r=e[n],i=e[n+1],o=e[n+2]-r,l=e[n+3]-i,h=Math.atan2(l,o);s[a]=r+t*Math.cos(h),s[a+1]=i+t*Math.sin(h),s[a+2]=h}addAfterPosition(t,e,n,s,a){const r=e[n+2],i=e[n+3],o=r-e[n],l=i-e[n+1],h=Math.atan2(l,o);s[a]=r+t*Math.cos(h),s[a+1]=i+t*Math.sin(h),s[a+2]=h}addCurvePosition(t,e,n,s,a,r,i,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=n,void(h[c+2]=Math.atan2(a-n,s-e));const u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,w=3*x,b=f*w,E=w*t,y=e*p+s*b+r*E+o*m,S=n*p+a*b+i*E+l*m;h[c]=y,h[c+1]=S,d&&(h[c+2]=t<.001?Math.atan2(a-n,s-e):Math.atan2(S-(n*g+a*x*2+i*u),y-(e*g+s*x*2+r*u)))}};let ga=fa;ga.NONE=-1,ga.BEFORE=-2,ga.AFTER=-3,ga.epsilon=1e-5;class pa{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 k,this.darkColor=t.darkColor?new k:null,this.setToSetupPose(),this.blendMode=this.data.blendMode}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof Qn&&this.attachment instanceof Qn&&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 xa{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 D,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 n=0;n0?C.degRad:-C.degRad,f=this.data.offsetRotation*m,g=this.data.offsetShearY*m,p=this.bones;for(let l=0,m=p.length;lC.PI?r-=C.PI2:r<-C.PI&&(r+=C.PI2),r*=t;const i=Math.cos(r),o=Math.sin(r);x.a=i*e-o*s,x.c=i*n-o*a,x.b=o*e+i*s,x.d=o*n+i*a}if(i){const t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.tx+=(t.x-x.tx)*e,x.ty+=(t.y-x.ty)*n}if(0!=s){let t=Math.sqrt(x.a*x.a+x.b*x.b);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleX)*s)/t),x.a*=t,x.b*=t}if(0!=a){let t=Math.sqrt(x.c*x.c+x.d*x.d);0!=t&&(t=(t+(Math.sqrt(c*c+u*u)-t+this.data.offsetScaleY)*a)/t),x.c*=t,x.d*=t}if(r>0){const t=x.c,e=x.d,n=Math.atan2(e,t);let s=Math.atan2(u,c)-Math.atan2(d,h)-(n-Math.atan2(x.b,x.a));s>C.PI?s-=C.PI2:s<-C.PI&&(s+=C.PI2),s=n+(s+g)*r;const a=Math.sqrt(t*t+e*e);x.c=Math.cos(s)*a,x.d=Math.sin(s)*a}m.updateAppliedTransform()}}applyRelativeWorld(){const t=this.mixRotate,e=this.mixX,n=this.mixY,s=this.mixScaleX,a=this.mixScaleY,r=this.mixShearY,i=0!=e||0!=n,o=this.target,l=o.matrix,h=l.a,c=l.c,d=l.b,u=l.d,m=h*u-c*d>0?C.degRad:-C.degRad,f=this.data.offsetRotation*m,g=this.data.offsetShearY*m,p=this.bones;for(let l=0,m=p.length;lC.PI?r-=C.PI2:r<-C.PI&&(r+=C.PI2),r*=t;const i=Math.cos(r),o=Math.sin(r);x.a=i*e-o*s,x.c=i*n-o*a,x.b=o*e+i*s,x.d=o*n+i*a}if(i){const t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),x.tx+=t.x*e,x.ty+=t.y*n}if(0!=s){const t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleX)*s+1;x.a*=t,x.b*=t}if(0!=a){const t=(Math.sqrt(c*c+u*u)-1+this.data.offsetScaleY)*a+1;x.c*=t,x.d*=t}if(r>0){let t=Math.atan2(u,c)-Math.atan2(d,h);t>C.PI?t-=C.PI2:t<-C.PI&&(t+=C.PI2);const e=x.c,n=x.d;t=Math.atan2(n,e)+(t-C.PI/2+g)*r;const s=Math.sqrt(e*e+n*n);x.c=Math.cos(t)*s,x.d=Math.sin(t)*s}m.updateAppliedTransform()}}applyAbsoluteLocal(){const t=this.mixRotate,e=this.mixX,n=this.mixY,s=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(!n)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=n}}class Sa extends oa{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 Ma{constructor(t,e,n){this.slotIndex=t,this.name=e,this.attachment=n}}class Aa{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,n){if(!n)throw new Error("attachment cannot be null.");const s=this.attachments;t>=s.length&&(s.length=t+1),s[t]||(s[t]={}),s[t][e]=n}addSkin(t){for(let e=0;e>4,t.readFloat())}s.push(e);break}}}}}const r=t.readInt(!0);if(r>0){const e=new Ns(r),a=n.slots.length;for(let n=0;n=0;t--)i[t]=-1;const o=Y.newArray(a-r,0);let l=0,h=0;for(let e=0;e=0;t--)-1==i[t]&&(i[t]=o[--h]);e.setFrame(n,s,i)}s.push(e)}const i=t.readInt(!0);if(i>0){const e=new Fs(i);for(let s=0;s=0;e--)-1==o[e]&&(o[e]=t[--a])}e.setFrame(r,ir(i,"time",0),o)}a.push(e)}if(t.events){const e=new Fs(t.events.length);let s=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))(lr||{});function hr(t){const e=t.substr(0,3),n=Math.floor(10*Number(e)+.001);return"3.7"===e?37:"3.8"===e?38:"4.0"===e?40:"4.1"===e?41:n<37?37:0}class cr{constructor(){this.scale=1}readSkeletonData(t,e){let n=null,s=this.readVersionOldFormat(e),a=hr(s);if(a===lr.VER38&&(n=new Se(new ee(t))),s=this.readVersionNewFormat(e),a=hr(s),a!==lr.VER40&&a!==lr.VER41||(n=new Ta(new aa(t))),!n){const t=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(t)}return n.scale=this.scale,n.readSkeletonData(e)}readVersionOldFormat(t){const e=new o(t);let n;try{e.readString(),n=e.readString()}catch(t){n=""}return n||""}readVersionNewFormat(t){const e=new o(t);let n;e.readInt32(),e.readInt32();try{n=e.readString()}catch(t){n=""}return n||""}}class dr{constructor(){this.scale=1}readSkeletonData(t,e){const n=e.skeleton.spine,s=hr(n);let a=null;if(s===lr.VER37&&(a=new zn(new Rn(t))),s===lr.VER38&&(a=new Ie(new ee(t))),s!==lr.VER40&&s!==lr.VER41||(a=new er(new aa(t))),!a){const t=`Unsupported version of spine model ${n}, please update pixi-spine`;console.error(t)}return a.scale=this.scale,a.readSkeletonData(e)}}class ur extends Z{createSkeleton(t){const e=hr(t.version);let n=null;if(e===lr.VER37&&(n=a),e===lr.VER38&&(n=s),e!==lr.VER40&&e!==lr.VER41||(n=r),!n){const e=`Cant detect version of spine model ${t.version}`;console.error(e)}this.skeleton=new n.Skeleton(t),this.skeleton.updateWorldTransform(),this.stateData=new n.AnimationStateData(t),this.state=new n.AnimationState(this.stateData)}}(new class extends nt{createBinaryParser(){return new cr}createJsonParser(){return new dr}parseData(t,e,n){return{spineData:t.readSkeletonData(e,n),spineAtlas:e}}}).installLoader()}}]);