@esotericsoftware/spine-webgl 4.2.40 → 4.2.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var spine=(()=>{var xt=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,Us=Object.getOwnPropertyNames,_s=Object.prototype.hasOwnProperty,zs=(e,t,i)=>t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ws=(e,t)=>{for(var i in t)xt(e,i,{get:t[i],enumerable:!0})},qs=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Us(t))!_s.call(e,n)&&n!==i&&xt(e,n,{get:()=>t[n],enumerable:!(s=Ns(t,n))||s.enumerable});return e},Gs=e=>qs(xt({},"__esModule",{value:!0}),e),B=(e,t,i)=>(zs(e,typeof t!="symbol"?t+"":t,i),i),ji={};Ws(ji,{AlphaTimeline:()=>si,Animation:()=>bt,AnimationState:()=>ns,AnimationStateAdapter:()=>Js,AnimationStateData:()=>Qs,AssetManager:()=>Cs,AssetManagerBase:()=>gs,AtlasAttachmentLoader:()=>tr,Attachment:()=>zt,AttachmentTimeline:()=>qe,BinaryInput:()=>ys,BlendMode:()=>Yt,Bone:()=>Ii,BoneData:()=>Ti,BoundingBoxAttachment:()=>St,CURRENT:()=>hs,CameraController:()=>Vr,ClippingAttachment:()=>$e,Color:()=>O,Color2Attribute:()=>Is,ColorAttribute:()=>Pt,ConstraintData:()=>dt,CurveTimeline:()=>Re,CurveTimeline1:()=>Ce,CurveTimeline2:()=>wt,DebugUtils:()=>Zs,DeformTimeline:()=>ai,Downloader:()=>Mi,DrawOrderTimeline:()=>Ge,Event:()=>Ei,EventData:()=>Ri,EventQueue:()=>ls,EventTimeline:()=>ht,EventType:()=>ye,FIRST:()=>wi,FakeTexture:()=>$s,GLTexture:()=>ut,HOLD_FIRST:()=>Ct,HOLD_MIX:()=>os,HOLD_SUBSEQUENT:()=>vi,IkConstraint:()=>xs,IkConstraintData:()=>Yi,IkConstraintTimeline:()=>li,Inherit:()=>ct,InheritTimeline:()=>ei,Input:()=>Di,IntSet:()=>Hs,Interpolation:()=>Zi,LoadingScreen:()=>zr,M00:()=>D,M01:()=>q,M02:()=>G,M03:()=>N,M10:()=>H,M11:()=>U,M12:()=>j,M13:()=>_,M20:()=>Z,M21:()=>K,M22:()=>z,M23:()=>W,M30:()=>Q,M31:()=>$,M32:()=>ee,M33:()=>J,ManagedWebGLRenderingContext:()=>be,MathUtils:()=>X,Matrix4:()=>Le,Mesh:()=>Ni,MeshAttachment:()=>De,MixBlend:()=>es,MixDirection:()=>ts,OrthoCamera:()=>Ss,PathAttachment:()=>He,PathConstraint:()=>et,PathConstraintData:()=>ki,PathConstraintMixTimeline:()=>di,PathConstraintPositionTimeline:()=>hi,PathConstraintSpacingTimeline:()=>ci,Physics:()=>ws,PhysicsConstraintDampingTimeline:()=>mi,PhysicsConstraintGravityTimeline:()=>pi,PhysicsConstraintInertiaTimeline:()=>fi,PhysicsConstraintMassTimeline:()=>gi,PhysicsConstraintMixTimeline:()=>bi,PhysicsConstraintResetTimeline:()=>vt,PhysicsConstraintStrengthTimeline:()=>ui,PhysicsConstraintTimeline:()=>Oe,PhysicsConstraintWindTimeline:()=>xi,PointAttachment:()=>Si,PolygonBatcher:()=>it,Pool:()=>lt,Position2Attribute:()=>Xt,Position3Attribute:()=>Dr,PositionMode:()=>It,Pow:()=>Ki,PowOut:()=>js,RGB2Timeline:()=>ni,RGBA2Timeline:()=>ri,RGBATimeline:()=>ti,RGBTimeline:()=>ii,RegionAttachment:()=>ae,ResizeMode:()=>Vt,RotateMode:()=>Et,RotateTimeline:()=>ot,SETUP:()=>yi,SUBSEQUENT:()=>At,ScaleTimeline:()=>jt,ScaleXTimeline:()=>Zt,ScaleYTimeline:()=>Kt,SceneRenderer:()=>ks,SequenceTimeline:()=>Qe,Shader:()=>ge,ShapeRenderer:()=>_i,ShapeType:()=>ve,ShearTimeline:()=>Jt,ShearXTimeline:()=>Qt,ShearYTimeline:()=>$t,Skeleton:()=>ft,SkeletonBinary:()=>sr,SkeletonBounds:()=>As,SkeletonClipping:()=>kt,SkeletonData:()=>Xi,SkeletonDebugRenderer:()=>Lt,SkeletonJson:()=>Br,SkeletonRenderer:()=>Wi,Skin:()=>Rt,SkinEntry:()=>Pi,Slot:()=>ps,SlotData:()=>Li,SpacingMode:()=>Mt,SpineCanvas:()=>Gr,StringSet:()=>Ut,TexCoordAttribute:()=>Ui,Texture:()=>Ai,TextureAtlas:()=>fs,TextureAtlasPage:()=>us,TextureAtlasRegion:()=>Ci,TextureFilter:()=>Tt,TextureRegion:()=>ds,TextureWrap:()=>cs,TimeKeeper:()=>_t,Timeline:()=>ue,Touch:()=>Ts,TrackEntry:()=>as,TransformConstraint:()=>bs,TransformConstraintData:()=>Bi,TransformConstraintTimeline:()=>oi,TranslateTimeline:()=>qt,TranslateXTimeline:()=>Gt,TranslateYTimeline:()=>Ht,Triangulator:()=>Ae,Utils:()=>L,Vector2:()=>We,Vector3:()=>Se,VertexAttachment:()=>Ee,VertexAttribute:()=>tt,VertexAttributeType:()=>je,WindowedMean:()=>Ks});var Hs=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Ut=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var i=0,s=e.length;i<s;i++)this.add(e[i]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},ze=class{constructor(e=0,t=0,i=0,s=0){this.r=e,this.g=t,this.b=i,this.a=s}set(e,t,i,s){return this.r=e,this.g=t,this.b=i,this.a=s,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,i,s){return this.r+=e,this.g+=t,this.b+=i,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}static fromString(e){return new ze().setFromString(e)}},O=ze;B(O,"WHITE",new ze(1,1,1,1)),B(O,"RED",new ze(1,0,0,1)),B(O,"GREEN",new ze(0,1,0,1)),B(O,"BLUE",new ze(0,0,1,1)),B(O,"MAGENTA",new ze(1,0,1,1));var Me=class{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*Me.degRad)}static sinDeg(e){return Math.sin(e*Me.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*Me.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return Me.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,i){let s=Math.random(),n=t-e;return s<=(i-e)/n?e+Math.sqrt(s*n*(i-e)):t-Math.sqrt((1-s)*n*(t-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},X=Me;B(X,"PI",3.1415927),B(X,"PI2",Me.PI*2),B(X,"invPI2",1/Me.PI2),B(X,"radiansToDegrees",180/Me.PI),B(X,"radDeg",Me.radiansToDegrees),B(X,"degreesToRadians",Me.PI/180),B(X,"degRad",Me.degreesToRadians);var Zi=class{apply(e,t,i){return e+(t-e)*this.applyInternal(i)}},Ki=class extends Zi{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},js=class extends Ki{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Je=class{static arrayCopy(e,t,i,s,n){for(let h=t,a=s;h<t+n;h++,a++)i[a]=e[h]}static arrayFill(e,t,i,s){for(let n=t;n<i;n++)e[n]=s}static setArraySize(e,t,i=0){let s=e.length;if(s==t)return e;if(e.length=t,s<t)for(let n=s;n<t;n++)e[n]=i;return e}static ensureArrayCapacity(e,t,i=0){return e.length>=t?e:Je.setArraySize(e,t,i)}static newArray(e,t){let i=new Array(e);for(let s=0;s<e;s++)i[s]=t;return i}static newFloatArray(e){if(Je.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let i=0;i<t.length;i++)t[i]=0;return t}}static newShortArray(e){if(Je.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let i=0;i<t.length;i++)t[i]=0;return t}}static toFloatArray(e){return Je.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Je.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,i=!0){for(var s=0;s<e.length;s++)if(e[s]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},L=Je;B(L,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Zs=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let i=e.bones[t];console.log(i.data.name+", "+i.a+", "+i.b+", "+i.c+", "+i.d+", "+i.worldX+", "+i.worldY)}}},lt=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},We=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},_t=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Ks=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},zt=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},Ji=class extends zt{id=Ji.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,i,s,n,h){i=n+(i>>1)*h;let a=e.bone.skeleton,r=e.deform,o=this.vertices,l=this.bones;if(!l){r.length>0&&(o=r);let u=e.bone,m=u.worldX,g=u.worldY,w=u.a,b=u.b,x=u.c,p=u.d;for(let v=t,y=n;y<i;v+=2,y+=h){let A=o[v],C=o[v+1];s[y]=A*w+C*b+m,s[y+1]=A*x+C*p+g}return}let c=0,d=0;for(let u=0;u<t;u+=2){let m=l[c];c+=m+1,d+=m}let f=a.bones;if(r.length==0)for(let u=n,m=d*3;u<i;u+=h){let g=0,w=0,b=l[c++];for(b+=c;c<b;c++,m+=3){let x=f[l[c]],p=o[m],v=o[m+1],y=o[m+2];g+=(p*x.a+v*x.b+x.worldX)*y,w+=(p*x.c+v*x.d+x.worldY)*y}s[u]=g,s[u+1]=w}else{let u=r;for(let m=n,g=d*3,w=d<<1;m<i;m+=h){let b=0,x=0,p=l[c++];for(p+=c;c<p;c++,g+=3,w+=2){let v=f[l[c]],y=o[g]+u[w],A=o[g+1]+u[w+1],C=o[g+2];b+=(y*v.a+A*v.b+v.worldX)*C,x+=(y*v.c+A*v.d+v.worldY)*C}s[m]=b,s[m+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),L.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=L.newFloatArray(this.vertices.length),L.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},Ee=Ji;B(Ee,"nextID",0);var pt=class{id=pt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new pt(this.regions.length);return L.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let s=this.regions[i];t.region!=s&&(t.region=s,t.updateRegion())}getPath(e,t){let i=e,s=(this.start+t).toString();for(let n=this.digits-s.length;n>0;n--)i+="0";return i+=s,i}static nextID(){return pt._nextID++}},Wt=pt;B(Wt,"_nextID",0);var Qi=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(Qi||{}),$i=[0,1,2,3,4,5,6],bt=class{name;timelines=[];timelineIds=new Ut;duration;constructor(e,t,i){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=i}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,i,s,n,h,a,r){if(!e)throw new Error("skeleton cannot be null.");s&&this.duration!=0&&(i%=this.duration,t>0&&(t%=this.duration));let o=this.timelines;for(let l=0,c=o.length;l<c;l++)o[l].apply(e,t,i,n,h,a,r)}},es=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(es||{}),ts=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ts||{}),re={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},ue=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=L.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let i=e.length;for(let s=1;s<i;s++)if(e[s]>t)return s-1;return i-1}static search(e,t,i){let s=e.length;for(let n=i;n<s;n+=i)if(e[n]>t)return n-i;return s-i}},Re=class extends ue{curves;constructor(e,t,i){super(e,i),this.curves=L.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let i=L.newFloatArray(t);L.arrayCopy(this.curves,0,i,0,t),this.curves=i}}setBezier(e,t,i,s,n,h,a,r,o,l,c){let d=this.curves,f=this.getFrameCount()+e*18;i==0&&(d[t]=2+f);let u=(s-h*2+r)*.03,m=(n-a*2+o)*.03,g=((h-r)*3-s+l)*.006,w=((a-o)*3-n+c)*.006,b=u*2+g,x=m*2+w,p=(h-s)*.3+u+g*.16666667,v=(a-n)*.3+m+w*.16666667,y=s+p,A=n+v;for(let C=f+18;f<C;f+=2)d[f]=y,d[f+1]=A,p+=b,v+=x,b+=g,x+=w,y+=p,A+=v}getBezierValue(e,t,i,s){let n=this.curves;if(n[s]>e){let o=this.frames[t],l=this.frames[t+i];return l+(e-o)/(n[s]-o)*(n[s+1]-l)}let h=s+18;for(s+=2;s<h;s+=2)if(n[s]>=e){let o=n[s-2],l=n[s-1];return l+(e-o)/(n[s]-o)*(n[s+1]-l)}t+=this.getFrameEntries();let a=n[h-2],r=n[h-1];return r+(e-a)/(this.frames[t]-a)*(this.frames[t+i]-r)}},Ce=class extends Re{constructor(e,t,i){super(e,t,[i])}getFrameEntries(){return 2}setFrame(e,t,i){e<<=1,this.frames[e]=t,this.frames[e+1]=i}getCurveValue(e){let t=this.frames,i=t.length-2;for(let n=2;n<=i;n+=2)if(t[n]>e){i=n-2;break}let s=this.curves[i>>1];switch(s){case 0:let n=t[i],h=t[i+1];return h+(e-n)/(t[i+2]-n)*(t[i+2+1]-h);case 1:return t[i+1]}return this.getBezierValue(e,i,1,s-2)}getRelativeValue(e,t,i,s,n){if(e<this.frames[0]){switch(i){case 0:return n;case 1:return s+(n-s)*t}return s}let h=this.getCurveValue(e);switch(i){case 0:return n+h*t;case 1:case 2:h+=n-s}return s+h*t}getAbsoluteValue(e,t,i,s,n){if(e<this.frames[0]){switch(i){case 0:return n;case 1:return s+(n-s)*t}return s}let h=this.getCurveValue(e);return i==0?n+(h-n)*t:s+(h-s)*t}getAbsoluteValue2(e,t,i,s,n,h){if(e<this.frames[0]){switch(i){case 0:return n;case 1:return s+(n-s)*t}return s}return i==0?n+(h-n)*t:s+(h-s)*t}getScaleValue(e,t,i,s,n,h){const a=this.frames;if(e<a[0]){switch(i){case 0:return h;case 1:return n+(h-n)*t}return n}let r=this.getCurveValue(e)*h;if(t==1)return i==3?n+r-h:r;if(s==1)switch(i){case 0:return h+(Math.abs(r)*X.signum(h)-h)*t;case 1:case 2:return n+(Math.abs(r)*X.signum(n)-n)*t}else{let o=0;switch(i){case 0:return o=Math.abs(h)*X.signum(r),o+(r-o)*t;case 1:case 2:return o=Math.abs(n)*X.signum(r),o+(r-o)*t}}return n+(r-h)*t}},wt=class extends Re{constructor(e,t,i,s){super(e,t,[i,s])}getFrameEntries(){return 3}setFrame(e,t,i,s){e*=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s}},ot=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.rotate+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(i,n,h,r.rotation,r.data.rotation))}},qt=class extends wt{boneIndex=0;constructor(e,t,i){super(e,t,re.x+"|"+i,re.y+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*n,r.y+=(r.data.y-r.y)*n}return}let l=0,c=0,d=ue.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];l=o[d+1],c=o[d+2];let m=(i-u)/(o[d+3]-u);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(i,d,1,f-2),c=this.getBezierValue(i,d,2,f+18-2)}switch(h){case 0:r.x=r.data.x+l*n,r.y=r.data.y+c*n;break;case 1:case 2:r.x+=(r.data.x+l-r.x)*n,r.y+=(r.data.y+c-r.y)*n;break;case 3:r.x+=l*n,r.y+=c*n}}},Gt=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.x+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(i,n,h,r.x,r.data.x))}},Ht=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.y+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(i,n,h,r.y,r.data.y))}},jt=class extends wt{boneIndex=0;constructor(e,t,i){super(e,t,re.scaleX+"|"+i,re.scaleY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*n,r.scaleY+=(r.data.scaleY-r.scaleY)*n}return}let l,c,d=ue.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];l=o[d+1],c=o[d+2];let m=(i-u)/(o[d+3]-u);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(i,d,1,f-2),c=this.getBezierValue(i,d,2,f+18-2)}if(l*=r.data.scaleX,c*=r.data.scaleY,n==1)h==3?(r.scaleX+=l-r.data.scaleX,r.scaleY+=c-r.data.scaleY):(r.scaleX=l,r.scaleY=c);else{let u=0,m=0;if(a==1)switch(h){case 0:u=r.data.scaleX,m=r.data.scaleY,r.scaleX=u+(Math.abs(l)*X.signum(u)-u)*n,r.scaleY=m+(Math.abs(c)*X.signum(m)-m)*n;break;case 1:case 2:u=r.scaleX,m=r.scaleY,r.scaleX=u+(Math.abs(l)*X.signum(u)-u)*n,r.scaleY=m+(Math.abs(c)*X.signum(m)-m)*n;break;case 3:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}else switch(h){case 0:u=Math.abs(r.data.scaleX)*X.signum(l),m=Math.abs(r.data.scaleY)*X.signum(c),r.scaleX=u+(l-u)*n,r.scaleY=m+(c-m)*n;break;case 1:case 2:u=Math.abs(r.scaleX)*X.signum(l),m=Math.abs(r.scaleY)*X.signum(c),r.scaleX=u+(l-u)*n,r.scaleY=m+(c-m)*n;break;case 3:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}}}},Zt=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.scaleX+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(i,n,h,a,r.scaleX,r.data.scaleX))}},Kt=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.scaleY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(i,n,h,a,r.scaleY,r.data.scaleY))}},Jt=class extends wt{boneIndex=0;constructor(e,t,i){super(e,t,re.shearX+"|"+i,re.shearY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*n,r.shearY+=(r.data.shearY-r.shearY)*n}return}let l=0,c=0,d=ue.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];l=o[d+1],c=o[d+2];let m=(i-u)/(o[d+3]-u);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(i,d,1,f-2),c=this.getBezierValue(i,d,2,f+18-2)}switch(h){case 0:r.shearX=r.data.shearX+l*n,r.shearY=r.data.shearY+c*n;break;case 1:case 2:r.shearX+=(r.data.shearX+l-r.shearX)*n,r.shearY+=(r.data.shearY+c-r.shearY)*n;break;case 3:r.shearX+=l*n,r.shearY+=c*n}}},Qt=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.shearX+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(i,n,h,r.shearX,r.data.shearX))}},$t=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.shearY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(i,n,h,r.shearY,r.data.shearY))}},ei=class extends ue{boneIndex=0;constructor(e,t){super(e,[re.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,i){e*=2,this.frames[e]=t,this.frames[e+1]=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){(h==0||h==1)&&(r.inherit=r.data.inherit);return}r.inherit=this.frames[ue.search(o,i,2)+1]}},ti=class extends Re{slotIndex=0;constructor(e,t,i){super(e,t,[re.rgb+"|"+i,re.alpha+"|"+i]),this.slotIndex=i}getFrameEntries(){return 5}setFrame(e,t,i,s,n,h){e*=5,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(i<o[0]){let w=r.data.color;switch(h){case 0:l.setFromColor(w);return;case 1:l.add((w.r-l.r)*n,(w.g-l.g)*n,(w.b-l.b)*n,(w.a-l.a)*n)}return}let c=0,d=0,f=0,u=0,m=ue.search(o,i,5),g=this.curves[m/5];switch(g){case 0:let w=o[m];c=o[m+1],d=o[m+2],f=o[m+3],u=o[m+4];let b=(i-w)/(o[m+5]-w);c+=(o[m+5+1]-c)*b,d+=(o[m+5+2]-d)*b,f+=(o[m+5+3]-f)*b,u+=(o[m+5+4]-u)*b;break;case 1:c=o[m+1],d=o[m+2],f=o[m+3],u=o[m+4];break;default:c=this.getBezierValue(i,m,1,g-2),d=this.getBezierValue(i,m,2,g+18-2),f=this.getBezierValue(i,m,3,g+18*2-2),u=this.getBezierValue(i,m,4,g+18*3-2)}n==1?l.set(c,d,f,u):(h==0&&l.setFromColor(r.data.color),l.add((c-l.r)*n,(d-l.g)*n,(f-l.b)*n,(u-l.a)*n))}},ii=class extends Re{slotIndex=0;constructor(e,t,i){super(e,t,[re.rgb+"|"+i]),this.slotIndex=i}getFrameEntries(){return 4}setFrame(e,t,i,s,n){e<<=2,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(i<o[0]){let g=r.data.color;switch(h){case 0:l.r=g.r,l.g=g.g,l.b=g.b;return;case 1:l.r+=(g.r-l.r)*n,l.g+=(g.g-l.g)*n,l.b+=(g.b-l.b)*n}return}let c=0,d=0,f=0,u=ue.search(o,i,4),m=this.curves[u>>2];switch(m){case 0:let g=o[u];c=o[u+1],d=o[u+2],f=o[u+3];let w=(i-g)/(o[u+4]-g);c+=(o[u+4+1]-c)*w,d+=(o[u+4+2]-d)*w,f+=(o[u+4+3]-f)*w;break;case 1:c=o[u+1],d=o[u+2],f=o[u+3];break;default:c=this.getBezierValue(i,u,1,m-2),d=this.getBezierValue(i,u,2,m+18-2),f=this.getBezierValue(i,u,3,m+18*2-2)}if(n==1)l.r=c,l.g=d,l.b=f;else{if(h==0){let g=r.data.color;l.r=g.r,l.g=g.g,l.b=g.b}l.r+=(c-l.r)*n,l.g+=(d-l.g)*n,l.b+=(f-l.b)*n}}},si=class extends Ce{slotIndex=0;constructor(e,t,i){super(e,t,re.alpha+"|"+i),this.slotIndex=i}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.color;if(i<this.frames[0]){let c=r.data.color;switch(h){case 0:o.a=c.a;return;case 1:o.a+=(c.a-o.a)*n}return}let l=this.getCurveValue(i);n==1?o.a=l:(h==0&&(o.a=r.data.color.a),o.a+=(l-o.a)*n)}},ri=class extends Re{slotIndex=0;constructor(e,t,i){super(e,t,[re.rgb+"|"+i,re.alpha+"|"+i,re.rgb2+"|"+i]),this.slotIndex=i}getFrameEntries(){return 8}setFrame(e,t,i,s,n,h,a,r,o){e<<=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h,this.frames[e+5]=a,this.frames[e+6]=r,this.frames[e+7]=o}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(i<o[0]){let v=r.data.color,y=r.data.darkColor;switch(h){case 0:l.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:l.add((v.r-l.r)*n,(v.g-l.g)*n,(v.b-l.b)*n,(v.a-l.a)*n),c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let d=0,f=0,u=0,m=0,g=0,w=0,b=0,x=ue.search(o,i,8),p=this.curves[x>>3];switch(p){case 0:let v=o[x];d=o[x+1],f=o[x+2],u=o[x+3],m=o[x+4],g=o[x+5],w=o[x+6],b=o[x+7];let y=(i-v)/(o[x+8]-v);d+=(o[x+8+1]-d)*y,f+=(o[x+8+2]-f)*y,u+=(o[x+8+3]-u)*y,m+=(o[x+8+4]-m)*y,g+=(o[x+8+5]-g)*y,w+=(o[x+8+6]-w)*y,b+=(o[x+8+7]-b)*y;break;case 1:d=o[x+1],f=o[x+2],u=o[x+3],m=o[x+4],g=o[x+5],w=o[x+6],b=o[x+7];break;default:d=this.getBezierValue(i,x,1,p-2),f=this.getBezierValue(i,x,2,p+18-2),u=this.getBezierValue(i,x,3,p+18*2-2),m=this.getBezierValue(i,x,4,p+18*3-2),g=this.getBezierValue(i,x,5,p+18*4-2),w=this.getBezierValue(i,x,6,p+18*5-2),b=this.getBezierValue(i,x,7,p+18*6-2)}if(n==1)l.set(d,f,u,m),c.r=g,c.g=w,c.b=b;else{if(h==0){l.setFromColor(r.data.color);let v=r.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}l.add((d-l.r)*n,(f-l.g)*n,(u-l.b)*n,(m-l.a)*n),c.r+=(g-c.r)*n,c.g+=(w-c.g)*n,c.b+=(b-c.b)*n}}},ni=class extends Re{slotIndex=0;constructor(e,t,i){super(e,t,[re.rgb+"|"+i,re.rgb2+"|"+i]),this.slotIndex=i}getFrameEntries(){return 7}setFrame(e,t,i,s,n,h,a,r){e*=7,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h,this.frames[e+5]=a,this.frames[e+6]=r}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(i<o[0]){let v=r.data.color,y=r.data.darkColor;switch(h){case 0:l.r=v.r,l.g=v.g,l.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:l.r+=(v.r-l.r)*n,l.g+=(v.g-l.g)*n,l.b+=(v.b-l.b)*n,c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let d=0,f=0,u=0,m=0,g=0,w=0,b=0,x=ue.search(o,i,7),p=this.curves[x/7];switch(p){case 0:let v=o[x];d=o[x+1],f=o[x+2],u=o[x+3],g=o[x+4],w=o[x+5],b=o[x+6];let y=(i-v)/(o[x+7]-v);d+=(o[x+7+1]-d)*y,f+=(o[x+7+2]-f)*y,u+=(o[x+7+3]-u)*y,g+=(o[x+7+4]-g)*y,w+=(o[x+7+5]-w)*y,b+=(o[x+7+6]-b)*y;break;case 1:d=o[x+1],f=o[x+2],u=o[x+3],g=o[x+4],w=o[x+5],b=o[x+6];break;default:d=this.getBezierValue(i,x,1,p-2),f=this.getBezierValue(i,x,2,p+18-2),u=this.getBezierValue(i,x,3,p+18*2-2),g=this.getBezierValue(i,x,4,p+18*3-2),w=this.getBezierValue(i,x,5,p+18*4-2),b=this.getBezierValue(i,x,6,p+18*5-2)}if(n==1)l.r=d,l.g=f,l.b=u,c.r=g,c.g=w,c.b=b;else{if(h==0){let v=r.data.color,y=r.data.darkColor;l.r=v.r,l.g=v.g,l.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}l.r+=(d-l.r)*n,l.g+=(f-l.g)*n,l.b+=(u-l.b)*n,c.r+=(g-c.r)*n,c.g+=(w-c.g)*n,c.b+=(b-c.b)*n}}},qe=class extends ue{slotIndex=0;attachmentNames;constructor(e,t){super(e,[re.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,i){this.frames[e]=t,this.attachmentNames[e]=i}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(r.bone.active){if(a==1){h==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(i<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[ue.search1(this.frames,i)])}}setAttachment(e,t,i){t.setAttachment(i?e.getAttachment(this.slotIndex,i):null)}},ai=class extends Re{slotIndex=0;attachment;vertices;constructor(e,t,i,s){super(e,t,[re.deform+"|"+i+"|"+s.id]),this.slotIndex=i,this.attachment=s,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,i){this.frames[e]=t,this.vertices[e]=i}setBezier(e,t,i,s,n,h,a,r,o,l,c){let d=this.curves,f=this.getFrameCount()+e*18;i==0&&(d[t]=2+f);let u=(s-h*2+r)*.03,m=o*.03-a*.06,g=((h-r)*3-s+l)*.006,w=(a-o+.33333333)*.018,b=u*2+g,x=m*2+w,p=(h-s)*.3+u+g*.16666667,v=a*.3+m+w*.16666667,y=s+p,A=v;for(let C=f+18;f<C;f+=2)d[f]=y,d[f+1]=A,p+=b,v+=x,b+=g,x+=w,y+=p,A+=v}getCurvePercent(e,t){let i=this.curves,s=i[t];switch(s){case 0:let r=this.frames[t];return(e-r)/(this.frames[t+this.getFrameEntries()]-r);case 1:return 0}if(s-=2,i[s]>e){let r=this.frames[t];return i[s+1]*(e-r)/(i[s]-r)}let n=s+18;for(s+=2;s<n;s+=2)if(i[s]>=e){let r=i[s-2],o=i[s-1];return o+(e-r)/(i[s]-r)*(i[s+1]-o)}let h=i[n-2],a=i[n-1];return a+(1-a)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.getAttachment();if(!o||!(o instanceof Ee)||o.timelineAttachment!=this.attachment)return;let l=r.deform;l.length==0&&(h=0);let c=this.vertices,d=c[0].length,f=this.frames;if(i<f[0]){switch(h){case 0:l.length=0;return;case 1:if(n==1){l.length=0;return}l.length=d;let x=o;if(x.bones){n=1-n;for(var u=0;u<d;u++)l[u]*=n}else{let p=x.vertices;for(var u=0;u<d;u++)l[u]+=(p[u]-l[u])*n}}return}if(l.length=d,i>=f[f.length-1]){let x=c[f.length-1];if(n==1)if(h==3){let p=o;if(p.bones)for(let v=0;v<d;v++)l[v]+=x[v];else{let v=p.vertices;for(let y=0;y<d;y++)l[y]+=x[y]-v[y]}}else L.arrayCopy(x,0,l,0,d);else switch(h){case 0:{let v=o;if(v.bones)for(let y=0;y<d;y++)l[y]=x[y]*n;else{let y=v.vertices;for(let A=0;A<d;A++){let C=y[A];l[A]=C+(x[A]-C)*n}}break}case 1:case 2:for(let v=0;v<d;v++)l[v]+=(x[v]-l[v])*n;break;case 3:let p=o;if(p.bones)for(let v=0;v<d;v++)l[v]+=x[v]*n;else{let v=p.vertices;for(let y=0;y<d;y++)l[y]+=(x[y]-v[y])*n}}return}let m=ue.search1(f,i),g=this.getCurvePercent(i,m),w=c[m],b=c[m+1];if(n==1)if(h==3){let x=o;if(x.bones)for(let p=0;p<d;p++){let v=w[p];l[p]+=v+(b[p]-v)*g}else{let p=x.vertices;for(let v=0;v<d;v++){let y=w[v];l[v]+=y+(b[v]-y)*g-p[v]}}}else for(let x=0;x<d;x++){let p=w[x];l[x]=p+(b[x]-p)*g}else switch(h){case 0:{let p=o;if(p.bones)for(let v=0;v<d;v++){let y=w[v];l[v]=(y+(b[v]-y)*g)*n}else{let v=p.vertices;for(let y=0;y<d;y++){let A=w[y],C=v[y];l[y]=C+(A+(b[y]-A)*g-C)*n}}break}case 1:case 2:for(let p=0;p<d;p++){let v=w[p];l[p]+=(v+(b[p]-v)*g-l[p])*n}break;case 3:let x=o;if(x.bones)for(let p=0;p<d;p++){let v=w[p];l[p]+=(v+(b[p]-v)*g)*n}else{let p=x.vertices;for(let v=0;v<d;v++){let y=w[v];l[v]+=(y+(b[v]-y)*g-p[v])*n}}}}},is=class extends ue{events;constructor(e){super(e,is.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,i,s,n,h,a){if(!s)return;let r=this.frames,o=this.frames.length;if(t>i)this.apply(e,t,Number.MAX_VALUE,s,n,h,a),t=-1;else if(t>=r[o-1])return;if(i<r[0])return;let l=0;if(t<r[0])l=0;else{l=ue.search1(r,t)+1;let c=r[l];for(;l>0&&r[l-1]==c;)l--}for(;l<o&&i>=r[l];l++)s.push(this.events[l])}},ht=is;B(ht,"propertyIds",[""+re.event]);var ss=class extends ue{drawOrders;constructor(e){super(e,ss.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,i){this.frames[e]=t,this.drawOrders[e]=i}apply(e,t,i,s,n,h,a){if(a==1){h==0&&L.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(h==0||h==1)&&L.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=ue.search1(this.frames,i),o=this.drawOrders[r];if(!o)L.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let l=e.drawOrder,c=e.slots;for(let d=0,f=o.length;d<f;d++)l[d]=c[o[d]]}}},Ge=ss;B(Ge,"propertyIds",[""+re.drawOrder]);var li=class extends Re{constraintIndex=0;constructor(e,t,i){super(e,t,[re.ikConstraint+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 6}setFrame(e,t,i,s,n,h,a){e*=6,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h?1:0,this.frames[e+5]=a?1:0}apply(e,t,i,s,n,h,a){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*n,r.softness+=(r.data.softness-r.softness)*n,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let l=0,c=0,d=ue.search(o,i,6),f=this.curves[d/6];switch(f){case 0:let u=o[d];l=o[d+1],c=o[d+2];let m=(i-u)/(o[d+6]-u);l+=(o[d+6+1]-l)*m,c+=(o[d+6+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(i,d,1,f-2),c=this.getBezierValue(i,d,2,f+18-2)}h==0?(r.mix=r.data.mix+(l-r.data.mix)*n,r.softness=r.data.softness+(c-r.data.softness)*n,a==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0)):(r.mix+=(l-r.mix)*n,r.softness+=(c-r.softness)*n,a==0&&(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0))}},oi=class extends Re{constraintIndex=0;constructor(e,t,i){super(e,t,[re.transformConstraint+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 7}setFrame(e,t,i,s,n,h,a,r){let o=this.frames;e*=7,o[e]=t,o[e+1]=i,o[e+2]=s,o[e+3]=n,o[e+4]=h,o[e+5]=a,o[e+6]=r}apply(e,t,i,s,n,h,a){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){let b=r.data;switch(h){case 0:r.mixRotate=b.mixRotate,r.mixX=b.mixX,r.mixY=b.mixY,r.mixScaleX=b.mixScaleX,r.mixScaleY=b.mixScaleY,r.mixShearY=b.mixShearY;return;case 1:r.mixRotate+=(b.mixRotate-r.mixRotate)*n,r.mixX+=(b.mixX-r.mixX)*n,r.mixY+=(b.mixY-r.mixY)*n,r.mixScaleX+=(b.mixScaleX-r.mixScaleX)*n,r.mixScaleY+=(b.mixScaleY-r.mixScaleY)*n,r.mixShearY+=(b.mixShearY-r.mixShearY)*n}return}let l,c,d,f,u,m,g=ue.search(o,i,7),w=this.curves[g/7];switch(w){case 0:let b=o[g];l=o[g+1],c=o[g+2],d=o[g+3],f=o[g+4],u=o[g+5],m=o[g+6];let x=(i-b)/(o[g+7]-b);l+=(o[g+7+1]-l)*x,c+=(o[g+7+2]-c)*x,d+=(o[g+7+3]-d)*x,f+=(o[g+7+4]-f)*x,u+=(o[g+7+5]-u)*x,m+=(o[g+7+6]-m)*x;break;case 1:l=o[g+1],c=o[g+2],d=o[g+3],f=o[g+4],u=o[g+5],m=o[g+6];break;default:l=this.getBezierValue(i,g,1,w-2),c=this.getBezierValue(i,g,2,w+18-2),d=this.getBezierValue(i,g,3,w+18*2-2),f=this.getBezierValue(i,g,4,w+18*3-2),u=this.getBezierValue(i,g,5,w+18*4-2),m=this.getBezierValue(i,g,6,w+18*5-2)}if(h==0){let b=r.data;r.mixRotate=b.mixRotate+(l-b.mixRotate)*n,r.mixX=b.mixX+(c-b.mixX)*n,r.mixY=b.mixY+(d-b.mixY)*n,r.mixScaleX=b.mixScaleX+(f-b.mixScaleX)*n,r.mixScaleY=b.mixScaleY+(u-b.mixScaleY)*n,r.mixShearY=b.mixShearY+(m-b.mixShearY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(d-r.mixY)*n,r.mixScaleX+=(f-r.mixScaleX)*n,r.mixScaleY+=(u-r.mixScaleY)*n,r.mixShearY+=(m-r.mixShearY)*n}},hi=class extends Ce{constraintIndex=0;constructor(e,t,i){super(e,t,re.pathConstraintPosition+"|"+i),this.constraintIndex=i}apply(e,t,i,s,n,h,a){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(i,n,h,r.position,r.data.position))}},ci=class extends Ce{constraintIndex=0;constructor(e,t,i){super(e,t,re.pathConstraintSpacing+"|"+i),this.constraintIndex=i}apply(e,t,i,s,n,h,a){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(i,n,h,r.spacing,r.data.spacing))}},di=class extends Re{constraintIndex=0;constructor(e,t,i){super(e,t,[re.pathConstraintMix+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 4}setFrame(e,t,i,s,n){let h=this.frames;e<<=2,h[e]=t,h[e+1]=i,h[e+2]=s,h[e+3]=n}apply(e,t,i,s,n,h,a){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*n,r.mixX+=(r.data.mixX-r.mixX)*n,r.mixY+=(r.data.mixY-r.mixY)*n}return}let l,c,d,f=ue.search(o,i,4),u=this.curves[f>>2];switch(u){case 0:let m=o[f];l=o[f+1],c=o[f+2],d=o[f+3];let g=(i-m)/(o[f+4]-m);l+=(o[f+4+1]-l)*g,c+=(o[f+4+2]-c)*g,d+=(o[f+4+3]-d)*g;break;case 1:l=o[f+1],c=o[f+2],d=o[f+3];break;default:l=this.getBezierValue(i,f,1,u-2),c=this.getBezierValue(i,f,2,u+18-2),d=this.getBezierValue(i,f,3,u+18*2-2)}if(h==0){let m=r.data;r.mixRotate=m.mixRotate+(l-m.mixRotate)*n,r.mixX=m.mixX+(c-m.mixX)*n,r.mixY=m.mixY+(d-m.mixY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(d-r.mixY)*n}},Oe=class extends Ce{constraintIndex=0;constructor(e,t,i,s){super(e,t,s+"|"+i),this.constraintIndex=i}apply(e,t,i,s,n,h,a){let r;if(this.constraintIndex==-1){const o=i>=this.frames[0]?this.getCurveValue(i):0;for(const l of e.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(i,n,h,this.get(l),this.setup(l),o))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(i,n,h,this.get(r),this.setup(r)))}},fi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},ui=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},mi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},gi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},xi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},pi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},bi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},rs=class extends ue{constraintIndex;constructor(e,t){super(e,rs.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,i,s,n,h,a){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;const o=this.frames;if(t>i)this.apply(e,t,Number.MAX_VALUE,[],n,h,a),t=-1;else if(t>=o[o.length-1])return;if(!(i<o[0])&&(t<o[0]||i>=o[ue.search1(o,t)+1]))if(r!=null)r.reset();else for(const l of e.physicsConstraints)l.active&&l.reset()}},vt=rs;B(vt,"propertyIds",[re.physicsConstraintReset.toString()]);var Ve=class extends ue{slotIndex;attachment;constructor(e,t,i){super(e,[re.sequence+"|"+t+"|"+i.sequence.id]),this.slotIndex=t,this.attachment=i}getFrameEntries(){return Ve.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,i,s,n){let h=this.frames;e*=Ve.ENTRIES,h[e]=t,h[e+Ve.MODE]=i|s<<4,h[e+Ve.DELAY]=n}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.attachment,l=this.attachment;if(o!=l&&(!(o instanceof Ee)||o.timelineAttachment!=l))return;let c=this.frames;if(i<c[0]){(h==0||h==1)&&(r.sequenceIndex=-1);return}let d=ue.search(c,i,Ve.ENTRIES),f=c[d],u=c[d+Ve.MODE],m=c[d+Ve.DELAY];if(!this.attachment.sequence)return;let g=u>>4,w=this.attachment.sequence.regions.length,b=$i[u&15];if(b!=0)switch(g+=(i-f)/m+1e-5|0,b){case 1:g=Math.min(w-1,g);break;case 2:g%=w;break;case 3:{let x=(w<<1)-2;g=x==0?0:g%x,g>=w&&(g=x-g);break}case 4:g=Math.max(w-1-g,0);break;case 5:g=w-1-g%w;break;case 6:{let x=(w<<1)-2;g=x==0?0:(g+w-1)%x,g>=w&&(g=x-g)}}r.sequenceIndex=g}},Qe=Ve;B(Qe,"ENTRIES",3),B(Qe,"MODE",1),B(Qe,"DELAY",2);var yt=class{static emptyAnimation(){return yt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ls(this);propertyIDs=new Ut;animationsChanged=!1;trackEntryPool=new lt(()=>new as);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let h=e*n.timeScale;if(n.delay>0){if(n.delay-=h,n.delay>0)continue;h=-n.delay,n.delay=0}let a=n.next;if(a){let r=n.trackLast-a.delay;if(r>=0){for(a.delay=0,a.trackTime+=n.timeScale==0?0:(r/n.timeScale+e)*a.timeScale,n.trackTime+=h,this.setCurrent(i,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){t[i]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,e)){let r=n.mixingFrom;for(n.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}n.trackTime+=h}this.queue.drain()}updateMixingFrom(e,t){let i=e.mixingFrom;if(!i)return!0;let s=this.updateMixingFrom(i,t);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),s):(i.trackTime+=t*i.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,i=this.tracks,s=!1;for(let d=0,f=i.length;d<f;d++){let u=i[d];if(!u||u.delay>0)continue;s=!0;let m=d==0?1:u.mixBlend,g=u.alpha;u.mixingFrom?g*=this.applyMixingFrom(u,e,m):u.trackTime>=u.trackEnd&&!u.next&&(g=0);let w=g>=u.alphaAttachmentThreshold,b=u.animationLast,x=u.getAnimationTime(),p=x,v=t;u.reverse&&(p=u.animation.duration-p,v=null);let y=u.animation.timelines,A=y.length;if(d==0&&g==1||m==3){d==0&&(w=!0);for(let C=0;C<A;C++){L.webkit602BugfixHelper(g,m);var n=y[C];n instanceof qe?this.applyAttachmentTimeline(n,e,p,m,w):n.apply(e,b,p,v,g,m,0)}}else{let C=u.timelineMode,I=u.shortestRotation,R=!I&&u.timelinesRotation.length!=A<<1;R&&(u.timelinesRotation.length=A<<1);for(let Y=0;Y<A;Y++){let k=y[Y],F=C[Y]==At?m:0;!I&&k instanceof ot?this.applyRotateTimeline(k,e,p,g,F,u.timelinesRotation,Y<<1,R):k instanceof qe?this.applyAttachmentTimeline(k,e,p,m,w):(L.webkit602BugfixHelper(g,m),k.apply(e,b,p,v,g,F,0))}}this.queueEvents(u,x),t.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var h=this.unkeyedState+yi,a=e.slots,r=0,o=e.slots.length;r<o;r++){var l=a[r];if(l.attachmentState==h){var c=l.data.attachmentName;l.setAttachment(c?e.getAttachment(l.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(e,t,i){let s=e.mixingFrom;s.mixingFrom&&this.applyMixingFrom(s,t,i);let n=0;e.mixDuration==0?(n=1,i==1&&(i=0)):(n=e.mixTime/e.mixDuration,n>1&&(n=1),i!=1&&(i=s.mixBlend));let h=n<s.mixAttachmentThreshold,a=n<s.mixDrawOrderThreshold,r=s.animation.timelines,o=r.length,l=s.alpha*e.interruptAlpha,c=l*(1-n),d=s.animationLast,f=s.getAnimationTime(),u=f,m=null;if(s.reverse?u=s.animation.duration-u:n<s.eventThreshold&&(m=this.events),i==3)for(let g=0;g<o;g++)r[g].apply(t,d,u,m,c,i,1);else{let g=s.timelineMode,w=s.timelineHoldMix,b=s.shortestRotation,x=!b&&s.timelinesRotation.length!=o<<1;x&&(s.timelinesRotation.length=o<<1),s.totalAlpha=0;for(let p=0;p<o;p++){let v=r[p],y=1,A,C=0;switch(g[p]){case At:if(!a&&v instanceof Ge)continue;A=i,C=c;break;case wi:A=0,C=c;break;case vi:A=i,C=l;break;case Ct:A=0,C=l;break;default:A=0;let I=w[p];C=l*Math.max(0,1-I.mixTime/I.mixDuration);break}s.totalAlpha+=C,!b&&v instanceof ot?this.applyRotateTimeline(v,t,u,C,A,s.timelinesRotation,p<<1,x):v instanceof qe?this.applyAttachmentTimeline(v,t,u,A,h&&C>=s.alphaAttachmentThreshold):(L.webkit602BugfixHelper(C,i),a&&v instanceof Ge&&A==0&&(y=0),v.apply(t,d,u,m,C,A,y))}}return e.mixDuration>0&&this.queueEvents(s,f),this.events.length=0,s.nextAnimationLast=f,s.nextTrackLast=s.trackTime,n}applyAttachmentTimeline(e,t,i,s,n){var h=t.slots[e.slotIndex];h.bone.active&&(i<e.frames[0]?(s==0||s==1)&&this.setAttachment(t,h,h.data.attachmentName,n):this.setAttachment(t,h,e.attachmentNames[ue.search1(e.frames,i)],n),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+yi))}setAttachment(e,t,i,s){t.setAttachment(i?e.getAttachment(t.data.index,i):null),s&&(t.attachmentState=this.unkeyedState+hs)}applyRotateTimeline(e,t,i,s,n,h,a,r){if(r&&(h[a]=0),s==1){e.apply(t,0,i,null,1,n,0);return}let o=t.bones[e.boneIndex];if(!o.active)return;let l=e.frames,c=0,d=0;if(i<l[0])switch(n){case 0:o.rotation=o.data.rotation;default:return;case 1:c=o.rotation,d=o.data.rotation}else c=n==0?o.data.rotation:o.rotation,d=o.data.rotation+e.getCurveValue(i);let f=0,u=d-c;if(u-=Math.ceil(u/360-.5)*360,u==0)f=h[a];else{let m=0,g=0;r?(m=0,g=u):(m=h[a],g=h[a+1]);let w=m-m%360;f=u+w;let b=u>=0,x=m>=0;Math.abs(g)<=90&&X.signum(g)!=X.signum(u)&&(Math.abs(m-w)>180?(f+=360*X.signum(m),x=b):w!=0?f-=360*X.signum(m):x=b),x!=b&&(f+=360*X.signum(m)),h[a]=f}h[a+1]=u,o.rotation=c+f*s}queueEvents(e,t){let i=e.animationStart,s=e.animationEnd,n=s-i,h=e.trackLast%n,a=this.events,r=0,o=a.length;for(;r<o;r++){let c=a[r];if(c.time<h)break;c.time>s||this.queue.event(e,c)}let l=!1;if(e.loop)if(n==0)l=!0;else{const c=Math.floor(e.trackTime/n);l=c>0&&c>Math.floor(e.trackLast/n)}else l=t>=s&&e.animationLast<s;for(l&&this.queue.complete(e);r<o;r++){let c=a[r];c.time<i||this.queue.event(e,c)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,i=this.tracks.length;t<i;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let i=t;for(;;){let s=i.mixingFrom;if(!s)break;this.queue.end(s),i.mixingFrom=null,i.mixingTo=null,i=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,i){let s=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,s&&(i&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,i=!1){let s=this.data.skeletonData.findAnimation(t);if(!s)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,s,i)}setAnimationWith(e,t,i=!1){if(!t)throw new Error("animation cannot be null.");let s=!0,n=this.expandToIndex(e);n&&(n.nextTrackLast==-1?(this.tracks[e]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,s=!1):this.clearNext(n));let h=this.trackEntry(e,t,i,n);return this.setCurrent(e,h,s),this.queue.drain(),h}addAnimation(e,t,i=!1,s=0){let n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,n,i,s)}addAnimationWith(e,t,i=!1,s=0){if(!t)throw new Error("animation cannot be null.");let n=this.expandToIndex(e);if(n)for(;n.next;)n=n.next;let h=this.trackEntry(e,t,i,n);return n?(n.next=h,h.previous=n,s<=0&&(s+=n.getTrackComplete()-h.mixDuration)):(this.setCurrent(e,h,!0),this.queue.drain()),h.delay=s,h}setEmptyAnimation(e,t=0){let i=this.setAnimationWith(e,yt.emptyAnimation(),!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){let s=this.addAnimationWith(e,yt.emptyAnimation(),!1,i);return i<=0&&(s.delay+=s.mixDuration-t),s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,s=this.tracks.length;i<s;i++){let n=this.tracks[i];n&&this.setEmptyAnimation(n.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(L.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,i,s){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=e,n.animation=t,n.loop=i,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=t.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=s?this.data.getMix(s.animation,t):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,i=e.length;t<i;t++){let s=e[t];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do(!s.mixingTo||s.mixBlend!=3)&&this.computeHold(s),s=s.mixingTo;while(s)}}}computeHold(e){let t=e.mixingTo,i=e.animation.timelines,s=e.animation.timelines.length,n=e.timelineMode;n.length=s;let h=e.timelineHoldMix;h.length=0;let a=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<s;r++)n[r]=a.addAll(i[r].getPropertyIds())?Ct:vi;return}e:for(let r=0;r<s;r++){let o=i[r],l=o.getPropertyIds();if(!a.addAll(l))n[r]=At;else if(!t||o instanceof qe||o instanceof Ge||o instanceof ht||!t.animation.hasTimeline(l))n[r]=wi;else{for(let c=t.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(e.mixDuration>0){n[r]=os,h[r]=c;continue e}break}n[r]=Ct}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},ns=yt;B(ns,"_emptyAnimation",new bt("<empty>",[],0));var as=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelta(e,t){this._mixDuration=e,this.previous!=null&&this.delay<=0&&(this.delay+=this.previous.getTrackComplete()-t),this.delay=this.delay}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}},ls=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(ye.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ye.interrupt),this.objects.push(e)}end(e){this.objects.push(ye.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ye.dispose),this.objects.push(e)}complete(e){this.objects.push(ye.complete),this.objects.push(e)}event(e,t){this.objects.push(ye.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let i=0;i<e.length;i+=2){let s=e[i],n=e[i+1];switch(s){case ye.start:n.listener&&n.listener.start&&n.listener.start(n);for(let a=0;a<t.length;a++){let r=t[a];r.start&&r.start(n)}break;case ye.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let a=0;a<t.length;a++){let r=t[a];r.interrupt&&r.interrupt(n)}break;case ye.end:n.listener&&n.listener.end&&n.listener.end(n);for(let a=0;a<t.length;a++){let r=t[a];r.end&&r.end(n)}case ye.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let a=0;a<t.length;a++){let r=t[a];r.dispose&&r.dispose(n)}this.animState.trackEntryPool.free(n);break;case ye.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let a=0;a<t.length;a++){let r=t[a];r.complete&&r.complete(n)}break;case ye.event:let h=e[i+++2];n.listener&&n.listener.event&&n.listener.event(n,h);for(let a=0;a<t.length;a++){let r=t[a];r.event&&r.event(n,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ye=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(ye||{}),Js=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},At=0,wi=1,vi=2,Ct=3,os=4,yi=1,hs=2,Qs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,i){let s=this.skeletonData.findAnimation(e);if(!s)throw new Error("Animation not found: "+e);let n=this.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);this.setMixWith(s,n,i)}setMixWith(e,t,i){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let s=e.name+"."+t.name;this.animationToMixTime[s]=i}getMix(e,t){let i=e.name+"."+t.name,s=this.animationToMixTime[i];return s===void 0?this.defaultMix:s}},St=class extends Ee{color=new O(1,1,1,1);constructor(e){super(e)}copy(){let e=new St(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},$e=class extends Ee{endSlot=null;color=new O(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new $e(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Ai=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Tt=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(Tt||{}),cs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(cs||{}),ds=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},$s=class extends Ai{setFilters(e,t){}setWraps(e,t){}dispose(){}},fs=class{pages=new Array;regions=new Array;constructor(e){let t=new er(e),i=new Array(4),s={};s.size=l=>{l.width=parseInt(i[1]),l.height=parseInt(i[2])},s.format=()=>{},s.filter=l=>{l.minFilter=L.enumValue(Tt,i[1]),l.magFilter=L.enumValue(Tt,i[2])},s.repeat=l=>{i[1].indexOf("x")!=-1&&(l.uWrap=10497),i[1].indexOf("y")!=-1&&(l.vWrap=10497)},s.pma=l=>{l.pma=i[1]=="true"};var n={};n.xy=l=>{l.x=parseInt(i[1]),l.y=parseInt(i[2])},n.size=l=>{l.width=parseInt(i[1]),l.height=parseInt(i[2])},n.bounds=l=>{l.x=parseInt(i[1]),l.y=parseInt(i[2]),l.width=parseInt(i[3]),l.height=parseInt(i[4])},n.offset=l=>{l.offsetX=parseInt(i[1]),l.offsetY=parseInt(i[2])},n.orig=l=>{l.originalWidth=parseInt(i[1]),l.originalHeight=parseInt(i[2])},n.offsets=l=>{l.offsetX=parseInt(i[1]),l.offsetY=parseInt(i[2]),l.originalWidth=parseInt(i[3]),l.originalHeight=parseInt(i[4])},n.rotate=l=>{let c=i[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},n.index=l=>{l.index=parseInt(i[1])};let h=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(i,h)==0);)h=t.readLine();let a=null,r=null,o=null;for(;h!==null;)if(h.trim().length==0)a=null,h=t.readLine();else if(a){let l=new Ci(a,h);for(;;){let c=t.readEntry(i,h=t.readLine());if(c==0)break;let d=n[i[0]];if(d)d(l);else{r||(r=[]),o||(o=[]),r.push(i[0]);let f=[];for(let u=0;u<c;u++)f.push(parseInt(i[u+1]));o.push(f)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),r&&r.length>0&&o&&o.length>0&&(l.names=r,l.values=o,r=null,o=null),l.u=l.x/a.width,l.v=l.y/a.height,l.degrees==90?(l.u2=(l.x+l.height)/a.width,l.v2=(l.y+l.width)/a.height):(l.u2=(l.x+l.width)/a.width,l.v2=(l.y+l.height)/a.height),this.regions.push(l)}else{for(a=new us(h.trim());t.readEntry(i,h=t.readLine())!=0;){let l=s[i[0]];l&&l(a)}this.pages.push(a)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let i of this.pages)i.setTexture(e.get(t+i.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},er=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let i=t.indexOf(":");if(i==-1)return 0;e[0]=t.substr(0,i).trim();for(let s=1,n=i+1;;s++){let h=t.indexOf(",",n);if(h==-1)return e[s]=t.substr(n).trim(),s;if(e[s]=t.substr(n,h-n).trim(),n=h+1,s==4)return 4}}},us=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Ci=class extends ds{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},De=class extends Ee{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new O(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new O(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=L.newFloatArray(e.length));let t=this.uvs,i=this.uvs.length,s=this.region.u,n=this.region.v,h=0,a=0;if(this.region instanceof Ci){let r=this.region,o=r.page,l=o.width,c=o.height;switch(r.degrees){case 90:s-=(r.originalHeight-r.offsetY-r.height)/l,n-=(r.originalWidth-r.offsetX-r.width)/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let d=0;d<i;d+=2)t[d]=s+e[d+1]*h,t[d+1]=n+(1-e[d])*a;return;case 180:s-=(r.originalWidth-r.offsetX-r.width)/l,n-=r.offsetY/c,h=r.originalWidth/l,a=r.originalHeight/c;for(let d=0;d<i;d+=2)t[d]=s+(1-e[d])*h,t[d+1]=n+(1-e[d+1])*a;return;case 270:s-=r.offsetY/l,n-=r.offsetX/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let d=0;d<i;d+=2)t[d]=s+(1-e[d+1])*h,t[d+1]=n+e[d]*a;return}s-=r.offsetX/l,n-=(r.originalHeight-r.offsetY-r.height)/c,h=r.originalWidth/l,a=r.originalHeight/c}else this.region?(h=this.region.u2-s,a=this.region.v2-n):(s=n=0,h=a=1);for(let r=0;r<i;r+=2)t[r]=s+e[r]*h,t[r+1]=n+e[r+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new De(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),L.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),L.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),L.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),L.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,i,s,n,h){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,i,s,n,h)}newLinkedMesh(){let e=new De(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},He=class extends Ee{lengths=[];closed=!1;constantSpeed=!1;color=new O(1,1,1,1);constructor(e){super(e)}copy(){let e=new He(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),L.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Si=class extends Ee{x=0;y=0;rotation=0;color=new O(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*X.degRad,i=Math.cos(t),s=Math.sin(t),n=i*e.a+s*e.b,h=i*e.c+s*e.d;return X.atan2Deg(h,n)}copy(){let e=new Si(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},ms=class extends zt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new O(1,1,1,1);path;region=null;sequence=null;offset=L.newFloatArray(8);uvs=L.newFloatArray(8);tempColor=new O(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,s=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*i,h=-this.height/2*this.scaleY+this.region.offsetY*s,a=n+this.region.width*i,r=h+this.region.height*s,o=this.rotation*X.degRad,l=Math.cos(o),c=Math.sin(o),d=this.x,f=this.y,u=n*l+d,m=n*c,g=h*l+f,w=h*c,b=a*l+d,x=a*c,p=r*l+f,v=r*c,y=this.offset;y[0]=u-w,y[1]=g+m,y[2]=u-v,y[3]=p+m,y[4]=b-v,y[5]=p+x,y[6]=b-w,y[7]=g+x,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,i,s){this.sequence!=null&&this.sequence.apply(e,this);let n=e.bone,h=this.offset,a=n.worldX,r=n.worldY,o=n.a,l=n.b,c=n.c,d=n.d,f=0,u=0;f=h[0],u=h[1],t[i]=f*o+u*l+a,t[i+1]=f*c+u*d+r,i+=s,f=h[2],u=h[3],t[i]=f*o+u*l+a,t[i+1]=f*c+u*d+r,i+=s,f=h[4],u=h[5],t[i]=f*o+u*l+a,t[i+1]=f*c+u*d+r,i+=s,f=h[6],u=h[7],t[i]=f*o+u*l+a,t[i+1]=f*c+u*d+r}copy(){let e=new ms(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,L.arrayCopy(this.uvs,0,e.uvs,0,8),L.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},ae=ms;B(ae,"X1",0),B(ae,"Y1",1),B(ae,"C1R",2),B(ae,"C1G",3),B(ae,"C1B",4),B(ae,"C1A",5),B(ae,"U1",6),B(ae,"V1",7),B(ae,"X2",8),B(ae,"Y2",9),B(ae,"C2R",10),B(ae,"C2G",11),B(ae,"C2B",12),B(ae,"C2A",13),B(ae,"U2",14),B(ae,"V2",15),B(ae,"X3",16),B(ae,"Y3",17),B(ae,"C3R",18),B(ae,"C3G",19),B(ae,"C3B",20),B(ae,"C3A",21),B(ae,"U3",22),B(ae,"V3",23),B(ae,"X4",24),B(ae,"Y4",25),B(ae,"C4R",26),B(ae,"C4G",27),B(ae,"C4B",28),B(ae,"C4A",29),B(ae,"U4",30),B(ae,"V4",31);var tr=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,i){let s=i.regions;for(let n=0,h=s.length;n<h;n++){let a=i.getPath(t,n),r=this.atlas.findRegion(a);if(r==null)throw new Error("Region not found in atlas: "+a+" (sequence: "+e+")");s[n]=r}}newRegionAttachment(e,t,i,s){let n=new ae(t,i);if(s!=null)this.loadSequence(t,i,s);else{let h=this.atlas.findRegion(i);if(!h)throw new Error("Region not found in atlas: "+i+" (region attachment: "+t+")");n.region=h}return n}newMeshAttachment(e,t,i,s){let n=new De(t,i);if(s!=null)this.loadSequence(t,i,s);else{let h=this.atlas.findRegion(i);if(!h)throw new Error("Region not found in atlas: "+i+" (mesh attachment: "+t+")");n.region=h}return n}newBoundingBoxAttachment(e,t){return new St(t)}newPathAttachment(e,t){return new He(t)}newPointAttachment(e,t){return new Si(t)}newClippingAttachment(e,t){return new $e(t)}},Ti=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=ct.Normal;skinRequired=!1;color=new O;icon;visible=!1;constructor(e,t,i){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=i}},ct=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(ct||{}),Ii=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,i){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=i,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,i,s,n,h,a){this.ax=e,this.ay=t,this.arotation=i,this.ascaleX=s,this.ascaleY=n,this.ashearX=h,this.ashearY=a;let r=this.parent;if(!r){let f=this.skeleton;const u=f.scaleX,m=f.scaleY,g=(i+h)*X.degRad,w=(i+90+a)*X.degRad;this.a=Math.cos(g)*s*u,this.b=Math.cos(w)*n*u,this.c=Math.sin(g)*s*m,this.d=Math.sin(w)*n*m,this.worldX=e*u+f.x,this.worldY=t*m+f.y;return}let o=r.a,l=r.b,c=r.c,d=r.d;switch(this.worldX=o*e+l*t+r.worldX,this.worldY=c*e+d*t+r.worldY,this.inherit){case 0:{const f=(i+h)*X.degRad,u=(i+90+a)*X.degRad,m=Math.cos(f)*s,g=Math.cos(u)*n,w=Math.sin(f)*s,b=Math.sin(u)*n;this.a=o*m+l*w,this.b=o*g+l*b,this.c=c*m+d*w,this.d=c*g+d*b;return}case 1:{const f=(i+h)*X.degRad,u=(i+90+a)*X.degRad;this.a=Math.cos(f)*s,this.b=Math.cos(u)*n,this.c=Math.sin(f)*s,this.d=Math.sin(u)*n;break}case 2:{let f=o*o+c*c,u=0;f>1e-4?(f=Math.abs(o*d-l*c)/f,o/=this.skeleton.scaleX,c/=this.skeleton.scaleY,l=c*f,d=o*f,u=Math.atan2(c,o)*X.radDeg):(o=0,c=0,u=90-Math.atan2(d,l)*X.radDeg);const m=(i+h-u)*X.degRad,g=(i+a-u+90)*X.degRad,w=Math.cos(m)*s,b=Math.cos(g)*n,x=Math.sin(m)*s,p=Math.sin(g)*n;this.a=o*w-l*x,this.b=o*b-l*p,this.c=c*w+d*x,this.d=c*b+d*p;break}case 3:case 4:{i*=X.degRad;const f=Math.cos(i),u=Math.sin(i);let m=(o*f+l*u)/this.skeleton.scaleX,g=(c*f+d*u)/this.skeleton.scaleY,w=Math.sqrt(m*m+g*g);w>1e-5&&(w=1/w),m*=w,g*=w,w=Math.sqrt(m*m+g*g),this.inherit==3&&o*d-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),i=Math.PI/2+Math.atan2(g,m);const b=Math.cos(i)*w,x=Math.sin(i)*w;h*=X.degRad,a=(90+a)*X.degRad;const p=Math.cos(h)*s,v=Math.cos(a)*n,y=Math.sin(h)*s,A=Math.sin(a)*n;this.a=m*p+b*y,this.b=m*v+b*A,this.c=g*p+x*y,this.d=g*v+x*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*X.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*X.radDeg;return}let t=e.a,i=e.b,s=e.c,n=e.d,h=1/(t*n-i*s),a=n*h,r=i*h,o=s*h,l=t*h,c=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=c*a-d*r,this.ay=d*l-c*o;let f,u,m,g;if(this.inherit==1)f=this.a,u=this.b,m=this.c,g=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*n-i*s)/(t*t+s*s),y=t/this.skeleton.scaleX;i=-(s/this.skeleton.scaleY)*v*this.skeleton.scaleX,n=y*v*this.skeleton.scaleY,h=1/(t*n-i*s),a=n*h,r=i*h;break}case 3:case 4:let w=X.cosDeg(this.rotation),b=X.sinDeg(this.rotation);t=(t*w+i*b)/this.skeleton.scaleX,s=(s*w+n*b)/this.skeleton.scaleY;let x=Math.sqrt(t*t+s*s);x>1e-5&&(x=1/x),t*=x,s*=x,x=Math.sqrt(t*t+s*s),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);let p=X.PI/2+Math.atan2(s,t);i=Math.cos(p)*x,n=Math.sin(p)*x,h=1/(t*n-i*s),a=n*h,r=i*h,o=s*h,l=t*h}f=a*this.a-r*this.c,u=a*this.b-r*this.d,m=l*this.c-o*this.a,g=l*this.d-o*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+m*m),this.ascaleX>1e-4){let w=f*g-u*m;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(f*u+m*g,w)*X.radDeg,this.arotation=Math.atan2(m,f)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,u)*X.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*X.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*X.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),i=e.x-this.worldX,s=e.y-this.worldY;return e.x=i*this.d*t-s*this.b*t,e.y=s*this.a*t-i*this.c*t,e}localToWorld(e){let t=e.x,i=e.y;return e.x=t*this.a+i*this.b+this.worldX,e.y=t*this.c+i*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=X.sinDeg(e),i=X.cosDeg(e);return Math.atan2(this.a*t-this.c*i,this.d*i-this.b*t)*X.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=X.sinDeg(e),i=X.cosDeg(e);return Math.atan2(i*this.c+t*this.d,i*this.a+t*this.b)*X.radDeg}rotateWorld(e){e*=X.degRad;const t=Math.sin(e),i=Math.cos(e),s=this.a,n=this.b;this.a=i*s-t*this.c,this.b=i*n-t*this.d,this.c=t*s+i*this.c,this.d=t*n+i*this.d}},dt=class{constructor(e,t,i){this.name=e,this.order=t,this.skinRequired=i}},gs=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",i=new Mi){this.textureLoader=e,this.pathPrefix=t,this.downloader=i}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,i){this.toLoad--,this.loaded++,this.assets[t]=i,e&&e(t,i)}error(e,t,i){this.toLoad--,this.loaded++,this.errors[t]=i,e&&e(t,i)}loadAll(){return new Promise((t,i)=>{let s=()=>{if(this.isLoadingComplete()){this.hasErrors()?i(this.errors):t(this);return}requestAnimationFrame(s)};requestAnimationFrame(s)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},i=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,s=>{this.success(t,e,s)},(s,n)=>{this.error(i,e,`Couldn't load binary ${e}: status ${s}, ${n}`)})}loadText(e,t=()=>{},i=()=>{}){e=this.start(e),this.downloader.downloadText(e,s=>{this.success(t,e,s)},(s,n)=>{this.error(i,e,`Couldn't load text ${e}: status ${s}, ${n}`)})}loadJson(e,t=()=>{},i=()=>{}){e=this.start(e),this.downloader.downloadJson(e,s=>{this.success(t,e,s)},(s,n)=>{this.error(i,e,`Couldn't load JSON ${e}: status ${s}, ${n}`)})}loadTexture(e,t=()=>{},i=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(h=>h.ok?h.blob():(this.error(i,e,`Couldn't load image: ${e}`),null)).then(h=>h?createImageBitmap(h,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(h=>{h&&this.success(t,e,this.textureLoader(h))});else{let h=new Image;h.crossOrigin="anonymous",h.onload=()=>{this.success(t,e,this.textureLoader(h))},h.onerror=()=>{this.error(i,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),h.src=e}}loadTextureAtlas(e,t=()=>{},i=()=>{},s){let n=e.lastIndexOf("/"),h=n>=0?e.substring(0,n+1):"";e=this.start(e),this.downloader.downloadText(e,a=>{try{let r=new fs(a),o=r.pages.length,l=!1;for(let c of r.pages)this.loadTexture(s?s[c.name]:h+c.name,(d,f)=>{l||(c.setTexture(f),--o==0&&this.success(t,e,r))},(d,f)=>{l||this.error(i,e,`Couldn't load texture atlas ${e} page image: ${d}`),l=!0})}catch(r){this.error(i,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(a,r)=>{this.error(i,e,`Couldn't load texture atlas ${e}: status ${a}, ${r}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let i=this.errors[e];throw Error("Asset not found: "+e+(i?`
1
+ "use strict";var spine=(()=>{var xt=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,Us=Object.getOwnPropertyNames,_s=Object.prototype.hasOwnProperty,zs=(e,t,i)=>t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ws=(e,t)=>{for(var i in t)xt(e,i,{get:t[i],enumerable:!0})},qs=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Us(t))!_s.call(e,n)&&n!==i&&xt(e,n,{get:()=>t[n],enumerable:!(s=Ns(t,n))||s.enumerable});return e},Gs=e=>qs(xt({},"__esModule",{value:!0}),e),B=(e,t,i)=>(zs(e,typeof t!="symbol"?t+"":t,i),i),ji={};Ws(ji,{AlphaTimeline:()=>si,Animation:()=>bt,AnimationState:()=>ns,AnimationStateAdapter:()=>Js,AnimationStateData:()=>Qs,AssetManager:()=>Cs,AssetManagerBase:()=>gs,AtlasAttachmentLoader:()=>tr,Attachment:()=>zt,AttachmentTimeline:()=>qe,BinaryInput:()=>ys,BlendMode:()=>Yt,Bone:()=>Ii,BoneData:()=>Ti,BoundingBoxAttachment:()=>St,CURRENT:()=>hs,CameraController:()=>Vr,ClippingAttachment:()=>$e,Color:()=>O,Color2Attribute:()=>Is,ColorAttribute:()=>Pt,ConstraintData:()=>dt,CurveTimeline:()=>Re,CurveTimeline1:()=>Ce,CurveTimeline2:()=>wt,DebugUtils:()=>Zs,DeformTimeline:()=>ai,Downloader:()=>Mi,DrawOrderTimeline:()=>Ge,Event:()=>Ei,EventData:()=>Ri,EventQueue:()=>ls,EventTimeline:()=>ht,EventType:()=>ye,FIRST:()=>wi,FakeTexture:()=>$s,GLTexture:()=>ut,HOLD_FIRST:()=>Ct,HOLD_MIX:()=>os,HOLD_SUBSEQUENT:()=>vi,IkConstraint:()=>xs,IkConstraintData:()=>Yi,IkConstraintTimeline:()=>li,Inherit:()=>ct,InheritTimeline:()=>ei,Input:()=>Di,IntSet:()=>Hs,Interpolation:()=>Zi,LoadingScreen:()=>zr,M00:()=>D,M01:()=>q,M02:()=>G,M03:()=>N,M10:()=>H,M11:()=>U,M12:()=>j,M13:()=>_,M20:()=>Z,M21:()=>K,M22:()=>z,M23:()=>W,M30:()=>Q,M31:()=>$,M32:()=>ee,M33:()=>J,ManagedWebGLRenderingContext:()=>be,MathUtils:()=>X,Matrix4:()=>Le,Mesh:()=>Ni,MeshAttachment:()=>De,MixBlend:()=>es,MixDirection:()=>ts,OrthoCamera:()=>Ss,PathAttachment:()=>He,PathConstraint:()=>et,PathConstraintData:()=>ki,PathConstraintMixTimeline:()=>di,PathConstraintPositionTimeline:()=>hi,PathConstraintSpacingTimeline:()=>ci,Physics:()=>ws,PhysicsConstraintDampingTimeline:()=>mi,PhysicsConstraintGravityTimeline:()=>pi,PhysicsConstraintInertiaTimeline:()=>fi,PhysicsConstraintMassTimeline:()=>gi,PhysicsConstraintMixTimeline:()=>bi,PhysicsConstraintResetTimeline:()=>vt,PhysicsConstraintStrengthTimeline:()=>ui,PhysicsConstraintTimeline:()=>Oe,PhysicsConstraintWindTimeline:()=>xi,PointAttachment:()=>Si,PolygonBatcher:()=>it,Pool:()=>lt,Position2Attribute:()=>Xt,Position3Attribute:()=>Dr,PositionMode:()=>It,Pow:()=>Ki,PowOut:()=>js,RGB2Timeline:()=>ni,RGBA2Timeline:()=>ri,RGBATimeline:()=>ti,RGBTimeline:()=>ii,RegionAttachment:()=>ae,ResizeMode:()=>Vt,RotateMode:()=>Et,RotateTimeline:()=>ot,SETUP:()=>yi,SUBSEQUENT:()=>At,ScaleTimeline:()=>jt,ScaleXTimeline:()=>Zt,ScaleYTimeline:()=>Kt,SceneRenderer:()=>ks,SequenceTimeline:()=>Qe,Shader:()=>ge,ShapeRenderer:()=>_i,ShapeType:()=>ve,ShearTimeline:()=>Jt,ShearXTimeline:()=>Qt,ShearYTimeline:()=>$t,Skeleton:()=>ft,SkeletonBinary:()=>sr,SkeletonBounds:()=>As,SkeletonClipping:()=>kt,SkeletonData:()=>Xi,SkeletonDebugRenderer:()=>Lt,SkeletonJson:()=>Br,SkeletonRenderer:()=>Wi,Skin:()=>Rt,SkinEntry:()=>Pi,Slot:()=>ps,SlotData:()=>Li,SpacingMode:()=>Mt,SpineCanvas:()=>Gr,StringSet:()=>Ut,TexCoordAttribute:()=>Ui,Texture:()=>Ai,TextureAtlas:()=>fs,TextureAtlasPage:()=>us,TextureAtlasRegion:()=>Ci,TextureFilter:()=>Tt,TextureRegion:()=>ds,TextureWrap:()=>cs,TimeKeeper:()=>_t,Timeline:()=>ue,Touch:()=>Ts,TrackEntry:()=>as,TransformConstraint:()=>bs,TransformConstraintData:()=>Bi,TransformConstraintTimeline:()=>oi,TranslateTimeline:()=>qt,TranslateXTimeline:()=>Gt,TranslateYTimeline:()=>Ht,Triangulator:()=>Ae,Utils:()=>L,Vector2:()=>We,Vector3:()=>Se,VertexAttachment:()=>Ee,VertexAttribute:()=>tt,VertexAttributeType:()=>je,WindowedMean:()=>Ks});var Hs=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Ut=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var i=0,s=e.length;i<s;i++)this.add(e[i]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},ze=class{constructor(e=0,t=0,i=0,s=0){this.r=e,this.g=t,this.b=i,this.a=s}set(e,t,i,s){return this.r=e,this.g=t,this.b=i,this.a=s,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,i,s){return this.r+=e,this.g+=t,this.b+=i,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}static fromString(e){return new ze().setFromString(e)}},O=ze;B(O,"WHITE",new ze(1,1,1,1)),B(O,"RED",new ze(1,0,0,1)),B(O,"GREEN",new ze(0,1,0,1)),B(O,"BLUE",new ze(0,0,1,1)),B(O,"MAGENTA",new ze(1,0,1,1));var Me=class{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*Me.degRad)}static sinDeg(e){return Math.sin(e*Me.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*Me.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return Me.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,i){let s=Math.random(),n=t-e;return s<=(i-e)/n?e+Math.sqrt(s*n*(i-e)):t-Math.sqrt((1-s)*n*(t-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},X=Me;B(X,"PI",3.1415927),B(X,"PI2",Me.PI*2),B(X,"invPI2",1/Me.PI2),B(X,"radiansToDegrees",180/Me.PI),B(X,"radDeg",Me.radiansToDegrees),B(X,"degreesToRadians",Me.PI/180),B(X,"degRad",Me.degreesToRadians);var Zi=class{apply(e,t,i){return e+(t-e)*this.applyInternal(i)}},Ki=class extends Zi{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},js=class extends Ki{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Je=class{static arrayCopy(e,t,i,s,n){for(let h=t,a=s;h<t+n;h++,a++)i[a]=e[h]}static arrayFill(e,t,i,s){for(let n=t;n<i;n++)e[n]=s}static setArraySize(e,t,i=0){let s=e.length;if(s==t)return e;if(e.length=t,s<t)for(let n=s;n<t;n++)e[n]=i;return e}static ensureArrayCapacity(e,t,i=0){return e.length>=t?e:Je.setArraySize(e,t,i)}static newArray(e,t){let i=new Array(e);for(let s=0;s<e;s++)i[s]=t;return i}static newFloatArray(e){if(Je.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let i=0;i<t.length;i++)t[i]=0;return t}}static newShortArray(e){if(Je.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let i=0;i<t.length;i++)t[i]=0;return t}}static toFloatArray(e){return Je.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Je.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,i=!0){for(var s=0;s<e.length;s++)if(e[s]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},L=Je;B(L,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Zs=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let i=e.bones[t];console.log(i.data.name+", "+i.a+", "+i.b+", "+i.c+", "+i.d+", "+i.worldX+", "+i.worldY)}}},lt=class{items=new Array;instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},We=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},_t=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Ks=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},zt=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},Ji=class extends zt{id=Ji.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,i,s,n,h){i=n+(i>>1)*h;let a=e.bone.skeleton,r=e.deform,o=this.vertices,l=this.bones;if(!l){r.length>0&&(o=r);let u=e.bone,m=u.worldX,g=u.worldY,w=u.a,b=u.b,x=u.c,p=u.d;for(let v=t,y=n;y<i;v+=2,y+=h){let A=o[v],C=o[v+1];s[y]=A*w+C*b+m,s[y+1]=A*x+C*p+g}return}let c=0,d=0;for(let u=0;u<t;u+=2){let m=l[c];c+=m+1,d+=m}let f=a.bones;if(r.length==0)for(let u=n,m=d*3;u<i;u+=h){let g=0,w=0,b=l[c++];for(b+=c;c<b;c++,m+=3){let x=f[l[c]],p=o[m],v=o[m+1],y=o[m+2];g+=(p*x.a+v*x.b+x.worldX)*y,w+=(p*x.c+v*x.d+x.worldY)*y}s[u]=g,s[u+1]=w}else{let u=r;for(let m=n,g=d*3,w=d<<1;m<i;m+=h){let b=0,x=0,p=l[c++];for(p+=c;c<p;c++,g+=3,w+=2){let v=f[l[c]],y=o[g]+u[w],A=o[g+1]+u[w+1],C=o[g+2];b+=(y*v.a+A*v.b+v.worldX)*C,x+=(y*v.c+A*v.d+v.worldY)*C}s[m]=b,s[m+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),L.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=L.newFloatArray(this.vertices.length),L.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},Ee=Ji;B(Ee,"nextID",0);var pt=class{id=pt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new pt(this.regions.length);return L.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let s=this.regions[i];t.region!=s&&(t.region=s,t.updateRegion())}getPath(e,t){let i=e,s=(this.start+t).toString();for(let n=this.digits-s.length;n>0;n--)i+="0";return i+=s,i}static nextID(){return pt._nextID++}},Wt=pt;B(Wt,"_nextID",0);var Qi=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(Qi||{}),$i=[0,1,2,3,4,5,6],bt=class{name;timelines=[];timelineIds=new Ut;duration;constructor(e,t,i){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=i}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,i,s,n,h,a,r){if(!e)throw new Error("skeleton cannot be null.");s&&this.duration!=0&&(i%=this.duration,t>0&&(t%=this.duration));let o=this.timelines;for(let l=0,c=o.length;l<c;l++)o[l].apply(e,t,i,n,h,a,r)}},es=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(es||{}),ts=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(ts||{}),re={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},ue=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=L.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let i=e.length;for(let s=1;s<i;s++)if(e[s]>t)return s-1;return i-1}static search(e,t,i){let s=e.length;for(let n=i;n<s;n+=i)if(e[n]>t)return n-i;return s-i}},Re=class extends ue{curves;constructor(e,t,i){super(e,i),this.curves=L.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let i=L.newFloatArray(t);L.arrayCopy(this.curves,0,i,0,t),this.curves=i}}setBezier(e,t,i,s,n,h,a,r,o,l,c){let d=this.curves,f=this.getFrameCount()+e*18;i==0&&(d[t]=2+f);let u=(s-h*2+r)*.03,m=(n-a*2+o)*.03,g=((h-r)*3-s+l)*.006,w=((a-o)*3-n+c)*.006,b=u*2+g,x=m*2+w,p=(h-s)*.3+u+g*.16666667,v=(a-n)*.3+m+w*.16666667,y=s+p,A=n+v;for(let C=f+18;f<C;f+=2)d[f]=y,d[f+1]=A,p+=b,v+=x,b+=g,x+=w,y+=p,A+=v}getBezierValue(e,t,i,s){let n=this.curves;if(n[s]>e){let o=this.frames[t],l=this.frames[t+i];return l+(e-o)/(n[s]-o)*(n[s+1]-l)}let h=s+18;for(s+=2;s<h;s+=2)if(n[s]>=e){let o=n[s-2],l=n[s-1];return l+(e-o)/(n[s]-o)*(n[s+1]-l)}t+=this.getFrameEntries();let a=n[h-2],r=n[h-1];return r+(e-a)/(this.frames[t]-a)*(this.frames[t+i]-r)}},Ce=class extends Re{constructor(e,t,i){super(e,t,[i])}getFrameEntries(){return 2}setFrame(e,t,i){e<<=1,this.frames[e]=t,this.frames[e+1]=i}getCurveValue(e){let t=this.frames,i=t.length-2;for(let n=2;n<=i;n+=2)if(t[n]>e){i=n-2;break}let s=this.curves[i>>1];switch(s){case 0:let n=t[i],h=t[i+1];return h+(e-n)/(t[i+2]-n)*(t[i+2+1]-h);case 1:return t[i+1]}return this.getBezierValue(e,i,1,s-2)}getRelativeValue(e,t,i,s,n){if(e<this.frames[0]){switch(i){case 0:return n;case 1:return s+(n-s)*t}return s}let h=this.getCurveValue(e);switch(i){case 0:return n+h*t;case 1:case 2:h+=n-s}return s+h*t}getAbsoluteValue(e,t,i,s,n){if(e<this.frames[0]){switch(i){case 0:return n;case 1:return s+(n-s)*t}return s}let h=this.getCurveValue(e);return i==0?n+(h-n)*t:s+(h-s)*t}getAbsoluteValue2(e,t,i,s,n,h){if(e<this.frames[0]){switch(i){case 0:return n;case 1:return s+(n-s)*t}return s}return i==0?n+(h-n)*t:s+(h-s)*t}getScaleValue(e,t,i,s,n,h){const a=this.frames;if(e<a[0]){switch(i){case 0:return h;case 1:return n+(h-n)*t}return n}let r=this.getCurveValue(e)*h;if(t==1)return i==3?n+r-h:r;if(s==1)switch(i){case 0:return h+(Math.abs(r)*X.signum(h)-h)*t;case 1:case 2:return n+(Math.abs(r)*X.signum(n)-n)*t}else{let o=0;switch(i){case 0:return o=Math.abs(h)*X.signum(r),o+(r-o)*t;case 1:case 2:return o=Math.abs(n)*X.signum(r),o+(r-o)*t}}return n+(r-h)*t}},wt=class extends Re{constructor(e,t,i,s){super(e,t,[i,s])}getFrameEntries(){return 3}setFrame(e,t,i,s){e*=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s}},ot=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.rotate+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.rotation=this.getRelativeValue(i,n,h,r.rotation,r.data.rotation))}},qt=class extends wt{boneIndex=0;constructor(e,t,i){super(e,t,re.x+"|"+i,re.y+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.x=r.data.x,r.y=r.data.y;return;case 1:r.x+=(r.data.x-r.x)*n,r.y+=(r.data.y-r.y)*n}return}let l=0,c=0,d=ue.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];l=o[d+1],c=o[d+2];let m=(i-u)/(o[d+3]-u);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(i,d,1,f-2),c=this.getBezierValue(i,d,2,f+18-2)}switch(h){case 0:r.x=r.data.x+l*n,r.y=r.data.y+c*n;break;case 1:case 2:r.x+=(r.data.x+l-r.x)*n,r.y+=(r.data.y+c-r.y)*n;break;case 3:r.x+=l*n,r.y+=c*n}}},Gt=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.x+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.x=this.getRelativeValue(i,n,h,r.x,r.data.x))}},Ht=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.y+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.y=this.getRelativeValue(i,n,h,r.y,r.data.y))}},jt=class extends wt{boneIndex=0;constructor(e,t,i){super(e,t,re.scaleX+"|"+i,re.scaleY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.scaleX=r.data.scaleX,r.scaleY=r.data.scaleY;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*n,r.scaleY+=(r.data.scaleY-r.scaleY)*n}return}let l,c,d=ue.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];l=o[d+1],c=o[d+2];let m=(i-u)/(o[d+3]-u);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(i,d,1,f-2),c=this.getBezierValue(i,d,2,f+18-2)}if(l*=r.data.scaleX,c*=r.data.scaleY,n==1)h==3?(r.scaleX+=l-r.data.scaleX,r.scaleY+=c-r.data.scaleY):(r.scaleX=l,r.scaleY=c);else{let u=0,m=0;if(a==1)switch(h){case 0:u=r.data.scaleX,m=r.data.scaleY,r.scaleX=u+(Math.abs(l)*X.signum(u)-u)*n,r.scaleY=m+(Math.abs(c)*X.signum(m)-m)*n;break;case 1:case 2:u=r.scaleX,m=r.scaleY,r.scaleX=u+(Math.abs(l)*X.signum(u)-u)*n,r.scaleY=m+(Math.abs(c)*X.signum(m)-m)*n;break;case 3:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}else switch(h){case 0:u=Math.abs(r.data.scaleX)*X.signum(l),m=Math.abs(r.data.scaleY)*X.signum(c),r.scaleX=u+(l-u)*n,r.scaleY=m+(c-m)*n;break;case 1:case 2:u=Math.abs(r.scaleX)*X.signum(l),m=Math.abs(r.scaleY)*X.signum(c),r.scaleX=u+(l-u)*n,r.scaleY=m+(c-m)*n;break;case 3:r.scaleX+=(l-r.data.scaleX)*n,r.scaleY+=(c-r.data.scaleY)*n}}}},Zt=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.scaleX+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.scaleX=this.getScaleValue(i,n,h,a,r.scaleX,r.data.scaleX))}},Kt=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.scaleY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.scaleY=this.getScaleValue(i,n,h,a,r.scaleY,r.data.scaleY))}},Jt=class extends wt{boneIndex=0;constructor(e,t,i){super(e,t,re.shearX+"|"+i,re.shearY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.shearX=r.data.shearX,r.shearY=r.data.shearY;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*n,r.shearY+=(r.data.shearY-r.shearY)*n}return}let l=0,c=0,d=ue.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];l=o[d+1],c=o[d+2];let m=(i-u)/(o[d+3]-u);l+=(o[d+3+1]-l)*m,c+=(o[d+3+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(i,d,1,f-2),c=this.getBezierValue(i,d,2,f+18-2)}switch(h){case 0:r.shearX=r.data.shearX+l*n,r.shearY=r.data.shearY+c*n;break;case 1:case 2:r.shearX+=(r.data.shearX+l-r.shearX)*n,r.shearY+=(r.data.shearY+c-r.shearY)*n;break;case 3:r.shearX+=l*n,r.shearY+=c*n}}},Qt=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.shearX+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.shearX=this.getRelativeValue(i,n,h,r.shearX,r.data.shearX))}},$t=class extends Ce{boneIndex=0;constructor(e,t,i){super(e,t,re.shearY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];r.active&&(r.shearY=this.getRelativeValue(i,n,h,r.shearY,r.data.shearY))}},ei=class extends ue{boneIndex=0;constructor(e,t){super(e,[re.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,i){e*=2,this.frames[e]=t,this.frames[e+1]=i}apply(e,t,i,s,n,h,a){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){(h==0||h==1)&&(r.inherit=r.data.inherit);return}r.inherit=this.frames[ue.search(o,i,2)+1]}},ti=class extends Re{slotIndex=0;constructor(e,t,i){super(e,t,[re.rgb+"|"+i,re.alpha+"|"+i]),this.slotIndex=i}getFrameEntries(){return 5}setFrame(e,t,i,s,n,h){e*=5,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(i<o[0]){let w=r.data.color;switch(h){case 0:l.setFromColor(w);return;case 1:l.add((w.r-l.r)*n,(w.g-l.g)*n,(w.b-l.b)*n,(w.a-l.a)*n)}return}let c=0,d=0,f=0,u=0,m=ue.search(o,i,5),g=this.curves[m/5];switch(g){case 0:let w=o[m];c=o[m+1],d=o[m+2],f=o[m+3],u=o[m+4];let b=(i-w)/(o[m+5]-w);c+=(o[m+5+1]-c)*b,d+=(o[m+5+2]-d)*b,f+=(o[m+5+3]-f)*b,u+=(o[m+5+4]-u)*b;break;case 1:c=o[m+1],d=o[m+2],f=o[m+3],u=o[m+4];break;default:c=this.getBezierValue(i,m,1,g-2),d=this.getBezierValue(i,m,2,g+18-2),f=this.getBezierValue(i,m,3,g+18*2-2),u=this.getBezierValue(i,m,4,g+18*3-2)}n==1?l.set(c,d,f,u):(h==0&&l.setFromColor(r.data.color),l.add((c-l.r)*n,(d-l.g)*n,(f-l.b)*n,(u-l.a)*n))}},ii=class extends Re{slotIndex=0;constructor(e,t,i){super(e,t,[re.rgb+"|"+i]),this.slotIndex=i}getFrameEntries(){return 4}setFrame(e,t,i,s,n){e<<=2,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color;if(i<o[0]){let g=r.data.color;switch(h){case 0:l.r=g.r,l.g=g.g,l.b=g.b;return;case 1:l.r+=(g.r-l.r)*n,l.g+=(g.g-l.g)*n,l.b+=(g.b-l.b)*n}return}let c=0,d=0,f=0,u=ue.search(o,i,4),m=this.curves[u>>2];switch(m){case 0:let g=o[u];c=o[u+1],d=o[u+2],f=o[u+3];let w=(i-g)/(o[u+4]-g);c+=(o[u+4+1]-c)*w,d+=(o[u+4+2]-d)*w,f+=(o[u+4+3]-f)*w;break;case 1:c=o[u+1],d=o[u+2],f=o[u+3];break;default:c=this.getBezierValue(i,u,1,m-2),d=this.getBezierValue(i,u,2,m+18-2),f=this.getBezierValue(i,u,3,m+18*2-2)}if(n==1)l.r=c,l.g=d,l.b=f;else{if(h==0){let g=r.data.color;l.r=g.r,l.g=g.g,l.b=g.b}l.r+=(c-l.r)*n,l.g+=(d-l.g)*n,l.b+=(f-l.b)*n}}},si=class extends Ce{slotIndex=0;constructor(e,t,i){super(e,t,re.alpha+"|"+i),this.slotIndex=i}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.color;if(i<this.frames[0]){let c=r.data.color;switch(h){case 0:o.a=c.a;return;case 1:o.a+=(c.a-o.a)*n}return}let l=this.getCurveValue(i);n==1?o.a=l:(h==0&&(o.a=r.data.color.a),o.a+=(l-o.a)*n)}},ri=class extends Re{slotIndex=0;constructor(e,t,i){super(e,t,[re.rgb+"|"+i,re.alpha+"|"+i,re.rgb2+"|"+i]),this.slotIndex=i}getFrameEntries(){return 8}setFrame(e,t,i,s,n,h,a,r,o){e<<=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h,this.frames[e+5]=a,this.frames[e+6]=r,this.frames[e+7]=o}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(i<o[0]){let v=r.data.color,y=r.data.darkColor;switch(h){case 0:l.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:l.add((v.r-l.r)*n,(v.g-l.g)*n,(v.b-l.b)*n,(v.a-l.a)*n),c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let d=0,f=0,u=0,m=0,g=0,w=0,b=0,x=ue.search(o,i,8),p=this.curves[x>>3];switch(p){case 0:let v=o[x];d=o[x+1],f=o[x+2],u=o[x+3],m=o[x+4],g=o[x+5],w=o[x+6],b=o[x+7];let y=(i-v)/(o[x+8]-v);d+=(o[x+8+1]-d)*y,f+=(o[x+8+2]-f)*y,u+=(o[x+8+3]-u)*y,m+=(o[x+8+4]-m)*y,g+=(o[x+8+5]-g)*y,w+=(o[x+8+6]-w)*y,b+=(o[x+8+7]-b)*y;break;case 1:d=o[x+1],f=o[x+2],u=o[x+3],m=o[x+4],g=o[x+5],w=o[x+6],b=o[x+7];break;default:d=this.getBezierValue(i,x,1,p-2),f=this.getBezierValue(i,x,2,p+18-2),u=this.getBezierValue(i,x,3,p+18*2-2),m=this.getBezierValue(i,x,4,p+18*3-2),g=this.getBezierValue(i,x,5,p+18*4-2),w=this.getBezierValue(i,x,6,p+18*5-2),b=this.getBezierValue(i,x,7,p+18*6-2)}if(n==1)l.set(d,f,u,m),c.r=g,c.g=w,c.b=b;else{if(h==0){l.setFromColor(r.data.color);let v=r.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}l.add((d-l.r)*n,(f-l.g)*n,(u-l.b)*n,(m-l.a)*n),c.r+=(g-c.r)*n,c.g+=(w-c.g)*n,c.b+=(b-c.b)*n}}},ni=class extends Re{slotIndex=0;constructor(e,t,i){super(e,t,[re.rgb+"|"+i,re.rgb2+"|"+i]),this.slotIndex=i}getFrameEntries(){return 7}setFrame(e,t,i,s,n,h,a,r){e*=7,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h,this.frames[e+5]=a,this.frames[e+6]=r}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,l=r.color,c=r.darkColor;if(i<o[0]){let v=r.data.color,y=r.data.darkColor;switch(h){case 0:l.r=v.r,l.g=v.g,l.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:l.r+=(v.r-l.r)*n,l.g+=(v.g-l.g)*n,l.b+=(v.b-l.b)*n,c.r+=(y.r-c.r)*n,c.g+=(y.g-c.g)*n,c.b+=(y.b-c.b)*n}return}let d=0,f=0,u=0,m=0,g=0,w=0,b=0,x=ue.search(o,i,7),p=this.curves[x/7];switch(p){case 0:let v=o[x];d=o[x+1],f=o[x+2],u=o[x+3],g=o[x+4],w=o[x+5],b=o[x+6];let y=(i-v)/(o[x+7]-v);d+=(o[x+7+1]-d)*y,f+=(o[x+7+2]-f)*y,u+=(o[x+7+3]-u)*y,g+=(o[x+7+4]-g)*y,w+=(o[x+7+5]-w)*y,b+=(o[x+7+6]-b)*y;break;case 1:d=o[x+1],f=o[x+2],u=o[x+3],g=o[x+4],w=o[x+5],b=o[x+6];break;default:d=this.getBezierValue(i,x,1,p-2),f=this.getBezierValue(i,x,2,p+18-2),u=this.getBezierValue(i,x,3,p+18*2-2),g=this.getBezierValue(i,x,4,p+18*3-2),w=this.getBezierValue(i,x,5,p+18*4-2),b=this.getBezierValue(i,x,6,p+18*5-2)}if(n==1)l.r=d,l.g=f,l.b=u,c.r=g,c.g=w,c.b=b;else{if(h==0){let v=r.data.color,y=r.data.darkColor;l.r=v.r,l.g=v.g,l.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}l.r+=(d-l.r)*n,l.g+=(f-l.g)*n,l.b+=(u-l.b)*n,c.r+=(g-c.r)*n,c.g+=(w-c.g)*n,c.b+=(b-c.b)*n}}},qe=class extends ue{slotIndex=0;attachmentNames;constructor(e,t){super(e,[re.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,i){this.frames[e]=t,this.attachmentNames[e]=i}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(r.bone.active){if(a==1){h==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(i<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,r,r.data.attachmentName);return}this.setAttachment(e,r,this.attachmentNames[ue.search1(this.frames,i)])}}setAttachment(e,t,i){t.setAttachment(i?e.getAttachment(this.slotIndex,i):null)}},ai=class extends Re{slotIndex=0;attachment;vertices;constructor(e,t,i,s){super(e,t,[re.deform+"|"+i+"|"+s.id]),this.slotIndex=i,this.attachment=s,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,i){this.frames[e]=t,this.vertices[e]=i}setBezier(e,t,i,s,n,h,a,r,o,l,c){let d=this.curves,f=this.getFrameCount()+e*18;i==0&&(d[t]=2+f);let u=(s-h*2+r)*.03,m=o*.03-a*.06,g=((h-r)*3-s+l)*.006,w=(a-o+.33333333)*.018,b=u*2+g,x=m*2+w,p=(h-s)*.3+u+g*.16666667,v=a*.3+m+w*.16666667,y=s+p,A=v;for(let C=f+18;f<C;f+=2)d[f]=y,d[f+1]=A,p+=b,v+=x,b+=g,x+=w,y+=p,A+=v}getCurvePercent(e,t){let i=this.curves,s=i[t];switch(s){case 0:let r=this.frames[t];return(e-r)/(this.frames[t+this.getFrameEntries()]-r);case 1:return 0}if(s-=2,i[s]>e){let r=this.frames[t];return i[s+1]*(e-r)/(i[s]-r)}let n=s+18;for(s+=2;s<n;s+=2)if(i[s]>=e){let r=i[s-2],o=i[s-1];return o+(e-r)/(i[s]-r)*(i[s+1]-o)}let h=i[n-2],a=i[n-1];return a+(1-a)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.getAttachment();if(!o||!(o instanceof Ee)||o.timelineAttachment!=this.attachment)return;let l=r.deform;l.length==0&&(h=0);let c=this.vertices,d=c[0].length,f=this.frames;if(i<f[0]){switch(h){case 0:l.length=0;return;case 1:if(n==1){l.length=0;return}l.length=d;let x=o;if(x.bones){n=1-n;for(var u=0;u<d;u++)l[u]*=n}else{let p=x.vertices;for(var u=0;u<d;u++)l[u]+=(p[u]-l[u])*n}}return}if(l.length=d,i>=f[f.length-1]){let x=c[f.length-1];if(n==1)if(h==3){let p=o;if(p.bones)for(let v=0;v<d;v++)l[v]+=x[v];else{let v=p.vertices;for(let y=0;y<d;y++)l[y]+=x[y]-v[y]}}else L.arrayCopy(x,0,l,0,d);else switch(h){case 0:{let v=o;if(v.bones)for(let y=0;y<d;y++)l[y]=x[y]*n;else{let y=v.vertices;for(let A=0;A<d;A++){let C=y[A];l[A]=C+(x[A]-C)*n}}break}case 1:case 2:for(let v=0;v<d;v++)l[v]+=(x[v]-l[v])*n;break;case 3:let p=o;if(p.bones)for(let v=0;v<d;v++)l[v]+=x[v]*n;else{let v=p.vertices;for(let y=0;y<d;y++)l[y]+=(x[y]-v[y])*n}}return}let m=ue.search1(f,i),g=this.getCurvePercent(i,m),w=c[m],b=c[m+1];if(n==1)if(h==3){let x=o;if(x.bones)for(let p=0;p<d;p++){let v=w[p];l[p]+=v+(b[p]-v)*g}else{let p=x.vertices;for(let v=0;v<d;v++){let y=w[v];l[v]+=y+(b[v]-y)*g-p[v]}}}else for(let x=0;x<d;x++){let p=w[x];l[x]=p+(b[x]-p)*g}else switch(h){case 0:{let p=o;if(p.bones)for(let v=0;v<d;v++){let y=w[v];l[v]=(y+(b[v]-y)*g)*n}else{let v=p.vertices;for(let y=0;y<d;y++){let A=w[y],C=v[y];l[y]=C+(A+(b[y]-A)*g-C)*n}}break}case 1:case 2:for(let p=0;p<d;p++){let v=w[p];l[p]+=(v+(b[p]-v)*g-l[p])*n}break;case 3:let x=o;if(x.bones)for(let p=0;p<d;p++){let v=w[p];l[p]+=(v+(b[p]-v)*g)*n}else{let p=x.vertices;for(let v=0;v<d;v++){let y=w[v];l[v]+=(y+(b[v]-y)*g-p[v])*n}}}}},is=class extends ue{events;constructor(e){super(e,is.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t.time,this.events[e]=t}apply(e,t,i,s,n,h,a){if(!s)return;let r=this.frames,o=this.frames.length;if(t>i)this.apply(e,t,Number.MAX_VALUE,s,n,h,a),t=-1;else if(t>=r[o-1])return;if(i<r[0])return;let l=0;if(t<r[0])l=0;else{l=ue.search1(r,t)+1;let c=r[l];for(;l>0&&r[l-1]==c;)l--}for(;l<o&&i>=r[l];l++)s.push(this.events[l])}},ht=is;B(ht,"propertyIds",[""+re.event]);var ss=class extends ue{drawOrders;constructor(e){super(e,ss.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,i){this.frames[e]=t,this.drawOrders[e]=i}apply(e,t,i,s,n,h,a){if(a==1){h==0&&L.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(h==0||h==1)&&L.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=ue.search1(this.frames,i),o=this.drawOrders[r];if(!o)L.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let l=e.drawOrder,c=e.slots;for(let d=0,f=o.length;d<f;d++)l[d]=c[o[d]]}}},Ge=ss;B(Ge,"propertyIds",[""+re.drawOrder]);var li=class extends Re{constraintIndex=0;constructor(e,t,i){super(e,t,[re.ikConstraint+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 6}setFrame(e,t,i,s,n,h,a){e*=6,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=n,this.frames[e+4]=h?1:0,this.frames[e+5]=a?1:0}apply(e,t,i,s,n,h,a){let r=e.ikConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.mix=r.data.mix,r.softness=r.data.softness,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch;return;case 1:r.mix+=(r.data.mix-r.mix)*n,r.softness+=(r.data.softness-r.softness)*n,r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch}return}let l=0,c=0,d=ue.search(o,i,6),f=this.curves[d/6];switch(f){case 0:let u=o[d];l=o[d+1],c=o[d+2];let m=(i-u)/(o[d+6]-u);l+=(o[d+6+1]-l)*m,c+=(o[d+6+2]-c)*m;break;case 1:l=o[d+1],c=o[d+2];break;default:l=this.getBezierValue(i,d,1,f-2),c=this.getBezierValue(i,d,2,f+18-2)}h==0?(r.mix=r.data.mix+(l-r.data.mix)*n,r.softness=r.data.softness+(c-r.data.softness)*n,a==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0)):(r.mix+=(l-r.mix)*n,r.softness+=(c-r.softness)*n,a==0&&(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0))}},oi=class extends Re{constraintIndex=0;constructor(e,t,i){super(e,t,[re.transformConstraint+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 7}setFrame(e,t,i,s,n,h,a,r){let o=this.frames;e*=7,o[e]=t,o[e+1]=i,o[e+2]=s,o[e+3]=n,o[e+4]=h,o[e+5]=a,o[e+6]=r}apply(e,t,i,s,n,h,a){let r=e.transformConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){let b=r.data;switch(h){case 0:r.mixRotate=b.mixRotate,r.mixX=b.mixX,r.mixY=b.mixY,r.mixScaleX=b.mixScaleX,r.mixScaleY=b.mixScaleY,r.mixShearY=b.mixShearY;return;case 1:r.mixRotate+=(b.mixRotate-r.mixRotate)*n,r.mixX+=(b.mixX-r.mixX)*n,r.mixY+=(b.mixY-r.mixY)*n,r.mixScaleX+=(b.mixScaleX-r.mixScaleX)*n,r.mixScaleY+=(b.mixScaleY-r.mixScaleY)*n,r.mixShearY+=(b.mixShearY-r.mixShearY)*n}return}let l,c,d,f,u,m,g=ue.search(o,i,7),w=this.curves[g/7];switch(w){case 0:let b=o[g];l=o[g+1],c=o[g+2],d=o[g+3],f=o[g+4],u=o[g+5],m=o[g+6];let x=(i-b)/(o[g+7]-b);l+=(o[g+7+1]-l)*x,c+=(o[g+7+2]-c)*x,d+=(o[g+7+3]-d)*x,f+=(o[g+7+4]-f)*x,u+=(o[g+7+5]-u)*x,m+=(o[g+7+6]-m)*x;break;case 1:l=o[g+1],c=o[g+2],d=o[g+3],f=o[g+4],u=o[g+5],m=o[g+6];break;default:l=this.getBezierValue(i,g,1,w-2),c=this.getBezierValue(i,g,2,w+18-2),d=this.getBezierValue(i,g,3,w+18*2-2),f=this.getBezierValue(i,g,4,w+18*3-2),u=this.getBezierValue(i,g,5,w+18*4-2),m=this.getBezierValue(i,g,6,w+18*5-2)}if(h==0){let b=r.data;r.mixRotate=b.mixRotate+(l-b.mixRotate)*n,r.mixX=b.mixX+(c-b.mixX)*n,r.mixY=b.mixY+(d-b.mixY)*n,r.mixScaleX=b.mixScaleX+(f-b.mixScaleX)*n,r.mixScaleY=b.mixScaleY+(u-b.mixScaleY)*n,r.mixShearY=b.mixShearY+(m-b.mixShearY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(d-r.mixY)*n,r.mixScaleX+=(f-r.mixScaleX)*n,r.mixScaleY+=(u-r.mixScaleY)*n,r.mixShearY+=(m-r.mixShearY)*n}},hi=class extends Ce{constraintIndex=0;constructor(e,t,i){super(e,t,re.pathConstraintPosition+"|"+i),this.constraintIndex=i}apply(e,t,i,s,n,h,a){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.position=this.getAbsoluteValue(i,n,h,r.position,r.data.position))}},ci=class extends Ce{constraintIndex=0;constructor(e,t,i){super(e,t,re.pathConstraintSpacing+"|"+i),this.constraintIndex=i}apply(e,t,i,s,n,h,a){let r=e.pathConstraints[this.constraintIndex];r.active&&(r.spacing=this.getAbsoluteValue(i,n,h,r.spacing,r.data.spacing))}},di=class extends Re{constraintIndex=0;constructor(e,t,i){super(e,t,[re.pathConstraintMix+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 4}setFrame(e,t,i,s,n){let h=this.frames;e<<=2,h[e]=t,h[e+1]=i,h[e+2]=s,h[e+3]=n}apply(e,t,i,s,n,h,a){let r=e.pathConstraints[this.constraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(h){case 0:r.mixRotate=r.data.mixRotate,r.mixX=r.data.mixX,r.mixY=r.data.mixY;return;case 1:r.mixRotate+=(r.data.mixRotate-r.mixRotate)*n,r.mixX+=(r.data.mixX-r.mixX)*n,r.mixY+=(r.data.mixY-r.mixY)*n}return}let l,c,d,f=ue.search(o,i,4),u=this.curves[f>>2];switch(u){case 0:let m=o[f];l=o[f+1],c=o[f+2],d=o[f+3];let g=(i-m)/(o[f+4]-m);l+=(o[f+4+1]-l)*g,c+=(o[f+4+2]-c)*g,d+=(o[f+4+3]-d)*g;break;case 1:l=o[f+1],c=o[f+2],d=o[f+3];break;default:l=this.getBezierValue(i,f,1,u-2),c=this.getBezierValue(i,f,2,u+18-2),d=this.getBezierValue(i,f,3,u+18*2-2)}if(h==0){let m=r.data;r.mixRotate=m.mixRotate+(l-m.mixRotate)*n,r.mixX=m.mixX+(c-m.mixX)*n,r.mixY=m.mixY+(d-m.mixY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(d-r.mixY)*n}},Oe=class extends Ce{constraintIndex=0;constructor(e,t,i,s){super(e,t,s+"|"+i),this.constraintIndex=i}apply(e,t,i,s,n,h,a){let r;if(this.constraintIndex==-1){const o=i>=this.frames[0]?this.getCurveValue(i):0;for(const l of e.physicsConstraints)l.active&&this.global(l.data)&&this.set(l,this.getAbsoluteValue2(i,n,h,this.get(l),this.setup(l),o))}else r=e.physicsConstraints[this.constraintIndex],r.active&&this.set(r,this.getAbsoluteValue(i,n,h,this.get(r),this.setup(r)))}},fi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},ui=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},mi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},gi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},xi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},pi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},bi=class extends Oe{constructor(e,t,i){super(e,t,i,re.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},rs=class extends ue{constraintIndex;constructor(e,t){super(e,rs.propertyIds),this.constraintIndex=t}getFrameCount(){return this.frames.length}setFrame(e,t){this.frames[e]=t}apply(e,t,i,s,n,h,a){let r;if(this.constraintIndex!=-1&&(r=e.physicsConstraints[this.constraintIndex],!r.active))return;const o=this.frames;if(t>i)this.apply(e,t,Number.MAX_VALUE,[],n,h,a),t=-1;else if(t>=o[o.length-1])return;if(!(i<o[0])&&(t<o[0]||i>=o[ue.search1(o,t)+1]))if(r!=null)r.reset();else for(const l of e.physicsConstraints)l.active&&l.reset()}},vt=rs;B(vt,"propertyIds",[re.physicsConstraintReset.toString()]);var Ve=class extends ue{slotIndex;attachment;constructor(e,t,i){super(e,[re.sequence+"|"+t+"|"+i.sequence.id]),this.slotIndex=t,this.attachment=i}getFrameEntries(){return Ve.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,i,s,n){let h=this.frames;e*=Ve.ENTRIES,h[e]=t,h[e+Ve.MODE]=i|s<<4,h[e+Ve.DELAY]=n}apply(e,t,i,s,n,h,a){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.attachment,l=this.attachment;if(o!=l&&(!(o instanceof Ee)||o.timelineAttachment!=l))return;let c=this.frames;if(i<c[0]){(h==0||h==1)&&(r.sequenceIndex=-1);return}let d=ue.search(c,i,Ve.ENTRIES),f=c[d],u=c[d+Ve.MODE],m=c[d+Ve.DELAY];if(!this.attachment.sequence)return;let g=u>>4,w=this.attachment.sequence.regions.length,b=$i[u&15];if(b!=0)switch(g+=(i-f)/m+1e-5|0,b){case 1:g=Math.min(w-1,g);break;case 2:g%=w;break;case 3:{let x=(w<<1)-2;g=x==0?0:g%x,g>=w&&(g=x-g);break}case 4:g=Math.max(w-1-g,0);break;case 5:g=w-1-g%w;break;case 6:{let x=(w<<1)-2;g=x==0?0:(g+w-1)%x,g>=w&&(g=x-g)}}r.sequenceIndex=g}},Qe=Ve;B(Qe,"ENTRIES",3),B(Qe,"MODE",1),B(Qe,"DELAY",2);var yt=class{static emptyAnimation(){return yt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ls(this);propertyIDs=new Ut;animationsChanged=!1;trackEntryPool=new lt(()=>new as);constructor(e){this.data=e}update(e){e*=this.timeScale;let t=this.tracks;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(!n)continue;n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast;let h=e*n.timeScale;if(n.delay>0){if(n.delay-=h,n.delay>0)continue;h=-n.delay,n.delay=0}let a=n.next;if(a){let r=n.trackLast-a.delay;if(r>=0){for(a.delay=0,a.trackTime+=n.timeScale==0?0:(r/n.timeScale+e)*a.timeScale,n.trackTime+=h,this.setCurrent(i,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(n.trackLast>=n.trackEnd&&!n.mixingFrom){t[i]=null,this.queue.end(n),this.clearNext(n);continue}if(n.mixingFrom&&this.updateMixingFrom(n,e)){let r=n.mixingFrom;for(n.mixingFrom=null,r&&(r.mixingTo=null);r;)this.queue.end(r),r=r.mixingFrom}n.trackTime+=h}this.queue.drain()}updateMixingFrom(e,t){let i=e.mixingFrom;if(!i)return!0;let s=this.updateMixingFrom(i,t);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),s):(i.trackTime+=t*i.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,i=this.tracks,s=!1;for(let d=0,f=i.length;d<f;d++){let u=i[d];if(!u||u.delay>0)continue;s=!0;let m=d==0?1:u.mixBlend,g=u.alpha;u.mixingFrom?g*=this.applyMixingFrom(u,e,m):u.trackTime>=u.trackEnd&&!u.next&&(g=0);let w=g>=u.alphaAttachmentThreshold,b=u.animationLast,x=u.getAnimationTime(),p=x,v=t;u.reverse&&(p=u.animation.duration-p,v=null);let y=u.animation.timelines,A=y.length;if(d==0&&g==1||m==3){d==0&&(w=!0);for(let C=0;C<A;C++){L.webkit602BugfixHelper(g,m);var n=y[C];n instanceof qe?this.applyAttachmentTimeline(n,e,p,m,w):n.apply(e,b,p,v,g,m,0)}}else{let C=u.timelineMode,I=u.shortestRotation,R=!I&&u.timelinesRotation.length!=A<<1;R&&(u.timelinesRotation.length=A<<1);for(let Y=0;Y<A;Y++){let k=y[Y],F=C[Y]==At?m:0;!I&&k instanceof ot?this.applyRotateTimeline(k,e,p,g,F,u.timelinesRotation,Y<<1,R):k instanceof qe?this.applyAttachmentTimeline(k,e,p,m,w):(L.webkit602BugfixHelper(g,m),k.apply(e,b,p,v,g,F,0))}}this.queueEvents(u,x),t.length=0,u.nextAnimationLast=x,u.nextTrackLast=u.trackTime}for(var h=this.unkeyedState+yi,a=e.slots,r=0,o=e.slots.length;r<o;r++){var l=a[r];if(l.attachmentState==h){var c=l.data.attachmentName;l.setAttachment(c?e.getAttachment(l.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(e,t,i){let s=e.mixingFrom;s.mixingFrom&&this.applyMixingFrom(s,t,i);let n=0;e.mixDuration==0?(n=1,i==1&&(i=0)):(n=e.mixTime/e.mixDuration,n>1&&(n=1),i!=1&&(i=s.mixBlend));let h=n<s.mixAttachmentThreshold,a=n<s.mixDrawOrderThreshold,r=s.animation.timelines,o=r.length,l=s.alpha*e.interruptAlpha,c=l*(1-n),d=s.animationLast,f=s.getAnimationTime(),u=f,m=null;if(s.reverse?u=s.animation.duration-u:n<s.eventThreshold&&(m=this.events),i==3)for(let g=0;g<o;g++)r[g].apply(t,d,u,m,c,i,1);else{let g=s.timelineMode,w=s.timelineHoldMix,b=s.shortestRotation,x=!b&&s.timelinesRotation.length!=o<<1;x&&(s.timelinesRotation.length=o<<1),s.totalAlpha=0;for(let p=0;p<o;p++){let v=r[p],y=1,A,C=0;switch(g[p]){case At:if(!a&&v instanceof Ge)continue;A=i,C=c;break;case wi:A=0,C=c;break;case vi:A=i,C=l;break;case Ct:A=0,C=l;break;default:A=0;let I=w[p];C=l*Math.max(0,1-I.mixTime/I.mixDuration);break}s.totalAlpha+=C,!b&&v instanceof ot?this.applyRotateTimeline(v,t,u,C,A,s.timelinesRotation,p<<1,x):v instanceof qe?this.applyAttachmentTimeline(v,t,u,A,h&&C>=s.alphaAttachmentThreshold):(L.webkit602BugfixHelper(C,i),a&&v instanceof Ge&&A==0&&(y=0),v.apply(t,d,u,m,C,A,y))}}return e.mixDuration>0&&this.queueEvents(s,f),this.events.length=0,s.nextAnimationLast=f,s.nextTrackLast=s.trackTime,n}applyAttachmentTimeline(e,t,i,s,n){var h=t.slots[e.slotIndex];h.bone.active&&(i<e.frames[0]?(s==0||s==1)&&this.setAttachment(t,h,h.data.attachmentName,n):this.setAttachment(t,h,e.attachmentNames[ue.search1(e.frames,i)],n),h.attachmentState<=this.unkeyedState&&(h.attachmentState=this.unkeyedState+yi))}setAttachment(e,t,i,s){t.setAttachment(i?e.getAttachment(t.data.index,i):null),s&&(t.attachmentState=this.unkeyedState+hs)}applyRotateTimeline(e,t,i,s,n,h,a,r){if(r&&(h[a]=0),s==1){e.apply(t,0,i,null,1,n,0);return}let o=t.bones[e.boneIndex];if(!o.active)return;let l=e.frames,c=0,d=0;if(i<l[0])switch(n){case 0:o.rotation=o.data.rotation;default:return;case 1:c=o.rotation,d=o.data.rotation}else c=n==0?o.data.rotation:o.rotation,d=o.data.rotation+e.getCurveValue(i);let f=0,u=d-c;if(u-=Math.ceil(u/360-.5)*360,u==0)f=h[a];else{let m=0,g=0;r?(m=0,g=u):(m=h[a],g=h[a+1]);let w=m-m%360;f=u+w;let b=u>=0,x=m>=0;Math.abs(g)<=90&&X.signum(g)!=X.signum(u)&&(Math.abs(m-w)>180?(f+=360*X.signum(m),x=b):w!=0?f-=360*X.signum(m):x=b),x!=b&&(f+=360*X.signum(m)),h[a]=f}h[a+1]=u,o.rotation=c+f*s}queueEvents(e,t){let i=e.animationStart,s=e.animationEnd,n=s-i,h=e.trackLast%n,a=this.events,r=0,o=a.length;for(;r<o;r++){let c=a[r];if(c.time<h)break;c.time>s||this.queue.event(e,c)}let l=!1;if(e.loop)if(n==0)l=!0;else{const c=Math.floor(e.trackTime/n);l=c>0&&c>Math.floor(e.trackLast/n)}else l=t>=s&&e.animationLast<s;for(l&&this.queue.complete(e);r<o;r++){let c=a[r];c.time<i||this.queue.event(e,c)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,i=this.tracks.length;t<i;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let i=t;for(;;){let s=i.mixingFrom;if(!s)break;this.queue.end(s),i.mixingFrom=null,i.mixingTo=null,i=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,i){let s=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,s&&(i&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,i=!1){let s=this.data.skeletonData.findAnimation(t);if(!s)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,s,i)}setAnimationWith(e,t,i=!1){if(!t)throw new Error("animation cannot be null.");let s=!0,n=this.expandToIndex(e);n&&(n.nextTrackLast==-1?(this.tracks[e]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,s=!1):this.clearNext(n));let h=this.trackEntry(e,t,i,n);return this.setCurrent(e,h,s),this.queue.drain(),h}addAnimation(e,t,i=!1,s=0){let n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,n,i,s)}addAnimationWith(e,t,i=!1,s=0){if(!t)throw new Error("animation cannot be null.");let n=this.expandToIndex(e);if(n)for(;n.next;)n=n.next;let h=this.trackEntry(e,t,i,n);return n?(n.next=h,h.previous=n,s<=0&&(s+=n.getTrackComplete()-h.mixDuration)):(this.setCurrent(e,h,!0),this.queue.drain()),h.delay=s,h}setEmptyAnimation(e,t=0){let i=this.setAnimationWith(e,yt.emptyAnimation(),!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){let s=this.addAnimationWith(e,yt.emptyAnimation(),!1,i);return i<=0&&(s.delay+=s.mixDuration-t),s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,s=this.tracks.length;i<s;i++){let n=this.tracks[i];n&&this.setEmptyAnimation(n.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(L.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,i,s){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=e,n.animation=t,n.loop=i,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=t.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=s?this.data.getMix(s.animation,t):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,i=e.length;t<i;t++){let s=e[t];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do(!s.mixingTo||s.mixBlend!=3)&&this.computeHold(s),s=s.mixingTo;while(s)}}}computeHold(e){let t=e.mixingTo,i=e.animation.timelines,s=e.animation.timelines.length,n=e.timelineMode;n.length=s;let h=e.timelineHoldMix;h.length=0;let a=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<s;r++)n[r]=a.addAll(i[r].getPropertyIds())?Ct:vi;return}e:for(let r=0;r<s;r++){let o=i[r],l=o.getPropertyIds();if(!a.addAll(l))n[r]=At;else if(!t||o instanceof qe||o instanceof Ge||o instanceof ht||!t.animation.hasTimeline(l))n[r]=wi;else{for(let c=t.mixingTo;c;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(e.mixDuration>0){n[r]=os,h[r]=c;continue e}break}n[r]=Ct}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},ns=yt;B(ns,"_emptyAnimation",new bt("<empty>",[],0));var as=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,this.previous!=null&&t<=0&&(t+=this.previous.getTrackComplete()-e),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}},ls=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(ye.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ye.interrupt),this.objects.push(e)}end(e){this.objects.push(ye.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ye.dispose),this.objects.push(e)}complete(e){this.objects.push(ye.complete),this.objects.push(e)}event(e,t){this.objects.push(ye.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let i=0;i<e.length;i+=2){let s=e[i],n=e[i+1];switch(s){case ye.start:n.listener&&n.listener.start&&n.listener.start(n);for(let a=0;a<t.length;a++){let r=t[a];r.start&&r.start(n)}break;case ye.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let a=0;a<t.length;a++){let r=t[a];r.interrupt&&r.interrupt(n)}break;case ye.end:n.listener&&n.listener.end&&n.listener.end(n);for(let a=0;a<t.length;a++){let r=t[a];r.end&&r.end(n)}case ye.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let a=0;a<t.length;a++){let r=t[a];r.dispose&&r.dispose(n)}this.animState.trackEntryPool.free(n);break;case ye.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let a=0;a<t.length;a++){let r=t[a];r.complete&&r.complete(n)}break;case ye.event:let h=e[i+++2];n.listener&&n.listener.event&&n.listener.event(n,h);for(let a=0;a<t.length;a++){let r=t[a];r.event&&r.event(n,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ye=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(ye||{}),Js=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},At=0,wi=1,vi=2,Ct=3,os=4,yi=1,hs=2,Qs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,i){let s=this.skeletonData.findAnimation(e);if(!s)throw new Error("Animation not found: "+e);let n=this.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);this.setMixWith(s,n,i)}setMixWith(e,t,i){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let s=e.name+"."+t.name;this.animationToMixTime[s]=i}getMix(e,t){let i=e.name+"."+t.name,s=this.animationToMixTime[i];return s===void 0?this.defaultMix:s}},St=class extends Ee{color=new O(1,1,1,1);constructor(e){super(e)}copy(){let e=new St(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},$e=class extends Ee{endSlot=null;color=new O(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new $e(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},Ai=class{_image;constructor(e){this._image=e}getImage(){return this._image}},Tt=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(Tt||{}),cs=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(cs||{}),ds=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},$s=class extends Ai{setFilters(e,t){}setWraps(e,t){}dispose(){}},fs=class{pages=new Array;regions=new Array;constructor(e){let t=new er(e),i=new Array(4),s={};s.size=l=>{l.width=parseInt(i[1]),l.height=parseInt(i[2])},s.format=()=>{},s.filter=l=>{l.minFilter=L.enumValue(Tt,i[1]),l.magFilter=L.enumValue(Tt,i[2])},s.repeat=l=>{i[1].indexOf("x")!=-1&&(l.uWrap=10497),i[1].indexOf("y")!=-1&&(l.vWrap=10497)},s.pma=l=>{l.pma=i[1]=="true"};var n={};n.xy=l=>{l.x=parseInt(i[1]),l.y=parseInt(i[2])},n.size=l=>{l.width=parseInt(i[1]),l.height=parseInt(i[2])},n.bounds=l=>{l.x=parseInt(i[1]),l.y=parseInt(i[2]),l.width=parseInt(i[3]),l.height=parseInt(i[4])},n.offset=l=>{l.offsetX=parseInt(i[1]),l.offsetY=parseInt(i[2])},n.orig=l=>{l.originalWidth=parseInt(i[1]),l.originalHeight=parseInt(i[2])},n.offsets=l=>{l.offsetX=parseInt(i[1]),l.offsetY=parseInt(i[2]),l.originalWidth=parseInt(i[3]),l.originalHeight=parseInt(i[4])},n.rotate=l=>{let c=i[1];c=="true"?l.degrees=90:c!="false"&&(l.degrees=parseInt(c))},n.index=l=>{l.index=parseInt(i[1])};let h=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(i,h)==0);)h=t.readLine();let a=null,r=null,o=null;for(;h!==null;)if(h.trim().length==0)a=null,h=t.readLine();else if(a){let l=new Ci(a,h);for(;;){let c=t.readEntry(i,h=t.readLine());if(c==0)break;let d=n[i[0]];if(d)d(l);else{r||(r=[]),o||(o=[]),r.push(i[0]);let f=[];for(let u=0;u<c;u++)f.push(parseInt(i[u+1]));o.push(f)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),r&&r.length>0&&o&&o.length>0&&(l.names=r,l.values=o,r=null,o=null),l.u=l.x/a.width,l.v=l.y/a.height,l.degrees==90?(l.u2=(l.x+l.height)/a.width,l.v2=(l.y+l.width)/a.height):(l.u2=(l.x+l.width)/a.width,l.v2=(l.y+l.height)/a.height),this.regions.push(l)}else{for(a=new us(h.trim());t.readEntry(i,h=t.readLine())!=0;){let l=s[i[0]];l&&l(a)}this.pages.push(a)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let i of this.pages)i.setTexture(e.get(t+i.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},er=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let i=t.indexOf(":");if(i==-1)return 0;e[0]=t.substr(0,i).trim();for(let s=1,n=i+1;;s++){let h=t.indexOf(",",n);if(h==-1)return e[s]=t.substr(n).trim(),s;if(e[s]=t.substr(n,h-n).trim(),n=h+1,s==4)return 4}}},us=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Ci=class extends ds{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},De=class extends Ee{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new O(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new O(0,0,0,0);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=L.newFloatArray(e.length));let t=this.uvs,i=this.uvs.length,s=this.region.u,n=this.region.v,h=0,a=0;if(this.region instanceof Ci){let r=this.region,o=r.page,l=o.width,c=o.height;switch(r.degrees){case 90:s-=(r.originalHeight-r.offsetY-r.height)/l,n-=(r.originalWidth-r.offsetX-r.width)/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let d=0;d<i;d+=2)t[d]=s+e[d+1]*h,t[d+1]=n+(1-e[d])*a;return;case 180:s-=(r.originalWidth-r.offsetX-r.width)/l,n-=r.offsetY/c,h=r.originalWidth/l,a=r.originalHeight/c;for(let d=0;d<i;d+=2)t[d]=s+(1-e[d])*h,t[d+1]=n+(1-e[d+1])*a;return;case 270:s-=r.offsetY/l,n-=r.offsetX/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let d=0;d<i;d+=2)t[d]=s+(1-e[d+1])*h,t[d+1]=n+e[d]*a;return}s-=r.offsetX/l,n-=(r.originalHeight-r.offsetY-r.height)/c,h=r.originalWidth/l,a=r.originalHeight/c}else this.region?(h=this.region.u2-s,a=this.region.v2-n):(s=n=0,h=a=1);for(let r=0;r<i;r+=2)t[r]=s+e[r]*h,t[r+1]=n+e[r+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(e){this.parentMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let e=new De(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),L.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),L.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),L.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,e.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(e.edges=new Array(this.edges.length),L.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,t,i,s,n,h){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,i,s,n,h)}newLinkedMesh(){let e=new De(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},He=class extends Ee{lengths=[];closed=!1;constantSpeed=!1;color=new O(1,1,1,1);constructor(e){super(e)}copy(){let e=new He(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),L.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Si=class extends Ee{x=0;y=0;rotation=0;color=new O(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,t){return t.x=this.x*e.a+this.y*e.b+e.worldX,t.y=this.x*e.c+this.y*e.d+e.worldY,t}computeWorldRotation(e){const t=this.rotation*X.degRad,i=Math.cos(t),s=Math.sin(t),n=i*e.a+s*e.b,h=i*e.c+s*e.d;return X.atan2Deg(h,n)}copy(){let e=new Si(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},ms=class extends zt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new O(1,1,1,1);path;region=null;sequence=null;offset=L.newFloatArray(8);uvs=L.newFloatArray(8);tempColor=new O(1,1,1,1);constructor(e,t){super(e),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,t=this.uvs;if(e==null){t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=1,t[6]=1,t[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,s=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*i,h=-this.height/2*this.scaleY+this.region.offsetY*s,a=n+this.region.width*i,r=h+this.region.height*s,o=this.rotation*X.degRad,l=Math.cos(o),c=Math.sin(o),d=this.x,f=this.y,u=n*l+d,m=n*c,g=h*l+f,w=h*c,b=a*l+d,x=a*c,p=r*l+f,v=r*c,y=this.offset;y[0]=u-w,y[1]=g+m,y[2]=u-v,y[3]=p+m,y[4]=b-v,y[5]=p+x,y[6]=b-w,y[7]=g+x,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,i,s){this.sequence!=null&&this.sequence.apply(e,this);let n=e.bone,h=this.offset,a=n.worldX,r=n.worldY,o=n.a,l=n.b,c=n.c,d=n.d,f=0,u=0;f=h[0],u=h[1],t[i]=f*o+u*l+a,t[i+1]=f*c+u*d+r,i+=s,f=h[2],u=h[3],t[i]=f*o+u*l+a,t[i+1]=f*c+u*d+r,i+=s,f=h[4],u=h[5],t[i]=f*o+u*l+a,t[i+1]=f*c+u*d+r,i+=s,f=h[6],u=h[7],t[i]=f*o+u*l+a,t[i+1]=f*c+u*d+r}copy(){let e=new ms(this.name,this.path);return e.region=this.region,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,L.arrayCopy(this.uvs,0,e.uvs,0,8),L.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},ae=ms;B(ae,"X1",0),B(ae,"Y1",1),B(ae,"C1R",2),B(ae,"C1G",3),B(ae,"C1B",4),B(ae,"C1A",5),B(ae,"U1",6),B(ae,"V1",7),B(ae,"X2",8),B(ae,"Y2",9),B(ae,"C2R",10),B(ae,"C2G",11),B(ae,"C2B",12),B(ae,"C2A",13),B(ae,"U2",14),B(ae,"V2",15),B(ae,"X3",16),B(ae,"Y3",17),B(ae,"C3R",18),B(ae,"C3G",19),B(ae,"C3B",20),B(ae,"C3A",21),B(ae,"U3",22),B(ae,"V3",23),B(ae,"X4",24),B(ae,"Y4",25),B(ae,"C4R",26),B(ae,"C4G",27),B(ae,"C4B",28),B(ae,"C4A",29),B(ae,"U4",30),B(ae,"V4",31);var tr=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,i){let s=i.regions;for(let n=0,h=s.length;n<h;n++){let a=i.getPath(t,n),r=this.atlas.findRegion(a);if(r==null)throw new Error("Region not found in atlas: "+a+" (sequence: "+e+")");s[n]=r}}newRegionAttachment(e,t,i,s){let n=new ae(t,i);if(s!=null)this.loadSequence(t,i,s);else{let h=this.atlas.findRegion(i);if(!h)throw new Error("Region not found in atlas: "+i+" (region attachment: "+t+")");n.region=h}return n}newMeshAttachment(e,t,i,s){let n=new De(t,i);if(s!=null)this.loadSequence(t,i,s);else{let h=this.atlas.findRegion(i);if(!h)throw new Error("Region not found in atlas: "+i+" (mesh attachment: "+t+")");n.region=h}return n}newBoundingBoxAttachment(e,t){return new St(t)}newPathAttachment(e,t){return new He(t)}newPointAttachment(e,t){return new Si(t)}newClippingAttachment(e,t){return new $e(t)}},Ti=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=ct.Normal;skinRequired=!1;color=new O;icon;visible=!1;constructor(e,t,i){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=i}},ct=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(ct||{}),Ii=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,i){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=i,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,i,s,n,h,a){this.ax=e,this.ay=t,this.arotation=i,this.ascaleX=s,this.ascaleY=n,this.ashearX=h,this.ashearY=a;let r=this.parent;if(!r){let f=this.skeleton;const u=f.scaleX,m=f.scaleY,g=(i+h)*X.degRad,w=(i+90+a)*X.degRad;this.a=Math.cos(g)*s*u,this.b=Math.cos(w)*n*u,this.c=Math.sin(g)*s*m,this.d=Math.sin(w)*n*m,this.worldX=e*u+f.x,this.worldY=t*m+f.y;return}let o=r.a,l=r.b,c=r.c,d=r.d;switch(this.worldX=o*e+l*t+r.worldX,this.worldY=c*e+d*t+r.worldY,this.inherit){case 0:{const f=(i+h)*X.degRad,u=(i+90+a)*X.degRad,m=Math.cos(f)*s,g=Math.cos(u)*n,w=Math.sin(f)*s,b=Math.sin(u)*n;this.a=o*m+l*w,this.b=o*g+l*b,this.c=c*m+d*w,this.d=c*g+d*b;return}case 1:{const f=(i+h)*X.degRad,u=(i+90+a)*X.degRad;this.a=Math.cos(f)*s,this.b=Math.cos(u)*n,this.c=Math.sin(f)*s,this.d=Math.sin(u)*n;break}case 2:{let f=o*o+c*c,u=0;f>1e-4?(f=Math.abs(o*d-l*c)/f,o/=this.skeleton.scaleX,c/=this.skeleton.scaleY,l=c*f,d=o*f,u=Math.atan2(c,o)*X.radDeg):(o=0,c=0,u=90-Math.atan2(d,l)*X.radDeg);const m=(i+h-u)*X.degRad,g=(i+a-u+90)*X.degRad,w=Math.cos(m)*s,b=Math.cos(g)*n,x=Math.sin(m)*s,p=Math.sin(g)*n;this.a=o*w-l*x,this.b=o*b-l*p,this.c=c*w+d*x,this.d=c*b+d*p;break}case 3:case 4:{i*=X.degRad;const f=Math.cos(i),u=Math.sin(i);let m=(o*f+l*u)/this.skeleton.scaleX,g=(c*f+d*u)/this.skeleton.scaleY,w=Math.sqrt(m*m+g*g);w>1e-5&&(w=1/w),m*=w,g*=w,w=Math.sqrt(m*m+g*g),this.inherit==3&&o*d-l*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),i=Math.PI/2+Math.atan2(g,m);const b=Math.cos(i)*w,x=Math.sin(i)*w;h*=X.degRad,a=(90+a)*X.degRad;const p=Math.cos(h)*s,v=Math.cos(a)*n,y=Math.sin(h)*s,A=Math.sin(a)*n;this.a=m*p+b*y,this.b=m*v+b*A,this.c=g*p+x*y,this.d=g*v+x*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*X.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*X.radDeg;return}let t=e.a,i=e.b,s=e.c,n=e.d,h=1/(t*n-i*s),a=n*h,r=i*h,o=s*h,l=t*h,c=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=c*a-d*r,this.ay=d*l-c*o;let f,u,m,g;if(this.inherit==1)f=this.a,u=this.b,m=this.c,g=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*n-i*s)/(t*t+s*s),y=t/this.skeleton.scaleX;i=-(s/this.skeleton.scaleY)*v*this.skeleton.scaleX,n=y*v*this.skeleton.scaleY,h=1/(t*n-i*s),a=n*h,r=i*h;break}case 3:case 4:let w=X.cosDeg(this.rotation),b=X.sinDeg(this.rotation);t=(t*w+i*b)/this.skeleton.scaleX,s=(s*w+n*b)/this.skeleton.scaleY;let x=Math.sqrt(t*t+s*s);x>1e-5&&(x=1/x),t*=x,s*=x,x=Math.sqrt(t*t+s*s),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);let p=X.PI/2+Math.atan2(s,t);i=Math.cos(p)*x,n=Math.sin(p)*x,h=1/(t*n-i*s),a=n*h,r=i*h,o=s*h,l=t*h}f=a*this.a-r*this.c,u=a*this.b-r*this.d,m=l*this.c-o*this.a,g=l*this.d-o*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+m*m),this.ascaleX>1e-4){let w=f*g-u*m;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(f*u+m*g,w)*X.radDeg,this.arotation=Math.atan2(m,f)*X.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,u)*X.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*X.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*X.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),i=e.x-this.worldX,s=e.y-this.worldY;return e.x=i*this.d*t-s*this.b*t,e.y=s*this.a*t-i*this.c*t,e}localToWorld(e){let t=e.x,i=e.y;return e.x=t*this.a+i*this.b+this.worldX,e.y=t*this.c+i*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=X.sinDeg(e),i=X.cosDeg(e);return Math.atan2(this.a*t-this.c*i,this.d*i-this.b*t)*X.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=X.sinDeg(e),i=X.cosDeg(e);return Math.atan2(i*this.c+t*this.d,i*this.a+t*this.b)*X.radDeg}rotateWorld(e){e*=X.degRad;const t=Math.sin(e),i=Math.cos(e),s=this.a,n=this.b;this.a=i*s-t*this.c,this.b=i*n-t*this.d,this.c=t*s+i*this.c,this.d=t*n+i*this.d}},dt=class{constructor(e,t,i){this.name=e,this.order=t,this.skinRequired=i}},gs=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",i=new Mi){this.textureLoader=e,this.pathPrefix=t,this.downloader=i}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,i){this.toLoad--,this.loaded++,this.assets[t]=i,e&&e(t,i)}error(e,t,i){this.toLoad--,this.loaded++,this.errors[t]=i,e&&e(t,i)}loadAll(){return new Promise((t,i)=>{let s=()=>{if(this.isLoadingComplete()){this.hasErrors()?i(this.errors):t(this);return}requestAnimationFrame(s)};requestAnimationFrame(s)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},i=()=>{}){e=this.start(e),this.downloader.downloadBinary(e,s=>{this.success(t,e,s)},(s,n)=>{this.error(i,e,`Couldn't load binary ${e}: status ${s}, ${n}`)})}loadText(e,t=()=>{},i=()=>{}){e=this.start(e),this.downloader.downloadText(e,s=>{this.success(t,e,s)},(s,n)=>{this.error(i,e,`Couldn't load text ${e}: status ${s}, ${n}`)})}loadJson(e,t=()=>{},i=()=>{}){e=this.start(e),this.downloader.downloadJson(e,s=>{this.success(t,e,s)},(s,n)=>{this.error(i,e,`Couldn't load JSON ${e}: status ${s}, ${n}`)})}loadTexture(e,t=()=>{},i=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(h=>h.ok?h.blob():(this.error(i,e,`Couldn't load image: ${e}`),null)).then(h=>h?createImageBitmap(h,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(h=>{h&&this.success(t,e,this.textureLoader(h))});else{let h=new Image;h.crossOrigin="anonymous",h.onload=()=>{this.success(t,e,this.textureLoader(h))},h.onerror=()=>{this.error(i,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),h.src=e}}loadTextureAtlas(e,t=()=>{},i=()=>{},s){let n=e.lastIndexOf("/"),h=n>=0?e.substring(0,n+1):"";e=this.start(e),this.downloader.downloadText(e,a=>{try{let r=new fs(a),o=r.pages.length,l=!1;for(let c of r.pages)this.loadTexture(s?s[c.name]:h+c.name,(d,f)=>{l||(c.setTexture(f),--o==0&&this.success(t,e,r))},(d,f)=>{l||this.error(i,e,`Couldn't load texture atlas ${e} page image: ${d}`),l=!0})}catch(r){this.error(i,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(a,r)=>{this.error(i,e,`Couldn't load texture atlas ${e}: status ${a}, ${r}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let i=this.errors[e];throw Error("Asset not found: "+e+(i?`
2
2
  `+i:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},Mi=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),i=t.length,s=new Uint8Array(i),n=0;n<i;n++)s[n]=t.charCodeAt(n);return s}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,i){if(this.start(e,t,i))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let s=new XMLHttpRequest;s.overrideMimeType("text/html"),s.open("GET",e,!0);let n=()=>{this.finish(e,s.status,s.responseText)};s.onload=n,s.onerror=n,s.send()}downloadJson(e,t,i){this.downloadText(e,s=>{t(JSON.parse(s))},i)}downloadBinary(e,t,i){if(this.start(e,t,i))return;if(this.rawDataUris[e]){try{let h=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(h))}catch(h){this.finish(e,400,JSON.stringify(h))}return}let s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer";let n=()=>{this.finish(e,s.status,s.response)};s.onload=()=>{s.status==200||s.status==0?this.finish(e,200,new Uint8Array(s.response)):n()},s.onerror=n,s.send()}start(e,t,i){let s=this.callbacks[e];try{if(s)return!0;this.callbacks[e]=s=[]}finally{s.push(t,i)}}finish(e,t,i){let s=this.callbacks[e];delete this.callbacks[e];let n=t==200||t==0?[i]:[t,i];for(let h=n.length-1,a=s.length;h<a;h+=2)s[h].apply(null,n)}},Ei=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Ri=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},xs=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let n=t.findBone(e.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${e.bones[s].name}`);this.bones.push(n)}let i=t.findBone(e.target.name);if(!i)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=i,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,i=this.bones;switch(i.length){case 1:this.apply1(i[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(i[0],i[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,i,s,n,h,a){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let o=r.a,l=r.b,c=r.c,d=r.d,f=-e.ashearX-e.arotation,u=0,m=0;switch(e.inherit){case 1:u=(t-e.worldX)*X.signum(e.skeleton.scaleX),m=(i-e.worldY)*X.signum(e.skeleton.scaleY);break;case 2:let b=Math.abs(o*d-l*c)/Math.max(1e-4,o*o+c*c),x=o/e.skeleton.scaleX,p=c/e.skeleton.scaleY;l=-p*b*e.skeleton.scaleX,d=x*b*e.skeleton.scaleY,f+=Math.atan2(p,x)*X.radDeg;default:let v=t-r.worldX,y=i-r.worldY,A=o*d-l*c;Math.abs(A)<=1e-4?(u=0,m=0):(u=(v*d-y*l)/A-e.ax,m=(y*o-v*c)/A-e.ay)}f+=Math.atan2(m,u)*X.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=e.ascaleX,w=e.ascaleY;if(s||n){switch(e.inherit){case 3:case 4:u=t-e.worldX,m=i-e.worldY}const b=e.data.length*g;if(b>1e-4){const x=u*u+m*m;if(s&&x<b*b||n&&x>b*b){const p=(Math.sqrt(x)/b-1)*a+1;g*=p,h&&(w*=p)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*a,g,w,e.ashearX,e.ashearY)}apply2(e,t,i,s,n,h,a,r,o){if(e.inherit!=0||t.inherit!=0)return;let l=e.ax,c=e.ay,d=e.ascaleX,f=e.ascaleY,u=d,m=f,g=t.ascaleX,w=0,b=0,x=0;d<0?(d=-d,w=180,x=-1):(w=0,x=1),f<0&&(f=-f,x=-x),g<0?(g=-g,b=180):b=0;let p=t.ax,v=0,y=0,A=0,C=e.a,I=e.b,R=e.c,Y=e.d,k=Math.abs(d-f)<=1e-4;!k||h?(v=0,y=C*p+e.worldX,A=R*p+e.worldY):(v=t.ay,y=C*p+I*v+e.worldX,A=R*p+Y*v+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,I=F.b,R=F.c,Y=F.d;let P=C*Y-I*R,E=y-F.worldX,M=A-F.worldY;P=Math.abs(P)<=1e-4?0:1/P;let V=(E*Y-M*I)*P-l,ie=(M*C-E*R)*P-c,te=Math.sqrt(V*V+ie*ie),he=t.data.length*g,me,fe;if(te<1e-4){this.apply1(e,i,s,!1,h,!1,o),t.updateWorldTransformWith(p,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}E=i-F.worldX,M=s-F.worldY;let ne=(E*Y-M*I)*P-l,se=(M*C-E*R)*P-c,ce=ne*ne+se*se;if(r!=0){r*=d*(g+1)*.5;let xe=Math.sqrt(ce),Te=xe-te-he*d+r;if(Te>0){let Ie=Math.min(1,Te/(r*2))-1;Ie=(Te-r*(1-Ie*Ie))/xe,ne-=Ie*ne,se-=Ie*se,ce=ne*ne+se*se}}e:if(k){he*=d;let xe=(ce-te*te-he*he)/(2*te*he);xe<-1?(xe=-1,fe=Math.PI*n):xe>1?(xe=1,fe=0,h&&(C=(Math.sqrt(ce)/(te+he)-1)*o+1,u*=C,a&&(m*=C))):fe=Math.acos(xe)*n,C=te+he*xe,I=he*Math.sin(fe),me=Math.atan2(se*C-ne*I,ne*C+se*I)}else{C=d*he,I=f*he;let xe=C*C,Te=I*I,Ie=Math.atan2(se,ne);R=Te*te*te+xe*ce-xe*Te;let _e=-2*Te*te,rt=Te-xe;if(Y=_e*_e-4*rt*R,Y>=0){let nt=Math.sqrt(Y);_e<0&&(nt=-nt),nt=-(_e+nt)*.5;let Vs=nt/rt,Ds=R/nt,at=Math.abs(Vs)<Math.abs(Ds)?Vs:Ds;if(at*at<=ce){M=Math.sqrt(ce-at*at)*n,me=Ie-Math.atan2(M,at),fe=Math.atan2(M/f,(at-te)/d);break e}}let gt=X.PI,Dt=te-C,Gi=Dt*Dt,Ls=0,Bs=0,Nt=te+C,Hi=Nt*Nt,Os=0;R=-C*te/(xe-Te),R>=-1&&R<=1&&(R=Math.acos(R),E=C*Math.cos(R)+te,M=I*Math.sin(R),Y=E*E+M*M,Y<Gi&&(gt=R,Gi=Y,Dt=E,Ls=M),Y>Hi&&(Bs=R,Hi=Y,Nt=E,Os=M)),ce<=(Gi+Hi)*.5?(me=Ie-Math.atan2(Ls*n,Dt),fe=gt*n):(me=Ie-Math.atan2(Os*n,Nt),fe=Bs*n)}let we=Math.atan2(v,p)*x,Fe=e.arotation;me=(me-we)*X.radDeg+w-Fe,me>180?me-=360:me<-180&&(me+=360),e.updateWorldTransformWith(l,c,Fe+me*o,u,m,0,0),Fe=t.arotation,fe=((fe+we)*X.radDeg-t.ashearX)*x+b-Fe,fe>180?fe-=360:fe<-180&&(fe+=360),t.updateWorldTransformWith(p,v,Fe+fe*o,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Yi=class extends dt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},ki=class extends dt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=It.Fixed;spacingMode=Mt.Fixed;rotateMode=Et.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},It=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(It||{}),Mt=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Mt||{}),Et=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Et||{}),Ne=class{data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let s=0,n=e.bones.length;s<n;s++){let h=t.findBone(e.bones[s].name);if(!h)throw new Error(`Couldn't find bone ${e.bones[s].name}.`);this.bones.push(h)}let i=t.findSlot(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=i,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof He))return;let i=this.mixRotate,s=this.mixX,n=this.mixY;if(i==0&&s==0&&n==0)return;let h=this.data,a=h.rotateMode==0,r=h.rotateMode==2,o=this.bones,l=o.length,c=a?l:l+1,d=L.setArraySize(this.spaces,c),f=r?this.lengths=L.setArraySize(this.lengths,l):[],u=this.spacing;switch(h.spacingMode){case 2:if(r)for(let y=0,A=c-1;y<A;y++){let C=o[y],I=C.data.length,R=I*C.a,Y=I*C.c;f[y]=Math.sqrt(R*R+Y*Y)}L.arrayFill(d,1,c,u);break;case 3:let p=0;for(let y=0,A=c-1;y<A;){let C=o[y],I=C.data.length;if(I<Ne.epsilon)r&&(f[y]=0),d[++y]=u;else{let R=I*C.a,Y=I*C.c,k=Math.sqrt(R*R+Y*Y);r&&(f[y]=k),d[++y]=k,p+=k}}if(p>0){p=c/p*u;for(let y=1;y<c;y++)d[y]*=p}break;default:let v=h.spacingMode==0;for(let y=0,A=c-1;y<A;){let C=o[y],I=C.data.length;if(I<Ne.epsilon)r&&(f[y]=0),d[++y]=u;else{let R=I*C.a,Y=I*C.c,k=Math.sqrt(R*R+Y*Y);r&&(f[y]=k),d[++y]=(v?I+u:u)*k/I}}}let m=this.computeWorldPositions(t,c,a),g=m[0],w=m[1],b=h.offsetRotation,x=!1;if(b==0)x=h.rotateMode==1;else{x=!1;let p=this.target.bone;b*=p.a*p.d-p.b*p.c>0?X.degRad:-X.degRad}for(let p=0,v=3;p<l;p++,v+=3){let y=o[p];y.worldX+=(g-y.worldX)*s,y.worldY+=(w-y.worldY)*n;let A=m[v],C=m[v+1],I=A-g,R=C-w;if(r){let Y=f[p];if(Y!=0){let k=(Math.sqrt(I*I+R*R)/Y-1)*i+1;y.a*=k,y.c*=k}}if(g=A,w=C,i>0){let Y=y.a,k=y.b,F=y.c,P=y.d,E=0,M=0,V=0;if(a?E=m[v-1]:d[p+1]==0?E=m[v+2]:E=Math.atan2(R,I),E-=Math.atan2(F,Y),x){M=Math.cos(E),V=Math.sin(E);let ie=y.data.length;g+=(ie*(M*Y-V*F)-I)*i,w+=(ie*(V*Y+M*F)-R)*i}else E+=b;E>X.PI?E-=X.PI2:E<-X.PI&&(E+=X.PI2),E*=i,M=Math.cos(E),V=Math.sin(E),y.a=M*Y-V*F,y.b=M*k-V*P,y.c=V*Y+M*F,y.d=V*k+M*P}y.updateAppliedTransform()}}computeWorldPositions(e,t,i){let s=this.target,n=this.position,h=this.spaces,a=L.setArraySize(this.positions,t*3+2),r=this.world,o=e.closed,l=e.worldVerticesLength,c=l/6,d=Ne.NONE;if(!e.constantSpeed){let ie=e.lengths;c-=o?1:2;let te=ie[c];this.data.positionMode==1&&(n*=te);let he;switch(this.data.spacingMode){case 2:he=te;break;case 3:he=te/t;break;default:he=1}r=L.setArraySize(this.world,8);for(let me=0,fe=0,ne=0;me<t;me++,fe+=3){let se=h[me]*he;n+=se;let ce=n;if(o)ce%=te,ce<0&&(ce+=te),ne=0;else if(ce<0){d!=Ne.BEFORE&&(d=Ne.BEFORE,e.computeWorldVertices(s,2,4,r,0,2)),this.addBeforePosition(ce,r,0,a,fe);continue}else if(ce>te){d!=Ne.AFTER&&(d=Ne.AFTER,e.computeWorldVertices(s,l-6,4,r,0,2)),this.addAfterPosition(ce-te,r,0,a,fe);continue}for(;;ne++){let we=ie[ne];if(!(ce>we)){if(ne==0)ce/=we;else{let Fe=ie[ne-1];ce=(ce-Fe)/(we-Fe)}break}}ne!=d&&(d=ne,o&&ne==c?(e.computeWorldVertices(s,l-4,4,r,0,2),e.computeWorldVertices(s,0,4,r,4,2)):e.computeWorldVertices(s,ne*6+2,8,r,0,2)),this.addCurvePosition(ce,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],a,fe,i||me>0&&se==0)}return a}o?(l+=2,r=L.setArraySize(this.world,l),e.computeWorldVertices(s,2,l-4,r,0,2),e.computeWorldVertices(s,0,2,r,l-4,2),r[l-2]=r[0],r[l-1]=r[1]):(c--,l-=4,r=L.setArraySize(this.world,l),e.computeWorldVertices(s,2,l,r,0,2));let f=L.setArraySize(this.curves,c),u=0,m=r[0],g=r[1],w=0,b=0,x=0,p=0,v=0,y=0,A=0,C=0,I=0,R=0,Y=0,k=0,F=0,P=0;for(let ie=0,te=2;ie<c;ie++,te+=6)w=r[te],b=r[te+1],x=r[te+2],p=r[te+3],v=r[te+4],y=r[te+5],A=(m-w*2+x)*.1875,C=(g-b*2+p)*.1875,I=((w-x)*3-m+v)*.09375,R=((b-p)*3-g+y)*.09375,Y=A*2+I,k=C*2+R,F=(w-m)*.75+A+I*.16666667,P=(b-g)*.75+C+R*.16666667,u+=Math.sqrt(F*F+P*P),F+=Y,P+=k,Y+=I,k+=R,u+=Math.sqrt(F*F+P*P),F+=Y,P+=k,u+=Math.sqrt(F*F+P*P),F+=Y+I,P+=k+R,u+=Math.sqrt(F*F+P*P),f[ie]=u,m=v,g=y;this.data.positionMode==1&&(n*=u);let E;switch(this.data.spacingMode){case 2:E=u;break;case 3:E=u/t;break;default:E=1}let M=this.segments,V=0;for(let ie=0,te=0,he=0,me=0;ie<t;ie++,te+=3){let fe=h[ie]*E;n+=fe;let ne=n;if(o)ne%=u,ne<0&&(ne+=u),he=0;else if(ne<0){this.addBeforePosition(ne,r,0,a,te);continue}else if(ne>u){this.addAfterPosition(ne-u,r,l-4,a,te);continue}for(;;he++){let se=f[he];if(!(ne>se)){if(he==0)ne/=se;else{let ce=f[he-1];ne=(ne-ce)/(se-ce)}break}}if(he!=d){d=he;let se=he*6;for(m=r[se],g=r[se+1],w=r[se+2],b=r[se+3],x=r[se+4],p=r[se+5],v=r[se+6],y=r[se+7],A=(m-w*2+x)*.03,C=(g-b*2+p)*.03,I=((w-x)*3-m+v)*.006,R=((b-p)*3-g+y)*.006,Y=A*2+I,k=C*2+R,F=(w-m)*.3+A+I*.16666667,P=(b-g)*.3+C+R*.16666667,V=Math.sqrt(F*F+P*P),M[0]=V,se=1;se<8;se++)F+=Y,P+=k,Y+=I,k+=R,V+=Math.sqrt(F*F+P*P),M[se]=V;F+=Y,P+=k,V+=Math.sqrt(F*F+P*P),M[8]=V,F+=Y+I,P+=k+R,V+=Math.sqrt(F*F+P*P),M[9]=V,me=0}for(ne*=V;;me++){let se=M[me];if(!(ne>se)){if(me==0)ne/=se;else{let ce=M[me-1];ne=me+(ne-ce)/(se-ce)}break}}this.addCurvePosition(ne*.1,m,g,w,b,x,p,v,y,a,te,i||ie>0&&fe==0)}return a}addBeforePosition(e,t,i,s,n){let h=t[i],a=t[i+1],r=t[i+2]-h,o=t[i+3]-a,l=Math.atan2(o,r);s[n]=h+e*Math.cos(l),s[n+1]=a+e*Math.sin(l),s[n+2]=l}addAfterPosition(e,t,i,s,n){let h=t[i+2],a=t[i+3],r=h-t[i],o=a-t[i+1],l=Math.atan2(o,r);s[n]=h+e*Math.cos(l),s[n+1]=a+e*Math.sin(l),s[n+2]=l}addCurvePosition(e,t,i,s,n,h,a,r,o,l,c,d){if(e==0||isNaN(e)){l[c]=t,l[c+1]=i,l[c+2]=Math.atan2(n-i,s-t);return}let f=e*e,u=f*e,m=1-e,g=m*m,w=g*m,b=m*e,x=b*3,p=m*x,v=x*e,y=t*w+s*p+h*v+r*u,A=i*w+n*p+a*v+o*u;l[c]=y,l[c+1]=A,d&&(e<.001?l[c+2]=Math.atan2(n-i,s-t):l[c+2]=Math.atan2(A-(i*g+n*b*2+a*f),y-(t*g+s*b*2+h*f)))}},et=Ne;B(et,"NONE",-1),B(et,"BEFORE",-2),B(et,"AFTER",-3),B(et,"epsilon",1e-5);var ir=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const i=this.data.x>0,s=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,a=this.bone,r=a.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const o=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=o,this.lastTime=this.skeleton.time;const l=a.worldX,c=a.worldY;if(this._reset)this._reset=!1,this.ux=l,this.uy=c;else{let d=this.remaining,f=this.inertia,u=this.data.limit*o,m=this.data.step,g=this.skeleton.data.referenceScale,w=-1;if(i||s){if(i){const b=(this.ux-l)*f;this.xOffset+=b>u?u:b<-u?-u:b,this.ux=l}if(s){const b=(this.uy-c)*f;this.yOffset+=b>u?u:b<-u?-u:b,this.uy=c}if(d>=m){w=Math.pow(this.damping,60*m);const b=this.massInverse*m,x=this.strength,p=this.wind*g,v=(ft.yDown?-this.gravity:this.gravity)*g;do i&&(this.xVelocity+=(p-this.xOffset*x)*b,this.xOffset+=this.xVelocity*m,this.xVelocity*=w),s&&(this.yVelocity-=(v+this.yOffset*x)*b,this.yOffset+=this.yVelocity*m,this.yVelocity*=w),d-=m;while(d>=m)}i&&(a.worldX+=this.xOffset*t*this.data.x),s&&(a.worldY+=this.yOffset*t*this.data.y)}if(n||h){let b=Math.atan2(a.c,a.a),x=0,p=0,v=0,y=this.cx-a.worldX,A=this.cy-a.worldY;if(y>u?y=u:y<-u&&(y=-u),A>u?A=u:A<-u&&(A=-u),n){v=(this.data.rotate+this.data.shearX)*t;let C=Math.atan2(A+this.ty,y+this.tx)-b-this.rotateOffset*v;this.rotateOffset+=(C-Math.ceil(C*X.invPI2-.5)*X.PI2)*f,C=this.rotateOffset*v+b,x=Math.cos(C),p=Math.sin(C),h&&(C=r*a.getWorldScaleX(),C>0&&(this.scaleOffset+=(y*x+A*p)*f/C))}else{x=Math.cos(b),p=Math.sin(b);const C=r*a.getWorldScaleX();C>0&&(this.scaleOffset+=(y*x+A*p)*f/C)}if(d=this.remaining,d>=m){w==-1&&(w=Math.pow(this.damping,60*m));const C=this.massInverse*m,I=this.strength,R=this.wind,Y=ft.yDown?-this.gravity:this.gravity,k=r/g;for(;;)if(d-=m,h&&(this.scaleVelocity+=(R*x-Y*p-this.scaleOffset*I)*C,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=w),n){if(this.rotateVelocity-=((R*p+Y*x)*k+this.rotateOffset*I)*C,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=w,d<m)break;const F=this.rotateOffset*v+b;x=Math.cos(F),p=Math.sin(F)}else if(d<m)break}}this.remaining=d}this.cx=a.worldX,this.cy=a.worldY;break;case 3:i&&(a.worldX+=this.xOffset*t*this.data.x),s&&(a.worldY+=this.yOffset*t*this.data.y)}if(n){let o=this.rotateOffset*t,l=0,c=0,d=0;if(this.data.shearX>0){let f=0;this.data.rotate>0&&(f=o*this.data.rotate,l=Math.sin(f),c=Math.cos(f),d=a.b,a.b=c*d-l*a.d,a.d=l*d+c*a.d),f+=o*this.data.shearX,l=Math.sin(f),c=Math.cos(f),d=a.a,a.a=c*d-l*a.c,a.c=l*d+c*a.c}else o*=this.data.rotate,l=Math.sin(o),c=Math.cos(o),d=a.a,a.a=c*d-l*a.c,a.c=l*d+c*a.c,d=a.b,a.b=c*d-l*a.d,a.d=l*d+c*a.d}if(h){const o=1+this.scaleOffset*t*this.data.scaleX;a.a*=o,a.c*=o}e!=3&&(this.tx=r*a.a,this.ty=r*a.c),a.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,i){const s=i*X.degRad,n=Math.cos(s),h=Math.sin(s),a=this.cx-e,r=this.cy-t;this.translate(a*n-r*h-a,a*h+r*n-r)}},ps=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new O,this.darkColor=e.darkColor?new O:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof Ee)||!(this.attachment instanceof Ee)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,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}},bs=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new We;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let s=0;s<e.bones.length;s++){let n=t.findBone(e.bones[s].name);if(!n)throw new Error(`Couldn't find bone ${e.bones[s].name}.`);this.bones.push(n)}let i=t.findBone(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=i,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=t!=0||i!=0,r=this.target,o=r.a,l=r.b,c=r.c,d=r.d,f=o*d-l*c>0?X.degRad:-X.degRad,u=this.data.offsetRotation*f,m=this.data.offsetShearY*f,g=this.bones;for(let w=0,b=g.length;w<b;w++){let x=g[w];if(e!=0){let p=x.a,v=x.b,y=x.c,A=x.d,C=Math.atan2(c,o)-Math.atan2(y,p)+u;C>X.PI?C-=X.PI2:C<-X.PI&&(C+=X.PI2),C*=e;let I=Math.cos(C),R=Math.sin(C);x.a=I*p-R*y,x.b=I*v-R*A,x.c=R*p+I*y,x.d=R*v+I*A}if(a){let p=this.temp;r.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(p.x-x.worldX)*t,x.worldY+=(p.y-x.worldY)*i}if(s!=0){let p=Math.sqrt(x.a*x.a+x.c*x.c);p!=0&&(p=(p+(Math.sqrt(o*o+c*c)-p+this.data.offsetScaleX)*s)/p),x.a*=p,x.c*=p}if(n!=0){let p=Math.sqrt(x.b*x.b+x.d*x.d);p!=0&&(p=(p+(Math.sqrt(l*l+d*d)-p+this.data.offsetScaleY)*n)/p),x.b*=p,x.d*=p}if(h>0){let p=x.b,v=x.d,y=Math.atan2(v,p),A=Math.atan2(d,l)-Math.atan2(c,o)-(y-Math.atan2(x.c,x.a));A>X.PI?A-=X.PI2:A<-X.PI&&(A+=X.PI2),A=y+(A+m)*h;let C=Math.sqrt(p*p+v*v);x.b=Math.cos(A)*C,x.d=Math.sin(A)*C}x.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=t!=0||i!=0,r=this.target,o=r.a,l=r.b,c=r.c,d=r.d,f=o*d-l*c>0?X.degRad:-X.degRad,u=this.data.offsetRotation*f,m=this.data.offsetShearY*f,g=this.bones;for(let w=0,b=g.length;w<b;w++){let x=g[w];if(e!=0){let p=x.a,v=x.b,y=x.c,A=x.d,C=Math.atan2(c,o)+u;C>X.PI?C-=X.PI2:C<-X.PI&&(C+=X.PI2),C*=e;let I=Math.cos(C),R=Math.sin(C);x.a=I*p-R*y,x.b=I*v-R*A,x.c=R*p+I*y,x.d=R*v+I*A}if(a){let p=this.temp;r.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),x.worldX+=p.x*t,x.worldY+=p.y*i}if(s!=0){let p=(Math.sqrt(o*o+c*c)-1+this.data.offsetScaleX)*s+1;x.a*=p,x.c*=p}if(n!=0){let p=(Math.sqrt(l*l+d*d)-1+this.data.offsetScaleY)*n+1;x.b*=p,x.d*=p}if(h>0){let p=Math.atan2(d,l)-Math.atan2(c,o);p>X.PI?p-=X.PI2:p<-X.PI&&(p+=X.PI2);let v=x.b,y=x.d;p=Math.atan2(y,v)+(p-X.PI/2+m)*h;let A=Math.sqrt(v*v+y*y);x.b=Math.cos(p)*A,x.d=Math.sin(p)*A}x.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=this.target,r=this.bones;for(let o=0,l=r.length;o<l;o++){let c=r[o],d=c.arotation;e!=0&&(d+=(a.arotation-d+this.data.offsetRotation)*e);let f=c.ax,u=c.ay;f+=(a.ax-f+this.data.offsetX)*t,u+=(a.ay-u+this.data.offsetY)*i;let m=c.ascaleX,g=c.ascaleY;s!=0&&m!=0&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*s)/m),n!=0&&g!=0&&(g=(g+(a.ascaleY-g+this.data.offsetScaleY)*n)/g);let w=c.ashearY;h!=0&&(w+=(a.ashearY-w+this.data.offsetShearY)*h),c.updateWorldTransformWith(f,u,d,m,g,c.ashearX,w)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,h=this.mixShearY,a=this.target,r=this.bones;for(let o=0,l=r.length;o<l;o++){let c=r[o],d=c.arotation+(a.arotation+this.data.offsetRotation)*e,f=c.ax+(a.ax+this.data.offsetX)*t,u=c.ay+(a.ay+this.data.offsetY)*i,m=c.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*s+1),g=c.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),w=c.ashearY+(a.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(f,u,d,m,g,c.ashearX,w)}}},Fi=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Fi.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let i=e.bones[t],s;if(!i.parent)s=new Ii(i,this,null);else{let n=this.bones[i.parent.index];s=new Ii(i,this,n),n.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let i=e.slots[t],s=this.bones[i.boneData.index],n=new ps(i,s);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let i=e.ikConstraints[t];this.ikConstraints.push(new xs(i,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let i=e.transformConstraints[t];this.transformConstraints.push(new bs(i,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let i=e.pathConstraints[t];this.pathConstraints.push(new et(i,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let i=e.physicsConstraints[t];this.physicsConstraints.push(new ir(i,this))}this.color=new O(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let d=0,f=t.length;d<f;d++){let u=t[d];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let d=this.skin.bones;for(let f=0,u=this.skin.bones.length;f<u;f++){let m=this.bones[d[f].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let i=this.ikConstraints,s=this.transformConstraints,n=this.pathConstraints,h=this.physicsConstraints,a=i.length,r=s.length,o=n.length,l=this.physicsConstraints.length,c=a+r+o+l;e:for(let d=0;d<c;d++){for(let f=0;f<a;f++){let u=i[f];if(u.data.order==d){this.sortIkConstraint(u);continue e}}for(let f=0;f<r;f++){let u=s[f];if(u.data.order==d){this.sortTransformConstraint(u);continue e}}for(let f=0;f<o;f++){let u=n[f];if(u.data.order==d){this.sortPathConstraint(u);continue e}}for(let f=0;f<l;f++){const u=h[f];if(u.data.order==d){this.sortPhysicsConstraint(u);continue e}}}for(let d=0,f=t.length;d<f;d++)this.sortBone(t[d])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&L.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let i=e.bones,s=i[0];if(this.sortBone(s),i.length==1)this._updateCache.push(e),this.sortReset(s.children);else{let n=i[i.length-1];this.sortBone(n),this._updateCache.push(e),this.sortReset(s.children),n.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&L.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,i=t.data.index,s=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,s),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,s);for(let r=0,o=this.data.skins.length;r<o;r++)this.sortPathConstraintAttachment(this.data.skins[r],i,s);let n=t.getAttachment();n instanceof He&&this.sortPathConstraintAttachmentWith(n,s);let h=e.bones,a=h.length;for(let r=0;r<a;r++)this.sortBone(h[r]);this._updateCache.push(e);for(let r=0;r<a;r++)this.sortReset(h[r].children);for(let r=0;r<a;r++)h[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&L.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,i=t.length;if(e.data.local)for(let s=0;s<i;s++){let n=t[s];this.sortBone(n.parent),this.sortBone(n)}else for(let s=0;s<i;s++)this.sortBone(t[s]);this._updateCache.push(e);for(let s=0;s<i;s++)this.sortReset(t[s].children);for(let s=0;s<i;s++)t[s].sorted=!0}sortPathConstraintAttachment(e,t,i){let s=e.attachments[t];if(s)for(let n in s)this.sortPathConstraintAttachmentWith(s[n],i)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof He))return;let i=e.bones;if(!i)this.sortBone(t);else{let s=this.bones;for(let n=0,h=i.length;n<h;){let a=i[n++];for(a+=n;n<a;)this.sortBone(s[i[n++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&L.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,i=e.length;t<i;t++){let s=e[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(e){if(!e)throw new Error("physics is undefined");let t=this.bones;for(let s=0,n=t.length;s<n;s++){let h=t[s];h.ax=h.x,h.ay=h.y,h.arotation=h.rotation,h.ascaleX=h.scaleX,h.ascaleY=h.scaleY,h.ashearX=h.shearX,h.ashearY=h.shearY}let i=this._updateCache;for(let s=0,n=i.length;s<n;s++)i[s].update(e)}updateWorldTransformWith(e,t){let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let s=t.a,n=t.b,h=t.c,a=t.d;i.worldX=s*this.x+n*this.y+t.worldX,i.worldY=h*this.x+a*this.y+t.worldY;const r=(i.rotation+i.shearX)*X.degRad,o=(i.rotation+90+i.shearY)*X.degRad,l=Math.cos(r)*i.scaleX,c=Math.cos(o)*i.scaleY,d=Math.sin(r)*i.scaleX,f=Math.sin(o)*i.scaleY;i.a=(s*l+n*d)*this.scaleX,i.b=(s*c+n*f)*this.scaleX,i.c=(h*l+a*d)*this.scaleY,i.d=(h*c+a*f)*this.scaleY;let u=this._updateCache;for(let m=0,g=u.length;m<g;m++){let w=u[m];w!=i&&w.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;L.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,i=e.length;t<i;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.data.name==e)return n}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.data.name==e)return n}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let i=0,s=t.length;i<s;i++){let n=t[i],h=n.data.attachmentName;if(h){let a=e.getAttachment(i,h);a&&n.setAttachment(a)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,t);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let s=0,n=i.length;s<n;s++){let h=i[s];if(h.data.name==e){let a=null;if(t&&(a=this.getAttachment(s,t),!a))throw new Error("Attachment not found: "+t+", for slot: "+e);h.setAttachment(a);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(){let e=new We,t=new We;return this.getBounds(e,t),{x:e.x,y:e.y,width:t.x,height:t.y}}getBounds(e,t,i=new Array(2),s=null){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let n=this.drawOrder,h=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let l=0,c=n.length;l<c;l++){let d=n[l];if(!d.bone.active)continue;let f=0,u=null,m=null,g=d.getAttachment();if(g instanceof ae)f=8,u=L.setArraySize(i,f,0),g.computeWorldVertices(d,u,0,2),m=Fi.quadTriangles;else if(g instanceof De){let w=g;f=w.worldVerticesLength,u=L.setArraySize(i,f,0),w.computeWorldVertices(d,0,f,u,0,2),m=w.triangles}else if(g instanceof $e&&s!=null){s.clipStart(d,g);continue}if(u&&m){s!=null&&s.isClipping()&&(s.clipTriangles(u,f,m,m.length),u=s.clippedVertices,f=s.clippedVertices.length);for(let w=0,b=u.length;w<b;w+=2){let x=u[w],p=u[w+1];h=Math.min(h,x),a=Math.min(a,p),r=Math.max(r,x),o=Math.max(o,p)}}s?.clipEndWithSlot(d)}s?.clipEnd(),e.set(h,a),t.set(r-h,o-a)}update(e){this.time+=e}physicsTranslate(e,t){const i=this.physicsConstraints;for(let s=0,n=i.length;s<n;s++)i[s].translate(e,t)}physicsRotate(e,t,i){const s=this.physicsConstraints;for(let n=0,h=s.length;n<h;n++)s[n].rotate(e,t,i)}},ft=Fi;B(ft,"quadTriangles",[0,1,2,2,3,0]),B(ft,"yDown",!1);var ws=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(ws||{}),vs=class extends dt{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Xi=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let i=0,s=t.length;i<s;i++){const n=t[i];if(n.name==e)return n}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let i=0,s=t.length;i<s;i++){const n=t[i];if(n.name==e)return n}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let i=0,s=t.length;i<s;i++){const n=t[i];if(n.name==e)return n}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let i=0,s=t.length;i<s;i++){const n=t[i];if(n.name==e)return n}return null}},Pi=class{constructor(e=0,t,i){this.slotIndex=e,this.name=t,this.attachment=i}},Rt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new O(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,i){if(!i)throw new Error("attachment cannot be null.");let s=this.attachments;e>=s.length&&(s.length=e+1),s[e]||(s[e]={}),s[e][t]=i}addSkin(e){for(let s=0;s<e.bones.length;s++){let n=e.bones[s],h=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==n){h=!0;break}h||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){let n=e.constraints[s],h=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==n){h=!0;break}h||this.constraints.push(n)}let t=e.getAttachments();for(let s=0;s<t.length;s++){var i=t[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(e){for(let s=0;s<e.bones.length;s++){let n=e.bones[s],h=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==n){h=!0;break}h||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){let n=e.constraints[s],h=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==n){h=!0;break}h||this.constraints.push(n)}let t=e.getAttachments();for(let s=0;s<t.length;s++){var i=t[s];i.attachment&&(i.attachment instanceof De?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.attachment)))}}getAttachment(e,t){let i=this.attachments[e];return i?i[t]:null}removeAttachment(e,t){let i=this.attachments[e];i&&delete i[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let i=this.attachments[t];if(i)for(let s in i){let n=i[s];n&&e.push(new Pi(t,s,n))}}return e}getAttachmentsForSlot(e,t){let i=this.attachments[e];if(i)for(let s in i){let n=i[s];n&&t.push(new Pi(e,s,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let i=0;for(let s=0;s<e.slots.length;s++){let n=e.slots[s],h=n.getAttachment();if(h&&i<t.attachments.length){let a=t.attachments[i];for(let r in a){let o=a[r];if(h==o){let l=this.getAttachment(i,r);l&&n.setAttachment(l);break}}}i++}}},Li=class{index=0;name;boneData;color=new O(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Yt.Normal;visible=!0;path=null;constructor(e,t,i){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!i)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=i}},Yt=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Yt||{}),Bi=class extends dt{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},sr=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new Xi;i.name="";let s=new ys(e),n=s.readInt32(),h=s.readInt32();i.hash=h==0&&n==0?null:h.toString(16)+n.toString(16),i.version=s.readString(),i.x=s.readFloat(),i.y=s.readFloat(),i.width=s.readFloat(),i.height=s.readFloat(),i.referenceScale=s.readFloat()*t;let a=s.readBoolean();a&&(i.fps=s.readFloat(),i.imagesPath=s.readString(),i.audioPath=s.readString());let r=0;r=s.readInt(!0);for(let l=0;l<r;l++){let c=s.readString();if(!c)throw new Error("String in string table must not be null.");s.strings.push(c)}r=s.readInt(!0);for(let l=0;l<r;l++){let c=s.readString();if(!c)throw new Error("Bone name must not be null.");let d=l==0?null:i.bones[s.readInt(!0)],f=new Ti(l,c,d);f.rotation=s.readFloat(),f.x=s.readFloat()*t,f.y=s.readFloat()*t,f.scaleX=s.readFloat(),f.scaleY=s.readFloat(),f.shearX=s.readFloat(),f.shearY=s.readFloat(),f.length=s.readFloat()*t,f.inherit=s.readByte(),f.skinRequired=s.readBoolean(),a&&(O.rgba8888ToColor(f.color,s.readInt32()),f.icon=s.readString()??void 0,f.visible=s.readBoolean()),i.bones.push(f)}r=s.readInt(!0);for(let l=0;l<r;l++){let c=s.readString();if(!c)throw new Error("Slot name must not be null.");let d=null;if(a){const g=c.lastIndexOf("/");g!=-1&&(d=c.substring(0,g),c=c.substring(g+1))}let f=i.bones[s.readInt(!0)],u=new Li(l,c,f);O.rgba8888ToColor(u.color,s.readInt32());let m=s.readInt32();m!=-1&&O.rgb888ToColor(u.darkColor=new O,m),u.attachmentName=s.readStringRef(),u.blendMode=s.readInt(!0),a&&(u.visible=s.readBoolean(),u.path=d),i.slots.push(u)}r=s.readInt(!0);for(let l=0,c;l<r;l++){let d=s.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new Yi(d);f.order=s.readInt(!0),c=s.readInt(!0);for(let m=0;m<c;m++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.bones[s.readInt(!0)];let u=s.readByte();f.skinRequired=(u&1)!=0,f.bendDirection=u&2?1:-1,f.compress=(u&4)!=0,f.stretch=(u&8)!=0,f.uniform=(u&16)!=0,u&32&&(f.mix=u&64?s.readFloat():1),u&128&&(f.softness=s.readFloat()*t),i.ikConstraints.push(f)}r=s.readInt(!0);for(let l=0,c;l<r;l++){let d=s.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new Bi(d);f.order=s.readInt(!0),c=s.readInt(!0);for(let m=0;m<c;m++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.bones[s.readInt(!0)];let u=s.readByte();f.skinRequired=(u&1)!=0,f.local=(u&2)!=0,f.relative=(u&4)!=0,u&8&&(f.offsetRotation=s.readFloat()),u&16&&(f.offsetX=s.readFloat()*t),u&32&&(f.offsetY=s.readFloat()*t),u&64&&(f.offsetScaleX=s.readFloat()),u&128&&(f.offsetScaleY=s.readFloat()),u=s.readByte(),u&1&&(f.offsetShearY=s.readFloat()),u&2&&(f.mixRotate=s.readFloat()),u&4&&(f.mixX=s.readFloat()),u&8&&(f.mixY=s.readFloat()),u&16&&(f.mixScaleX=s.readFloat()),u&32&&(f.mixScaleY=s.readFloat()),u&64&&(f.mixShearY=s.readFloat()),i.transformConstraints.push(f)}r=s.readInt(!0);for(let l=0,c;l<r;l++){let d=s.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new ki(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),c=s.readInt(!0);for(let m=0;m<c;m++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.slots[s.readInt(!0)];const u=s.readByte();f.positionMode=u&1,f.spacingMode=u>>1&3,f.rotateMode=u>>3&3,u&128&&(f.offsetRotation=s.readFloat()),f.position=s.readFloat(),f.positionMode==0&&(f.position*=t),f.spacing=s.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=t),f.mixRotate=s.readFloat(),f.mixX=s.readFloat(),f.mixY=s.readFloat(),i.pathConstraints.push(f)}r=s.readInt(!0);for(let l=0,c;l<r;l++){const d=s.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new vs(d);f.order=s.readInt(!0),f.bone=i.bones[s.readInt(!0)];let u=s.readByte();f.skinRequired=(u&1)!=0,u&2&&(f.x=s.readFloat()),u&4&&(f.y=s.readFloat()),u&8&&(f.rotate=s.readFloat()),u&16&&(f.scaleX=s.readFloat()),u&32&&(f.shearX=s.readFloat()),f.limit=(u&64?s.readFloat():5e3)*t,f.step=1/s.readUnsignedByte(),f.inertia=s.readFloat(),f.strength=s.readFloat(),f.damping=s.readFloat(),f.massInverse=u&128?s.readFloat():1,f.wind=s.readFloat(),f.gravity=s.readFloat(),u=s.readByte(),u&1&&(f.inertiaGlobal=!0),u&2&&(f.strengthGlobal=!0),u&4&&(f.dampingGlobal=!0),u&8&&(f.massGlobal=!0),u&16&&(f.windGlobal=!0),u&32&&(f.gravityGlobal=!0),u&64&&(f.mixGlobal=!0),f.mix=u&128?s.readFloat():1,i.physicsConstraints.push(f)}let o=this.readSkin(s,i,!0,a);o&&(i.defaultSkin=o,i.skins.push(o));{let l=i.skins.length;for(L.setArraySize(i.skins,r=l+s.readInt(!0));l<r;l++){let c=this.readSkin(s,i,!1,a);if(!c)throw new Error("readSkin() should not have returned null.");i.skins[l]=c}}r=this.linkedMeshes.length;for(let l=0;l<r;l++){let c=this.linkedMeshes[l];const d=i.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(c.slotIndex,c.parent);if(!f)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?f:c.mesh,c.mesh.setParentMesh(f),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,r=s.readInt(!0);for(let l=0;l<r;l++){let c=s.readString();if(!c)throw new Error("Event data name must not be null");let d=new Ri(c);d.intValue=s.readInt(!1),d.floatValue=s.readFloat(),d.stringValue=s.readString(),d.audioPath=s.readString(),d.audioPath&&(d.volume=s.readFloat(),d.balance=s.readFloat()),i.events.push(d)}r=s.readInt(!0);for(let l=0;l<r;l++){let c=s.readString();if(!c)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(s,c,i))}return i}readSkin(e,t,i,s){let n=null,h=0;if(i){if(h=e.readInt(!0),h==0)return null;n=new Rt("default")}else{let a=e.readString();if(!a)throw new Error("Skin name must not be null.");n=new Rt(a),s&&O.rgba8888ToColor(n.color,e.readInt32()),n.bones.length=e.readInt(!0);for(let r=0,o=n.bones.length;r<o;r++)n.bones[r]=t.bones[e.readInt(!0)];for(let r=0,o=e.readInt(!0);r<o;r++)n.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let r=0,o=e.readInt(!0);r<o;r++)n.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let r=0,o=e.readInt(!0);r<o;r++)n.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let r=0,o=e.readInt(!0);r<o;r++)n.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let a=0;a<h;a++){let r=e.readInt(!0);for(let o=0,l=e.readInt(!0);o<l;o++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,n,r,c,s);d&&n.setAttachment(r,c,d)}}return n}readAttachment(e,t,i,s,n,h){let a=this.scale,r=e.readByte();const o=r&8?e.readStringRef():n;if(!o)throw new Error("Attachment name must not be null");switch(r&7){case Ue.Region:{let l=r&16?e.readStringRef():null;const c=r&32?e.readInt32():4294967295,d=r&64?this.readSequence(e):null;let f=r&128?e.readFloat():0,u=e.readFloat(),m=e.readFloat(),g=e.readFloat(),w=e.readFloat(),b=e.readFloat(),x=e.readFloat();l||(l=o);let p=this.attachmentLoader.newRegionAttachment(i,o,l,d);return p?(p.path=l,p.x=u*a,p.y=m*a,p.scaleX=g,p.scaleY=w,p.rotation=f,p.width=b*a,p.height=x*a,O.rgba8888ToColor(p.color,c),p.sequence=d,d==null&&p.updateRegion(),p):null}case Ue.BoundingBox:{let l=this.readVertices(e,(r&16)!=0),c=h?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(i,o);return d?(d.worldVerticesLength=l.length,d.vertices=l.vertices,d.bones=l.bones,h&&O.rgba8888ToColor(d.color,c),d):null}case Ue.Mesh:{let l=r&16?e.readStringRef():o;const c=r&32?e.readInt32():4294967295,d=r&64?this.readSequence(e):null,f=e.readInt(!0),u=this.readVertices(e,(r&128)!=0),m=this.readFloatArray(e,u.length,1),g=this.readShortArray(e,(u.length-f-2)*3);let w=[],b=0,x=0;h&&(w=this.readShortArray(e,e.readInt(!0)),b=e.readFloat(),x=e.readFloat()),l||(l=o);let p=this.attachmentLoader.newMeshAttachment(i,o,l,d);return p?(p.path=l,O.rgba8888ToColor(p.color,c),p.bones=u.bones,p.vertices=u.vertices,p.worldVerticesLength=u.length,p.triangles=g,p.regionUVs=m,d==null&&p.updateRegion(),p.hullLength=f<<1,p.sequence=d,h&&(p.edges=w,p.width=b*a,p.height=x*a),p):null}case Ue.LinkedMesh:{const l=r&16?e.readStringRef():o;if(l==null)throw new Error("Path of linked mesh must not be null");const c=r&32?e.readInt32():4294967295,d=r&64?this.readSequence(e):null,f=(r&128)!=0,u=e.readInt(!0),m=e.readStringRef();let g=0,w=0;h&&(g=e.readFloat(),w=e.readFloat());let b=this.attachmentLoader.newMeshAttachment(i,o,l,d);return b?(b.path=l,O.rgba8888ToColor(b.color,c),b.sequence=d,h&&(b.width=g*a,b.height=w*a),this.linkedMeshes.push(new rr(b,u,s,m,f)),b):null}case Ue.Path:{const l=(r&16)!=0,c=(r&32)!=0,d=this.readVertices(e,(r&64)!=0),f=L.newArray(d.length/6,0);for(let g=0,w=f.length;g<w;g++)f[g]=e.readFloat()*a;const u=h?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(i,o);return m?(m.closed=l,m.constantSpeed=c,m.worldVerticesLength=d.length,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,h&&O.rgba8888ToColor(m.color,u),m):null}case Ue.Point:{const l=e.readFloat(),c=e.readFloat(),d=e.readFloat(),f=h?e.readInt32():0,u=this.attachmentLoader.newPointAttachment(i,o);return u?(u.x=c*a,u.y=d*a,u.rotation=l,h&&O.rgba8888ToColor(u.color,f),u):null}case Ue.Clipping:{const l=e.readInt(!0),c=this.readVertices(e,(r&16)!=0);let d=h?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(i,o);return f?(f.endSlot=t.slots[l],f.worldVerticesLength=c.length,f.vertices=c.vertices,f.bones=c.bones,h&&O.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){let t=new Wt(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const i=this.scale,s=e.readInt(!0),n=new nr;if(n.length=s<<1,!t)return n.vertices=this.readFloatArray(e,n.length,i),n;let h=new Array,a=new Array;for(let r=0;r<s;r++){let o=e.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(e.readInt(!0)),h.push(e.readFloat()*i),h.push(e.readFloat()*i),h.push(e.readFloat())}return n.vertices=L.toFloatArray(h),n.bones=a,n}readFloatArray(e,t,i){let s=new Array(t);if(i==1)for(let n=0;n<t;n++)s[n]=e.readFloat();else for(let n=0;n<t;n++)s[n]=e.readFloat()*i;return s}readShortArray(e,t){let i=new Array(t);for(let s=0;s<t;s++)i[s]=e.readInt(!0);return i}readAnimation(e,t,i){e.readInt(!0);let s=new Array,n=this.scale;for(let o=0,l=e.readInt(!0);o<l;o++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let u=e.readByte(),m=e.readInt(!0),g=m-1;switch(u){case pr:{let w=new qe(m,c);for(let b=0;b<m;b++)w.setFrame(b,e.readFloat(),e.readStringRef());s.push(w);break}case br:{let w=e.readInt(!0),b=new ti(m,w,c),x=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let C=0,I=0;b.setFrame(C,x,p,v,y,A),C!=g;C++){let R=e.readFloat(),Y=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;switch(e.readByte()){case Xe:b.setStepped(C);break;case Pe:le(e,b,I++,C,0,x,R,p,Y,1),le(e,b,I++,C,1,x,R,v,k,1),le(e,b,I++,C,2,x,R,y,F,1),le(e,b,I++,C,3,x,R,A,P,1)}x=R,p=Y,v=k,y=F,A=P}s.push(b);break}case wr:{let w=e.readInt(!0),b=new ii(m,w,c),x=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255;for(let A=0,C=0;b.setFrame(A,x,p,v,y),A!=g;A++){let I=e.readFloat(),R=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;switch(e.readByte()){case Xe:b.setStepped(A);break;case Pe:le(e,b,C++,A,0,x,I,p,R,1),le(e,b,C++,A,1,x,I,v,Y,1),le(e,b,C++,A,2,x,I,y,k,1)}x=I,p=R,v=Y,y=k}s.push(b);break}case vr:{let w=e.readInt(!0),b=new ri(m,w,c),x=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;for(let Y=0,k=0;b.setFrame(Y,x,p,v,y,A,C,I,R),Y!=g;Y++){let F=e.readFloat(),P=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,ie=e.readUnsignedByte()/255,te=e.readUnsignedByte()/255,he=e.readUnsignedByte()/255;switch(e.readByte()){case Xe:b.setStepped(Y);break;case Pe:le(e,b,k++,Y,0,x,F,p,P,1),le(e,b,k++,Y,1,x,F,v,E,1),le(e,b,k++,Y,2,x,F,y,M,1),le(e,b,k++,Y,3,x,F,A,V,1),le(e,b,k++,Y,4,x,F,C,ie,1),le(e,b,k++,Y,5,x,F,I,te,1),le(e,b,k++,Y,6,x,F,R,he,1)}x=F,p=P,v=E,y=M,A=V,C=ie,I=te,R=he}s.push(b);break}case yr:{let w=e.readInt(!0),b=new ni(m,w,c),x=e.readFloat(),p=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let R=0,Y=0;b.setFrame(R,x,p,v,y,A,C,I),R!=g;R++){let k=e.readFloat(),F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,ie=e.readUnsignedByte()/255;switch(e.readByte()){case Xe:b.setStepped(R);break;case Pe:le(e,b,Y++,R,0,x,k,p,F,1),le(e,b,Y++,R,1,x,k,v,P,1),le(e,b,Y++,R,2,x,k,y,E,1),le(e,b,Y++,R,3,x,k,A,M,1),le(e,b,Y++,R,4,x,k,C,V,1),le(e,b,Y++,R,5,x,k,I,ie,1)}x=k,p=F,v=P,y=E,A=M,C=V,I=ie}s.push(b);break}case Ar:{let w=new si(m,e.readInt(!0),c),b=e.readFloat(),x=e.readUnsignedByte()/255;for(let p=0,v=0;w.setFrame(p,b,x),p!=g;p++){let y=e.readFloat(),A=e.readUnsignedByte()/255;switch(e.readByte()){case Xe:w.setStepped(p);break;case Pe:le(e,w,v++,p,0,b,y,x,A,1)}b=y,x=A}s.push(w)}}}}for(let o=0,l=e.readInt(!0);o<l;o++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let u=e.readByte(),m=e.readInt(!0);if(u==xr){let w=new ei(m,c);for(let b=0;b<m;b++)w.setFrame(b,e.readFloat(),e.readByte());s.push(w);continue}let g=e.readInt(!0);switch(u){case ar:s.push(pe(e,new ot(m,g,c),1));break;case lr:s.push(Oi(e,new qt(m,g,c),n));break;case or:s.push(pe(e,new Gt(m,g,c),n));break;case hr:s.push(pe(e,new Ht(m,g,c),n));break;case cr:s.push(Oi(e,new jt(m,g,c),1));break;case dr:s.push(pe(e,new Zt(m,g,c),1));break;case fr:s.push(pe(e,new Kt(m,g,c),1));break;case ur:s.push(Oi(e,new Jt(m,g,c),1));break;case mr:s.push(pe(e,new Qt(m,g,c),1));break;case gr:s.push(pe(e,new $t(m,g,c),1))}}}for(let o=0,l=e.readInt(!0);o<l;o++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,u=new li(d,e.readInt(!0),c),m=e.readByte(),g=e.readFloat(),w=m&1?m&2?e.readFloat():1:0,b=m&4?e.readFloat()*n:0;for(let x=0,p=0;u.setFrame(x,g,w,b,m&8?1:-1,(m&16)!=0,(m&32)!=0),x!=f;x++){m=e.readByte();const v=e.readFloat(),y=m&1?m&2?e.readFloat():1:0,A=m&4?e.readFloat()*n:0;m&64?u.setStepped(x):m&128&&(le(e,u,p++,x,0,g,v,w,y,1),le(e,u,p++,x,1,g,v,b,A,n)),g=v,w=y,b=A}s.push(u)}for(let o=0,l=e.readInt(!0);o<l;o++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,u=new oi(d,e.readInt(!0),c),m=e.readFloat(),g=e.readFloat(),w=e.readFloat(),b=e.readFloat(),x=e.readFloat(),p=e.readFloat(),v=e.readFloat();for(let y=0,A=0;u.setFrame(y,m,g,w,b,x,p,v),y!=f;y++){let C=e.readFloat(),I=e.readFloat(),R=e.readFloat(),Y=e.readFloat(),k=e.readFloat(),F=e.readFloat(),P=e.readFloat();switch(e.readByte()){case Xe:u.setStepped(y);break;case Pe:le(e,u,A++,y,0,m,C,g,I,1),le(e,u,A++,y,1,m,C,w,R,1),le(e,u,A++,y,2,m,C,b,Y,1),le(e,u,A++,y,3,m,C,x,k,1),le(e,u,A++,y,4,m,C,p,F,1),le(e,u,A++,y,5,m,C,v,P,1)}m=C,g=I,w=R,b=Y,x=k,p=F,v=P}s.push(u)}for(let o=0,l=e.readInt(!0);o<l;o++){let c=e.readInt(!0),d=i.pathConstraints[c];for(let f=0,u=e.readInt(!0);f<u;f++){const m=e.readByte(),g=e.readInt(!0),w=e.readInt(!0);switch(m){case Tr:s.push(pe(e,new hi(g,w,c),d.positionMode==0?n:1));break;case Ir:s.push(pe(e,new ci(g,w,c),d.spacingMode==0||d.spacingMode==1?n:1));break;case Mr:let b=new di(g,w,c),x=e.readFloat(),p=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let A=0,C=0,I=b.getFrameCount()-1;b.setFrame(A,x,p,v,y),A!=I;A++){let R=e.readFloat(),Y=e.readFloat(),k=e.readFloat(),F=e.readFloat();switch(e.readByte()){case Xe:b.setStepped(A);break;case Pe:le(e,b,C++,A,0,x,R,p,Y,1),le(e,b,C++,A,1,x,R,v,k,1),le(e,b,C++,A,2,x,R,y,F,1)}x=R,p=Y,v=k,y=F}s.push(b)}}}for(let o=0,l=e.readInt(!0);o<l;o++){const c=e.readInt(!0)-1;for(let d=0,f=e.readInt(!0);d<f;d++){const u=e.readByte(),m=e.readInt(!0);if(u==Lr){const w=new vt(m,c);for(let b=0;b<m;b++)w.setFrame(b,e.readFloat());s.push(w);continue}const g=e.readInt(!0);switch(u){case Er:s.push(pe(e,new fi(m,g,c),1));break;case Rr:s.push(pe(e,new ui(m,g,c),1));break;case Yr:s.push(pe(e,new mi(m,g,c),1));break;case kr:s.push(pe(e,new gi(m,g,c),1));break;case Fr:s.push(pe(e,new xi(m,g,c),1));break;case Xr:s.push(pe(e,new pi(m,g,c),1));break;case Pr:s.push(pe(e,new bi(m,g,c),1))}}}for(let o=0,l=e.readInt(!0);o<l;o++){let c=i.skins[e.readInt(!0)];for(let d=0,f=e.readInt(!0);d<f;d++){let u=e.readInt(!0);for(let m=0,g=e.readInt(!0);m<g;m++){let w=e.readStringRef();if(!w)throw new Error("attachmentName must not be null.");let b=c.getAttachment(u,w),x=e.readByte(),p=e.readInt(!0),v=p-1;switch(x){case Cr:{let y=b,A=y.bones,C=y.vertices,I=A?C.length/3*2:C.length,R=e.readInt(!0),Y=new ai(p,R,u,y),k=e.readFloat();for(let F=0,P=0;;F++){let E,M=e.readInt(!0);if(M==0)E=A?L.newFloatArray(I):C;else{E=L.newFloatArray(I);let ie=e.readInt(!0);if(M+=ie,n==1)for(let te=ie;te<M;te++)E[te]=e.readFloat();else for(let te=ie;te<M;te++)E[te]=e.readFloat()*n;if(!A)for(let te=0,he=E.length;te<he;te++)E[te]+=C[te]}if(Y.setFrame(F,k,E),F==v)break;let V=e.readFloat();switch(e.readByte()){case Xe:Y.setStepped(F);break;case Pe:le(e,Y,P++,F,0,k,V,0,1,1)}k=V}s.push(Y);break}case Sr:{let y=new Qe(p,u,b);for(let A=0;A<p;A++){let C=e.readFloat(),I=e.readInt32();y.setFrame(A,C,$i[I&15],I>>4,e.readFloat())}s.push(y);break}}}}}let h=e.readInt(!0);if(h>0){let o=new Ge(h),l=i.slots.length;for(let c=0;c<h;c++){let d=e.readFloat(),f=e.readInt(!0),u=L.newArray(l,0);for(let b=l-1;b>=0;b--)u[b]=-1;let m=L.newArray(l-f,0),g=0,w=0;for(let b=0;b<f;b++){let x=e.readInt(!0);for(;g!=x;)m[w++]=g++;u[g+e.readInt(!0)]=g++}for(;g<l;)m[w++]=g++;for(let b=l-1;b>=0;b--)u[b]==-1&&(u[b]=m[--w]);o.setFrame(c,d,u)}s.push(o)}let a=e.readInt(!0);if(a>0){let o=new ht(a);for(let l=0;l<a;l++){let c=e.readFloat(),d=i.events[e.readInt(!0)],f=new Ei(c,d);f.intValue=e.readInt(!1),f.floatValue=e.readFloat(),f.stringValue=e.readString(),f.stringValue==null&&(f.stringValue=d.stringValue),f.data.audioPath&&(f.volume=e.readFloat(),f.balance=e.readFloat()),o.setFrame(l,f)}s.push(o)}let r=0;for(let o=0,l=s.length;o<l;o++)r=Math.max(r,s[o].getDuration());return new bt(t,s,r)}},ys=class{constructor(e,t=new Array,i=0,s=new DataView(e.buffer)){this.strings=t,this.index=i,this.buffer=s}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),i=t&127;return t&128&&(t=this.readByte(),i|=(t&127)<<7,t&128&&(t=this.readByte(),i|=(t&127)<<14,t&128&&(t=this.readByte(),i|=(t&127)<<21,t&128&&(t=this.readByte(),i|=(t&127)<<28)))),e?i:i>>>1^-(i&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",i=0;for(let s=0;s<e;){let n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(n),s++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},rr=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,i,s,n){this.mesh=e,this.skinIndex=t,this.slotIndex=i,this.parent=s,this.inheritTimeline=n}},nr=class{constructor(e=null,t=null,i=0){this.bones=e,this.vertices=t,this.length=i}},Ue=(e=>(e[e.Region=0]="Region",e[e.BoundingBox=1]="BoundingBox",e[e.Mesh=2]="Mesh",e[e.LinkedMesh=3]="LinkedMesh",e[e.Path=4]="Path",e[e.Point=5]="Point",e[e.Clipping=6]="Clipping",e))(Ue||{});function pe(e,t,i){let s=e.readFloat(),n=e.readFloat()*i;for(let h=0,a=0,r=t.getFrameCount()-1;t.setFrame(h,s,n),h!=r;h++){let o=e.readFloat(),l=e.readFloat()*i;switch(e.readByte()){case Xe:t.setStepped(h);break;case Pe:le(e,t,a++,h,0,s,o,n,l,i)}s=o,n=l}return t}function Oi(e,t,i){let s=e.readFloat(),n=e.readFloat()*i,h=e.readFloat()*i;for(let a=0,r=0,o=t.getFrameCount()-1;t.setFrame(a,s,n,h),a!=o;a++){let l=e.readFloat(),c=e.readFloat()*i,d=e.readFloat()*i;switch(e.readByte()){case Xe:t.setStepped(a);break;case Pe:le(e,t,r++,a,0,s,l,n,c,i),le(e,t,r++,a,1,s,l,h,d,i)}s=l,n=c,h=d}return t}function le(e,t,i,s,n,h,a,r,o,l){t.setBezier(i,s,n,h,r,e.readFloat(),e.readFloat()*l,e.readFloat(),e.readFloat()*l,a,o)}var ar=0,lr=1,or=2,hr=3,cr=4,dr=5,fr=6,ur=7,mr=8,gr=9,xr=10,pr=0,br=1,wr=2,vr=3,yr=4,Ar=5,Cr=0,Sr=1,Tr=0,Ir=1,Mr=2,Er=0,Rr=1,Yr=2,kr=4,Fr=5,Xr=6,Pr=7,Lr=8,Xe=1,Pe=2,As=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new lt(()=>L.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let i=this.boundingBoxes,s=this.polygons,n=this.polygonPool,h=e.slots,a=h.length;i.length=0,n.freeAll(s),s.length=0;for(let r=0;r<a;r++){let o=h[r];if(!o.bone.active)continue;let l=o.getAttachment();if(l instanceof St){let c=l;i.push(c);let d=n.obtain();d.length!=c.worldVerticesLength&&(d=L.newFloatArray(c.worldVerticesLength)),s.push(d),c.computeWorldVertices(o,0,c.worldVerticesLength,d,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=this.polygons;for(let h=0,a=n.length;h<a;h++){let r=n[h],o=r;for(let l=0,c=r.length;l<c;l+=2){let d=o[l],f=o[l+1];e=Math.min(e,d),t=Math.min(t,f),i=Math.max(i,d),s=Math.max(s,f)}}this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,i,s){let n=this.minX,h=this.minY,a=this.maxX,r=this.maxY;if(e<=n&&i<=n||t<=h&&s<=h||e>=a&&i>=a||t>=r&&s>=r)return!1;let o=(s-t)/(i-e),l=o*(n-e)+t;if(l>h&&l<r||(l=o*(a-e)+t,l>h&&l<r))return!0;let c=(h-t)/o+e;return c>n&&c<a||(c=(r-t)/o+e,c>n&&c<a)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let i=this.polygons;for(let s=0,n=i.length;s<n;s++)if(this.containsPointPolygon(i[s],e,t))return this.boundingBoxes[s];return null}containsPointPolygon(e,t,i){let s=e,n=e.length,h=n-2,a=!1;for(let r=0;r<n;r+=2){let o=s[r+1],l=s[h+1];if(o<i&&l>=i||l<i&&o>=i){let c=s[r];c+(i-o)/(l-o)*(s[h]-c)<t&&(a=!a)}h=r}return a}intersectsSegment(e,t,i,s){let n=this.polygons;for(let h=0,a=n.length;h<a;h++)if(this.intersectsSegmentPolygon(n[h],e,t,i,s))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,i,s,n){let h=e,a=e.length,r=t-s,o=i-n,l=t*n-i*s,c=h[a-2],d=h[a-1];for(let f=0;f<a;f+=2){let u=h[f],m=h[f+1],g=c*m-d*u,w=c-u,b=d-m,x=r*b-o*w,p=(l*w-r*g)/x;if((p>=c&&p<=u||p>=u&&p<=c)&&(p>=t&&p<=s||p>=s&&p<=t)){let v=(l*b-o*g)/x;if((v>=d&&v<=m||v>=m&&v<=d)&&(v>=i&&v<=n||v>=n&&v<=i))return!0}c=u,d=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Ae=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new lt(()=>new Array);polygonIndicesPool=new lt(()=>new Array);triangulate(e){let t=e,i=e.length>>1,s=this.indicesArray;s.length=0;for(let a=0;a<i;a++)s[a]=a;let n=this.isConcaveArray;n.length=0;for(let a=0,r=i;a<r;++a)n[a]=Ae.isConcave(a,i,t,s);let h=this.triangles;for(h.length=0;i>3;){let a=i-1,r=0,o=1;for(;;){e:if(!n[r]){let d=s[a]<<1,f=s[r]<<1,u=s[o]<<1,m=t[d],g=t[d+1],w=t[f],b=t[f+1],x=t[u],p=t[u+1];for(let v=(o+1)%i;v!=a;v=(v+1)%i){if(!n[v])continue;let y=s[v]<<1,A=t[y],C=t[y+1];if(Ae.positiveArea(x,p,m,g,A,C)&&Ae.positiveArea(m,g,w,b,A,C)&&Ae.positiveArea(w,b,x,p,A,C))break e}break}if(o==0){do{if(!n[r])break;r--}while(r>0);break}a=r,r=o,o=(o+1)%i}h.push(s[(i+r-1)%i]),h.push(s[r]),h.push(s[(r+1)%i]),s.splice(r,1),n.splice(r,1),i--;let l=(i+r-1)%i,c=r==i?0:r;n[l]=Ae.isConcave(l,i,t,s),n[c]=Ae.isConcave(c,i,t,s)}return i==3&&(h.push(s[2]),h.push(s[0]),h.push(s[1])),h}decompose(e,t){let i=e,s=this.convexPolygons;this.polygonPool.freeAll(s),s.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let h=this.polygonIndicesPool.obtain();h.length=0;let a=this.polygonPool.obtain();a.length=0;let r=-1,o=0;for(let l=0,c=t.length;l<c;l+=3){let d=t[l]<<1,f=t[l+1]<<1,u=t[l+2]<<1,m=i[d],g=i[d+1],w=i[f],b=i[f+1],x=i[u],p=i[u+1],v=!1;if(r==d){let y=a.length-4,A=Ae.winding(a[y],a[y+1],a[y+2],a[y+3],x,p),C=Ae.winding(x,p,a[0],a[1],a[2],a[3]);A==o&&C==o&&(a.push(x),a.push(p),h.push(u),v=!0)}v||(a.length>0?(s.push(a),n.push(h)):(this.polygonPool.free(a),this.polygonIndicesPool.free(h)),a=this.polygonPool.obtain(),a.length=0,a.push(m),a.push(g),a.push(w),a.push(b),a.push(x),a.push(p),h=this.polygonIndicesPool.obtain(),h.length=0,h.push(d),h.push(f),h.push(u),o=Ae.winding(m,g,w,b,x,p),r=d)}a.length>0&&(s.push(a),n.push(h));for(let l=0,c=s.length;l<c;l++){if(h=n[l],h.length==0)continue;let d=h[0],f=h[h.length-1];a=s[l];let u=a.length-4,m=a[u],g=a[u+1],w=a[u+2],b=a[u+3],x=a[0],p=a[1],v=a[2],y=a[3],A=Ae.winding(m,g,w,b,x,p);for(let C=0;C<c;C++){if(C==l)continue;let I=n[C];if(I.length!=3)continue;let R=I[0],Y=I[1],k=I[2],F=s[C],P=F[F.length-2],E=F[F.length-1];if(R!=d||Y!=f)continue;let M=Ae.winding(m,g,w,b,P,E),V=Ae.winding(P,E,x,p,v,y);M==A&&V==A&&(F.length=0,I.length=0,a.push(P),a.push(E),h.push(k),m=w,g=b,w=P,b=E,C=0)}}for(let l=s.length-1;l>=0;l--)a=s[l],a.length==0&&(s.splice(l,1),this.polygonPool.free(a),h=n[l],n.splice(l,1),this.polygonIndicesPool.free(h));return s}static isConcave(e,t,i,s){let n=s[(t+e-1)%t]<<1,h=s[e]<<1,a=s[(e+1)%t]<<1;return!this.positiveArea(i[n],i[n+1],i[h],i[h+1],i[a],i[a+1])}static positiveArea(e,t,i,s,n,h){return e*(h-s)+i*(t-h)+n*(s-t)>=0}static winding(e,t,i,s,n,h){let a=i-e,r=s-t;return n*r-h*a+a*t-e*r>=0?1:-1}},kt=class{triangulator=new Ae;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let i=t.worldVerticesLength,s=L.setArraySize(this.clippingPolygon,i);t.computeWorldVertices(e,0,i,s,0,2);let n=this.clippingPolygon;kt.makeClockwise(n);let h=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let a=0,r=h.length;a<r;a++){let o=h[a];kt.makeClockwise(o),o.push(o[0]),o.push(o[1])}return h.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,i,s,n,h,a,r){n&&h&&a&&typeof r=="boolean"?this.clipTrianglesRender(e,t,i,s,n,h,a,r):this.clipTrianglesNoRender(e,t,i,s)}clipTrianglesNoRender(e,t,i,s){let n=this.clipOutput,h=this.clippedVertices,a=this.clippedTriangles,r=this.clippingPolygons,o=r.length,l=2,c=0;h.length=0,a.length=0;e:for(let d=0;d<s;d+=3){let f=i[d]<<1,u=e[f],m=e[f+1];f=i[d+1]<<1;let g=e[f],w=e[f+1];f=i[d+2]<<1;let b=e[f],x=e[f+1];for(let p=0;p<o;p++){let v=h.length;if(this.clip(u,m,g,w,b,x,r[p],n)){let y=n.length;if(y==0)continue;let A=y>>1,C=this.clipOutput,I=L.setArraySize(h,v+A*l);for(let Y=0;Y<y;Y+=2){let k=C[Y],F=C[Y+1];I[v]=k,I[v+1]=F,v+=2}v=a.length;let R=L.setArraySize(a,v+3*(A-2));A--;for(let Y=1;Y<A;Y++)R[v]=c,R[v+1]=c+Y,R[v+2]=c+Y+1,v+=3;c+=A+1}else{let y=L.setArraySize(h,v+3*l);y[v]=u,y[v+1]=m,y[v+2]=g,y[v+3]=w,y[v+4]=b,y[v+5]=x,v=a.length;let A=L.setArraySize(a,v+3);A[v]=c,A[v+1]=c+1,A[v+2]=c+2,c+=3;continue e}}}}clipTrianglesRender(e,t,i,s,n,h,a,r){let o=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,f=d.length,u=r?12:8,m=0;l.length=0,c.length=0;e:for(let g=0;g<s;g+=3){let w=i[g]<<1,b=e[w],x=e[w+1],p=n[w],v=n[w+1];w=i[g+1]<<1;let y=e[w],A=e[w+1],C=n[w],I=n[w+1];w=i[g+2]<<1;let R=e[w],Y=e[w+1],k=n[w],F=n[w+1];for(let P=0;P<f;P++){let E=l.length;if(this.clip(b,x,y,A,R,Y,d[P],o)){let M=o.length;if(M==0)continue;let V=A-Y,ie=R-y,te=b-R,he=Y-x,me=1/(V*te+ie*(x-Y)),fe=M>>1,ne=this.clipOutput,se=L.setArraySize(l,E+fe*u);for(let we=0;we<M;we+=2){let Fe=ne[we],xe=ne[we+1];se[E]=Fe,se[E+1]=xe,se[E+2]=h.r,se[E+3]=h.g,se[E+4]=h.b,se[E+5]=h.a;let Te=Fe-R,Ie=xe-Y,_e=(V*Te+ie*Ie)*me,rt=(he*Te+te*Ie)*me,gt=1-_e-rt;se[E+6]=p*_e+C*rt+k*gt,se[E+7]=v*_e+I*rt+F*gt,r&&(se[E+8]=a.r,se[E+9]=a.g,se[E+10]=a.b,se[E+11]=a.a),E+=u}E=c.length;let ce=L.setArraySize(c,E+3*(fe-2));fe--;for(let we=1;we<fe;we++)ce[E]=m,ce[E+1]=m+we,ce[E+2]=m+we+1,E+=3;m+=fe+1}else{let M=L.setArraySize(l,E+3*u);M[E]=b,M[E+1]=x,M[E+2]=h.r,M[E+3]=h.g,M[E+4]=h.b,M[E+5]=h.a,r?(M[E+6]=p,M[E+7]=v,M[E+8]=a.r,M[E+9]=a.g,M[E+10]=a.b,M[E+11]=a.a,M[E+12]=y,M[E+13]=A,M[E+14]=h.r,M[E+15]=h.g,M[E+16]=h.b,M[E+17]=h.a,M[E+18]=C,M[E+19]=I,M[E+20]=a.r,M[E+21]=a.g,M[E+22]=a.b,M[E+23]=a.a,M[E+24]=R,M[E+25]=Y,M[E+26]=h.r,M[E+27]=h.g,M[E+28]=h.b,M[E+29]=h.a,M[E+30]=k,M[E+31]=F,M[E+32]=a.r,M[E+33]=a.g,M[E+34]=a.b,M[E+35]=a.a):(M[E+6]=p,M[E+7]=v,M[E+8]=y,M[E+9]=A,M[E+10]=h.r,M[E+11]=h.g,M[E+12]=h.b,M[E+13]=h.a,M[E+14]=C,M[E+15]=I,M[E+16]=R,M[E+17]=Y,M[E+18]=h.r,M[E+19]=h.g,M[E+20]=h.b,M[E+21]=h.a,M[E+22]=k,M[E+23]=F),E=c.length;let V=L.setArraySize(c,E+3);V[E]=m,V[E+1]=m+1,V[E+2]=m+2,m+=3;continue e}}}}clip(e,t,i,s,n,h,a,r){let o=r,l=!1,c;a.length%4>=2?(c=r,r=this.scratch):c=this.scratch,c.length=0,c.push(e),c.push(t),c.push(i),c.push(s),c.push(n),c.push(h),c.push(e),c.push(t),r.length=0;let d=a,f=a.length-4;for(let u=0;;u+=2){let m=d[u],g=d[u+1],w=d[u+2],b=d[u+3],x=m-w,p=g-b,v=c,y=c.length-2,A=r.length;for(let I=0;I<y;I+=2){let R=v[I],Y=v[I+1],k=v[I+2],F=v[I+3],P=x*(F-b)-p*(k-w)>0;if(x*(Y-b)-p*(R-w)>0){if(P){r.push(k),r.push(F);continue}let E=F-Y,M=k-R,V=E*(w-m)-M*(b-g);if(Math.abs(V)>1e-6){let ie=(M*(g-Y)-E*(m-R))/V;r.push(m+(w-m)*ie),r.push(g+(b-g)*ie)}else r.push(m),r.push(g)}else if(P){let E=F-Y,M=k-R,V=E*(w-m)-M*(b-g);if(Math.abs(V)>1e-6){let ie=(M*(g-Y)-E*(m-R))/V;r.push(m+(w-m)*ie),r.push(g+(b-g)*ie)}else r.push(m),r.push(g);r.push(k),r.push(F)}l=!0}if(A==r.length)return o.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==f)break;let C=r;r=c,r.length=0,c=C}if(o!=r){o.length=0;for(let u=0,m=r.length-2;u<m;u++)o[u]=r[u]}else o.length=o.length-2;return l}static makeClockwise(e){let t=e,i=e.length,s=t[i-2]*t[1]-t[0]*t[i-1],n=0,h=0,a=0,r=0;for(let o=0,l=i-3;o<l;o+=2)n=t[o],h=t[o+1],a=t[o+2],r=t[o+3],s+=n*r-a*h;if(!(s<0))for(let o=0,l=i-2,c=i>>1;o<c;o+=2){let d=t[o],f=t[o+1],u=l-o;t[o]=t[u],t[o+1]=t[u+1],t[u]=d,t[u+1]=f}}},Br=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new Xi,s=typeof e=="string"?JSON.parse(e):e,n=s.skeleton;if(n&&(i.hash=n.hash,i.version=n.spine,i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height,i.referenceScale=T(n,"referenceScale",100)*t,i.fps=n.fps,i.imagesPath=n.images??null,i.audioPath=n.audio??null),s.bones)for(let h=0;h<s.bones.length;h++){let a=s.bones[h],r=null,o=T(a,"parent",null);o&&(r=i.findBone(o));let l=new Ti(i.bones.length,a.name,r);l.length=T(a,"length",0)*t,l.x=T(a,"x",0)*t,l.y=T(a,"y",0)*t,l.rotation=T(a,"rotation",0),l.scaleX=T(a,"scaleX",1),l.scaleY=T(a,"scaleY",1),l.shearX=T(a,"shearX",0),l.shearY=T(a,"shearY",0),l.inherit=L.enumValue(ct,T(a,"inherit","Normal")),l.skinRequired=T(a,"skin",!1);let c=T(a,"color",null);c&&l.color.setFromString(c),i.bones.push(l)}if(s.slots)for(let h=0;h<s.slots.length;h++){let a=s.slots[h],r=null,o=a.name;const l=o.lastIndexOf("/");l!=-1&&(r=o.substring(0,l),o=o.substring(l+1));let c=i.findBone(a.bone);if(!c)throw new Error(`Couldn't find bone ${a.bone} for slot ${o}`);let d=new Li(i.slots.length,o,c),f=T(a,"color",null);f&&d.color.setFromString(f);let u=T(a,"dark",null);u&&(d.darkColor=O.fromString(u)),d.attachmentName=T(a,"attachment",null),d.blendMode=L.enumValue(Yt,T(a,"blend","normal")),d.visible=T(a,"visible",!0),d.path=r,i.slots.push(d)}if(s.ik)for(let h=0;h<s.ik.length;h++){let a=s.ik[h],r=new Yi(a.name);r.order=T(a,"order",0),r.skinRequired=T(a,"skin",!1);for(let l=0;l<a.bones.length;l++){let c=i.findBone(a.bones[l]);if(!c)throw new Error(`Couldn't find bone ${a.bones[l]} for IK constraint ${a.name}.`);r.bones.push(c)}let o=i.findBone(a.target);if(!o)throw new Error(`Couldn't find target bone ${a.target} for IK constraint ${a.name}.`);r.target=o,r.mix=T(a,"mix",1),r.softness=T(a,"softness",0)*t,r.bendDirection=T(a,"bendPositive",!0)?1:-1,r.compress=T(a,"compress",!1),r.stretch=T(a,"stretch",!1),r.uniform=T(a,"uniform",!1),i.ikConstraints.push(r)}if(s.transform)for(let h=0;h<s.transform.length;h++){let a=s.transform[h],r=new Bi(a.name);r.order=T(a,"order",0),r.skinRequired=T(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let d=a.bones[c],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${a.name}.`);r.bones.push(f)}let o=a.target,l=i.findBone(o);if(!l)throw new Error(`Couldn't find target bone ${o} for transform constraint ${a.name}.`);r.target=l,r.local=T(a,"local",!1),r.relative=T(a,"relative",!1),r.offsetRotation=T(a,"rotation",0),r.offsetX=T(a,"x",0)*t,r.offsetY=T(a,"y",0)*t,r.offsetScaleX=T(a,"scaleX",0),r.offsetScaleY=T(a,"scaleY",0),r.offsetShearY=T(a,"shearY",0),r.mixRotate=T(a,"mixRotate",1),r.mixX=T(a,"mixX",1),r.mixY=T(a,"mixY",r.mixX),r.mixScaleX=T(a,"mixScaleX",1),r.mixScaleY=T(a,"mixScaleY",r.mixScaleX),r.mixShearY=T(a,"mixShearY",1),i.transformConstraints.push(r)}if(s.path)for(let h=0;h<s.path.length;h++){let a=s.path[h],r=new ki(a.name);r.order=T(a,"order",0),r.skinRequired=T(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let d=a.bones[c],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${a.name}.`);r.bones.push(f)}let o=a.target,l=i.findSlot(o);if(!l)throw new Error(`Couldn't find target slot ${o} for path constraint ${a.name}.`);r.target=l,r.positionMode=L.enumValue(It,T(a,"positionMode","Percent")),r.spacingMode=L.enumValue(Mt,T(a,"spacingMode","Length")),r.rotateMode=L.enumValue(Et,T(a,"rotateMode","Tangent")),r.offsetRotation=T(a,"rotation",0),r.position=T(a,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=T(a,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=T(a,"mixRotate",1),r.mixX=T(a,"mixX",1),r.mixY=T(a,"mixY",r.mixX),i.pathConstraints.push(r)}if(s.physics)for(let h=0;h<s.physics.length;h++){const a=s.physics[h],r=new vs(a.name);r.order=T(a,"order",0),r.skinRequired=T(a,"skin",!1);const o=a.bone,l=i.findBone(o);if(l==null)throw new Error("Physics bone not found: "+o);r.bone=l,r.x=T(a,"x",0),r.y=T(a,"y",0),r.rotate=T(a,"rotate",0),r.scaleX=T(a,"scaleX",0),r.shearX=T(a,"shearX",0),r.limit=T(a,"limit",5e3)*t,r.step=1/T(a,"fps",60),r.inertia=T(a,"inertia",1),r.strength=T(a,"strength",100),r.damping=T(a,"damping",1),r.massInverse=1/T(a,"mass",1),r.wind=T(a,"wind",0),r.gravity=T(a,"gravity",0),r.mix=T(a,"mix",1),r.inertiaGlobal=T(a,"inertiaGlobal",!1),r.strengthGlobal=T(a,"strengthGlobal",!1),r.dampingGlobal=T(a,"dampingGlobal",!1),r.massGlobal=T(a,"massGlobal",!1),r.windGlobal=T(a,"windGlobal",!1),r.gravityGlobal=T(a,"gravityGlobal",!1),r.mixGlobal=T(a,"mixGlobal",!1),i.physicsConstraints.push(r)}if(s.skins)for(let h=0;h<s.skins.length;h++){let a=s.skins[h],r=new Rt(a.name);if(a.bones)for(let o=0;o<a.bones.length;o++){let l=a.bones[o],c=i.findBone(l);if(!c)throw new Error(`Couldn't find bone ${l} for skin ${a.name}.`);r.bones.push(c)}if(a.ik)for(let o=0;o<a.ik.length;o++){let l=a.ik[o],c=i.findIkConstraint(l);if(!c)throw new Error(`Couldn't find IK constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.transform)for(let o=0;o<a.transform.length;o++){let l=a.transform[o],c=i.findTransformConstraint(l);if(!c)throw new Error(`Couldn't find transform constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.path)for(let o=0;o<a.path.length;o++){let l=a.path[o],c=i.findPathConstraint(l);if(!c)throw new Error(`Couldn't find path constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}if(a.physics)for(let o=0;o<a.physics.length;o++){let l=a.physics[o],c=i.findPhysicsConstraint(l);if(!c)throw new Error(`Couldn't find physics constraint ${l} for skin ${a.name}.`);r.constraints.push(c)}for(let o in a.attachments){let l=i.findSlot(o);if(!l)throw new Error(`Couldn't find slot ${o} for skin ${a.name}.`);let c=a.attachments[o];for(let d in c){let f=this.readAttachment(c[d],r,l.index,d,i);f&&r.setAttachment(l.index,d,f)}}i.skins.push(r),r.name=="default"&&(i.defaultSkin=r)}for(let h=0,a=this.linkedMeshes.length;h<a;h++){let r=this.linkedMeshes[h],o=r.skin?i.findSkin(r.skin):i.defaultSkin;if(!o)throw new Error(`Skin not found: ${r.skin}`);let l=o.getAttachment(r.slotIndex,r.parent);if(!l)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?l:r.mesh,r.mesh.setParentMesh(l),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,s.events)for(let h in s.events){let a=s.events[h],r=new Ri(h);r.intValue=T(a,"int",0),r.floatValue=T(a,"float",0),r.stringValue=T(a,"string",""),r.audioPath=T(a,"audio",null),r.audioPath&&(r.volume=T(a,"volume",1),r.balance=T(a,"balance",0)),i.events.push(r)}if(s.animations)for(let h in s.animations){let a=s.animations[h];this.readAnimation(a,h,i)}return i}readAttachment(e,t,i,s,n){let h=this.scale;switch(s=T(e,"name",s),T(e,"type","region")){case"region":{let a=T(e,"path",s),r=this.readSequence(T(e,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(t,s,a,r);if(!o)return null;o.path=a,o.x=T(e,"x",0)*h,o.y=T(e,"y",0)*h,o.scaleX=T(e,"scaleX",1),o.scaleY=T(e,"scaleY",1),o.rotation=T(e,"rotation",0),o.width=e.width*h,o.height=e.height*h,o.sequence=r;let l=T(e,"color",null);return l&&o.color.setFromString(l),o.region!=null&&o.updateRegion(),o}case"boundingbox":{let a=this.attachmentLoader.newBoundingBoxAttachment(t,s);if(!a)return null;this.readVertices(e,a,e.vertexCount<<1);let r=T(e,"color",null);return r&&a.color.setFromString(r),a}case"mesh":case"linkedmesh":{let a=T(e,"path",s),r=this.readSequence(T(e,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(t,s,a,r);if(!o)return null;o.path=a;let l=T(e,"color",null);l&&o.color.setFromString(l),o.width=T(e,"width",0)*h,o.height=T(e,"height",0)*h,o.sequence=r;let c=T(e,"parent",null);if(c)return this.linkedMeshes.push(new Or(o,T(e,"skin",null),i,c,T(e,"timelines",!0))),o;let d=e.uvs;return this.readVertices(e,o,d.length),o.triangles=e.triangles,o.regionUVs=d,o.region!=null&&o.updateRegion(),o.edges=T(e,"edges",null),o.hullLength=T(e,"hull",0)*2,o}case"path":{let a=this.attachmentLoader.newPathAttachment(t,s);if(!a)return null;a.closed=T(e,"closed",!1),a.constantSpeed=T(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,a,r<<1);let o=L.newArray(r/3,0);for(let c=0;c<e.lengths.length;c++)o[c]=e.lengths[c]*h;a.lengths=o;let l=T(e,"color",null);return l&&a.color.setFromString(l),a}case"point":{let a=this.attachmentLoader.newPointAttachment(t,s);if(!a)return null;a.x=T(e,"x",0)*h,a.y=T(e,"y",0)*h,a.rotation=T(e,"rotation",0);let r=T(e,"color",null);return r&&a.color.setFromString(r),a}case"clipping":{let a=this.attachmentLoader.newClippingAttachment(t,s);if(!a)return null;let r=T(e,"end",null);r&&(a.endSlot=n.findSlot(r));let o=e.vertexCount;this.readVertices(e,a,o<<1);let l=T(e,"color",null);return l&&a.color.setFromString(l),a}}return null}readSequence(e){if(e==null)return null;let t=new Wt(T(e,"count",0));return t.start=T(e,"start",1),t.digits=T(e,"digits",0),t.setupIndex=T(e,"setup",0),t}readVertices(e,t,i){let s=this.scale;t.worldVerticesLength=i;let n=e.vertices;if(i==n.length){let r=L.toFloatArray(n);if(s!=1)for(let o=0,l=n.length;o<l;o++)r[o]*=s;t.vertices=r;return}let h=new Array,a=new Array;for(let r=0,o=n.length;r<o;){let l=n[r++];a.push(l);for(let c=r+l*4;r<c;r+=4)a.push(n[r]),h.push(n[r+1]*s),h.push(n[r+2]*s),h.push(n[r+3])}t.bones=a,t.vertices=L.toFloatArray(h)}readAnimation(e,t,i){let s=this.scale,n=new Array;if(e.slots)for(let a in e.slots){let r=e.slots[a],o=i.findSlot(a);if(!o)throw new Error("Slot not found: "+a);let l=o.index;for(let c in r){let d=r[c];if(!d)continue;let f=d.length;if(c=="attachment"){let u=new qe(f,l);for(let m=0;m<f;m++){let g=d[m];u.setFrame(m,T(g,"time",0),T(g,"name",null))}n.push(u)}else if(c=="rgba"){let u=new ti(f,f<<2,l),m=d[0],g=T(m,"time",0),w=O.fromString(m.color);for(let b=0,x=0;;b++){u.setFrame(b,g,w.r,w.g,w.b,w.a);let p=d[b+1];if(!p){u.shrink(x);break}let v=T(p,"time",0),y=O.fromString(p.color),A=m.curve;A&&(x=oe(A,u,x,b,0,g,v,w.r,y.r,1),x=oe(A,u,x,b,1,g,v,w.g,y.g,1),x=oe(A,u,x,b,2,g,v,w.b,y.b,1),x=oe(A,u,x,b,3,g,v,w.a,y.a,1)),g=v,w=y,m=p}n.push(u)}else if(c=="rgb"){let u=new ii(f,f*3,l),m=d[0],g=T(m,"time",0),w=O.fromString(m.color);for(let b=0,x=0;;b++){u.setFrame(b,g,w.r,w.g,w.b);let p=d[b+1];if(!p){u.shrink(x);break}let v=T(p,"time",0),y=O.fromString(p.color),A=m.curve;A&&(x=oe(A,u,x,b,0,g,v,w.r,y.r,1),x=oe(A,u,x,b,1,g,v,w.g,y.g,1),x=oe(A,u,x,b,2,g,v,w.b,y.b,1)),g=v,w=y,m=p}n.push(u)}else if(c=="alpha")n.push(Ye(d,new si(f,f,l),0,1));else if(c=="rgba2"){let u=new ri(f,f*7,l),m=d[0],g=T(m,"time",0),w=O.fromString(m.light),b=O.fromString(m.dark);for(let x=0,p=0;;x++){u.setFrame(x,g,w.r,w.g,w.b,w.a,b.r,b.g,b.b);let v=d[x+1];if(!v){u.shrink(p);break}let y=T(v,"time",0),A=O.fromString(v.light),C=O.fromString(v.dark),I=m.curve;I&&(p=oe(I,u,p,x,0,g,y,w.r,A.r,1),p=oe(I,u,p,x,1,g,y,w.g,A.g,1),p=oe(I,u,p,x,2,g,y,w.b,A.b,1),p=oe(I,u,p,x,3,g,y,w.a,A.a,1),p=oe(I,u,p,x,4,g,y,b.r,C.r,1),p=oe(I,u,p,x,5,g,y,b.g,C.g,1),p=oe(I,u,p,x,6,g,y,b.b,C.b,1)),g=y,w=A,b=C,m=v}n.push(u)}else if(c=="rgb2"){let u=new ni(f,f*6,l),m=d[0],g=T(m,"time",0),w=O.fromString(m.light),b=O.fromString(m.dark);for(let x=0,p=0;;x++){u.setFrame(x,g,w.r,w.g,w.b,b.r,b.g,b.b);let v=d[x+1];if(!v){u.shrink(p);break}let y=T(v,"time",0),A=O.fromString(v.light),C=O.fromString(v.dark),I=m.curve;I&&(p=oe(I,u,p,x,0,g,y,w.r,A.r,1),p=oe(I,u,p,x,1,g,y,w.g,A.g,1),p=oe(I,u,p,x,2,g,y,w.b,A.b,1),p=oe(I,u,p,x,3,g,y,b.r,C.r,1),p=oe(I,u,p,x,4,g,y,b.g,C.g,1),p=oe(I,u,p,x,5,g,y,b.b,C.b,1)),g=y,w=A,b=C,m=v}n.push(u)}}}if(e.bones)for(let a in e.bones){let r=e.bones[a],o=i.findBone(a);if(!o)throw new Error("Bone not found: "+a);let l=o.index;for(let c in r){let d=r[c],f=d.length;if(f!=0){if(c==="rotate")n.push(Ye(d,new ot(f,f,l),0,1));else if(c==="translate"){let u=new qt(f,f<<1,l);n.push(Vi(d,u,"x","y",0,s))}else if(c==="translatex"){let u=new Gt(f,f,l);n.push(Ye(d,u,0,s))}else if(c==="translatey"){let u=new Ht(f,f,l);n.push(Ye(d,u,0,s))}else if(c==="scale"){let u=new jt(f,f<<1,l);n.push(Vi(d,u,"x","y",1,1))}else if(c==="scalex"){let u=new Zt(f,f,l);n.push(Ye(d,u,1,1))}else if(c==="scaley"){let u=new Kt(f,f,l);n.push(Ye(d,u,1,1))}else if(c==="shear"){let u=new Jt(f,f<<1,l);n.push(Vi(d,u,"x","y",0,1))}else if(c==="shearx"){let u=new Qt(f,f,l);n.push(Ye(d,u,0,1))}else if(c==="sheary"){let u=new $t(f,f,l);n.push(Ye(d,u,0,1))}else if(c==="inherit"){let u=new ei(f,o.index);for(let m=0;m<d.length;m++){let g=d[m];u.setFrame(m,T(g,"time",0),L.enumValue(ct,T(g,"inherit","Normal")))}n.push(u)}}}}if(e.ik)for(let a in e.ik){let r=e.ik[a],o=r[0];if(!o)continue;let l=i.findIkConstraint(a);if(!l)throw new Error("IK Constraint not found: "+a);let c=i.ikConstraints.indexOf(l),d=new li(r.length,r.length<<1,c),f=T(o,"time",0),u=T(o,"mix",1),m=T(o,"softness",0)*s;for(let g=0,w=0;;g++){d.setFrame(g,f,u,m,T(o,"bendPositive",!0)?1:-1,T(o,"compress",!1),T(o,"stretch",!1));let b=r[g+1];if(!b){d.shrink(w);break}let x=T(b,"time",0),p=T(b,"mix",1),v=T(b,"softness",0)*s,y=o.curve;y&&(w=oe(y,d,w,g,0,f,x,u,p,1),w=oe(y,d,w,g,1,f,x,m,v,s)),f=x,u=p,m=v,o=b}n.push(d)}if(e.transform)for(let a in e.transform){let r=e.transform[a],o=r[0];if(!o)continue;let l=i.findTransformConstraint(a);if(!l)throw new Error("Transform constraint not found: "+a);let c=i.transformConstraints.indexOf(l),d=new oi(r.length,r.length*6,c),f=T(o,"time",0),u=T(o,"mixRotate",1),m=T(o,"mixX",1),g=T(o,"mixY",m),w=T(o,"mixScaleX",1),b=T(o,"mixScaleY",w),x=T(o,"mixShearY",1);for(let p=0,v=0;;p++){d.setFrame(p,f,u,m,g,w,b,x);let y=r[p+1];if(!y){d.shrink(v);break}let A=T(y,"time",0),C=T(y,"mixRotate",1),I=T(y,"mixX",1),R=T(y,"mixY",I),Y=T(y,"mixScaleX",1),k=T(y,"mixScaleY",Y),F=T(y,"mixShearY",1),P=o.curve;P&&(v=oe(P,d,v,p,0,f,A,u,C,1),v=oe(P,d,v,p,1,f,A,m,I,1),v=oe(P,d,v,p,2,f,A,g,R,1),v=oe(P,d,v,p,3,f,A,w,Y,1),v=oe(P,d,v,p,4,f,A,b,k,1),v=oe(P,d,v,p,5,f,A,x,F,1)),f=A,u=C,m=I,g=R,w=Y,b=k,w=Y,o=y}n.push(d)}if(e.path)for(let a in e.path){let r=e.path[a],o=i.findPathConstraint(a);if(!o)throw new Error("Path constraint not found: "+a);let l=i.pathConstraints.indexOf(o);for(let c in r){let d=r[c],f=d[0];if(!f)continue;let u=d.length;if(c==="position"){let m=new hi(u,u,l);n.push(Ye(d,m,0,o.positionMode==0?s:1))}else if(c==="spacing"){let m=new ci(u,u,l);n.push(Ye(d,m,0,o.spacingMode==0||o.spacingMode==1?s:1))}else if(c==="mix"){let m=new di(u,u*3,l),g=T(f,"time",0),w=T(f,"mixRotate",1),b=T(f,"mixX",1),x=T(f,"mixY",b);for(let p=0,v=0;;p++){m.setFrame(p,g,w,b,x);let y=d[p+1];if(!y){m.shrink(v);break}let A=T(y,"time",0),C=T(y,"mixRotate",1),I=T(y,"mixX",1),R=T(y,"mixY",I),Y=f.curve;Y&&(v=oe(Y,m,v,p,0,g,A,w,C,1),v=oe(Y,m,v,p,1,g,A,b,I,1),v=oe(Y,m,v,p,2,g,A,x,R,1)),g=A,w=C,b=I,x=R,f=y}n.push(m)}}}if(e.physics)for(let a in e.physics){let r=e.physics[a],o=-1;if(a.length>0){let l=i.findPhysicsConstraint(a);if(!l)throw new Error("Physics constraint not found: "+a);o=i.physicsConstraints.indexOf(l)}for(let l in r){let c=r[l],d=c[0];if(!d)continue;let f=c.length;if(l=="reset"){const m=new vt(c.size,o);for(let g=0;d!=null;d=c[g+1],g++)m.setFrame(g,T(d,"time",0));n.push(m);continue}let u;if(l=="inertia")u=new fi(f,f,o);else if(l=="strength")u=new ui(f,f,o);else if(l=="damping")u=new mi(f,f,o);else if(l=="mass")u=new gi(f,f,o);else if(l=="wind")u=new xi(f,f,o);else if(l=="gravity")u=new pi(f,f,o);else if(l=="mix")u=new bi(f,f,o);else continue;n.push(Ye(c,u,0,1))}}if(e.attachments)for(let a in e.attachments){let r=e.attachments[a],o=i.findSkin(a);if(!o)throw new Error("Skin not found: "+a);for(let l in r){let c=r[l],d=i.findSlot(l);if(!d)throw new Error("Slot not found: "+l);let f=d.index;for(let u in c){let m=c[u],g=o.getAttachment(f,u);for(let w in m){let b=m[w],x=b[0];if(x){if(w=="deform"){let p=g.bones,v=g.vertices,y=p?v.length/3*2:v.length,A=new ai(b.length,b.length,f,g),C=T(x,"time",0);for(let I=0,R=0;;I++){let Y,k=T(x,"vertices",null);if(!k)Y=p?L.newFloatArray(y):v;else{Y=L.newFloatArray(y);let M=T(x,"offset",0);if(L.arrayCopy(k,0,Y,M,k.length),s!=1)for(let V=M,ie=V+k.length;V<ie;V++)Y[V]*=s;if(!p)for(let V=0;V<y;V++)Y[V]+=v[V]}A.setFrame(I,C,Y);let F=b[I+1];if(!F){A.shrink(R);break}let P=T(F,"time",0),E=x.curve;E&&(R=oe(E,A,R,I,0,C,P,0,1,1)),C=P,x=F}n.push(A)}else if(w=="sequence"){let p=new Qe(b.length,f,g),v=0;for(let y=0;y<b.length;y++){let A=T(x,"delay",v),C=T(x,"time",0),I=Qi[T(x,"mode","hold")],R=T(x,"index",0);p.setFrame(y,C,I,R,A),v=A,x=b[y+1]}n.push(p)}}}}}}if(e.drawOrder){let a=new Ge(e.drawOrder.length),r=i.slots.length,o=0;for(let l=0;l<e.drawOrder.length;l++,o++){let c=e.drawOrder[l],d=null,f=T(c,"offsets",null);if(f){d=L.newArray(r,-1);let u=L.newArray(r-f.length,0),m=0,g=0;for(let w=0;w<f.length;w++){let b=f[w],x=i.findSlot(b.slot);if(!x)throw new Error("Slot not found: "+x);let p=x.index;for(;m!=p;)u[g++]=m++;d[m+b.offset]=m++}for(;m<r;)u[g++]=m++;for(let w=r-1;w>=0;w--)d[w]==-1&&(d[w]=u[--g])}a.setFrame(o,T(c,"time",0),d)}n.push(a)}if(e.events){let a=new ht(e.events.length),r=0;for(let o=0;o<e.events.length;o++,r++){let l=e.events[o],c=i.findEvent(l.name);if(!c)throw new Error("Event not found: "+l.name);let d=new Ei(L.toSinglePrecision(T(l,"time",0)),c);d.intValue=T(l,"int",c.intValue),d.floatValue=T(l,"float",c.floatValue),d.stringValue=T(l,"string",c.stringValue),d.data.audioPath&&(d.volume=T(l,"volume",1),d.balance=T(l,"balance",0)),a.setFrame(r,d)}n.push(a)}let h=0;for(let a=0,r=n.length;a<r;a++)h=Math.max(h,n[a].getDuration());i.animations.push(new bt(t,n,h))}},Or=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,i,s,n){this.mesh=e,this.skin=t,this.slotIndex=i,this.parent=s,this.inheritTimeline=n}};function Ye(e,t,i,s){let n=e[0],h=T(n,"time",0),a=T(n,"value",i)*s,r=0;for(let o=0;;o++){t.setFrame(o,h,a);let l=e[o+1];if(!l)return t.shrink(r),t;let c=T(l,"time",0),d=T(l,"value",i)*s;n.curve&&(r=oe(n.curve,t,r,o,0,h,c,a,d,s)),h=c,a=d,n=l}}function Vi(e,t,i,s,n,h){let a=e[0],r=T(a,"time",0),o=T(a,i,n)*h,l=T(a,s,n)*h,c=0;for(let d=0;;d++){t.setFrame(d,r,o,l);let f=e[d+1];if(!f)return t.shrink(c),t;let u=T(f,"time",0),m=T(f,i,n)*h,g=T(f,s,n)*h,w=a.curve;w&&(c=oe(w,t,c,d,0,r,u,o,m,h),c=oe(w,t,c,d,1,r,u,l,g,h)),r=u,o=m,l=g,a=f}}function oe(e,t,i,s,n,h,a,r,o,l){if(e=="stepped")return t.setStepped(s),i;let c=n<<2,d=e[c],f=e[c+1]*l,u=e[c+2],m=e[c+3]*l;return t.setBezier(i,s,n,h,r,d,f,u,m,a,o),i+1}function T(e,t,i){return e[t]!==void 0?e[t]:i}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));var be=class{canvas;gl;restorables=new Array;constructor(e,t={alpha:"true"}){if(e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext)this.gl=e,this.canvas=this.gl.canvas;else{let i=e;this.gl=i.getContext("webgl2",t)||i.getContext("webgl",t),this.canvas=i,i.addEventListener("webglcontextlost",s=>{let n=s;s&&s.preventDefault()}),i.addEventListener("webglcontextrestored",s=>{for(let n=0,h=this.restorables.length;n<h;n++)this.restorables[n].restore()})}}addRestorable(e){this.restorables.push(e)}removeRestorable(e){let t=this.restorables.indexOf(e);t>-1&&this.restorables.splice(t,1)}},Ft=class extends Ai{context;texture=null;boundUnit=0;useMipMaps=!1;constructor(e,t,i=!1){super(t),this.context=e instanceof be?e:new be(e),this.useMipMaps=i,this.restore(),this.context.addRestorable(this)}setFilters(e,t){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,Ft.validateMagFilter(t)),this.useMipMaps=Ft.usesMipMaps(e),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(e){switch(e){case 9987:case 9985:case 9986:case 9984:return 9729;default:return e}}static usesMipMaps(e){switch(e){case 9987:case 9985:case 9986:case 9984:return!0;default:return!1}}setWraps(e,t){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t)}update(e){let t=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind(),Ft.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL&&t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this._image),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,e?t.LINEAR_MIPMAP_LINEAR:t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e&&t.generateMipmap(t.TEXTURE_2D)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(e=0){let t=this.context.gl;this.boundUnit=e,t.activeTexture(t.TEXTURE0+e),t.bindTexture(t.TEXTURE_2D,this.texture)}unbind(){let e=this.context.gl;e.activeTexture(e.TEXTURE0+this.boundUnit),e.bindTexture(e.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}},ut=Ft;B(ut,"DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL",!1);var Cs=class extends gs{constructor(e,t="",i=new Mi){super(s=>new ut(e,s),t,i)}},Se=class{x=0;y=0;z=0;constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}setFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,i){return this.x=e,this.y=t,this.z=i,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}normalize(){let e=this.length();return e==0?this:(e=1/e,this.x*=e,this.y*=e,this.z*=e,this)}cross(e){return this.set(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}multiply(e){let t=e.values;return this.set(this.x*t[D]+this.y*t[q]+this.z*t[G]+t[N],this.x*t[H]+this.y*t[U]+this.z*t[j]+t[_],this.x*t[Z]+this.y*t[K]+this.z*t[z]+t[W])}project(e){let t=e.values,i=1/(this.x*t[Q]+this.y*t[$]+this.z*t[ee]+t[J]);return this.set((this.x*t[D]+this.y*t[q]+this.z*t[G]+t[N])*i,(this.x*t[H]+this.y*t[U]+this.z*t[j]+t[_])*i,(this.x*t[Z]+this.y*t[K]+this.z*t[z]+t[W])*i)}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(e){let t=e.x-this.x,i=e.y-this.y,s=e.z-this.z;return Math.sqrt(t*t+i*i+s*s)}},D=0,q=4,G=8,N=12,H=1,U=5,j=9,_=13,Z=2,K=6,z=10,W=14,Q=3,$=7,ee=11,J=15,ke=class{temp=new Float32Array(16);values=new Float32Array(16);constructor(){let e=this.values;e[D]=1,e[U]=1,e[z]=1,e[J]=1}set(e){return this.values.set(e),this}transpose(){let e=this.temp,t=this.values;return e[D]=t[D],e[q]=t[H],e[G]=t[Z],e[N]=t[Q],e[H]=t[q],e[U]=t[U],e[j]=t[K],e[_]=t[$],e[Z]=t[G],e[K]=t[j],e[z]=t[z],e[W]=t[ee],e[Q]=t[N],e[$]=t[_],e[ee]=t[W],e[J]=t[J],this.set(e)}identity(){let e=this.values;return e[D]=1,e[q]=0,e[G]=0,e[N]=0,e[H]=0,e[U]=1,e[j]=0,e[_]=0,e[Z]=0,e[K]=0,e[z]=1,e[W]=0,e[Q]=0,e[$]=0,e[ee]=0,e[J]=1,this}invert(){let e=this.values,t=this.temp,i=e[Q]*e[K]*e[j]*e[N]-e[Z]*e[$]*e[j]*e[N]-e[Q]*e[U]*e[z]*e[N]+e[H]*e[$]*e[z]*e[N]+e[Z]*e[U]*e[ee]*e[N]-e[H]*e[K]*e[ee]*e[N]-e[Q]*e[K]*e[G]*e[_]+e[Z]*e[$]*e[G]*e[_]+e[Q]*e[q]*e[z]*e[_]-e[D]*e[$]*e[z]*e[_]-e[Z]*e[q]*e[ee]*e[_]+e[D]*e[K]*e[ee]*e[_]+e[Q]*e[U]*e[G]*e[W]-e[H]*e[$]*e[G]*e[W]-e[Q]*e[q]*e[j]*e[W]+e[D]*e[$]*e[j]*e[W]+e[H]*e[q]*e[ee]*e[W]-e[D]*e[U]*e[ee]*e[W]-e[Z]*e[U]*e[G]*e[J]+e[H]*e[K]*e[G]*e[J]+e[Z]*e[q]*e[j]*e[J]-e[D]*e[K]*e[j]*e[J]-e[H]*e[q]*e[z]*e[J]+e[D]*e[U]*e[z]*e[J];if(i==0)throw new Error("non-invertible matrix");let s=1/i;return t[D]=e[j]*e[W]*e[$]-e[_]*e[z]*e[$]+e[_]*e[K]*e[ee]-e[U]*e[W]*e[ee]-e[j]*e[K]*e[J]+e[U]*e[z]*e[J],t[q]=e[N]*e[z]*e[$]-e[G]*e[W]*e[$]-e[N]*e[K]*e[ee]+e[q]*e[W]*e[ee]+e[G]*e[K]*e[J]-e[q]*e[z]*e[J],t[G]=e[G]*e[_]*e[$]-e[N]*e[j]*e[$]+e[N]*e[U]*e[ee]-e[q]*e[_]*e[ee]-e[G]*e[U]*e[J]+e[q]*e[j]*e[J],t[N]=e[N]*e[j]*e[K]-e[G]*e[_]*e[K]-e[N]*e[U]*e[z]+e[q]*e[_]*e[z]+e[G]*e[U]*e[W]-e[q]*e[j]*e[W],t[H]=e[_]*e[z]*e[Q]-e[j]*e[W]*e[Q]-e[_]*e[Z]*e[ee]+e[H]*e[W]*e[ee]+e[j]*e[Z]*e[J]-e[H]*e[z]*e[J],t[U]=e[G]*e[W]*e[Q]-e[N]*e[z]*e[Q]+e[N]*e[Z]*e[ee]-e[D]*e[W]*e[ee]-e[G]*e[Z]*e[J]+e[D]*e[z]*e[J],t[j]=e[N]*e[j]*e[Q]-e[G]*e[_]*e[Q]-e[N]*e[H]*e[ee]+e[D]*e[_]*e[ee]+e[G]*e[H]*e[J]-e[D]*e[j]*e[J],t[_]=e[G]*e[_]*e[Z]-e[N]*e[j]*e[Z]+e[N]*e[H]*e[z]-e[D]*e[_]*e[z]-e[G]*e[H]*e[W]+e[D]*e[j]*e[W],t[Z]=e[U]*e[W]*e[Q]-e[_]*e[K]*e[Q]+e[_]*e[Z]*e[$]-e[H]*e[W]*e[$]-e[U]*e[Z]*e[J]+e[H]*e[K]*e[J],t[K]=e[N]*e[K]*e[Q]-e[q]*e[W]*e[Q]-e[N]*e[Z]*e[$]+e[D]*e[W]*e[$]+e[q]*e[Z]*e[J]-e[D]*e[K]*e[J],t[z]=e[q]*e[_]*e[Q]-e[N]*e[U]*e[Q]+e[N]*e[H]*e[$]-e[D]*e[_]*e[$]-e[q]*e[H]*e[J]+e[D]*e[U]*e[J],t[W]=e[N]*e[U]*e[Z]-e[q]*e[_]*e[Z]-e[N]*e[H]*e[K]+e[D]*e[_]*e[K]+e[q]*e[H]*e[W]-e[D]*e[U]*e[W],t[Q]=e[j]*e[K]*e[Q]-e[U]*e[z]*e[Q]-e[j]*e[Z]*e[$]+e[H]*e[z]*e[$]+e[U]*e[Z]*e[ee]-e[H]*e[K]*e[ee],t[$]=e[q]*e[z]*e[Q]-e[G]*e[K]*e[Q]+e[G]*e[Z]*e[$]-e[D]*e[z]*e[$]-e[q]*e[Z]*e[ee]+e[D]*e[K]*e[ee],t[ee]=e[G]*e[U]*e[Q]-e[q]*e[j]*e[Q]-e[G]*e[H]*e[$]+e[D]*e[j]*e[$]+e[q]*e[H]*e[ee]-e[D]*e[U]*e[ee],t[J]=e[q]*e[j]*e[Z]-e[G]*e[U]*e[Z]+e[G]*e[H]*e[K]-e[D]*e[j]*e[K]-e[q]*e[H]*e[z]+e[D]*e[U]*e[z],e[D]=t[D]*s,e[q]=t[q]*s,e[G]=t[G]*s,e[N]=t[N]*s,e[H]=t[H]*s,e[U]=t[U]*s,e[j]=t[j]*s,e[_]=t[_]*s,e[Z]=t[Z]*s,e[K]=t[K]*s,e[z]=t[z]*s,e[W]=t[W]*s,e[Q]=t[Q]*s,e[$]=t[$]*s,e[ee]=t[ee]*s,e[J]=t[J]*s,this}determinant(){let e=this.values;return e[Q]*e[K]*e[j]*e[N]-e[Z]*e[$]*e[j]*e[N]-e[Q]*e[U]*e[z]*e[N]+e[H]*e[$]*e[z]*e[N]+e[Z]*e[U]*e[ee]*e[N]-e[H]*e[K]*e[ee]*e[N]-e[Q]*e[K]*e[G]*e[_]+e[Z]*e[$]*e[G]*e[_]+e[Q]*e[q]*e[z]*e[_]-e[D]*e[$]*e[z]*e[_]-e[Z]*e[q]*e[ee]*e[_]+e[D]*e[K]*e[ee]*e[_]+e[Q]*e[U]*e[G]*e[W]-e[H]*e[$]*e[G]*e[W]-e[Q]*e[q]*e[j]*e[W]+e[D]*e[$]*e[j]*e[W]+e[H]*e[q]*e[ee]*e[W]-e[D]*e[U]*e[ee]*e[W]-e[Z]*e[U]*e[G]*e[J]+e[H]*e[K]*e[G]*e[J]+e[Z]*e[q]*e[j]*e[J]-e[D]*e[K]*e[j]*e[J]-e[H]*e[q]*e[z]*e[J]+e[D]*e[U]*e[z]*e[J]}translate(e,t,i){let s=this.values;return s[N]+=e,s[_]+=t,s[W]+=i,this}copy(){return new ke().set(this.values)}projection(e,t,i,s){this.identity();let n=1/Math.tan(i*(Math.PI/180)/2),h=(t+e)/(e-t),a=2*t*e/(e-t),r=this.values;return r[D]=n/s,r[H]=0,r[Z]=0,r[Q]=0,r[q]=0,r[U]=n,r[K]=0,r[$]=0,r[G]=0,r[j]=0,r[z]=h,r[ee]=-1,r[N]=0,r[_]=0,r[W]=a,r[J]=0,this}ortho2d(e,t,i,s){return this.ortho(e,e+i,t,t+s,0,1)}ortho(e,t,i,s,n,h){this.identity();let a=2/(t-e),r=2/(s-i),o=-2/(h-n),l=-(t+e)/(t-e),c=-(s+i)/(s-i),d=-(h+n)/(h-n),f=this.values;return f[D]=a,f[H]=0,f[Z]=0,f[Q]=0,f[q]=0,f[U]=r,f[K]=0,f[$]=0,f[G]=0,f[j]=0,f[z]=o,f[ee]=0,f[N]=l,f[_]=c,f[W]=d,f[J]=1,this}multiply(e){let t=this.temp,i=this.values,s=e.values;return t[D]=i[D]*s[D]+i[q]*s[H]+i[G]*s[Z]+i[N]*s[Q],t[q]=i[D]*s[q]+i[q]*s[U]+i[G]*s[K]+i[N]*s[$],t[G]=i[D]*s[G]+i[q]*s[j]+i[G]*s[z]+i[N]*s[ee],t[N]=i[D]*s[N]+i[q]*s[_]+i[G]*s[W]+i[N]*s[J],t[H]=i[H]*s[D]+i[U]*s[H]+i[j]*s[Z]+i[_]*s[Q],t[U]=i[H]*s[q]+i[U]*s[U]+i[j]*s[K]+i[_]*s[$],t[j]=i[H]*s[G]+i[U]*s[j]+i[j]*s[z]+i[_]*s[ee],t[_]=i[H]*s[N]+i[U]*s[_]+i[j]*s[W]+i[_]*s[J],t[Z]=i[Z]*s[D]+i[K]*s[H]+i[z]*s[Z]+i[W]*s[Q],t[K]=i[Z]*s[q]+i[K]*s[U]+i[z]*s[K]+i[W]*s[$],t[z]=i[Z]*s[G]+i[K]*s[j]+i[z]*s[z]+i[W]*s[ee],t[W]=i[Z]*s[N]+i[K]*s[_]+i[z]*s[W]+i[W]*s[J],t[Q]=i[Q]*s[D]+i[$]*s[H]+i[ee]*s[Z]+i[J]*s[Q],t[$]=i[Q]*s[q]+i[$]*s[U]+i[ee]*s[K]+i[J]*s[$],t[ee]=i[Q]*s[G]+i[$]*s[j]+i[ee]*s[z]+i[J]*s[ee],t[J]=i[Q]*s[N]+i[$]*s[_]+i[ee]*s[W]+i[J]*s[J],this.set(this.temp)}multiplyLeft(e){let t=this.temp,i=this.values,s=e.values;return t[D]=s[D]*i[D]+s[q]*i[H]+s[G]*i[Z]+s[N]*i[Q],t[q]=s[D]*i[q]+s[q]*i[U]+s[G]*i[K]+s[N]*i[$],t[G]=s[D]*i[G]+s[q]*i[j]+s[G]*i[z]+s[N]*i[ee],t[N]=s[D]*i[N]+s[q]*i[_]+s[G]*i[W]+s[N]*i[J],t[H]=s[H]*i[D]+s[U]*i[H]+s[j]*i[Z]+s[_]*i[Q],t[U]=s[H]*i[q]+s[U]*i[U]+s[j]*i[K]+s[_]*i[$],t[j]=s[H]*i[G]+s[U]*i[j]+s[j]*i[z]+s[_]*i[ee],t[_]=s[H]*i[N]+s[U]*i[_]+s[j]*i[W]+s[_]*i[J],t[Z]=s[Z]*i[D]+s[K]*i[H]+s[z]*i[Z]+s[W]*i[Q],t[K]=s[Z]*i[q]+s[K]*i[U]+s[z]*i[K]+s[W]*i[$],t[z]=s[Z]*i[G]+s[K]*i[j]+s[z]*i[z]+s[W]*i[ee],t[W]=s[Z]*i[N]+s[K]*i[_]+s[z]*i[W]+s[W]*i[J],t[Q]=s[Q]*i[D]+s[$]*i[H]+s[ee]*i[Z]+s[J]*i[Q],t[$]=s[Q]*i[q]+s[$]*i[U]+s[ee]*i[K]+s[J]*i[$],t[ee]=s[Q]*i[G]+s[$]*i[j]+s[ee]*i[z]+s[J]*i[ee],t[J]=s[Q]*i[N]+s[$]*i[_]+s[ee]*i[W]+s[J]*i[J],this.set(this.temp)}lookAt(e,t,i){let s=ke.xAxis,n=ke.yAxis,h=ke.zAxis;h.setFrom(t).normalize(),s.setFrom(t).normalize(),s.cross(i).normalize(),n.setFrom(s).cross(h).normalize(),this.identity();let a=this.values;return a[D]=s.x,a[q]=s.y,a[G]=s.z,a[H]=n.x,a[U]=n.y,a[j]=n.z,a[Z]=-h.x,a[K]=-h.y,a[z]=-h.z,ke.tmpMatrix.identity(),ke.tmpMatrix.values[N]=-e.x,ke.tmpMatrix.values[_]=-e.y,ke.tmpMatrix.values[W]=-e.z,this.multiply(ke.tmpMatrix),this}},Le=ke;B(Le,"xAxis",new Se),B(Le,"yAxis",new Se),B(Le,"zAxis",new Se),B(Le,"tmpMatrix",new ke);var Ss=class{position=new Se(0,0,0);direction=new Se(0,0,-1);up=new Se(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new Le;inverseProjectionView=new Le;projection=new Le;view=new Le;constructor(e,t){this.viewportWidth=e,this.viewportHeight=t,this.update()}update(){let e=this.projection,t=this.view,i=this.projectionView,s=this.inverseProjectionView,n=this.zoom,h=this.viewportWidth,a=this.viewportHeight;e.ortho(n*(-h/2),n*(h/2),n*(-a/2),n*(a/2),this.near,this.far),t.lookAt(this.position,this.direction,this.up),i.set(e.values),i.multiply(t),s.set(i.values).invert()}screenToWorld(e,t,i){let s=e.x,n=i-e.y-1;return e.x=2*s/t-1,e.y=2*n/i-1,e.z=2*e.z-1,e.project(this.inverseProjectionView),e}worldToScreen(e,t,i){return e.project(this.projectionView),e.x=t*(e.x+1)/2,e.y=i*(e.y+1)/2,e.z=(e.z+1)/2,e}setViewport(e,t){this.viewportWidth=e,this.viewportHeight=t}},Di=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=new Array;eventListeners=[];constructor(e){this.element=e,this.setupCallbacks(e)}setupCallbacks(e){let t=a=>{if(a instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=a.clientX-r.left,this.mouseY=a.clientY-r.top,this.buttonDown=!0,this.listeners.map(o=>{o.down&&o.down(this.mouseX,this.mouseY)}),document.addEventListener("mousemove",i),document.addEventListener("mouseup",s)}},i=a=>{if(a instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=a.clientX-r.left,this.mouseY=a.clientY-r.top,this.listeners.map(o=>{this.buttonDown?o.dragged&&o.dragged(this.mouseX,this.mouseY):o.moved&&o.moved(this.mouseX,this.mouseY)})}},s=a=>{if(a instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=a.clientX-r.left,this.mouseY=a.clientY-r.top,this.buttonDown=!1,this.listeners.map(o=>{o.up&&o.up(this.mouseX,this.mouseY)}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}},n=a=>{a.preventDefault();let r=a.deltaY;a.deltaMode==WheelEvent.DOM_DELTA_LINE&&(r*=8),a.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(r*=24),this.listeners.map(o=>{o.wheel&&o.wheel(a.deltaY)})};e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",i,!0),e.addEventListener("mouseup",s,!0),e.addEventListener("wheel",n,!0),e.addEventListener("touchstart",a=>{if(!this.touch0||!this.touch1){var r=a.changedTouches;let o=r.item(0);if(!o)return;let l=e.getBoundingClientRect(),c=o.clientX-l.left,d=o.clientY-l.top,f=new Ts(o.identifier,c,d);if(this.mouseX=c,this.mouseY=d,this.buttonDown=!0,!this.touch0)this.touch0=f,this.listeners.map(u=>{u.down&&u.down(f.x,f.y)});else if(!this.touch1){this.touch1=f;let u=this.touch1.x-this.touch0.x,m=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(u*u+m*m),this.listeners.map(g=>{g.zoom&&g.zoom(this.initialPinchDistance,this.initialPinchDistance)})}}a.preventDefault()},!1),e.addEventListener("touchmove",a=>{if(this.touch0){var r=a.changedTouches;let c=e.getBoundingClientRect();for(var o=0;o<r.length;o++){var l=r[o];let d=l.clientX-c.left,f=l.clientY-c.top;this.touch0.identifier===l.identifier&&(this.touch0.x=this.mouseX=d,this.touch0.y=this.mouseY=f,this.listeners.map(u=>{u.dragged&&u.dragged(d,f)})),this.touch1&&this.touch1.identifier===l.identifier&&(this.touch1.x=this.mouseX=d,this.touch1.y=this.mouseY=f)}if(this.touch0&&this.touch1){let d=this.touch1.x-this.touch0.x,f=this.touch1.x-this.touch0.x,u=Math.sqrt(d*d+f*f);this.listeners.map(m=>{m.zoom&&m.zoom(this.initialPinchDistance,u)})}}a.preventDefault()},!1);let h=a=>{if(this.touch0){var r=a.changedTouches;let c=e.getBoundingClientRect();for(var o=0;o<r.length;o++){var l=r[o];let d=l.clientX-c.left,f=l.clientY-c.top;if(this.touch0.identifier===l.identifier)if(this.touch0=null,this.mouseX=d,this.mouseY=f,this.listeners.map(u=>{u.up&&u.up(d,f)}),this.touch1)this.touch0=this.touch1,this.touch1=null,this.mouseX=this.touch0.x,this.mouseX=this.touch0.x,this.buttonDown=!0,this.listeners.map(u=>{u.down&&u.down(this.touch0.x,this.touch0.y)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}a.preventDefault()};e.addEventListener("touchend",h,!1),e.addEventListener("touchcancel",h)}addListener(e){this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}},Ts=class{constructor(e,t,i){this.identifier=e,this.x=t,this.y=i}},Vr=class{constructor(e,t){this.canvas=e,this.camera=t;let i=0,s=0,n=0,h=0,a=0,r=0,o=0,l=0;new Di(e).addListener({down:(c,d)=>{i=t.position.x,s=t.position.y,h=r=c,a=o=d,l=t.zoom},dragged:(c,d)=>{let f=c-h,u=d-a,m=t.screenToWorld(new Se(0,0),e.clientWidth,e.clientHeight),g=t.screenToWorld(new Se(f,u),e.clientWidth,e.clientHeight).sub(m);t.position.set(i-g.x,s-g.y,0),t.update(),r=c,o=d},wheel:c=>{let d=c/200*t.zoom,f=t.zoom+d;if(f>0){let u=0,m=0;if(c<0)u=r,m=o;else{let b=new Se(e.clientWidth/2+15,e.clientHeight/2),x=r-b.x,p=e.clientHeight-1-o-b.y;u=b.x-x,m=e.clientHeight-1-b.y+p}let g=t.screenToWorld(new Se(u,m),e.clientWidth,e.clientHeight);t.zoom=f,t.update();let w=t.screenToWorld(new Se(u,m),e.clientWidth,e.clientHeight);t.position.add(g.sub(w)),t.update()}},zoom:(c,d)=>{let f=c/d;t.zoom=l*f},up:(c,d)=>{r=c,o=d},moved:(c,d)=>{r=c,o=d}})}},de=class{constructor(e,t,i){this.vertexShader=t,this.fragmentShader=i,this.vsSource=t,this.fsSource=i,this.context=e instanceof be?e:new be(e),this.context.addRestorable(this),this.compile()}context;vs=null;vsSource;fs=null;fsSource;program=null;tmp2x2=new Float32Array(2*2);tmp3x3=new Float32Array(3*3);tmp4x4=new Float32Array(4*4);getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){let e=this.context.gl;try{if(this.vs=this.compileShader(e.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(e.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(t){throw this.dispose(),t}}compileShader(e,t){let i=this.context.gl,s=i.createShader(e);if(!s)throw new Error("Couldn't create shader.");if(i.shaderSource(s,t),i.compileShader(s),!i.getShaderParameter(s,i.COMPILE_STATUS)){let n="Couldn't compile shader: "+i.getShaderInfoLog(s);if(i.deleteShader(s),!i.isContextLost())throw new Error(n)}return s}compileProgram(e,t){let i=this.context.gl,s=i.createProgram();if(!s)throw new Error("Couldn't compile program.");if(i.attachShader(s,e),i.attachShader(s,t),i.linkProgram(s),!i.getProgramParameter(s,i.LINK_STATUS)){let n="Couldn't compile shader program: "+i.getProgramInfoLog(s);if(i.deleteProgram(s),!i.isContextLost())throw new Error(n)}return s}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(e,t){this.context.gl.uniform1i(this.getUniformLocation(e),t)}setUniformf(e,t){this.context.gl.uniform1f(this.getUniformLocation(e),t)}setUniform2f(e,t,i){this.context.gl.uniform2f(this.getUniformLocation(e),t,i)}setUniform3f(e,t,i,s){this.context.gl.uniform3f(this.getUniformLocation(e),t,i,s)}setUniform4f(e,t,i,s,n){this.context.gl.uniform4f(this.getUniformLocation(e),t,i,s,n)}setUniform2x2f(e,t){let i=this.context.gl;this.tmp2x2.set(t),i.uniformMatrix2fv(this.getUniformLocation(e),!1,this.tmp2x2)}setUniform3x3f(e,t){let i=this.context.gl;this.tmp3x3.set(t),i.uniformMatrix3fv(this.getUniformLocation(e),!1,this.tmp3x3)}setUniform4x4f(e,t){let i=this.context.gl;this.tmp4x4.set(t),i.uniformMatrix4fv(this.getUniformLocation(e),!1,this.tmp4x4)}getUniformLocation(e){let t=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=t.getUniformLocation(this.program,e);if(!i&&!t.isContextLost())throw new Error(`Couldn't find location for uniform ${e}`);return i}getAttributeLocation(e){let t=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=t.getAttribLocation(this.program,e);if(i==-1&&!t.isContextLost())throw new Error(`Couldn't find location for attribute ${e}`);return i}dispose(){this.context.removeRestorable(this);let e=this.context.gl;this.vs&&(e.deleteShader(this.vs),this.vs=null),this.fs&&(e.deleteShader(this.fs),this.fs=null),this.program&&(e.deleteProgram(this.program),this.program=null)}static newColoredTextured(e){let t=`
3
3
  attribute vec4 ${de.POSITION};
4
4
  attribute vec4 ${de.COLOR};