@esotericsoftware/spine-webgl 4.2.81 → 4.2.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Input.d.ts +13 -9
- package/dist/Input.js +74 -45
- package/dist/LoadingScreen.d.ts +1 -0
- package/dist/LoadingScreen.js +18 -1
- package/dist/esm/spine-webgl.min.mjs +26 -26
- package/dist/esm/spine-webgl.mjs +1065 -1542
- package/dist/esm/spine-webgl.mjs.map +3 -3
- package/dist/iife/spine-webgl.js +1068 -1543
- package/dist/iife/spine-webgl.js.map +3 -3
- package/dist/iife/spine-webgl.min.js +26 -26
- package/package.json +2 -2
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";var spine=(()=>{var mt=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,Us=Object.getOwnPropertyNames,_s=Object.prototype.hasOwnProperty,zs=(e,t,i)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ws=(e,t)=>{for(var i in t)mt(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&&mt(e,n,{get:()=>t[n],enumerable:!(s=Ns(t,n))||s.enumerable});return e},Gs=e=>qs(mt({},"__esModule",{value:!0}),e),B=(e,t,i)=>(zs(e,typeof t!="symbol"?t+"":t,i),i),ji={};Ws(ji,{AlphaTimeline:()=>si,Animation:()=>xt,AnimationState:()=>ns,AnimationStateAdapter:()=>Js,AnimationStateData:()=>Qs,AssetManager:()=>Cs,AssetManagerBase:()=>gs,AtlasAttachmentLoader:()=>tr,Attachment:()=>zt,AttachmentTimeline:()=>qe,BinaryInput:()=>ys,BlendMode:()=>Rt,Bone:()=>Ii,BoneData:()=>Ti,BoundingBoxAttachment:()=>At,CURRENT:()=>hs,CameraController:()=>Or,ClippingAttachment:()=>$e,Color:()=>V,Color2Attribute:()=>Is,ColorAttribute:()=>Xt,ConstraintData:()=>ht,CurveTimeline:()=>Ye,CurveTimeline1:()=>Te,CurveTimeline2:()=>pt,DebugUtils:()=>Zs,DeformTimeline:()=>ai,Downloader:()=>Mi,DrawOrderTimeline:()=>Ge,Event:()=>Ei,EventData:()=>Ri,EventQueue:()=>ls,EventTimeline:()=>lt,EventType:()=>Ae,FIRST:()=>wi,FakeTexture:()=>$s,GLTexture:()=>ct,HOLD_FIRST:()=>yt,HOLD_MIX:()=>os,HOLD_SUBSEQUENT:()=>vi,IkConstraint:()=>xs,IkConstraintData:()=>Yi,IkConstraintTimeline:()=>li,Inherit:()=>ot,InheritTimeline:()=>ei,Input:()=>Di,IntSet:()=>Hs,Interpolation:()=>Zi,LoadingScreen:()=>zr,M00:()=>O,M01:()=>W,M02:()=>q,M03:()=>D,M10:()=>G,M11:()=>N,M12:()=>H,M13:()=>U,M20:()=>j,M21:()=>Z,M22:()=>_,M23:()=>z,M30:()=>Q,M31:()=>$,M32:()=>ee,M33:()=>J,ManagedWebGLRenderingContext:()=>be,MathUtils:()=>P,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:()=>bt,PhysicsConstraintStrengthTimeline:()=>ui,PhysicsConstraintTimeline:()=>Ve,PhysicsConstraintWindTimeline:()=>xi,PointAttachment:()=>Si,PolygonBatcher:()=>it,Pool:()=>nt,Position2Attribute:()=>Ft,Position3Attribute:()=>Dr,PositionMode:()=>St,Pow:()=>Ki,PowOut:()=>js,RGB2Timeline:()=>ni,RGBA2Timeline:()=>ri,RGBATimeline:()=>ti,RGBTimeline:()=>ii,RegionAttachment:()=>le,ResizeMode:()=>Vt,RotateMode:()=>It,RotateTimeline:()=>at,SETUP:()=>yi,SUBSEQUENT:()=>vt,ScaleTimeline:()=>jt,ScaleXTimeline:()=>Zt,ScaleYTimeline:()=>Kt,SceneRenderer:()=>ks,SequenceTimeline:()=>Qe,Shader:()=>xe,ShapeRenderer:()=>_i,ShapeType:()=>ye,ShearTimeline:()=>Jt,ShearXTimeline:()=>Qt,ShearYTimeline:()=>$t,Skeleton:()=>Mt,SkeletonBinary:()=>sr,SkeletonBounds:()=>As,SkeletonClipping:()=>Yt,SkeletonData:()=>Xi,SkeletonDebugRenderer:()=>Pt,SkeletonJson:()=>Br,SkeletonRenderer:()=>Wi,Skin:()=>Et,SkinEntry:()=>Pi,Slot:()=>ps,SlotData:()=>Li,SpacingMode:()=>Tt,SpineCanvas:()=>Gr,StringSet:()=>Ut,TexCoordAttribute:()=>Ui,Texture:()=>Ai,TextureAtlas:()=>fs,TextureAtlasPage:()=>us,TextureAtlasRegion:()=>Ci,TextureFilter:()=>Ct,TextureRegion:()=>ds,TextureWrap:()=>cs,TimeKeeper:()=>_t,Timeline:()=>me,Touch:()=>Ts,TrackEntry:()=>as,TransformConstraint:()=>bs,TransformConstraintData:()=>Bi,TransformConstraintTimeline:()=>oi,TranslateTimeline:()=>qt,TranslateXTimeline:()=>Gt,TranslateYTimeline:()=>Ht,Triangulator:()=>Ce,Utils:()=>L,Vector2:()=>We,Vector3:()=>Ie,VertexAttachment:()=>Re,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}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return Number("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e){return new ze().setFromString(e)}},V=ze;B(V,"WHITE",new ze(1,1,1,1)),B(V,"RED",new ze(1,0,0,1)),B(V,"GREEN",new ze(0,1,0,1)),B(V,"BLUE",new ze(0,0,1,1)),B(V,"MAGENTA",new ze(1,0,1,1));var Ee=class{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*Ee.degRad)}static sinDeg(e){return Math.sin(e*Ee.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*Ee.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 Ee.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}},P=Ee;B(P,"PI",3.1415927),B(P,"PI2",Ee.PI*2),B(P,"invPI2",1/Ee.PI2),B(P,"radiansToDegrees",180/Ee.PI),B(P,"radDeg",Ee.radiansToDegrees),B(P,"degreesToRadians",Ee.PI/180),B(P,"degRad",Ee.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)}}},nt=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 y=t,v=n;v<i;y+=2,v+=h){let A=o[y],C=o[y+1];s[v]=A*w+C*b+m,s[v+1]=A*x+C*p+g}return}let c=0,f=0;for(let u=0;u<t;u+=2){let m=l[c];c+=m+1,f+=m}let d=a.bones;if(r.length==0)for(let u=n,m=f*3;u<i;u+=h){let g=0,w=0,b=l[c++];for(b+=c;c<b;c++,m+=3){let x=d[l[c]],p=o[m],y=o[m+1],v=o[m+2];g+=(p*x.a+y*x.b+x.worldX)*v,w+=(p*x.c+y*x.d+x.worldY)*v}s[u]=g,s[u+1]=w}else{let u=r;for(let m=n,g=f*3,w=f<<1;m<i;m+=h){let b=0,x=0,p=l[c++];for(p+=c;c<p;c++,g+=3,w+=2){let y=d[l[c]],v=o[g]+u[w],A=o[g+1]+u[w+1],C=o[g+2];b+=(v*y.a+A*y.b+y.worldX)*C,x+=(v*y.c+A*y.d+y.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}},Re=Ji;B(Re,"nextID",0);var gt=class{id=gt.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new gt(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 gt._nextID++}},Wt=gt;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],xt=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},me=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}},Ye=class extends me{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 f=this.curves,d=this.getFrameCount()+e*18;i==0&&(f[t]=2+d);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,y=(a-n)*.3+m+w*.16666667,v=s+p,A=n+y;for(let C=d+18;d<C;d+=2)f[d]=v,f[d+1]=A,p+=b,y+=x,b+=g,x+=w,v+=p,A+=y}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)}},Te=class extends Ye{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)*P.signum(h)-h)*t;case 1:case 2:return n+(Math.abs(r)*P.signum(n)-n)*t}else{let o=0;switch(i){case 0:return o=Math.abs(h)*P.signum(r),o+(r-o)*t;case 1:case 2:return o=Math.abs(n)*P.signum(r),o+(r-o)*t}}return n+(r-h)*t}},pt=class extends Ye{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}},at=class extends Te{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 pt{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,f=me.search(o,i,3),d=this.curves[f/3];switch(d){case 0:let u=o[f];l=o[f+1],c=o[f+2];let m=(i-u)/(o[f+3]-u);l+=(o[f+3+1]-l)*m,c+=(o[f+3+2]-c)*m;break;case 1:l=o[f+1],c=o[f+2];break;default:l=this.getBezierValue(i,f,1,d-2),c=this.getBezierValue(i,f,2,d+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 Te{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 Te{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 pt{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,f=me.search(o,i,3),d=this.curves[f/3];switch(d){case 0:let u=o[f];l=o[f+1],c=o[f+2];let m=(i-u)/(o[f+3]-u);l+=(o[f+3+1]-l)*m,c+=(o[f+3+2]-c)*m;break;case 1:l=o[f+1],c=o[f+2];break;default:l=this.getBezierValue(i,f,1,d-2),c=this.getBezierValue(i,f,2,d+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)*P.signum(u)-u)*n,r.scaleY=m+(Math.abs(c)*P.signum(m)-m)*n;break;case 1:case 2:u=r.scaleX,m=r.scaleY,r.scaleX=u+(Math.abs(l)*P.signum(u)-u)*n,r.scaleY=m+(Math.abs(c)*P.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)*P.signum(l),m=Math.abs(r.data.scaleY)*P.signum(c),r.scaleX=u+(l-u)*n,r.scaleY=m+(c-m)*n;break;case 1:case 2:u=Math.abs(r.scaleX)*P.signum(l),m=Math.abs(r.scaleY)*P.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 Te{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 Te{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 pt{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,f=me.search(o,i,3),d=this.curves[f/3];switch(d){case 0:let u=o[f];l=o[f+1],c=o[f+2];let m=(i-u)/(o[f+3]-u);l+=(o[f+3+1]-l)*m,c+=(o[f+3+2]-c)*m;break;case 1:l=o[f+1],c=o[f+2];break;default:l=this.getBezierValue(i,f,1,d-2),c=this.getBezierValue(i,f,2,d+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 Te{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 Te{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 me{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;if(a==1){h==0&&(r.inherit=r.data.inherit);return}let o=this.frames;if(i<o[0]){(h==0||h==1)&&(r.inherit=r.data.inherit);return}r.inherit=this.frames[me.search(o,i,2)+1]}},ti=class extends Ye{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,f=0,d=0,u=0,m=me.search(o,i,5),g=this.curves[m/5];switch(g){case 0:let w=o[m];c=o[m+1],f=o[m+2],d=o[m+3],u=o[m+4];let b=(i-w)/(o[m+5]-w);c+=(o[m+5+1]-c)*b,f+=(o[m+5+2]-f)*b,d+=(o[m+5+3]-d)*b,u+=(o[m+5+4]-u)*b;break;case 1:c=o[m+1],f=o[m+2],d=o[m+3],u=o[m+4];break;default:c=this.getBezierValue(i,m,1,g-2),f=this.getBezierValue(i,m,2,g+18-2),d=this.getBezierValue(i,m,3,g+18*2-2),u=this.getBezierValue(i,m,4,g+18*3-2)}n==1?l.set(c,f,d,u):(h==0&&l.setFromColor(r.data.color),l.add((c-l.r)*n,(f-l.g)*n,(d-l.b)*n,(u-l.a)*n))}},ii=class extends Ye{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,f=0,d=0,u=me.search(o,i,4),m=this.curves[u>>2];switch(m){case 0:let g=o[u];c=o[u+1],f=o[u+2],d=o[u+3];let w=(i-g)/(o[u+4]-g);c+=(o[u+4+1]-c)*w,f+=(o[u+4+2]-f)*w,d+=(o[u+4+3]-d)*w;break;case 1:c=o[u+1],f=o[u+2],d=o[u+3];break;default:c=this.getBezierValue(i,u,1,m-2),f=this.getBezierValue(i,u,2,m+18-2),d=this.getBezierValue(i,u,3,m+18*2-2)}if(n==1)l.r=c,l.g=f,l.b=d;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+=(f-l.g)*n,l.b+=(d-l.b)*n}}},si=class extends Te{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 Ye{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 y=r.data.color,v=r.data.darkColor;switch(h){case 0:l.setFromColor(y),c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.add((y.r-l.r)*n,(y.g-l.g)*n,(y.b-l.b)*n,(y.a-l.a)*n),c.r+=(v.r-c.r)*n,c.g+=(v.g-c.g)*n,c.b+=(v.b-c.b)*n}return}let f=0,d=0,u=0,m=0,g=0,w=0,b=0,x=me.search(o,i,8),p=this.curves[x>>3];switch(p){case 0:let y=o[x];f=o[x+1],d=o[x+2],u=o[x+3],m=o[x+4],g=o[x+5],w=o[x+6],b=o[x+7];let v=(i-y)/(o[x+8]-y);f+=(o[x+8+1]-f)*v,d+=(o[x+8+2]-d)*v,u+=(o[x+8+3]-u)*v,m+=(o[x+8+4]-m)*v,g+=(o[x+8+5]-g)*v,w+=(o[x+8+6]-w)*v,b+=(o[x+8+7]-b)*v;break;case 1:f=o[x+1],d=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:f=this.getBezierValue(i,x,1,p-2),d=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(f,d,u,m),c.r=g,c.g=w,c.b=b;else{if(h==0){l.setFromColor(r.data.color);let y=r.data.darkColor;c.r=y.r,c.g=y.g,c.b=y.b}l.add((f-l.r)*n,(d-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 Ye{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 y=r.data.color,v=r.data.darkColor;switch(h){case 0:l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b;return;case 1:l.r+=(y.r-l.r)*n,l.g+=(y.g-l.g)*n,l.b+=(y.b-l.b)*n,c.r+=(v.r-c.r)*n,c.g+=(v.g-c.g)*n,c.b+=(v.b-c.b)*n}return}let f=0,d=0,u=0,m=0,g=0,w=0,b=0,x=me.search(o,i,7),p=this.curves[x/7];switch(p){case 0:let y=o[x];f=o[x+1],d=o[x+2],u=o[x+3],g=o[x+4],w=o[x+5],b=o[x+6];let v=(i-y)/(o[x+7]-y);f+=(o[x+7+1]-f)*v,d+=(o[x+7+2]-d)*v,u+=(o[x+7+3]-u)*v,g+=(o[x+7+4]-g)*v,w+=(o[x+7+5]-w)*v,b+=(o[x+7+6]-b)*v;break;case 1:f=o[x+1],d=o[x+2],u=o[x+3],g=o[x+4],w=o[x+5],b=o[x+6];break;default:f=this.getBezierValue(i,x,1,p-2),d=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=f,l.g=d,l.b=u,c.r=g,c.g=w,c.b=b;else{if(h==0){let y=r.data.color,v=r.data.darkColor;l.r=y.r,l.g=y.g,l.b=y.b,c.r=v.r,c.g=v.g,c.b=v.b}l.r+=(f-l.r)*n,l.g+=(d-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 me{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[me.search1(this.frames,i)])}}setAttachment(e,t,i){t.setAttachment(i?e.getAttachment(this.slotIndex,i):null)}},ai=class extends Ye{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 f=this.curves,d=this.getFrameCount()+e*18;i==0&&(f[t]=2+d);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,y=a*.3+m+w*.16666667,v=s+p,A=y;for(let C=d+18;d<C;d+=2)f[d]=v,f[d+1]=A,p+=b,y+=x,b+=g,x+=w,v+=p,A+=y}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 Re)||o.timelineAttachment!=this.attachment)return;let l=r.deform;l.length==0&&(h=0);let c=this.vertices,f=c[0].length,d=this.frames;if(i<d[0]){switch(h){case 0:l.length=0;return;case 1:if(n==1){l.length=0;return}l.length=f;let x=o;if(x.bones){n=1-n;for(var u=0;u<f;u++)l[u]*=n}else{let p=x.vertices;for(var u=0;u<f;u++)l[u]+=(p[u]-l[u])*n}}return}if(l.length=f,i>=d[d.length-1]){let x=c[d.length-1];if(n==1)if(h==3){let p=o;if(p.bones)for(let y=0;y<f;y++)l[y]+=x[y];else{let y=p.vertices;for(let v=0;v<f;v++)l[v]+=x[v]-y[v]}}else L.arrayCopy(x,0,l,0,f);else switch(h){case 0:{let y=o;if(y.bones)for(let v=0;v<f;v++)l[v]=x[v]*n;else{let v=y.vertices;for(let A=0;A<f;A++){let C=v[A];l[A]=C+(x[A]-C)*n}}break}case 1:case 2:for(let y=0;y<f;y++)l[y]+=(x[y]-l[y])*n;break;case 3:let p=o;if(p.bones)for(let y=0;y<f;y++)l[y]+=x[y]*n;else{let y=p.vertices;for(let v=0;v<f;v++)l[v]+=(x[v]-y[v])*n}}return}let m=me.search1(d,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<f;p++){let y=w[p];l[p]+=y+(b[p]-y)*g}else{let p=x.vertices;for(let y=0;y<f;y++){let v=w[y];l[y]+=v+(b[y]-v)*g-p[y]}}}else for(let x=0;x<f;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 y=0;y<f;y++){let v=w[y];l[y]=(v+(b[y]-v)*g)*n}else{let y=p.vertices;for(let v=0;v<f;v++){let A=w[v],C=y[v];l[v]=C+(A+(b[v]-A)*g-C)*n}}break}case 1:case 2:for(let p=0;p<f;p++){let y=w[p];l[p]+=(y+(b[p]-y)*g-l[p])*n}break;case 3:let x=o;if(x.bones)for(let p=0;p<f;p++){let y=w[p];l[p]+=(y+(b[p]-y)*g)*n}else{let p=x.vertices;for(let y=0;y<f;y++){let v=w[y];l[y]+=(v+(b[y]-v)*g-p[y])*n}}}}},is=class extends me{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=me.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])}},lt=is;B(lt,"propertyIds",[""+re.event]);var ss=class extends me{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=me.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 f=0,d=o.length;f<d;f++)l[f]=c[o[f]]}}},Ge=ss;B(Ge,"propertyIds",[""+re.drawOrder]);var li=class extends Ye{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,f=me.search(o,i,6),d=this.curves[f/6];switch(d){case 0:let u=o[f];l=o[f+1],c=o[f+2];let m=(i-u)/(o[f+6]-u);l+=(o[f+6+1]-l)*m,c+=(o[f+6+2]-c)*m;break;case 1:l=o[f+1],c=o[f+2];break;default:l=this.getBezierValue(i,f,1,d-2),c=this.getBezierValue(i,f,2,d+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[f+3],r.compress=o[f+4]!=0,r.stretch=o[f+5]!=0)):(r.mix+=(l-r.mix)*n,r.softness+=(c-r.softness)*n,a==0&&(r.bendDirection=o[f+3],r.compress=o[f+4]!=0,r.stretch=o[f+5]!=0))}},oi=class extends Ye{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,f,d,u,m,g=me.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],f=o[g+3],d=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,f+=(o[g+7+3]-f)*x,d+=(o[g+7+4]-d)*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],f=o[g+3],d=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),f=this.getBezierValue(i,g,3,w+18*2-2),d=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+(f-b.mixY)*n,r.mixScaleX=b.mixScaleX+(d-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+=(f-r.mixY)*n,r.mixScaleX+=(d-r.mixScaleX)*n,r.mixScaleY+=(u-r.mixScaleY)*n,r.mixShearY+=(m-r.mixShearY)*n}},hi=class extends Te{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 Te{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 Ye{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,f,d=me.search(o,i,4),u=this.curves[d>>2];switch(u){case 0:let m=o[d];l=o[d+1],c=o[d+2],f=o[d+3];let g=(i-m)/(o[d+4]-m);l+=(o[d+4+1]-l)*g,c+=(o[d+4+2]-c)*g,f+=(o[d+4+3]-f)*g;break;case 1:l=o[d+1],c=o[d+2],f=o[d+3];break;default:l=this.getBezierValue(i,d,1,u-2),c=this.getBezierValue(i,d,2,u+18-2),f=this.getBezierValue(i,d,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+(f-m.mixY)*n}else r.mixRotate+=(l-r.mixRotate)*n,r.mixX+=(c-r.mixX)*n,r.mixY+=(f-r.mixY)*n}},Ve=class extends Te{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 Ve{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 Ve{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 Ve{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 Ve{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 Ve{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 Ve{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 Ve{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 me{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[me.search1(o,t)+1]))if(r!=null)r.reset();else for(const l of e.physicsConstraints)l.active&&l.reset()}},bt=rs;B(bt,"propertyIds",[re.physicsConstraintReset.toString()]);var Oe=class extends me{slotIndex;attachment;constructor(e,t,i){super(e,[re.sequence+"|"+t+"|"+i.sequence.id]),this.slotIndex=t,this.attachment=i}getFrameEntries(){return Oe.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,t,i,s,n){let h=this.frames;e*=Oe.ENTRIES,h[e]=t,h[e+Oe.MODE]=i|s<<4,h[e+Oe.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 Re)||o.timelineAttachment!=l))return;if(a==1){h==0&&(r.sequenceIndex=-1);return}let c=this.frames;if(i<c[0]){(h==0||h==1)&&(r.sequenceIndex=-1);return}let f=me.search(c,i,Oe.ENTRIES),d=c[f],u=c[f+Oe.MODE],m=c[f+Oe.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-d)/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=Oe;B(Qe,"ENTRIES",3),B(Qe,"MODE",1),B(Qe,"DELAY",2);var wt=class{static emptyAnimation(){return wt._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 nt(()=>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.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),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 f=0,d=i.length;f<d;f++){let u=i[f];if(!u||u.delay>0)continue;s=!0;let m=f==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,y=t;u.reverse&&(p=u.animation.duration-p,y=null);let v=u.animation.timelines,A=v.length;if(f==0&&g==1||m==3){f==0&&(w=!0);for(let C=0;C<A;C++){L.webkit602BugfixHelper(g,m);var n=v[C];n instanceof qe?this.applyAttachmentTimeline(n,e,p,m,w):n.apply(e,b,p,y,g,m,0)}}else{let C=u.timelineMode,T=u.shortestRotation,E=!T&&u.timelinesRotation.length!=A<<1;E&&(u.timelinesRotation.length=A<<1);for(let R=0;R<A;R++){let k=v[R],X=C[R]==vt?m:0;!T&&k instanceof at?this.applyRotateTimeline(k,e,p,g,X,u.timelinesRotation,R<<1,E):k instanceof qe?this.applyAttachmentTimeline(k,e,p,m,w):(L.webkit602BugfixHelper(g,m),k.apply(e,b,p,y,g,X,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),f=s.animationLast,d=s.getAnimationTime(),u=d,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,f,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 y=r[p],v=1,A,C=0;switch(g[p]){case vt:if(!a&&y instanceof Ge)continue;A=i,C=c;break;case wi:A=0,C=c;break;case vi:A=i,C=l;break;case yt:A=0,C=l;break;default:A=0;let T=w[p];C=l*Math.max(0,1-T.mixTime/T.mixDuration);break}s.totalAlpha+=C,!b&&y instanceof at?this.applyRotateTimeline(y,t,u,C,A,s.timelinesRotation,p<<1,x):y instanceof qe?this.applyAttachmentTimeline(y,t,u,A,h&&C>=s.alphaAttachmentThreshold):(L.webkit602BugfixHelper(C,i),a&&y instanceof Ge&&A==0&&(v=0),y.apply(t,f,u,m,C,A,v))}}return e.mixDuration>0&&this.queueEvents(s,d),this.events.length=0,s.nextAnimationLast=d,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[me.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,f=0;if(i<l[0])switch(n){case 0:o.rotation=o.data.rotation;default:return;case 1:c=o.rotation,f=o.data.rotation}else c=n==0?o.data.rotation:o.rotation,f=o.data.rotation+e.getCurveValue(i);let d=0,u=f-c;if(u-=Math.ceil(u/360-.5)*360,u==0)d=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;d=u+w;let b=u>=0,x=m>=0;Math.abs(g)<=90&&P.signum(g)!=P.signum(u)&&(Math.abs(m-w)>180?(d+=360*P.signum(m),x=b):w!=0?d-=360*P.signum(m):x=b),x!=b&&(d+=360*P.signum(m)),h[a]=d}h[a+1]=u,o.rotation=c+d*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=Math.max(s+n.getTrackComplete()-h.mixDuration,0))):(this.setCurrent(e,h,!0),this.queue.drain(),s<0&&(s=0)),h.delay=s,h}setEmptyAnimation(e,t=0){let i=this.setAnimationWith(e,wt.emptyAnimation(),!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){let s=this.addAnimationWith(e,wt.emptyAnimation(),!1,i);return i<=0&&(s.delay=Math.max(s.delay+s.mixDuration-t,0)),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())?yt:vi;return}e:for(let r=0;r<s;r++){let o=i[r],l=o.getPropertyIds();if(!a.addAll(l))n[r]=vt;else if(!t||o instanceof qe||o instanceof Ge||o instanceof lt||!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]=yt}}}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=wt;B(ns,"_emptyAnimation",new xt("<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,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),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}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},ls=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(Ae.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(Ae.interrupt),this.objects.push(e)}end(e){this.objects.push(Ae.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(Ae.dispose),this.objects.push(e)}complete(e){this.objects.push(Ae.complete),this.objects.push(e)}event(e,t){this.objects.push(Ae.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 Ae.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 Ae.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 Ae.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 Ae.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 Ae.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 Ae.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}},Ae=(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))(Ae||{}),Js=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},vt=0,wi=1,vi=2,yt=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}},At=class extends Re{color=new V(1,1,1,1);constructor(e){super(e)}copy(){let e=new At(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},$e=class extends Re{endSlot=null;color=new V(.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}},Ct=(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))(Ct||{}),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(Ct,i[1]),l.magFilter=L.enumValue(Ct,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 f=n[i[0]];if(f)f(l);else{r||(r=[]),o||(o=[]),r.push(i[0]);let d=[];for(let u=0;u<c;u++)d.push(parseInt(i[u+1]));o.push(d)}}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 Re{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(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 f=0;f<i;f+=2)t[f]=s+e[f+1]*h,t[f+1]=n+(1-e[f])*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 f=0;f<i;f+=2)t[f]=s+(1-e[f])*h,t[f+1]=n+(1-e[f+1])*a;return;case 270:s-=r.offsetY/l,n-=r.offsetX/c,h=r.originalHeight/l,a=r.originalWidth/c;for(let f=0;f<i;f+=2)t[f]=s+(1-e[f+1])*h,t[f+1]=n+e[f]*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 Re{lengths=[];closed=!1;constantSpeed=!1;color=new V(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 Re{x=0;y=0;rotation=0;color=new V(.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*P.degRad,i=Math.cos(t),s=Math.sin(t),n=i*e.a+s*e.b,h=i*e.c+s*e.d;return P.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 V(1,1,1,1);path;region=null;sequence=null;offset=L.newFloatArray(8);uvs=L.newFloatArray(8);tempColor=new V(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*P.degRad,l=Math.cos(o),c=Math.sin(o),f=this.x,d=this.y,u=n*l+f,m=n*c,g=h*l+d,w=h*c,b=a*l+f,x=a*c,p=r*l+d,y=r*c,v=this.offset;v[0]=u-w,v[1]=g+m,v[2]=u-y,v[3]=p+m,v[4]=b-y,v[5]=p+x,v[6]=b-w,v[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,f=n.d,d=0,u=0;d=h[0],u=h[1],t[i]=d*o+u*l+a,t[i+1]=d*c+u*f+r,i+=s,d=h[2],u=h[3],t[i]=d*o+u*l+a,t[i+1]=d*c+u*f+r,i+=s,d=h[4],u=h[5],t[i]=d*o+u*l+a,t[i+1]=d*c+u*f+r,i+=s,d=h[6],u=h[7],t[i]=d*o+u*l+a,t[i+1]=d*c+u*f+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}},le=ms;B(le,"X1",0),B(le,"Y1",1),B(le,"C1R",2),B(le,"C1G",3),B(le,"C1B",4),B(le,"C1A",5),B(le,"U1",6),B(le,"V1",7),B(le,"X2",8),B(le,"Y2",9),B(le,"C2R",10),B(le,"C2G",11),B(le,"C2B",12),B(le,"C2A",13),B(le,"U2",14),B(le,"V2",15),B(le,"X3",16),B(le,"Y3",17),B(le,"C3R",18),B(le,"C3G",19),B(le,"C3B",20),B(le,"C3A",21),B(le,"U3",22),B(le,"V3",23),B(le,"X4",24),B(le,"Y4",25),B(le,"C4R",26),B(le,"C4G",27),B(le,"C4B",28),B(le,"C4A",29),B(le,"U4",30),B(le,"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 le(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 At(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=ot.Normal;skinRequired=!1;color=new V;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}},ot=(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))(ot||{}),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 d=this.skeleton;const u=d.scaleX,m=d.scaleY,g=(i+h)*P.degRad,w=(i+90+a)*P.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+d.x,this.worldY=t*m+d.y;return}let o=r.a,l=r.b,c=r.c,f=r.d;switch(this.worldX=o*e+l*t+r.worldX,this.worldY=c*e+f*t+r.worldY,this.inherit){case 0:{const d=(i+h)*P.degRad,u=(i+90+a)*P.degRad,m=Math.cos(d)*s,g=Math.cos(u)*n,w=Math.sin(d)*s,b=Math.sin(u)*n;this.a=o*m+l*w,this.b=o*g+l*b,this.c=c*m+f*w,this.d=c*g+f*b;return}case 1:{const d=(i+h)*P.degRad,u=(i+90+a)*P.degRad;this.a=Math.cos(d)*s,this.b=Math.cos(u)*n,this.c=Math.sin(d)*s,this.d=Math.sin(u)*n;break}case 2:{let d=1/this.skeleton.scaleX,u=1/this.skeleton.scaleY;o*=d,c*=u;let m=o*o+c*c,g=0;m>1e-4?(m=Math.abs(o*f*u-l*d*c)/m,l=c*m,f=o*m,g=Math.atan2(c,o)*P.radDeg):(o=0,c=0,g=90-Math.atan2(f,l)*P.radDeg);const w=(i+h-g)*P.degRad,b=(i+a-g+90)*P.degRad,x=Math.cos(w)*s,p=Math.cos(b)*n,y=Math.sin(w)*s,v=Math.sin(b)*n;this.a=o*x-l*y,this.b=o*p-l*v,this.c=c*x+f*y,this.d=c*p+f*v;break}case 3:case 4:{i*=P.degRad;const d=Math.cos(i),u=Math.sin(i);let m=(o*d+l*u)/this.skeleton.scaleX,g=(c*d+f*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*f-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*=P.degRad,a=(90+a)*P.degRad;const p=Math.cos(h)*s,y=Math.cos(a)*n,v=Math.sin(h)*s,A=Math.sin(a)*n;this.a=m*p+b*v,this.b=m*y+b*A,this.c=g*p+x*v,this.d=g*y+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)*P.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)*P.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,f=this.worldY-e.worldY;this.ax=c*a-f*r,this.ay=f*l-c*o;let d,u,m,g;if(this.inherit==1)d=this.a,u=this.b,m=this.c,g=this.d;else{switch(this.inherit){case 2:{let y=Math.abs(t*n-i*s)/(t*t+s*s);i=-s*this.skeleton.scaleX*y/this.skeleton.scaleY,n=t*this.skeleton.scaleY*y/this.skeleton.scaleX,h=1/(t*n-i*s),a=n*h,r=i*h;break}case 3:case 4:let w=P.cosDeg(this.rotation),b=P.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=P.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}d=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(d*d+m*m),this.ascaleX>1e-4){let w=d*g-u*m;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(d*u+m*g,w)*P.radDeg,this.arotation=Math.atan2(m,d)*P.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,u)*P.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*P.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*P.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=P.sinDeg(e),i=P.cosDeg(e);return Math.atan2(this.a*t-this.c*i,this.d*i-this.b*t)*P.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=P.sinDeg(e),i=P.cosDeg(e);return Math.atan2(i*this.c+t*this.d,i*this.a+t*this.b)*P.radDeg}rotateWorld(e){e*=P.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}},ht=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,(f,d)=>{l||(c.setTexture(d),--o==0&&this.success(t,e,r))},(f,d)=>{l||this.error(i,e,`Couldn't load texture atlas ${e} page image: ${f}`),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
|
-
`+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,f=r.d,d=-e.ashearX-e.arotation,u=0,m=0;switch(e.inherit){case 1:u=(t-e.worldX)*P.signum(e.skeleton.scaleX),m=(i-e.worldY)*P.signum(e.skeleton.scaleY);break;case 2:let b=Math.abs(o*f-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,f=x*b*e.skeleton.scaleY,d+=Math.atan2(p,x)*P.radDeg;default:let y=t-r.worldX,v=i-r.worldY,A=o*f-l*c;Math.abs(A)<=1e-4?(u=0,m=0):(u=(y*f-v*l)/A-e.ax,m=(v*o-y*c)/A-e.ay)}d+=Math.atan2(m,u)*P.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=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+d*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,f=e.ascaleX,d=e.ascaleY,u=f,m=d,g=t.ascaleX,w=0,b=0,x=0;f<0?(f=-f,w=180,x=-1):(w=0,x=1),d<0&&(d=-d,x=-x),g<0?(g=-g,b=180):b=0;let p=t.ax,y=0,v=0,A=0,C=e.a,T=e.b,E=e.c,R=e.d,k=Math.abs(f-d)<=1e-4;!k||h?(y=0,v=C*p+e.worldX,A=E*p+e.worldY):(y=t.ay,v=C*p+T*y+e.worldX,A=E*p+R*y+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");C=X.a,T=X.b,E=X.c,R=X.d;let I=C*R-T*E,Y=v-X.worldX,F=A-X.worldY;I=Math.abs(I)<=1e-4?0:1/I;let ie=(Y*R-F*T)*I-l,se=(F*C-Y*E)*I-c,te=Math.sqrt(ie*ie+se*se),ce=t.data.length*g,de,fe;if(te<1e-4){this.apply1(e,i,s,!1,h,!1,o),t.updateWorldTransformWith(p,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}Y=i-X.worldX,F=s-X.worldY;let K=(Y*R-F*T)*I-l,ne=(F*C-Y*E)*I-c,ae=K*K+ne*ne;if(r!=0){r*=f*(g+1)*.5;let ge=Math.sqrt(ae),we=ge-te-ce*f+r;if(we>0){let ve=Math.min(1,we/(r*2))-1;ve=(we-r*(1-ve*ve))/ge,K-=ve*K,ne-=ve*ne,ae=K*K+ne*ne}}e:if(k){ce*=f;let ge=(ae-te*te-ce*ce)/(2*te*ce);ge<-1?(ge=-1,fe=Math.PI*n):ge>1?(ge=1,fe=0,h&&(C=(Math.sqrt(ae)/(te+ce)-1)*o+1,u*=C,a&&(m*=C))):fe=Math.acos(ge)*n,C=te+ce*ge,T=ce*Math.sin(fe),de=Math.atan2(ne*C-K*T,K*C+ne*T)}else{C=f*ce,T=d*ce;let ge=C*C,we=T*T,ve=Math.atan2(ne,K);E=we*te*te+ge*ae-ge*we;let _e=-2*we*te,ft=we-ge;if(R=_e*_e-4*ft*E,R>=0){let rt=Math.sqrt(R);_e<0&&(rt=-rt),rt=-(_e+rt)*.5;let ut=rt/ft,Ds=E/rt,Nt=Math.abs(ut)<Math.abs(Ds)?ut:Ds;if(ut=ae-Nt*Nt,ut>=0){F=Math.sqrt(ut)*n,de=ve-Math.atan2(F,Nt),fe=Math.atan2(F/d,(Nt-te)/f);break e}}let Ls=P.PI,Ot=te-C,Gi=Ot*Ot,Bs=0,Vs=0,Dt=te+C,Hi=Dt*Dt,Os=0;E=-C*te/(ge-we),E>=-1&&E<=1&&(E=Math.acos(E),Y=C*Math.cos(E)+te,F=T*Math.sin(E),R=Y*Y+F*F,R<Gi&&(Ls=E,Gi=R,Ot=Y,Bs=F),R>Hi&&(Vs=E,Hi=R,Dt=Y,Os=F)),ae<=(Gi+Hi)*.5?(de=ve-Math.atan2(Bs*n,Ot),fe=Ls*n):(de=ve-Math.atan2(Os*n,Dt),fe=Vs*n)}let Me=Math.atan2(y,p)*x,Se=e.arotation;de=(de-Me)*P.radDeg+w-Se,de>180?de-=360:de<-180&&(de+=360),e.updateWorldTransformWith(l,c,Se+de*o,u,m,0,0),Se=t.arotation,fe=((fe+Me)*P.radDeg-t.ashearX)*x+b-Se,fe>180?fe-=360:fe<-180&&(fe+=360),t.updateWorldTransformWith(p,y,Se+fe*o,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Yi=class extends ht{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 ht{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=St.Fixed;spacingMode=Tt.Fixed;rotateMode=It.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},St=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(St||{}),Tt=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Tt||{}),It=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(It||{}),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,f=L.setArraySize(this.spaces,c),d=r?this.lengths=L.setArraySize(this.lengths,l):[],u=this.spacing;switch(h.spacingMode){case 2:if(r)for(let v=0,A=c-1;v<A;v++){let C=o[v],T=C.data.length,E=T*C.a,R=T*C.c;d[v]=Math.sqrt(E*E+R*R)}L.arrayFill(f,1,c,u);break;case 3:let p=0;for(let v=0,A=c-1;v<A;){let C=o[v],T=C.data.length;if(T<Ne.epsilon)r&&(d[v]=0),f[++v]=u;else{let E=T*C.a,R=T*C.c,k=Math.sqrt(E*E+R*R);r&&(d[v]=k),f[++v]=k,p+=k}}if(p>0){p=c/p*u;for(let v=1;v<c;v++)f[v]*=p}break;default:let y=h.spacingMode==0;for(let v=0,A=c-1;v<A;){let C=o[v],T=C.data.length;if(T<Ne.epsilon)r&&(d[v]=0),f[++v]=u;else{let E=T*C.a,R=T*C.c,k=Math.sqrt(E*E+R*R);r&&(d[v]=k),f[++v]=(y?T+u:u)*k/T}}}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?P.degRad:-P.degRad}for(let p=0,y=3;p<l;p++,y+=3){let v=o[p];v.worldX+=(g-v.worldX)*s,v.worldY+=(w-v.worldY)*n;let A=m[y],C=m[y+1],T=A-g,E=C-w;if(r){let R=d[p];if(R!=0){let k=(Math.sqrt(T*T+E*E)/R-1)*i+1;v.a*=k,v.c*=k}}if(g=A,w=C,i>0){let R=v.a,k=v.b,X=v.c,I=v.d,Y=0,F=0,ie=0;if(a?Y=m[y-1]:f[p+1]==0?Y=m[y+2]:Y=Math.atan2(E,T),Y-=Math.atan2(X,R),x){F=Math.cos(Y),ie=Math.sin(Y);let se=v.data.length;g+=(se*(F*R-ie*X)-T)*i,w+=(se*(ie*R+F*X)-E)*i}else Y+=b;Y>P.PI?Y-=P.PI2:Y<-P.PI&&(Y+=P.PI2),Y*=i,F=Math.cos(Y),ie=Math.sin(Y),v.a=F*R-ie*X,v.b=F*k-ie*I,v.c=ie*R+F*X,v.d=ie*k+F*I}v.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,f=Ne.NONE;if(!e.constantSpeed){let se=e.lengths;c-=o?1:2;let te=se[c];this.data.positionMode==1&&(n*=te);let ce;switch(this.data.spacingMode){case 2:ce=te;break;case 3:ce=te/t;break;default:ce=1}r=L.setArraySize(this.world,8);for(let de=0,fe=0,K=0;de<t;de++,fe+=3){let ne=h[de]*ce;n+=ne;let ae=n;if(o)ae%=te,ae<0&&(ae+=te),K=0;else if(ae<0){f!=Ne.BEFORE&&(f=Ne.BEFORE,e.computeWorldVertices(s,2,4,r,0,2)),this.addBeforePosition(ae,r,0,a,fe);continue}else if(ae>te){f!=Ne.AFTER&&(f=Ne.AFTER,e.computeWorldVertices(s,l-6,4,r,0,2)),this.addAfterPosition(ae-te,r,0,a,fe);continue}for(;;K++){let Me=se[K];if(!(ae>Me)){if(K==0)ae/=Me;else{let Se=se[K-1];ae=(ae-Se)/(Me-Se)}break}}K!=f&&(f=K,o&&K==c?(e.computeWorldVertices(s,l-4,4,r,0,2),e.computeWorldVertices(s,0,4,r,4,2)):e.computeWorldVertices(s,K*6+2,8,r,0,2)),this.addCurvePosition(ae,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],a,fe,i||de>0&&ne==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 d=L.setArraySize(this.curves,c),u=0,m=r[0],g=r[1],w=0,b=0,x=0,p=0,y=0,v=0,A=0,C=0,T=0,E=0,R=0,k=0,X=0,I=0;for(let se=0,te=2;se<c;se++,te+=6)w=r[te],b=r[te+1],x=r[te+2],p=r[te+3],y=r[te+4],v=r[te+5],A=(m-w*2+x)*.1875,C=(g-b*2+p)*.1875,T=((w-x)*3-m+y)*.09375,E=((b-p)*3-g+v)*.09375,R=A*2+T,k=C*2+E,X=(w-m)*.75+A+T*.16666667,I=(b-g)*.75+C+E*.16666667,u+=Math.sqrt(X*X+I*I),X+=R,I+=k,R+=T,k+=E,u+=Math.sqrt(X*X+I*I),X+=R,I+=k,u+=Math.sqrt(X*X+I*I),X+=R+T,I+=k+E,u+=Math.sqrt(X*X+I*I),d[se]=u,m=y,g=v;this.data.positionMode==1&&(n*=u);let Y;switch(this.data.spacingMode){case 2:Y=u;break;case 3:Y=u/t;break;default:Y=1}let F=this.segments,ie=0;for(let se=0,te=0,ce=0,de=0;se<t;se++,te+=3){let fe=h[se]*Y;n+=fe;let K=n;if(o)K%=u,K<0&&(K+=u),ce=0;else if(K<0){this.addBeforePosition(K,r,0,a,te);continue}else if(K>u){this.addAfterPosition(K-u,r,l-4,a,te);continue}for(;;ce++){let ne=d[ce];if(!(K>ne)){if(ce==0)K/=ne;else{let ae=d[ce-1];K=(K-ae)/(ne-ae)}break}}if(ce!=f){f=ce;let ne=ce*6;for(m=r[ne],g=r[ne+1],w=r[ne+2],b=r[ne+3],x=r[ne+4],p=r[ne+5],y=r[ne+6],v=r[ne+7],A=(m-w*2+x)*.03,C=(g-b*2+p)*.03,T=((w-x)*3-m+y)*.006,E=((b-p)*3-g+v)*.006,R=A*2+T,k=C*2+E,X=(w-m)*.3+A+T*.16666667,I=(b-g)*.3+C+E*.16666667,ie=Math.sqrt(X*X+I*I),F[0]=ie,ne=1;ne<8;ne++)X+=R,I+=k,R+=T,k+=E,ie+=Math.sqrt(X*X+I*I),F[ne]=ie;X+=R,I+=k,ie+=Math.sqrt(X*X+I*I),F[8]=ie,X+=R+T,I+=k+E,ie+=Math.sqrt(X*X+I*I),F[9]=ie,de=0}for(K*=ie;;de++){let ne=F[de];if(!(K>ne)){if(de==0)K/=ne;else{let ae=F[de-1];K=de+(K-ae)/(ne-ae)}break}}this.addCurvePosition(K*.1,m,g,w,b,x,p,y,v,a,te,i||se>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,f){if(e==0||isNaN(e)){l[c]=t,l[c+1]=i,l[c+2]=Math.atan2(n-i,s-t);return}let d=e*e,u=d*e,m=1-e,g=m*m,w=g*m,b=m*e,x=b*3,p=m*x,y=x*e,v=t*w+s*p+h*y+r*u,A=i*w+n*p+a*y+o*u;l[c]=v,l[c+1]=A,f&&(e<.001?l[c+2]=Math.atan2(n-i,s-t):l[c+2]=Math.atan2(A-(i*g+n*b*2+a*d),v-(t*g+s*b*2+h*d)))}},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=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=o.time;const c=a.worldX,f=a.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=f;else{let d=this.remaining,u=this.inertia,m=this.data.step,g=this.skeleton.data.referenceScale,w=-1,b=this.data.limit*l,x=b*Math.abs(o.scaleY);if(b*=Math.abs(o.scaleX),i||s){if(i){const p=(this.ux-c)*u;this.xOffset+=p>b?b:p<-b?-b:p,this.ux=c}if(s){const p=(this.uy-f)*u;this.yOffset+=p>x?x:p<-x?-x:p,this.uy=f}if(d>=m){w=Math.pow(this.damping,60*m);const p=this.massInverse*m,y=this.strength,v=this.wind*g*o.scaleX,A=this.gravity*g*o.scaleY;do i&&(this.xVelocity+=(v-this.xOffset*y)*p,this.xOffset+=this.xVelocity*m,this.xVelocity*=w),s&&(this.yVelocity-=(A+this.yOffset*y)*p,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 p=Math.atan2(a.c,a.a),y=0,v=0,A=0,C=this.cx-a.worldX,T=this.cy-a.worldY;if(C>b?C=b:C<-b&&(C=-b),T>x?T=x:T<-x&&(T=-x),n){A=(this.data.rotate+this.data.shearX)*t;let E=Math.atan2(T+this.ty,C+this.tx)-p-this.rotateOffset*A;this.rotateOffset+=(E-Math.ceil(E*P.invPI2-.5)*P.PI2)*u,E=this.rotateOffset*A+p,y=Math.cos(E),v=Math.sin(E),h&&(E=r*a.getWorldScaleX(),E>0&&(this.scaleOffset+=(C*y+T*v)*u/E))}else{y=Math.cos(p),v=Math.sin(p);const E=r*a.getWorldScaleX();E>0&&(this.scaleOffset+=(C*y+T*v)*u/E)}if(d=this.remaining,d>=m){w==-1&&(w=Math.pow(this.damping,60*m));const E=this.massInverse*m,R=this.strength,k=this.wind,X=Mt.yDown?-this.gravity:this.gravity,I=r/g;for(;;)if(d-=m,h&&(this.scaleVelocity+=(k*y-X*v-this.scaleOffset*R)*E,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=w),n){if(this.rotateVelocity-=((k*v+X*y)*I+this.rotateOffset*R)*E,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=w,d<m)break;const Y=this.rotateOffset*A+p;y=Math.cos(Y),v=Math.sin(Y)}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,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=o*this.data.rotate,l=Math.sin(d),c=Math.cos(d),f=a.b,a.b=c*f-l*a.d,a.d=l*f+c*a.d),d+=o*this.data.shearX,l=Math.sin(d),c=Math.cos(d),f=a.a,a.a=c*f-l*a.c,a.c=l*f+c*a.c}else o*=this.data.rotate,l=Math.sin(o),c=Math.cos(o),f=a.a,a.a=c*f-l*a.c,a.c=l*f+c*a.c,f=a.b,a.b=c*f-l*a.d,a.d=l*f+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*P.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 V,this.darkColor=e.darkColor?new V:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof Re)||!(this.attachment instanceof Re)||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,f=r.d,d=o*f-l*c>0?P.degRad:-P.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,g=this.bones;for(let w=0,b=g.length;w<b;w++){let x=g[w];if(e!=0){let p=x.a,y=x.b,v=x.c,A=x.d,C=Math.atan2(c,o)-Math.atan2(v,p)+u;C>P.PI?C-=P.PI2:C<-P.PI&&(C+=P.PI2),C*=e;let T=Math.cos(C),E=Math.sin(C);x.a=T*p-E*v,x.b=T*y-E*A,x.c=E*p+T*v,x.d=E*y+T*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+f*f)-p+this.data.offsetScaleY)*n)/p),x.b*=p,x.d*=p}if(h>0){let p=x.b,y=x.d,v=Math.atan2(y,p),A=Math.atan2(f,l)-Math.atan2(c,o)-(v-Math.atan2(x.c,x.a));A>P.PI?A-=P.PI2:A<-P.PI&&(A+=P.PI2),A=v+(A+m)*h;let C=Math.sqrt(p*p+y*y);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,f=r.d,d=o*f-l*c>0?P.degRad:-P.degRad,u=this.data.offsetRotation*d,m=this.data.offsetShearY*d,g=this.bones;for(let w=0,b=g.length;w<b;w++){let x=g[w];if(e!=0){let p=x.a,y=x.b,v=x.c,A=x.d,C=Math.atan2(c,o)+u;C>P.PI?C-=P.PI2:C<-P.PI&&(C+=P.PI2),C*=e;let T=Math.cos(C),E=Math.sin(C);x.a=T*p-E*v,x.b=T*y-E*A,x.c=E*p+T*v,x.d=E*y+T*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+f*f)-1+this.data.offsetScaleY)*n+1;x.b*=p,x.d*=p}if(h>0){let p=Math.atan2(f,l)-Math.atan2(c,o);p>P.PI?p-=P.PI2:p<-P.PI&&(p+=P.PI2);let y=x.b,v=x.d;p=Math.atan2(v,y)+(p-P.PI/2+m)*h;let A=Math.sqrt(y*y+v*v);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],f=c.arotation;e!=0&&(f+=(a.arotation-f+this.data.offsetRotation)*e);let d=c.ax,u=c.ay;d+=(a.ax-d+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(d,u,f,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],f=c.arotation+(a.arotation+this.data.offsetRotation)*e,d=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(d,u,f,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 V(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let f=0,d=t.length;f<d;f++){let u=t[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let d=0,u=this.skin.bones.length;d<u;d++){let m=this.bones[f[d].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 f=0;f<c;f++){for(let d=0;d<a;d++){let u=i[d];if(u.data.order==f){this.sortIkConstraint(u);continue e}}for(let d=0;d<r;d++){let u=s[d];if(u.data.order==f){this.sortTransformConstraint(u);continue e}}for(let d=0;d<o;d++){let u=n[d];if(u.data.order==f){this.sortPathConstraint(u);continue e}}for(let d=0;d<l;d++){const u=h[d];if(u.data.order==f){this.sortPhysicsConstraint(u);continue e}}}for(let f=0,d=t.length;f<d;f++)this.sortBone(t[f])}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==null)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){if(!t)throw new Error("parent cannot be null.");let i=this.bones;for(let g=1,w=i.length;g<w;g++){let b=i[g];b.ax=b.x,b.ay=b.y,b.arotation=b.rotation,b.ascaleX=b.scaleX,b.ascaleY=b.scaleY,b.ashearX=b.shearX,b.ashearY=b.shearY}let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let n=t.a,h=t.b,a=t.c,r=t.d;s.worldX=n*this.x+h*this.y+t.worldX,s.worldY=a*this.x+r*this.y+t.worldY;const o=(s.rotation+s.shearX)*P.degRad,l=(s.rotation+90+s.shearY)*P.degRad,c=Math.cos(o)*s.scaleX,f=Math.cos(l)*s.scaleY,d=Math.sin(o)*s.scaleX,u=Math.sin(l)*s.scaleY;s.a=(n*c+h*d)*this.scaleX,s.b=(n*f+h*u)*this.scaleX,s.c=(a*c+r*d)*this.scaleY,s.d=(a*f+r*u)*this.scaleY;let m=this._updateCache;for(let g=0,w=m.length;g<w;g++){let b=m[g];b!=s&&b.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(e){let t=new We,i=new We;return this.getBounds(t,i,void 0,e),{x:t.x,y:t.y,width:i.x,height:i.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 f=n[l];if(!f.bone.active)continue;let d=0,u=null,m=null,g=f.getAttachment();if(g instanceof le)d=8,u=L.setArraySize(i,d,0),g.computeWorldVertices(f,u,0,2),m=Fi.quadTriangles;else if(g instanceof De){let w=g;d=w.worldVerticesLength,u=L.setArraySize(i,d,0),w.computeWorldVertices(f,0,d,u,0,2),m=w.triangles}else if(g instanceof $e&&s!=null){s.clipStart(f,g);continue}if(u&&m){s!=null&&s.isClipping()&&(s.clipTriangles(u,m,m.length),u=s.clippedVertices,d=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(f)}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)}},Mt=Fi;B(Mt,"quadTriangles",[0,1,2,2,3,0]),B(Mt,"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 ht{_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}},Et=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new V(.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 V(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Rt.Normal;visible=!0;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}},Rt=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Rt||{}),Bi=class extends ht{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 f=l==0?null:i.bones[s.readInt(!0)],d=new Ti(l,c,f);d.rotation=s.readFloat(),d.x=s.readFloat()*t,d.y=s.readFloat()*t,d.scaleX=s.readFloat(),d.scaleY=s.readFloat(),d.shearX=s.readFloat(),d.shearY=s.readFloat(),d.length=s.readFloat()*t,d.inherit=s.readByte(),d.skinRequired=s.readBoolean(),a&&(V.rgba8888ToColor(d.color,s.readInt32()),d.icon=s.readString()??void 0,d.visible=s.readBoolean()),i.bones.push(d)}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 f=i.bones[s.readInt(!0)],d=new Li(l,c,f);V.rgba8888ToColor(d.color,s.readInt32());let u=s.readInt32();u!=-1&&V.rgb888ToColor(d.darkColor=new V,u),d.attachmentName=s.readStringRef(),d.blendMode=s.readInt(!0),a&&(d.visible=s.readBoolean()),i.slots.push(d)}r=s.readInt(!0);for(let l=0,c;l<r;l++){let f=s.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new Yi(f);d.order=s.readInt(!0),c=s.readInt(!0);for(let m=0;m<c;m++)d.bones.push(i.bones[s.readInt(!0)]);d.target=i.bones[s.readInt(!0)];let u=s.readByte();d.skinRequired=(u&1)!=0,d.bendDirection=u&2?1:-1,d.compress=(u&4)!=0,d.stretch=(u&8)!=0,d.uniform=(u&16)!=0,u&32&&(d.mix=u&64?s.readFloat():1),u&128&&(d.softness=s.readFloat()*t),i.ikConstraints.push(d)}r=s.readInt(!0);for(let l=0,c;l<r;l++){let f=s.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new Bi(f);d.order=s.readInt(!0),c=s.readInt(!0);for(let m=0;m<c;m++)d.bones.push(i.bones[s.readInt(!0)]);d.target=i.bones[s.readInt(!0)];let u=s.readByte();d.skinRequired=(u&1)!=0,d.local=(u&2)!=0,d.relative=(u&4)!=0,u&8&&(d.offsetRotation=s.readFloat()),u&16&&(d.offsetX=s.readFloat()*t),u&32&&(d.offsetY=s.readFloat()*t),u&64&&(d.offsetScaleX=s.readFloat()),u&128&&(d.offsetScaleY=s.readFloat()),u=s.readByte(),u&1&&(d.offsetShearY=s.readFloat()),u&2&&(d.mixRotate=s.readFloat()),u&4&&(d.mixX=s.readFloat()),u&8&&(d.mixY=s.readFloat()),u&16&&(d.mixScaleX=s.readFloat()),u&32&&(d.mixScaleY=s.readFloat()),u&64&&(d.mixShearY=s.readFloat()),i.transformConstraints.push(d)}r=s.readInt(!0);for(let l=0,c;l<r;l++){let f=s.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new ki(f);d.order=s.readInt(!0),d.skinRequired=s.readBoolean(),c=s.readInt(!0);for(let m=0;m<c;m++)d.bones.push(i.bones[s.readInt(!0)]);d.target=i.slots[s.readInt(!0)];const u=s.readByte();d.positionMode=u&1,d.spacingMode=u>>1&3,d.rotateMode=u>>3&3,u&128&&(d.offsetRotation=s.readFloat()),d.position=s.readFloat(),d.positionMode==0&&(d.position*=t),d.spacing=s.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=t),d.mixRotate=s.readFloat(),d.mixX=s.readFloat(),d.mixY=s.readFloat(),i.pathConstraints.push(d)}r=s.readInt(!0);for(let l=0,c;l<r;l++){const f=s.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new vs(f);d.order=s.readInt(!0),d.bone=i.bones[s.readInt(!0)];let u=s.readByte();d.skinRequired=(u&1)!=0,u&2&&(d.x=s.readFloat()),u&4&&(d.y=s.readFloat()),u&8&&(d.rotate=s.readFloat()),u&16&&(d.scaleX=s.readFloat()),u&32&&(d.shearX=s.readFloat()),d.limit=(u&64?s.readFloat():5e3)*t,d.step=1/s.readUnsignedByte(),d.inertia=s.readFloat(),d.strength=s.readFloat(),d.damping=s.readFloat(),d.massInverse=u&128?s.readFloat():1,d.wind=s.readFloat(),d.gravity=s.readFloat(),u=s.readByte(),u&1&&(d.inertiaGlobal=!0),u&2&&(d.strengthGlobal=!0),u&4&&(d.dampingGlobal=!0),u&8&&(d.massGlobal=!0),u&16&&(d.windGlobal=!0),u&32&&(d.gravityGlobal=!0),u&64&&(d.mixGlobal=!0),d.mix=u&128?s.readFloat():1,i.physicsConstraints.push(d)}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 f=i.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=f.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),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 f=new Ri(c);f.intValue=s.readInt(!1),f.floatValue=s.readFloat(),f.stringValue=s.readString(),f.audioPath=s.readString(),f.audioPath&&(f.volume=s.readFloat(),f.balance=s.readFloat()),i.events.push(f)}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 Et("default")}else{let a=e.readString();if(!a)throw new Error("Skin name must not be null.");n=new Et(a),s&&V.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 f=this.readAttachment(e,t,n,r,c,s);f&&n.setAttachment(r,c,f)}}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,f=r&64?this.readSequence(e):null;let d=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,f);return p?(p.path=l,p.x=u*a,p.y=m*a,p.scaleX=g,p.scaleY=w,p.rotation=d,p.width=b*a,p.height=x*a,V.rgba8888ToColor(p.color,c),p.sequence=f,f==null&&p.updateRegion(),p):null}case Ue.BoundingBox:{let l=this.readVertices(e,(r&16)!=0),c=h?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(i,o);return f?(f.worldVerticesLength=l.length,f.vertices=l.vertices,f.bones=l.bones,h&&V.rgba8888ToColor(f.color,c),f):null}case Ue.Mesh:{let l=r&16?e.readStringRef():o;const c=r&32?e.readInt32():4294967295,f=r&64?this.readSequence(e):null,d=e.readInt(!0),u=this.readVertices(e,(r&128)!=0),m=this.readFloatArray(e,u.length,1),g=this.readShortArray(e,(u.length-d-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,f);return p?(p.path=l,V.rgba8888ToColor(p.color,c),p.bones=u.bones,p.vertices=u.vertices,p.worldVerticesLength=u.length,p.triangles=g,p.regionUVs=m,f==null&&p.updateRegion(),p.hullLength=d<<1,p.sequence=f,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,f=r&64?this.readSequence(e):null,d=(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,f);return b?(b.path=l,V.rgba8888ToColor(b.color,c),b.sequence=f,h&&(b.width=g*a,b.height=w*a),this.linkedMeshes.push(new rr(b,u,s,m,d)),b):null}case Ue.Path:{const l=(r&16)!=0,c=(r&32)!=0,f=this.readVertices(e,(r&64)!=0),d=L.newArray(f.length/6,0);for(let g=0,w=d.length;g<w;g++)d[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=f.length,m.vertices=f.vertices,m.bones=f.bones,m.lengths=d,h&&V.rgba8888ToColor(m.color,u),m):null}case Ue.Point:{const l=e.readFloat(),c=e.readFloat(),f=e.readFloat(),d=h?e.readInt32():0,u=this.attachmentLoader.newPointAttachment(i,o);return u?(u.x=c*a,u.y=f*a,u.rotation=l,h&&V.rgba8888ToColor(u.color,d),u):null}case Ue.Clipping:{const l=e.readInt(!0),c=this.readVertices(e,(r&16)!=0);let f=h?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(i,o);return d?(d.endSlot=t.slots[l],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&V.rgba8888ToColor(d.color,f),d):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 f=0,d=e.readInt(!0);f<d;f++){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,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let C=0,T=0;b.setFrame(C,x,p,y,v,A),C!=g;C++){let E=e.readFloat(),R=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;switch(e.readByte()){case Xe:b.setStepped(C);break;case Pe:oe(e,b,T++,C,0,x,E,p,R,1),oe(e,b,T++,C,1,x,E,y,k,1),oe(e,b,T++,C,2,x,E,v,X,1),oe(e,b,T++,C,3,x,E,A,I,1)}x=E,p=R,y=k,v=X,A=I}s.push(b);break}case wr:{let w=e.readInt(!0),b=new ii(m,w,c),x=e.readFloat(),p=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let A=0,C=0;b.setFrame(A,x,p,y,v),A!=g;A++){let T=e.readFloat(),E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;switch(e.readByte()){case Xe:b.setStepped(A);break;case Pe:oe(e,b,C++,A,0,x,T,p,E,1),oe(e,b,C++,A,1,x,T,y,R,1),oe(e,b,C++,A,2,x,T,v,k,1)}x=T,p=E,y=R,v=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,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;for(let R=0,k=0;b.setFrame(R,x,p,y,v,A,C,T,E),R!=g;R++){let X=e.readFloat(),I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,ie=e.readUnsignedByte()/255,se=e.readUnsignedByte()/255,te=e.readUnsignedByte()/255,ce=e.readUnsignedByte()/255;switch(e.readByte()){case Xe:b.setStepped(R);break;case Pe:oe(e,b,k++,R,0,x,X,p,I,1),oe(e,b,k++,R,1,x,X,y,Y,1),oe(e,b,k++,R,2,x,X,v,F,1),oe(e,b,k++,R,3,x,X,A,ie,1),oe(e,b,k++,R,4,x,X,C,se,1),oe(e,b,k++,R,5,x,X,T,te,1),oe(e,b,k++,R,6,x,X,E,ce,1)}x=X,p=I,y=Y,v=F,A=ie,C=se,T=te,E=ce}s.push(b);break}case yr:{let w=e.readInt(!0),b=new ni(m,w,c),x=e.readFloat(),p=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let E=0,R=0;b.setFrame(E,x,p,y,v,A,C,T),E!=g;E++){let k=e.readFloat(),X=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,ie=e.readUnsignedByte()/255,se=e.readUnsignedByte()/255;switch(e.readByte()){case Xe:b.setStepped(E);break;case Pe:oe(e,b,R++,E,0,x,k,p,X,1),oe(e,b,R++,E,1,x,k,y,I,1),oe(e,b,R++,E,2,x,k,v,Y,1),oe(e,b,R++,E,3,x,k,A,F,1),oe(e,b,R++,E,4,x,k,C,ie,1),oe(e,b,R++,E,5,x,k,T,se,1)}x=k,p=X,y=I,v=Y,A=F,C=ie,T=se}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,y=0;w.setFrame(p,b,x),p!=g;p++){let v=e.readFloat(),A=e.readUnsignedByte()/255;switch(e.readByte()){case Xe:w.setStepped(p);break;case Pe:oe(e,w,y++,p,0,b,v,x,A,1)}b=v,x=A}s.push(w)}}}}for(let o=0,l=e.readInt(!0);o<l;o++){let c=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){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 at(m,g,c),1));break;case lr:s.push(Vi(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(Vi(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(Vi(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),f=e.readInt(!0),d=f-1,u=new li(f,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!=d;x++){m=e.readByte();const y=e.readFloat(),v=m&1?m&2?e.readFloat():1:0,A=m&4?e.readFloat()*n:0;m&64?u.setStepped(x):m&128&&(oe(e,u,p++,x,0,g,y,w,v,1),oe(e,u,p++,x,1,g,y,b,A,n)),g=y,w=v,b=A}s.push(u)}for(let o=0,l=e.readInt(!0);o<l;o++){let c=e.readInt(!0),f=e.readInt(!0),d=f-1,u=new oi(f,e.readInt(!0),c),m=e.readFloat(),g=e.readFloat(),w=e.readFloat(),b=e.readFloat(),x=e.readFloat(),p=e.readFloat(),y=e.readFloat();for(let v=0,A=0;u.setFrame(v,m,g,w,b,x,p,y),v!=d;v++){let C=e.readFloat(),T=e.readFloat(),E=e.readFloat(),R=e.readFloat(),k=e.readFloat(),X=e.readFloat(),I=e.readFloat();switch(e.readByte()){case Xe:u.setStepped(v);break;case Pe:oe(e,u,A++,v,0,m,C,g,T,1),oe(e,u,A++,v,1,m,C,w,E,1),oe(e,u,A++,v,2,m,C,b,R,1),oe(e,u,A++,v,3,m,C,x,k,1),oe(e,u,A++,v,4,m,C,p,X,1),oe(e,u,A++,v,5,m,C,y,I,1)}m=C,g=T,w=E,b=R,x=k,p=X,y=I}s.push(u)}for(let o=0,l=e.readInt(!0);o<l;o++){let c=e.readInt(!0),f=i.pathConstraints[c];for(let d=0,u=e.readInt(!0);d<u;d++){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),f.positionMode==0?n:1));break;case Ir:s.push(pe(e,new ci(g,w,c),f.spacingMode==0||f.spacingMode==1?n:1));break;case Mr:let b=new di(g,w,c),x=e.readFloat(),p=e.readFloat(),y=e.readFloat(),v=e.readFloat();for(let A=0,C=0,T=b.getFrameCount()-1;b.setFrame(A,x,p,y,v),A!=T;A++){let E=e.readFloat(),R=e.readFloat(),k=e.readFloat(),X=e.readFloat();switch(e.readByte()){case Xe:b.setStepped(A);break;case Pe:oe(e,b,C++,A,0,x,E,p,R,1),oe(e,b,C++,A,1,x,E,y,k,1),oe(e,b,C++,A,2,x,E,v,X,1)}x=E,p=R,y=k,v=X}s.push(b)}}}for(let o=0,l=e.readInt(!0);o<l;o++){const c=e.readInt(!0)-1;for(let f=0,d=e.readInt(!0);f<d;f++){const u=e.readByte(),m=e.readInt(!0);if(u==Lr){const w=new bt(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 f=0,d=e.readInt(!0);f<d;f++){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),y=p-1;switch(x){case Cr:{let v=b,A=v.bones,C=v.vertices,T=A?C.length/3*2:C.length,E=e.readInt(!0),R=new ai(p,E,u,v),k=e.readFloat();for(let X=0,I=0;;X++){let Y,F=e.readInt(!0);if(F==0)Y=A?L.newFloatArray(T):C;else{Y=L.newFloatArray(T);let se=e.readInt(!0);if(F+=se,n==1)for(let te=se;te<F;te++)Y[te]=e.readFloat();else for(let te=se;te<F;te++)Y[te]=e.readFloat()*n;if(!A)for(let te=0,ce=Y.length;te<ce;te++)Y[te]+=C[te]}if(R.setFrame(X,k,Y),X==y)break;let ie=e.readFloat();switch(e.readByte()){case Xe:R.setStepped(X);break;case Pe:oe(e,R,I++,X,0,k,ie,0,1,1)}k=ie}s.push(R);break}case Sr:{let v=new Qe(p,u,b);for(let A=0;A<p;A++){let C=e.readFloat(),T=e.readInt32();v.setFrame(A,C,$i[T&15],T>>4,e.readFloat())}s.push(v);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 f=e.readFloat(),d=e.readInt(!0),u=L.newArray(l,0);for(let b=l-1;b>=0;b--)u[b]=-1;let m=L.newArray(l-d,0),g=0,w=0;for(let b=0;b<d;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,f,u)}s.push(o)}let a=e.readInt(!0);if(a>0){let o=new lt(a);for(let l=0;l<a;l++){let c=e.readFloat(),f=i.events[e.readInt(!0)],d=new Ei(c,f);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),o.setFrame(l,d)}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 xt(t,s,r)}},ys=class{constructor(e,t=new Array,i=0,s=new DataView(e instanceof ArrayBuffer?e: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:oe(e,t,a++,h,0,s,o,n,l,i)}s=o,n=l}return t}function Vi(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,f=e.readFloat()*i;switch(e.readByte()){case Xe:t.setStepped(a);break;case Pe:oe(e,t,r++,a,0,s,l,n,c,i),oe(e,t,r++,a,1,s,l,h,f,i)}s=l,n=c,h=f}return t}function oe(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 nt(()=>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 At){let c=l;i.push(c);let f=n.obtain();f.length!=c.worldVerticesLength&&(f=L.newFloatArray(c.worldVerticesLength)),s.push(f),c.computeWorldVertices(o,0,c.worldVerticesLength,f,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 f=o[l],d=o[l+1];e=Math.min(e,f),t=Math.min(t,d),i=Math.max(i,f),s=Math.max(s,d)}}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],f=h[a-1];for(let d=0;d<a;d+=2){let u=h[d],m=h[d+1],g=c*m-f*u,w=c-u,b=f-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 y=(l*b-o*g)/x;if((y>=f&&y<=m||y>=m&&y<=f)&&(y>=i&&y<=n||y>=n&&y<=i))return!0}c=u,f=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}},Ce=class{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new nt(()=>new Array);polygonIndicesPool=new nt(()=>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]=Ce.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 f=s[a]<<1,d=s[r]<<1,u=s[o]<<1,m=t[f],g=t[f+1],w=t[d],b=t[d+1],x=t[u],p=t[u+1];for(let y=(o+1)%i;y!=a;y=(y+1)%i){if(!n[y])continue;let v=s[y]<<1,A=t[v],C=t[v+1];if(Ce.positiveArea(x,p,m,g,A,C)&&Ce.positiveArea(m,g,w,b,A,C)&&Ce.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]=Ce.isConcave(l,i,t,s),n[c]=Ce.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 f=t[l]<<1,d=t[l+1]<<1,u=t[l+2]<<1,m=i[f],g=i[f+1],w=i[d],b=i[d+1],x=i[u],p=i[u+1],y=!1;if(r==f){let v=a.length-4,A=Ce.winding(a[v],a[v+1],a[v+2],a[v+3],x,p),C=Ce.winding(x,p,a[0],a[1],a[2],a[3]);A==o&&C==o&&(a.push(x),a.push(p),h.push(u),y=!0)}y||(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(f),h.push(d),h.push(u),o=Ce.winding(m,g,w,b,x,p),r=f)}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 f=h[0],d=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],y=a[2],v=a[3],A=Ce.winding(m,g,w,b,x,p);for(let C=0;C<c;C++){if(C==l)continue;let T=n[C];if(T.length!=3)continue;let E=T[0],R=T[1],k=T[2],X=s[C],I=X[X.length-2],Y=X[X.length-1];if(E!=f||R!=d)continue;let F=Ce.winding(m,g,w,b,I,Y),ie=Ce.winding(I,Y,x,p,y,v);F==A&&ie==A&&(X.length=0,T.length=0,a.push(I),a.push(Y),h.push(k),m=w,g=b,w=I,b=Y,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}},Yt=class{triangulator=new Ce;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=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;Yt.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];Yt.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){let o,l,c,f,d,u;typeof t=="number"?(o=i,l=s,c=n,f=h,d=a,u=r):(o=t,l=i,c=s,f=n,d=h,u=a),c&&f&&d&&typeof u=="boolean"?this.clipTrianglesRender(e,o,l,c,f,d,u):this.clipTrianglesNoRender(e,o,l)}clipTrianglesNoRender(e,t,i){let s=this.clipOutput,n=this.clippedVertices,h=this.clippedTriangles,a=this.clippingPolygons,r=a.length,o=0;n.length=0,h.length=0;for(let l=0;l<i;l+=3){let c=t[l]<<1,f=e[c],d=e[c+1];c=t[l+1]<<1;let u=e[c],m=e[c+1];c=t[l+2]<<1;let g=e[c],w=e[c+1];for(let b=0;b<r;b++){let x=n.length;if(this.clip(f,d,u,m,g,w,a[b],s)){let p=s.length;if(p==0)continue;let y=p>>1,v=this.clipOutput,A=L.setArraySize(n,x+y*2);for(let T=0;T<p;T+=2,x+=2){let E=v[T],R=v[T+1];A[x]=E,A[x+1]=R}x=h.length;let C=L.setArraySize(h,x+3*(y-2));y--;for(let T=1;T<y;T++,x+=3)C[x]=o,C[x+1]=o+T,C[x+2]=o+T+1;o+=y+1}else{let p=L.setArraySize(n,x+6);p[x]=f,p[x+1]=d,p[x+2]=u,p[x+3]=m,p[x+4]=g,p[x+5]=w,x=h.length;let y=L.setArraySize(h,x+3);y[x]=o,y[x+1]=o+1,y[x+2]=o+2,o+=3;break}}}}clipTrianglesRender(e,t,i,s,n,h,a){let r=this.clipOutput,o=this.clippedVertices,l=this.clippedTriangles,c=this.clippingPolygons,f=c.length,d=a?12:8,u=0;o.length=0,l.length=0;for(let m=0;m<i;m+=3){let g=t[m]<<1,w=e[g],b=e[g+1],x=s[g],p=s[g+1];g=t[m+1]<<1;let y=e[g],v=e[g+1],A=s[g],C=s[g+1];g=t[m+2]<<1;let T=e[g],E=e[g+1],R=s[g],k=s[g+1];for(let X=0;X<f;X++){let I=o.length;if(this.clip(w,b,y,v,T,E,c[X],r)){let Y=r.length;if(Y==0)continue;let F=v-E,ie=T-y,se=w-T,te=E-b,ce=1/(F*se+ie*(b-E)),de=Y>>1,fe=this.clipOutput,K=L.setArraySize(o,I+de*d);for(let ae=0;ae<Y;ae+=2,I+=d){let Me=fe[ae],Se=fe[ae+1];K[I]=Me,K[I+1]=Se,K[I+2]=n.r,K[I+3]=n.g,K[I+4]=n.b,K[I+5]=n.a;let ge=Me-T,we=Se-E,ve=(F*ge+ie*we)*ce,_e=(te*ge+se*we)*ce,ft=1-ve-_e;K[I+6]=x*ve+A*_e+R*ft,K[I+7]=p*ve+C*_e+k*ft,a&&(K[I+8]=h.r,K[I+9]=h.g,K[I+10]=h.b,K[I+11]=h.a)}I=l.length;let ne=L.setArraySize(l,I+3*(de-2));de--;for(let ae=1;ae<de;ae++,I+=3)ne[I]=u,ne[I+1]=u+ae,ne[I+2]=u+ae+1;u+=de+1}else{let Y=L.setArraySize(o,I+3*d);Y[I]=w,Y[I+1]=b,Y[I+2]=n.r,Y[I+3]=n.g,Y[I+4]=n.b,Y[I+5]=n.a,a?(Y[I+6]=x,Y[I+7]=p,Y[I+8]=h.r,Y[I+9]=h.g,Y[I+10]=h.b,Y[I+11]=h.a,Y[I+12]=y,Y[I+13]=v,Y[I+14]=n.r,Y[I+15]=n.g,Y[I+16]=n.b,Y[I+17]=n.a,Y[I+18]=A,Y[I+19]=C,Y[I+20]=h.r,Y[I+21]=h.g,Y[I+22]=h.b,Y[I+23]=h.a,Y[I+24]=T,Y[I+25]=E,Y[I+26]=n.r,Y[I+27]=n.g,Y[I+28]=n.b,Y[I+29]=n.a,Y[I+30]=R,Y[I+31]=k,Y[I+32]=h.r,Y[I+33]=h.g,Y[I+34]=h.b,Y[I+35]=h.a):(Y[I+6]=x,Y[I+7]=p,Y[I+8]=y,Y[I+9]=v,Y[I+10]=n.r,Y[I+11]=n.g,Y[I+12]=n.b,Y[I+13]=n.a,Y[I+14]=A,Y[I+15]=C,Y[I+16]=T,Y[I+17]=E,Y[I+18]=n.r,Y[I+19]=n.g,Y[I+20]=n.b,Y[I+21]=n.a,Y[I+22]=R,Y[I+23]=k),I=l.length;let F=L.setArraySize(l,I+3);F[I]=u,F[I+1]=u+1,F[I+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(e,t,i,s){let n=this.clipOutput,h=this.clippedVertices,a=this.clippedUVs,r=this.clippedTriangles,o=this.clippingPolygons,l=o.length,c=0;h.length=0,a.length=0,r.length=0;for(let f=0;f<i;f+=3){let d=t[f]<<1,u=e[d],m=e[d+1],g=s[d],w=s[d+1];d=t[f+1]<<1;let b=e[d],x=e[d+1],p=s[d],y=s[d+1];d=t[f+2]<<1;let v=e[d],A=e[d+1],C=s[d],T=s[d+1];for(let E=0;E<l;E++){let R=h.length;if(this.clip(u,m,b,x,v,A,o[E],n)){let k=n.length;if(k==0)continue;let X=x-A,I=v-b,Y=u-v,F=A-m,ie=1/(X*Y+I*(m-A)),se=k>>1,te=this.clipOutput,ce=L.setArraySize(h,R+se*2),de=L.setArraySize(a,R+se*2);for(let K=0;K<k;K+=2,R+=2){let ne=te[K],ae=te[K+1];ce[R]=ne,ce[R+1]=ae;let Me=ne-v,Se=ae-A,ge=(X*Me+I*Se)*ie,we=(F*Me+Y*Se)*ie,ve=1-ge-we;de[R]=g*ge+p*we+C*ve,de[R+1]=w*ge+y*we+T*ve}R=r.length;let fe=L.setArraySize(r,R+3*(se-2));se--;for(let K=1;K<se;K++,R+=3)fe[R]=c,fe[R+1]=c+K,fe[R+2]=c+K+1;c+=se+1}else{let k=L.setArraySize(h,R+6);k[R]=u,k[R+1]=m,k[R+2]=b,k[R+3]=x,k[R+4]=v,k[R+5]=A;let X=L.setArraySize(a,R+3*2);X[R]=g,X[R+1]=w,X[R+2]=p,X[R+3]=y,X[R+4]=C,X[R+5]=T,R=r.length;let I=L.setArraySize(r,R+3);I[R]=c,I[R+1]=c+1,I[R+2]=c+2,c+=3;break}}}}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 f=a.length-4,d=a;for(let u=0;;u+=2){let m=d[u],g=d[u+1],w=m-d[u+2],b=g-d[u+3],x=r.length,p=c;for(let v=0,A=c.length-2;v<A;){let C=p[v],T=p[v+1];v+=2;let E=p[v],R=p[v+1],k=b*(m-E)>w*(g-R),X=b*(m-C)-w*(g-T);if(X>0){if(k){r.push(E),r.push(R);continue}let I=E-C,Y=R-T,F=X/(I*b-Y*w);if(F>=0&&F<=1)r.push(C+I*F),r.push(T+Y*F);else{r.push(E),r.push(R);continue}}else if(k){let I=E-C,Y=R-T,F=X/(I*b-Y*w);if(F>=0&&F<=1)r.push(C+I*F),r.push(T+Y*F),r.push(E),r.push(R);else{r.push(E),r.push(R);continue}}l=!0}if(x==r.length)return o.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==f)break;let y=r;r=c,r.length=0,c=y}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 f=t[o],d=t[o+1],u=l-o;t[o]=t[u],t[o+1]=t[u+1],t[u]=f,t[u+1]=d}}},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=M(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=M(a,"parent",null);o&&(r=i.findBone(o));let l=new Ti(i.bones.length,a.name,r);l.length=M(a,"length",0)*t,l.x=M(a,"x",0)*t,l.y=M(a,"y",0)*t,l.rotation=M(a,"rotation",0),l.scaleX=M(a,"scaleX",1),l.scaleY=M(a,"scaleY",1),l.shearX=M(a,"shearX",0),l.shearY=M(a,"shearY",0),l.inherit=L.enumValue(ot,M(a,"inherit","Normal")),l.skinRequired=M(a,"skin",!1);let c=M(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=a.name,o=i.findBone(a.bone);if(!o)throw new Error(`Couldn't find bone ${a.bone} for slot ${r}`);let l=new Li(i.slots.length,r,o),c=M(a,"color",null);c&&l.color.setFromString(c);let f=M(a,"dark",null);f&&(l.darkColor=V.fromString(f)),l.attachmentName=M(a,"attachment",null),l.blendMode=L.enumValue(Rt,M(a,"blend","normal")),l.visible=M(a,"visible",!0),i.slots.push(l)}if(s.ik)for(let h=0;h<s.ik.length;h++){let a=s.ik[h],r=new Yi(a.name);r.order=M(a,"order",0),r.skinRequired=M(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=M(a,"mix",1),r.softness=M(a,"softness",0)*t,r.bendDirection=M(a,"bendPositive",!0)?1:-1,r.compress=M(a,"compress",!1),r.stretch=M(a,"stretch",!1),r.uniform=M(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=M(a,"order",0),r.skinRequired=M(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let f=a.bones[c],d=i.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${a.name}.`);r.bones.push(d)}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=M(a,"local",!1),r.relative=M(a,"relative",!1),r.offsetRotation=M(a,"rotation",0),r.offsetX=M(a,"x",0)*t,r.offsetY=M(a,"y",0)*t,r.offsetScaleX=M(a,"scaleX",0),r.offsetScaleY=M(a,"scaleY",0),r.offsetShearY=M(a,"shearY",0),r.mixRotate=M(a,"mixRotate",1),r.mixX=M(a,"mixX",1),r.mixY=M(a,"mixY",r.mixX),r.mixScaleX=M(a,"mixScaleX",1),r.mixScaleY=M(a,"mixScaleY",r.mixScaleX),r.mixShearY=M(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=M(a,"order",0),r.skinRequired=M(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let f=a.bones[c],d=i.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${a.name}.`);r.bones.push(d)}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(St,M(a,"positionMode","Percent")),r.spacingMode=L.enumValue(Tt,M(a,"spacingMode","Length")),r.rotateMode=L.enumValue(It,M(a,"rotateMode","Tangent")),r.offsetRotation=M(a,"rotation",0),r.position=M(a,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=M(a,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=M(a,"mixRotate",1),r.mixX=M(a,"mixX",1),r.mixY=M(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=M(a,"order",0),r.skinRequired=M(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=M(a,"x",0),r.y=M(a,"y",0),r.rotate=M(a,"rotate",0),r.scaleX=M(a,"scaleX",0),r.shearX=M(a,"shearX",0),r.limit=M(a,"limit",5e3)*t,r.step=1/M(a,"fps",60),r.inertia=M(a,"inertia",1),r.strength=M(a,"strength",100),r.damping=M(a,"damping",1),r.massInverse=1/M(a,"mass",1),r.wind=M(a,"wind",0),r.gravity=M(a,"gravity",0),r.mix=M(a,"mix",1),r.inertiaGlobal=M(a,"inertiaGlobal",!1),r.strengthGlobal=M(a,"strengthGlobal",!1),r.dampingGlobal=M(a,"dampingGlobal",!1),r.massGlobal=M(a,"massGlobal",!1),r.windGlobal=M(a,"windGlobal",!1),r.gravityGlobal=M(a,"gravityGlobal",!1),r.mixGlobal=M(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 Et(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 f in c){let d=this.readAttachment(c[f],r,l.index,f,i);d&&r.setAttachment(l.index,f,d)}}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=M(a,"int",0),r.floatValue=M(a,"float",0),r.stringValue=M(a,"string",""),r.audioPath=M(a,"audio",null),r.audioPath&&(r.volume=M(a,"volume",1),r.balance=M(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=M(e,"name",s),M(e,"type","region")){case"region":{let a=M(e,"path",s),r=this.readSequence(M(e,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(t,s,a,r);if(!o)return null;o.path=a,o.x=M(e,"x",0)*h,o.y=M(e,"y",0)*h,o.scaleX=M(e,"scaleX",1),o.scaleY=M(e,"scaleY",1),o.rotation=M(e,"rotation",0),o.width=e.width*h,o.height=e.height*h,o.sequence=r;let l=M(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=M(e,"color",null);return r&&a.color.setFromString(r),a}case"mesh":case"linkedmesh":{let a=M(e,"path",s),r=this.readSequence(M(e,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(t,s,a,r);if(!o)return null;o.path=a;let l=M(e,"color",null);l&&o.color.setFromString(l),o.width=M(e,"width",0)*h,o.height=M(e,"height",0)*h,o.sequence=r;let c=M(e,"parent",null);if(c)return this.linkedMeshes.push(new Vr(o,M(e,"skin",null),i,c,M(e,"timelines",!0))),o;let f=e.uvs;return this.readVertices(e,o,f.length),o.triangles=e.triangles,o.regionUVs=f,o.region!=null&&o.updateRegion(),o.edges=M(e,"edges",null),o.hullLength=M(e,"hull",0)*2,o}case"path":{let a=this.attachmentLoader.newPathAttachment(t,s);if(!a)return null;a.closed=M(e,"closed",!1),a.constantSpeed=M(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=M(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=M(e,"x",0)*h,a.y=M(e,"y",0)*h,a.rotation=M(e,"rotation",0);let r=M(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=M(e,"end",null);r&&(a.endSlot=n.findSlot(r));let o=e.vertexCount;this.readVertices(e,a,o<<1);let l=M(e,"color",null);return l&&a.color.setFromString(l),a}}return null}readSequence(e){if(e==null)return null;let t=new Wt(M(e,"count",0));return t.start=M(e,"start",1),t.digits=M(e,"digits",0),t.setupIndex=M(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 f=r[c];if(!f)continue;let d=f.length;if(c=="attachment"){let u=new qe(d,l);for(let m=0;m<d;m++){let g=f[m];u.setFrame(m,M(g,"time",0),M(g,"name",null))}n.push(u)}else if(c=="rgba"){let u=new ti(d,d<<2,l),m=f[0],g=M(m,"time",0),w=V.fromString(m.color);for(let b=0,x=0;;b++){u.setFrame(b,g,w.r,w.g,w.b,w.a);let p=f[b+1];if(!p){u.shrink(x);break}let y=M(p,"time",0),v=V.fromString(p.color),A=m.curve;A&&(x=he(A,u,x,b,0,g,y,w.r,v.r,1),x=he(A,u,x,b,1,g,y,w.g,v.g,1),x=he(A,u,x,b,2,g,y,w.b,v.b,1),x=he(A,u,x,b,3,g,y,w.a,v.a,1)),g=y,w=v,m=p}n.push(u)}else if(c=="rgb"){let u=new ii(d,d*3,l),m=f[0],g=M(m,"time",0),w=V.fromString(m.color);for(let b=0,x=0;;b++){u.setFrame(b,g,w.r,w.g,w.b);let p=f[b+1];if(!p){u.shrink(x);break}let y=M(p,"time",0),v=V.fromString(p.color),A=m.curve;A&&(x=he(A,u,x,b,0,g,y,w.r,v.r,1),x=he(A,u,x,b,1,g,y,w.g,v.g,1),x=he(A,u,x,b,2,g,y,w.b,v.b,1)),g=y,w=v,m=p}n.push(u)}else if(c=="alpha")n.push(ke(f,new si(d,d,l),0,1));else if(c=="rgba2"){let u=new ri(d,d*7,l),m=f[0],g=M(m,"time",0),w=V.fromString(m.light),b=V.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 y=f[x+1];if(!y){u.shrink(p);break}let v=M(y,"time",0),A=V.fromString(y.light),C=V.fromString(y.dark),T=m.curve;T&&(p=he(T,u,p,x,0,g,v,w.r,A.r,1),p=he(T,u,p,x,1,g,v,w.g,A.g,1),p=he(T,u,p,x,2,g,v,w.b,A.b,1),p=he(T,u,p,x,3,g,v,w.a,A.a,1),p=he(T,u,p,x,4,g,v,b.r,C.r,1),p=he(T,u,p,x,5,g,v,b.g,C.g,1),p=he(T,u,p,x,6,g,v,b.b,C.b,1)),g=v,w=A,b=C,m=y}n.push(u)}else if(c=="rgb2"){let u=new ni(d,d*6,l),m=f[0],g=M(m,"time",0),w=V.fromString(m.light),b=V.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 y=f[x+1];if(!y){u.shrink(p);break}let v=M(y,"time",0),A=V.fromString(y.light),C=V.fromString(y.dark),T=m.curve;T&&(p=he(T,u,p,x,0,g,v,w.r,A.r,1),p=he(T,u,p,x,1,g,v,w.g,A.g,1),p=he(T,u,p,x,2,g,v,w.b,A.b,1),p=he(T,u,p,x,3,g,v,b.r,C.r,1),p=he(T,u,p,x,4,g,v,b.g,C.g,1),p=he(T,u,p,x,5,g,v,b.b,C.b,1)),g=v,w=A,b=C,m=y}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 f=r[c],d=f.length;if(d!=0){if(c==="rotate")n.push(ke(f,new at(d,d,l),0,1));else if(c==="translate"){let u=new qt(d,d<<1,l);n.push(Oi(f,u,"x","y",0,s))}else if(c==="translatex"){let u=new Gt(d,d,l);n.push(ke(f,u,0,s))}else if(c==="translatey"){let u=new Ht(d,d,l);n.push(ke(f,u,0,s))}else if(c==="scale"){let u=new jt(d,d<<1,l);n.push(Oi(f,u,"x","y",1,1))}else if(c==="scalex"){let u=new Zt(d,d,l);n.push(ke(f,u,1,1))}else if(c==="scaley"){let u=new Kt(d,d,l);n.push(ke(f,u,1,1))}else if(c==="shear"){let u=new Jt(d,d<<1,l);n.push(Oi(f,u,"x","y",0,1))}else if(c==="shearx"){let u=new Qt(d,d,l);n.push(ke(f,u,0,1))}else if(c==="sheary"){let u=new $t(d,d,l);n.push(ke(f,u,0,1))}else if(c==="inherit"){let u=new ei(d,o.index);for(let m=0;m<f.length;m++){let g=f[m];u.setFrame(m,M(g,"time",0),L.enumValue(ot,M(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),f=new li(r.length,r.length<<1,c),d=M(o,"time",0),u=M(o,"mix",1),m=M(o,"softness",0)*s;for(let g=0,w=0;;g++){f.setFrame(g,d,u,m,M(o,"bendPositive",!0)?1:-1,M(o,"compress",!1),M(o,"stretch",!1));let b=r[g+1];if(!b){f.shrink(w);break}let x=M(b,"time",0),p=M(b,"mix",1),y=M(b,"softness",0)*s,v=o.curve;v&&(w=he(v,f,w,g,0,d,x,u,p,1),w=he(v,f,w,g,1,d,x,m,y,s)),d=x,u=p,m=y,o=b}n.push(f)}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),f=new oi(r.length,r.length*6,c),d=M(o,"time",0),u=M(o,"mixRotate",1),m=M(o,"mixX",1),g=M(o,"mixY",m),w=M(o,"mixScaleX",1),b=M(o,"mixScaleY",w),x=M(o,"mixShearY",1);for(let p=0,y=0;;p++){f.setFrame(p,d,u,m,g,w,b,x);let v=r[p+1];if(!v){f.shrink(y);break}let A=M(v,"time",0),C=M(v,"mixRotate",1),T=M(v,"mixX",1),E=M(v,"mixY",T),R=M(v,"mixScaleX",1),k=M(v,"mixScaleY",R),X=M(v,"mixShearY",1),I=o.curve;I&&(y=he(I,f,y,p,0,d,A,u,C,1),y=he(I,f,y,p,1,d,A,m,T,1),y=he(I,f,y,p,2,d,A,g,E,1),y=he(I,f,y,p,3,d,A,w,R,1),y=he(I,f,y,p,4,d,A,b,k,1),y=he(I,f,y,p,5,d,A,x,X,1)),d=A,u=C,m=T,g=E,w=R,b=k,w=R,o=v}n.push(f)}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 f=r[c],d=f[0];if(!d)continue;let u=f.length;if(c==="position"){let m=new hi(u,u,l);n.push(ke(f,m,0,o.positionMode==0?s:1))}else if(c==="spacing"){let m=new ci(u,u,l);n.push(ke(f,m,0,o.spacingMode==0||o.spacingMode==1?s:1))}else if(c==="mix"){let m=new di(u,u*3,l),g=M(d,"time",0),w=M(d,"mixRotate",1),b=M(d,"mixX",1),x=M(d,"mixY",b);for(let p=0,y=0;;p++){m.setFrame(p,g,w,b,x);let v=f[p+1];if(!v){m.shrink(y);break}let A=M(v,"time",0),C=M(v,"mixRotate",1),T=M(v,"mixX",1),E=M(v,"mixY",T),R=d.curve;R&&(y=he(R,m,y,p,0,g,A,w,C,1),y=he(R,m,y,p,1,g,A,b,T,1),y=he(R,m,y,p,2,g,A,x,E,1)),g=A,w=C,b=T,x=E,d=v}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],f=c[0];if(!f)continue;let d=c.length;if(l=="reset"){const m=new bt(d,o);for(let g=0;f!=null;f=c[g+1],g++)m.setFrame(g,M(f,"time",0));n.push(m);continue}let u;if(l=="inertia")u=new fi(d,d,o);else if(l=="strength")u=new ui(d,d,o);else if(l=="damping")u=new mi(d,d,o);else if(l=="mass")u=new gi(d,d,o);else if(l=="wind")u=new xi(d,d,o);else if(l=="gravity")u=new pi(d,d,o);else if(l=="mix")u=new bi(d,d,o);else continue;n.push(ke(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],f=i.findSlot(l);if(!f)throw new Error("Slot not found: "+l);let d=f.index;for(let u in c){let m=c[u],g=o.getAttachment(d,u);for(let w in m){let b=m[w],x=b[0];if(x){if(w=="deform"){let p=g.bones,y=g.vertices,v=p?y.length/3*2:y.length,A=new ai(b.length,b.length,d,g),C=M(x,"time",0);for(let T=0,E=0;;T++){let R,k=M(x,"vertices",null);if(!k)R=p?L.newFloatArray(v):y;else{R=L.newFloatArray(v);let F=M(x,"offset",0);if(L.arrayCopy(k,0,R,F,k.length),s!=1)for(let ie=F,se=ie+k.length;ie<se;ie++)R[ie]*=s;if(!p)for(let ie=0;ie<v;ie++)R[ie]+=y[ie]}A.setFrame(T,C,R);let X=b[T+1];if(!X){A.shrink(E);break}let I=M(X,"time",0),Y=x.curve;Y&&(E=he(Y,A,E,T,0,C,I,0,1,1)),C=I,x=X}n.push(A)}else if(w=="sequence"){let p=new Qe(b.length,d,g),y=0;for(let v=0;v<b.length;v++){let A=M(x,"delay",y),C=M(x,"time",0),T=Qi[M(x,"mode","hold")],E=M(x,"index",0);p.setFrame(v,C,T,E,A),y=A,x=b[v+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],f=null,d=M(c,"offsets",null);if(d){f=L.newArray(r,-1);let u=L.newArray(r-d.length,0),m=0,g=0;for(let w=0;w<d.length;w++){let b=d[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++;f[m+b.offset]=m++}for(;m<r;)u[g++]=m++;for(let w=r-1;w>=0;w--)f[w]==-1&&(f[w]=u[--g])}a.setFrame(o,M(c,"time",0),f)}n.push(a)}if(e.events){let a=new lt(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 f=new Ei(L.toSinglePrecision(M(l,"time",0)),c);f.intValue=M(l,"int",c.intValue),f.floatValue=M(l,"float",c.floatValue),f.stringValue=M(l,"string",c.stringValue),f.data.audioPath&&(f.volume=M(l,"volume",1),f.balance=M(l,"balance",0)),a.setFrame(r,f)}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 xt(t,n,h))}},Vr=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 ke(e,t,i,s){let n=e[0],h=M(n,"time",0),a=M(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=M(l,"time",0),f=M(l,"value",i)*s;n.curve&&(r=he(n.curve,t,r,o,0,h,c,a,f,s)),h=c,a=f,n=l}}function Oi(e,t,i,s,n,h){let a=e[0],r=M(a,"time",0),o=M(a,i,n)*h,l=M(a,s,n)*h,c=0;for(let f=0;;f++){t.setFrame(f,r,o,l);let d=e[f+1];if(!d)return t.shrink(c),t;let u=M(d,"time",0),m=M(d,i,n)*h,g=M(d,s,n)*h,w=a.curve;w&&(c=he(w,t,c,f,0,r,u,o,m,h),c=he(w,t,c,f,1,r,u,l,g,h)),r=u,o=m,l=g,a=d}}function he(e,t,i,s,n,h,a,r,o,l){if(e=="stepped")return t.setStepped(s),i;let c=n<<2,f=e[c],d=e[c+1]*l,u=e[c+2],m=e[c+3]*l;return t.setBezier(i,s,n,h,r,f,d,u,m,a,o),i+1}function M(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)}},kt=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,kt.validateMagFilter(t)),this.useMipMaps=kt.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(),kt.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)}},ct=kt;B(ct,"DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL",!1);var Cs=class extends gs{constructor(e,t="",i=new Mi){super(s=>new ct(e,s),t,i)}},Ie=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[O]+this.y*t[W]+this.z*t[q]+t[D],this.x*t[G]+this.y*t[N]+this.z*t[H]+t[U],this.x*t[j]+this.y*t[Z]+this.z*t[_]+t[z])}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[O]+this.y*t[W]+this.z*t[q]+t[D])*i,(this.x*t[G]+this.y*t[N]+this.z*t[H]+t[U])*i,(this.x*t[j]+this.y*t[Z]+this.z*t[_]+t[z])*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)}},O=0,W=4,q=8,D=12,G=1,N=5,H=9,U=13,j=2,Z=6,_=10,z=14,Q=3,$=7,ee=11,J=15,Fe=class{temp=new Float32Array(16);values=new Float32Array(16);constructor(){let e=this.values;e[O]=1,e[N]=1,e[_]=1,e[J]=1}set(e){return this.values.set(e),this}transpose(){let e=this.temp,t=this.values;return e[O]=t[O],e[W]=t[G],e[q]=t[j],e[D]=t[Q],e[G]=t[W],e[N]=t[N],e[H]=t[Z],e[U]=t[$],e[j]=t[q],e[Z]=t[H],e[_]=t[_],e[z]=t[ee],e[Q]=t[D],e[$]=t[U],e[ee]=t[z],e[J]=t[J],this.set(e)}identity(){let e=this.values;return e[O]=1,e[W]=0,e[q]=0,e[D]=0,e[G]=0,e[N]=1,e[H]=0,e[U]=0,e[j]=0,e[Z]=0,e[_]=1,e[z]=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[Z]*e[H]*e[D]-e[j]*e[$]*e[H]*e[D]-e[Q]*e[N]*e[_]*e[D]+e[G]*e[$]*e[_]*e[D]+e[j]*e[N]*e[ee]*e[D]-e[G]*e[Z]*e[ee]*e[D]-e[Q]*e[Z]*e[q]*e[U]+e[j]*e[$]*e[q]*e[U]+e[Q]*e[W]*e[_]*e[U]-e[O]*e[$]*e[_]*e[U]-e[j]*e[W]*e[ee]*e[U]+e[O]*e[Z]*e[ee]*e[U]+e[Q]*e[N]*e[q]*e[z]-e[G]*e[$]*e[q]*e[z]-e[Q]*e[W]*e[H]*e[z]+e[O]*e[$]*e[H]*e[z]+e[G]*e[W]*e[ee]*e[z]-e[O]*e[N]*e[ee]*e[z]-e[j]*e[N]*e[q]*e[J]+e[G]*e[Z]*e[q]*e[J]+e[j]*e[W]*e[H]*e[J]-e[O]*e[Z]*e[H]*e[J]-e[G]*e[W]*e[_]*e[J]+e[O]*e[N]*e[_]*e[J];if(i==0)throw new Error("non-invertible matrix");let s=1/i;return t[O]=e[H]*e[z]*e[$]-e[U]*e[_]*e[$]+e[U]*e[Z]*e[ee]-e[N]*e[z]*e[ee]-e[H]*e[Z]*e[J]+e[N]*e[_]*e[J],t[W]=e[D]*e[_]*e[$]-e[q]*e[z]*e[$]-e[D]*e[Z]*e[ee]+e[W]*e[z]*e[ee]+e[q]*e[Z]*e[J]-e[W]*e[_]*e[J],t[q]=e[q]*e[U]*e[$]-e[D]*e[H]*e[$]+e[D]*e[N]*e[ee]-e[W]*e[U]*e[ee]-e[q]*e[N]*e[J]+e[W]*e[H]*e[J],t[D]=e[D]*e[H]*e[Z]-e[q]*e[U]*e[Z]-e[D]*e[N]*e[_]+e[W]*e[U]*e[_]+e[q]*e[N]*e[z]-e[W]*e[H]*e[z],t[G]=e[U]*e[_]*e[Q]-e[H]*e[z]*e[Q]-e[U]*e[j]*e[ee]+e[G]*e[z]*e[ee]+e[H]*e[j]*e[J]-e[G]*e[_]*e[J],t[N]=e[q]*e[z]*e[Q]-e[D]*e[_]*e[Q]+e[D]*e[j]*e[ee]-e[O]*e[z]*e[ee]-e[q]*e[j]*e[J]+e[O]*e[_]*e[J],t[H]=e[D]*e[H]*e[Q]-e[q]*e[U]*e[Q]-e[D]*e[G]*e[ee]+e[O]*e[U]*e[ee]+e[q]*e[G]*e[J]-e[O]*e[H]*e[J],t[U]=e[q]*e[U]*e[j]-e[D]*e[H]*e[j]+e[D]*e[G]*e[_]-e[O]*e[U]*e[_]-e[q]*e[G]*e[z]+e[O]*e[H]*e[z],t[j]=e[N]*e[z]*e[Q]-e[U]*e[Z]*e[Q]+e[U]*e[j]*e[$]-e[G]*e[z]*e[$]-e[N]*e[j]*e[J]+e[G]*e[Z]*e[J],t[Z]=e[D]*e[Z]*e[Q]-e[W]*e[z]*e[Q]-e[D]*e[j]*e[$]+e[O]*e[z]*e[$]+e[W]*e[j]*e[J]-e[O]*e[Z]*e[J],t[_]=e[W]*e[U]*e[Q]-e[D]*e[N]*e[Q]+e[D]*e[G]*e[$]-e[O]*e[U]*e[$]-e[W]*e[G]*e[J]+e[O]*e[N]*e[J],t[z]=e[D]*e[N]*e[j]-e[W]*e[U]*e[j]-e[D]*e[G]*e[Z]+e[O]*e[U]*e[Z]+e[W]*e[G]*e[z]-e[O]*e[N]*e[z],t[Q]=e[H]*e[Z]*e[Q]-e[N]*e[_]*e[Q]-e[H]*e[j]*e[$]+e[G]*e[_]*e[$]+e[N]*e[j]*e[ee]-e[G]*e[Z]*e[ee],t[$]=e[W]*e[_]*e[Q]-e[q]*e[Z]*e[Q]+e[q]*e[j]*e[$]-e[O]*e[_]*e[$]-e[W]*e[j]*e[ee]+e[O]*e[Z]*e[ee],t[ee]=e[q]*e[N]*e[Q]-e[W]*e[H]*e[Q]-e[q]*e[G]*e[$]+e[O]*e[H]*e[$]+e[W]*e[G]*e[ee]-e[O]*e[N]*e[ee],t[J]=e[W]*e[H]*e[j]-e[q]*e[N]*e[j]+e[q]*e[G]*e[Z]-e[O]*e[H]*e[Z]-e[W]*e[G]*e[_]+e[O]*e[N]*e[_],e[O]=t[O]*s,e[W]=t[W]*s,e[q]=t[q]*s,e[D]=t[D]*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[Z]=t[Z]*s,e[_]=t[_]*s,e[z]=t[z]*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[Z]*e[H]*e[D]-e[j]*e[$]*e[H]*e[D]-e[Q]*e[N]*e[_]*e[D]+e[G]*e[$]*e[_]*e[D]+e[j]*e[N]*e[ee]*e[D]-e[G]*e[Z]*e[ee]*e[D]-e[Q]*e[Z]*e[q]*e[U]+e[j]*e[$]*e[q]*e[U]+e[Q]*e[W]*e[_]*e[U]-e[O]*e[$]*e[_]*e[U]-e[j]*e[W]*e[ee]*e[U]+e[O]*e[Z]*e[ee]*e[U]+e[Q]*e[N]*e[q]*e[z]-e[G]*e[$]*e[q]*e[z]-e[Q]*e[W]*e[H]*e[z]+e[O]*e[$]*e[H]*e[z]+e[G]*e[W]*e[ee]*e[z]-e[O]*e[N]*e[ee]*e[z]-e[j]*e[N]*e[q]*e[J]+e[G]*e[Z]*e[q]*e[J]+e[j]*e[W]*e[H]*e[J]-e[O]*e[Z]*e[H]*e[J]-e[G]*e[W]*e[_]*e[J]+e[O]*e[N]*e[_]*e[J]}translate(e,t,i){let s=this.values;return s[D]+=e,s[U]+=t,s[z]+=i,this}copy(){return new Fe().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[O]=n/s,r[G]=0,r[j]=0,r[Q]=0,r[W]=0,r[N]=n,r[Z]=0,r[$]=0,r[q]=0,r[H]=0,r[_]=h,r[ee]=-1,r[D]=0,r[U]=0,r[z]=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),f=-(h+n)/(h-n),d=this.values;return d[O]=a,d[G]=0,d[j]=0,d[Q]=0,d[W]=0,d[N]=r,d[Z]=0,d[$]=0,d[q]=0,d[H]=0,d[_]=o,d[ee]=0,d[D]=l,d[U]=c,d[z]=f,d[J]=1,this}multiply(e){let t=this.temp,i=this.values,s=e.values;return t[O]=i[O]*s[O]+i[W]*s[G]+i[q]*s[j]+i[D]*s[Q],t[W]=i[O]*s[W]+i[W]*s[N]+i[q]*s[Z]+i[D]*s[$],t[q]=i[O]*s[q]+i[W]*s[H]+i[q]*s[_]+i[D]*s[ee],t[D]=i[O]*s[D]+i[W]*s[U]+i[q]*s[z]+i[D]*s[J],t[G]=i[G]*s[O]+i[N]*s[G]+i[H]*s[j]+i[U]*s[Q],t[N]=i[G]*s[W]+i[N]*s[N]+i[H]*s[Z]+i[U]*s[$],t[H]=i[G]*s[q]+i[N]*s[H]+i[H]*s[_]+i[U]*s[ee],t[U]=i[G]*s[D]+i[N]*s[U]+i[H]*s[z]+i[U]*s[J],t[j]=i[j]*s[O]+i[Z]*s[G]+i[_]*s[j]+i[z]*s[Q],t[Z]=i[j]*s[W]+i[Z]*s[N]+i[_]*s[Z]+i[z]*s[$],t[_]=i[j]*s[q]+i[Z]*s[H]+i[_]*s[_]+i[z]*s[ee],t[z]=i[j]*s[D]+i[Z]*s[U]+i[_]*s[z]+i[z]*s[J],t[Q]=i[Q]*s[O]+i[$]*s[G]+i[ee]*s[j]+i[J]*s[Q],t[$]=i[Q]*s[W]+i[$]*s[N]+i[ee]*s[Z]+i[J]*s[$],t[ee]=i[Q]*s[q]+i[$]*s[H]+i[ee]*s[_]+i[J]*s[ee],t[J]=i[Q]*s[D]+i[$]*s[U]+i[ee]*s[z]+i[J]*s[J],this.set(this.temp)}multiplyLeft(e){let t=this.temp,i=this.values,s=e.values;return t[O]=s[O]*i[O]+s[W]*i[G]+s[q]*i[j]+s[D]*i[Q],t[W]=s[O]*i[W]+s[W]*i[N]+s[q]*i[Z]+s[D]*i[$],t[q]=s[O]*i[q]+s[W]*i[H]+s[q]*i[_]+s[D]*i[ee],t[D]=s[O]*i[D]+s[W]*i[U]+s[q]*i[z]+s[D]*i[J],t[G]=s[G]*i[O]+s[N]*i[G]+s[H]*i[j]+s[U]*i[Q],t[N]=s[G]*i[W]+s[N]*i[N]+s[H]*i[Z]+s[U]*i[$],t[H]=s[G]*i[q]+s[N]*i[H]+s[H]*i[_]+s[U]*i[ee],t[U]=s[G]*i[D]+s[N]*i[U]+s[H]*i[z]+s[U]*i[J],t[j]=s[j]*i[O]+s[Z]*i[G]+s[_]*i[j]+s[z]*i[Q],t[Z]=s[j]*i[W]+s[Z]*i[N]+s[_]*i[Z]+s[z]*i[$],t[_]=s[j]*i[q]+s[Z]*i[H]+s[_]*i[_]+s[z]*i[ee],t[z]=s[j]*i[D]+s[Z]*i[U]+s[_]*i[z]+s[z]*i[J],t[Q]=s[Q]*i[O]+s[$]*i[G]+s[ee]*i[j]+s[J]*i[Q],t[$]=s[Q]*i[W]+s[$]*i[N]+s[ee]*i[Z]+s[J]*i[$],t[ee]=s[Q]*i[q]+s[$]*i[H]+s[ee]*i[_]+s[J]*i[ee],t[J]=s[Q]*i[D]+s[$]*i[U]+s[ee]*i[z]+s[J]*i[J],this.set(this.temp)}lookAt(e,t,i){let s=Fe.xAxis,n=Fe.yAxis,h=Fe.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[O]=s.x,a[W]=s.y,a[q]=s.z,a[G]=n.x,a[N]=n.y,a[H]=n.z,a[j]=-h.x,a[Z]=-h.y,a[_]=-h.z,Fe.tmpMatrix.identity(),Fe.tmpMatrix.values[D]=-e.x,Fe.tmpMatrix.values[U]=-e.y,Fe.tmpMatrix.values[z]=-e.z,this.multiply(Fe.tmpMatrix),this}},Le=Fe;B(Le,"xAxis",new Ie),B(Le,"yAxis",new Ie),B(Le,"zAxis",new Ie),B(Le,"tmpMatrix",new Fe);var Ss=class{position=new Ie(0,0,0);direction=new Ie(0,0,-1);up=new Ie(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,f=o.clientY-l.top,d=new Ts(o.identifier,c,f);if(this.mouseX=c,this.mouseY=f,this.buttonDown=!0,!this.touch0)this.touch0=d,this.listeners.map(u=>{u.down&&u.down(d.x,d.y)});else if(!this.touch1){this.touch1=d;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 f=l.clientX-c.left,d=l.clientY-c.top;this.touch0.identifier===l.identifier&&(this.touch0.x=this.mouseX=f,this.touch0.y=this.mouseY=d,this.listeners.map(u=>{u.dragged&&u.dragged(f,d)})),this.touch1&&this.touch1.identifier===l.identifier&&(this.touch1.x=this.mouseX=f,this.touch1.y=this.mouseY=d)}if(this.touch0&&this.touch1){let f=this.touch1.x-this.touch0.x,d=this.touch1.x-this.touch0.x,u=Math.sqrt(f*f+d*d);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 f=l.clientX-c.left,d=l.clientY-c.top;if(this.touch0.identifier===l.identifier)if(this.touch0=null,this.mouseX=f,this.mouseY=d,this.listeners.map(u=>{u.up&&u.up(f,d)}),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}},Or=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,f)=>{i=t.position.x,s=t.position.y,h=r=c,a=o=f,l=t.zoom},dragged:(c,f)=>{let d=c-h,u=f-a,m=t.screenToWorld(new Ie(0,0),e.clientWidth,e.clientHeight),g=t.screenToWorld(new Ie(d,u),e.clientWidth,e.clientHeight).sub(m);t.position.set(i-g.x,s-g.y,0),t.update(),r=c,o=f},wheel:c=>{let f=c/200*t.zoom,d=t.zoom+f;if(d>0){let u=0,m=0;if(c<0)u=r,m=o;else{let b=new Ie(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 Ie(u,m),e.clientWidth,e.clientHeight);t.zoom=d,t.update();let w=t.screenToWorld(new Ie(u,m),e.clientWidth,e.clientHeight);t.position.add(g.sub(w)),t.update()}},zoom:(c,f)=>{let d=c/f;t.zoom=l*d},up:(c,f)=>{r=c,o=f},moved:(c,f)=>{r=c,o=f}})}},ue=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
|
-
attribute vec4 ${
|
|
4
|
-
attribute vec4 ${
|
|
5
|
-
attribute vec2 ${
|
|
6
|
-
uniform mat4 ${
|
|
1
|
+
"use strict";var spine=(()=>{var Te=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,Gi=Object.getOwnPropertyNames,Hi=Object.prototype.hasOwnProperty,_i=(e,t)=>{for(var s in t)Te(e,s,{get:t[s],enumerable:!0})},ji=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Gi(t))!Hi.call(e,r)&&r!==s&&Te(e,r,{get:()=>t[r],enumerable:!(i=qi(t,r))||i.enumerable});return e},Zi=e=>ji(Te({},"__esModule",{value:!0}),e),zs={};_i(zs,{AlphaTimeline:()=>Ue,Animation:()=>ne,AnimationState:()=>tr,AnimationStateAdapter:()=>er,AnimationStateData:()=>sr,AssetManager:()=>pi,AssetManagerBase:()=>ni,AtlasAttachmentLoader:()=>nr,Attachment:()=>Ee,AttachmentTimeline:()=>Ot,BinaryInput:()=>ui,BlendMode:()=>Ts,Bone:()=>us,BoneData:()=>fs,BoundingBoxAttachment:()=>os,CURRENT:()=>ti,CameraController:()=>zr,ClippingAttachment:()=>$t,Color:()=>tt,Color2Attribute:()=>vi,ColorAttribute:()=>me,ConstraintData:()=>ee,CurveTimeline:()=>Ct,CurveTimeline1:()=>yt,CurveTimeline2:()=>ae,DebugUtils:()=>Qi,DeformTimeline:()=>qe,Downloader:()=>ms,DrawOrderTimeline:()=>zt,Event:()=>gs,EventData:()=>xs,EventQueue:()=>Js,EventTimeline:()=>le,EventType:()=>Qs,FIRST:()=>ns,FakeTexture:()=>ir,GLTexture:()=>Gt,HOLD_FIRST:()=>he,HOLD_MIX:()=>$s,HOLD_SUBSEQUENT:()=>as,IkConstraint:()=>ai,IkConstraintData:()=>ps,IkConstraintTimeline:()=>Ge,Inherit:()=>de,InheritTimeline:()=>Oe,Input:()=>Rs,IntSet:()=>Ki,Interpolation:()=>Ws,LoadingScreen:()=>_r,M00:()=>V,M01:()=>W,M02:()=>q,M03:()=>O,M10:()=>G,M11:()=>D,M12:()=>H,M13:()=>N,M20:()=>_,M21:()=>j,M22:()=>U,M23:()=>z,M30:()=>J,M31:()=>Q,M32:()=>$,M33:()=>K,ManagedWebGLRenderingContext:()=>xt,MathUtils:()=>P,Matrix4:()=>se,Mesh:()=>Ys,MeshAttachment:()=>Wt,MixBlend:()=>js,MixDirection:()=>Zs,OrthoCamera:()=>wi,PathAttachment:()=>qt,PathConstraint:()=>li,PathConstraintData:()=>ws,PathConstraintMixTimeline:()=>Ze,PathConstraintPositionTimeline:()=>_e,PathConstraintSpacingTimeline:()=>je,Physics:()=>di,PhysicsConstraintDampingTimeline:()=>Qe,PhysicsConstraintGravityTimeline:()=>es,PhysicsConstraintInertiaTimeline:()=>Ke,PhysicsConstraintMassTimeline:()=>$e,PhysicsConstraintMixTimeline:()=>ss,PhysicsConstraintResetTimeline:()=>is,PhysicsConstraintStrengthTimeline:()=>Je,PhysicsConstraintTimeline:()=>Pt,PhysicsConstraintWindTimeline:()=>ts,PointAttachment:()=>ri,PolygonBatcher:()=>Fs,Pool:()=>Jt,Position2Attribute:()=>ue,Position3Attribute:()=>Wr,PositionMode:()=>bs,Pow:()=>qs,PowOut:()=>Ji,RGB2Timeline:()=>We,RGBA2Timeline:()=>ze,RGBATimeline:()=>De,RGBTimeline:()=>Ne,RegionAttachment:()=>te,ResizeMode:()=>Ri,RotateMode:()=>ys,RotateTimeline:()=>Qt,SETUP:()=>ls,SUBSEQUENT:()=>oe,ScaleTimeline:()=>Fe,ScaleXTimeline:()=>Xe,ScaleYTimeline:()=>Pe,SceneRenderer:()=>Ei,SequenceTimeline:()=>rs,Shader:()=>Tt,ShapeRenderer:()=>Xs,ShapeType:()=>Ti,ShearTimeline:()=>Le,ShearXTimeline:()=>Be,ShearYTimeline:()=>Ve,Skeleton:()=>ci,SkeletonBinary:()=>lr,SkeletonBounds:()=>mi,SkeletonClipping:()=>xi,SkeletonData:()=>As,SkeletonDebugRenderer:()=>Ii,SkeletonJson:()=>Nr,SkeletonRenderer:()=>Mi,Skin:()=>fe,SkinEntry:()=>Cs,Slot:()=>oi,SlotData:()=>Ss,SpacingMode:()=>vs,SpineCanvas:()=>Kr,StringSet:()=>Ie,TexCoordAttribute:()=>ks,Texture:()=>hs,TextureAtlas:()=>cs,TextureAtlasPage:()=>ii,TextureAtlasRegion:()=>ds,TextureFilter:()=>ce,TextureRegion:()=>si,TextureWrap:()=>ei,TimeKeeper:()=>Me,Timeline:()=>ft,Touch:()=>bi,TrackEntry:()=>Ks,TransformConstraint:()=>hi,TransformConstraintData:()=>Is,TransformConstraintTimeline:()=>He,TranslateTimeline:()=>Re,TranslateXTimeline:()=>Ye,TranslateYTimeline:()=>ke,Triangulator:()=>gi,Utils:()=>L,Vector2:()=>Vt,Vector3:()=>At,VertexAttachment:()=>Yt,VertexAttribute:()=>Ht,VertexAttributeType:()=>yi,WindowedMean:()=>$i});var Ki=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}},Ie=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 s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},tt=class Nt{constructor(t=0,s=0,i=0,r=0){this.r=t,this.g=s,this.b=i,this.a=r}static WHITE=new Nt(1,1,1,1);static RED=new Nt(1,0,0,1);static GREEN=new Nt(0,1,0,1);static BLUE=new Nt(0,0,1,1);static MAGENTA=new Nt(1,0,1,1);set(t,s,i,r){return this.r=t,this.g=s,this.b=i,this.a=r,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)=="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!=8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,i,r){return this.r+=t,this.g+=s,this.b+=i,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new Nt){return s.setFromString(t)}},P=class Et{static PI=3.1415927;static PI2=Et.PI*2;static invPI2=1/Et.PI2;static radiansToDegrees=180/Et.PI;static radDeg=Et.radiansToDegrees;static degreesToRadians=Et.PI/180;static degRad=Et.degreesToRadians;static clamp(t,s,i){return t<s?s:t>i?i:t}static cosDeg(t){return Math.cos(t*Et.degRad)}static sinDeg(t){return Math.sin(t*Et.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*Et.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return Et.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,i){let r=Math.random(),h=s-t;return r<=(i-t)/h?t+Math.sqrt(r*h*(i-t)):s-Math.sqrt((1-r)*h*(s-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},Ws=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},qs=class extends Ws{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}},Ji=class extends qs{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},L=class Kt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,i,r,h){for(let l=s,n=r;l<s+h;l++,n++)i[n]=t[l]}static arrayFill(t,s,i,r){for(let h=s;h<i;h++)t[h]=r}static setArraySize(t,s,i=0){let r=t.length;if(r==s)return t;if(t.length=s,r<s)for(let h=r;h<s;h++)t[h]=i;return t}static ensureArrayCapacity(t,s,i=0){return t.length>=s?t:Kt.setArraySize(t,s,i)}static newArray(t,s){let i=new Array(t);for(let r=0;r<t;r++)i[r]=s;return i}static newFloatArray(t){if(Kt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static newShortArray(t){if(Kt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let s=new Array(t);for(let i=0;i<s.length;i++)s[i]=0;return s}}static toFloatArray(t){return Kt.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return Kt.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,s){}static contains(t,s,i=!0){for(var r=0;r<t.length;r++)if(t[r]==s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},Qi=class{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},Jt=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}},Vt=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}},Me=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)}},$i=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}},Ee=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},Yt=class Pi extends Ee{static nextID=0;id=Pi.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(t){super(t)}computeWorldVertices(t,s,i,r,h,l){i=h+(i>>1)*l;let n=t.bone.skeleton,a=t.deform,o=this.vertices,c=this.bones;if(!c){a.length>0&&(o=a);let u=t.bone,g=u.worldX,w=u.worldY,b=u.a,x=u.b,p=u.c,v=u.d;for(let y=s,A=h;A<i;y+=2,A+=l){let C=o[y],S=o[y+1];r[A]=C*b+S*x+g,r[A+1]=C*p+S*v+w}return}let d=0,f=0;for(let u=0;u<s;u+=2){let g=c[d];d+=g+1,f+=g}let m=n.bones;if(a.length==0)for(let u=h,g=f*3;u<i;u+=l){let w=0,b=0,x=c[d++];for(x+=d;d<x;d++,g+=3){let p=m[c[d]],v=o[g],y=o[g+1],A=o[g+2];w+=(v*p.a+y*p.b+p.worldX)*A,b+=(v*p.c+y*p.d+p.worldY)*A}r[u]=w,r[u+1]=b}else{let u=a;for(let g=h,w=f*3,b=f<<1;g<i;g+=l){let x=0,p=0,v=c[d++];for(v+=d;d<v;d++,w+=3,b+=2){let y=m[c[d]],A=o[w]+u[b],C=o[w+1]+u[b+1],S=o[w+2];x+=(A*y.a+C*y.b+y.worldX)*S,p+=(A*y.c+C*y.d+y.worldY)*S}r[g]=x,r[g+1]=p}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),L.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=L.newFloatArray(this.vertices.length),L.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},Gs=class Ae{static _nextID=0;id=Ae.nextID();regions;start=0;digits=0;setupIndex=0;constructor(t){this.regions=new Array(t)}copy(){let t=new Ae(this.regions.length);return L.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,s){let i=t.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(t,s){let i=t,r=(this.start+s).toString();for(let h=this.digits-r.length;h>0;h--)i+="0";return i+=r,i}static nextID(){return Ae._nextID++}},Hs=(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))(Hs||{}),_s=[0,1,2,3,4,5,6],ne=class{name;timelines=[];timelineIds=new Ie;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}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,s,i,r,h,l,n){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let a=this.timelines;for(let o=0,c=a.length;o<c;o++)a[o].apply(e,t,s,r,h,l,n)}},js=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(js||{}),Zs=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(Zs||{}),it={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},ft=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 s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let r=s;r<i;r+=s)if(e[r]>t)return r-s;return i-s}},Ct=class extends ft{curves;constructor(e,t,s){super(e,s),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 s=L.newFloatArray(t);L.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,r,h,l,n,a,o,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(i-h*2+n)*.03,u=(r-l*2+a)*.03,g=((h-n)*3-i+o)*.006,w=((l-a)*3-r+c)*.006,b=m*2+g,x=u*2+w,p=(h-i)*.3+m+g*.16666667,v=(l-r)*.3+u+w*.16666667,y=i+p,A=r+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,s,i){let r=this.curves;if(r[i]>e){let a=this.frames[t],o=this.frames[t+s];return o+(e-a)/(r[i]-a)*(r[i+1]-o)}let h=i+18;for(i+=2;i<h;i+=2)if(r[i]>=e){let a=r[i-2],o=r[i-1];return o+(e-a)/(r[i]-a)*(r[i+1]-o)}t+=this.getFrameEntries();let l=r[h-2],n=r[h-1];return n+(e-l)/(this.frames[t]-l)*(this.frames[t+s]-n)}},yt=class extends Ct{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let r=2;r<=s;r+=2)if(t[r]>e){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=t[s],h=t[s+1];return h+(e-r)/(t[s+2]-r)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let h=this.getCurveValue(e);switch(s){case 0:return r+h*t;case 1:case 2:h+=r-i}return i+h*t}getAbsoluteValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}let h=this.getCurveValue(e);return s==0?r+(h-r)*t:i+(h-i)*t}getAbsoluteValue2(e,t,s,i,r,h){if(e<this.frames[0]){switch(s){case 0:return r;case 1:return i+(r-i)*t}return i}return s==0?r+(h-r)*t:i+(h-i)*t}getScaleValue(e,t,s,i,r,h){const l=this.frames;if(e<l[0]){switch(s){case 0:return h;case 1:return r+(h-r)*t}return r}let n=this.getCurveValue(e)*h;if(t==1)return s==3?r+n-h:n;if(i==1)switch(s){case 0:return h+(Math.abs(n)*P.signum(h)-h)*t;case 1:case 2:return r+(Math.abs(n)*P.signum(r)-r)*t}else{let a=0;switch(s){case 0:return a=Math.abs(h)*P.signum(n),a+(n-a)*t;case 1:case 2:return a=Math.abs(r)*P.signum(n),a+(n-a)*t}}return r+(n-h)*t}},ae=class extends Ct{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}},Qt=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.rotate+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(s,r,h,n.rotation,n.data.rotation))}},Re=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,it.x+"|"+s,it.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let o=0,c=0,d=ft.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];o=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*u,c+=(a[d+3+2]-c)*u;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(h){case 0:n.x=n.data.x+o*r,n.y=n.data.y+c*r;break;case 1:case 2:n.x+=(n.data.x+o-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case 3:n.x+=o*r,n.y+=c*r}}},Ye=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.x+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(s,r,h,n.x,n.data.x))}},ke=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.y+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(s,r,h,n.y,n.data.y))}},Fe=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,it.scaleX+"|"+s,it.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let o,c,d=ft.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];o=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*u,c+=(a[d+3+2]-c)*u;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(o*=n.data.scaleX,c*=n.data.scaleY,r==1)h==3?(n.scaleX+=o-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=o,n.scaleY=c);else{let m=0,u=0;if(l==1)switch(h){case 0:m=n.data.scaleX,u=n.data.scaleY,n.scaleX=m+(Math.abs(o)*P.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*P.signum(u)-u)*r;break;case 1:case 2:m=n.scaleX,u=n.scaleY,n.scaleX=m+(Math.abs(o)*P.signum(m)-m)*r,n.scaleY=u+(Math.abs(c)*P.signum(u)-u)*r;break;case 3:n.scaleX+=(o-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(h){case 0:m=Math.abs(n.data.scaleX)*P.signum(o),u=Math.abs(n.data.scaleY)*P.signum(c),n.scaleX=m+(o-m)*r,n.scaleY=u+(c-u)*r;break;case 1:case 2:m=Math.abs(n.scaleX)*P.signum(o),u=Math.abs(n.scaleY)*P.signum(c),n.scaleX=m+(o-m)*r,n.scaleY=u+(c-u)*r;break;case 3:n.scaleX+=(o-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},Xe=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.scaleX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(s,r,h,l,n.scaleX,n.data.scaleX))}},Pe=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.scaleY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(s,r,h,l,n.scaleY,n.data.scaleY))}},Le=class extends ae{boneIndex=0;constructor(e,t,s){super(e,t,it.shearX+"|"+s,it.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let o=0,c=0,d=ft.search(a,s,3),f=this.curves[d/3];switch(f){case 0:let m=a[d];o=a[d+1],c=a[d+2];let u=(s-m)/(a[d+3]-m);o+=(a[d+3+1]-o)*u,c+=(a[d+3+2]-c)*u;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(h){case 0:n.shearX=n.data.shearX+o*r,n.shearY=n.data.shearY+c*r;break;case 1:case 2:n.shearX+=(n.data.shearX+o-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case 3:n.shearX+=o*r,n.shearY+=c*r}}},Be=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.shearX+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(s,r,h,n.shearX,n.data.shearX))}},Ve=class extends yt{boneIndex=0;constructor(e,t,s){super(e,t,it.shearY+"|"+s),this.boneIndex=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(s,r,h,n.shearY,n.data.shearY))}},Oe=class extends ft{boneIndex=0;constructor(e,t){super(e,[it.inherit+"|"+t]),this.boneIndex=t}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,i,r,h,l){let n=e.bones[this.boneIndex];if(!n.active)return;if(l==1){h==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(s<a[0]){(h==0||h==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[ft.search(a,s,2)+1]}},De=class extends Ct{slotIndex=0;constructor(e,t,s){super(e,t,[it.rgb+"|"+s,it.alpha+"|"+s]),this.slotIndex=s}getFrameEntries(){return 5}setFrame(e,t,s,i,r,h){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color;if(s<a[0]){let w=n.data.color;switch(h){case 0:o.setFromColor(w);return;case 1:o.add((w.r-o.r)*r,(w.g-o.g)*r,(w.b-o.b)*r,(w.a-o.a)*r)}return}let c=0,d=0,f=0,m=0,u=ft.search(a,s,5),g=this.curves[u/5];switch(g){case 0:let w=a[u];c=a[u+1],d=a[u+2],f=a[u+3],m=a[u+4];let b=(s-w)/(a[u+5]-w);c+=(a[u+5+1]-c)*b,d+=(a[u+5+2]-d)*b,f+=(a[u+5+3]-f)*b,m+=(a[u+5+4]-m)*b;break;case 1:c=a[u+1],d=a[u+2],f=a[u+3],m=a[u+4];break;default:c=this.getBezierValue(s,u,1,g-2),d=this.getBezierValue(s,u,2,g+18-2),f=this.getBezierValue(s,u,3,g+18*2-2),m=this.getBezierValue(s,u,4,g+18*3-2)}r==1?o.set(c,d,f,m):(h==0&&o.setFromColor(n.data.color),o.add((c-o.r)*r,(d-o.g)*r,(f-o.b)*r,(m-o.a)*r))}},Ne=class extends Ct{slotIndex=0;constructor(e,t,s){super(e,t,[it.rgb+"|"+s]),this.slotIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color;if(s<a[0]){let g=n.data.color;switch(h){case 0:o.r=g.r,o.g=g.g,o.b=g.b;return;case 1:o.r+=(g.r-o.r)*r,o.g+=(g.g-o.g)*r,o.b+=(g.b-o.b)*r}return}let c=0,d=0,f=0,m=ft.search(a,s,4),u=this.curves[m>>2];switch(u){case 0:let g=a[m];c=a[m+1],d=a[m+2],f=a[m+3];let w=(s-g)/(a[m+4]-g);c+=(a[m+4+1]-c)*w,d+=(a[m+4+2]-d)*w,f+=(a[m+4+3]-f)*w;break;case 1:c=a[m+1],d=a[m+2],f=a[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),d=this.getBezierValue(s,m,2,u+18-2),f=this.getBezierValue(s,m,3,u+18*2-2)}if(r==1)o.r=c,o.g=d,o.b=f;else{if(h==0){let g=n.data.color;o.r=g.r,o.g=g.g,o.b=g.b}o.r+=(c-o.r)*r,o.g+=(d-o.g)*r,o.b+=(f-o.b)*r}}},Ue=class extends yt{slotIndex=0;constructor(e,t,s){super(e,t,it.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s<this.frames[0]){let c=n.data.color;switch(h){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*r}return}let o=this.getCurveValue(s);r==1?a.a=o:(h==0&&(a.a=n.data.color.a),a.a+=(o-a.a)*r)}},ze=class extends Ct{slotIndex=0;constructor(e,t,s){super(e,t,[it.rgb+"|"+s,it.alpha+"|"+s,it.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 8}setFrame(e,t,s,i,r,h,l,n,a){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h,this.frames[e+5]=l,this.frames[e+6]=n,this.frames[e+7]=a}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color,c=n.darkColor;if(s<a[0]){let v=n.data.color,y=n.data.darkColor;switch(h){case 0:o.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:o.add((v.r-o.r)*r,(v.g-o.g)*r,(v.b-o.b)*r,(v.a-o.a)*r),c.r+=(y.r-c.r)*r,c.g+=(y.g-c.g)*r,c.b+=(y.b-c.b)*r}return}let d=0,f=0,m=0,u=0,g=0,w=0,b=0,x=ft.search(a,s,8),p=this.curves[x>>3];switch(p){case 0:let v=a[x];d=a[x+1],f=a[x+2],m=a[x+3],u=a[x+4],g=a[x+5],w=a[x+6],b=a[x+7];let y=(s-v)/(a[x+8]-v);d+=(a[x+8+1]-d)*y,f+=(a[x+8+2]-f)*y,m+=(a[x+8+3]-m)*y,u+=(a[x+8+4]-u)*y,g+=(a[x+8+5]-g)*y,w+=(a[x+8+6]-w)*y,b+=(a[x+8+7]-b)*y;break;case 1:d=a[x+1],f=a[x+2],m=a[x+3],u=a[x+4],g=a[x+5],w=a[x+6],b=a[x+7];break;default:d=this.getBezierValue(s,x,1,p-2),f=this.getBezierValue(s,x,2,p+18-2),m=this.getBezierValue(s,x,3,p+18*2-2),u=this.getBezierValue(s,x,4,p+18*3-2),g=this.getBezierValue(s,x,5,p+18*4-2),w=this.getBezierValue(s,x,6,p+18*5-2),b=this.getBezierValue(s,x,7,p+18*6-2)}if(r==1)o.set(d,f,m,u),c.r=g,c.g=w,c.b=b;else{if(h==0){o.setFromColor(n.data.color);let v=n.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}o.add((d-o.r)*r,(f-o.g)*r,(m-o.b)*r,(u-o.a)*r),c.r+=(g-c.r)*r,c.g+=(w-c.g)*r,c.b+=(b-c.b)*r}}},We=class extends Ct{slotIndex=0;constructor(e,t,s){super(e,t,[it.rgb+"|"+s,it.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,h,l,n){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h,this.frames[e+5]=l,this.frames[e+6]=n}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color,c=n.darkColor;if(s<a[0]){let v=n.data.color,y=n.data.darkColor;switch(h){case 0:o.r=v.r,o.g=v.g,o.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:o.r+=(v.r-o.r)*r,o.g+=(v.g-o.g)*r,o.b+=(v.b-o.b)*r,c.r+=(y.r-c.r)*r,c.g+=(y.g-c.g)*r,c.b+=(y.b-c.b)*r}return}let d=0,f=0,m=0,u=0,g=0,w=0,b=0,x=ft.search(a,s,7),p=this.curves[x/7];switch(p){case 0:let v=a[x];d=a[x+1],f=a[x+2],m=a[x+3],g=a[x+4],w=a[x+5],b=a[x+6];let y=(s-v)/(a[x+7]-v);d+=(a[x+7+1]-d)*y,f+=(a[x+7+2]-f)*y,m+=(a[x+7+3]-m)*y,g+=(a[x+7+4]-g)*y,w+=(a[x+7+5]-w)*y,b+=(a[x+7+6]-b)*y;break;case 1:d=a[x+1],f=a[x+2],m=a[x+3],g=a[x+4],w=a[x+5],b=a[x+6];break;default:d=this.getBezierValue(s,x,1,p-2),f=this.getBezierValue(s,x,2,p+18-2),m=this.getBezierValue(s,x,3,p+18*2-2),g=this.getBezierValue(s,x,4,p+18*3-2),w=this.getBezierValue(s,x,5,p+18*4-2),b=this.getBezierValue(s,x,6,p+18*5-2)}if(r==1)o.r=d,o.g=f,o.b=m,c.r=g,c.g=w,c.b=b;else{if(h==0){let v=n.data.color,y=n.data.darkColor;o.r=v.r,o.g=v.g,o.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}o.r+=(d-o.r)*r,o.g+=(f-o.g)*r,o.b+=(m-o.b)*r,c.r+=(g-c.r)*r,c.g+=(w-c.g)*r,c.b+=(b-c.b)*r}}},Ot=class extends ft{slotIndex=0;attachmentNames;constructor(e,t){super(e,[it.attachment+"|"+t]),this.slotIndex=t,this.attachmentNames=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(n.bone.active){if(l==1){h==0&&this.setAttachment(e,n,n.data.attachmentName);return}if(s<this.frames[0]){(h==0||h==1)&&this.setAttachment(e,n,n.data.attachmentName);return}this.setAttachment(e,n,this.attachmentNames[ft.search1(this.frames,s)])}}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},qe=class extends Ct{slotIndex=0;attachment;vertices;constructor(e,t,s,i){super(e,t,[it.deform+"|"+s+"|"+i.id]),this.slotIndex=s,this.attachment=i,this.vertices=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,i,r,h,l,n,a,o,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(i-h*2+n)*.03,u=a*.03-l*.06,g=((h-n)*3-i+o)*.006,w=(l-a+.33333333)*.018,b=m*2+g,x=u*2+w,p=(h-i)*.3+m+g*.16666667,v=l*.3+u+w*.16666667,y=i+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 s=this.curves,i=s[t];switch(i){case 0:let n=this.frames[t];return(e-n)/(this.frames[t+this.getFrameEntries()]-n);case 1:return 0}if(i-=2,s[i]>e){let n=this.frames[t];return s[i+1]*(e-n)/(s[i]-n)}let r=i+18;for(i+=2;i<r;i+=2)if(s[i]>=e){let n=s[i-2],a=s[i-1];return a+(e-n)/(s[i]-n)*(s[i+1]-a)}let h=s[r-2],l=s[r-1];return l+(1-l)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof Yt)||a.timelineAttachment!=this.attachment)return;let o=n.deform;o.length==0&&(h=0);let c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(h){case 0:o.length=0;return;case 1:if(r==1){o.length=0;return}o.length=d;let x=a;if(x.bones){r=1-r;for(var m=0;m<d;m++)o[m]*=r}else{let p=x.vertices;for(var m=0;m<d;m++)o[m]+=(p[m]-o[m])*r}}return}if(o.length=d,s>=f[f.length-1]){let x=c[f.length-1];if(r==1)if(h==3){let p=a;if(p.bones)for(let v=0;v<d;v++)o[v]+=x[v];else{let v=p.vertices;for(let y=0;y<d;y++)o[y]+=x[y]-v[y]}}else L.arrayCopy(x,0,o,0,d);else switch(h){case 0:{let v=a;if(v.bones)for(let y=0;y<d;y++)o[y]=x[y]*r;else{let y=v.vertices;for(let A=0;A<d;A++){let C=y[A];o[A]=C+(x[A]-C)*r}}break}case 1:case 2:for(let v=0;v<d;v++)o[v]+=(x[v]-o[v])*r;break;case 3:let p=a;if(p.bones)for(let v=0;v<d;v++)o[v]+=x[v]*r;else{let v=p.vertices;for(let y=0;y<d;y++)o[y]+=(x[y]-v[y])*r}}return}let u=ft.search1(f,s),g=this.getCurvePercent(s,u),w=c[u],b=c[u+1];if(r==1)if(h==3){let x=a;if(x.bones)for(let p=0;p<d;p++){let v=w[p];o[p]+=v+(b[p]-v)*g}else{let p=x.vertices;for(let v=0;v<d;v++){let y=w[v];o[v]+=y+(b[v]-y)*g-p[v]}}}else for(let x=0;x<d;x++){let p=w[x];o[x]=p+(b[x]-p)*g}else switch(h){case 0:{let p=a;if(p.bones)for(let v=0;v<d;v++){let y=w[v];o[v]=(y+(b[v]-y)*g)*r}else{let v=p.vertices;for(let y=0;y<d;y++){let A=w[y],C=v[y];o[y]=C+(A+(b[y]-A)*g-C)*r}}break}case 1:case 2:for(let p=0;p<d;p++){let v=w[p];o[p]+=(v+(b[p]-v)*g-o[p])*r}break;case 3:let x=a;if(x.bones)for(let p=0;p<d;p++){let v=w[p];o[p]+=(v+(b[p]-v)*g)*r}else{let p=x.vertices;for(let v=0;v<d;v++){let y=w[v];o[v]+=(y+(b[v]-y)*g-p[v])*r}}}}},le=class Li extends ft{static propertyIds=[""+it.event];events;constructor(t){super(t,Li.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,i,r,h,l,n){if(!r)return;let a=this.frames,o=this.frames.length;if(s>i)this.apply(t,s,Number.MAX_VALUE,r,h,l,n),s=-1;else if(s>=a[o-1])return;if(i<a[0])return;let c=0;if(s<a[0])c=0;else{c=ft.search1(a,s)+1;let d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<o&&i>=a[c];c++)r.push(this.events[c])}},zt=class Bi extends ft{static propertyIds=[""+it.drawOrder];drawOrders;constructor(t){super(t,Bi.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,r,h,l,n){if(n==1){l==0&&L.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(i<this.frames[0]){(l==0||l==1)&&L.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let a=ft.search1(this.frames,i),o=this.drawOrders[a];if(!o)L.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let c=t.drawOrder,d=t.slots;for(let f=0,m=o.length;f<m;f++)c[f]=d[o[f]]}}},Ge=class extends Ct{constraintIndex=0;constructor(e,t,s){super(e,t,[it.ikConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,i,r,h,l){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h?1:0,this.frames[e+5]=l?1:0}apply(e,t,s,i,r,h,l){let n=e.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let o=0,c=0,d=ft.search(a,s,6),f=this.curves[d/6];switch(f){case 0:let m=a[d];o=a[d+1],c=a[d+2];let u=(s-m)/(a[d+6]-m);o+=(a[d+6+1]-o)*u,c+=(a[d+6+2]-c)*u;break;case 1:o=a[d+1],c=a[d+2];break;default:o=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}h==0?(n.mix=n.data.mix+(o-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,l==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0)):(n.mix+=(o-n.mix)*r,n.softness+=(c-n.softness)*r,l==0&&(n.bendDirection=a[d+3],n.compress=a[d+4]!=0,n.stretch=a[d+5]!=0))}},He=class extends Ct{constraintIndex=0;constructor(e,t,s){super(e,t,[it.transformConstraint+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,h,l,n){let a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=i,a[e+3]=r,a[e+4]=h,a[e+5]=l,a[e+6]=n}apply(e,t,s,i,r,h,l){let n=e.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){let b=n.data;switch(h){case 0:n.mixRotate=b.mixRotate,n.mixX=b.mixX,n.mixY=b.mixY,n.mixScaleX=b.mixScaleX,n.mixScaleY=b.mixScaleY,n.mixShearY=b.mixShearY;return;case 1:n.mixRotate+=(b.mixRotate-n.mixRotate)*r,n.mixX+=(b.mixX-n.mixX)*r,n.mixY+=(b.mixY-n.mixY)*r,n.mixScaleX+=(b.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(b.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(b.mixShearY-n.mixShearY)*r}return}let o,c,d,f,m,u,g=ft.search(a,s,7),w=this.curves[g/7];switch(w){case 0:let b=a[g];o=a[g+1],c=a[g+2],d=a[g+3],f=a[g+4],m=a[g+5],u=a[g+6];let x=(s-b)/(a[g+7]-b);o+=(a[g+7+1]-o)*x,c+=(a[g+7+2]-c)*x,d+=(a[g+7+3]-d)*x,f+=(a[g+7+4]-f)*x,m+=(a[g+7+5]-m)*x,u+=(a[g+7+6]-u)*x;break;case 1:o=a[g+1],c=a[g+2],d=a[g+3],f=a[g+4],m=a[g+5],u=a[g+6];break;default:o=this.getBezierValue(s,g,1,w-2),c=this.getBezierValue(s,g,2,w+18-2),d=this.getBezierValue(s,g,3,w+18*2-2),f=this.getBezierValue(s,g,4,w+18*3-2),m=this.getBezierValue(s,g,5,w+18*4-2),u=this.getBezierValue(s,g,6,w+18*5-2)}if(h==0){let b=n.data;n.mixRotate=b.mixRotate+(o-b.mixRotate)*r,n.mixX=b.mixX+(c-b.mixX)*r,n.mixY=b.mixY+(d-b.mixY)*r,n.mixScaleX=b.mixScaleX+(f-b.mixScaleX)*r,n.mixScaleY=b.mixScaleY+(m-b.mixScaleY)*r,n.mixShearY=b.mixShearY+(u-b.mixShearY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r,n.mixScaleX+=(f-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(u-n.mixShearY)*r}},_e=class extends yt{constraintIndex=0;constructor(e,t,s){super(e,t,it.pathConstraintPosition+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,l){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(s,r,h,n.position,n.data.position))}},je=class extends yt{constraintIndex=0;constructor(e,t,s){super(e,t,it.pathConstraintSpacing+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,l){let n=e.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(s,r,h,n.spacing,n.data.spacing))}},Ze=class extends Ct{constraintIndex=0;constructor(e,t,s){super(e,t,[it.pathConstraintMix+"|"+s]),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,i,r){let h=this.frames;e<<=2,h[e]=t,h[e+1]=s,h[e+2]=i,h[e+3]=r}apply(e,t,s,i,r,h,l){let n=e.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(s<a[0]){switch(h){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let o,c,d,f=ft.search(a,s,4),m=this.curves[f>>2];switch(m){case 0:let u=a[f];o=a[f+1],c=a[f+2],d=a[f+3];let g=(s-u)/(a[f+4]-u);o+=(a[f+4+1]-o)*g,c+=(a[f+4+2]-c)*g,d+=(a[f+4+3]-d)*g;break;case 1:o=a[f+1],c=a[f+2],d=a[f+3];break;default:o=this.getBezierValue(s,f,1,m-2),c=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(h==0){let u=n.data;n.mixRotate=u.mixRotate+(o-u.mixRotate)*r,n.mixX=u.mixX+(c-u.mixX)*r,n.mixY=u.mixY+(d-u.mixY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r}},Pt=class extends yt{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,l){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const o of e.physicsConstraints)o.active&&this.global(o.data)&&this.set(o,this.getAbsoluteValue2(s,r,h,this.get(o),this.setup(o),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,h,this.get(n),this.setup(n)))}},Ke=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Je=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Qe=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},$e=class extends Pt{constructor(e,t,s){super(e,t,s,it.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}},ts=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},es=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},ss=class extends Pt{constructor(e,t,s){super(e,t,s,it.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},is=class Vi extends ft{static propertyIds=[it.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,Vi.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,r,h,l,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const o=this.frames;if(s>i)this.apply(t,s,Number.MAX_VALUE,[],h,l,n),s=-1;else if(s>=o[o.length-1])return;if(!(i<o[0])&&(s<o[0]||i>=o[ft.search1(o,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},rs=class Lt extends ft{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,i){super(t,[it.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return Lt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,r,h){let l=this.frames;t*=Lt.ENTRIES,l[t]=s,l[t+Lt.MODE]=i|r<<4,l[t+Lt.DELAY]=h}apply(t,s,i,r,h,l,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let o=a.attachment,c=this.attachment;if(o!=c&&(!(o instanceof Yt)||o.timelineAttachment!=c))return;if(n==1){l==0&&(a.sequenceIndex=-1);return}let d=this.frames;if(i<d[0]){(l==0||l==1)&&(a.sequenceIndex=-1);return}let f=ft.search(d,i,Lt.ENTRIES),m=d[f],u=d[f+Lt.MODE],g=d[f+Lt.DELAY];if(!this.attachment.sequence)return;let w=u>>4,b=this.attachment.sequence.regions.length,x=_s[u&15];if(x!=0)switch(w+=(i-m)/g+1e-5|0,x){case 1:w=Math.min(b-1,w);break;case 2:w%=b;break;case 3:{let p=(b<<1)-2;w=p==0?0:w%p,w>=b&&(w=p-w);break}case 4:w=Math.max(b-1-w,0);break;case 5:w=b-1-w%b;break;case 6:{let p=(b<<1)-2;w=p==0?0:(w+b-1)%p,w>=b&&(w=p-w)}}a.sequenceIndex=w}},tr=class Ce{static _emptyAnimation=new ne("<empty>",[],0);static emptyAnimation(){return Ce._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Js(this);propertyIDs=new Ie;animationsChanged=!1;trackEntryPool=new Jt(()=>new Ks);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let l=t*h.timeScale;if(h.delay>0){if(h.delay-=l,h.delay>0)continue;l=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+t)*n.timeScale,h.trackTime+=l,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[i]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,t)){let a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=l}this.queue.drain()}updateMixingFrom(t,s){let i=t.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((i.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let f=0,m=i.length;f<m;f++){let u=i[f];if(!u||u.delay>0)continue;r=!0;let g=f==0?1:u.mixBlend,w=u.alpha;u.mixingFrom?w*=this.applyMixingFrom(u,t,g):u.trackTime>=u.trackEnd&&!u.next&&(w=0);let b=w>=u.alphaAttachmentThreshold,x=u.animationLast,p=u.getAnimationTime(),v=p,y=s;u.reverse&&(v=u.animation.duration-v,y=null);let A=u.animation.timelines,C=A.length;if(f==0&&w==1||g==3){f==0&&(b=!0);for(let S=0;S<C;S++){L.webkit602BugfixHelper(w,g);var h=A[S];h instanceof Ot?this.applyAttachmentTimeline(h,t,v,g,b):h.apply(t,x,v,y,w,g,0)}}else{let S=u.timelineMode,I=u.shortestRotation,Y=!I&&u.timelinesRotation.length!=C<<1;Y&&(u.timelinesRotation.length=C<<1);for(let k=0;k<C;k++){let F=A[k],X=S[k]==oe?g:0;!I&&F instanceof Qt?this.applyRotateTimeline(F,t,v,w,X,u.timelinesRotation,k<<1,Y):F instanceof Ot?this.applyAttachmentTimeline(F,t,v,g,b):(L.webkit602BugfixHelper(w,g),F.apply(t,x,v,y,w,X,0))}}this.queueEvents(u,p),s.length=0,u.nextAnimationLast=p,u.nextTrackLast=u.trackTime}for(var l=this.unkeyedState+ls,n=t.slots,a=0,o=t.slots.length;a<o;a++){var c=n[a];if(c.attachmentState==l){var d=c.data.attachmentName;c.setAttachment(d?t.getAttachment(c.data.index,d):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(t,s,i){let r=t.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,s,i);let h=0;t.mixDuration==0?(h=1,i==1&&(i=0)):(h=t.mixTime/t.mixDuration,h>1&&(h=1),i!=1&&(i=r.mixBlend));let l=h<r.mixAttachmentThreshold,n=h<r.mixDrawOrderThreshold,a=r.animation.timelines,o=a.length,c=r.alpha*t.interruptAlpha,d=c*(1-h),f=r.animationLast,m=r.getAnimationTime(),u=m,g=null;if(r.reverse?u=r.animation.duration-u:h<r.eventThreshold&&(g=this.events),i==3)for(let w=0;w<o;w++)a[w].apply(s,f,u,g,d,i,1);else{let w=r.timelineMode,b=r.timelineHoldMix,x=r.shortestRotation,p=!x&&r.timelinesRotation.length!=o<<1;p&&(r.timelinesRotation.length=o<<1),r.totalAlpha=0;for(let v=0;v<o;v++){let y=a[v],A=1,C,S=0;switch(w[v]){case oe:if(!n&&y instanceof zt)continue;C=i,S=d;break;case ns:C=0,S=d;break;case as:C=i,S=c;break;case he:C=0,S=c;break;default:C=0;let I=b[v];S=c*Math.max(0,1-I.mixTime/I.mixDuration);break}r.totalAlpha+=S,!x&&y instanceof Qt?this.applyRotateTimeline(y,s,u,S,C,r.timelinesRotation,v<<1,p):y instanceof Ot?this.applyAttachmentTimeline(y,s,u,C,l&&S>=r.alphaAttachmentThreshold):(L.webkit602BugfixHelper(S,i),n&&y instanceof zt&&C==0&&(A=0),y.apply(s,f,u,g,S,C,A))}}return t.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,h}applyAttachmentTimeline(t,s,i,r,h){var l=s.slots[t.slotIndex];l.bone.active&&(i<t.frames[0]?(r==0||r==1)&&this.setAttachment(s,l,l.data.attachmentName,h):this.setAttachment(s,l,t.attachmentNames[ft.search1(t.frames,i)],h),l.attachmentState<=this.unkeyedState&&(l.attachmentState=this.unkeyedState+ls))}setAttachment(t,s,i,r){s.setAttachment(i?t.getAttachment(s.data.index,i):null),r&&(s.attachmentState=this.unkeyedState+ti)}applyRotateTimeline(t,s,i,r,h,l,n,a){if(a&&(l[n]=0),r==1){t.apply(s,0,i,null,1,h,0);return}let o=s.bones[t.boneIndex];if(!o.active)return;let c=t.frames,d=0,f=0;if(i<c[0])switch(h){case 0:o.rotation=o.data.rotation;default:return;case 1:d=o.rotation,f=o.data.rotation}else d=h==0?o.data.rotation:o.rotation,f=o.data.rotation+t.getCurveValue(i);let m=0,u=f-d;if(u-=Math.ceil(u/360-.5)*360,u==0)m=l[n];else{let g=0,w=0;a?(g=0,w=u):(g=l[n],w=l[n+1]);let b=g-g%360;m=u+b;let x=u>=0,p=g>=0;Math.abs(w)<=90&&P.signum(w)!=P.signum(u)&&(Math.abs(g-b)>180?(m+=360*P.signum(g),p=x):b!=0?m-=360*P.signum(g):p=x),p!=x&&(m+=360*P.signum(g)),l[n]=m}l[n+1]=u,o.rotation=d+m*r}queueEvents(t,s){let i=t.animationStart,r=t.animationEnd,h=r-i,l=t.trackLast%h,n=this.events,a=0,o=n.length;for(;a<o;a++){let d=n[a];if(d.time<l)break;d.time>r||this.queue.event(t,d)}let c=!1;if(t.loop)if(h==0)c=!0;else{const d=Math.floor(t.trackTime/h);c=d>0&&d>Math.floor(t.trackLast/h)}else c=s>=r&&t.animationLast<r;for(c&&this.queue.complete(t);a<o;a++){let d=n[a];d.time<i||this.queue.event(t,d)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,i){let r=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,r,i)}setAnimationWith(t,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,h=this.expandToIndex(t);h&&(h.nextTrackLast==-1?(this.tracks[t]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,r=!1):this.clearNext(h));let l=this.trackEntry(t,s,i,h);return this.setCurrent(t,l,r),this.queue.drain(),l}addAnimation(t,s,i=!1,r=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,h,i,r)}addAnimationWith(t,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(t);if(h)for(;h.next;)h=h.next;let l=this.trackEntry(t,s,i,h);return h?(h.next=l,l.previous=h,r<=0&&(r=Math.max(r+h.getTrackComplete()-l.mixDuration,0))):(this.setCurrent(t,l,!0),this.queue.drain(),r<0&&(r=0)),l.delay=r,l}setEmptyAnimation(t,s=0){let i=this.setAnimationWith(t,Ce.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(t,s=0,i=0){let r=this.addAnimationWith(t,Ce.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i<r;i++){let h=this.tracks[i];h&&this.setEmptyAnimation(h.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(L.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,i,r){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=t,h.animation=s,h.loop=i,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=s.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=r?this.data.getMix(r.animation,s):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(t){let s=t.mixingTo,i=t.animation.timelines,r=t.animation.timelines.length,h=t.timelineMode;h.length=r;let l=t.timelineHoldMix;l.length=0;let n=this.propertyIDs;if(s&&s.holdPrevious){for(let a=0;a<r;a++)h[a]=n.addAll(i[a].getPropertyIds())?he:as;return}t:for(let a=0;a<r;a++){let o=i[a],c=o.getPropertyIds();if(!n.addAll(c))h[a]=oe;else if(!s||o instanceof Ot||o instanceof zt||o instanceof le||!s.animation.hasTimeline(c))h[a]=ns;else{for(let d=s.mixingTo;d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(t.mixDuration>0){h[a]=$s,l[a]=d;continue t}break}h[a]=he}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Ks=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,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),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}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Js=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),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 s=0;s<e.length;s+=2){let i=e[s],r=e[s+1];switch(i){case 0:r.listener&&r.listener.start&&r.listener.start(r);for(let l=0;l<t.length;l++){let n=t[l];n.start&&n.start(r)}break;case 1:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let l=0;l<t.length;l++){let n=t[l];n.interrupt&&n.interrupt(r)}break;case 2:r.listener&&r.listener.end&&r.listener.end(r);for(let l=0;l<t.length;l++){let n=t[l];n.end&&n.end(r)}case 3:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let l=0;l<t.length;l++){let n=t[l];n.dispose&&n.dispose(r)}this.animState.trackEntryPool.free(r);break;case 4:r.listener&&r.listener.complete&&r.listener.complete(r);for(let l=0;l<t.length;l++){let n=t[l];n.complete&&n.complete(r)}break;case 5:let h=e[s+++2];r.listener&&r.listener.event&&r.listener.event(r,h);for(let l=0;l<t.length;l++){let n=t[l];n.event&&n.event(r,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Qs=(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))(Qs||{}),er=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},oe=0,ns=1,as=2,he=3,$s=4,ls=1,ti=2,sr=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(i,r,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},os=class Oi extends Yt{color=new tt(1,1,1,1);constructor(t){super(t)}copy(){let t=new Oi(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},$t=class Di extends Yt{endSlot=null;color=new tt(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Di(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},hs=class{_image;constructor(e){this._image=e}getImage(){return this._image}},ce=(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))(ce||{}),ei=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(ei||{}),si=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},ir=class extends hs{setFilters(e,t){}setWraps(e,t){}dispose(){}},cs=class{pages=new Array;regions=new Array;constructor(e){let t=new rr(e),s=new Array(4),i={};i.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},i.format=()=>{},i.filter=o=>{o.minFilter=L.enumValue(ce,s[1]),o.magFilter=L.enumValue(ce,s[2])},i.repeat=o=>{s[1].indexOf("x")!=-1&&(o.uWrap=10497),s[1].indexOf("y")!=-1&&(o.vWrap=10497)},i.pma=o=>{o.pma=s[1]=="true"};var r={};r.xy=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2])},r.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},r.bounds=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2]),o.width=parseInt(s[3]),o.height=parseInt(s[4])},r.offset=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2])},r.orig=o=>{o.originalWidth=parseInt(s[1]),o.originalHeight=parseInt(s[2])},r.offsets=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2]),o.originalWidth=parseInt(s[3]),o.originalHeight=parseInt(s[4])},r.rotate=o=>{let c=s[1];c=="true"?o.degrees=90:c!="false"&&(o.degrees=parseInt(c))},r.index=o=>{o.index=parseInt(s[1])};let h=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(s,h)==0);)h=t.readLine();let l=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)l=null,h=t.readLine();else if(l){let o=new ds(l,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let d=r[s[0]];if(d)d(o);else{n||(n=[]),a||(a=[]),n.push(s[0]);let f=[];for(let m=0;m<c;m++)f.push(parseInt(s[m+1]));a.push(f)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height),n&&n.length>0&&a&&a.length>0&&(o.names=n,o.values=a,n=null,a=null),o.u=o.x/l.width,o.v=o.y/l.height,o.degrees==90?(o.u2=(o.x+o.height)/l.width,o.v2=(o.y+o.width)/l.height):(o.u2=(o.x+o.width)/l.width,o.v2=(o.y+o.height)/l.height),this.regions.push(o)}else{for(l=new ii(h.trim());t.readEntry(s,h=t.readLine())!=0;){let o=i[s[0]];o&&o(l)}this.pages.push(l)}}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 s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},rr=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 s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,r=s+1;;i++){let h=t.indexOf(",",r);if(h==-1)return e[i]=t.substr(r).trim(),i;if(e[i]=t.substr(r,h-r).trim(),r=h+1,i==4)return 4}}},ii=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}},ds=class extends si{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)}},Wt=class Os extends Yt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new tt(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new tt(0,0,0,0);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=L.newFloatArray(t.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,h=this.region.v,l=0,n=0;if(this.region instanceof ds){let a=this.region,o=a.page,c=o.width,d=o.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/d,l=a.originalHeight/c,n=a.originalWidth/d;for(let f=0;f<i;f+=2)s[f]=r+t[f+1]*l,s[f+1]=h+(1-t[f])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,h-=a.offsetY/d,l=a.originalWidth/c,n=a.originalHeight/d;for(let f=0;f<i;f+=2)s[f]=r+(1-t[f])*l,s[f+1]=h+(1-t[f+1])*n;return;case 270:r-=a.offsetY/c,h-=a.offsetX/d,l=a.originalHeight/c,n=a.originalWidth/d;for(let f=0;f<i;f+=2)s[f]=r+(1-t[f+1])*l,s[f+1]=h+t[f]*n;return}r-=a.offsetX/c,h-=(a.originalHeight-a.offsetY-a.height)/d,l=a.originalWidth/c,n=a.originalHeight/d}else this.region?(l=this.region.u2-r,n=this.region.v2-h):(r=h=0,l=n=1);for(let a=0;a<i;a+=2)s[a]=r+t[a]*l,s[a+1]=h+t[a+1]*n}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Os(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),L.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),L.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),L.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),L.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,i,r,h,l){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,i,r,h,l)}newLinkedMesh(){let t=new Os(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}},qt=class Ni extends Yt{lengths=[];closed=!1;constantSpeed=!1;color=new tt(1,1,1,1);constructor(t){super(t)}copy(){let t=new Ni(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),L.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},ri=class Ui extends Yt{x=0;y=0;rotation=0;color=new tt(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*P.degRad,i=Math.cos(s),r=Math.sin(s),h=i*t.a+r*t.b,l=i*t.c+r*t.d;return P.atan2Deg(l,h)}copy(){let t=new Ui(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},te=class zi extends Ee{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new tt(1,1,1,1);path;region=null;sequence=null;offset=L.newFloatArray(8);uvs=L.newFloatArray(8);tempColor=new tt(1,1,1,1);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*i,l=-this.height/2*this.scaleY+this.region.offsetY*r,n=h+this.region.width*i,a=l+this.region.height*r,o=this.rotation*P.degRad,c=Math.cos(o),d=Math.sin(o),f=this.x,m=this.y,u=h*c+f,g=h*d,w=l*c+m,b=l*d,x=n*c+f,p=n*d,v=a*c+m,y=a*d,A=this.offset;A[0]=u-b,A[1]=w+g,A[2]=u-y,A[3]=v+g,A[4]=x-y,A[5]=v+p,A[6]=x-b,A[7]=w+p,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,i,r){this.sequence!=null&&this.sequence.apply(t,this);let h=t.bone,l=this.offset,n=h.worldX,a=h.worldY,o=h.a,c=h.b,d=h.c,f=h.d,m=0,u=0;m=l[0],u=l[1],s[i]=m*o+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=l[2],u=l[3],s[i]=m*o+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=l[4],u=l[5],s[i]=m*o+u*c+n,s[i+1]=m*d+u*f+a,i+=r,m=l[6],u=l[7],s[i]=m*o+u*c+n,s[i+1]=m*d+u*f+a}copy(){let t=new zi(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,L.arrayCopy(this.uvs,0,t.uvs,0,8),L.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},nr=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let r=0,h=i.length;r<h;r++){let l=s.getPath(t,r),n=this.atlas.findRegion(l);if(n==null)throw new Error("Region not found in atlas: "+l+" (sequence: "+e+")");i[r]=n}}newRegionAttachment(e,t,s,i){let r=new te(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");r.region=h}return r}newMeshAttachment(e,t,s,i){let r=new Wt(t,s);if(i!=null)this.loadSequence(t,s,i);else{let h=this.atlas.findRegion(s);if(!h)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");r.region=h}return r}newBoundingBoxAttachment(e,t){return new os(t)}newPathAttachment(e,t){return new qt(t)}newPointAttachment(e,t){return new ri(t)}newClippingAttachment(e,t){return new $t(t)}},fs=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new tt;icon;visible=!1;constructor(e,t,s){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=s}},de=(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))(de||{}),us=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,s){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=s,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,s,i,r,h,l){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=h,this.ashearY=l;let n=this.parent;if(!n){let f=this.skeleton;const m=f.scaleX,u=f.scaleY,g=(s+h)*P.degRad,w=(s+90+l)*P.degRad;this.a=Math.cos(g)*i*m,this.b=Math.cos(w)*r*m,this.c=Math.sin(g)*i*u,this.d=Math.sin(w)*r*u,this.worldX=e*m+f.x,this.worldY=t*u+f.y;return}let a=n.a,o=n.b,c=n.c,d=n.d;switch(this.worldX=a*e+o*t+n.worldX,this.worldY=c*e+d*t+n.worldY,this.inherit){case 0:{const f=(s+h)*P.degRad,m=(s+90+l)*P.degRad,u=Math.cos(f)*i,g=Math.cos(m)*r,w=Math.sin(f)*i,b=Math.sin(m)*r;this.a=a*u+o*w,this.b=a*g+o*b,this.c=c*u+d*w,this.d=c*g+d*b;return}case 1:{const f=(s+h)*P.degRad,m=(s+90+l)*P.degRad;this.a=Math.cos(f)*i,this.b=Math.cos(m)*r,this.c=Math.sin(f)*i,this.d=Math.sin(m)*r;break}case 2:{let f=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=f,c*=m;let u=a*a+c*c,g=0;u>1e-4?(u=Math.abs(a*d*m-o*f*c)/u,o=c*u,d=a*u,g=Math.atan2(c,a)*P.radDeg):(a=0,c=0,g=90-Math.atan2(d,o)*P.radDeg);const w=(s+h-g)*P.degRad,b=(s+l-g+90)*P.degRad,x=Math.cos(w)*i,p=Math.cos(b)*r,v=Math.sin(w)*i,y=Math.sin(b)*r;this.a=a*x-o*v,this.b=a*p-o*y,this.c=c*x+d*v,this.d=c*p+d*y;break}case 3:case 4:{s*=P.degRad;const f=Math.cos(s),m=Math.sin(s);let u=(a*f+o*m)/this.skeleton.scaleX,g=(c*f+d*m)/this.skeleton.scaleY,w=Math.sqrt(u*u+g*g);w>1e-5&&(w=1/w),u*=w,g*=w,w=Math.sqrt(u*u+g*g),this.inherit==3&&a*d-o*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),s=Math.PI/2+Math.atan2(g,u);const b=Math.cos(s)*w,x=Math.sin(s)*w;h*=P.degRad,l=(90+l)*P.degRad;const p=Math.cos(h)*i,v=Math.cos(l)*r,y=Math.sin(h)*i,A=Math.sin(l)*r;this.a=u*p+b*y,this.b=u*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)*P.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)*P.radDeg;return}let t=e.a,s=e.b,i=e.c,r=e.d,h=1/(t*r-s*i),l=r*h,n=s*h,a=i*h,o=t*h,c=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=c*l-d*n,this.ay=d*o-c*a;let f,m,u,g;if(this.inherit==1)f=this.a,m=this.b,u=this.c,g=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*r-s*i)/(t*t+i*i);s=-i*this.skeleton.scaleX*v/this.skeleton.scaleY,r=t*this.skeleton.scaleY*v/this.skeleton.scaleX,h=1/(t*r-s*i),l=r*h,n=s*h;break}case 3:case 4:let w=P.cosDeg(this.rotation),b=P.sinDeg(this.rotation);t=(t*w+s*b)/this.skeleton.scaleX,i=(i*w+r*b)/this.skeleton.scaleY;let x=Math.sqrt(t*t+i*i);x>1e-5&&(x=1/x),t*=x,i*=x,x=Math.sqrt(t*t+i*i),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);let p=P.PI/2+Math.atan2(i,t);s=Math.cos(p)*x,r=Math.sin(p)*x,h=1/(t*r-s*i),l=r*h,n=s*h,a=i*h,o=t*h}f=l*this.a-n*this.c,m=l*this.b-n*this.d,u=o*this.c-a*this.a,g=o*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+u*u),this.ascaleX>1e-4){let w=f*g-m*u;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(f*m+u*g,w)*P.radDeg,this.arotation=Math.atan2(u,f)*P.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,m)*P.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*P.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*P.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),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*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=P.sinDeg(e),s=P.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*P.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=P.sinDeg(e),s=P.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*P.radDeg}rotateWorld(e){e*=P.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,r=this.b;this.a=s*i-t*this.c,this.b=s*r-t*this.d,this.c=t*i+s*this.c,this.d=t*r+s*this.d}},ee=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},ni=class{pathPrefix="";textureLoader;downloader;assets={};assetsRefCount={};assetsLoaded={};errors={};toLoad=0;loaded=0;constructor(e,t="",s=new ms){this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,this.assetsRefCount[t]=(this.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadBinary(e,h=>{this.success(t,e,h),i(h)},(h,l)=>{const n=`Couldn't load binary ${e}: status ${h}, ${l}`;this.error(s,e,n),r(n)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,r)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${r}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadJson(e,h=>{this.success(t,e,h),i(h)},(h,l)=>{const n=`Couldn't load JSON ${e}: status ${h}, ${l}`;this.error(s,e,n),r(n)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const i=this.assetsLoaded[e],r=i!==void 0;return r&&i.then(h=>this.success(t,e,h)).catch(h=>this.error(s,e,h)),r}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.assetsLoaded[e]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.textureLoader(n);this.success(t,e,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.textureLoader(n);this.success(t,e,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),r(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let r=e.lastIndexOf("/"),h=r>=0?e.substring(0,r+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.assetsLoaded[e]=new Promise((l,n)=>{this.downloader.downloadText(e,a=>{try{let o=new cs(a),c=o.pages.length,d=!1;for(let f of o.pages)this.loadTexture(i?i[f.name]:h+f.name,(m,u)=>{d||(f.setTexture(u),--c==0&&(this.success(t,e,o),l(o)))},(m,u)=>{if(!d){const g=`Couldn't load texture atlas ${e} page image: ${m}`;this.error(s,e,g),n(g)}d=!0})}catch(o){const c=`Couldn't parse texture atlas ${e}: ${o.message}`;this.error(s,e,c),n(c)}},(a,o)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${o}`;this.error(s,e,c),n(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},i){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.assetsLoaded[e]=new Promise((r,h)=>{this.downloader.downloadText(e,l=>{try{const n=new cs(l);this.success(t,e,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),h(a)}},(l,n)=>{const a=`Couldn't load texture atlas ${e}: status ${l}, ${n}`;this.error(s,e,a),h(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(i,r)=>t(r),(i,r)=>s(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 s=this.errors[e];throw Error("Asset not found: "+e+(s?`
|
|
2
|
+
`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],delete this.assetsRefCount[e],delete this.assetsLoaded[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={},this.assetsLoaded={},this.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){--this.assetsRefCount[e]===0&&this.remove(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},ms=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),s=t.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=t.charCodeAt(r);return i}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,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToString(i))}catch(l){this.finish(e,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",i||e,!0);let h=()=>{this.finish(e,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(l){this.finish(e,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.open("GET",i||e,!0),r.responseType="arraybuffer";let h=()=>{this.finish(e,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(e,200,new Uint8Array(r.response)):h()},r.onerror=h,r.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let r=t==200||t==0?[s]:[t,s];for(let h=r.length-1,l=i.length;h<l;h+=2)i[h].apply(null,r)}},gs=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}},xs=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},ai=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 i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,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,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,r,h,l){let n=e.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,o=n.b,c=n.c,d=n.d,f=-e.ashearX-e.arotation,m=0,u=0;switch(e.inherit){case 1:m=(t-e.worldX)*P.signum(e.skeleton.scaleX),u=(s-e.worldY)*P.signum(e.skeleton.scaleY);break;case 2:let b=Math.abs(a*d-o*c)/Math.max(1e-4,a*a+c*c),x=a/e.skeleton.scaleX,p=c/e.skeleton.scaleY;o=-p*b*e.skeleton.scaleX,d=x*b*e.skeleton.scaleY,f+=Math.atan2(p,x)*P.radDeg;default:let v=t-n.worldX,y=s-n.worldY,A=a*d-o*c;Math.abs(A)<=1e-4?(m=0,u=0):(m=(v*d-y*o)/A-e.ax,u=(y*a-v*c)/A-e.ay)}f+=Math.atan2(u,m)*P.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=e.ascaleX,w=e.ascaleY;if(i||r){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const b=e.data.length*g;if(b>1e-4){const x=m*m+u*u;if(i&&x<b*b||r&&x>b*b){const p=(Math.sqrt(x)/b-1)*l+1;g*=p,h&&(w*=p)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*l,g,w,e.ashearX,e.ashearY)}apply2(e,t,s,i,r,h,l,n,a){if(e.inherit!=0||t.inherit!=0)return;let o=e.ax,c=e.ay,d=e.ascaleX,f=e.ascaleY,m=d,u=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,S=e.b,I=e.c,Y=e.d,k=Math.abs(d-f)<=1e-4;!k||h?(v=0,y=C*p+e.worldX,A=I*p+e.worldY):(v=t.ay,y=C*p+S*v+e.worldX,A=I*p+Y*v+e.worldY);let F=e.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,S=F.b,I=F.c,Y=F.d;let X=C*Y-S*I,E=y-F.worldX,R=A-F.worldY;X=Math.abs(X)<=1e-4?0:1/X;let B=(E*Y-R*S)*X-o,st=(R*C-E*I)*X-c,et=Math.sqrt(B*B+st*st),rt=t.data.length*g,ct,ot;if(et<1e-4){this.apply1(e,s,i,!1,h,!1,a),t.updateWorldTransformWith(p,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}E=s-F.worldX,R=i-F.worldY;let ut=(E*Y-R*S)*X-o,Z=(R*C-E*I)*X-c,nt=ut*ut+Z*Z;if(n!=0){n*=d*(g+1)*.5;let mt=Math.sqrt(nt),pt=mt-et-rt*d+n;if(pt>0){let wt=Math.min(1,pt/(n*2))-1;wt=(pt-n*(1-wt*wt))/mt,ut-=wt*ut,Z-=wt*Z,nt=ut*ut+Z*Z}}t:if(k){rt*=d;let mt=(nt-et*et-rt*rt)/(2*et*rt);mt<-1?(mt=-1,ot=Math.PI*r):mt>1?(mt=1,ot=0,h&&(C=(Math.sqrt(nt)/(et+rt)-1)*a+1,m*=C,l&&(u*=C))):ot=Math.acos(mt)*r,C=et+rt*mt,S=rt*Math.sin(ot),ct=Math.atan2(Z*C-ut*S,ut*C+Z*S)}else{C=d*rt,S=f*rt;let mt=C*C,pt=S*S,wt=Math.atan2(Z,ut);I=pt*et*et+mt*nt-mt*pt;let Mt=-2*pt*et,jt=pt-mt;if(Y=Mt*Mt-4*jt*I,Y>=0){let Zt=Math.sqrt(Y);Mt<0&&(Zt=-Zt),Zt=-(Mt+Zt)*.5;let re=Zt/jt,Xi=I/Zt,ye=Math.abs(re)<Math.abs(Xi)?re:Xi;if(re=nt-ye*ye,re>=0){R=Math.sqrt(re)*r,ct=wt-Math.atan2(R,ye),ot=Math.atan2(R/f,(ye-et)/d);break t}}let ie=P.PI,be=et-C,Bs=be*be,Yi=0,ki=0,ve=et+C,Vs=ve*ve,Fi=0;I=-C*et/(mt-pt),I>=-1&&I<=1&&(I=Math.acos(I),E=C*Math.cos(I)+et,R=S*Math.sin(I),Y=E*E+R*R,Y<Bs&&(ie=I,Bs=Y,be=E,Yi=R),Y>Vs&&(ki=I,Vs=Y,ve=E,Fi=R)),nt<=(Bs+Vs)*.5?(ct=wt-Math.atan2(Yi*r,be),ot=ie*r):(ct=wt-Math.atan2(Fi*r,ve),ot=ki*r)}let ht=Math.atan2(v,p)*x,bt=e.arotation;ct=(ct-ht)*P.radDeg+w-bt,ct>180?ct-=360:ct<-180&&(ct+=360),e.updateWorldTransformWith(o,c,bt+ct*a,m,u,0,0),bt=t.arotation,ot=((ot+ht)*P.radDeg-t.ashearX)*x+b-bt,ot>180?ot-=360:ot<-180&&(ot+=360),t.updateWorldTransformWith(p,v,bt+ot*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},ps=class extends ee{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)}},ws=class extends ee{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=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},bs=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(bs||{}),vs=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(vs||{}),ys=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(ys||{}),li=class Bt{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,s){if(!t)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0,h=t.bones.length;r<h;r++){let l=s.findBone(t.bones[r].name);if(!l)throw new Error(`Couldn't find bone ${t.bones[r].name}.`);this.bones.push(l)}let i=s.findSlot(t.target.name);if(!i)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=i,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let s=this.target.getAttachment();if(!(s instanceof qt))return;let i=this.mixRotate,r=this.mixX,h=this.mixY;if(i==0&&r==0&&h==0)return;let l=this.data,n=l.rotateMode==0,a=l.rotateMode==2,o=this.bones,c=o.length,d=n?c:c+1,f=L.setArraySize(this.spaces,d),m=a?this.lengths=L.setArraySize(this.lengths,c):[],u=this.spacing;switch(l.spacingMode){case 2:if(a)for(let A=0,C=d-1;A<C;A++){let S=o[A],I=S.data.length,Y=I*S.a,k=I*S.c;m[A]=Math.sqrt(Y*Y+k*k)}L.arrayFill(f,1,d,u);break;case 3:let v=0;for(let A=0,C=d-1;A<C;){let S=o[A],I=S.data.length;if(I<Bt.epsilon)a&&(m[A]=0),f[++A]=u;else{let Y=I*S.a,k=I*S.c,F=Math.sqrt(Y*Y+k*k);a&&(m[A]=F),f[++A]=F,v+=F}}if(v>0){v=d/v*u;for(let A=1;A<d;A++)f[A]*=v}break;default:let y=l.spacingMode==0;for(let A=0,C=d-1;A<C;){let S=o[A],I=S.data.length;if(I<Bt.epsilon)a&&(m[A]=0),f[++A]=u;else{let Y=I*S.a,k=I*S.c,F=Math.sqrt(Y*Y+k*k);a&&(m[A]=F),f[++A]=(y?I+u:u)*F/I}}}let g=this.computeWorldPositions(s,d,n),w=g[0],b=g[1],x=l.offsetRotation,p=!1;if(x==0)p=l.rotateMode==1;else{p=!1;let v=this.target.bone;x*=v.a*v.d-v.b*v.c>0?P.degRad:-P.degRad}for(let v=0,y=3;v<c;v++,y+=3){let A=o[v];A.worldX+=(w-A.worldX)*r,A.worldY+=(b-A.worldY)*h;let C=g[y],S=g[y+1],I=C-w,Y=S-b;if(a){let k=m[v];if(k!=0){let F=(Math.sqrt(I*I+Y*Y)/k-1)*i+1;A.a*=F,A.c*=F}}if(w=C,b=S,i>0){let k=A.a,F=A.b,X=A.c,E=A.d,R=0,B=0,st=0;if(n?R=g[y-1]:f[v+1]==0?R=g[y+2]:R=Math.atan2(Y,I),R-=Math.atan2(X,k),p){B=Math.cos(R),st=Math.sin(R);let et=A.data.length;w+=(et*(B*k-st*X)-I)*i,b+=(et*(st*k+B*X)-Y)*i}else R+=x;R>P.PI?R-=P.PI2:R<-P.PI&&(R+=P.PI2),R*=i,B=Math.cos(R),st=Math.sin(R),A.a=B*k-st*X,A.b=B*F-st*E,A.c=st*k+B*X,A.d=st*F+B*E}A.updateAppliedTransform()}}computeWorldPositions(t,s,i){let r=this.target,h=this.position,l=this.spaces,n=L.setArraySize(this.positions,s*3+2),a=this.world,o=t.closed,c=t.worldVerticesLength,d=c/6,f=Bt.NONE;if(!t.constantSpeed){let et=t.lengths;d-=o?1:2;let rt=et[d];this.data.positionMode==1&&(h*=rt);let ct;switch(this.data.spacingMode){case 2:ct=rt;break;case 3:ct=rt/s;break;default:ct=1}a=L.setArraySize(this.world,8);for(let ot=0,ut=0,Z=0;ot<s;ot++,ut+=3){let nt=l[ot]*ct;h+=nt;let ht=h;if(o)ht%=rt,ht<0&&(ht+=rt),Z=0;else if(ht<0){f!=Bt.BEFORE&&(f=Bt.BEFORE,t.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition(ht,a,0,n,ut);continue}else if(ht>rt){f!=Bt.AFTER&&(f=Bt.AFTER,t.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition(ht-rt,a,0,n,ut);continue}for(;;Z++){let bt=et[Z];if(!(ht>bt)){if(Z==0)ht/=bt;else{let mt=et[Z-1];ht=(ht-mt)/(bt-mt)}break}}Z!=f&&(f=Z,o&&Z==d?(t.computeWorldVertices(r,c-4,4,a,0,2),t.computeWorldVertices(r,0,4,a,4,2)):t.computeWorldVertices(r,Z*6+2,8,a,0,2)),this.addCurvePosition(ht,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,ut,i||ot>0&&nt==0)}return n}o?(c+=2,a=L.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,a,0,2),t.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=L.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,a,0,2));let m=L.setArraySize(this.curves,d),u=0,g=a[0],w=a[1],b=0,x=0,p=0,v=0,y=0,A=0,C=0,S=0,I=0,Y=0,k=0,F=0,X=0,E=0;for(let et=0,rt=2;et<d;et++,rt+=6)b=a[rt],x=a[rt+1],p=a[rt+2],v=a[rt+3],y=a[rt+4],A=a[rt+5],C=(g-b*2+p)*.1875,S=(w-x*2+v)*.1875,I=((b-p)*3-g+y)*.09375,Y=((x-v)*3-w+A)*.09375,k=C*2+I,F=S*2+Y,X=(b-g)*.75+C+I*.16666667,E=(x-w)*.75+S+Y*.16666667,u+=Math.sqrt(X*X+E*E),X+=k,E+=F,k+=I,F+=Y,u+=Math.sqrt(X*X+E*E),X+=k,E+=F,u+=Math.sqrt(X*X+E*E),X+=k+I,E+=F+Y,u+=Math.sqrt(X*X+E*E),m[et]=u,g=y,w=A;this.data.positionMode==1&&(h*=u);let R;switch(this.data.spacingMode){case 2:R=u;break;case 3:R=u/s;break;default:R=1}let B=this.segments,st=0;for(let et=0,rt=0,ct=0,ot=0;et<s;et++,rt+=3){let ut=l[et]*R;h+=ut;let Z=h;if(o)Z%=u,Z<0&&(Z+=u),ct=0;else if(Z<0){this.addBeforePosition(Z,a,0,n,rt);continue}else if(Z>u){this.addAfterPosition(Z-u,a,c-4,n,rt);continue}for(;;ct++){let nt=m[ct];if(!(Z>nt)){if(ct==0)Z/=nt;else{let ht=m[ct-1];Z=(Z-ht)/(nt-ht)}break}}if(ct!=f){f=ct;let nt=ct*6;for(g=a[nt],w=a[nt+1],b=a[nt+2],x=a[nt+3],p=a[nt+4],v=a[nt+5],y=a[nt+6],A=a[nt+7],C=(g-b*2+p)*.03,S=(w-x*2+v)*.03,I=((b-p)*3-g+y)*.006,Y=((x-v)*3-w+A)*.006,k=C*2+I,F=S*2+Y,X=(b-g)*.3+C+I*.16666667,E=(x-w)*.3+S+Y*.16666667,st=Math.sqrt(X*X+E*E),B[0]=st,nt=1;nt<8;nt++)X+=k,E+=F,k+=I,F+=Y,st+=Math.sqrt(X*X+E*E),B[nt]=st;X+=k,E+=F,st+=Math.sqrt(X*X+E*E),B[8]=st,X+=k+I,E+=F+Y,st+=Math.sqrt(X*X+E*E),B[9]=st,ot=0}for(Z*=st;;ot++){let nt=B[ot];if(!(Z>nt)){if(ot==0)Z/=nt;else{let ht=B[ot-1];Z=ot+(Z-ht)/(nt-ht)}break}}this.addCurvePosition(Z*.1,g,w,b,x,p,v,y,A,n,rt,i||et>0&&ut==0)}return n}addBeforePosition(t,s,i,r,h){let l=s[i],n=s[i+1],a=s[i+2]-l,o=s[i+3]-n,c=Math.atan2(o,a);r[h]=l+t*Math.cos(c),r[h+1]=n+t*Math.sin(c),r[h+2]=c}addAfterPosition(t,s,i,r,h){let l=s[i+2],n=s[i+3],a=l-s[i],o=n-s[i+1],c=Math.atan2(o,a);r[h]=l+t*Math.cos(c),r[h+1]=n+t*Math.sin(c),r[h+2]=c}addCurvePosition(t,s,i,r,h,l,n,a,o,c,d,f){if(t==0||isNaN(t)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(h-i,r-s);return}let m=t*t,u=m*t,g=1-t,w=g*g,b=w*g,x=g*t,p=x*3,v=g*p,y=p*t,A=s*b+r*v+l*y+a*u,C=i*b+h*v+n*y+o*u;c[d]=A,c[d+1]=C,f&&(t<.001?c[d+2]=Math.atan2(h-i,r-s):c[d+2]=Math.atan2(C-(i*w+h*x*2+n*m),A-(s*w+r*x*2+l*m)))}},ar=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 s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,l=this.bone,n=l.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,o=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=o,this.lastTime=a.time;const c=l.worldX,d=l.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let f=this.remaining,m=this.inertia,u=this.data.step,g=this.skeleton.data.referenceScale,w=-1,b=this.data.limit*o,x=b*Math.abs(a.scaleY);if(b*=Math.abs(a.scaleX),s||i){if(s){const p=(this.ux-c)*m;this.xOffset+=p>b?b:p<-b?-b:p,this.ux=c}if(i){const p=(this.uy-d)*m;this.yOffset+=p>x?x:p<-x?-x:p,this.uy=d}if(f>=u){w=Math.pow(this.damping,60*u);const p=this.massInverse*u,v=this.strength,y=this.wind*g*a.scaleX,A=this.gravity*g*a.scaleY;do s&&(this.xVelocity+=(y-this.xOffset*v)*p,this.xOffset+=this.xVelocity*u,this.xVelocity*=w),i&&(this.yVelocity-=(A+this.yOffset*v)*p,this.yOffset+=this.yVelocity*u,this.yVelocity*=w),f-=u;while(f>=u)}s&&(l.worldX+=this.xOffset*t*this.data.x),i&&(l.worldY+=this.yOffset*t*this.data.y)}if(r||h){let p=Math.atan2(l.c,l.a),v=0,y=0,A=0,C=this.cx-l.worldX,S=this.cy-l.worldY;if(C>b?C=b:C<-b&&(C=-b),S>x?S=x:S<-x&&(S=-x),r){A=(this.data.rotate+this.data.shearX)*t;let I=Math.atan2(S+this.ty,C+this.tx)-p-this.rotateOffset*A;this.rotateOffset+=(I-Math.ceil(I*P.invPI2-.5)*P.PI2)*m,I=this.rotateOffset*A+p,v=Math.cos(I),y=Math.sin(I),h&&(I=n*l.getWorldScaleX(),I>0&&(this.scaleOffset+=(C*v+S*y)*m/I))}else{v=Math.cos(p),y=Math.sin(p);const I=n*l.getWorldScaleX();I>0&&(this.scaleOffset+=(C*v+S*y)*m/I)}if(f=this.remaining,f>=u){w==-1&&(w=Math.pow(this.damping,60*u));const I=this.massInverse*u,Y=this.strength,k=this.wind,F=ci.yDown?-this.gravity:this.gravity,X=n/g;for(;;)if(f-=u,h&&(this.scaleVelocity+=(k*v-F*y-this.scaleOffset*Y)*I,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=w),r){if(this.rotateVelocity-=((k*y+F*v)*X+this.rotateOffset*Y)*I,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=w,f<u)break;const E=this.rotateOffset*A+p;v=Math.cos(E),y=Math.sin(E)}else if(f<u)break}}this.remaining=f}this.cx=l.worldX,this.cy=l.worldY;break;case 3:s&&(l.worldX+=this.xOffset*t*this.data.x),i&&(l.worldY+=this.yOffset*t*this.data.y)}if(r){let a=this.rotateOffset*t,o=0,c=0,d=0;if(this.data.shearX>0){let f=0;this.data.rotate>0&&(f=a*this.data.rotate,o=Math.sin(f),c=Math.cos(f),d=l.b,l.b=c*d-o*l.d,l.d=o*d+c*l.d),f+=a*this.data.shearX,o=Math.sin(f),c=Math.cos(f),d=l.a,l.a=c*d-o*l.c,l.c=o*d+c*l.c}else a*=this.data.rotate,o=Math.sin(a),c=Math.cos(a),d=l.a,l.a=c*d-o*l.c,l.c=o*d+c*l.c,d=l.b,l.b=c*d-o*l.d,l.d=o*d+c*l.d}if(h){const a=1+this.scaleOffset*t*this.data.scaleX;l.a*=a,l.c*=a}e!=3&&(this.tx=n*l.a,this.ty=n*l.c),l.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const i=s*P.degRad,r=Math.cos(i),h=Math.sin(i),l=this.cx-e,n=this.cy-t;this.translate(l*r-n*h-l,l*h+n*r-n)}},oi=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 tt,this.darkColor=e.darkColor?new tt:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof Yt)||!(this.attachment instanceof Yt)||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}},hi=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Vt;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 i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,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,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=t!=0||s!=0,n=this.target,a=n.a,o=n.b,c=n.c,d=n.d,f=a*d-o*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*f,u=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,a)-Math.atan2(y,p)+m;C>P.PI?C-=P.PI2:C<-P.PI&&(C+=P.PI2),C*=e;let S=Math.cos(C),I=Math.sin(C);x.a=S*p-I*y,x.b=S*v-I*A,x.c=I*p+S*y,x.d=I*v+S*A}if(l){let p=this.temp;n.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(p.x-x.worldX)*t,x.worldY+=(p.y-x.worldY)*s}if(i!=0){let p=Math.sqrt(x.a*x.a+x.c*x.c);p!=0&&(p=(p+(Math.sqrt(a*a+c*c)-p+this.data.offsetScaleX)*i)/p),x.a*=p,x.c*=p}if(r!=0){let p=Math.sqrt(x.b*x.b+x.d*x.d);p!=0&&(p=(p+(Math.sqrt(o*o+d*d)-p+this.data.offsetScaleY)*r)/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,o)-Math.atan2(c,a)-(y-Math.atan2(x.c,x.a));A>P.PI?A-=P.PI2:A<-P.PI&&(A+=P.PI2),A=y+(A+u)*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,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=t!=0||s!=0,n=this.target,a=n.a,o=n.b,c=n.c,d=n.d,f=a*d-o*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*f,u=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,a)+m;C>P.PI?C-=P.PI2:C<-P.PI&&(C+=P.PI2),C*=e;let S=Math.cos(C),I=Math.sin(C);x.a=S*p-I*y,x.b=S*v-I*A,x.c=I*p+S*y,x.d=I*v+S*A}if(l){let p=this.temp;n.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),x.worldX+=p.x*t,x.worldY+=p.y*s}if(i!=0){let p=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;x.a*=p,x.c*=p}if(r!=0){let p=(Math.sqrt(o*o+d*d)-1+this.data.offsetScaleY)*r+1;x.b*=p,x.d*=p}if(h>0){let p=Math.atan2(d,o)-Math.atan2(c,a);p>P.PI?p-=P.PI2:p<-P.PI&&(p+=P.PI2);let v=x.b,y=x.d;p=Math.atan2(y,v)+(p-P.PI/2+u)*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,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=this.target,n=this.bones;for(let a=0,o=n.length;a<o;a++){let c=n[a],d=c.arotation;e!=0&&(d+=(l.arotation-d+this.data.offsetRotation)*e);let f=c.ax,m=c.ay;f+=(l.ax-f+this.data.offsetX)*t,m+=(l.ay-m+this.data.offsetY)*s;let u=c.ascaleX,g=c.ascaleY;i!=0&&u!=0&&(u=(u+(l.ascaleX-u+this.data.offsetScaleX)*i)/u),r!=0&&g!=0&&(g=(g+(l.ascaleY-g+this.data.offsetScaleY)*r)/g);let w=c.ashearY;h!=0&&(w+=(l.ashearY-w+this.data.offsetShearY)*h),c.updateWorldTransformWith(f,m,d,u,g,c.ashearX,w)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=this.target,n=this.bones;for(let a=0,o=n.length;a<o;a++){let c=n[a],d=c.arotation+(l.arotation+this.data.offsetRotation)*e,f=c.ax+(l.ax+this.data.offsetX)*t,m=c.ay+(l.ay+this.data.offsetY)*s,u=c.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*i+1),g=c.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*r+1),w=c.ashearY+(l.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(f,m,d,u,g,c.ashearX,w)}}},ci=class Ds{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return Ds.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=t.bones[s],r;if(!i.parent)r=new us(i,this,null);else{let h=this.bones[i.parent.index];r=new us(i,this,h),h.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let s=0;s<t.slots.length;s++){let i=t.slots[s],r=this.bones[i.boneData.index],h=new oi(i,r);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let s=0;s<t.ikConstraints.length;s++){let i=t.ikConstraints[s];this.ikConstraints.push(new ai(i,this))}this.transformConstraints=new Array;for(let s=0;s<t.transformConstraints.length;s++){let i=t.transformConstraints[s];this.transformConstraints.push(new hi(i,this))}this.pathConstraints=new Array;for(let s=0;s<t.pathConstraints.length;s++){let i=t.pathConstraints[s];this.pathConstraints.push(new li(i,this))}this.physicsConstraints=new Array;for(let s=0;s<t.physicsConstraints.length;s++){let i=t.physicsConstraints[s];this.physicsConstraints.push(new ar(i,this))}this.color=new tt(1,1,1,1),this.updateCache()}updateCache(){let t=this._updateCache;t.length=0;let s=this.bones;for(let f=0,m=s.length;f<m;f++){let u=s[f];u.sorted=u.data.skinRequired,u.active=!u.sorted}if(this.skin){let f=this.skin.bones;for(let m=0,u=this.skin.bones.length;m<u;m++){let g=this.bones[f[m].index];do g.sorted=!1,g.active=!0,g=g.parent;while(g)}}let i=this.ikConstraints,r=this.transformConstraints,h=this.pathConstraints,l=this.physicsConstraints,n=i.length,a=r.length,o=h.length,c=this.physicsConstraints.length,d=n+a+o+c;t:for(let f=0;f<d;f++){for(let m=0;m<n;m++){let u=i[m];if(u.data.order==f){this.sortIkConstraint(u);continue t}}for(let m=0;m<a;m++){let u=r[m];if(u.data.order==f){this.sortTransformConstraint(u);continue t}}for(let m=0;m<o;m++){let u=h[m];if(u.data.order==f){this.sortPathConstraint(u);continue t}}for(let m=0;m<c;m++){const u=l[m];if(u.data.order==f){this.sortPhysicsConstraint(u);continue t}}}for(let f=0,m=s.length;f<m;f++)this.sortBone(s[f])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&L.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target;this.sortBone(s);let i=t.bones,r=i[0];if(this.sortBone(r),i.length==1)this._updateCache.push(t),this.sortReset(r.children);else{let h=i[i.length-1];this.sortBone(h),this._updateCache.push(t),this.sortReset(r.children),h.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&L.contains(this.skin.constraints,t.data,!0)),!t.active)return;let s=t.target,i=s.data.index,r=s.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,r);for(let a=0,o=this.data.skins.length;a<o;a++)this.sortPathConstraintAttachment(this.data.skins[a],i,r);let h=s.getAttachment();h instanceof qt&&this.sortPathConstraintAttachmentWith(h,r);let l=t.bones,n=l.length;for(let a=0;a<n;a++)this.sortBone(l[a]);this._updateCache.push(t);for(let a=0;a<n;a++)this.sortReset(l[a].children);for(let a=0;a<n;a++)l[a].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&L.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let s=t.bones,i=s.length;if(t.data.local)for(let r=0;r<i;r++){let h=s[r];this.sortBone(h.parent),this.sortBone(h)}else for(let r=0;r<i;r++)this.sortBone(s[r]);this._updateCache.push(t);for(let r=0;r<i;r++)this.sortReset(s[r].children);for(let r=0;r<i;r++)s[r].sorted=!0}sortPathConstraintAttachment(t,s,i){let r=t.attachments[s];if(r)for(let h in r)this.sortPathConstraintAttachmentWith(r[h],i)}sortPathConstraintAttachmentWith(t,s){if(!(t instanceof qt))return;let i=t.bones;if(!i)this.sortBone(s);else{let r=this.bones;for(let h=0,l=i.length;h<l;){let n=i[h++];for(n+=h;h<n;)this.sortBone(r[i[h++]])}}}sortPhysicsConstraint(t){const s=t.bone;t.active=s.active&&(!t.data.skinRequired||this.skin!=null&&L.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(s),this._updateCache.push(t),this.sortReset(s.children),s.sorted=!0)}sortBone(t){if(!t||t.sorted)return;let s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,i=t.length;s<i;s++){let r=t[s];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(t){if(t==null)throw new Error("physics is undefined");let s=this.bones;for(let r=0,h=s.length;r<h;r++){let l=s[r];l.ax=l.x,l.ay=l.y,l.arotation=l.rotation,l.ascaleX=l.scaleX,l.ascaleY=l.scaleY,l.ashearX=l.shearX,l.ashearY=l.shearY}let i=this._updateCache;for(let r=0,h=i.length;r<h;r++)i[r].update(t)}updateWorldTransformWith(t,s){if(!s)throw new Error("parent cannot be null.");let i=this.bones;for(let w=1,b=i.length;w<b;w++){let x=i[w];x.ax=x.x,x.ay=x.y,x.arotation=x.rotation,x.ascaleX=x.scaleX,x.ascaleY=x.scaleY,x.ashearX=x.shearX,x.ashearY=x.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let h=s.a,l=s.b,n=s.c,a=s.d;r.worldX=h*this.x+l*this.y+s.worldX,r.worldY=n*this.x+a*this.y+s.worldY;const o=(r.rotation+r.shearX)*P.degRad,c=(r.rotation+90+r.shearY)*P.degRad,d=Math.cos(o)*r.scaleX,f=Math.cos(c)*r.scaleY,m=Math.sin(o)*r.scaleX,u=Math.sin(c)*r.scaleY;r.a=(h*d+l*m)*this.scaleX,r.b=(h*f+l*u)*this.scaleX,r.c=(n*d+a*m)*this.scaleY,r.d=(n*f+a*u)*this.scaleY;let g=this._updateCache;for(let w=0,b=g.length;w<b;w++){let x=g[w];x!=r&&x.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;L.arrayCopy(t,0,this.drawOrder,0,t.length);for(let s=0,i=t.length;s<i;s++)t[s].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let s=this.bones;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(h.data.name==t)return h}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let h=s[i];if(h.data.name==t)return h}return null}setSkinByName(t){let s=this.data.findSkin(t);if(!s)throw new Error("Skin not found: "+t);this.setSkin(s)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let s=this.slots;for(let i=0,r=s.length;i<r;i++){let h=s[i],l=h.data.attachmentName;if(l){let n=t.getAttachment(i,l);n&&h.setAttachment(n)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,s){let i=this.data.findSlot(t);if(!i)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(i.index,s)}getAttachment(t,s){if(!s)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(t,s);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");let i=this.slots;for(let r=0,h=i.length;r<h;r++){let l=i[r];if(l.data.name==t){let n=null;if(s&&(n=this.getAttachment(r,s),!n))throw new Error("Attachment not found: "+s+", for slot: "+t);l.setAttachment(n);return}}throw new Error("Slot not found: "+t)}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(s=>s.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new Vt,i=new Vt;return this.getBounds(s,i,void 0,t),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(t,s,i=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,l=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let c=0,d=h.length;c<d;c++){let f=h[c];if(!f.bone.active)continue;let m=0,u=null,g=null,w=f.getAttachment();if(w instanceof te)m=8,u=L.setArraySize(i,m,0),w.computeWorldVertices(f,u,0,2),g=Ds.quadTriangles;else if(w instanceof Wt){let b=w;m=b.worldVerticesLength,u=L.setArraySize(i,m,0),b.computeWorldVertices(f,0,m,u,0,2),g=b.triangles}else if(w instanceof $t&&r!=null){r.clipStart(f,w);continue}if(u&&g){r!=null&&r.isClipping()&&(r.clipTriangles(u,g,g.length),u=r.clippedVertices,m=r.clippedVertices.length);for(let b=0,x=u.length;b<x;b+=2){let p=u[b],v=u[b+1];l=Math.min(l,p),n=Math.min(n,v),a=Math.max(a,p),o=Math.max(o,v)}}r?.clipEndWithSlot(f)}r?.clipEnd(),t.set(l,n),s.set(a-l,o-n)}update(t){this.time+=t}physicsTranslate(t,s){const i=this.physicsConstraints;for(let r=0,h=i.length;r<h;r++)i[r].translate(t,s)}physicsRotate(t,s,i){const r=this.physicsConstraints;for(let h=0,l=r.length;h<l;h++)r[h].rotate(t,s,i)}},di=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(di||{}),fi=class extends ee{_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)}},As=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 s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}},Cs=class{constructor(e=0,t,s){this.slotIndex=e,this.name=t,this.attachment=s}},fe=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new tt(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let r=e.bones[i],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==r){h=!0;break}h||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){let r=e.bones[i],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==r){h=!0;break}h||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==r){h=!0;break}h||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof Wt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new Cs(t,i,r))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new Cs(e,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let r=e.slots[i],h=r.getAttachment();if(h&&s<t.attachments.length){let l=t.attachments[s];for(let n in l){let a=l[n];if(h==a){let o=this.getAttachment(s,n);o&&r.setAttachment(o);break}}}s++}}},Ss=class{index=0;name;boneData;color=new tt(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},Ts=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Ts||{}),Is=class extends ee{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)}},lr=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new As;s.name="";let i=new ui(e),r=i.readInt32(),h=i.readInt32();s.hash=h==0&&r==0?null:h.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*t;let l=i.readBoolean();l&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("String in string table must not be null.");i.strings.push(c)}n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Bone name must not be null.");let d=o==0?null:s.bones[i.readInt(!0)],f=new fs(o,c,d);f.rotation=i.readFloat(),f.x=i.readFloat()*t,f.y=i.readFloat()*t,f.scaleX=i.readFloat(),f.scaleY=i.readFloat(),f.shearX=i.readFloat(),f.shearY=i.readFloat(),f.length=i.readFloat()*t,f.inherit=i.readByte(),f.skinRequired=i.readBoolean(),l&&(tt.rgba8888ToColor(f.color,i.readInt32()),f.icon=i.readString()??void 0,f.visible=i.readBoolean()),s.bones.push(f)}n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Slot name must not be null.");let d=s.bones[i.readInt(!0)],f=new Ss(o,c,d);tt.rgba8888ToColor(f.color,i.readInt32());let m=i.readInt32();m!=-1&&tt.rgb888ToColor(f.darkColor=new tt,m),f.attachmentName=i.readStringRef(),f.blendMode=i.readInt(!0),l&&(f.visible=i.readBoolean()),s.slots.push(f)}n=i.readInt(!0);for(let o=0,c;o<n;o++){let d=i.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new ps(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.bendDirection=(m&2)!=0?1:-1,f.compress=(m&4)!=0,f.stretch=(m&8)!=0,f.uniform=(m&16)!=0,(m&32)!=0&&(f.mix=(m&64)!=0?i.readFloat():1),(m&128)!=0&&(f.softness=i.readFloat()*t),s.ikConstraints.push(f)}n=i.readInt(!0);for(let o=0,c;o<n;o++){let d=i.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new Is(d);f.order=i.readInt(!0),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,f.local=(m&2)!=0,f.relative=(m&4)!=0,(m&8)!=0&&(f.offsetRotation=i.readFloat()),(m&16)!=0&&(f.offsetX=i.readFloat()*t),(m&32)!=0&&(f.offsetY=i.readFloat()*t),(m&64)!=0&&(f.offsetScaleX=i.readFloat()),(m&128)!=0&&(f.offsetScaleY=i.readFloat()),m=i.readByte(),(m&1)!=0&&(f.offsetShearY=i.readFloat()),(m&2)!=0&&(f.mixRotate=i.readFloat()),(m&4)!=0&&(f.mixX=i.readFloat()),(m&8)!=0&&(f.mixY=i.readFloat()),(m&16)!=0&&(f.mixScaleX=i.readFloat()),(m&32)!=0&&(f.mixScaleY=i.readFloat()),(m&64)!=0&&(f.mixShearY=i.readFloat()),s.transformConstraints.push(f)}n=i.readInt(!0);for(let o=0,c;o<n;o++){let d=i.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new ws(d);f.order=i.readInt(!0),f.skinRequired=i.readBoolean(),c=i.readInt(!0);for(let u=0;u<c;u++)f.bones.push(s.bones[i.readInt(!0)]);f.target=s.slots[i.readInt(!0)];const m=i.readByte();f.positionMode=m&1,f.spacingMode=m>>1&3,f.rotateMode=m>>3&3,(m&128)!=0&&(f.offsetRotation=i.readFloat()),f.position=i.readFloat(),f.positionMode==0&&(f.position*=t),f.spacing=i.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=t),f.mixRotate=i.readFloat(),f.mixX=i.readFloat(),f.mixY=i.readFloat(),s.pathConstraints.push(f)}n=i.readInt(!0);for(let o=0,c;o<n;o++){const d=i.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new fi(d);f.order=i.readInt(!0),f.bone=s.bones[i.readInt(!0)];let m=i.readByte();f.skinRequired=(m&1)!=0,(m&2)!=0&&(f.x=i.readFloat()),(m&4)!=0&&(f.y=i.readFloat()),(m&8)!=0&&(f.rotate=i.readFloat()),(m&16)!=0&&(f.scaleX=i.readFloat()),(m&32)!=0&&(f.shearX=i.readFloat()),f.limit=((m&64)!=0?i.readFloat():5e3)*t,f.step=1/i.readUnsignedByte(),f.inertia=i.readFloat(),f.strength=i.readFloat(),f.damping=i.readFloat(),f.massInverse=(m&128)!=0?i.readFloat():1,f.wind=i.readFloat(),f.gravity=i.readFloat(),m=i.readByte(),(m&1)!=0&&(f.inertiaGlobal=!0),(m&2)!=0&&(f.strengthGlobal=!0),(m&4)!=0&&(f.dampingGlobal=!0),(m&8)!=0&&(f.massGlobal=!0),(m&16)!=0&&(f.windGlobal=!0),(m&32)!=0&&(f.gravityGlobal=!0),(m&64)!=0&&(f.mixGlobal=!0),f.mix=(m&128)!=0?i.readFloat():1,s.physicsConstraints.push(f)}let a=this.readSkin(i,s,!0,l);a&&(s.defaultSkin=a,s.skins.push(a));{let o=s.skins.length;for(L.setArraySize(s.skins,n=o+i.readInt(!0));o<n;o++){let c=this.readSkin(i,s,!1,l);if(!c)throw new Error("readSkin() should not have returned null.");s.skins[o]=c}}n=this.linkedMeshes.length;for(let o=0;o<n;o++){let c=this.linkedMeshes[o];const d=s.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(c.slotIndex,c.parent);if(!f)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?f:c.mesh,c.mesh.setParentMesh(f),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Event data name must not be null");let d=new xs(c);d.intValue=i.readInt(!1),d.floatValue=i.readFloat(),d.stringValue=i.readString(),d.audioPath=i.readString(),d.audioPath&&(d.volume=i.readFloat(),d.balance=i.readFloat()),s.events.push(d)}n=i.readInt(!0);for(let o=0;o<n;o++){let c=i.readString();if(!c)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,c,s))}return s}readSkin(e,t,s,i){let r=null,h=0;if(s){if(h=e.readInt(!0),h==0)return null;r=new fe("default")}else{let l=e.readString();if(!l)throw new Error("Skin name must not be null.");r=new fe(l),i&&tt.rgba8888ToColor(r.color,e.readInt32()),r.bones.length=e.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=t.bones[e.readInt(!0)];for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let n=0,a=e.readInt(!0);n<a;n++)r.constraints.push(t.physicsConstraints[e.readInt(!0)]);h=e.readInt(!0)}for(let l=0;l<h;l++){let n=e.readInt(!0);for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readStringRef();if(!c)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,r,n,c,i);d&&r.setAttachment(n,c,d)}}return r}readAttachment(e,t,s,i,r,h){let l=this.scale,n=e.readByte();const a=(n&8)!=0?e.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let o=(n&16)!=0?e.readStringRef():null;const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null;let f=(n&128)!=0?e.readFloat():0,m=e.readFloat(),u=e.readFloat(),g=e.readFloat(),w=e.readFloat(),b=e.readFloat(),x=e.readFloat();o||(o=a);let p=this.attachmentLoader.newRegionAttachment(s,a,o,d);return p?(p.path=o,p.x=m*l,p.y=u*l,p.scaleX=g,p.scaleY=w,p.rotation=f,p.width=b*l,p.height=x*l,tt.rgba8888ToColor(p.color,c),p.sequence=d,d==null&&p.updateRegion(),p):null}case 1:{let o=this.readVertices(e,(n&16)!=0),c=h?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,a);return d?(d.worldVerticesLength=o.length,d.vertices=o.vertices,d.bones=o.bones,h&&tt.rgba8888ToColor(d.color,c),d):null}case 2:{let o=(n&16)!=0?e.readStringRef():a;const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null,f=e.readInt(!0),m=this.readVertices(e,(n&128)!=0),u=this.readFloatArray(e,m.length,1),g=this.readShortArray(e,(m.length-f-2)*3);let w=[],b=0,x=0;h&&(w=this.readShortArray(e,e.readInt(!0)),b=e.readFloat(),x=e.readFloat()),o||(o=a);let p=this.attachmentLoader.newMeshAttachment(s,a,o,d);return p?(p.path=o,tt.rgba8888ToColor(p.color,c),p.bones=m.bones,p.vertices=m.vertices,p.worldVerticesLength=m.length,p.triangles=g,p.regionUVs=u,d==null&&p.updateRegion(),p.hullLength=f<<1,p.sequence=d,h&&(p.edges=w,p.width=b*l,p.height=x*l),p):null}case 3:{const o=(n&16)!=0?e.readStringRef():a;if(o==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?e.readInt32():4294967295,d=(n&64)!=0?this.readSequence(e):null,f=(n&128)!=0,m=e.readInt(!0),u=e.readStringRef();let g=0,w=0;h&&(g=e.readFloat(),w=e.readFloat());let b=this.attachmentLoader.newMeshAttachment(s,a,o,d);return b?(b.path=o,tt.rgba8888ToColor(b.color,c),b.sequence=d,h&&(b.width=g*l,b.height=w*l),this.linkedMeshes.push(new or(b,m,i,u,f)),b):null}case 4:{const o=(n&16)!=0,c=(n&32)!=0,d=this.readVertices(e,(n&64)!=0),f=L.newArray(d.length/6,0);for(let g=0,w=f.length;g<w;g++)f[g]=e.readFloat()*l;const m=h?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,a);return u?(u.closed=o,u.constantSpeed=c,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=f,h&&tt.rgba8888ToColor(u.color,m),u):null}case 5:{const o=e.readFloat(),c=e.readFloat(),d=e.readFloat(),f=h?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,a);return m?(m.x=c*l,m.y=d*l,m.rotation=o,h&&tt.rgba8888ToColor(m.color,f),m):null}case 6:{const o=e.readInt(!0),c=this.readVertices(e,(n&16)!=0);let d=h?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,a);return f?(f.endSlot=t.slots[o],f.worldVerticesLength=c.length,f.vertices=c.vertices,f.bones=c.bones,h&&tt.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){let t=new Gs(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),r=new hr;if(r.length=i<<1,!t)return r.vertices=this.readFloatArray(e,r.length,s),r;let h=new Array,l=new Array;for(let n=0;n<i;n++){let a=e.readInt(!0);l.push(a);for(let o=0;o<a;o++)l.push(e.readInt(!0)),h.push(e.readFloat()*s),h.push(e.readFloat()*s),h.push(e.readFloat())}return r.vertices=L.toFloatArray(h),r.bones=l,r}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let r=0;r<t;r++)i[r]=e.readFloat();else for(let r=0;r<t;r++)i[r]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,r=this.scale;for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),u=e.readInt(!0),g=u-1;switch(m){case yr:{let w=new Ot(u,c);for(let b=0;b<u;b++)w.setFrame(b,e.readFloat(),e.readStringRef());i.push(w);break}case Ar:{let w=e.readInt(!0),b=new De(u,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,S=0;b.setFrame(C,x,p,v,y,A),C!=g;C++){let I=e.readFloat(),Y=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255;switch(e.readByte()){case kt:b.setStepped(C);break;case Ft:at(e,b,S++,C,0,x,I,p,Y,1),at(e,b,S++,C,1,x,I,v,k,1),at(e,b,S++,C,2,x,I,y,F,1),at(e,b,S++,C,3,x,I,A,X,1)}x=I,p=Y,v=k,y=F,A=X}i.push(b);break}case Cr:{let w=e.readInt(!0),b=new Ne(u,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 S=e.readFloat(),I=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;switch(e.readByte()){case kt:b.setStepped(A);break;case Ft:at(e,b,C++,A,0,x,S,p,I,1),at(e,b,C++,A,1,x,S,v,Y,1),at(e,b,C++,A,2,x,S,y,k,1)}x=S,p=I,v=Y,y=k}i.push(b);break}case Sr:{let w=e.readInt(!0),b=new ze(u,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,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let Y=0,k=0;b.setFrame(Y,x,p,v,y,A,C,S,I),Y!=g;Y++){let F=e.readFloat(),X=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,st=e.readUnsignedByte()/255,et=e.readUnsignedByte()/255,rt=e.readUnsignedByte()/255;switch(e.readByte()){case kt:b.setStepped(Y);break;case Ft:at(e,b,k++,Y,0,x,F,p,X,1),at(e,b,k++,Y,1,x,F,v,E,1),at(e,b,k++,Y,2,x,F,y,R,1),at(e,b,k++,Y,3,x,F,A,B,1),at(e,b,k++,Y,4,x,F,C,st,1),at(e,b,k++,Y,5,x,F,S,et,1),at(e,b,k++,Y,6,x,F,I,rt,1)}x=F,p=X,v=E,y=R,A=B,C=st,S=et,I=rt}i.push(b);break}case Tr:{let w=e.readInt(!0),b=new We(u,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,S=e.readUnsignedByte()/255;for(let I=0,Y=0;b.setFrame(I,x,p,v,y,A,C,S),I!=g;I++){let k=e.readFloat(),F=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,st=e.readUnsignedByte()/255;switch(e.readByte()){case kt:b.setStepped(I);break;case Ft:at(e,b,Y++,I,0,x,k,p,F,1),at(e,b,Y++,I,1,x,k,v,X,1),at(e,b,Y++,I,2,x,k,y,E,1),at(e,b,Y++,I,3,x,k,A,R,1),at(e,b,Y++,I,4,x,k,C,B,1),at(e,b,Y++,I,5,x,k,S,st,1)}x=k,p=F,v=X,y=E,A=R,C=B,S=st}i.push(b);break}case Ir:{let w=new Ue(u,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 kt:w.setStepped(p);break;case Ft:at(e,w,v++,p,0,b,y,x,A,1)}b=y,x=A}i.push(w)}}}}for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),u=e.readInt(!0);if(m==vr){let w=new Oe(u,c);for(let b=0;b<u;b++)w.setFrame(b,e.readFloat(),e.readByte());i.push(w);continue}let g=e.readInt(!0);switch(m){case cr:i.push(gt(e,new Qt(u,g,c),1));break;case dr:i.push(Ms(e,new Re(u,g,c),r));break;case fr:i.push(gt(e,new Ye(u,g,c),r));break;case ur:i.push(gt(e,new ke(u,g,c),r));break;case mr:i.push(Ms(e,new Fe(u,g,c),1));break;case gr:i.push(gt(e,new Xe(u,g,c),1));break;case xr:i.push(gt(e,new Pe(u,g,c),1));break;case pr:i.push(Ms(e,new Le(u,g,c),1));break;case wr:i.push(gt(e,new Be(u,g,c),1));break;case br:i.push(gt(e,new Ve(u,g,c),1))}}}for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new Ge(d,e.readInt(!0),c),u=e.readByte(),g=e.readFloat(),w=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,b=(u&4)!=0?e.readFloat()*r:0;for(let x=0,p=0;m.setFrame(x,g,w,b,(u&8)!=0?1:-1,(u&16)!=0,(u&32)!=0),x!=f;x++){u=e.readByte();const v=e.readFloat(),y=(u&1)!=0?(u&2)!=0?e.readFloat():1:0,A=(u&4)!=0?e.readFloat()*r:0;(u&64)!=0?m.setStepped(x):(u&128)!=0&&(at(e,m,p++,x,0,g,v,w,y,1),at(e,m,p++,x,1,g,v,b,A,r)),g=v,w=y,b=A}i.push(m)}for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new He(d,e.readInt(!0),c),u=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;m.setFrame(y,u,g,w,b,x,p,v),y!=f;y++){let C=e.readFloat(),S=e.readFloat(),I=e.readFloat(),Y=e.readFloat(),k=e.readFloat(),F=e.readFloat(),X=e.readFloat();switch(e.readByte()){case kt:m.setStepped(y);break;case Ft:at(e,m,A++,y,0,u,C,g,S,1),at(e,m,A++,y,1,u,C,w,I,1),at(e,m,A++,y,2,u,C,b,Y,1),at(e,m,A++,y,3,u,C,x,k,1),at(e,m,A++,y,4,u,C,p,F,1),at(e,m,A++,y,5,u,C,v,X,1)}u=C,g=S,w=I,b=Y,x=k,p=F,v=X}i.push(m)}for(let a=0,o=e.readInt(!0);a<o;a++){let c=e.readInt(!0),d=s.pathConstraints[c];for(let f=0,m=e.readInt(!0);f<m;f++){const u=e.readByte(),g=e.readInt(!0),w=e.readInt(!0);switch(u){case Rr:i.push(gt(e,new _e(g,w,c),d.positionMode==0?r:1));break;case Yr:i.push(gt(e,new je(g,w,c),d.spacingMode==0||d.spacingMode==1?r:1));break;case kr:let b=new Ze(g,w,c),x=e.readFloat(),p=e.readFloat(),v=e.readFloat(),y=e.readFloat();for(let A=0,C=0,S=b.getFrameCount()-1;b.setFrame(A,x,p,v,y),A!=S;A++){let I=e.readFloat(),Y=e.readFloat(),k=e.readFloat(),F=e.readFloat();switch(e.readByte()){case kt:b.setStepped(A);break;case Ft:at(e,b,C++,A,0,x,I,p,Y,1),at(e,b,C++,A,1,x,I,v,k,1),at(e,b,C++,A,2,x,I,y,F,1)}x=I,p=Y,v=k,y=F}i.push(b)}}}for(let a=0,o=e.readInt(!0);a<o;a++){const c=e.readInt(!0)-1;for(let d=0,f=e.readInt(!0);d<f;d++){const m=e.readByte(),u=e.readInt(!0);if(m==Dr){const w=new is(u,c);for(let b=0;b<u;b++)w.setFrame(b,e.readFloat());i.push(w);continue}const g=e.readInt(!0);switch(m){case Fr:i.push(gt(e,new Ke(u,g,c),1));break;case Xr:i.push(gt(e,new Je(u,g,c),1));break;case Pr:i.push(gt(e,new Qe(u,g,c),1));break;case Lr:i.push(gt(e,new $e(u,g,c),1));break;case Br:i.push(gt(e,new ts(u,g,c),1));break;case Vr:i.push(gt(e,new es(u,g,c),1));break;case Or:i.push(gt(e,new ss(u,g,c),1))}}}for(let a=0,o=e.readInt(!0);a<o;a++){let c=s.skins[e.readInt(!0)];for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readInt(!0);for(let u=0,g=e.readInt(!0);u<g;u++){let w=e.readStringRef();if(!w)throw new Error("attachmentName must not be null.");let b=c.getAttachment(m,w),x=e.readByte(),p=e.readInt(!0),v=p-1;switch(x){case Mr:{let y=b,A=y.bones,C=y.vertices,S=A?C.length/3*2:C.length,I=e.readInt(!0),Y=new qe(p,I,m,y),k=e.readFloat();for(let F=0,X=0;;F++){let E,R=e.readInt(!0);if(R==0)E=A?L.newFloatArray(S):C;else{E=L.newFloatArray(S);let st=e.readInt(!0);if(R+=st,r==1)for(let et=st;et<R;et++)E[et]=e.readFloat();else for(let et=st;et<R;et++)E[et]=e.readFloat()*r;if(!A)for(let et=0,rt=E.length;et<rt;et++)E[et]+=C[et]}if(Y.setFrame(F,k,E),F==v)break;let B=e.readFloat();switch(e.readByte()){case kt:Y.setStepped(F);break;case Ft:at(e,Y,X++,F,0,k,B,0,1,1)}k=B}i.push(Y);break}case Er:{let y=new rs(p,m,b);for(let A=0;A<p;A++){let C=e.readFloat(),S=e.readInt32();y.setFrame(A,C,_s[S&15],S>>4,e.readFloat())}i.push(y);break}}}}}let h=e.readInt(!0);if(h>0){let a=new zt(h),o=s.slots.length;for(let c=0;c<h;c++){let d=e.readFloat(),f=e.readInt(!0),m=L.newArray(o,0);for(let b=o-1;b>=0;b--)m[b]=-1;let u=L.newArray(o-f,0),g=0,w=0;for(let b=0;b<f;b++){let x=e.readInt(!0);for(;g!=x;)u[w++]=g++;m[g+e.readInt(!0)]=g++}for(;g<o;)u[w++]=g++;for(let b=o-1;b>=0;b--)m[b]==-1&&(m[b]=u[--w]);a.setFrame(c,d,m)}i.push(a)}let l=e.readInt(!0);if(l>0){let a=new le(l);for(let o=0;o<l;o++){let c=e.readFloat(),d=s.events[e.readInt(!0)],f=new gs(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()),a.setFrame(o,f)}i.push(a)}let n=0;for(let a=0,o=i.length;a<o;a++)n=Math.max(n,i[a].getDuration());return new ne(t,i,n)}},ui=class{constructor(e,t=new Array,s=0,i=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=i}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(),s=t&127;return(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&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="",s=0;for(let i=0;i<e;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:t+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(r),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},or=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},hr=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function gt(e,t,s){let i=e.readFloat(),r=e.readFloat()*s;for(let h=0,l=0,n=t.getFrameCount()-1;t.setFrame(h,i,r),h!=n;h++){let a=e.readFloat(),o=e.readFloat()*s;switch(e.readByte()){case kt:t.setStepped(h);break;case Ft:at(e,t,l++,h,0,i,a,r,o,s)}i=a,r=o}return t}function Ms(e,t,s){let i=e.readFloat(),r=e.readFloat()*s,h=e.readFloat()*s;for(let l=0,n=0,a=t.getFrameCount()-1;t.setFrame(l,i,r,h),l!=a;l++){let o=e.readFloat(),c=e.readFloat()*s,d=e.readFloat()*s;switch(e.readByte()){case kt:t.setStepped(l);break;case Ft:at(e,t,n++,l,0,i,o,r,c,s),at(e,t,n++,l,1,i,o,h,d,s)}i=o,r=c,h=d}return t}function at(e,t,s,i,r,h,l,n,a,o){t.setBezier(s,i,r,h,n,e.readFloat(),e.readFloat()*o,e.readFloat(),e.readFloat()*o,l,a)}var cr=0,dr=1,fr=2,ur=3,mr=4,gr=5,xr=6,pr=7,wr=8,br=9,vr=10,yr=0,Ar=1,Cr=2,Sr=3,Tr=4,Ir=5,Mr=0,Er=1,Rr=0,Yr=1,kr=2,Fr=0,Xr=1,Pr=2,Lr=4,Br=5,Vr=6,Or=7,Dr=8,kt=1,Ft=2,mi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Jt(()=>L.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,h=e.slots,l=h.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n<l;n++){let a=h[n];if(!a.bone.active)continue;let o=a.getAttachment();if(o instanceof os){let c=o;s.push(c);let d=r.obtain();d.length!=c.worldVerticesLength&&(d=L.newFloatArray(c.worldVerticesLength)),i.push(d),c.computeWorldVertices(a,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,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let h=0,l=r.length;h<l;h++){let n=r[h],a=n;for(let o=0,c=n.length;o<c;o+=2){let d=a[o],f=a[o+1];e=Math.min(e,d),t=Math.min(t,f),s=Math.max(s,d),i=Math.max(i,f)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let r=this.minX,h=this.minY,l=this.maxX,n=this.maxY;if(e<=r&&s<=r||t<=h&&i<=h||e>=l&&s>=l||t>=n&&i>=n)return!1;let a=(i-t)/(s-e),o=a*(r-e)+t;if(o>h&&o<n||(o=a*(l-e)+t,o>h&&o<n))return!0;let c=(h-t)/a+e;return c>r&&c<l||(c=(n-t)/a+e,c>r&&c<l)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,r=e.length,h=r-2,l=!1;for(let n=0;n<r;n+=2){let a=i[n+1],o=i[h+1];if(a<s&&o>=s||o<s&&a>=s){let c=i[n];c+(s-a)/(o-a)*(i[h]-c)<t&&(l=!l)}h=n}return l}intersectsSegment(e,t,s,i){let r=this.polygons;for(let h=0,l=r.length;h<l;h++)if(this.intersectsSegmentPolygon(r[h],e,t,s,i))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(e,t,s,i,r){let h=e,l=e.length,n=t-i,a=s-r,o=t*r-s*i,c=h[l-2],d=h[l-1];for(let f=0;f<l;f+=2){let m=h[f],u=h[f+1],g=c*u-d*m,w=c-m,b=d-u,x=n*b-a*w,p=(o*w-n*g)/x;if((p>=c&&p<=m||p>=m&&p<=c)&&(p>=t&&p<=i||p>=i&&p<=t)){let v=(o*b-a*g)/x;if((v>=d&&v<=u||v>=u&&v<=d)&&(v>=s&&v<=r||v>=r&&v<=s))return!0}c=m,d=u}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}},gi=class vt{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Jt(()=>new Array);polygonIndicesPool=new Jt(()=>new Array);triangulate(t){let s=t,i=t.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<i;n++)r[n]=n;let h=this.isConcaveArray;h.length=0;for(let n=0,a=i;n<a;++n)h[n]=vt.isConcave(n,i,s,r);let l=this.triangles;for(l.length=0;i>3;){let n=i-1,a=0,o=1;for(;;){t:if(!h[a]){let f=r[n]<<1,m=r[a]<<1,u=r[o]<<1,g=s[f],w=s[f+1],b=s[m],x=s[m+1],p=s[u],v=s[u+1];for(let y=(o+1)%i;y!=n;y=(y+1)%i){if(!h[y])continue;let A=r[y]<<1,C=s[A],S=s[A+1];if(vt.positiveArea(p,v,g,w,C,S)&&vt.positiveArea(g,w,b,x,C,S)&&vt.positiveArea(b,x,p,v,C,S))break t}break}if(o==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=o,o=(o+1)%i}l.push(r[(i+a-1)%i]),l.push(r[a]),l.push(r[(a+1)%i]),r.splice(a,1),h.splice(a,1),i--;let c=(i+a-1)%i,d=a==i?0:a;h[c]=vt.isConcave(c,i,s,r),h[d]=vt.isConcave(d,i,s,r)}return i==3&&(l.push(r[2]),l.push(r[0]),l.push(r[1])),l}decompose(t,s){let i=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let l=this.polygonIndicesPool.obtain();l.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,o=0;for(let c=0,d=s.length;c<d;c+=3){let f=s[c]<<1,m=s[c+1]<<1,u=s[c+2]<<1,g=i[f],w=i[f+1],b=i[m],x=i[m+1],p=i[u],v=i[u+1],y=!1;if(a==f){let A=n.length-4,C=vt.winding(n[A],n[A+1],n[A+2],n[A+3],p,v),S=vt.winding(p,v,n[0],n[1],n[2],n[3]);C==o&&S==o&&(n.push(p),n.push(v),l.push(u),y=!0)}y||(n.length>0?(r.push(n),h.push(l)):(this.polygonPool.free(n),this.polygonIndicesPool.free(l)),n=this.polygonPool.obtain(),n.length=0,n.push(g),n.push(w),n.push(b),n.push(x),n.push(p),n.push(v),l=this.polygonIndicesPool.obtain(),l.length=0,l.push(f),l.push(m),l.push(u),o=vt.winding(g,w,b,x,p,v),a=f)}n.length>0&&(r.push(n),h.push(l));for(let c=0,d=r.length;c<d;c++){if(l=h[c],l.length==0)continue;let f=l[0],m=l[l.length-1];n=r[c];let u=n.length-4,g=n[u],w=n[u+1],b=n[u+2],x=n[u+3],p=n[0],v=n[1],y=n[2],A=n[3],C=vt.winding(g,w,b,x,p,v);for(let S=0;S<d;S++){if(S==c)continue;let I=h[S];if(I.length!=3)continue;let Y=I[0],k=I[1],F=I[2],X=r[S],E=X[X.length-2],R=X[X.length-1];if(Y!=f||k!=m)continue;let B=vt.winding(g,w,b,x,E,R),st=vt.winding(E,R,p,v,y,A);B==C&&st==C&&(X.length=0,I.length=0,n.push(E),n.push(R),l.push(F),g=b,w=x,b=E,x=R,S=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),l=h[c],h.splice(c,1),this.polygonIndicesPool.free(l));return r}static isConcave(t,s,i,r){let h=r[(s+t-1)%s]<<1,l=r[t]<<1,n=r[(t+1)%s]<<1;return!this.positiveArea(i[h],i[h+1],i[l],i[l+1],i[n],i[n+1])}static positiveArea(t,s,i,r,h,l){return t*(l-r)+i*(s-l)+h*(r-s)>=0}static winding(t,s,i,r,h,l){let n=i-t,a=r-s;return h*a-l*n+n*s-t*a>=0?1:-1}},xi=class Ns{triangulator=new gi;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=L.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(t,0,i,r,0,2);let h=this.clippingPolygon;Ns.makeClockwise(h);let l=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let n=0,a=l.length;n<a;n++){let o=l[n];Ns.makeClockwise(o),o.push(o[0]),o.push(o[1])}return l.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.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(t,s,i,r,h,l,n,a){let o,c,d,f,m,u;typeof s=="number"?(o=i,c=r,d=h,f=l,m=n,u=a):(o=s,c=i,d=r,f=h,m=l,u=n),d&&f&&m&&typeof u=="boolean"?this.clipTrianglesRender(t,o,c,d,f,m,u):this.clipTrianglesNoRender(t,o,c)}clipTrianglesNoRender(t,s,i){let r=this.clipOutput,h=this.clippedVertices,l=this.clippedTriangles,n=this.clippingPolygons,a=n.length,o=0;h.length=0,l.length=0;for(let c=0;c<i;c+=3){let d=s[c]<<1,f=t[d],m=t[d+1];d=s[c+1]<<1;let u=t[d],g=t[d+1];d=s[c+2]<<1;let w=t[d],b=t[d+1];for(let x=0;x<a;x++){let p=h.length;if(this.clip(f,m,u,g,w,b,n[x],r)){let v=r.length;if(v==0)continue;let y=v>>1,A=this.clipOutput,C=L.setArraySize(h,p+y*2);for(let I=0;I<v;I+=2,p+=2){let Y=A[I],k=A[I+1];C[p]=Y,C[p+1]=k}p=l.length;let S=L.setArraySize(l,p+3*(y-2));y--;for(let I=1;I<y;I++,p+=3)S[p]=o,S[p+1]=o+I,S[p+2]=o+I+1;o+=y+1}else{let v=L.setArraySize(h,p+6);v[p]=f,v[p+1]=m,v[p+2]=u,v[p+3]=g,v[p+4]=w,v[p+5]=b,p=l.length;let y=L.setArraySize(l,p+3);y[p]=o,y[p+1]=o+1,y[p+2]=o+2,o+=3;break}}}}clipTrianglesRender(t,s,i,r,h,l,n){let a=this.clipOutput,o=this.clippedVertices,c=this.clippedTriangles,d=this.clippingPolygons,f=d.length,m=n?12:8,u=0;o.length=0,c.length=0;for(let g=0;g<i;g+=3){let w=s[g]<<1,b=t[w],x=t[w+1],p=r[w],v=r[w+1];w=s[g+1]<<1;let y=t[w],A=t[w+1],C=r[w],S=r[w+1];w=s[g+2]<<1;let I=t[w],Y=t[w+1],k=r[w],F=r[w+1];for(let X=0;X<f;X++){let E=o.length;if(this.clip(b,x,y,A,I,Y,d[X],a)){let R=a.length;if(R==0)continue;let B=A-Y,st=I-y,et=b-I,rt=Y-x,ct=1/(B*et+st*(x-Y)),ot=R>>1,ut=this.clipOutput,Z=L.setArraySize(o,E+ot*m);for(let ht=0;ht<R;ht+=2,E+=m){let bt=ut[ht],mt=ut[ht+1];Z[E]=bt,Z[E+1]=mt,Z[E+2]=h.r,Z[E+3]=h.g,Z[E+4]=h.b,Z[E+5]=h.a;let pt=bt-I,wt=mt-Y,Mt=(B*pt+st*wt)*ct,jt=(rt*pt+et*wt)*ct,ie=1-Mt-jt;Z[E+6]=p*Mt+C*jt+k*ie,Z[E+7]=v*Mt+S*jt+F*ie,n&&(Z[E+8]=l.r,Z[E+9]=l.g,Z[E+10]=l.b,Z[E+11]=l.a)}E=c.length;let nt=L.setArraySize(c,E+3*(ot-2));ot--;for(let ht=1;ht<ot;ht++,E+=3)nt[E]=u,nt[E+1]=u+ht,nt[E+2]=u+ht+1;u+=ot+1}else{let R=L.setArraySize(o,E+3*m);R[E]=b,R[E+1]=x,R[E+2]=h.r,R[E+3]=h.g,R[E+4]=h.b,R[E+5]=h.a,n?(R[E+6]=p,R[E+7]=v,R[E+8]=l.r,R[E+9]=l.g,R[E+10]=l.b,R[E+11]=l.a,R[E+12]=y,R[E+13]=A,R[E+14]=h.r,R[E+15]=h.g,R[E+16]=h.b,R[E+17]=h.a,R[E+18]=C,R[E+19]=S,R[E+20]=l.r,R[E+21]=l.g,R[E+22]=l.b,R[E+23]=l.a,R[E+24]=I,R[E+25]=Y,R[E+26]=h.r,R[E+27]=h.g,R[E+28]=h.b,R[E+29]=h.a,R[E+30]=k,R[E+31]=F,R[E+32]=l.r,R[E+33]=l.g,R[E+34]=l.b,R[E+35]=l.a):(R[E+6]=p,R[E+7]=v,R[E+8]=y,R[E+9]=A,R[E+10]=h.r,R[E+11]=h.g,R[E+12]=h.b,R[E+13]=h.a,R[E+14]=C,R[E+15]=S,R[E+16]=I,R[E+17]=Y,R[E+18]=h.r,R[E+19]=h.g,R[E+20]=h.b,R[E+21]=h.a,R[E+22]=k,R[E+23]=F),E=c.length;let B=L.setArraySize(c,E+3);B[E]=u,B[E+1]=u+1,B[E+2]=u+2,u+=3;break}}}}clipTrianglesUnpacked(t,s,i,r){let h=this.clipOutput,l=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,o=this.clippingPolygons,c=o.length,d=0;l.length=0,n.length=0,a.length=0;for(let f=0;f<i;f+=3){let m=s[f]<<1,u=t[m],g=t[m+1],w=r[m],b=r[m+1];m=s[f+1]<<1;let x=t[m],p=t[m+1],v=r[m],y=r[m+1];m=s[f+2]<<1;let A=t[m],C=t[m+1],S=r[m],I=r[m+1];for(let Y=0;Y<c;Y++){let k=l.length;if(this.clip(u,g,x,p,A,C,o[Y],h)){let F=h.length;if(F==0)continue;let X=p-C,E=A-x,R=u-A,B=C-g,st=1/(X*R+E*(g-C)),et=F>>1,rt=this.clipOutput,ct=L.setArraySize(l,k+et*2),ot=L.setArraySize(n,k+et*2);for(let Z=0;Z<F;Z+=2,k+=2){let nt=rt[Z],ht=rt[Z+1];ct[k]=nt,ct[k+1]=ht;let bt=nt-A,mt=ht-C,pt=(X*bt+E*mt)*st,wt=(B*bt+R*mt)*st,Mt=1-pt-wt;ot[k]=w*pt+v*wt+S*Mt,ot[k+1]=b*pt+y*wt+I*Mt}k=a.length;let ut=L.setArraySize(a,k+3*(et-2));et--;for(let Z=1;Z<et;Z++,k+=3)ut[k]=d,ut[k+1]=d+Z,ut[k+2]=d+Z+1;d+=et+1}else{let F=L.setArraySize(l,k+6);F[k]=u,F[k+1]=g,F[k+2]=x,F[k+3]=p,F[k+4]=A,F[k+5]=C;let X=L.setArraySize(n,k+3*2);X[k]=w,X[k+1]=b,X[k+2]=v,X[k+3]=y,X[k+4]=S,X[k+5]=I,k=a.length;let E=L.setArraySize(a,k+3);E[k]=d,E[k+1]=d+1,E[k+2]=d+2,d+=3;break}}}}clip(t,s,i,r,h,l,n,a){let o=a,c=!1,d;n.length%4>=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(t),d.push(s),d.push(i),d.push(r),d.push(h),d.push(l),d.push(t),d.push(s),a.length=0;let f=n.length-4,m=n;for(let u=0;;u+=2){let g=m[u],w=m[u+1],b=g-m[u+2],x=w-m[u+3],p=a.length,v=d;for(let A=0,C=d.length-2;A<C;){let S=v[A],I=v[A+1];A+=2;let Y=v[A],k=v[A+1],F=x*(g-Y)>b*(w-k),X=x*(g-S)-b*(w-I);if(X>0){if(F){a.push(Y),a.push(k);continue}let E=Y-S,R=k-I,B=X/(E*x-R*b);if(B>=0&&B<=1)a.push(S+E*B),a.push(I+R*B);else{a.push(Y),a.push(k);continue}}else if(F){let E=Y-S,R=k-I,B=X/(E*x-R*b);if(B>=0&&B<=1)a.push(S+E*B),a.push(I+R*B),a.push(Y),a.push(k);else{a.push(Y),a.push(k);continue}}c=!0}if(p==a.length)return o.length=0,!0;if(a.push(a[0]),a.push(a[1]),u==f)break;let y=a;a=d,a.length=0,d=y}if(o!=a){o.length=0;for(let u=0,g=a.length-2;u<g;u++)o[u]=a[u]}else o.length=o.length-2;return c}static makeClockwise(t){let s=t,i=t.length,r=s[i-2]*s[1]-s[0]*s[i-1],h=0,l=0,n=0,a=0;for(let o=0,c=i-3;o<c;o+=2)h=s[o],l=s[o+1],n=s[o+2],a=s[o+3],r+=h*a-n*l;if(!(r<0))for(let o=0,c=i-2,d=i>>1;o<d;o+=2){let f=s[o],m=s[o+1],u=c-o;s[o]=s[u],s[o+1]=s[u+1],s[u]=f,s[u+1]=m}}},Nr=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new As,i=typeof e=="string"?JSON.parse(e):e,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=M(r,"referenceScale",100)*t,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let h=0;h<i.bones.length;h++){let l=i.bones[h],n=null,a=M(l,"parent",null);a&&(n=s.findBone(a));let o=new fs(s.bones.length,l.name,n);o.length=M(l,"length",0)*t,o.x=M(l,"x",0)*t,o.y=M(l,"y",0)*t,o.rotation=M(l,"rotation",0),o.scaleX=M(l,"scaleX",1),o.scaleY=M(l,"scaleY",1),o.shearX=M(l,"shearX",0),o.shearY=M(l,"shearY",0),o.inherit=L.enumValue(de,M(l,"inherit","Normal")),o.skinRequired=M(l,"skin",!1);let c=M(l,"color",null);c&&o.color.setFromString(c),s.bones.push(o)}if(i.slots)for(let h=0;h<i.slots.length;h++){let l=i.slots[h],n=l.name,a=s.findBone(l.bone);if(!a)throw new Error(`Couldn't find bone ${l.bone} for slot ${n}`);let o=new Ss(s.slots.length,n,a),c=M(l,"color",null);c&&o.color.setFromString(c);let d=M(l,"dark",null);d&&(o.darkColor=tt.fromString(d)),o.attachmentName=M(l,"attachment",null),o.blendMode=L.enumValue(Ts,M(l,"blend","normal")),o.visible=M(l,"visible",!0),s.slots.push(o)}if(i.ik)for(let h=0;h<i.ik.length;h++){let l=i.ik[h],n=new ps(l.name);n.order=M(l,"order",0),n.skinRequired=M(l,"skin",!1);for(let o=0;o<l.bones.length;o++){let c=s.findBone(l.bones[o]);if(!c)throw new Error(`Couldn't find bone ${l.bones[o]} for IK constraint ${l.name}.`);n.bones.push(c)}let a=s.findBone(l.target);if(!a)throw new Error(`Couldn't find target bone ${l.target} for IK constraint ${l.name}.`);n.target=a,n.mix=M(l,"mix",1),n.softness=M(l,"softness",0)*t,n.bendDirection=M(l,"bendPositive",!0)?1:-1,n.compress=M(l,"compress",!1),n.stretch=M(l,"stretch",!1),n.uniform=M(l,"uniform",!1),s.ikConstraints.push(n)}if(i.transform)for(let h=0;h<i.transform.length;h++){let l=i.transform[h],n=new Is(l.name);n.order=M(l,"order",0),n.skinRequired=M(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let d=l.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${l.name}.`);n.bones.push(f)}let a=l.target,o=s.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${l.name}.`);n.target=o,n.local=M(l,"local",!1),n.relative=M(l,"relative",!1),n.offsetRotation=M(l,"rotation",0),n.offsetX=M(l,"x",0)*t,n.offsetY=M(l,"y",0)*t,n.offsetScaleX=M(l,"scaleX",0),n.offsetScaleY=M(l,"scaleY",0),n.offsetShearY=M(l,"shearY",0),n.mixRotate=M(l,"mixRotate",1),n.mixX=M(l,"mixX",1),n.mixY=M(l,"mixY",n.mixX),n.mixScaleX=M(l,"mixScaleX",1),n.mixScaleY=M(l,"mixScaleY",n.mixScaleX),n.mixShearY=M(l,"mixShearY",1),s.transformConstraints.push(n)}if(i.path)for(let h=0;h<i.path.length;h++){let l=i.path[h],n=new ws(l.name);n.order=M(l,"order",0),n.skinRequired=M(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let d=l.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${l.name}.`);n.bones.push(f)}let a=l.target,o=s.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${l.name}.`);n.target=o,n.positionMode=L.enumValue(bs,M(l,"positionMode","Percent")),n.spacingMode=L.enumValue(vs,M(l,"spacingMode","Length")),n.rotateMode=L.enumValue(ys,M(l,"rotateMode","Tangent")),n.offsetRotation=M(l,"rotation",0),n.position=M(l,"position",0),n.positionMode==0&&(n.position*=t),n.spacing=M(l,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=t),n.mixRotate=M(l,"mixRotate",1),n.mixX=M(l,"mixX",1),n.mixY=M(l,"mixY",n.mixX),s.pathConstraints.push(n)}if(i.physics)for(let h=0;h<i.physics.length;h++){const l=i.physics[h],n=new fi(l.name);n.order=M(l,"order",0),n.skinRequired=M(l,"skin",!1);const a=l.bone,o=s.findBone(a);if(o==null)throw new Error("Physics bone not found: "+a);n.bone=o,n.x=M(l,"x",0),n.y=M(l,"y",0),n.rotate=M(l,"rotate",0),n.scaleX=M(l,"scaleX",0),n.shearX=M(l,"shearX",0),n.limit=M(l,"limit",5e3)*t,n.step=1/M(l,"fps",60),n.inertia=M(l,"inertia",1),n.strength=M(l,"strength",100),n.damping=M(l,"damping",1),n.massInverse=1/M(l,"mass",1),n.wind=M(l,"wind",0),n.gravity=M(l,"gravity",0),n.mix=M(l,"mix",1),n.inertiaGlobal=M(l,"inertiaGlobal",!1),n.strengthGlobal=M(l,"strengthGlobal",!1),n.dampingGlobal=M(l,"dampingGlobal",!1),n.massGlobal=M(l,"massGlobal",!1),n.windGlobal=M(l,"windGlobal",!1),n.gravityGlobal=M(l,"gravityGlobal",!1),n.mixGlobal=M(l,"mixGlobal",!1),s.physicsConstraints.push(n)}if(i.skins)for(let h=0;h<i.skins.length;h++){let l=i.skins[h],n=new fe(l.name);if(l.bones)for(let a=0;a<l.bones.length;a++){let o=l.bones[a],c=s.findBone(o);if(!c)throw new Error(`Couldn't find bone ${o} for skin ${l.name}.`);n.bones.push(c)}if(l.ik)for(let a=0;a<l.ik.length;a++){let o=l.ik[a],c=s.findIkConstraint(o);if(!c)throw new Error(`Couldn't find IK constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.transform)for(let a=0;a<l.transform.length;a++){let o=l.transform[a],c=s.findTransformConstraint(o);if(!c)throw new Error(`Couldn't find transform constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.path)for(let a=0;a<l.path.length;a++){let o=l.path[a],c=s.findPathConstraint(o);if(!c)throw new Error(`Couldn't find path constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.physics)for(let a=0;a<l.physics.length;a++){let o=l.physics[a],c=s.findPhysicsConstraint(o);if(!c)throw new Error(`Couldn't find physics constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}for(let a in l.attachments){let o=s.findSlot(a);if(!o)throw new Error(`Couldn't find slot ${a} for skin ${l.name}.`);let c=l.attachments[a];for(let d in c){let f=this.readAttachment(c[d],n,o.index,d,s);f&&n.setAttachment(o.index,d,f)}}s.skins.push(n),n.name=="default"&&(s.defaultSkin=n)}for(let h=0,l=this.linkedMeshes.length;h<l;h++){let n=this.linkedMeshes[h],a=n.skin?s.findSkin(n.skin):s.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let o=a.getAttachment(n.slotIndex,n.parent);if(!o)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?o:n.mesh,n.mesh.setParentMesh(o),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let h in i.events){let l=i.events[h],n=new xs(h);n.intValue=M(l,"int",0),n.floatValue=M(l,"float",0),n.stringValue=M(l,"string",""),n.audioPath=M(l,"audio",null),n.audioPath&&(n.volume=M(l,"volume",1),n.balance=M(l,"balance",0)),s.events.push(n)}if(i.animations)for(let h in i.animations){let l=i.animations[h];this.readAnimation(l,h,s)}return s}readAttachment(e,t,s,i,r){let h=this.scale;switch(i=M(e,"name",i),M(e,"type","region")){case"region":{let l=M(e,"path",i),n=this.readSequence(M(e,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(t,i,l,n);if(!a)return null;a.path=l,a.x=M(e,"x",0)*h,a.y=M(e,"y",0)*h,a.scaleX=M(e,"scaleX",1),a.scaleY=M(e,"scaleY",1),a.rotation=M(e,"rotation",0),a.width=e.width*h,a.height=e.height*h,a.sequence=n;let o=M(e,"color",null);return o&&a.color.setFromString(o),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!l)return null;this.readVertices(e,l,e.vertexCount<<1);let n=M(e,"color",null);return n&&l.color.setFromString(n),l}case"mesh":case"linkedmesh":{let l=M(e,"path",i),n=this.readSequence(M(e,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(t,i,l,n);if(!a)return null;a.path=l;let o=M(e,"color",null);o&&a.color.setFromString(o),a.width=M(e,"width",0)*h,a.height=M(e,"height",0)*h,a.sequence=n;let c=M(e,"parent",null);if(c)return this.linkedMeshes.push(new Ur(a,M(e,"skin",null),s,c,M(e,"timelines",!0))),a;let d=e.uvs;return this.readVertices(e,a,d.length),a.triangles=e.triangles,a.regionUVs=d,a.region!=null&&a.updateRegion(),a.edges=M(e,"edges",null),a.hullLength=M(e,"hull",0)*2,a}case"path":{let l=this.attachmentLoader.newPathAttachment(t,i);if(!l)return null;l.closed=M(e,"closed",!1),l.constantSpeed=M(e,"constantSpeed",!0);let n=e.vertexCount;this.readVertices(e,l,n<<1);let a=L.newArray(n/3,0);for(let c=0;c<e.lengths.length;c++)a[c]=e.lengths[c]*h;l.lengths=a;let o=M(e,"color",null);return o&&l.color.setFromString(o),l}case"point":{let l=this.attachmentLoader.newPointAttachment(t,i);if(!l)return null;l.x=M(e,"x",0)*h,l.y=M(e,"y",0)*h,l.rotation=M(e,"rotation",0);let n=M(e,"color",null);return n&&l.color.setFromString(n),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(t,i);if(!l)return null;let n=M(e,"end",null);n&&(l.endSlot=r.findSlot(n));let a=e.vertexCount;this.readVertices(e,l,a<<1);let o=M(e,"color",null);return o&&l.color.setFromString(o),l}}return null}readSequence(e){if(e==null)return null;let t=new Gs(M(e,"count",0));return t.start=M(e,"start",1),t.digits=M(e,"digits",0),t.setupIndex=M(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let r=e.vertices;if(s==r.length){let n=L.toFloatArray(r);if(i!=1)for(let a=0,o=r.length;a<o;a++)n[a]*=i;t.vertices=n;return}let h=new Array,l=new Array;for(let n=0,a=r.length;n<a;){let o=r[n++];l.push(o);for(let c=n+o*4;n<c;n+=4)l.push(r[n]),h.push(r[n+1]*i),h.push(r[n+2]*i),h.push(r[n+3])}t.bones=l,t.vertices=L.toFloatArray(h)}readAnimation(e,t,s){let i=this.scale,r=new Array;if(e.slots)for(let l in e.slots){let n=e.slots[l],a=s.findSlot(l);if(!a)throw new Error("Slot not found: "+l);let o=a.index;for(let c in n){let d=n[c];if(!d)continue;let f=d.length;if(c=="attachment"){let m=new Ot(f,o);for(let u=0;u<f;u++){let g=d[u];m.setFrame(u,M(g,"time",0),M(g,"name",null))}r.push(m)}else if(c=="rgba"){let m=new De(f,f<<2,o),u=d[0],g=M(u,"time",0),w=tt.fromString(u.color);for(let b=0,x=0;;b++){m.setFrame(b,g,w.r,w.g,w.b,w.a);let p=d[b+1];if(!p){m.shrink(x);break}let v=M(p,"time",0),y=tt.fromString(p.color),A=u.curve;A&&(x=lt(A,m,x,b,0,g,v,w.r,y.r,1),x=lt(A,m,x,b,1,g,v,w.g,y.g,1),x=lt(A,m,x,b,2,g,v,w.b,y.b,1),x=lt(A,m,x,b,3,g,v,w.a,y.a,1)),g=v,w=y,u=p}r.push(m)}else if(c=="rgb"){let m=new Ne(f,f*3,o),u=d[0],g=M(u,"time",0),w=tt.fromString(u.color);for(let b=0,x=0;;b++){m.setFrame(b,g,w.r,w.g,w.b);let p=d[b+1];if(!p){m.shrink(x);break}let v=M(p,"time",0),y=tt.fromString(p.color),A=u.curve;A&&(x=lt(A,m,x,b,0,g,v,w.r,y.r,1),x=lt(A,m,x,b,1,g,v,w.g,y.g,1),x=lt(A,m,x,b,2,g,v,w.b,y.b,1)),g=v,w=y,u=p}r.push(m)}else if(c=="alpha")r.push(St(d,new Ue(f,f,o),0,1));else if(c=="rgba2"){let m=new ze(f,f*7,o),u=d[0],g=M(u,"time",0),w=tt.fromString(u.light),b=tt.fromString(u.dark);for(let x=0,p=0;;x++){m.setFrame(x,g,w.r,w.g,w.b,w.a,b.r,b.g,b.b);let v=d[x+1];if(!v){m.shrink(p);break}let y=M(v,"time",0),A=tt.fromString(v.light),C=tt.fromString(v.dark),S=u.curve;S&&(p=lt(S,m,p,x,0,g,y,w.r,A.r,1),p=lt(S,m,p,x,1,g,y,w.g,A.g,1),p=lt(S,m,p,x,2,g,y,w.b,A.b,1),p=lt(S,m,p,x,3,g,y,w.a,A.a,1),p=lt(S,m,p,x,4,g,y,b.r,C.r,1),p=lt(S,m,p,x,5,g,y,b.g,C.g,1),p=lt(S,m,p,x,6,g,y,b.b,C.b,1)),g=y,w=A,b=C,u=v}r.push(m)}else if(c=="rgb2"){let m=new We(f,f*6,o),u=d[0],g=M(u,"time",0),w=tt.fromString(u.light),b=tt.fromString(u.dark);for(let x=0,p=0;;x++){m.setFrame(x,g,w.r,w.g,w.b,b.r,b.g,b.b);let v=d[x+1];if(!v){m.shrink(p);break}let y=M(v,"time",0),A=tt.fromString(v.light),C=tt.fromString(v.dark),S=u.curve;S&&(p=lt(S,m,p,x,0,g,y,w.r,A.r,1),p=lt(S,m,p,x,1,g,y,w.g,A.g,1),p=lt(S,m,p,x,2,g,y,w.b,A.b,1),p=lt(S,m,p,x,3,g,y,b.r,C.r,1),p=lt(S,m,p,x,4,g,y,b.g,C.g,1),p=lt(S,m,p,x,5,g,y,b.b,C.b,1)),g=y,w=A,b=C,u=v}r.push(m)}}}if(e.bones)for(let l in e.bones){let n=e.bones[l],a=s.findBone(l);if(!a)throw new Error("Bone not found: "+l);let o=a.index;for(let c in n){let d=n[c],f=d.length;if(f!=0){if(c==="rotate")r.push(St(d,new Qt(f,f,o),0,1));else if(c==="translate"){let m=new Re(f,f<<1,o);r.push(Es(d,m,"x","y",0,i))}else if(c==="translatex"){let m=new Ye(f,f,o);r.push(St(d,m,0,i))}else if(c==="translatey"){let m=new ke(f,f,o);r.push(St(d,m,0,i))}else if(c==="scale"){let m=new Fe(f,f<<1,o);r.push(Es(d,m,"x","y",1,1))}else if(c==="scalex"){let m=new Xe(f,f,o);r.push(St(d,m,1,1))}else if(c==="scaley"){let m=new Pe(f,f,o);r.push(St(d,m,1,1))}else if(c==="shear"){let m=new Le(f,f<<1,o);r.push(Es(d,m,"x","y",0,1))}else if(c==="shearx"){let m=new Be(f,f,o);r.push(St(d,m,0,1))}else if(c==="sheary"){let m=new Ve(f,f,o);r.push(St(d,m,0,1))}else if(c==="inherit"){let m=new Oe(f,a.index);for(let u=0;u<d.length;u++){let g=d[u];m.setFrame(u,M(g,"time",0),L.enumValue(de,M(g,"inherit","Normal")))}r.push(m)}}}}if(e.ik)for(let l in e.ik){let n=e.ik[l],a=n[0];if(!a)continue;let o=s.findIkConstraint(l);if(!o)throw new Error("IK Constraint not found: "+l);let c=s.ikConstraints.indexOf(o),d=new Ge(n.length,n.length<<1,c),f=M(a,"time",0),m=M(a,"mix",1),u=M(a,"softness",0)*i;for(let g=0,w=0;;g++){d.setFrame(g,f,m,u,M(a,"bendPositive",!0)?1:-1,M(a,"compress",!1),M(a,"stretch",!1));let b=n[g+1];if(!b){d.shrink(w);break}let x=M(b,"time",0),p=M(b,"mix",1),v=M(b,"softness",0)*i,y=a.curve;y&&(w=lt(y,d,w,g,0,f,x,m,p,1),w=lt(y,d,w,g,1,f,x,u,v,i)),f=x,m=p,u=v,a=b}r.push(d)}if(e.transform)for(let l in e.transform){let n=e.transform[l],a=n[0];if(!a)continue;let o=s.findTransformConstraint(l);if(!o)throw new Error("Transform constraint not found: "+l);let c=s.transformConstraints.indexOf(o),d=new He(n.length,n.length*6,c),f=M(a,"time",0),m=M(a,"mixRotate",1),u=M(a,"mixX",1),g=M(a,"mixY",u),w=M(a,"mixScaleX",1),b=M(a,"mixScaleY",w),x=M(a,"mixShearY",1);for(let p=0,v=0;;p++){d.setFrame(p,f,m,u,g,w,b,x);let y=n[p+1];if(!y){d.shrink(v);break}let A=M(y,"time",0),C=M(y,"mixRotate",1),S=M(y,"mixX",1),I=M(y,"mixY",S),Y=M(y,"mixScaleX",1),k=M(y,"mixScaleY",Y),F=M(y,"mixShearY",1),X=a.curve;X&&(v=lt(X,d,v,p,0,f,A,m,C,1),v=lt(X,d,v,p,1,f,A,u,S,1),v=lt(X,d,v,p,2,f,A,g,I,1),v=lt(X,d,v,p,3,f,A,w,Y,1),v=lt(X,d,v,p,4,f,A,b,k,1),v=lt(X,d,v,p,5,f,A,x,F,1)),f=A,m=C,u=S,g=I,w=Y,b=k,w=Y,a=y}r.push(d)}if(e.path)for(let l in e.path){let n=e.path[l],a=s.findPathConstraint(l);if(!a)throw new Error("Path constraint not found: "+l);let o=s.pathConstraints.indexOf(a);for(let c in n){let d=n[c],f=d[0];if(!f)continue;let m=d.length;if(c==="position"){let u=new _e(m,m,o);r.push(St(d,u,0,a.positionMode==0?i:1))}else if(c==="spacing"){let u=new je(m,m,o);r.push(St(d,u,0,a.spacingMode==0||a.spacingMode==1?i:1))}else if(c==="mix"){let u=new Ze(m,m*3,o),g=M(f,"time",0),w=M(f,"mixRotate",1),b=M(f,"mixX",1),x=M(f,"mixY",b);for(let p=0,v=0;;p++){u.setFrame(p,g,w,b,x);let y=d[p+1];if(!y){u.shrink(v);break}let A=M(y,"time",0),C=M(y,"mixRotate",1),S=M(y,"mixX",1),I=M(y,"mixY",S),Y=f.curve;Y&&(v=lt(Y,u,v,p,0,g,A,w,C,1),v=lt(Y,u,v,p,1,g,A,b,S,1),v=lt(Y,u,v,p,2,g,A,x,I,1)),g=A,w=C,b=S,x=I,f=y}r.push(u)}}}if(e.physics)for(let l in e.physics){let n=e.physics[l],a=-1;if(l.length>0){let o=s.findPhysicsConstraint(l);if(!o)throw new Error("Physics constraint not found: "+l);a=s.physicsConstraints.indexOf(o)}for(let o in n){let c=n[o],d=c[0];if(!d)continue;let f=c.length;if(o=="reset"){const u=new is(f,a);for(let g=0;d!=null;d=c[g+1],g++)u.setFrame(g,M(d,"time",0));r.push(u);continue}let m;if(o=="inertia")m=new Ke(f,f,a);else if(o=="strength")m=new Je(f,f,a);else if(o=="damping")m=new Qe(f,f,a);else if(o=="mass")m=new $e(f,f,a);else if(o=="wind")m=new ts(f,f,a);else if(o=="gravity")m=new es(f,f,a);else if(o=="mix")m=new ss(f,f,a);else continue;r.push(St(c,m,0,1))}}if(e.attachments)for(let l in e.attachments){let n=e.attachments[l],a=s.findSkin(l);if(!a)throw new Error("Skin not found: "+l);for(let o in n){let c=n[o],d=s.findSlot(o);if(!d)throw new Error("Slot not found: "+o);let f=d.index;for(let m in c){let u=c[m],g=a.getAttachment(f,m);for(let w in u){let b=u[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 qe(b.length,b.length,f,g),C=M(x,"time",0);for(let S=0,I=0;;S++){let Y,k=M(x,"vertices",null);if(!k)Y=p?L.newFloatArray(y):v;else{Y=L.newFloatArray(y);let R=M(x,"offset",0);if(L.arrayCopy(k,0,Y,R,k.length),i!=1)for(let B=R,st=B+k.length;B<st;B++)Y[B]*=i;if(!p)for(let B=0;B<y;B++)Y[B]+=v[B]}A.setFrame(S,C,Y);let F=b[S+1];if(!F){A.shrink(I);break}let X=M(F,"time",0),E=x.curve;E&&(I=lt(E,A,I,S,0,C,X,0,1,1)),C=X,x=F}r.push(A)}else if(w=="sequence"){let p=new rs(b.length,f,g),v=0;for(let y=0;y<b.length;y++){let A=M(x,"delay",v),C=M(x,"time",0),S=Hs[M(x,"mode","hold")],I=M(x,"index",0);p.setFrame(y,C,S,I,A),v=A,x=b[y+1]}r.push(p)}}}}}}if(e.drawOrder){let l=new zt(e.drawOrder.length),n=s.slots.length,a=0;for(let o=0;o<e.drawOrder.length;o++,a++){let c=e.drawOrder[o],d=null,f=M(c,"offsets",null);if(f){d=L.newArray(n,-1);let m=L.newArray(n-f.length,0),u=0,g=0;for(let w=0;w<f.length;w++){let b=f[w],x=s.findSlot(b.slot);if(!x)throw new Error("Slot not found: "+x);let p=x.index;for(;u!=p;)m[g++]=u++;d[u+b.offset]=u++}for(;u<n;)m[g++]=u++;for(let w=n-1;w>=0;w--)d[w]==-1&&(d[w]=m[--g])}l.setFrame(a,M(c,"time",0),d)}r.push(l)}if(e.events){let l=new le(e.events.length),n=0;for(let a=0;a<e.events.length;a++,n++){let o=e.events[a],c=s.findEvent(o.name);if(!c)throw new Error("Event not found: "+o.name);let d=new gs(L.toSinglePrecision(M(o,"time",0)),c);d.intValue=M(o,"int",c.intValue),d.floatValue=M(o,"float",c.floatValue),d.stringValue=M(o,"string",c.stringValue),d.data.audioPath&&(d.volume=M(o,"volume",1),d.balance=M(o,"balance",0)),l.setFrame(n,d)}r.push(l)}let h=0;for(let l=0,n=r.length;l<n;l++)h=Math.max(h,r[l].getDuration());s.animations.push(new ne(t,r,h))}},Ur=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};function St(e,t,s,i){let r=e[0],h=M(r,"time",0),l=M(r,"value",s)*i,n=0;for(let a=0;;a++){t.setFrame(a,h,l);let o=e[a+1];if(!o)return t.shrink(n),t;let c=M(o,"time",0),d=M(o,"value",s)*i;r.curve&&(n=lt(r.curve,t,n,a,0,h,c,l,d,i)),h=c,l=d,r=o}}function Es(e,t,s,i,r,h){let l=e[0],n=M(l,"time",0),a=M(l,s,r)*h,o=M(l,i,r)*h,c=0;for(let d=0;;d++){t.setFrame(d,n,a,o);let f=e[d+1];if(!f)return t.shrink(c),t;let m=M(f,"time",0),u=M(f,s,r)*h,g=M(f,i,r)*h,w=l.curve;w&&(c=lt(w,t,c,d,0,n,m,a,u,h),c=lt(w,t,c,d,1,n,m,o,g,h)),n=m,a=u,o=g,l=f}}function lt(e,t,s,i,r,h,l,n,a,o){if(e=="stepped")return t.setStepped(i),s;let c=r<<2,d=e[c],f=e[c+1]*o,m=e[c+2],u=e[c+3]*o;return t.setBezier(s,i,r,h,n,d,f,m,u,l,a),s+1}function M(e,t,s){return e[t]!==void 0?e[t]:s}typeof Math.fround>"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));var xt=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 s=e;this.gl=s.getContext("webgl2",t)||s.getContext("webgl",t),this.canvas=s,s.addEventListener("webglcontextlost",i=>{let r=i;i&&i.preventDefault()}),s.addEventListener("webglcontextrestored",i=>{for(let r=0,h=this.restorables.length;r<h;r++)this.restorables[r].restore()})}}addRestorable(e){this.restorables.push(e)}removeRestorable(e){let t=this.restorables.indexOf(e);t>-1&&this.restorables.splice(t,1)}},Gt=class Se extends hs{context;texture=null;boundUnit=0;useMipMaps=!1;static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL=!1;constructor(t,s,i=!1){super(s),this.context=t instanceof xt?t:new xt(t),this.useMipMaps=i,this.restore(),this.context.addRestorable(this)}setFilters(t,s){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,Se.validateMagFilter(s)),this.useMipMaps=Se.usesMipMaps(t),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(t){switch(t){case 9987:case 9985:case 9986:case 9984:return 9729;default:return t}}static usesMipMaps(t){switch(t){case 9987:case 9985:case 9986:case 9984:return!0;default:return!1}}setWraps(t,s){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,s)}update(t){let s=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind(),Se.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,this._image),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,t?s.LINEAR_MIPMAP_LINEAR:s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),t&&s.generateMipmap(s.TEXTURE_2D)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(t=0){let s=this.context.gl;this.boundUnit=t,s.activeTexture(s.TEXTURE0+t),s.bindTexture(s.TEXTURE_2D,this.texture)}unbind(){let t=this.context.gl;t.activeTexture(t.TEXTURE0+this.boundUnit),t.bindTexture(t.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}},pi=class extends ni{constructor(e,t="",s=new ms){super(i=>new Gt(e,i),t,s)}},At=class{x=0;y=0;z=0;constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.z=s}setFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,s){return this.x=e,this.y=t,this.z=s,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[V]+this.y*t[W]+this.z*t[q]+t[O],this.x*t[G]+this.y*t[D]+this.z*t[H]+t[N],this.x*t[_]+this.y*t[j]+this.z*t[U]+t[z])}project(e){let t=e.values,s=1/(this.x*t[J]+this.y*t[Q]+this.z*t[$]+t[K]);return this.set((this.x*t[V]+this.y*t[W]+this.z*t[q]+t[O])*s,(this.x*t[G]+this.y*t[D]+this.z*t[H]+t[N])*s,(this.x*t[_]+this.y*t[j]+this.z*t[U]+t[z])*s)}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,s=e.y-this.y,i=e.z-this.z;return Math.sqrt(t*t+s*s+i*i)}},V=0,W=4,q=8,O=12,G=1,D=5,H=9,N=13,_=2,j=6,U=10,z=14,J=3,Q=7,$=11,K=15,se=class Rt{temp=new Float32Array(16);values=new Float32Array(16);static xAxis=new At;static yAxis=new At;static zAxis=new At;static tmpMatrix=new Rt;constructor(){let t=this.values;t[V]=1,t[D]=1,t[U]=1,t[K]=1}set(t){return this.values.set(t),this}transpose(){let t=this.temp,s=this.values;return t[V]=s[V],t[W]=s[G],t[q]=s[_],t[O]=s[J],t[G]=s[W],t[D]=s[D],t[H]=s[j],t[N]=s[Q],t[_]=s[q],t[j]=s[H],t[U]=s[U],t[z]=s[$],t[J]=s[O],t[Q]=s[N],t[$]=s[z],t[K]=s[K],this.set(t)}identity(){let t=this.values;return t[V]=1,t[W]=0,t[q]=0,t[O]=0,t[G]=0,t[D]=1,t[H]=0,t[N]=0,t[_]=0,t[j]=0,t[U]=1,t[z]=0,t[J]=0,t[Q]=0,t[$]=0,t[K]=1,this}invert(){let t=this.values,s=this.temp,i=t[J]*t[j]*t[H]*t[O]-t[_]*t[Q]*t[H]*t[O]-t[J]*t[D]*t[U]*t[O]+t[G]*t[Q]*t[U]*t[O]+t[_]*t[D]*t[$]*t[O]-t[G]*t[j]*t[$]*t[O]-t[J]*t[j]*t[q]*t[N]+t[_]*t[Q]*t[q]*t[N]+t[J]*t[W]*t[U]*t[N]-t[V]*t[Q]*t[U]*t[N]-t[_]*t[W]*t[$]*t[N]+t[V]*t[j]*t[$]*t[N]+t[J]*t[D]*t[q]*t[z]-t[G]*t[Q]*t[q]*t[z]-t[J]*t[W]*t[H]*t[z]+t[V]*t[Q]*t[H]*t[z]+t[G]*t[W]*t[$]*t[z]-t[V]*t[D]*t[$]*t[z]-t[_]*t[D]*t[q]*t[K]+t[G]*t[j]*t[q]*t[K]+t[_]*t[W]*t[H]*t[K]-t[V]*t[j]*t[H]*t[K]-t[G]*t[W]*t[U]*t[K]+t[V]*t[D]*t[U]*t[K];if(i==0)throw new Error("non-invertible matrix");let r=1/i;return s[V]=t[H]*t[z]*t[Q]-t[N]*t[U]*t[Q]+t[N]*t[j]*t[$]-t[D]*t[z]*t[$]-t[H]*t[j]*t[K]+t[D]*t[U]*t[K],s[W]=t[O]*t[U]*t[Q]-t[q]*t[z]*t[Q]-t[O]*t[j]*t[$]+t[W]*t[z]*t[$]+t[q]*t[j]*t[K]-t[W]*t[U]*t[K],s[q]=t[q]*t[N]*t[Q]-t[O]*t[H]*t[Q]+t[O]*t[D]*t[$]-t[W]*t[N]*t[$]-t[q]*t[D]*t[K]+t[W]*t[H]*t[K],s[O]=t[O]*t[H]*t[j]-t[q]*t[N]*t[j]-t[O]*t[D]*t[U]+t[W]*t[N]*t[U]+t[q]*t[D]*t[z]-t[W]*t[H]*t[z],s[G]=t[N]*t[U]*t[J]-t[H]*t[z]*t[J]-t[N]*t[_]*t[$]+t[G]*t[z]*t[$]+t[H]*t[_]*t[K]-t[G]*t[U]*t[K],s[D]=t[q]*t[z]*t[J]-t[O]*t[U]*t[J]+t[O]*t[_]*t[$]-t[V]*t[z]*t[$]-t[q]*t[_]*t[K]+t[V]*t[U]*t[K],s[H]=t[O]*t[H]*t[J]-t[q]*t[N]*t[J]-t[O]*t[G]*t[$]+t[V]*t[N]*t[$]+t[q]*t[G]*t[K]-t[V]*t[H]*t[K],s[N]=t[q]*t[N]*t[_]-t[O]*t[H]*t[_]+t[O]*t[G]*t[U]-t[V]*t[N]*t[U]-t[q]*t[G]*t[z]+t[V]*t[H]*t[z],s[_]=t[D]*t[z]*t[J]-t[N]*t[j]*t[J]+t[N]*t[_]*t[Q]-t[G]*t[z]*t[Q]-t[D]*t[_]*t[K]+t[G]*t[j]*t[K],s[j]=t[O]*t[j]*t[J]-t[W]*t[z]*t[J]-t[O]*t[_]*t[Q]+t[V]*t[z]*t[Q]+t[W]*t[_]*t[K]-t[V]*t[j]*t[K],s[U]=t[W]*t[N]*t[J]-t[O]*t[D]*t[J]+t[O]*t[G]*t[Q]-t[V]*t[N]*t[Q]-t[W]*t[G]*t[K]+t[V]*t[D]*t[K],s[z]=t[O]*t[D]*t[_]-t[W]*t[N]*t[_]-t[O]*t[G]*t[j]+t[V]*t[N]*t[j]+t[W]*t[G]*t[z]-t[V]*t[D]*t[z],s[J]=t[H]*t[j]*t[J]-t[D]*t[U]*t[J]-t[H]*t[_]*t[Q]+t[G]*t[U]*t[Q]+t[D]*t[_]*t[$]-t[G]*t[j]*t[$],s[Q]=t[W]*t[U]*t[J]-t[q]*t[j]*t[J]+t[q]*t[_]*t[Q]-t[V]*t[U]*t[Q]-t[W]*t[_]*t[$]+t[V]*t[j]*t[$],s[$]=t[q]*t[D]*t[J]-t[W]*t[H]*t[J]-t[q]*t[G]*t[Q]+t[V]*t[H]*t[Q]+t[W]*t[G]*t[$]-t[V]*t[D]*t[$],s[K]=t[W]*t[H]*t[_]-t[q]*t[D]*t[_]+t[q]*t[G]*t[j]-t[V]*t[H]*t[j]-t[W]*t[G]*t[U]+t[V]*t[D]*t[U],t[V]=s[V]*r,t[W]=s[W]*r,t[q]=s[q]*r,t[O]=s[O]*r,t[G]=s[G]*r,t[D]=s[D]*r,t[H]=s[H]*r,t[N]=s[N]*r,t[_]=s[_]*r,t[j]=s[j]*r,t[U]=s[U]*r,t[z]=s[z]*r,t[J]=s[J]*r,t[Q]=s[Q]*r,t[$]=s[$]*r,t[K]=s[K]*r,this}determinant(){let t=this.values;return t[J]*t[j]*t[H]*t[O]-t[_]*t[Q]*t[H]*t[O]-t[J]*t[D]*t[U]*t[O]+t[G]*t[Q]*t[U]*t[O]+t[_]*t[D]*t[$]*t[O]-t[G]*t[j]*t[$]*t[O]-t[J]*t[j]*t[q]*t[N]+t[_]*t[Q]*t[q]*t[N]+t[J]*t[W]*t[U]*t[N]-t[V]*t[Q]*t[U]*t[N]-t[_]*t[W]*t[$]*t[N]+t[V]*t[j]*t[$]*t[N]+t[J]*t[D]*t[q]*t[z]-t[G]*t[Q]*t[q]*t[z]-t[J]*t[W]*t[H]*t[z]+t[V]*t[Q]*t[H]*t[z]+t[G]*t[W]*t[$]*t[z]-t[V]*t[D]*t[$]*t[z]-t[_]*t[D]*t[q]*t[K]+t[G]*t[j]*t[q]*t[K]+t[_]*t[W]*t[H]*t[K]-t[V]*t[j]*t[H]*t[K]-t[G]*t[W]*t[U]*t[K]+t[V]*t[D]*t[U]*t[K]}translate(t,s,i){let r=this.values;return r[O]+=t,r[N]+=s,r[z]+=i,this}copy(){return new Rt().set(this.values)}projection(t,s,i,r){this.identity();let h=1/Math.tan(i*(Math.PI/180)/2),l=(s+t)/(t-s),n=2*s*t/(t-s),a=this.values;return a[V]=h/r,a[G]=0,a[_]=0,a[J]=0,a[W]=0,a[D]=h,a[j]=0,a[Q]=0,a[q]=0,a[H]=0,a[U]=l,a[$]=-1,a[O]=0,a[N]=0,a[z]=n,a[K]=0,this}ortho2d(t,s,i,r){return this.ortho(t,t+i,s,s+r,0,1)}ortho(t,s,i,r,h,l){this.identity();let n=2/(s-t),a=2/(r-i),o=-2/(l-h),c=-(s+t)/(s-t),d=-(r+i)/(r-i),f=-(l+h)/(l-h),m=this.values;return m[V]=n,m[G]=0,m[_]=0,m[J]=0,m[W]=0,m[D]=a,m[j]=0,m[Q]=0,m[q]=0,m[H]=0,m[U]=o,m[$]=0,m[O]=c,m[N]=d,m[z]=f,m[K]=1,this}multiply(t){let s=this.temp,i=this.values,r=t.values;return s[V]=i[V]*r[V]+i[W]*r[G]+i[q]*r[_]+i[O]*r[J],s[W]=i[V]*r[W]+i[W]*r[D]+i[q]*r[j]+i[O]*r[Q],s[q]=i[V]*r[q]+i[W]*r[H]+i[q]*r[U]+i[O]*r[$],s[O]=i[V]*r[O]+i[W]*r[N]+i[q]*r[z]+i[O]*r[K],s[G]=i[G]*r[V]+i[D]*r[G]+i[H]*r[_]+i[N]*r[J],s[D]=i[G]*r[W]+i[D]*r[D]+i[H]*r[j]+i[N]*r[Q],s[H]=i[G]*r[q]+i[D]*r[H]+i[H]*r[U]+i[N]*r[$],s[N]=i[G]*r[O]+i[D]*r[N]+i[H]*r[z]+i[N]*r[K],s[_]=i[_]*r[V]+i[j]*r[G]+i[U]*r[_]+i[z]*r[J],s[j]=i[_]*r[W]+i[j]*r[D]+i[U]*r[j]+i[z]*r[Q],s[U]=i[_]*r[q]+i[j]*r[H]+i[U]*r[U]+i[z]*r[$],s[z]=i[_]*r[O]+i[j]*r[N]+i[U]*r[z]+i[z]*r[K],s[J]=i[J]*r[V]+i[Q]*r[G]+i[$]*r[_]+i[K]*r[J],s[Q]=i[J]*r[W]+i[Q]*r[D]+i[$]*r[j]+i[K]*r[Q],s[$]=i[J]*r[q]+i[Q]*r[H]+i[$]*r[U]+i[K]*r[$],s[K]=i[J]*r[O]+i[Q]*r[N]+i[$]*r[z]+i[K]*r[K],this.set(this.temp)}multiplyLeft(t){let s=this.temp,i=this.values,r=t.values;return s[V]=r[V]*i[V]+r[W]*i[G]+r[q]*i[_]+r[O]*i[J],s[W]=r[V]*i[W]+r[W]*i[D]+r[q]*i[j]+r[O]*i[Q],s[q]=r[V]*i[q]+r[W]*i[H]+r[q]*i[U]+r[O]*i[$],s[O]=r[V]*i[O]+r[W]*i[N]+r[q]*i[z]+r[O]*i[K],s[G]=r[G]*i[V]+r[D]*i[G]+r[H]*i[_]+r[N]*i[J],s[D]=r[G]*i[W]+r[D]*i[D]+r[H]*i[j]+r[N]*i[Q],s[H]=r[G]*i[q]+r[D]*i[H]+r[H]*i[U]+r[N]*i[$],s[N]=r[G]*i[O]+r[D]*i[N]+r[H]*i[z]+r[N]*i[K],s[_]=r[_]*i[V]+r[j]*i[G]+r[U]*i[_]+r[z]*i[J],s[j]=r[_]*i[W]+r[j]*i[D]+r[U]*i[j]+r[z]*i[Q],s[U]=r[_]*i[q]+r[j]*i[H]+r[U]*i[U]+r[z]*i[$],s[z]=r[_]*i[O]+r[j]*i[N]+r[U]*i[z]+r[z]*i[K],s[J]=r[J]*i[V]+r[Q]*i[G]+r[$]*i[_]+r[K]*i[J],s[Q]=r[J]*i[W]+r[Q]*i[D]+r[$]*i[j]+r[K]*i[Q],s[$]=r[J]*i[q]+r[Q]*i[H]+r[$]*i[U]+r[K]*i[$],s[K]=r[J]*i[O]+r[Q]*i[N]+r[$]*i[z]+r[K]*i[K],this.set(this.temp)}lookAt(t,s,i){let r=Rt.xAxis,h=Rt.yAxis,l=Rt.zAxis;l.setFrom(s).normalize(),r.setFrom(s).normalize(),r.cross(i).normalize(),h.setFrom(r).cross(l).normalize(),this.identity();let n=this.values;return n[V]=r.x,n[W]=r.y,n[q]=r.z,n[G]=h.x,n[D]=h.y,n[H]=h.z,n[_]=-l.x,n[j]=-l.y,n[U]=-l.z,Rt.tmpMatrix.identity(),Rt.tmpMatrix.values[O]=-t.x,Rt.tmpMatrix.values[N]=-t.y,Rt.tmpMatrix.values[z]=-t.z,this.multiply(Rt.tmpMatrix),this}},wi=class{position=new At(0,0,0);direction=new At(0,0,-1);up=new At(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new se;inverseProjectionView=new se;projection=new se;view=new se;constructor(e,t){this.viewportWidth=e,this.viewportHeight=t,this.update()}update(){let e=this.projection,t=this.view,s=this.projectionView,i=this.inverseProjectionView,r=this.zoom,h=this.viewportWidth,l=this.viewportHeight;e.ortho(r*(-h/2),r*(h/2),r*(-l/2),r*(l/2),this.near,this.far),t.lookAt(this.position,this.direction,this.up),s.set(e.values),s.multiply(t),i.set(s.values).invert()}screenToWorld(e,t,s){let i=e.x,r=s-e.y-1;return e.x=2*i/t-1,e.y=2*r/s-1,e.z=2*e.z-1,e.project(this.inverseProjectionView),e}worldToScreen(e,t,s){return e.project(this.projectionView),e.x=t*(e.x+1)/2,e.y=s*(e.y+1)/2,e.z=(e.z+1)/2,e}setViewport(e,t){this.viewportWidth=e,this.viewportHeight=t}},Rs=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=new Array;autoPreventDefault;isTouch=!1;callbacks;constructor(e,t=!0){this.element=e,this.autoPreventDefault=t,this.callbacks=this.setupCallbacks(e)}setupCallbacks(e){const t=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=e.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.buttonDown=!0,this.listeners.map(c=>{c.down&&c.down(this.mouseX,this.mouseY,a)})}},s=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=e.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.listeners.map(c=>{this.buttonDown?c.dragged&&c.dragged(this.mouseX,this.mouseY,a):c.moved&&c.moved(this.mouseX,this.mouseY,a)})}},i=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=e.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.buttonDown=!1,this.listeners.map(c=>{c.up&&c.up(this.mouseX,this.mouseY,a)})}},r=a=>{this.autoPreventDefault&&a.preventDefault();let o=a.deltaY;a.deltaMode==WheelEvent.DOM_DELTA_LINE&&(o*=8),a.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(o*=24),this.listeners.map(c=>{c.wheel&&c.wheel(a.deltaY,a)})},h=a=>{if(this.isTouch=!0,!this.touch0||!this.touch1){var o=a.changedTouches;let c=o.item(0);if(!c)return;let d=e.getBoundingClientRect(),f=c.clientX-d.left,m=c.clientY-d.top,u=new bi(c.identifier,f,m);if(this.mouseX=f,this.mouseY=m,this.buttonDown=!0,!this.touch0)this.touch0=u,this.listeners.map(g=>{g.down&&g.down(u.x,u.y,a)});else if(!this.touch1){this.touch1=u;let g=this.touch1.x-this.touch0.x,w=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(g*g+w*w),this.listeners.map(b=>{b.zoom&&b.zoom(this.initialPinchDistance,this.initialPinchDistance,a)})}}this.autoPreventDefault&&a.preventDefault()},l=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let f=e.getBoundingClientRect();for(var c=0;c<o.length;c++){var d=o[c];let m=d.clientX-f.left,u=d.clientY-f.top;this.touch0.identifier===d.identifier&&(this.touch0.x=this.mouseX=m,this.touch0.y=this.mouseY=u,this.listeners.map(g=>{g.dragged&&g.dragged(m,u,a)})),this.touch1&&this.touch1.identifier===d.identifier&&(this.touch1.x=this.mouseX=m,this.touch1.y=this.mouseY=u)}if(this.touch0&&this.touch1){let m=this.touch1.x-this.touch0.x,u=this.touch1.x-this.touch0.x,g=Math.sqrt(m*m+u*u);this.listeners.map(w=>{w.zoom&&w.zoom(this.initialPinchDistance,g,a)})}}this.autoPreventDefault&&a.preventDefault()},n=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let f=e.getBoundingClientRect();for(var c=0;c<o.length;c++){var d=o[c];let m=d.clientX-f.left,u=d.clientY-f.top;if(this.touch0.identifier===d.identifier)if(this.touch0=null,this.mouseX=m,this.mouseY=u,this.listeners.map(g=>{g.up&&g.up(m,u,a)}),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(g=>{g.down&&g.down(this.touch0.x,this.touch0.y,a)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}this.autoPreventDefault&&a.preventDefault()};return e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",s,!0),e.addEventListener("mouseup",i,!0),e.addEventListener("wheel",r,!0),e.addEventListener("touchstart",h,{passive:!1,capture:!1}),e.addEventListener("touchmove",l,{passive:!1,capture:!1}),e.addEventListener("touchend",n,{passive:!1,capture:!1}),e.addEventListener("touchcancel",n),{mouseDown:t,mouseMove:s,mouseUp:i,mouseWheel:r,touchStart:h,touchMove:l,touchEnd:n}}dispose(){const e=this.element;e.removeEventListener("mousedown",this.callbacks.mouseDown,!0),e.removeEventListener("mousemove",this.callbacks.mouseMove,!0),e.removeEventListener("mouseup",this.callbacks.mouseUp,!0),e.removeEventListener("wheel",this.callbacks.mouseWheel,!0),e.removeEventListener("touchstart",this.callbacks.touchStart,{capture:!1}),e.removeEventListener("touchmove",this.callbacks.touchMove,{capture:!1}),e.removeEventListener("touchend",this.callbacks.touchEnd,{capture:!1}),e.removeEventListener("touchcancel",this.callbacks.touchEnd),this.listeners.length=0}addListener(e){this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}},bi=class{constructor(e,t,s){this.identifier=e,this.x=t,this.y=s}},zr=class{constructor(e,t){this.canvas=e,this.camera=t;let s=0,i=0,r=0,h=0,l=0,n=0,a=0,o=0;new Rs(e).addListener({down:(c,d)=>{s=t.position.x,i=t.position.y,h=n=c,l=a=d,o=t.zoom},dragged:(c,d)=>{let f=c-h,m=d-l,u=t.screenToWorld(new At(0,0),e.clientWidth,e.clientHeight),g=t.screenToWorld(new At(f,m),e.clientWidth,e.clientHeight).sub(u);t.position.set(s-g.x,i-g.y,0),t.update(),n=c,a=d},wheel:c=>{let d=c/200*t.zoom,f=t.zoom+d;if(f>0){let m=0,u=0;if(c<0)m=n,u=a;else{let b=new At(e.clientWidth/2+15,e.clientHeight/2),x=n-b.x,p=e.clientHeight-1-a-b.y;m=b.x-x,u=e.clientHeight-1-b.y+p}let g=t.screenToWorld(new At(m,u),e.clientWidth,e.clientHeight);t.zoom=f,t.update();let w=t.screenToWorld(new At(m,u),e.clientWidth,e.clientHeight);t.position.add(g.sub(w)),t.update()}},zoom:(c,d)=>{let f=c/d;t.zoom=o*f},up:(c,d)=>{n=c,a=d},moved:(c,d)=>{n=c,a=d}})}},Tt=class dt{constructor(t,s,i){this.vertexShader=s,this.fragmentShader=i,this.vsSource=s,this.fsSource=i,this.context=t instanceof xt?t:new xt(t),this.context.addRestorable(this),this.compile()}static MVP_MATRIX="u_projTrans";static POSITION="a_position";static COLOR="a_color";static COLOR2="a_color2";static TEXCOORDS="a_texCoords";static SAMPLER="u_texture";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 t=this.context.gl;try{if(this.vs=this.compileShader(t.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(t.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(s){throw this.dispose(),s}}compileShader(t,s){let i=this.context.gl,r=i.createShader(t);if(!r)throw new Error("Couldn't create shader.");if(i.shaderSource(r,s),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS)){let h="Couldn't compile shader: "+i.getShaderInfoLog(r);if(i.deleteShader(r),!i.isContextLost())throw new Error(h)}return r}compileProgram(t,s){let i=this.context.gl,r=i.createProgram();if(!r)throw new Error("Couldn't compile program.");if(i.attachShader(r,t),i.attachShader(r,s),i.linkProgram(r),!i.getProgramParameter(r,i.LINK_STATUS)){let h="Couldn't compile shader program: "+i.getProgramInfoLog(r);if(i.deleteProgram(r),!i.isContextLost())throw new Error(h)}return r}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(t,s){this.context.gl.uniform1i(this.getUniformLocation(t),s)}setUniformf(t,s){this.context.gl.uniform1f(this.getUniformLocation(t),s)}setUniform2f(t,s,i){this.context.gl.uniform2f(this.getUniformLocation(t),s,i)}setUniform3f(t,s,i,r){this.context.gl.uniform3f(this.getUniformLocation(t),s,i,r)}setUniform4f(t,s,i,r,h){this.context.gl.uniform4f(this.getUniformLocation(t),s,i,r,h)}setUniform2x2f(t,s){let i=this.context.gl;this.tmp2x2.set(s),i.uniformMatrix2fv(this.getUniformLocation(t),!1,this.tmp2x2)}setUniform3x3f(t,s){let i=this.context.gl;this.tmp3x3.set(s),i.uniformMatrix3fv(this.getUniformLocation(t),!1,this.tmp3x3)}setUniform4x4f(t,s){let i=this.context.gl;this.tmp4x4.set(s),i.uniformMatrix4fv(this.getUniformLocation(t),!1,this.tmp4x4)}getUniformLocation(t){let s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=s.getUniformLocation(this.program,t);if(!i&&!s.isContextLost())throw new Error(`Couldn't find location for uniform ${t}`);return i}getAttributeLocation(t){let s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=s.getAttribLocation(this.program,t);if(i==-1&&!s.isContextLost())throw new Error(`Couldn't find location for attribute ${t}`);return i}dispose(){this.context.removeRestorable(this);let t=this.context.gl;this.vs&&(t.deleteShader(this.vs),this.vs=null),this.fs&&(t.deleteShader(this.fs),this.fs=null),this.program&&(t.deleteProgram(this.program),this.program=null)}static newColoredTextured(t){let s=`
|
|
3
|
+
attribute vec4 ${dt.POSITION};
|
|
4
|
+
attribute vec4 ${dt.COLOR};
|
|
5
|
+
attribute vec2 ${dt.TEXCOORDS};
|
|
6
|
+
uniform mat4 ${dt.MVP_MATRIX};
|
|
7
7
|
varying vec4 v_color;
|
|
8
8
|
varying vec2 v_texCoords;
|
|
9
9
|
|
|
10
10
|
void main () {
|
|
11
|
-
v_color = ${
|
|
12
|
-
v_texCoords = ${
|
|
13
|
-
gl_Position = ${
|
|
11
|
+
v_color = ${dt.COLOR};
|
|
12
|
+
v_texCoords = ${dt.TEXCOORDS};
|
|
13
|
+
gl_Position = ${dt.MVP_MATRIX} * ${dt.POSITION};
|
|
14
14
|
}
|
|
15
15
|
`,i=`
|
|
16
16
|
#ifdef GL_ES
|
|
@@ -26,21 +26,21 @@ uniform sampler2D u_texture;
|
|
|
26
26
|
void main () {
|
|
27
27
|
gl_FragColor = v_color * texture2D(u_texture, v_texCoords);
|
|
28
28
|
}
|
|
29
|
-
`;return new
|
|
30
|
-
attribute vec4 ${
|
|
31
|
-
attribute vec4 ${
|
|
32
|
-
attribute vec4 ${
|
|
33
|
-
attribute vec2 ${
|
|
34
|
-
uniform mat4 ${
|
|
29
|
+
`;return new dt(t,s,i)}static newTwoColoredTextured(t){let s=`
|
|
30
|
+
attribute vec4 ${dt.POSITION};
|
|
31
|
+
attribute vec4 ${dt.COLOR};
|
|
32
|
+
attribute vec4 ${dt.COLOR2};
|
|
33
|
+
attribute vec2 ${dt.TEXCOORDS};
|
|
34
|
+
uniform mat4 ${dt.MVP_MATRIX};
|
|
35
35
|
varying vec4 v_light;
|
|
36
36
|
varying vec4 v_dark;
|
|
37
37
|
varying vec2 v_texCoords;
|
|
38
38
|
|
|
39
39
|
void main () {
|
|
40
|
-
v_light = ${
|
|
41
|
-
v_dark = ${
|
|
42
|
-
v_texCoords = ${
|
|
43
|
-
gl_Position = ${
|
|
40
|
+
v_light = ${dt.COLOR};
|
|
41
|
+
v_dark = ${dt.COLOR2};
|
|
42
|
+
v_texCoords = ${dt.TEXCOORDS};
|
|
43
|
+
gl_Position = ${dt.MVP_MATRIX} * ${dt.POSITION};
|
|
44
44
|
}
|
|
45
45
|
`,i=`
|
|
46
46
|
#ifdef GL_ES
|
|
@@ -59,15 +59,15 @@ void main () {
|
|
|
59
59
|
gl_FragColor.a = texColor.a * v_light.a;
|
|
60
60
|
gl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;
|
|
61
61
|
}
|
|
62
|
-
`;return new
|
|
63
|
-
attribute vec4 ${
|
|
64
|
-
attribute vec4 ${
|
|
65
|
-
uniform mat4 ${
|
|
62
|
+
`;return new dt(t,s,i)}static newColored(t){let s=`
|
|
63
|
+
attribute vec4 ${dt.POSITION};
|
|
64
|
+
attribute vec4 ${dt.COLOR};
|
|
65
|
+
uniform mat4 ${dt.MVP_MATRIX};
|
|
66
66
|
varying vec4 v_color;
|
|
67
67
|
|
|
68
68
|
void main () {
|
|
69
|
-
v_color = ${
|
|
70
|
-
gl_Position = ${
|
|
69
|
+
v_color = ${dt.COLOR};
|
|
70
|
+
gl_Position = ${dt.MVP_MATRIX} * ${dt.POSITION};
|
|
71
71
|
}
|
|
72
72
|
`,i=`
|
|
73
73
|
#ifdef GL_ES
|
|
@@ -81,4 +81,4 @@ varying LOWP vec4 v_color;
|
|
|
81
81
|
void main () {
|
|
82
82
|
gl_FragColor = v_color;
|
|
83
83
|
}
|
|
84
|
-
`;return new ue(e,t,i)}},xe=ue;B(xe,"MVP_MATRIX","u_projTrans"),B(xe,"POSITION","a_position"),B(xe,"COLOR","a_color"),B(xe,"COLOR2","a_color2"),B(xe,"TEXCOORDS","a_texCoords"),B(xe,"SAMPLER","u_texture");var Ni=class{constructor(e,t,i,s){this.attributes=t,this.context=e instanceof be?e:new be(e),this.elementsPerVertex=0;for(let n=0;n<t.length;n++)this.elementsPerVertex+=t[n].numElements;this.vertices=new Float32Array(i*this.elementsPerVertex),this.indices=new Uint16Array(s),this.context.addRestorable(this)}context;vertices;verticesBuffer=null;verticesLength=0;dirtyVertices=!1;indices;indicesBuffer=null;indicesLength=0;dirtyIndices=!1;elementsPerVertex=0;getAttributes(){return this.attributes}maxVertices(){return this.vertices.length/this.elementsPerVertex}numVertices(){return this.verticesLength/this.elementsPerVertex}setVerticesLength(e){this.dirtyVertices=!0,this.verticesLength=e}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(e){this.dirtyIndices=!0,this.indicesLength=e}getIndices(){return this.indices}getVertexSizeInFloats(){let e=0;for(var t=0;t<this.attributes.length;t++){let i=this.attributes[t];e+=i.numElements}return e}setVertices(e){if(this.dirtyVertices=!0,e.length>this.vertices.length)throw Error("Mesh can't store more than "+this.maxVertices()+" vertices");this.vertices.set(e,0),this.verticesLength=e.length}setIndices(e){if(this.dirtyIndices=!0,e.length>this.indices.length)throw Error("Mesh can't store more than "+this.maxIndices()+" indices");this.indices.set(e,0),this.indicesLength=e.length}draw(e,t){this.drawWithOffset(e,t,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(e,t,i,s){let n=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(e),this.indicesLength>0?n.drawElements(t,s,n.UNSIGNED_SHORT,i*2):n.drawArrays(t,i,s),this.unbind(e)}bind(e){let t=this.context.gl;t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer);let i=0;for(let s=0;s<this.attributes.length;s++){let n=this.attributes[s],h=e.getAttributeLocation(n.name);t.enableVertexAttribArray(h),t.vertexAttribPointer(h,n.numElements,t.FLOAT,!1,this.elementsPerVertex*4,i*4),i+=n.numElements}this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(e){let t=this.context.gl;for(let i=0;i<this.attributes.length;i++){let s=this.attributes[i],n=e.getAttributeLocation(s.name);t.disableVertexAttribArray(n)}t.bindBuffer(t.ARRAY_BUFFER,null),this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}update(){let e=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=e.createBuffer()),e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),e.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=e.createBuffer()),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),e.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);let e=this.context.gl;e.deleteBuffer(this.verticesBuffer),e.deleteBuffer(this.indicesBuffer)}},tt=class{constructor(e,t,i){this.name=e,this.type=t,this.numElements=i}},Ft=class extends tt{constructor(){super(xe.POSITION,je.Float,2)}},Dr=class extends tt{constructor(){super(xe.POSITION,je.Float,3)}},Ui=class extends tt{constructor(e=0){super(xe.TEXCOORDS+(e==0?"":e),je.Float,2)}},Xt=class extends tt{constructor(){super(xe.COLOR,je.Float,4)}},Is=class extends tt{constructor(){super(xe.COLOR2,je.Float,4)}},je=(e=>(e[e.Float=0]="Float",e))(je||{}),Be=1,Nr=769,Ms=770,Es=771,Rs=774,Ze=class{context;drawCalls=0;isDrawing=!1;mesh;shader=null;lastTexture=null;verticesLength=0;indicesLength=0;srcColorBlend;srcAlphaBlend;dstBlend;cullWasEnabled=!1;constructor(e,t=!0,i=10920){if(i>10920)throw new Error("Can't have more than 10920 triangles per batch: "+i);this.context=e instanceof be?e:new be(e);let s=t?[new Ft,new Xt,new Ui,new Is]:[new Ft,new Xt,new Ui];this.mesh=new Ni(e,s,i,i*3);let n=this.context.gl;this.srcColorBlend=n.SRC_ALPHA,this.srcAlphaBlend=n.ONE,this.dstBlend=n.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=e,this.lastTexture=null,this.isDrawing=!0;let t=this.context.gl;t.enable(t.BLEND),t.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),Ze.disableCulling&&(this.cullWasEnabled=t.isEnabled(t.CULL_FACE),this.cullWasEnabled&&t.disable(t.CULL_FACE))}setBlendMode(e,t){const i=Ze.blendModesGL[e],s=t?i.srcRgbPma:i.srcRgb,n=i.srcAlpha,h=i.dstRgb;if(this.srcColorBlend==s&&this.srcAlphaBlend==n&&this.dstBlend==h)return;this.srcColorBlend=s,this.srcAlphaBlend=n,this.dstBlend=h,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(s,h,n,h)}draw(e,t,i){e!=this.lastTexture?(this.flush(),this.lastTexture=e):(this.verticesLength+t.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();let s=this.mesh.numVertices();this.mesh.getVertices().set(t,this.verticesLength),this.verticesLength+=t.length,this.mesh.setVerticesLength(this.verticesLength);let n=this.mesh.getIndices();for(let h=this.indicesLength,a=0;a<i.length;h++,a++)n[h]=i[a]+s;this.indicesLength+=i.length,this.mesh.setIndicesLength(this.indicesLength)}flush(){if(this.verticesLength!=0){if(!this.lastTexture)throw new Error("No texture set.");if(!this.shader)throw new Error("No shader set.");this.lastTexture.bind(),this.mesh.draw(this.shader,this.context.gl.TRIANGLES),this.verticesLength=0,this.indicesLength=0,this.mesh.setVerticesLength(0),this.mesh.setIndicesLength(0),this.drawCalls++,Ze.globalDrawCalls++}}end(){if(!this.isDrawing)throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");(this.verticesLength>0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;let e=this.context.gl;e.disable(e.BLEND),Ze.disableCulling&&this.cullWasEnabled&&e.enable(e.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let e=Ze.globalDrawCalls;return Ze.globalDrawCalls=0,e}dispose(){this.mesh.dispose()}},it=Ze;B(it,"disableCulling",!1),B(it,"globalDrawCalls",0),B(it,"blendModesGL",[{srcRgb:Ms,srcRgbPma:Be,dstRgb:Es,srcAlpha:Be},{srcRgb:Ms,srcRgbPma:Be,dstRgb:Be,srcAlpha:Be},{srcRgb:Rs,srcRgbPma:Rs,dstRgb:Es,srcAlpha:Be},{srcRgb:Be,srcRgbPma:Be,dstRgb:Nr,srcAlpha:Be}]);var _i=class{context;isDrawing=!1;mesh;shapeType=ye.Filled;color=new V(1,1,1,1);shader=null;vertexIndex=0;tmp=new We;srcColorBlend;srcAlphaBlend;dstBlend;constructor(e,t=10920){if(t>10920)throw new Error("Can't have more than 10920 triangles per batch: "+t);this.context=e instanceof be?e:new be(e),this.mesh=new Ni(e,[new Ft,new Xt],t,0);let i=this.context.gl;this.srcColorBlend=i.SRC_ALPHA,this.srcAlphaBlend=i.ONE,this.dstBlend=i.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=e,this.vertexIndex=0,this.isDrawing=!0;let t=this.context.gl;t.enable(t.BLEND),t.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(e,t,i){this.srcColorBlend=e,this.srcAlphaBlend=t,this.dstBlend=i,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(e,i,t,i))}setColor(e){this.color.setFromColor(e)}setColorWith(e,t,i,s){this.color.set(e,t,i,s)}point(e,t,i){this.check(ye.Point,1),i||(i=this.color),this.vertex(e,t,i)}line(e,t,i,s,n){this.check(ye.Line,2);let h=this.mesh.getVertices(),a=this.vertexIndex;n||(n=this.color),this.vertex(e,t,n),this.vertex(i,s,n)}triangle(e,t,i,s,n,h,a,r,o,l){this.check(e?ye.Filled:ye.Line,3);let c=this.mesh.getVertices(),f=this.vertexIndex;r||(r=this.color),o||(o=this.color),l||(l=this.color),e?(this.vertex(t,i,r),this.vertex(s,n,o),this.vertex(h,a,l)):(this.vertex(t,i,r),this.vertex(s,n,o),this.vertex(s,n,r),this.vertex(h,a,o),this.vertex(h,a,r),this.vertex(t,i,o))}quad(e,t,i,s,n,h,a,r,o,l,c,f,d){this.check(e?ye.Filled:ye.Line,3);let u=this.mesh.getVertices(),m=this.vertexIndex;l||(l=this.color),c||(c=this.color),f||(f=this.color),d||(d=this.color),e?(this.vertex(t,i,l),this.vertex(s,n,c),this.vertex(h,a,f),this.vertex(h,a,f),this.vertex(r,o,d),this.vertex(t,i,l)):(this.vertex(t,i,l),this.vertex(s,n,c),this.vertex(s,n,c),this.vertex(h,a,f),this.vertex(h,a,f),this.vertex(r,o,d),this.vertex(r,o,d),this.vertex(t,i,l))}rect(e,t,i,s,n,h){this.quad(e,t,i,t+s,i,t+s,i+n,t,i+n,h,h,h,h)}rectLine(e,t,i,s,n,h,a){this.check(e?ye.Filled:ye.Line,8),a||(a=this.color);let r=this.tmp.set(n-i,t-s);r.normalize(),h*=.5;let o=r.x*h,l=r.y*h;e?(this.vertex(t+o,i+l,a),this.vertex(t-o,i-l,a),this.vertex(s+o,n+l,a),this.vertex(s-o,n-l,a),this.vertex(s+o,n+l,a),this.vertex(t-o,i-l,a)):(this.vertex(t+o,i+l,a),this.vertex(t-o,i-l,a),this.vertex(s+o,n+l,a),this.vertex(s-o,n-l,a),this.vertex(s+o,n+l,a),this.vertex(t+o,i+l,a),this.vertex(s-o,n-l,a),this.vertex(t-o,i-l,a))}x(e,t,i){this.line(e-i,t-i,e+i,t+i),this.line(e-i,t+i,e+i,t-i)}polygon(e,t,i,s){if(i<3)throw new Error("Polygon must contain at least 3 vertices");this.check(ye.Line,i*2),s||(s=this.color);let n=this.mesh.getVertices(),h=this.vertexIndex;t<<=1,i<<=1;let a=e[t],r=e[t+1],o=t+i;for(let l=t,c=t+i-2;l<c;l+=2){let f=e[l],d=e[l+1],u=0,m=0;l+2>=o?(u=a,m=r):(u=e[l+2],m=e[l+3]),this.vertex(f,d,s),this.vertex(u,m,s)}}circle(e,t,i,s,n,h=0){if(h==0&&(h=Math.max(1,6*P.cbrt(s)|0)),h<=0)throw new Error("segments must be > 0.");n||(n=this.color);let a=2*P.PI/h,r=Math.cos(a),o=Math.sin(a),l=s,c=0;if(e){this.check(ye.Filled,h*3+3),h--;for(let d=0;d<h;d++){this.vertex(t,i,n),this.vertex(t+l,i+c,n);let u=l;l=r*l-o*c,c=o*u+r*c,this.vertex(t+l,i+c,n)}this.vertex(t,i,n),this.vertex(t+l,i+c,n)}else{this.check(ye.Line,h*2+2);for(let d=0;d<h;d++){this.vertex(t+l,i+c,n);let u=l;l=r*l-o*c,c=o*u+r*c,this.vertex(t+l,i+c,n)}this.vertex(t+l,i+c,n)}let f=l;l=s,c=0,this.vertex(t+l,i+c,n)}curve(e,t,i,s,n,h,a,r,o,l){this.check(ye.Line,o*2+2),l||(l=this.color);let c=1/o,f=c*c,d=c*c*c,u=3*c,m=3*f,g=6*f,w=6*d,b=e-i*2+n,x=t-s*2+h,p=(i-n)*3-e+a,y=(s-h)*3-t+r,v=e,A=t,C=(i-e)*u+b*m+p*d,T=(s-t)*u+x*m+y*d,E=b*g+p*w,R=x*g+y*w,k=p*w,X=y*w;for(;o-- >0;)this.vertex(v,A,l),v+=C,A+=T,C+=E,T+=R,E+=k,R+=X,this.vertex(v,A,l);this.vertex(v,A,l),this.vertex(a,r,l)}vertex(e,t,i){let s=this.vertexIndex,n=this.mesh.getVertices();n[s++]=e,n[s++]=t,n[s++]=i.r,n[s++]=i.g,n[s++]=i.b,n[s++]=i.a,this.vertexIndex=s}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();let e=this.context.gl;e.disable(e.BLEND),this.isDrawing=!1}flush(){if(this.vertexIndex!=0){if(!this.shader)throw new Error("No shader set.");this.mesh.setVerticesLength(this.vertexIndex),this.mesh.draw(this.shader,this.shapeType),this.vertexIndex=0}}check(e,t){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType==e)if(this.mesh.maxVertices()-this.mesh.numVertices()<t)this.flush();else return;else this.flush(),this.shapeType=e}dispose(){this.mesh.dispose()}},ye=(e=>(e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.Filled=4]="Filled",e))(ye||{}),zi=class{boneLineColor=new V(1,0,0,1);boneOriginColor=new V(0,1,0,1);attachmentLineColor=new V(0,0,1,.5);triangleLineColor=new V(1,.64,0,.5);pathColor=new V().setFromString("FF7F00");clipColor=new V(.8,0,0,2);aabbColor=new V(0,1,0,.5);drawBones=!0;drawRegionAttachments=!0;drawBoundingBoxes=!0;drawMeshHull=!0;drawMeshTriangles=!0;drawPaths=!0;drawSkeletonXY=!1;drawClipping=!0;premultipliedAlpha=!1;scale=1;boneWidth=2;context;bounds=new As;temp=new Array;vertices=L.newFloatArray(2*1024);constructor(e){this.context=e instanceof be?e:new be(e)}draw(e,t,i){let s=t.x,n=t.y,h=this.context.gl,a=this.premultipliedAlpha?h.ONE:h.SRC_ALPHA;e.setBlendMode(a,h.ONE,h.ONE_MINUS_SRC_ALPHA);let r=t.bones;if(this.drawBones){e.setColor(this.boneLineColor);for(let o=0,l=r.length;o<l;o++){let c=r[o];if(i&&i.indexOf(c.data.name)>-1||!c.parent)continue;let f=c.data.length*c.a+c.worldX,d=c.data.length*c.c+c.worldY;e.rectLine(!0,c.worldX,c.worldY,f,d,this.boneWidth*this.scale)}this.drawSkeletonXY&&e.x(s,n,4*this.scale)}if(this.drawRegionAttachments){e.setColor(this.attachmentLineColor);let o=t.slots;for(let l=0,c=o.length;l<c;l++){let f=o[l],d=f.getAttachment();if(d instanceof le){let u=d,m=this.vertices;u.computeWorldVertices(f,m,0,2),e.line(m[0],m[1],m[2],m[3]),e.line(m[2],m[3],m[4],m[5]),e.line(m[4],m[5],m[6],m[7]),e.line(m[6],m[7],m[0],m[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){let o=t.slots;for(let l=0,c=o.length;l<c;l++){let f=o[l];if(!f.bone.active)continue;let d=f.getAttachment();if(!(d instanceof De))continue;let u=d,m=this.vertices;u.computeWorldVertices(f,0,u.worldVerticesLength,m,0,2);let g=u.triangles,w=u.hullLength;if(this.drawMeshTriangles){e.setColor(this.triangleLineColor);for(let b=0,x=g.length;b<x;b+=3){let p=g[b]*2,y=g[b+1]*2,v=g[b+2]*2;e.triangle(!1,m[p],m[p+1],m[y],m[y+1],m[v],m[v+1])}}if(this.drawMeshHull&&w>0){e.setColor(this.attachmentLineColor),w=(w>>1)*2;let b=m[w-2],x=m[w-1];for(let p=0,y=w;p<y;p+=2){let v=m[p],A=m[p+1];e.line(v,A,b,x),b=v,x=A}}}}if(this.drawBoundingBoxes){let o=this.bounds;o.update(t,!0),e.setColor(this.aabbColor),e.rect(!1,o.minX,o.minY,o.getWidth(),o.getHeight());let l=o.polygons,c=o.boundingBoxes;for(let f=0,d=l.length;f<d;f++){let u=l[f];e.setColor(c[f].color),e.polygon(u,0,u.length)}}if(this.drawPaths){let o=t.slots;for(let l=0,c=o.length;l<c;l++){let f=o[l];if(!f.bone.active)continue;let d=f.getAttachment();if(!(d instanceof He))continue;let u=d,m=u.worldVerticesLength,g=this.temp=L.setArraySize(this.temp,m,0);u.computeWorldVertices(f,0,m,g,0,2);let w=this.pathColor,b=g[2],x=g[3],p=0,y=0;if(u.closed){e.setColor(w);let v=g[0],A=g[1],C=g[m-2],T=g[m-1];p=g[m-4],y=g[m-3],e.curve(b,x,v,A,C,T,p,y,32),e.setColor(zi.LIGHT_GRAY),e.line(b,x,v,A),e.line(p,y,C,T)}m-=4;for(let v=4;v<m;v+=6){let A=g[v],C=g[v+1],T=g[v+2],E=g[v+3];p=g[v+4],y=g[v+5],e.setColor(w),e.curve(b,x,A,C,T,E,p,y,32),e.setColor(zi.LIGHT_GRAY),e.line(b,x,A,C),e.line(p,y,T,E),b=p,x=y}}}if(this.drawBones){e.setColor(this.boneOriginColor);for(let o=0,l=r.length;o<l;o++){let c=r[o];i&&i.indexOf(c.data.name)>-1||e.circle(!0,c.worldX,c.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=t.slots;e.setColor(this.clipColor);for(let l=0,c=o.length;l<c;l++){let f=o[l];if(!f.bone.active)continue;let d=f.getAttachment();if(!(d instanceof $e))continue;let u=d,m=u.worldVerticesLength,g=this.temp=L.setArraySize(this.temp,m,0);u.computeWorldVertices(f,0,m,g,0,2);for(let w=0,b=g.length;w<b;w+=2){let x=g[w],p=g[w+1],y=g[(w+2)%g.length],v=g[(w+3)%g.length];e.line(x,p,y,v)}}}}dispose(){}},Pt=zi;B(Pt,"LIGHT_GRAY",new V(.7529411764705882,.7529411764705882,.7529411764705882,1)),B(Pt,"GREEN",new V(0,1,0,1));var Ur=class{constructor(e,t,i){this.vertices=e,this.numVertices=t,this.numFloats=i}},Ys=class{premultipliedAlpha=!1;tempColor=new V;tempColor2=new V;vertices;vertexSize=2+2+4;twoColorTint=!1;renderable=new Ur([],0,0);clipper=new Yt;temp=new We;temp2=new We;temp3=new V;temp4=new V;constructor(e,t=!0){this.twoColorTint=t,t&&(this.vertexSize+=4),this.vertices=L.newFloatArray(this.vertexSize*1024)}draw(e,t,i=-1,s=-1,n=null){let h=this.clipper,a=this.premultipliedAlpha,r=this.twoColorTint,o=null,l=this.renderable,c,f,d=t.drawOrder,u,m=t.color,g=r?12:8,w=!1;i==-1&&(w=!0);for(let b=0,x=d.length;b<x;b++){let p=h.isClipping()?2:g,y=d[b];if(!y.bone.active){h.clipEndWithSlot(y);continue}if(i>=0&&i==y.data.index&&(w=!0),!w){h.clipEndWithSlot(y);continue}s>=0&&s==y.data.index&&(w=!1);let v=y.getAttachment(),A;if(v instanceof le){let C=v;l.vertices=this.vertices,l.numVertices=4,l.numFloats=p<<2,C.computeWorldVertices(y,l.vertices,0,p),f=Ys.QUAD_TRIANGLES,c=C.uvs,A=C.region.texture,u=C.color}else if(v instanceof De){let C=v;l.vertices=this.vertices,l.numVertices=C.worldVerticesLength>>1,l.numFloats=l.numVertices*p,l.numFloats>l.vertices.length&&(l.vertices=this.vertices=L.newFloatArray(l.numFloats)),C.computeWorldVertices(y,0,C.worldVerticesLength,l.vertices,0,p),f=C.triangles,A=C.region.texture,c=C.uvs,u=C.color}else if(v instanceof $e){let C=v;h.clipStart(y,C);continue}else{h.clipEndWithSlot(y);continue}if(A){let C=y.color,T=this.tempColor;T.r=m.r*C.r*u.r,T.g=m.g*C.g*u.g,T.b=m.b*C.b*u.b,T.a=m.a*C.a*u.a,a&&(T.r*=T.a,T.g*=T.a,T.b*=T.a);let E=this.tempColor2;y.darkColor?(a?(E.r=y.darkColor.r*T.a,E.g=y.darkColor.g*T.a,E.b=y.darkColor.b*T.a):E.setFromColor(y.darkColor),E.a=a?1:0):E.set(0,0,0,1);let R=y.data.blendMode;if(R!=o&&(o=R,e.setBlendMode(o,a)),h.isClipping()){h.clipTriangles(l.vertices,f,f.length,c,T,E,r);let k=new Float32Array(h.clippedVertices),X=h.clippedTriangles;n&&n(k,k.length,g),e.draw(A,k,X)}else{let k=l.vertices;if(r)for(let I=2,Y=0,F=l.numFloats;I<F;I+=g,Y+=2)k[I]=T.r,k[I+1]=T.g,k[I+2]=T.b,k[I+3]=T.a,k[I+4]=c[Y],k[I+5]=c[Y+1],k[I+6]=E.r,k[I+7]=E.g,k[I+8]=E.b,k[I+9]=E.a;else for(let I=2,Y=0,F=l.numFloats;I<F;I+=g,Y+=2)k[I]=T.r,k[I+1]=T.g,k[I+2]=T.b,k[I+3]=T.a,k[I+4]=c[Y],k[I+5]=c[Y+1];let X=l.vertices.subarray(0,l.numFloats);n&&n(l.vertices,l.numFloats,g),e.draw(A,X,f)}}h.clipEndWithSlot(y)}h.clipEnd()}getSkeletonClipping(){return this.clipper}},Wi=Ys;B(Wi,"QUAD_TRIANGLES",[0,1,2,2,3,0]);var S=[0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0],Lt=[0,1,2,2,3,0],Bt=new V(1,1,1,1),ks=class{context;canvas;camera;batcher;twoColorTint=!1;batcherShader;shapes;shapesShader;activeRenderer=null;skeletonRenderer;skeletonDebugRenderer;constructor(e,t,i=!0){this.canvas=e,this.context=t instanceof be?t:new be(t),this.twoColorTint=i,this.camera=new Ss(e.width,e.height),this.batcherShader=i?xe.newTwoColoredTextured(this.context):xe.newColoredTextured(this.context),this.batcher=new it(this.context,i),this.shapesShader=xe.newColored(this.context),this.shapes=new _i(this.context),this.skeletonRenderer=new Wi(this.context,i),this.skeletonDebugRenderer=new Pt(this.context)}dispose(){this.batcher.dispose(),this.batcherShader.dispose(),this.shapes.dispose(),this.shapesShader.dispose(),this.skeletonDebugRenderer.dispose()}begin(){this.camera.update(),this.enableRenderer(this.batcher)}drawSkeleton(e,t=!1,i=-1,s=-1,n=null){this.enableRenderer(this.batcher),this.skeletonRenderer.premultipliedAlpha=t,this.skeletonRenderer.draw(this.batcher,e,i,s,n)}drawSkeletonDebug(e,t=!1,i){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.premultipliedAlpha=t,this.skeletonDebugRenderer.draw(this.shapes,e,i)}drawTexture(e,t,i,s,n,h){this.enableRenderer(this.batcher),h||(h=Bt);var a=0;S[a++]=t,S[a++]=i,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=0,S[a++]=1,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t+s,S[a++]=i,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=1,S[a++]=1,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t+s,S[a++]=i+n,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=1,S[a++]=0,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t,S[a++]=i+n,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=0,S[a++]=0,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a]=0),this.batcher.draw(e,S,Lt)}drawTextureUV(e,t,i,s,n,h,a,r,o,l){this.enableRenderer(this.batcher),l||(l=Bt);var c=0;S[c++]=t,S[c++]=i,S[c++]=l.r,S[c++]=l.g,S[c++]=l.b,S[c++]=l.a,S[c++]=h,S[c++]=a,this.twoColorTint&&(S[c++]=0,S[c++]=0,S[c++]=0,S[c++]=0),S[c++]=t+s,S[c++]=i,S[c++]=l.r,S[c++]=l.g,S[c++]=l.b,S[c++]=l.a,S[c++]=r,S[c++]=a,this.twoColorTint&&(S[c++]=0,S[c++]=0,S[c++]=0,S[c++]=0),S[c++]=t+s,S[c++]=i+n,S[c++]=l.r,S[c++]=l.g,S[c++]=l.b,S[c++]=l.a,S[c++]=r,S[c++]=o,this.twoColorTint&&(S[c++]=0,S[c++]=0,S[c++]=0,S[c++]=0),S[c++]=t,S[c++]=i+n,S[c++]=l.r,S[c++]=l.g,S[c++]=l.b,S[c++]=l.a,S[c++]=h,S[c++]=o,this.twoColorTint&&(S[c++]=0,S[c++]=0,S[c++]=0,S[c]=0),this.batcher.draw(e,S,Lt)}drawTextureRotated(e,t,i,s,n,h,a,r,o){this.enableRenderer(this.batcher),o||(o=Bt);let l=t+h,c=i+a,f=-h,d=-a,u=s-h,m=n-a,g=f,w=d,b=f,x=m,p=u,y=m,v=u,A=d,C=0,T=0,E=0,R=0,k=0,X=0,I=0,Y=0;if(r!=0){let ie=P.cosDeg(r),se=P.sinDeg(r);C=ie*g-se*w,T=se*g+ie*w,I=ie*b-se*x,Y=se*b+ie*x,k=ie*p-se*y,X=se*p+ie*y,E=k+(C-I),R=X+(T-Y)}else C=g,T=w,I=b,Y=x,k=p,X=y,E=v,R=A;C+=l,T+=c,E+=l,R+=c,k+=l,X+=c,I+=l,Y+=c;var F=0;S[F++]=C,S[F++]=T,S[F++]=o.r,S[F++]=o.g,S[F++]=o.b,S[F++]=o.a,S[F++]=0,S[F++]=1,this.twoColorTint&&(S[F++]=0,S[F++]=0,S[F++]=0,S[F++]=0),S[F++]=E,S[F++]=R,S[F++]=o.r,S[F++]=o.g,S[F++]=o.b,S[F++]=o.a,S[F++]=1,S[F++]=1,this.twoColorTint&&(S[F++]=0,S[F++]=0,S[F++]=0,S[F++]=0),S[F++]=k,S[F++]=X,S[F++]=o.r,S[F++]=o.g,S[F++]=o.b,S[F++]=o.a,S[F++]=1,S[F++]=0,this.twoColorTint&&(S[F++]=0,S[F++]=0,S[F++]=0,S[F++]=0),S[F++]=I,S[F++]=Y,S[F++]=o.r,S[F++]=o.g,S[F++]=o.b,S[F++]=o.a,S[F++]=0,S[F++]=0,this.twoColorTint&&(S[F++]=0,S[F++]=0,S[F++]=0,S[F]=0),this.batcher.draw(e,S,Lt)}drawRegion(e,t,i,s,n,h){this.enableRenderer(this.batcher),h||(h=Bt);var a=0;S[a++]=t,S[a++]=i,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=e.u,S[a++]=e.v2,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t+s,S[a++]=i,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=e.u2,S[a++]=e.v2,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t+s,S[a++]=i+n,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=e.u2,S[a++]=e.v,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a++]=0),S[a++]=t,S[a++]=i+n,S[a++]=h.r,S[a++]=h.g,S[a++]=h.b,S[a++]=h.a,S[a++]=e.u,S[a++]=e.v,this.twoColorTint&&(S[a++]=0,S[a++]=0,S[a++]=0,S[a]=0),this.batcher.draw(e.page.texture,S,Lt)}line(e,t,i,s,n,h){this.enableRenderer(this.shapes),this.shapes.line(e,t,i,s,n)}triangle(e,t,i,s,n,h,a,r,o,l){this.enableRenderer(this.shapes),this.shapes.triangle(e,t,i,s,n,h,a,r,o,l)}quad(e,t,i,s,n,h,a,r,o,l,c,f,d){this.enableRenderer(this.shapes),this.shapes.quad(e,t,i,s,n,h,a,r,o,l,c,f,d)}rect(e,t,i,s,n,h){this.enableRenderer(this.shapes),this.shapes.rect(e,t,i,s,n,h)}rectLine(e,t,i,s,n,h,a){this.enableRenderer(this.shapes),this.shapes.rectLine(e,t,i,s,n,h,a)}polygon(e,t,i,s){this.enableRenderer(this.shapes),this.shapes.polygon(e,t,i,s)}circle(e,t,i,s,n,h=0){this.enableRenderer(this.shapes),this.shapes.circle(e,t,i,s,n,h)}curve(e,t,i,s,n,h,a,r,o,l){this.enableRenderer(this.shapes),this.shapes.curve(e,t,i,s,n,h,a,r,o,l)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(e){let t=this.canvas;var i=window.devicePixelRatio||1,s=Math.round(t.clientWidth*i),n=Math.round(t.clientHeight*i);if((t.width!=s||t.height!=n)&&(t.width=s,t.height=n),this.context.gl.viewport(0,0,t.width,t.height),e===Vt.Expand)this.camera.setViewport(s,n);else if(e===Vt.Fit){let h=t.width,a=t.height,r=this.camera.viewportWidth,o=this.camera.viewportHeight,l=o/r,c=a/h,f=l<c?r/h:o/a;this.camera.setViewport(h*f,a*f)}this.camera.update()}enableRenderer(e){this.activeRenderer!==e&&(this.end(),e instanceof it?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(xe.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):e instanceof _i?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(xe.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},Vt=(e=>(e[e.Stretch=0]="Stretch",e[e.Expand=1]="Expand",e[e.Fit=2]="Fit",e))(Vt||{}),dt,st,Fs=0,_r=1,qi=1,Xs=165,Ps=108,Ke=163,zr=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new _t;backgroundColor=new V(.135,.135,.135,1);tempColor=new V;constructor(e){if(this.renderer=e,this.timeKeeper.maxDelta=9,!st){let t=navigator.userAgent.indexOf("Safari")>-1,i=()=>Fs++;st=new Image,st.src=qr,t||(st.crossOrigin="anonymous"),st.onload=i,dt=new Image,dt.src=Wr,t||(dt.crossOrigin="anonymous"),dt.onload=i}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(e=!1){if(Fs<2||e&&this.fadeOut>qi)return;this.timeKeeper.update();let t=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(t,5));let i=this.tempColor,s=this.renderer,n=s.canvas,h=s.context.gl;if(s.resize(1),s.camera.position.set(n.width/2,n.height/2,0),s.batcher.setBlendMode(0,!0),e){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>qi)return;i.setFromColor(this.backgroundColor),t=1-this.fadeOut/qi,t=1-(t-1)*(t-1),i.a*=t,i.a>0&&(s.camera.zoom=1,s.begin(),s.quad(!0,0,0,n.width,0,n.width,n.height,0,n.height,i,i,i,i),s.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(h.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),h.clear(h.COLOR_BUFFER_BIT)),t=1;t*=Math.min(this.fadeIn/_r,1),i.set(t,t,t,t),this.logo||(this.logo=new ct(s.context,st),this.spinner=new ct(s.context,dt)),s.camera.zoom=Math.max(1,Ke/n.height),s.begin(),s.drawTexture(this.logo,(n.width-Xs)/2,(n.height-Ps)/2,Xs,Ps,i),this.spinner&&s.drawTextureRotated(this.spinner,(n.width-Ke)/2,(n.height-Ke)/2,Ke,Ke,Ke/2,Ke/2,this.angle,i),s.end()}},Wr="data:image/png;base64,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",qr="data:image/png;base64,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",Gr=class{constructor(e,t){this.config=t,t.pathPrefix||(t.pathPrefix=""),t.app||(t.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),t.webglConfig||(t.webglConfig={alpha:!0}),this.htmlCanvas=e,this.context=new be(e,t.webglConfig),this.renderer=new ks(e,this.context),this.gl=this.context.gl,this.assetManager=new Cs(this.context,t.pathPrefix),this.input=new Di(e),t.app.loadAssets&&t.app.loadAssets(this);let i=()=>{this.disposed||(requestAnimationFrame(i),this.time.update(),t.app.update&&t.app.update(this,this.time.delta),t.app.render&&t.app.render(this))},s=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?t.app.error&&t.app.error(this,this.assetManager.getErrors()):(t.app.initialize&&t.app.initialize(this),i());return}requestAnimationFrame(s)}};requestAnimationFrame(s)}context;time=new _t;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(e,t,i,s){this.gl.clearColor(e,t,i,s),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}};return Gs(ji)})();
|
|
84
|
+
`;return new dt(t,s,i)}},Ys=class{constructor(e,t,s,i){this.attributes=t,this.context=e instanceof xt?e:new xt(e),this.elementsPerVertex=0;for(let r=0;r<t.length;r++)this.elementsPerVertex+=t[r].numElements;this.vertices=new Float32Array(s*this.elementsPerVertex),this.indices=new Uint16Array(i),this.context.addRestorable(this)}context;vertices;verticesBuffer=null;verticesLength=0;dirtyVertices=!1;indices;indicesBuffer=null;indicesLength=0;dirtyIndices=!1;elementsPerVertex=0;getAttributes(){return this.attributes}maxVertices(){return this.vertices.length/this.elementsPerVertex}numVertices(){return this.verticesLength/this.elementsPerVertex}setVerticesLength(e){this.dirtyVertices=!0,this.verticesLength=e}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(e){this.dirtyIndices=!0,this.indicesLength=e}getIndices(){return this.indices}getVertexSizeInFloats(){let e=0;for(var t=0;t<this.attributes.length;t++){let s=this.attributes[t];e+=s.numElements}return e}setVertices(e){if(this.dirtyVertices=!0,e.length>this.vertices.length)throw Error("Mesh can't store more than "+this.maxVertices()+" vertices");this.vertices.set(e,0),this.verticesLength=e.length}setIndices(e){if(this.dirtyIndices=!0,e.length>this.indices.length)throw Error("Mesh can't store more than "+this.maxIndices()+" indices");this.indices.set(e,0),this.indicesLength=e.length}draw(e,t){this.drawWithOffset(e,t,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(e,t,s,i){let r=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(e),this.indicesLength>0?r.drawElements(t,i,r.UNSIGNED_SHORT,s*2):r.drawArrays(t,s,i),this.unbind(e)}bind(e){let t=this.context.gl;t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer);let s=0;for(let i=0;i<this.attributes.length;i++){let r=this.attributes[i],h=e.getAttributeLocation(r.name);t.enableVertexAttribArray(h),t.vertexAttribPointer(h,r.numElements,t.FLOAT,!1,this.elementsPerVertex*4,s*4),s+=r.numElements}this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(e){let t=this.context.gl;for(let s=0;s<this.attributes.length;s++){let i=this.attributes[s],r=e.getAttributeLocation(i.name);t.disableVertexAttribArray(r)}t.bindBuffer(t.ARRAY_BUFFER,null),this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}update(){let e=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=e.createBuffer()),e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),e.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=e.createBuffer()),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),e.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);let e=this.context.gl;e.deleteBuffer(this.verticesBuffer),e.deleteBuffer(this.indicesBuffer)}},Ht=class{constructor(e,t,s){this.name=e,this.type=t,this.numElements=s}},ue=class extends Ht{constructor(){super(Tt.POSITION,0,2)}},Wr=class extends Ht{constructor(){super(Tt.POSITION,0,3)}},ks=class extends Ht{constructor(e=0){super(Tt.TEXCOORDS+(e==0?"":e),0,2)}},me=class extends Ht{constructor(){super(Tt.COLOR,0,4)}},vi=class extends Ht{constructor(){super(Tt.COLOR2,0,4)}},yi=(e=>(e[e.Float=0]="Float",e))(yi||{}),Xt=1,qr=769,Ai=770,Ci=771,Si=774,Fs=class Ut{static disableCulling=!1;context;drawCalls=0;static globalDrawCalls=0;isDrawing=!1;mesh;shader=null;lastTexture=null;verticesLength=0;indicesLength=0;srcColorBlend;srcAlphaBlend;dstBlend;cullWasEnabled=!1;constructor(t,s=!0,i=10920){if(i>10920)throw new Error("Can't have more than 10920 triangles per batch: "+i);this.context=t instanceof xt?t:new xt(t);let r=s?[new ue,new me,new ks,new vi]:[new ue,new me,new ks];this.mesh=new Ys(t,r,i,i*3);let h=this.context.gl;this.srcColorBlend=h.SRC_ALPHA,this.srcAlphaBlend=h.ONE,this.dstBlend=h.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=t,this.lastTexture=null,this.isDrawing=!0;let s=this.context.gl;s.enable(s.BLEND),s.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),Ut.disableCulling&&(this.cullWasEnabled=s.isEnabled(s.CULL_FACE),this.cullWasEnabled&&s.disable(s.CULL_FACE))}static blendModesGL=[{srcRgb:Ai,srcRgbPma:Xt,dstRgb:Ci,srcAlpha:Xt},{srcRgb:Ai,srcRgbPma:Xt,dstRgb:Xt,srcAlpha:Xt},{srcRgb:Si,srcRgbPma:Si,dstRgb:Ci,srcAlpha:Xt},{srcRgb:Xt,srcRgbPma:Xt,dstRgb:qr,srcAlpha:Xt}];setBlendMode(t,s){const i=Ut.blendModesGL[t],r=s?i.srcRgbPma:i.srcRgb,h=i.srcAlpha,l=i.dstRgb;if(this.srcColorBlend==r&&this.srcAlphaBlend==h&&this.dstBlend==l)return;this.srcColorBlend=r,this.srcAlphaBlend=h,this.dstBlend=l,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(r,l,h,l)}draw(t,s,i){t!=this.lastTexture?(this.flush(),this.lastTexture=t):(this.verticesLength+s.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();let r=this.mesh.numVertices();this.mesh.getVertices().set(s,this.verticesLength),this.verticesLength+=s.length,this.mesh.setVerticesLength(this.verticesLength);let h=this.mesh.getIndices();for(let l=this.indicesLength,n=0;n<i.length;l++,n++)h[l]=i[n]+r;this.indicesLength+=i.length,this.mesh.setIndicesLength(this.indicesLength)}flush(){if(this.verticesLength!=0){if(!this.lastTexture)throw new Error("No texture set.");if(!this.shader)throw new Error("No shader set.");this.lastTexture.bind(),this.mesh.draw(this.shader,this.context.gl.TRIANGLES),this.verticesLength=0,this.indicesLength=0,this.mesh.setVerticesLength(0),this.mesh.setIndicesLength(0),this.drawCalls++,Ut.globalDrawCalls++}}end(){if(!this.isDrawing)throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");(this.verticesLength>0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;let t=this.context.gl;t.disable(t.BLEND),Ut.disableCulling&&this.cullWasEnabled&&t.enable(t.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let t=Ut.globalDrawCalls;return Ut.globalDrawCalls=0,t}dispose(){this.mesh.dispose()}},Xs=class{context;isDrawing=!1;mesh;shapeType=4;color=new tt(1,1,1,1);shader=null;vertexIndex=0;tmp=new Vt;srcColorBlend;srcAlphaBlend;dstBlend;constructor(e,t=10920){if(t>10920)throw new Error("Can't have more than 10920 triangles per batch: "+t);this.context=e instanceof xt?e:new xt(e),this.mesh=new Ys(e,[new ue,new me],t,0);let s=this.context.gl;this.srcColorBlend=s.SRC_ALPHA,this.srcAlphaBlend=s.ONE,this.dstBlend=s.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=e,this.vertexIndex=0,this.isDrawing=!0;let t=this.context.gl;t.enable(t.BLEND),t.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(e,t,s){this.srcColorBlend=e,this.srcAlphaBlend=t,this.dstBlend=s,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(e,s,t,s))}setColor(e){this.color.setFromColor(e)}setColorWith(e,t,s,i){this.color.set(e,t,s,i)}point(e,t,s){this.check(0,1),s||(s=this.color),this.vertex(e,t,s)}line(e,t,s,i,r){this.check(1,2);let h=this.mesh.getVertices(),l=this.vertexIndex;r||(r=this.color),this.vertex(e,t,r),this.vertex(s,i,r)}triangle(e,t,s,i,r,h,l,n,a,o){this.check(e?4:1,3);let c=this.mesh.getVertices(),d=this.vertexIndex;n||(n=this.color),a||(a=this.color),o||(o=this.color),e?(this.vertex(t,s,n),this.vertex(i,r,a),this.vertex(h,l,o)):(this.vertex(t,s,n),this.vertex(i,r,a),this.vertex(i,r,n),this.vertex(h,l,a),this.vertex(h,l,n),this.vertex(t,s,a))}quad(e,t,s,i,r,h,l,n,a,o,c,d,f){this.check(e?4:1,3);let m=this.mesh.getVertices(),u=this.vertexIndex;o||(o=this.color),c||(c=this.color),d||(d=this.color),f||(f=this.color),e?(this.vertex(t,s,o),this.vertex(i,r,c),this.vertex(h,l,d),this.vertex(h,l,d),this.vertex(n,a,f),this.vertex(t,s,o)):(this.vertex(t,s,o),this.vertex(i,r,c),this.vertex(i,r,c),this.vertex(h,l,d),this.vertex(h,l,d),this.vertex(n,a,f),this.vertex(n,a,f),this.vertex(t,s,o))}rect(e,t,s,i,r,h){this.quad(e,t,s,t+i,s,t+i,s+r,t,s+r,h,h,h,h)}rectLine(e,t,s,i,r,h,l){this.check(e?4:1,8),l||(l=this.color);let n=this.tmp.set(r-s,t-i);n.normalize(),h*=.5;let a=n.x*h,o=n.y*h;e?(this.vertex(t+a,s+o,l),this.vertex(t-a,s-o,l),this.vertex(i+a,r+o,l),this.vertex(i-a,r-o,l),this.vertex(i+a,r+o,l),this.vertex(t-a,s-o,l)):(this.vertex(t+a,s+o,l),this.vertex(t-a,s-o,l),this.vertex(i+a,r+o,l),this.vertex(i-a,r-o,l),this.vertex(i+a,r+o,l),this.vertex(t+a,s+o,l),this.vertex(i-a,r-o,l),this.vertex(t-a,s-o,l))}x(e,t,s){this.line(e-s,t-s,e+s,t+s),this.line(e-s,t+s,e+s,t-s)}polygon(e,t,s,i){if(s<3)throw new Error("Polygon must contain at least 3 vertices");this.check(1,s*2),i||(i=this.color);let r=this.mesh.getVertices(),h=this.vertexIndex;t<<=1,s<<=1;let l=e[t],n=e[t+1],a=t+s;for(let o=t,c=t+s-2;o<c;o+=2){let d=e[o],f=e[o+1],m=0,u=0;o+2>=a?(m=l,u=n):(m=e[o+2],u=e[o+3]),this.vertex(d,f,i),this.vertex(m,u,i)}}circle(e,t,s,i,r,h=0){if(h==0&&(h=Math.max(1,6*P.cbrt(i)|0)),h<=0)throw new Error("segments must be > 0.");r||(r=this.color);let l=2*P.PI/h,n=Math.cos(l),a=Math.sin(l),o=i,c=0;if(e){this.check(4,h*3+3),h--;for(let f=0;f<h;f++){this.vertex(t,s,r),this.vertex(t+o,s+c,r);let m=o;o=n*o-a*c,c=a*m+n*c,this.vertex(t+o,s+c,r)}this.vertex(t,s,r),this.vertex(t+o,s+c,r)}else{this.check(1,h*2+2);for(let f=0;f<h;f++){this.vertex(t+o,s+c,r);let m=o;o=n*o-a*c,c=a*m+n*c,this.vertex(t+o,s+c,r)}this.vertex(t+o,s+c,r)}let d=o;o=i,c=0,this.vertex(t+o,s+c,r)}curve(e,t,s,i,r,h,l,n,a,o){this.check(1,a*2+2),o||(o=this.color);let c=1/a,d=c*c,f=c*c*c,m=3*c,u=3*d,g=6*d,w=6*f,b=e-s*2+r,x=t-i*2+h,p=(s-r)*3-e+l,v=(i-h)*3-t+n,y=e,A=t,C=(s-e)*m+b*u+p*f,S=(i-t)*m+x*u+v*f,I=b*g+p*w,Y=x*g+v*w,k=p*w,F=v*w;for(;a-- >0;)this.vertex(y,A,o),y+=C,A+=S,C+=I,S+=Y,I+=k,Y+=F,this.vertex(y,A,o);this.vertex(y,A,o),this.vertex(l,n,o)}vertex(e,t,s){let i=this.vertexIndex,r=this.mesh.getVertices();r[i++]=e,r[i++]=t,r[i++]=s.r,r[i++]=s.g,r[i++]=s.b,r[i++]=s.a,this.vertexIndex=i}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();let e=this.context.gl;e.disable(e.BLEND),this.isDrawing=!1}flush(){if(this.vertexIndex!=0){if(!this.shader)throw new Error("No shader set.");this.mesh.setVerticesLength(this.vertexIndex),this.mesh.draw(this.shader,this.shapeType),this.vertexIndex=0}}check(e,t){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType==e)if(this.mesh.maxVertices()-this.mesh.numVertices()<t)this.flush();else return;else this.flush(),this.shapeType=e}dispose(){this.mesh.dispose()}},Ti=(e=>(e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.Filled=4]="Filled",e))(Ti||{}),Ii=class Us{boneLineColor=new tt(1,0,0,1);boneOriginColor=new tt(0,1,0,1);attachmentLineColor=new tt(0,0,1,.5);triangleLineColor=new tt(1,.64,0,.5);pathColor=new tt().setFromString("FF7F00");clipColor=new tt(.8,0,0,2);aabbColor=new tt(0,1,0,.5);drawBones=!0;drawRegionAttachments=!0;drawBoundingBoxes=!0;drawMeshHull=!0;drawMeshTriangles=!0;drawPaths=!0;drawSkeletonXY=!1;drawClipping=!0;premultipliedAlpha=!1;scale=1;boneWidth=2;context;bounds=new mi;temp=new Array;vertices=L.newFloatArray(2*1024);static LIGHT_GRAY=new tt(192/255,192/255,192/255,1);static GREEN=new tt(0,1,0,1);constructor(t){this.context=t instanceof xt?t:new xt(t)}draw(t,s,i){let r=s.x,h=s.y,l=this.context.gl,n=this.premultipliedAlpha?l.ONE:l.SRC_ALPHA;t.setBlendMode(n,l.ONE,l.ONE_MINUS_SRC_ALPHA);let a=s.bones;if(this.drawBones){t.setColor(this.boneLineColor);for(let o=0,c=a.length;o<c;o++){let d=a[o];if(i&&i.indexOf(d.data.name)>-1||!d.parent)continue;let f=d.data.length*d.a+d.worldX,m=d.data.length*d.c+d.worldY;t.rectLine(!0,d.worldX,d.worldY,f,m,this.boneWidth*this.scale)}this.drawSkeletonXY&&t.x(r,h,4*this.scale)}if(this.drawRegionAttachments){t.setColor(this.attachmentLineColor);let o=s.slots;for(let c=0,d=o.length;c<d;c++){let f=o[c],m=f.getAttachment();if(m instanceof te){let u=m,g=this.vertices;u.computeWorldVertices(f,g,0,2),t.line(g[0],g[1],g[2],g[3]),t.line(g[2],g[3],g[4],g[5]),t.line(g[4],g[5],g[6],g[7]),t.line(g[6],g[7],g[0],g[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){let o=s.slots;for(let c=0,d=o.length;c<d;c++){let f=o[c];if(!f.bone.active)continue;let m=f.getAttachment();if(!(m instanceof Wt))continue;let u=m,g=this.vertices;u.computeWorldVertices(f,0,u.worldVerticesLength,g,0,2);let w=u.triangles,b=u.hullLength;if(this.drawMeshTriangles){t.setColor(this.triangleLineColor);for(let x=0,p=w.length;x<p;x+=3){let v=w[x]*2,y=w[x+1]*2,A=w[x+2]*2;t.triangle(!1,g[v],g[v+1],g[y],g[y+1],g[A],g[A+1])}}if(this.drawMeshHull&&b>0){t.setColor(this.attachmentLineColor),b=(b>>1)*2;let x=g[b-2],p=g[b-1];for(let v=0,y=b;v<y;v+=2){let A=g[v],C=g[v+1];t.line(A,C,x,p),x=A,p=C}}}}if(this.drawBoundingBoxes){let o=this.bounds;o.update(s,!0),t.setColor(this.aabbColor),t.rect(!1,o.minX,o.minY,o.getWidth(),o.getHeight());let c=o.polygons,d=o.boundingBoxes;for(let f=0,m=c.length;f<m;f++){let u=c[f];t.setColor(d[f].color),t.polygon(u,0,u.length)}}if(this.drawPaths){let o=s.slots;for(let c=0,d=o.length;c<d;c++){let f=o[c];if(!f.bone.active)continue;let m=f.getAttachment();if(!(m instanceof qt))continue;let u=m,g=u.worldVerticesLength,w=this.temp=L.setArraySize(this.temp,g,0);u.computeWorldVertices(f,0,g,w,0,2);let b=this.pathColor,x=w[2],p=w[3],v=0,y=0;if(u.closed){t.setColor(b);let A=w[0],C=w[1],S=w[g-2],I=w[g-1];v=w[g-4],y=w[g-3],t.curve(x,p,A,C,S,I,v,y,32),t.setColor(Us.LIGHT_GRAY),t.line(x,p,A,C),t.line(v,y,S,I)}g-=4;for(let A=4;A<g;A+=6){let C=w[A],S=w[A+1],I=w[A+2],Y=w[A+3];v=w[A+4],y=w[A+5],t.setColor(b),t.curve(x,p,C,S,I,Y,v,y,32),t.setColor(Us.LIGHT_GRAY),t.line(x,p,C,S),t.line(v,y,I,Y),x=v,p=y}}}if(this.drawBones){t.setColor(this.boneOriginColor);for(let o=0,c=a.length;o<c;o++){let d=a[o];i&&i.indexOf(d.data.name)>-1||t.circle(!0,d.worldX,d.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=s.slots;t.setColor(this.clipColor);for(let c=0,d=o.length;c<d;c++){let f=o[c];if(!f.bone.active)continue;let m=f.getAttachment();if(!(m instanceof $t))continue;let u=m,g=u.worldVerticesLength,w=this.temp=L.setArraySize(this.temp,g,0);u.computeWorldVertices(f,0,g,w,0,2);for(let b=0,x=w.length;b<x;b+=2){let p=w[b],v=w[b+1],y=w[(b+2)%w.length],A=w[(b+3)%w.length];t.line(p,v,y,A)}}}}dispose(){}},Gr=class{constructor(e,t,s){this.vertices=e,this.numVertices=t,this.numFloats=s}},Mi=class Wi{static QUAD_TRIANGLES=[0,1,2,2,3,0];premultipliedAlpha=!1;tempColor=new tt;tempColor2=new tt;vertices;vertexSize=8;twoColorTint=!1;renderable=new Gr([],0,0);clipper=new xi;temp=new Vt;temp2=new Vt;temp3=new tt;temp4=new tt;constructor(t,s=!0){this.twoColorTint=s,s&&(this.vertexSize+=4),this.vertices=L.newFloatArray(this.vertexSize*1024)}draw(t,s,i=-1,r=-1,h=null){let l=this.clipper,n=this.premultipliedAlpha,a=this.twoColorTint,o=null,c=this.renderable,d,f,m=s.drawOrder,u,g=s.color,w=a?12:8,b=!1;i==-1&&(b=!0);for(let x=0,p=m.length;x<p;x++){let v=l.isClipping()?2:w,y=m[x];if(!y.bone.active){l.clipEndWithSlot(y);continue}if(i>=0&&i==y.data.index&&(b=!0),!b){l.clipEndWithSlot(y);continue}r>=0&&r==y.data.index&&(b=!1);let A=y.getAttachment(),C;if(A instanceof te){let S=A;c.vertices=this.vertices,c.numVertices=4,c.numFloats=v<<2,S.computeWorldVertices(y,c.vertices,0,v),f=Wi.QUAD_TRIANGLES,d=S.uvs,C=S.region.texture,u=S.color}else if(A instanceof Wt){let S=A;c.vertices=this.vertices,c.numVertices=S.worldVerticesLength>>1,c.numFloats=c.numVertices*v,c.numFloats>c.vertices.length&&(c.vertices=this.vertices=L.newFloatArray(c.numFloats)),S.computeWorldVertices(y,0,S.worldVerticesLength,c.vertices,0,v),f=S.triangles,C=S.region.texture,d=S.uvs,u=S.color}else if(A instanceof $t){let S=A;l.clipStart(y,S);continue}else{l.clipEndWithSlot(y);continue}if(C){let S=y.color,I=this.tempColor;I.r=g.r*S.r*u.r,I.g=g.g*S.g*u.g,I.b=g.b*S.b*u.b,I.a=g.a*S.a*u.a,n&&(I.r*=I.a,I.g*=I.a,I.b*=I.a);let Y=this.tempColor2;y.darkColor?(n?(Y.r=y.darkColor.r*I.a,Y.g=y.darkColor.g*I.a,Y.b=y.darkColor.b*I.a):Y.setFromColor(y.darkColor),Y.a=n?1:0):Y.set(0,0,0,1);let k=y.data.blendMode;if(k!=o&&(o=k,t.setBlendMode(o,n)),l.isClipping()){l.clipTriangles(c.vertices,f,f.length,d,I,Y,a);let F=new Float32Array(l.clippedVertices),X=l.clippedTriangles;h&&h(F,F.length,w),t.draw(C,F,X)}else{let F=c.vertices;if(a)for(let E=2,R=0,B=c.numFloats;E<B;E+=w,R+=2)F[E]=I.r,F[E+1]=I.g,F[E+2]=I.b,F[E+3]=I.a,F[E+4]=d[R],F[E+5]=d[R+1],F[E+6]=Y.r,F[E+7]=Y.g,F[E+8]=Y.b,F[E+9]=Y.a;else for(let E=2,R=0,B=c.numFloats;E<B;E+=w,R+=2)F[E]=I.r,F[E+1]=I.g,F[E+2]=I.b,F[E+3]=I.a,F[E+4]=d[R],F[E+5]=d[R+1];let X=c.vertices.subarray(0,c.numFloats);h&&h(c.vertices,c.numFloats,w),t.draw(C,X,f)}}l.clipEndWithSlot(y)}l.clipEnd()}getSkeletonClipping(){return this.clipper}},T=[0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0],ge=[0,1,2,2,3,0],xe=new tt(1,1,1,1),Ei=class{context;canvas;camera;batcher;twoColorTint=!1;batcherShader;shapes;shapesShader;activeRenderer=null;skeletonRenderer;skeletonDebugRenderer;constructor(e,t,s=!0){this.canvas=e,this.context=t instanceof xt?t:new xt(t),this.twoColorTint=s,this.camera=new wi(e.width,e.height),this.batcherShader=s?Tt.newTwoColoredTextured(this.context):Tt.newColoredTextured(this.context),this.batcher=new Fs(this.context,s),this.shapesShader=Tt.newColored(this.context),this.shapes=new Xs(this.context),this.skeletonRenderer=new Mi(this.context,s),this.skeletonDebugRenderer=new Ii(this.context)}dispose(){this.batcher.dispose(),this.batcherShader.dispose(),this.shapes.dispose(),this.shapesShader.dispose(),this.skeletonDebugRenderer.dispose()}begin(){this.camera.update(),this.enableRenderer(this.batcher)}drawSkeleton(e,t=!1,s=-1,i=-1,r=null){this.enableRenderer(this.batcher),this.skeletonRenderer.premultipliedAlpha=t,this.skeletonRenderer.draw(this.batcher,e,s,i,r)}drawSkeletonDebug(e,t=!1,s){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.premultipliedAlpha=t,this.skeletonDebugRenderer.draw(this.shapes,e,s)}drawTexture(e,t,s,i,r,h){this.enableRenderer(this.batcher),h||(h=xe);var l=0;T[l++]=t,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=0,T[l++]=1,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=t+i,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=1,T[l++]=1,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=t+i,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=1,T[l++]=0,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=t,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=0,T[l++]=0,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l]=0),this.batcher.draw(e,T,ge)}drawTextureUV(e,t,s,i,r,h,l,n,a,o){this.enableRenderer(this.batcher),o||(o=xe);var c=0;T[c++]=t,T[c++]=s,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=h,T[c++]=l,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=t+i,T[c++]=s,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=n,T[c++]=l,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=t+i,T[c++]=s+r,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=n,T[c++]=a,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=t,T[c++]=s+r,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=h,T[c++]=a,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c]=0),this.batcher.draw(e,T,ge)}drawTextureRotated(e,t,s,i,r,h,l,n,a){this.enableRenderer(this.batcher),a||(a=xe);let o=t+h,c=s+l,d=-h,f=-l,m=i-h,u=r-l,g=d,w=f,b=d,x=u,p=m,v=u,y=m,A=f,C=0,S=0,I=0,Y=0,k=0,F=0,X=0,E=0;if(n!=0){let B=P.cosDeg(n),st=P.sinDeg(n);C=B*g-st*w,S=st*g+B*w,X=B*b-st*x,E=st*b+B*x,k=B*p-st*v,F=st*p+B*v,I=k+(C-X),Y=F+(S-E)}else C=g,S=w,X=b,E=x,k=p,F=v,I=y,Y=A;C+=o,S+=c,I+=o,Y+=c,k+=o,F+=c,X+=o,E+=c;var R=0;T[R++]=C,T[R++]=S,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=0,T[R++]=1,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R++]=0),T[R++]=I,T[R++]=Y,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=1,T[R++]=1,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R++]=0),T[R++]=k,T[R++]=F,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=1,T[R++]=0,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R++]=0),T[R++]=X,T[R++]=E,T[R++]=a.r,T[R++]=a.g,T[R++]=a.b,T[R++]=a.a,T[R++]=0,T[R++]=0,this.twoColorTint&&(T[R++]=0,T[R++]=0,T[R++]=0,T[R]=0),this.batcher.draw(e,T,ge)}drawRegion(e,t,s,i,r,h){this.enableRenderer(this.batcher),h||(h=xe);var l=0;T[l++]=t,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=e.u,T[l++]=e.v2,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=t+i,T[l++]=s,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=e.u2,T[l++]=e.v2,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=t+i,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=e.u2,T[l++]=e.v,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=t,T[l++]=s+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=e.u,T[l++]=e.v,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l]=0),this.batcher.draw(e.page.texture,T,ge)}line(e,t,s,i,r,h){this.enableRenderer(this.shapes),this.shapes.line(e,t,s,i,r)}triangle(e,t,s,i,r,h,l,n,a,o){this.enableRenderer(this.shapes),this.shapes.triangle(e,t,s,i,r,h,l,n,a,o)}quad(e,t,s,i,r,h,l,n,a,o,c,d,f){this.enableRenderer(this.shapes),this.shapes.quad(e,t,s,i,r,h,l,n,a,o,c,d,f)}rect(e,t,s,i,r,h){this.enableRenderer(this.shapes),this.shapes.rect(e,t,s,i,r,h)}rectLine(e,t,s,i,r,h,l){this.enableRenderer(this.shapes),this.shapes.rectLine(e,t,s,i,r,h,l)}polygon(e,t,s,i){this.enableRenderer(this.shapes),this.shapes.polygon(e,t,s,i)}circle(e,t,s,i,r,h=0){this.enableRenderer(this.shapes),this.shapes.circle(e,t,s,i,r,h)}curve(e,t,s,i,r,h,l,n,a,o){this.enableRenderer(this.shapes),this.shapes.curve(e,t,s,i,r,h,l,n,a,o)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(e){let t=this.canvas;var s=window.devicePixelRatio||1,i=Math.round(t.clientWidth*s),r=Math.round(t.clientHeight*s);if((t.width!=i||t.height!=r)&&(t.width=i,t.height=r),this.context.gl.viewport(0,0,t.width,t.height),e===1)this.camera.setViewport(i,r);else if(e===2){let h=t.width,l=t.height,n=this.camera.viewportWidth,a=this.camera.viewportHeight,o=a/n,c=l/h,d=o<c?n/h:a/l;this.camera.setViewport(h*d,l*d)}this.camera.update()}enableRenderer(e){this.activeRenderer!==e&&(this.end(),e instanceof Fs?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(Tt.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):e instanceof Xs?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(Tt.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},Ri=(e=>(e[e.Stretch=0]="Stretch",e[e.Expand=1]="Expand",e[e.Fit=2]="Fit",e))(Ri||{}),_t,Dt,Ps=0,Hr=1,Ls=1,pe=165,we=108,It=163,_r=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new Me;backgroundColor=new tt(.135,.135,.135,1);tempColor=new tt;constructor(e){if(this.renderer=e,this.timeKeeper.maxDelta=9,!Dt){let t=navigator.userAgent.indexOf("Safari")>-1,s=()=>Ps++;Dt=new Image,Dt.src=Zr,t||(Dt.crossOrigin="anonymous"),Dt.onload=s,_t=new Image,_t.src=jr,t||(_t.crossOrigin="anonymous"),_t.onload=s}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(e=!1){if(Ps<2||e&&this.fadeOut>Ls)return;this.timeKeeper.update();let t=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(t,5));let s=this.tempColor,i=this.renderer,r=i.canvas,h=i.context.gl;if(i.resize(1),i.camera.position.set(r.width/2,r.height/2,0),i.batcher.setBlendMode(0,!0),e){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>Ls)return;s.setFromColor(this.backgroundColor),t=1-this.fadeOut/Ls,t=1-(t-1)*(t-1),s.a*=t,s.a>0&&(i.camera.zoom=1,i.begin(),i.quad(!0,0,0,r.width,0,r.width,r.height,0,r.height,s,s,s,s),i.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(h.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),h.clear(h.COLOR_BUFFER_BIT)),t=1;t*=Math.min(this.fadeIn/Hr,1),s.set(t,t,t,t),this.logo||(this.logo=new Gt(i.context,Dt),this.spinner=new Gt(i.context,_t)),i.camera.zoom=Math.max(1,It/r.height),i.begin(),i.drawTexture(this.logo,(r.width-pe)/2,(r.height-we)/2,pe,we,s),this.spinner&&i.drawTextureRotated(this.spinner,(r.width-It)/2,(r.height-It)/2,It,It,It/2,It/2,this.angle,s),i.end()}drawInCoordinates(e,t){if(Ps<2)return;this.timeKeeper.update();let s=this.renderer;s.batcher.setBlendMode(0,!0),this.logo||(this.logo=new Gt(s.context,Dt),this.spinner=new Gt(s.context,_t));const i=e-pe/2,r=t-we/2;s.drawTexture(this.logo,i,r,pe,we),this.angle-=this.timeKeeper.delta*500,this.spinner&&s.drawTextureRotated(this.spinner,i,r-25,It,It,It/2,It/2,this.angle)}},jr="data:image/png;base64,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",Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKUAAABsCAYAAAALzHKmAAAQ7klEQVR42u3da4xdVRUA4D0zd2Y6nZY59DVtZ1puS9+lzC0YAi2UQ8AAQczFpPgA9VIeIQbirRqJ0cBUBVGjDr/QCKSNRSMmpuODxAdxqhgwxkhFjf6Sxh/+UUNVNGJCzR7uTvas7LXX2q9zzp3em6y0gTN3Zu75utZe5+yztxC9V+/Ve5X9En1Vjd7J6SFbLNF7naPw+l2jh7YHMBWssqMHtlsRdim4qsLtIawaPiHEQOLoNrA9iIkQDnRrVA1qD2LZ8ISoxYqKo13sQAtBWBayQWZUAXGRQM9JjCngDVY0UqJNDbQrMcaGmArdUKpIjbYiQLsCZCyIMQBy8QwnilR4Q5AuCpxFYvRFmBLbEiwKwpsSaWycVQGZBKMrwBjA9BhxDe57u2L2hOoKNCbOrgAZitEVYUxoKSMErQvSxYIzCkguRg5EF4AUhqUlhy/YUKSxcRaKsioYOQhD4I0yYxkR3PcJBcuFysmgsXAWBTMJyBCMIQh9kGGxXIXvexCQXbHGAMrBWTbM2CCpMSMLIxehC77lSJwXGth7M0FzoVJIXXDWQnGmhOkL0ic7YhhtWdGGkAuPAjUWGoF4faCmwBkbZmyUqUCyMqMLRA4+E6IsdTjidUHKBYrh9CnpRcH0ypKxsyOGEYNIIeTCOz91OIJ1QYoB5eAMyZo+MFNnyVTZ0YiRC9EGEMOyAgshxErHsL2XK1gOUgwohtM1a5YNM7Rsu4K0ZkcbRm4mpPBRwFZ5hg9eCqkrUB+csWGGogzNkqEgrdnRhpGLkINudaLgwvVB6oqzCjCTZElb2Y4B0gUjBtEG0ARnDRLjjoG9DwcshtQGlIPTljVjwUySLWNkyRCQVHa0ZUUTRAwgF91a33BEy0VKAcVwwqwZC2bqbOlUurllOxQkJzNyINoAYqjWhYYjWg5SCiiG05Q1U8FMjTIoS8YE6YORi1BHtJ4KIcQEEtTXUWAxpK44YVlPBdO1jCdFWTZIE8bVGEYMIRPcZGBw4HKQcoBiOE1ZMzbMgVQwU6JMAdKEEcuIJogUvg1YCCE2gsCO42DlIIVAKZwpYJaSLVNnSU6XjYHUmxhTmXaFaMO3EYkLqMC+FsLlIoVAKZzMrEnBhJeLfLNlKMrYWRIDCbOkFSSVHbHM6AKRC6/ODUewNqQ+OLlZkxpjUmV8MBbMUJSxyzY3Q1IgTRgxiBRCHdem0KDAUkBh9sRwwjEnAXMMgTnKhFlUtiwkS5rGka4g9SaGgxFmRC7AzTCEEBcyA36dDSsXqAtOLkysjGMwY5XxVChjZ0kuSCo7YlkRQsQQYtDEFsegsLoCxUp7Kpgps2UslFGzJGccSYHUmxhOZqwzEZqAbfUMCisHKIZzgsCpl3MTzMwTpi1bYp2477gyFKUxS7qWbdjY2EBS2dGE0QQRA7gNCyHEdhjE8RhUDlBT9tzgmjWZMFNlSy+Urk1OzCyJlW0XkK4YOQh1cDtcgwBrQmoDWkdgboBZE8mYsJSHlnFbJ+5bwmOPJ7lZkirbC8aRsMvmgtTHjBhGE0QbwJ2egUE1ITVlUC5OmDVdYNrKuN70xM6WoShjlW4464dbtiFIWK6x7GjESEHUUe0iYncnbMdQSE0Z1ITTNOb0hRmjjLtmS9dmJ2rp1jtuKktyyrb6YLEMCUHq2dGG0QQRQ7f72kzc+cJecerne8Wvv7JNPHPvenEkz8Sh3UtFc92QyGt9Yko/HgOLAIUZlItTz5ouMF3KuE+2jFLCQ1D6lm6fLMkBacuOJowYRBUXyfjuHjF3NhdnsfjvAfH6E9vFt9XxKgikEKgJZyyYalzOLeMu2bLbULI6bh+QGwmQ+rgRlumdGEQAao+K56bEL2woVUwOiev0r8OAUjiJrMmFCbvykGxZRAmPitK1dHM7bohyMsuyi/I8f0+e57fJYIKEZXpXo9E4mOf5XTKyLLvCBLETF8uY2SKepkC+dpX4T02Ivepr4HvZcOZ5fmee54fyPL+DmTUhzAs6n4n8bN5dr9f3YdkSg8nsxG0lPBVKVpNjG0/aGhzfLDmRZdnumZmZp8+c+cdZPV555fSr7Xb7s0jJ3i5Pcue4MxKkPPkvvXTqz/B92u32l0wYOzG1fkhcd/py8Rcbyq/vFM/KY1WA95h/3zzP71bfU6JsNpsfgj+P/FlbrdaDGExYyuXvLz8H+DudODH700ajcSM3W6Yu4alQ1spCOTd38jcKocTZbh9+9NixY99XJ8AEUkcpo9W64yH197m5k7+bnZ19QT+J09NHntQhwji/Jg58qi6++ofLxJ8gSFneVw2Ka4QQDfh1Ok4dZavVmtZ/nrm5k7/Vf55O1tRhboUw5+ZOvqyOl5+R/FyOHj32PYVU/tloNG5IXcKrhJIzngwp3fNjomazea/64BuNxts646f50lWv169utw9/DmtqdJQyZFaSJVuV6nq9fqMEof5/vV6/CYBqgJDlee+yAbF/+4i4ZWqZeNfaIfHWzn+Hx0KcEuU9+s8jv3ej0bhVlXOZydX/k0iRMeb8P0D5e6tj8zy/Xb9UJIc56h/yqVOnXul8lmuZ2bJslKmbHG7XrbpCmCXFRLvdfqQD6jTS3Jiy5I4OykM6ADV+1Eu1DmV6evopBORexzDi1L+X/HnGxsb2w3Hm9PSRJ9QxWPOTZdmlKht2hi+w6dkox5bqffI8fye3hDteGqKaHVsHXihKl0tB+h0cY+lute54AGRKDCW89LNTRynHb7ChUWVVjetOnJh9EYBUyPZeNCoOtsbFQwdXi4/esELcd+tq8cCHJ8UXp+viy9efLz7AgamjlKXc1AA1m83DoIRDlFubzeb96hhZLVTlgJ24gttutx+ONa50bHZKRenaeTs1OfpAfnr6yOOdE7EZdNwmlKocntXLNkA5JTGq47Ds+Lf94lWsyfnXleLfnIwJUN4DOnNYwuUxh2A3Ln9XULrfK8t3J27Tu3BVwiOjXJqoAy8UZej1yclGo3GTLN+gu3w+z/P3YaWbQqk3Ne12e4ZC+c8rxWsYytcPiP9RpZxCqWDKnxOiBNlyAUpOnGsoh4tA2Rm8X9xqtT6md5wyZmYe+0YRKL+1S/wYQ3n8zctBl5SBUv5djivfjMOPduIzcizeiYfr9foVvUwZG+XCuzibZKnSceZ5/v4QlKp8y7ElhnJlTeTP7BI/kllRYfzrfvHqFy4UX1vaL/aVlSmROzwbwdS29T2UcEwZF+V8ozM2lu1VY812u/15akypGh3TmFJesJbHHD167IdUxz3YJy5bNySuX1mbvy55CbMLtzU6tjGlsdFptVqfUMc0Go23F4wy1l2dSnbfvpMwVPe9WWVLDsrOJaF9MFu2Wq1PqmNkGce67xiXhTjdNwdlvV6/BgxfbPfBfVCetxi6b9/rlCup65QzM48dl2OjLMv26CibzeZ96sTIzEFdpwQXz9U1yrtVlpR/Zll2Fec65Y6l4pbbx8XHH9kknvzJlPjlHy8Tp29eKT5ou0aJoIT3w3dBlLDzVpfAJEZ1XOdaJZxnOSlvPMjPzxFljIvng914RwebsjYO7uhMyHu46sOfnf3Oz2TXDW6vvYxdFoIXz3Wc8J5zs9n8iOn2IrxTc2BM3Glqdp7dI553uaOjxrhwcob+MyuUpjs6WZZdon8OcigjPx8V+u+GTWFTSWEx3WYcdJ225jNDSE4q0GHCzlueHOyujn6bUWYgeb9ZZUaQPe+GzQ+Gc8+oOGhC+c1d4gfI16n3XDAhQ7+9qE9l01E2Go132GYKyXE1NiFDTcpoNpv3LOYJGWXNErJNW9sEp63p2RKiVPMn1bS1DgxsyhoGdGpmizj+xtXiDYnx7/vFmce3iWdW1cTVGEY4hQ2ZW0nNq8Qm/M6XbXm3S100lwGedFybuvNOibLI+ZS2ceU4eAxiEuvCkfmU8ycToDxETe6FgCBQHeqyAbFvfEhcO7BwDuXFCEbTZF840XeHK0jYcbs2OIGle0mVJ/mmnClEPQqxyTY5I8/zFhif7fSZee4bnrPOU4AssnRXHaVTCTd14dRDY3UbTIiSeFhsN/aMjgnqthFx880rxX3yATL5p3y4LPXzOaBkUyBjZMlYpbtQlIOBD475ZEusjMNSvkXe6VEoJVDkeZ2dzIfIFsRzU+JF2OyM9M9fTC/6SUYOyFQPjQ2nWiUjxnPfw5EeHqMWIqAeIFsAU847lJM2JM6xsewt1OIDLs99P7ZFHNdB/upS8XtPiD7PfLuCXJNolYyyFiNI/Zit65ItrOVafFbHcFohY7hPTN21Tjz4uc3iqfsnxKdX1MTl1OoYRFaMsToGB6Trw2JFP/OdZC2hJZ7ZkrMoAbbSGmelDJ91hFKuJeS7jlBMkJnrAqqJlgMUZS/dArPlGHNdSg5M3xXXtvquuEatvIYtDRhpxbUJuIgqsU5lGWtUploK0KuEU9mSW8YpmFQ556xNuYW7NiW13B+FkMiKHIy+C6eGgBxJvMR0oSv5hi6+z4HJyZoU0M2RVvDlrOQbcxVfX5AhZbuqy0v7ZstYMLHlAVlLTF9ALLbvu9Y5Zylpn/XOsd0ibIvxr2KCLHpp6SCUIdnSZSF+WzfOhem6GD+1KwR3Z4jNjrtDpNoZwmWd8yrupZN6Hx3fbMmFSe0Swdq2ZIPjxk1112Duo8OBGLrBkw/IoncdK2XHsdC9dHz204m50xh3tzFq1zFqtzHXrfCw7OgDsqyNnZLszVijsmXgrmNcmGtS78lIoMX2aJz03fKO2sDJddPQSCDPiQ1DfWBycY6XtXstc2PQKuxgG2McmXTPb9/9vmuJYXKyJrWjbeg+3xPM4O73nWqvbyw7xgZZSJbEUBa157cNJjdr2vb+5iA1YV3HxYscj30PDCEHIgcjtfm8K8hSsmRotkwFk5s1TTghUAopB6xrjHMBBkI0YYTZ0dZlxwLpkiWDULpmy5gwqayZgZNkA7oKQQCxctByYg0XIIEQQuRitGVHblMTA2ShKGPDpC6wu+DEgJqg2rDGDBtAF4Q6RAojp1xXGmSMbImVcR+YWNY04eQCtUG1ofUJ2/uvcETIgUhhdAE5GAlkKShjwHTNmhhODKgJqQ2sC14uOgyfD0IbRF+MlQaZAiZWyn2yJsTJATqGnHQO2Jhh+xlsACFCG0QbRtdyzQFZCZSxYPpmTS7Q5cjJHYNBYIkZpu99HoUQ/o4QIYSIZUZfjJ4ZMjZI32wZBDMU5yhy8pZTULl4XYP5fagMyEVoy4oupTpGduwnkloSlKEwY+AcQU4MhRTD6ovXBRwFzwWgCSEF0QVjJUGmgEllTS5OLlCIlIN1mS9mx/cZ5eLDALpCTI2RAhkTZQqYoTgpoCPECbaBHQ2ETL3PUl98ECAXYijG0OyYAmQoTG7W5ODkAF1CnVgm2JQx4okPA+gCMTbGskBGgRmaOblAh5GTORIrfKFx4VH4EIAxIXIxlg2SBbMvECY3e7oApbDaIgQu5/2HmeEKEINYiwSRi7EQkLFgumZOCuggctKGI4ULZN/vMeSLj0AYMytWEqMLzFg4fYDaoKaC6wvOFR4FkIPQFaILxrJAOsHsc/zlfYDWXE8qF22s8Pz5KHxcgEVALBtjJXBSSEOwFhk1Zgy4hitCT4hVw+gFs8/zwxqIBbUgyK7fcyA0PD9XX4iVxhiC0xdof6STWCsoBmKF7+cVCWFXQYyBMxRpf+STX1b0x45AhN0OMSrOGEirhrY/dfQAdjvS7oy+WCF6r1RIFxXWvlTRg1YVqFWBmxZbD99ig9pt0YPQw9rD1nstVri9V+/Ve3XrS/wfim4P5fIFxLoAAAAASUVORK5CYII=",Kr=class{constructor(e,t){this.config=t,t.pathPrefix||(t.pathPrefix=""),t.app||(t.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),t.webglConfig||(t.webglConfig={alpha:!0}),this.htmlCanvas=e,this.context=new xt(e,t.webglConfig),this.renderer=new Ei(e,this.context),this.gl=this.context.gl,this.assetManager=new pi(this.context,t.pathPrefix),this.input=new Rs(e),t.app.loadAssets&&t.app.loadAssets(this);let s=()=>{this.disposed||(requestAnimationFrame(s),this.time.update(),t.app.update&&t.app.update(this,this.time.delta),t.app.render&&t.app.render(this))},i=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?t.app.error&&t.app.error(this,this.assetManager.getErrors()):(t.app.initialize&&t.app.initialize(this),s());return}requestAnimationFrame(i)}};requestAnimationFrame(i)}context;time=new Me;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(e,t,s,i){this.gl.clearColor(e,t,s,i),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}};return Zi(zs)})();
|