@esotericsoftware/spine-webgl 4.1.53 → 4.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";var spine=(()=>{var ft=Object.defineProperty,Ys=Object.getOwnPropertyDescriptor,Ms=Object.getOwnPropertyNames,Es=Object.prototype.hasOwnProperty,ks=(e,t,i)=>t in e?ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Rs=(e,t)=>{for(var i in t)ft(e,i,{get:t[i],enumerable:!0})},Fs=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ms(t))!Es.call(e,n)&&n!==i&&ft(e,n,{get:()=>t[n],enumerable:!(s=Ys(t,n))||s.enumerable});return e},Xs=e=>Fs(ft({},"__esModule",{value:!0}),e),P=(e,t,i)=>(ks(e,typeof t!="symbol"?t+"":t,i),i),Pi={};Rs(Pi,{AlphaTimeline:()=>$t,Animation:()=>mt,AnimationState:()=>Gi,AnimationStateAdapter:()=>Os,AnimationStateData:()=>Vs,AssetManager:()=>cs,AssetManagerBase:()=>is,AtlasAttachmentLoader:()=>zs,Attachment:()=>Nt,AttachmentTimeline:()=>We,BinaryInput:()=>os,BlendMode:()=>Yt,Bone:()=>gi,BoneData:()=>mi,BoundingBoxAttachment:()=>pt,CURRENT:()=>Ki,CameraController:()=>gr,ClippingAttachment:()=>ot,Color:()=>D,Color2Attribute:()=>us,ColorAttribute:()=>Rt,ConstraintData:()=>At,CurveTimeline:()=>Ie,CurveTimeline1:()=>Ye,CurveTimeline2:()=>gt,DebugUtils:()=>Ps,DeformTimeline:()=>ii,Downloader:()=>xi,DrawOrderTimeline:()=>qe,Event:()=>wi,EventData:()=>bi,EventQueue:()=>ji,EventTimeline:()=>lt,EventType:()=>ve,FIRST:()=>oi,FakeTexture:()=>Ns,GLTexture:()=>ht,HOLD_FIRST:()=>bt,HOLD_MIX:()=>Zi,HOLD_SUBSEQUENT:()=>hi,IkConstraint:()=>ss,IkConstraintData:()=>pi,IkConstraintTimeline:()=>si,Input:()=>Yi,IntSet:()=>Ls,Interpolation:()=>Di,LoadingScreen:()=>vr,M00:()=>O,M01:()=>q,M02:()=>G,M03:()=>V,M10:()=>H,M11:()=>N,M12:()=>j,M13:()=>U,M20:()=>Z,M21:()=>K,M22:()=>z,M23:()=>_,M30:()=>Q,M31:()=>$,M32:()=>ee,M33:()=>J,ManagedWebGLRenderingContext:()=>we,MathUtils:()=>F,Matrix4:()=>Pe,Mesh:()=>Mi,MeshAttachment:()=>Ve,MixBlend:()=>zi,MixDirection:()=>_i,OrthoCamera:()=>ds,PathAttachment:()=>Ge,PathConstraint:()=>Qe,PathConstraintData:()=>vi,PathConstraintMixTimeline:()=>li,PathConstraintPositionTimeline:()=>ni,PathConstraintSpacingTimeline:()=>ai,PointAttachment:()=>ui,PolygonBatcher:()=>et,Pool:()=>nt,Position2Attribute:()=>kt,Position3Attribute:()=>xr,PositionMode:()=>Ct,Pow:()=>Oi,PowOut:()=>Bs,RGB2Timeline:()=>ti,RGBA2Timeline:()=>ei,RGBATimeline:()=>Jt,RGBTimeline:()=>Qt,RegionAttachment:()=>ae,ResizeMode:()=>Bt,RotateMode:()=>Tt,RotateTimeline:()=>at,SETUP:()=>ci,SUBSEQUENT:()=>wt,ScaleTimeline:()=>qt,ScaleXTimeline:()=>Gt,ScaleYTimeline:()=>Ht,SceneRenderer:()=>bs,SequenceTimeline:()=>Je,Shader:()=>ge,ShapeRenderer:()=>ki,ShapeType:()=>pe,ShearTimeline:()=>jt,ShearXTimeline:()=>Zt,ShearYTimeline:()=>Kt,Skeleton:()=>ls,SkeletonBinary:()=>_s,SkeletonBounds:()=>hs,SkeletonClipping:()=>Mt,SkeletonData:()=>yi,SkeletonDebugRenderer:()=>Ft,SkeletonJson:()=>ur,SkeletonRenderer:()=>Fi,Skin:()=>It,SkinEntry:()=>Ai,Slot:()=>rs,SlotData:()=>Ci,SpacingMode:()=>St,SpineCanvas:()=>Cr,StringSet:()=>Ot,TexCoordAttribute:()=>Ei,Texture:()=>di,TextureAtlas:()=>$i,TextureAtlasPage:()=>es,TextureAtlasRegion:()=>fi,TextureFilter:()=>vt,TextureRegion:()=>Qi,TextureWrap:()=>Ji,TimeKeeper:()=>Vt,Timeline:()=>me,Touch:()=>fs,TrackEntry:()=>Hi,TransformConstraint:()=>ns,TransformConstraintData:()=>Si,TransformConstraintTimeline:()=>ri,TransformMode:()=>yt,TranslateTimeline:()=>zt,TranslateXTimeline:()=>_t,TranslateYTimeline:()=>Wt,Triangulator:()=>ye,Utils:()=>B,Vector2:()=>_e,Vector3:()=>Ae,VertexAttachment:()=>Te,VertexAttribute:()=>$e,VertexAttributeType:()=>He,WindowedMean:()=>Ds});var Ls=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}},Ot=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var i=0,s=e.length;i<s;i++)this.add(e[i]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},ze=class{constructor(e=0,t=0,i=0,s=0){this.r=e,this.g=t,this.b=i,this.a=s}set(e,t,i,s){return this.r=e,this.g=t,this.b=i,this.a=s,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,i,s){return this.r+=e,this.g+=t,this.b+=i,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}static fromString(e){return new ze().setFromString(e)}},D=ze;P(D,"WHITE",new ze(1,1,1,1)),P(D,"RED",new ze(1,0,0,1)),P(D,"GREEN",new ze(0,1,0,1)),P(D,"BLUE",new ze(0,0,1,1)),P(D,"MAGENTA",new ze(1,0,1,1));var Xe=class{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*Xe.degRad)}static sinDeg(e){return Math.sin(e*Xe.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 Xe.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}},F=Xe;P(F,"PI",3.1415927),P(F,"PI2",Xe.PI*2),P(F,"radiansToDegrees",180/Xe.PI),P(F,"radDeg",Xe.radiansToDegrees),P(F,"degreesToRadians",Xe.PI/180),P(F,"degRad",Xe.degreesToRadians);var Di=class{apply(e,t,i){return e+(t-e)*this.applyInternal(i)}},Oi=class extends Di{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}},Bs=class extends Oi{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},Ke=class{static arrayCopy(e,t,i,s,n){for(let c=t,l=s;c<t+n;c++,l++)i[l]=e[c]}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:Ke.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(Ke.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(Ke.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 Ke.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Ke.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)]}},B=Ke;P(B,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");var Ps=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}},_e=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}},Vt=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)}},Ds=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}},Nt=class{name;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}},Vi=class extends Nt{id=Vi.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,t,i,s,n,c){i=n+(i>>1)*c;let l=e.bone.skeleton,r=e.deform,o=this.vertices,a=this.bones;if(!a){r.length>0&&(o=r);let u=e.bone,m=u.worldX,g=u.worldY,p=u.a,v=u.b,x=u.c,w=u.d;for(let b=t,y=n;y<i;b+=2,y+=c){let C=o[b],A=o[b+1];s[y]=C*p+A*v+m,s[y+1]=C*x+A*w+g}return}let h=0,d=0;for(let u=0;u<t;u+=2){let m=a[h];h+=m+1,d+=m}let f=l.bones;if(r.length==0)for(let u=n,m=d*3;u<i;u+=c){let g=0,p=0,v=a[h++];for(v+=h;h<v;h++,m+=3){let x=f[a[h]],w=o[m],b=o[m+1],y=o[m+2];g+=(w*x.a+b*x.b+x.worldX)*y,p+=(w*x.c+b*x.d+x.worldY)*y}s[u]=g,s[u+1]=p}else{let u=r;for(let m=n,g=d*3,p=d<<1;m<i;m+=c){let v=0,x=0,w=a[h++];for(w+=h;h<w;h++,g+=3,p+=2){let b=f[a[h]],y=o[g]+u[p],C=o[g+1]+u[p+1],A=o[g+2];v+=(y*b.a+C*b.b+b.worldX)*A,x+=(y*b.c+C*b.d+b.worldY)*A}s[m]=v,s[m+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},Te=Vi;P(Te,"nextID",0);var ut=class{id=ut.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new ut(this.regions.length);return B.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 ut._nextID++}},Ut=ut;P(Ut,"_nextID",0);var Ni=(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))(Ni||{}),Ui=[0,1,2,3,4,5,6],mt=class{name;timelines=[];timelineIds=new Ot;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,c,l,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 a=0,h=o.length;a<h;a++)o[a].apply(e,t,i,n,c,l,r)}},zi=(e=>(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(zi||{}),_i=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(_i||{}),de={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19},me=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=B.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}},Ie=class extends me{curves;constructor(e,t,i){super(e,i),this.curves=B.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=B.newFloatArray(t);B.arrayCopy(this.curves,0,i,0,t),this.curves=i}}setBezier(e,t,i,s,n,c,l,r,o,a,h){let d=this.curves,f=this.getFrameCount()+e*18;i==0&&(d[t]=2+f);let u=(s-c*2+r)*.03,m=(n-l*2+o)*.03,g=((c-r)*3-s+a)*.006,p=((l-o)*3-n+h)*.006,v=u*2+g,x=m*2+p,w=(c-s)*.3+u+g*.16666667,b=(l-n)*.3+m+p*.16666667,y=s+w,C=n+b;for(let A=f+18;f<A;f+=2)d[f]=y,d[f+1]=C,w+=v,b+=x,v+=g,x+=p,y+=w,C+=b}getBezierValue(e,t,i,s){let n=this.curves;if(n[s]>e){let o=this.frames[t],a=this.frames[t+i];return a+(e-o)/(n[s]-o)*(n[s+1]-a)}let c=s+18;for(s+=2;s<c;s+=2)if(n[s]>=e){let o=n[s-2],a=n[s-1];return a+(e-o)/(n[s]-o)*(n[s+1]-a)}t+=this.getFrameEntries();let l=n[c-2],r=n[c-1];return r+(e-l)/(this.frames[t]-l)*(this.frames[t+i]-r)}},Ye=class extends Ie{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],c=t[i+1];return c+(e-n)/(t[i+2]-n)*(t[i+2+1]-c);case 1:return t[i+1]}return this.getBezierValue(e,i,1,s-2)}},gt=class extends Ie{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 Ye{boneIndex=0;constructor(e,t,i){super(e,t,de.rotate+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,c,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.rotation=r.data.rotation;return;case 1:r.rotation+=(r.data.rotation-r.rotation)*n}return}let a=this.getCurveValue(i);switch(c){case 0:r.rotation=r.data.rotation+a*n;break;case 1:case 2:a+=r.data.rotation-r.rotation;case 3:r.rotation+=a*n}}},zt=class extends gt{boneIndex=0;constructor(e,t,i){super(e,t,de.x+"|"+i,de.y+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,c,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){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 a=0,h=0,d=me.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];a=o[d+1],h=o[d+2];let m=(i-u)/(o[d+3]-u);a+=(o[d+3+1]-a)*m,h+=(o[d+3+2]-h)*m;break;case 1:a=o[d+1],h=o[d+2];break;default:a=this.getBezierValue(i,d,1,f-2),h=this.getBezierValue(i,d,2,f+18-2)}switch(c){case 0:r.x=r.data.x+a*n,r.y=r.data.y+h*n;break;case 1:case 2:r.x+=(r.data.x+a-r.x)*n,r.y+=(r.data.y+h-r.y)*n;break;case 3:r.x+=a*n,r.y+=h*n}}},_t=class extends Ye{boneIndex=0;constructor(e,t,i){super(e,t,de.x+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,c,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.x=r.data.x;return;case 1:r.x+=(r.data.x-r.x)*n}return}let a=this.getCurveValue(i);switch(c){case 0:r.x=r.data.x+a*n;break;case 1:case 2:r.x+=(r.data.x+a-r.x)*n;break;case 3:r.x+=a*n}}},Wt=class extends Ye{boneIndex=0;constructor(e,t,i){super(e,t,de.y+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,c,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.y=r.data.y;return;case 1:r.y+=(r.data.y-r.y)*n}return}let a=this.getCurveValue(i);switch(c){case 0:r.y=r.data.y+a*n;break;case 1:case 2:r.y+=(r.data.y+a-r.y)*n;break;case 3:r.y+=a*n}}},qt=class extends gt{boneIndex=0;constructor(e,t,i){super(e,t,de.scaleX+"|"+i,de.scaleY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,c,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){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 a,h,d=me.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];a=o[d+1],h=o[d+2];let m=(i-u)/(o[d+3]-u);a+=(o[d+3+1]-a)*m,h+=(o[d+3+2]-h)*m;break;case 1:a=o[d+1],h=o[d+2];break;default:a=this.getBezierValue(i,d,1,f-2),h=this.getBezierValue(i,d,2,f+18-2)}if(a*=r.data.scaleX,h*=r.data.scaleY,n==1)c==3?(r.scaleX+=a-r.data.scaleX,r.scaleY+=h-r.data.scaleY):(r.scaleX=a,r.scaleY=h);else{let u=0,m=0;if(l==1)switch(c){case 0:u=r.data.scaleX,m=r.data.scaleY,r.scaleX=u+(Math.abs(a)*F.signum(u)-u)*n,r.scaleY=m+(Math.abs(h)*F.signum(m)-m)*n;break;case 1:case 2:u=r.scaleX,m=r.scaleY,r.scaleX=u+(Math.abs(a)*F.signum(u)-u)*n,r.scaleY=m+(Math.abs(h)*F.signum(m)-m)*n;break;case 3:r.scaleX+=(a-r.data.scaleX)*n,r.scaleY+=(h-r.data.scaleY)*n}else switch(c){case 0:u=Math.abs(r.data.scaleX)*F.signum(a),m=Math.abs(r.data.scaleY)*F.signum(h),r.scaleX=u+(a-u)*n,r.scaleY=m+(h-m)*n;break;case 1:case 2:u=Math.abs(r.scaleX)*F.signum(a),m=Math.abs(r.scaleY)*F.signum(h),r.scaleX=u+(a-u)*n,r.scaleY=m+(h-m)*n;break;case 3:r.scaleX+=(a-r.data.scaleX)*n,r.scaleY+=(h-r.data.scaleY)*n}}}},Gt=class extends Ye{boneIndex=0;constructor(e,t,i){super(e,t,de.scaleX+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,c,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.scaleX=r.data.scaleX;return;case 1:r.scaleX+=(r.data.scaleX-r.scaleX)*n}return}let a=this.getCurveValue(i)*r.data.scaleX;if(n==1)c==3?r.scaleX+=a-r.data.scaleX:r.scaleX=a;else{let h=0;if(l==1)switch(c){case 0:h=r.data.scaleX,r.scaleX=h+(Math.abs(a)*F.signum(h)-h)*n;break;case 1:case 2:h=r.scaleX,r.scaleX=h+(Math.abs(a)*F.signum(h)-h)*n;break;case 3:r.scaleX+=(a-r.data.scaleX)*n}else switch(c){case 0:h=Math.abs(r.data.scaleX)*F.signum(a),r.scaleX=h+(a-h)*n;break;case 1:case 2:h=Math.abs(r.scaleX)*F.signum(a),r.scaleX=h+(a-h)*n;break;case 3:r.scaleX+=(a-r.data.scaleX)*n}}}},Ht=class extends Ye{boneIndex=0;constructor(e,t,i){super(e,t,de.scaleY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,c,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.scaleY=r.data.scaleY;return;case 1:r.scaleY+=(r.data.scaleY-r.scaleY)*n}return}let a=this.getCurveValue(i)*r.data.scaleY;if(n==1)c==3?r.scaleY+=a-r.data.scaleY:r.scaleY=a;else{let h=0;if(l==1)switch(c){case 0:h=r.data.scaleY,r.scaleY=h+(Math.abs(a)*F.signum(h)-h)*n;break;case 1:case 2:h=r.scaleY,r.scaleY=h+(Math.abs(a)*F.signum(h)-h)*n;break;case 3:r.scaleY+=(a-r.data.scaleY)*n}else switch(c){case 0:h=Math.abs(r.data.scaleY)*F.signum(a),r.scaleY=h+(a-h)*n;break;case 1:case 2:h=Math.abs(r.scaleY)*F.signum(a),r.scaleY=h+(a-h)*n;break;case 3:r.scaleY+=(a-r.data.scaleY)*n}}}},jt=class extends gt{boneIndex=0;constructor(e,t,i){super(e,t,de.shearX+"|"+i,de.shearY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,c,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){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 a=0,h=0,d=me.search(o,i,3),f=this.curves[d/3];switch(f){case 0:let u=o[d];a=o[d+1],h=o[d+2];let m=(i-u)/(o[d+3]-u);a+=(o[d+3+1]-a)*m,h+=(o[d+3+2]-h)*m;break;case 1:a=o[d+1],h=o[d+2];break;default:a=this.getBezierValue(i,d,1,f-2),h=this.getBezierValue(i,d,2,f+18-2)}switch(c){case 0:r.shearX=r.data.shearX+a*n,r.shearY=r.data.shearY+h*n;break;case 1:case 2:r.shearX+=(r.data.shearX+a-r.shearX)*n,r.shearY+=(r.data.shearY+h-r.shearY)*n;break;case 3:r.shearX+=a*n,r.shearY+=h*n}}},Zt=class extends Ye{boneIndex=0;constructor(e,t,i){super(e,t,de.shearX+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,c,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.shearX=r.data.shearX;return;case 1:r.shearX+=(r.data.shearX-r.shearX)*n}return}let a=this.getCurveValue(i);switch(c){case 0:r.shearX=r.data.shearX+a*n;break;case 1:case 2:r.shearX+=(r.data.shearX+a-r.shearX)*n;break;case 3:r.shearX+=a*n}}},Kt=class extends Ye{boneIndex=0;constructor(e,t,i){super(e,t,de.shearY+"|"+i),this.boneIndex=i}apply(e,t,i,s,n,c,l){let r=e.bones[this.boneIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.shearY=r.data.shearY;return;case 1:r.shearY+=(r.data.shearY-r.shearY)*n}return}let a=this.getCurveValue(i);switch(c){case 0:r.shearY=r.data.shearY+a*n;break;case 1:case 2:r.shearY+=(r.data.shearY+a-r.shearY)*n;break;case 3:r.shearY+=a*n}}},Jt=class extends Ie{slotIndex=0;constructor(e,t,i){super(e,t,[de.rgb+"|"+i,de.alpha+"|"+i]),this.slotIndex=i}getFrameEntries(){return 5}setFrame(e,t,i,s,n,c){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]=c}apply(e,t,i,s,n,c,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,a=r.color;if(i<o[0]){let p=r.data.color;switch(c){case 0:a.setFromColor(p);return;case 1:a.add((p.r-a.r)*n,(p.g-a.g)*n,(p.b-a.b)*n,(p.a-a.a)*n)}return}let h=0,d=0,f=0,u=0,m=me.search(o,i,5),g=this.curves[m/5];switch(g){case 0:let p=o[m];h=o[m+1],d=o[m+2],f=o[m+3],u=o[m+4];let v=(i-p)/(o[m+5]-p);h+=(o[m+5+1]-h)*v,d+=(o[m+5+2]-d)*v,f+=(o[m+5+3]-f)*v,u+=(o[m+5+4]-u)*v;break;case 1:h=o[m+1],d=o[m+2],f=o[m+3],u=o[m+4];break;default:h=this.getBezierValue(i,m,1,g-2),d=this.getBezierValue(i,m,2,g+18-2),f=this.getBezierValue(i,m,3,g+18*2-2),u=this.getBezierValue(i,m,4,g+18*3-2)}n==1?a.set(h,d,f,u):(c==0&&a.setFromColor(r.data.color),a.add((h-a.r)*n,(d-a.g)*n,(f-a.b)*n,(u-a.a)*n))}},Qt=class extends Ie{slotIndex=0;constructor(e,t,i){super(e,t,[de.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,c,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,a=r.color;if(i<o[0]){let g=r.data.color;switch(c){case 0:a.r=g.r,a.g=g.g,a.b=g.b;return;case 1:a.r+=(g.r-a.r)*n,a.g+=(g.g-a.g)*n,a.b+=(g.b-a.b)*n}return}let h=0,d=0,f=0,u=me.search(o,i,4),m=this.curves[u>>2];switch(m){case 0:let g=o[u];h=o[u+1],d=o[u+2],f=o[u+3];let p=(i-g)/(o[u+4]-g);h+=(o[u+4+1]-h)*p,d+=(o[u+4+2]-d)*p,f+=(o[u+4+3]-f)*p;break;case 1:h=o[u+1],d=o[u+2],f=o[u+3];break;default:h=this.getBezierValue(i,u,1,m-2),d=this.getBezierValue(i,u,2,m+18-2),f=this.getBezierValue(i,u,3,m+18*2-2)}if(n==1)a.r=h,a.g=d,a.b=f;else{if(c==0){let g=r.data.color;a.r=g.r,a.g=g.g,a.b=g.b}a.r+=(h-a.r)*n,a.g+=(d-a.g)*n,a.b+=(f-a.b)*n}}},$t=class extends Ye{slotIndex=0;constructor(e,t,i){super(e,t,de.alpha+"|"+i),this.slotIndex=i}apply(e,t,i,s,n,c,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.color;if(i<this.frames[0]){let h=r.data.color;switch(c){case 0:o.a=h.a;return;case 1:o.a+=(h.a-o.a)*n}return}let a=this.getCurveValue(i);n==1?o.a=a:(c==0&&(o.a=r.data.color.a),o.a+=(a-o.a)*n)}},ei=class extends Ie{slotIndex=0;constructor(e,t,i){super(e,t,[de.rgb+"|"+i,de.alpha+"|"+i,de.rgb2+"|"+i]),this.slotIndex=i}getFrameEntries(){return 8}setFrame(e,t,i,s,n,c,l,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]=c,this.frames[e+5]=l,this.frames[e+6]=r,this.frames[e+7]=o}apply(e,t,i,s,n,c,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,a=r.color,h=r.darkColor;if(i<o[0]){let b=r.data.color,y=r.data.darkColor;switch(c){case 0:a.setFromColor(b),h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:a.add((b.r-a.r)*n,(b.g-a.g)*n,(b.b-a.b)*n,(b.a-a.a)*n),h.r+=(y.r-h.r)*n,h.g+=(y.g-h.g)*n,h.b+=(y.b-h.b)*n}return}let d=0,f=0,u=0,m=0,g=0,p=0,v=0,x=me.search(o,i,8),w=this.curves[x>>3];switch(w){case 0:let b=o[x];d=o[x+1],f=o[x+2],u=o[x+3],m=o[x+4],g=o[x+5],p=o[x+6],v=o[x+7];let y=(i-b)/(o[x+8]-b);d+=(o[x+8+1]-d)*y,f+=(o[x+8+2]-f)*y,u+=(o[x+8+3]-u)*y,m+=(o[x+8+4]-m)*y,g+=(o[x+8+5]-g)*y,p+=(o[x+8+6]-p)*y,v+=(o[x+8+7]-v)*y;break;case 1:d=o[x+1],f=o[x+2],u=o[x+3],m=o[x+4],g=o[x+5],p=o[x+6],v=o[x+7];break;default:d=this.getBezierValue(i,x,1,w-2),f=this.getBezierValue(i,x,2,w+18-2),u=this.getBezierValue(i,x,3,w+18*2-2),m=this.getBezierValue(i,x,4,w+18*3-2),g=this.getBezierValue(i,x,5,w+18*4-2),p=this.getBezierValue(i,x,6,w+18*5-2),v=this.getBezierValue(i,x,7,w+18*6-2)}if(n==1)a.set(d,f,u,m),h.r=g,h.g=p,h.b=v;else{if(c==0){a.setFromColor(r.data.color);let b=r.data.darkColor;h.r=b.r,h.g=b.g,h.b=b.b}a.add((d-a.r)*n,(f-a.g)*n,(u-a.b)*n,(m-a.a)*n),h.r+=(g-h.r)*n,h.g+=(p-h.g)*n,h.b+=(v-h.b)*n}}},ti=class extends Ie{slotIndex=0;constructor(e,t,i){super(e,t,[de.rgb+"|"+i,de.rgb2+"|"+i]),this.slotIndex=i}getFrameEntries(){return 7}setFrame(e,t,i,s,n,c,l,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]=c,this.frames[e+5]=l,this.frames[e+6]=r}apply(e,t,i,s,n,c,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=this.frames,a=r.color,h=r.darkColor;if(i<o[0]){let b=r.data.color,y=r.data.darkColor;switch(c){case 0:a.r=b.r,a.g=b.g,a.b=b.b,h.r=y.r,h.g=y.g,h.b=y.b;return;case 1:a.r+=(b.r-a.r)*n,a.g+=(b.g-a.g)*n,a.b+=(b.b-a.b)*n,h.r+=(y.r-h.r)*n,h.g+=(y.g-h.g)*n,h.b+=(y.b-h.b)*n}return}let d=0,f=0,u=0,m=0,g=0,p=0,v=0,x=me.search(o,i,7),w=this.curves[x/7];switch(w){case 0:let b=o[x];d=o[x+1],f=o[x+2],u=o[x+3],g=o[x+4],p=o[x+5],v=o[x+6];let y=(i-b)/(o[x+7]-b);d+=(o[x+7+1]-d)*y,f+=(o[x+7+2]-f)*y,u+=(o[x+7+3]-u)*y,g+=(o[x+7+4]-g)*y,p+=(o[x+7+5]-p)*y,v+=(o[x+7+6]-v)*y;break;case 1:d=o[x+1],f=o[x+2],u=o[x+3],g=o[x+4],p=o[x+5],v=o[x+6];break;default:d=this.getBezierValue(i,x,1,w-2),f=this.getBezierValue(i,x,2,w+18-2),u=this.getBezierValue(i,x,3,w+18*2-2),g=this.getBezierValue(i,x,4,w+18*3-2),p=this.getBezierValue(i,x,5,w+18*4-2),v=this.getBezierValue(i,x,6,w+18*5-2)}if(n==1)a.r=d,a.g=f,a.b=u,h.r=g,h.g=p,h.b=v;else{if(c==0){let b=r.data.color,y=r.data.darkColor;a.r=b.r,a.g=b.g,a.b=b.b,h.r=y.r,h.g=y.g,h.b=y.b}a.r+=(d-a.r)*n,a.g+=(f-a.g)*n,a.b+=(u-a.b)*n,h.r+=(g-h.r)*n,h.g+=(p-h.g)*n,h.b+=(v-h.b)*n}}},We=class extends me{slotIndex=0;attachmentNames;constructor(e,t){super(e,[de.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,c,l){let r=e.slots[this.slotIndex];if(r.bone.active){if(l==1){c==0&&this.setAttachment(e,r,r.data.attachmentName);return}if(i<this.frames[0]){(c==0||c==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)}},ii=class extends Ie{slotIndex=0;attachment;vertices;constructor(e,t,i,s){super(e,t,[de.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,c,l,r,o,a,h){let d=this.curves,f=this.getFrameCount()+e*18;i==0&&(d[t]=2+f);let u=(s-c*2+r)*.03,m=o*.03-l*.06,g=((c-r)*3-s+a)*.006,p=(l-o+.33333333)*.018,v=u*2+g,x=m*2+p,w=(c-s)*.3+u+g*.16666667,b=l*.3+m+p*.16666667,y=s+w,C=b;for(let A=f+18;f<A;f+=2)d[f]=y,d[f+1]=C,w+=v,b+=x,v+=g,x+=p,y+=w,C+=b}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 c=i[n-2],l=i[n-1];return l+(1-l)*(e-c)/(this.frames[t+this.getFrameEntries()]-c)}apply(e,t,i,s,n,c,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.getAttachment();if(!o||!(o instanceof Te)||o.timelineAttachment!=this.attachment)return;let a=r.deform;a.length==0&&(c=0);let h=this.vertices,d=h[0].length,f=this.frames;if(i<f[0]){switch(c){case 0:a.length=0;return;case 1:if(n==1){a.length=0;return}a.length=d;let x=o;if(x.bones){n=1-n;for(var u=0;u<d;u++)a[u]*=n}else{let w=x.vertices;for(var u=0;u<d;u++)a[u]+=(w[u]-a[u])*n}}return}if(a.length=d,i>=f[f.length-1]){let x=h[f.length-1];if(n==1)if(c==3){let w=o;if(w.bones)for(let b=0;b<d;b++)a[b]+=x[b];else{let b=w.vertices;for(let y=0;y<d;y++)a[y]+=x[y]-b[y]}}else B.arrayCopy(x,0,a,0,d);else switch(c){case 0:{let b=o;if(b.bones)for(let y=0;y<d;y++)a[y]=x[y]*n;else{let y=b.vertices;for(let C=0;C<d;C++){let A=y[C];a[C]=A+(x[C]-A)*n}}break}case 1:case 2:for(let b=0;b<d;b++)a[b]+=(x[b]-a[b])*n;break;case 3:let w=o;if(w.bones)for(let b=0;b<d;b++)a[b]+=x[b]*n;else{let b=w.vertices;for(let y=0;y<d;y++)a[y]+=(x[y]-b[y])*n}}return}let m=me.search1(f,i),g=this.getCurvePercent(i,m),p=h[m],v=h[m+1];if(n==1)if(c==3){let x=o;if(x.bones)for(let w=0;w<d;w++){let b=p[w];a[w]+=b+(v[w]-b)*g}else{let w=x.vertices;for(let b=0;b<d;b++){let y=p[b];a[b]+=y+(v[b]-y)*g-w[b]}}}else for(let x=0;x<d;x++){let w=p[x];a[x]=w+(v[x]-w)*g}else switch(c){case 0:{let w=o;if(w.bones)for(let b=0;b<d;b++){let y=p[b];a[b]=(y+(v[b]-y)*g)*n}else{let b=w.vertices;for(let y=0;y<d;y++){let C=p[y],A=b[y];a[y]=A+(C+(v[y]-C)*g-A)*n}}break}case 1:case 2:for(let w=0;w<d;w++){let b=p[w];a[w]+=(b+(v[w]-b)*g-a[w])*n}break;case 3:let x=o;if(x.bones)for(let w=0;w<d;w++){let b=p[w];a[w]+=(b+(v[w]-b)*g)*n}else{let w=x.vertices;for(let b=0;b<d;b++){let y=p[b];a[b]+=(y+(v[b]-y)*g-w[b])*n}}}}},Wi=class extends me{events;constructor(e){super(e,Wi.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,c,l){if(!s)return;let r=this.frames,o=this.frames.length;if(t>i)this.apply(e,t,Number.MAX_VALUE,s,n,c,l),t=-1;else if(t>=r[o-1])return;if(i<r[0])return;let a=0;if(t<r[0])a=0;else{a=me.search1(r,t)+1;let h=r[a];for(;a>0&&r[a-1]==h;)a--}for(;a<o&&i>=r[a];a++)s.push(this.events[a])}},lt=Wi;P(lt,"propertyIds",[""+de.event]);var qi=class extends me{drawOrders;constructor(e){super(e,qi.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,c,l){if(l==1){c==0&&B.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(i<this.frames[0]){(c==0||c==1)&&B.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let r=me.search1(this.frames,i),o=this.drawOrders[r];if(!o)B.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let a=e.drawOrder,h=e.slots;for(let d=0,f=o.length;d<f;d++)a[d]=h[o[d]]}}},qe=qi;P(qe,"propertyIds",[""+de.drawOrder]);var si=class extends Ie{ikConstraintIndex=0;constructor(e,t,i){super(e,t,[de.ikConstraint+"|"+i]),this.ikConstraintIndex=i}getFrameEntries(){return 6}setFrame(e,t,i,s,n,c,l){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]=c?1:0,this.frames[e+5]=l?1:0}apply(e,t,i,s,n,c,l){let r=e.ikConstraints[this.ikConstraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){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 a=0,h=0,d=me.search(o,i,6),f=this.curves[d/6];switch(f){case 0:let u=o[d];a=o[d+1],h=o[d+2];let m=(i-u)/(o[d+6]-u);a+=(o[d+6+1]-a)*m,h+=(o[d+6+2]-h)*m;break;case 1:a=o[d+1],h=o[d+2];break;default:a=this.getBezierValue(i,d,1,f-2),h=this.getBezierValue(i,d,2,f+18-2)}c==0?(r.mix=r.data.mix+(a-r.data.mix)*n,r.softness=r.data.softness+(h-r.data.softness)*n,l==1?(r.bendDirection=r.data.bendDirection,r.compress=r.data.compress,r.stretch=r.data.stretch):(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0)):(r.mix+=(a-r.mix)*n,r.softness+=(h-r.softness)*n,l==0&&(r.bendDirection=o[d+3],r.compress=o[d+4]!=0,r.stretch=o[d+5]!=0))}},ri=class extends Ie{transformConstraintIndex=0;constructor(e,t,i){super(e,t,[de.transformConstraint+"|"+i]),this.transformConstraintIndex=i}getFrameEntries(){return 7}setFrame(e,t,i,s,n,c,l,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]=c,o[e+5]=l,o[e+6]=r}apply(e,t,i,s,n,c,l){let r=e.transformConstraints[this.transformConstraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){let v=r.data;switch(c){case 0:r.mixRotate=v.mixRotate,r.mixX=v.mixX,r.mixY=v.mixY,r.mixScaleX=v.mixScaleX,r.mixScaleY=v.mixScaleY,r.mixShearY=v.mixShearY;return;case 1:r.mixRotate+=(v.mixRotate-r.mixRotate)*n,r.mixX+=(v.mixX-r.mixX)*n,r.mixY+=(v.mixY-r.mixY)*n,r.mixScaleX+=(v.mixScaleX-r.mixScaleX)*n,r.mixScaleY+=(v.mixScaleY-r.mixScaleY)*n,r.mixShearY+=(v.mixShearY-r.mixShearY)*n}return}let a,h,d,f,u,m,g=me.search(o,i,7),p=this.curves[g/7];switch(p){case 0:let v=o[g];a=o[g+1],h=o[g+2],d=o[g+3],f=o[g+4],u=o[g+5],m=o[g+6];let x=(i-v)/(o[g+7]-v);a+=(o[g+7+1]-a)*x,h+=(o[g+7+2]-h)*x,d+=(o[g+7+3]-d)*x,f+=(o[g+7+4]-f)*x,u+=(o[g+7+5]-u)*x,m+=(o[g+7+6]-m)*x;break;case 1:a=o[g+1],h=o[g+2],d=o[g+3],f=o[g+4],u=o[g+5],m=o[g+6];break;default:a=this.getBezierValue(i,g,1,p-2),h=this.getBezierValue(i,g,2,p+18-2),d=this.getBezierValue(i,g,3,p+18*2-2),f=this.getBezierValue(i,g,4,p+18*3-2),u=this.getBezierValue(i,g,5,p+18*4-2),m=this.getBezierValue(i,g,6,p+18*5-2)}if(c==0){let v=r.data;r.mixRotate=v.mixRotate+(a-v.mixRotate)*n,r.mixX=v.mixX+(h-v.mixX)*n,r.mixY=v.mixY+(d-v.mixY)*n,r.mixScaleX=v.mixScaleX+(f-v.mixScaleX)*n,r.mixScaleY=v.mixScaleY+(u-v.mixScaleY)*n,r.mixShearY=v.mixShearY+(m-v.mixShearY)*n}else r.mixRotate+=(a-r.mixRotate)*n,r.mixX+=(h-r.mixX)*n,r.mixY+=(d-r.mixY)*n,r.mixScaleX+=(f-r.mixScaleX)*n,r.mixScaleY+=(u-r.mixScaleY)*n,r.mixShearY+=(m-r.mixShearY)*n}},ni=class extends Ye{pathConstraintIndex=0;constructor(e,t,i){super(e,t,de.pathConstraintPosition+"|"+i),this.pathConstraintIndex=i}apply(e,t,i,s,n,c,l){let r=e.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.position=r.data.position;return;case 1:r.position+=(r.data.position-r.position)*n}return}let a=this.getCurveValue(i);c==0?r.position=r.data.position+(a-r.data.position)*n:r.position+=(a-r.position)*n}},ai=class extends Ye{pathConstraintIndex=0;constructor(e,t,i){super(e,t,de.pathConstraintSpacing+"|"+i),this.pathConstraintIndex=i}apply(e,t,i,s,n,c,l){let r=e.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){case 0:r.spacing=r.data.spacing;return;case 1:r.spacing+=(r.data.spacing-r.spacing)*n}return}let a=this.getCurveValue(i);c==0?r.spacing=r.data.spacing+(a-r.data.spacing)*n:r.spacing+=(a-r.spacing)*n}},li=class extends Ie{pathConstraintIndex=0;constructor(e,t,i){super(e,t,[de.pathConstraintMix+"|"+i]),this.pathConstraintIndex=i}getFrameEntries(){return 4}setFrame(e,t,i,s,n){let c=this.frames;e<<=2,c[e]=t,c[e+1]=i,c[e+2]=s,c[e+3]=n}apply(e,t,i,s,n,c,l){let r=e.pathConstraints[this.pathConstraintIndex];if(!r.active)return;let o=this.frames;if(i<o[0]){switch(c){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 a,h,d,f=me.search(o,i,4),u=this.curves[f>>2];switch(u){case 0:let m=o[f];a=o[f+1],h=o[f+2],d=o[f+3];let g=(i-m)/(o[f+4]-m);a+=(o[f+4+1]-a)*g,h+=(o[f+4+2]-h)*g,d+=(o[f+4+3]-d)*g;break;case 1:a=o[f+1],h=o[f+2],d=o[f+3];break;default:a=this.getBezierValue(i,f,1,u-2),h=this.getBezierValue(i,f,2,u+18-2),d=this.getBezierValue(i,f,3,u+18*2-2)}if(c==0){let m=r.data;r.mixRotate=m.mixRotate+(a-m.mixRotate)*n,r.mixX=m.mixX+(h-m.mixX)*n,r.mixY=m.mixY+(d-m.mixY)*n}else r.mixRotate+=(a-r.mixRotate)*n,r.mixX+=(h-r.mixX)*n,r.mixY+=(d-r.mixY)*n}},Oe=class extends me{slotIndex;attachment;constructor(e,t,i){super(e,[de.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 c=this.frames;e*=Oe.ENTRIES,c[e]=t,c[e+Oe.MODE]=i|s<<4,c[e+Oe.DELAY]=n}apply(e,t,i,s,n,c,l){let r=e.slots[this.slotIndex];if(!r.bone.active)return;let o=r.attachment,a=this.attachment;if(o!=a&&(!(o instanceof Te)||o.timelineAttachment!=a))return;let h=this.frames;if(i<h[0]){(c==0||c==1)&&(r.sequenceIndex=-1);return}let d=me.search(h,i,Oe.ENTRIES),f=h[d],u=h[d+Oe.MODE],m=h[d+Oe.DELAY];if(!this.attachment.sequence)return;let g=u>>4,p=this.attachment.sequence.regions.length,v=Ui[u&15];if(v!=0)switch(g+=(i-f)/m+1e-5|0,v){case 1:g=Math.min(p-1,g);break;case 2:g%=p;break;case 3:{let x=(p<<1)-2;g=x==0?0:g%x,g>=p&&(g=x-g);break}case 4:g=Math.max(p-1-g,0);break;case 5:g=p-1-g%p;break;case 6:{let x=(p<<1)-2;g=x==0?0:(g+p-1)%x,g>=p&&(g=x-g)}}r.sequenceIndex=g}},Je=Oe;P(Je,"ENTRIES",3),P(Je,"MODE",1),P(Je,"DELAY",2);var xt=class{static emptyAnimation(){return xt._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new ji(this);propertyIDs=new Ot;animationsChanged=!1;trackEntryPool=new nt(()=>new Hi);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 c=e*n.timeScale;if(n.delay>0){if(n.delay-=c,n.delay>0)continue;c=-n.delay,n.delay=0}let l=n.next;if(l){let r=n.trackLast-l.delay;if(r>=0){for(l.delay=0,l.trackTime+=n.timeScale==0?0:(r/n.timeScale+e)*l.timeScale,n.trackTime+=c,this.setCurrent(i,l,!0);l.mixingFrom;)l.mixTime+=e,l=l.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+=c}this.queue.drain()}updateMixingFrom(e,t){let i=e.mixingFrom;if(!i)return!0;let s=this.updateMixingFrom(i,t);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),s):(i.trackTime+=t*i.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,i=this.tracks,s=!1;for(let d=0,f=i.length;d<f;d++){let u=i[d];if(!u||u.delay>0)continue;s=!0;let m=d==0?1:u.mixBlend,g=u.alpha;u.mixingFrom?g*=this.applyMixingFrom(u,e,m):u.trackTime>=u.trackEnd&&!u.next&&(g=0);let p=u.animationLast,v=u.getAnimationTime(),x=v,w=t;u.reverse&&(x=u.animation.duration-x,w=null);let b=u.animation.timelines,y=b.length;if(d==0&&g==1||m==3)for(let C=0;C<y;C++){B.webkit602BugfixHelper(g,m);var n=b[C];n instanceof We?this.applyAttachmentTimeline(n,e,x,m,!0):n.apply(e,p,x,w,g,m,0)}else{let C=u.timelineMode,A=u.shortestRotation,T=!A&&u.timelinesRotation.length!=y<<1;T&&(u.timelinesRotation.length=y<<1);for(let E=0;E<y;E++){let R=b[E],L=C[E]==wt?m:0;!A&&R instanceof at?this.applyRotateTimeline(R,e,x,g,L,u.timelinesRotation,E<<1,T):R instanceof We?this.applyAttachmentTimeline(R,e,x,m,!0):(B.webkit602BugfixHelper(g,m),R.apply(e,p,x,w,g,L,0))}}this.queueEvents(u,v),t.length=0,u.nextAnimationLast=v,u.nextTrackLast=u.trackTime}for(var c=this.unkeyedState+ci,l=e.slots,r=0,o=e.slots.length;r<o;r++){var a=l[r];if(a.attachmentState==c){var h=a.data.attachmentName;a.setAttachment(h?e.getAttachment(a.data.index,h):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 c=n<s.attachmentThreshold,l=n<s.drawOrderThreshold,r=s.animation.timelines,o=r.length,a=s.alpha*e.interruptAlpha,h=a*(1-n),d=s.animationLast,f=s.getAnimationTime(),u=f,m=null;if(s.reverse?u=s.animation.duration-u:n<s.eventThreshold&&(m=this.events),i==3)for(let g=0;g<o;g++)r[g].apply(t,d,u,m,h,i,1);else{let g=s.timelineMode,p=s.timelineHoldMix,v=s.shortestRotation,x=!v&&s.timelinesRotation.length!=o<<1;x&&(s.timelinesRotation.length=o<<1),s.totalAlpha=0;for(let w=0;w<o;w++){let b=r[w],y=1,C,A=0;switch(g[w]){case wt:if(!l&&b instanceof qe)continue;C=i,A=h;break;case oi:C=0,A=h;break;case hi:C=i,A=a;break;case bt:C=0,A=a;break;default:C=0;let T=p[w];A=a*Math.max(0,1-T.mixTime/T.mixDuration);break}s.totalAlpha+=A,!v&&b instanceof at?this.applyRotateTimeline(b,t,u,A,C,s.timelinesRotation,w<<1,x):b instanceof We?this.applyAttachmentTimeline(b,t,u,C,c):(B.webkit602BugfixHelper(A,i),l&&b instanceof qe&&C==0&&(y=0),b.apply(t,d,u,m,A,C,y))}}return e.mixDuration>0&&this.queueEvents(s,f),this.events.length=0,s.nextAnimationLast=f,s.nextTrackLast=s.trackTime,n}applyAttachmentTimeline(e,t,i,s,n){var c=t.slots[e.slotIndex];c.bone.active&&(i<e.frames[0]?(s==0||s==1)&&this.setAttachment(t,c,c.data.attachmentName,n):this.setAttachment(t,c,e.attachmentNames[me.search1(e.frames,i)],n),c.attachmentState<=this.unkeyedState&&(c.attachmentState=this.unkeyedState+ci))}setAttachment(e,t,i,s){t.setAttachment(i?e.getAttachment(t.data.index,i):null),s&&(t.attachmentState=this.unkeyedState+Ki)}applyRotateTimeline(e,t,i,s,n,c,l,r){if(r&&(c[l]=0),s==1){e.apply(t,0,i,null,1,n,0);return}let o=t.bones[e.boneIndex];if(!o.active)return;let a=e.frames,h=0,d=0;if(i<a[0])switch(n){case 0:o.rotation=o.data.rotation;default:return;case 1:h=o.rotation,d=o.data.rotation}else h=n==0?o.data.rotation:o.rotation,d=o.data.rotation+e.getCurveValue(i);let f=0,u=d-h;if(u-=(16384-(16384.499999999996-u/360|0))*360,u==0)f=c[l];else{let m=0,g=0;r?(m=0,g=u):(m=c[l],g=c[l+1]);let p=u>0,v=m>=0;F.signum(g)!=F.signum(u)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*F.signum(m)),v=p),f=u+m-m%360,v!=p&&(f+=360*F.signum(m)),c[l]=f}c[l+1]=u,o.rotation=h+f*s}queueEvents(e,t){let i=e.animationStart,s=e.animationEnd,n=s-i,c=e.trackLast%n,l=this.events,r=0,o=l.length;for(;r<o;r++){let h=l[r];if(h.time<c)break;h.time>s||this.queue.event(e,h)}let a=!1;for(e.loop?a=n==0||c>e.trackTime%n:a=t>=s&&e.animationLast<s,a&&this.queue.complete(e);r<o;r++){let h=l[r];h.time<i||this.queue.event(e,h)}}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 c=this.trackEntry(e,t,i,n);return this.setCurrent(e,c,s),this.queue.drain(),c}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 c=this.trackEntry(e,t,i,n);return n?(n.next=c,c.previous=n,s<=0&&(s+=n.getTrackComplete()-c.mixDuration)):(this.setCurrent(e,c,!0),this.queue.drain()),c.delay=s,c}setEmptyAnimation(e,t=0){let i=this.setAnimationWith(e,xt.emptyAnimation(),!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){let s=this.addAnimationWith(e,xt.emptyAnimation(),!1,i);return i<=0&&(s.delay+=s.mixDuration-t),s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,s=this.tracks.length;i<s;i++){let n=this.tracks[i];n&&this.setEmptyAnimation(n.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(B.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.attachmentThreshold=0,n.drawOrderThreshold=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 c=e.timelineHoldMix;c.length=0;let l=this.propertyIDs;if(t&&t.holdPrevious){for(let r=0;r<s;r++)n[r]=l.addAll(i[r].getPropertyIds())?bt:hi;return}e:for(let r=0;r<s;r++){let o=i[r],a=o.getPropertyIds();if(!l.addAll(a))n[r]=wt;else if(!t||o instanceof We||o instanceof qe||o instanceof lt||!t.animation.hasTimeline(a))n[r]=oi;else{for(let h=t.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(a)){if(e.mixDuration>0){n[r]=Zi,c[r]=h;continue e}break}n[r]=bt}}}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()}},Gi=xt;P(Gi,"_emptyAnimation",new mt("<empty>",[],0));var Hi=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;attachmentThreshold=0;drawOrderThreshold=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;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}},ji=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(ve.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ve.interrupt),this.objects.push(e)}end(e){this.objects.push(ve.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ve.dispose),this.objects.push(e)}complete(e){this.objects.push(ve.complete),this.objects.push(e)}event(e,t){this.objects.push(ve.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 ve.start:n.listener&&n.listener.start&&n.listener.start(n);for(let l=0;l<t.length;l++){let r=t[l];r.start&&r.start(n)}break;case ve.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let l=0;l<t.length;l++){let r=t[l];r.interrupt&&r.interrupt(n)}break;case ve.end:n.listener&&n.listener.end&&n.listener.end(n);for(let l=0;l<t.length;l++){let r=t[l];r.end&&r.end(n)}case ve.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let l=0;l<t.length;l++){let r=t[l];r.dispose&&r.dispose(n)}this.animState.trackEntryPool.free(n);break;case ve.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let l=0;l<t.length;l++){let r=t[l];r.complete&&r.complete(n)}break;case ve.event:let c=e[i+++2];n.listener&&n.listener.event&&n.listener.event(n,c);for(let l=0;l<t.length;l++){let r=t[l];r.event&&r.event(n,c)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ve=(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))(ve||{}),Os=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},wt=0,oi=1,hi=2,bt=3,Zi=4,ci=1,Ki=2,Vs=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}},pt=class extends Te{color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new pt(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},ot=class extends Te{endSlot=null;color=new D(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new ot(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},di=class{_image;constructor(e){this._image=e}getImage(){return this._image}},vt=(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))(vt||{}),Ji=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(Ji||{}),Qi=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Ns=class extends di{setFilters(e,t){}setWraps(e,t){}dispose(){}},$i=class{pages=new Array;regions=new Array;constructor(e){let t=new Us(e),i=new Array(4),s={};s.size=a=>{a.width=parseInt(i[1]),a.height=parseInt(i[2])},s.format=()=>{},s.filter=a=>{a.minFilter=B.enumValue(vt,i[1]),a.magFilter=B.enumValue(vt,i[2])},s.repeat=a=>{i[1].indexOf("x")!=-1&&(a.uWrap=10497),i[1].indexOf("y")!=-1&&(a.vWrap=10497)},s.pma=a=>{a.pma=i[1]=="true"};var n={};n.xy=a=>{a.x=parseInt(i[1]),a.y=parseInt(i[2])},n.size=a=>{a.width=parseInt(i[1]),a.height=parseInt(i[2])},n.bounds=a=>{a.x=parseInt(i[1]),a.y=parseInt(i[2]),a.width=parseInt(i[3]),a.height=parseInt(i[4])},n.offset=a=>{a.offsetX=parseInt(i[1]),a.offsetY=parseInt(i[2])},n.orig=a=>{a.originalWidth=parseInt(i[1]),a.originalHeight=parseInt(i[2])},n.offsets=a=>{a.offsetX=parseInt(i[1]),a.offsetY=parseInt(i[2]),a.originalWidth=parseInt(i[3]),a.originalHeight=parseInt(i[4])},n.rotate=a=>{let h=i[1];h=="true"?a.degrees=90:h!="false"&&(a.degrees=parseInt(h))},n.index=a=>{a.index=parseInt(i[1])};let c=t.readLine();for(;c&&c.trim().length==0;)c=t.readLine();for(;!(!c||c.trim().length==0||t.readEntry(i,c)==0);)c=t.readLine();let l=null,r=null,o=null;for(;c!==null;)if(c.trim().length==0)l=null,c=t.readLine();else if(l){let a=new fi(l,c);for(;;){let h=t.readEntry(i,c=t.readLine());if(h==0)break;let d=n[i[0]];if(d)d(a);else{r||(r=[]),o||(o=[]),r.push(i[0]);let f=[];for(let u=0;u<h;u++)f.push(parseInt(i[u+1]));o.push(f)}}a.originalWidth==0&&a.originalHeight==0&&(a.originalWidth=a.width,a.originalHeight=a.height),r&&r.length>0&&o&&o.length>0&&(a.names=r,a.values=o,r=null,o=null),a.u=a.x/l.width,a.v=a.y/l.height,a.degrees==90?(a.u2=(a.x+a.height)/l.width,a.v2=(a.y+a.width)/l.height):(a.u2=(a.x+a.width)/l.width,a.v2=(a.y+a.height)/l.height),this.regions.push(a)}else{for(l=new es(c.trim());t.readEntry(i,c=t.readLine())!=0;){let a=s[i[0]];a&&a(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 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()}},Us=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 c=t.indexOf(",",n);if(c==-1)return e[s]=t.substr(n).trim(),s;if(e[s]=t.substr(n,c-n).trim(),n=c+1,s==4)return 4}}},es=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}},fi=class extends Qi{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)}},Ve=class extends Te{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new D(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new D(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=B.newFloatArray(e.length));let t=this.uvs,i=this.uvs.length,s=this.region.u,n=this.region.v,c=0,l=0;if(this.region instanceof fi){let r=this.region,o=r.page.texture.getImage(),a=o.width,h=o.height;switch(r.degrees){case 90:s-=(r.originalHeight-r.offsetY-r.height)/a,n-=(r.originalWidth-r.offsetX-r.width)/h,c=r.originalHeight/a,l=r.originalWidth/h;for(let d=0;d<i;d+=2)t[d]=s+e[d+1]*c,t[d+1]=n+(1-e[d])*l;return;case 180:s-=(r.originalWidth-r.offsetX-r.width)/a,n-=r.offsetY/h,c=r.originalWidth/a,l=r.originalHeight/h;for(let d=0;d<i;d+=2)t[d]=s+(1-e[d])*c,t[d+1]=n+(1-e[d+1])*l;return;case 270:s-=r.offsetY/a,n-=r.offsetX/h,c=r.originalHeight/a,l=r.originalWidth/h;for(let d=0;d<i;d+=2)t[d]=s+(1-e[d+1])*c,t[d+1]=n+e[d]*l;return}s-=r.offsetX/a,n-=(r.originalHeight-r.offsetY-r.height)/h,c=r.originalWidth/a,l=r.originalHeight/h}else this.region?(c=this.region.u2-s,l=this.region.v2-n):(s=n=0,c=l=1);for(let r=0;r<i;r+=2)t[r]=s+e[r]*c,t[r+1]=n+e[r+1]*l}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 Ve(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=new Array(this.uvs.length),B.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),B.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),B.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,c){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,t,i,s,n,c)}newLinkedMesh(){let e=new Ve(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}},Ge=class extends Te{lengths=[];closed=!1;constantSpeed=!1;color=new D(1,1,1,1);constructor(e){super(e)}copy(){let e=new Ge(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},ui=class extends Te{x=0;y=0;rotation=0;color=new D(.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){let t=F.cosDeg(this.rotation),i=F.sinDeg(this.rotation),s=t*e.a+i*e.b,n=t*e.c+i*e.d;return Math.atan2(n,s)*F.radDeg}copy(){let e=new ui(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},ts=class extends Nt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new D(1,1,1,1);path;region=null;sequence=null;offset=B.newFloatArray(8);uvs=B.newFloatArray(8);tempColor=new D(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,c=-this.height/2*this.scaleY+this.region.offsetY*s,l=n+this.region.width*i,r=c+this.region.height*s,o=this.rotation*Math.PI/180,a=Math.cos(o),h=Math.sin(o),d=this.x,f=this.y,u=n*a+d,m=n*h,g=c*a+f,p=c*h,v=l*a+d,x=l*h,w=r*a+f,b=r*h,y=this.offset;y[0]=u-p,y[1]=g+m,y[2]=u-b,y[3]=w+m,y[4]=v-b,y[5]=w+x,y[6]=v-p,y[7]=g+x,e.degrees==90?(t[0]=e.u2,t[1]=e.v2,t[2]=e.u,t[3]=e.v2,t[4]=e.u,t[5]=e.v,t[6]=e.u2,t[7]=e.v):(t[0]=e.u,t[1]=e.v2,t[2]=e.u,t[3]=e.v,t[4]=e.u2,t[5]=e.v,t[6]=e.u2,t[7]=e.v2)}computeWorldVertices(e,t,i,s){this.sequence!=null&&this.sequence.apply(e,this);let n=e.bone,c=this.offset,l=n.worldX,r=n.worldY,o=n.a,a=n.b,h=n.c,d=n.d,f=0,u=0;f=c[0],u=c[1],t[i]=f*o+u*a+l,t[i+1]=f*h+u*d+r,i+=s,f=c[2],u=c[3],t[i]=f*o+u*a+l,t[i+1]=f*h+u*d+r,i+=s,f=c[4],u=c[5],t[i]=f*o+u*a+l,t[i+1]=f*h+u*d+r,i+=s,f=c[6],u=c[7],t[i]=f*o+u*a+l,t[i+1]=f*h+u*d+r}copy(){let e=new ts(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,B.arrayCopy(this.uvs,0,e.uvs,0,8),B.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}},ae=ts;P(ae,"X1",0),P(ae,"Y1",1),P(ae,"C1R",2),P(ae,"C1G",3),P(ae,"C1B",4),P(ae,"C1A",5),P(ae,"U1",6),P(ae,"V1",7),P(ae,"X2",8),P(ae,"Y2",9),P(ae,"C2R",10),P(ae,"C2G",11),P(ae,"C2B",12),P(ae,"C2A",13),P(ae,"U2",14),P(ae,"V2",15),P(ae,"X3",16),P(ae,"Y3",17),P(ae,"C3R",18),P(ae,"C3G",19),P(ae,"C3B",20),P(ae,"C3A",21),P(ae,"U3",22),P(ae,"V3",23),P(ae,"X4",24),P(ae,"Y4",25),P(ae,"C4R",26),P(ae,"C4G",27),P(ae,"C4B",28),P(ae,"C4A",29),P(ae,"U4",30),P(ae,"V4",31);var zs=class{atlas;constructor(e){this.atlas=e}loadSequence(e,t,i){let s=i.regions;for(let n=0,c=s.length;n<c;n++){let l=i.getPath(t,n),r=this.atlas.findRegion(l);if(r==null)throw new Error("Region not found in atlas: "+l+" (sequence: "+e+")");s[n]=r}}newRegionAttachment(e,t,i,s){let n=new ae(t,i);if(s!=null)this.loadSequence(t,i,s);else{let c=this.atlas.findRegion(i);if(!c)throw new Error("Region not found in atlas: "+i+" (region attachment: "+t+")");n.region=c}return n}newMeshAttachment(e,t,i,s){let n=new Ve(t,i);if(s!=null)this.loadSequence(t,i,s);else{let c=this.atlas.findRegion(i);if(!c)throw new Error("Region not found in atlas: "+i+" (mesh attachment: "+t+")");n.region=c}return n}newBoundingBoxAttachment(e,t){return new pt(t)}newPathAttachment(e,t){return new Ge(t)}newPointAttachment(e,t){return new ui(t)}newClippingAttachment(e,t){return new ot(t)}},mi=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;transformMode=yt.Normal;skinRequired=!1;color=new D;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}},yt=(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))(yt||{}),gi=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;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(){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,c,l){this.ax=e,this.ay=t,this.arotation=i,this.ascaleX=s,this.ascaleY=n,this.ashearX=c,this.ashearY=l;let r=this.parent;if(!r){let f=this.skeleton,u=i+90+l,m=f.scaleX,g=f.scaleY;this.a=F.cosDeg(i+c)*s*m,this.b=F.cosDeg(u)*n*m,this.c=F.sinDeg(i+c)*s*g,this.d=F.sinDeg(u)*n*g,this.worldX=e*m+f.x,this.worldY=t*g+f.y;return}let o=r.a,a=r.b,h=r.c,d=r.d;switch(this.worldX=o*e+a*t+r.worldX,this.worldY=h*e+d*t+r.worldY,this.data.transformMode){case 0:{let f=i+90+l,u=F.cosDeg(i+c)*s,m=F.cosDeg(f)*n,g=F.sinDeg(i+c)*s,p=F.sinDeg(f)*n;this.a=o*u+a*g,this.b=o*m+a*p,this.c=h*u+d*g,this.d=h*m+d*p;return}case 1:{let f=i+90+l;this.a=F.cosDeg(i+c)*s,this.b=F.cosDeg(f)*n,this.c=F.sinDeg(i+c)*s,this.d=F.sinDeg(f)*n;break}case 2:{let f=o*o+h*h,u=0;f>1e-4?(f=Math.abs(o*d-a*h)/f,o/=this.skeleton.scaleX,h/=this.skeleton.scaleY,a=h*f,d=o*f,u=Math.atan2(h,o)*F.radDeg):(o=0,h=0,u=90-Math.atan2(d,a)*F.radDeg);let m=i+c-u,g=i+l-u+90,p=F.cosDeg(m)*s,v=F.cosDeg(g)*n,x=F.sinDeg(m)*s,w=F.sinDeg(g)*n;this.a=o*p-a*x,this.b=o*v-a*w,this.c=h*p+d*x,this.d=h*v+d*w;break}case 3:case 4:{let f=F.cosDeg(i),u=F.sinDeg(i),m=(o*f+a*u)/this.skeleton.scaleX,g=(h*f+d*u)/this.skeleton.scaleY,p=Math.sqrt(m*m+g*g);p>1e-5&&(p=1/p),m*=p,g*=p,p=Math.sqrt(m*m+g*g),this.data.transformMode==3&&o*d-a*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let v=Math.PI/2+Math.atan2(g,m),x=Math.cos(v)*p,w=Math.sin(v)*p,b=F.cosDeg(c)*s,y=F.cosDeg(90+l)*n,C=F.sinDeg(c)*s,A=F.sinDeg(90+l)*n;this.a=m*b+x*C,this.b=m*y+x*A,this.c=g*b+w*C,this.d=g*y+w*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}getWorldRotationX(){return Math.atan2(this.c,this.a)*F.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*F.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)}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)*F.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)*F.radDeg;return}let t=e.a,i=e.b,s=e.c,n=e.d,c=1/(t*n-i*s),l=this.worldX-e.worldX,r=this.worldY-e.worldY;this.ax=l*n*c-r*i*c,this.ay=r*t*c-l*s*c;let o=c*n,a=c*t,h=c*i,d=c*s,f=o*this.a-h*this.c,u=o*this.b-h*this.d,m=a*this.c-d*this.a,g=a*this.d-d*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+m*m),this.ascaleX>1e-4){let p=f*g-u*m;this.ascaleY=p/this.ascaleX,this.ashearY=Math.atan2(f*u+m*g,p)*F.radDeg,this.arotation=Math.atan2(m,f)*F.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,u)*F.radDeg}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}worldToLocalRotation(e){let t=F.sinDeg(e),i=F.cosDeg(e);return Math.atan2(this.a*t-this.c*i,this.d*i-this.b*t)*F.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=F.sinDeg(e),i=F.cosDeg(e);return Math.atan2(i*this.c+t*this.d,i*this.a+t*this.b)*F.radDeg}rotateWorld(e){let t=this.a,i=this.b,s=this.c,n=this.d,c=F.cosDeg(e),l=F.sinDeg(e);this.a=c*t-l*s,this.b=c*i-l*n,this.c=l*t+c*s,this.d=l*i+c*n}},At=class{constructor(e,t,i){this.name=e,this.order=t,this.skinRequired=i}},is=class{pathPrefix="";textureLoader;downloader;assets={};errors={};toLoad=0;loaded=0;constructor(e,t="",i=new xi){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(c=>c.ok?c.blob():(this.error(i,e,`Couldn't load image: ${e}`),null)).then(c=>c?createImageBitmap(c,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(c=>{c&&this.success(t,e,this.textureLoader(c))});else{let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{this.success(t,e,this.textureLoader(c))},c.onerror=()=>{this.error(i,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),c.src=e}}loadTextureAtlas(e,t=()=>{},i=()=>{},s){let n=e.lastIndexOf("/"),c=n>=0?e.substring(0,n+1):"";e=this.start(e),this.downloader.downloadText(e,l=>{try{let r=new $i(l),o=r.pages.length,a=!1;for(let h of r.pages)this.loadTexture(s?s[h.name]:c+h.name,(d,f)=>{a||(h.setTexture(f),--o==0&&this.success(t,e,r))},(d,f)=>{a||this.error(i,e,`Couldn't load texture atlas ${e} page image: ${d}`),a=!0})}catch(r){this.error(i,e,`Couldn't parse texture atlas ${e}: ${r.message}`)}},(l,r)=>{this.error(i,e,`Couldn't load texture atlas ${e}: status ${l}, ${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}},xi=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 c=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(c))}catch(c){this.finish(e,400,JSON.stringify(c))}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 c=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(c))}catch(c){this.finish(e,400,JSON.stringify(c))}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 c=n.length-1,l=s.length;c<l;c+=2)s[c].apply(null,n)}},wi=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}},bi=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},ss=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.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch,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}isActive(){return this.active}update(){if(this.mix==0)return;let e=this.target,t=this.bones;switch(t.length){case 1:this.apply1(t[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(t[0],t[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,i,s,n,c,l){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let o=r.a,a=r.b,h=r.c,d=r.d,f=-e.ashearX-e.arotation,u=0,m=0;switch(e.data.transformMode){case 1:u=(t-e.worldX)*F.signum(e.skeleton.scaleX),m=(i-e.worldY)*F.signum(e.skeleton.scaleY);break;case 2:let v=Math.abs(o*d-a*h)/Math.max(1e-4,o*o+h*h),x=o/e.skeleton.scaleX,w=h/e.skeleton.scaleY;a=-w*v*e.skeleton.scaleX,d=x*v*e.skeleton.scaleY,f+=Math.atan2(w,x)*F.radDeg;default:let b=t-r.worldX,y=i-r.worldY,C=o*d-a*h;Math.abs(C)<=1e-4?(u=0,m=0):(u=(b*d-y*a)/C-e.ax,m=(y*o-b*h)/C-e.ay)}f+=Math.atan2(m,u)*F.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=e.ascaleX,p=e.ascaleY;if(s||n){switch(e.data.transformMode){case 3:case 4:u=t-e.worldX,m=i-e.worldY}let v=e.data.length*g,x=Math.sqrt(u*u+m*m);if(s&&x<v||n&&x>v&&v>1e-4){let w=(x/v-1)*l+1;g*=w,c&&(p*=w)}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*l,g,p,e.ashearX,e.ashearY)}apply2(e,t,i,s,n,c,l,r,o){let a=e.ax,h=e.ay,d=e.ascaleX,f=e.ascaleY,u=d,m=f,g=t.ascaleX,p=0,v=0,x=0;d<0?(d=-d,p=180,x=-1):(p=0,x=1),f<0&&(f=-f,x=-x),g<0?(g=-g,v=180):v=0;let w=t.ax,b=0,y=0,C=0,A=e.a,T=e.b,E=e.c,R=e.d,L=Math.abs(d-f)<=1e-4;!L||c?(b=0,y=A*w+e.worldX,C=E*w+e.worldY):(b=t.ay,y=A*w+T*b+e.worldX,C=E*w+R*b+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");A=X.a,T=X.b,E=X.c,R=X.d;let k=A*R-T*E,M=y-X.worldX,I=C-X.worldY;k=Math.abs(k)<=1e-4?0:1/k;let W=(M*R-I*T)*k-a,se=(I*A-M*E)*k-h,te=Math.sqrt(W*W+se*se),oe=t.data.length*g,re,ce;if(te<1e-4){this.apply1(e,i,s,!1,c,!1,o),t.updateWorldTransformWith(w,b,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}M=i-X.worldX,I=s-X.worldY;let ne=(M*R-I*T)*k-a,ie=(I*A-M*E)*k-h,fe=ne*ne+ie*ie;if(r!=0){r*=d*(g+1)*.5;let xe=Math.sqrt(fe),Ce=xe-te-oe*d+r;if(Ce>0){let Se=Math.min(1,Ce/(r*2))-1;Se=(Ce-r*(1-Se*Se))/xe,ne-=Se*ne,ie-=Se*ie,fe=ne*ne+ie*ie}}e:if(L){oe*=d;let xe=(fe-te*te-oe*oe)/(2*te*oe);xe<-1?(xe=-1,ce=Math.PI*n):xe>1?(xe=1,ce=0,c&&(A=(Math.sqrt(fe)/(te+oe)-1)*o+1,u*=A,l&&(m*=A))):ce=Math.acos(xe)*n,A=te+oe*xe,T=oe*Math.sin(ce),re=Math.atan2(ie*A-ne*T,ne*A+ie*T)}else{A=d*oe,T=f*oe;let xe=A*A,Ce=T*T,Se=Math.atan2(ie,ne);E=Ce*te*te+xe*fe-xe*Ce;let Ue=-2*Ce*te,it=Ce-xe;if(R=Ue*Ue-4*it*E,R>=0){let st=Math.sqrt(R);Ue<0&&(st=-st),st=-(Ue+st)*.5;let Ts=st/it,Is=E/st,rt=Math.abs(Ts)<Math.abs(Is)?Ts:Is;if(rt*rt<=fe){I=Math.sqrt(fe-rt*rt)*n,re=Se-Math.atan2(I,rt),ce=Math.atan2(I/f,(rt-te)/d);break e}}let dt=F.PI,Pt=te-A,Li=Pt*Pt,As=0,Cs=0,Dt=te+A,Bi=Dt*Dt,Ss=0;E=-A*te/(xe-Ce),E>=-1&&E<=1&&(E=Math.acos(E),M=A*Math.cos(E)+te,I=T*Math.sin(E),R=M*M+I*I,R<Li&&(dt=E,Li=R,Pt=M,As=I),R>Bi&&(Cs=E,Bi=R,Dt=M,Ss=I)),fe<=(Li+Bi)*.5?(re=Se-Math.atan2(As*n,Pt),ce=dt*n):(re=Se-Math.atan2(Ss*n,Dt),ce=Cs*n)}let be=Math.atan2(b,w)*x,Re=e.arotation;re=(re-be)*F.radDeg+p-Re,re>180?re-=360:re<-180&&(re+=360),e.updateWorldTransformWith(a,h,Re+re*o,u,m,0,0),Re=t.arotation,ce=((ce+be)*F.radDeg-t.ashearX)*x+v-Re,ce>180?ce-=360:ce<-180&&(ce+=360),t.updateWorldTransformWith(w,b,Re+ce*o,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},pi=class extends At{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=1;compress=!1;stretch=!1;uniform=!1;mix=1;softness=0;constructor(e){super(e,0,!1)}},vi=class extends At{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=Ct.Fixed;spacingMode=St.Fixed;rotateMode=Tt.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},Ct=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Ct||{}),St=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(St||{}),Tt=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Tt||{}),Le=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 c=t.findBone(e.bones[s].name);if(!c)throw new Error(`Couldn't find bone ${e.bones[s].name}.`);this.bones.push(c)}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}update(){let e=this.target.getAttachment();if(!(e instanceof Ge))return;let t=this.mixRotate,i=this.mixX,s=this.mixY;if(t==0&&i==0&&s==0)return;let n=this.data,c=n.rotateMode==0,l=n.rotateMode==2,r=this.bones,o=r.length,a=c?o:o+1,h=B.setArraySize(this.spaces,a),d=l?this.lengths=B.setArraySize(this.lengths,o):[],f=this.spacing;switch(n.spacingMode){case 2:if(l)for(let b=0,y=a-1;b<y;b++){let C=r[b],A=C.data.length;if(A<Le.epsilon)d[b]=0;else{let T=A*C.a,E=A*C.c;d[b]=Math.sqrt(T*T+E*E)}}B.arrayFill(h,1,a,f);break;case 3:let x=0;for(let b=0,y=a-1;b<y;){let C=r[b],A=C.data.length;if(A<Le.epsilon)l&&(d[b]=0),h[++b]=f;else{let T=A*C.a,E=A*C.c,R=Math.sqrt(T*T+E*E);l&&(d[b]=R),h[++b]=R,x+=R}}if(x>0){x=a/x*f;for(let b=1;b<a;b++)h[b]*=x}break;default:let w=n.spacingMode==0;for(let b=0,y=a-1;b<y;){let C=r[b],A=C.data.length;if(A<Le.epsilon)l&&(d[b]=0),h[++b]=f;else{let T=A*C.a,E=A*C.c,R=Math.sqrt(T*T+E*E);l&&(d[b]=R),h[++b]=(w?A+f:f)*R/A}}}let u=this.computeWorldPositions(e,a,c),m=u[0],g=u[1],p=n.offsetRotation,v=!1;if(p==0)v=n.rotateMode==1;else{v=!1;let x=this.target.bone;p*=x.a*x.d-x.b*x.c>0?F.degRad:-F.degRad}for(let x=0,w=3;x<o;x++,w+=3){let b=r[x];b.worldX+=(m-b.worldX)*i,b.worldY+=(g-b.worldY)*s;let y=u[w],C=u[w+1],A=y-m,T=C-g;if(l){let E=d[x];if(E!=0){let R=(Math.sqrt(A*A+T*T)/E-1)*t+1;b.a*=R,b.c*=R}}if(m=y,g=C,t>0){let E=b.a,R=b.b,L=b.c,X=b.d,k=0,M=0,I=0;if(c?k=u[w-1]:h[x+1]==0?k=u[w+2]:k=Math.atan2(T,A),k-=Math.atan2(L,E),v){M=Math.cos(k),I=Math.sin(k);let W=b.data.length;m+=(W*(M*E-I*L)-A)*t,g+=(W*(I*E+M*L)-T)*t}else k+=p;k>F.PI?k-=F.PI2:k<-F.PI&&(k+=F.PI2),k*=t,M=Math.cos(k),I=Math.sin(k),b.a=M*E-I*L,b.b=M*R-I*X,b.c=I*E+M*L,b.d=I*R+M*X}b.updateAppliedTransform()}}computeWorldPositions(e,t,i){let s=this.target,n=this.position,c=this.spaces,l=B.setArraySize(this.positions,t*3+2),r=this.world,o=e.closed,a=e.worldVerticesLength,h=a/6,d=Le.NONE;if(!e.constantSpeed){let se=e.lengths;h-=o?1:2;let te=se[h];this.data.positionMode==1&&(n*=te);let oe;switch(this.data.spacingMode){case 2:oe=te;break;case 3:oe=te/t;break;default:oe=1}r=B.setArraySize(this.world,8);for(let re=0,ce=0,ne=0;re<t;re++,ce+=3){let ie=c[re]*oe;n+=ie;let fe=n;if(o)fe%=te,fe<0&&(fe+=te),ne=0;else if(fe<0){d!=Le.BEFORE&&(d=Le.BEFORE,e.computeWorldVertices(s,2,4,r,0,2)),this.addBeforePosition(fe,r,0,l,ce);continue}else if(fe>te){d!=Le.AFTER&&(d=Le.AFTER,e.computeWorldVertices(s,a-6,4,r,0,2)),this.addAfterPosition(fe-te,r,0,l,ce);continue}for(;;ne++){let be=se[ne];if(!(fe>be)){if(ne==0)fe/=be;else{let Re=se[ne-1];fe=(fe-Re)/(be-Re)}break}}ne!=d&&(d=ne,o&&ne==h?(e.computeWorldVertices(s,a-4,4,r,0,2),e.computeWorldVertices(s,0,4,r,4,2)):e.computeWorldVertices(s,ne*6+2,8,r,0,2)),this.addCurvePosition(fe,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],l,ce,i||re>0&&ie==0)}return l}o?(a+=2,r=B.setArraySize(this.world,a),e.computeWorldVertices(s,2,a-4,r,0,2),e.computeWorldVertices(s,0,2,r,a-4,2),r[a-2]=r[0],r[a-1]=r[1]):(h--,a-=4,r=B.setArraySize(this.world,a),e.computeWorldVertices(s,2,a,r,0,2));let f=B.setArraySize(this.curves,h),u=0,m=r[0],g=r[1],p=0,v=0,x=0,w=0,b=0,y=0,C=0,A=0,T=0,E=0,R=0,L=0,X=0,k=0;for(let se=0,te=2;se<h;se++,te+=6)p=r[te],v=r[te+1],x=r[te+2],w=r[te+3],b=r[te+4],y=r[te+5],C=(m-p*2+x)*.1875,A=(g-v*2+w)*.1875,T=((p-x)*3-m+b)*.09375,E=((v-w)*3-g+y)*.09375,R=C*2+T,L=A*2+E,X=(p-m)*.75+C+T*.16666667,k=(v-g)*.75+A+E*.16666667,u+=Math.sqrt(X*X+k*k),X+=R,k+=L,R+=T,L+=E,u+=Math.sqrt(X*X+k*k),X+=R,k+=L,u+=Math.sqrt(X*X+k*k),X+=R+T,k+=L+E,u+=Math.sqrt(X*X+k*k),f[se]=u,m=b,g=y;this.data.positionMode==1&&(n*=u);let M;switch(this.data.spacingMode){case 2:M=u;break;case 3:M=u/t;break;default:M=1}let I=this.segments,W=0;for(let se=0,te=0,oe=0,re=0;se<t;se++,te+=3){let ce=c[se]*M;n+=ce;let ne=n;if(o)ne%=u,ne<0&&(ne+=u),oe=0;else if(ne<0){this.addBeforePosition(ne,r,0,l,te);continue}else if(ne>u){this.addAfterPosition(ne-u,r,a-4,l,te);continue}for(;;oe++){let ie=f[oe];if(!(ne>ie)){if(oe==0)ne/=ie;else{let fe=f[oe-1];ne=(ne-fe)/(ie-fe)}break}}if(oe!=d){d=oe;let ie=oe*6;for(m=r[ie],g=r[ie+1],p=r[ie+2],v=r[ie+3],x=r[ie+4],w=r[ie+5],b=r[ie+6],y=r[ie+7],C=(m-p*2+x)*.03,A=(g-v*2+w)*.03,T=((p-x)*3-m+b)*.006,E=((v-w)*3-g+y)*.006,R=C*2+T,L=A*2+E,X=(p-m)*.3+C+T*.16666667,k=(v-g)*.3+A+E*.16666667,W=Math.sqrt(X*X+k*k),I[0]=W,ie=1;ie<8;ie++)X+=R,k+=L,R+=T,L+=E,W+=Math.sqrt(X*X+k*k),I[ie]=W;X+=R,k+=L,W+=Math.sqrt(X*X+k*k),I[8]=W,X+=R+T,k+=L+E,W+=Math.sqrt(X*X+k*k),I[9]=W,re=0}for(ne*=W;;re++){let ie=I[re];if(!(ne>ie)){if(re==0)ne/=ie;else{let fe=I[re-1];ne=re+(ne-fe)/(ie-fe)}break}}this.addCurvePosition(ne*.1,m,g,p,v,x,w,b,y,l,te,i||se>0&&ce==0)}return l}addBeforePosition(e,t,i,s,n){let c=t[i],l=t[i+1],r=t[i+2]-c,o=t[i+3]-l,a=Math.atan2(o,r);s[n]=c+e*Math.cos(a),s[n+1]=l+e*Math.sin(a),s[n+2]=a}addAfterPosition(e,t,i,s,n){let c=t[i+2],l=t[i+3],r=c-t[i],o=l-t[i+1],a=Math.atan2(o,r);s[n]=c+e*Math.cos(a),s[n+1]=l+e*Math.sin(a),s[n+2]=a}addCurvePosition(e,t,i,s,n,c,l,r,o,a,h,d){if(e==0||isNaN(e)){a[h]=t,a[h+1]=i,a[h+2]=Math.atan2(n-i,s-t);return}let f=e*e,u=f*e,m=1-e,g=m*m,p=g*m,v=m*e,x=v*3,w=m*x,b=x*e,y=t*p+s*w+c*b+r*u,C=i*p+n*w+l*b+o*u;a[h]=y,a[h+1]=C,d&&(e<.001?a[h+2]=Math.atan2(n-i,s-t):a[h+2]=Math.atan2(C-(i*g+n*v*2+l*f),y-(t*g+s*v*2+c*f)))}},Qe=Le;P(Qe,"NONE",-1),P(Qe,"BEFORE",-2),P(Qe,"AFTER",-3),P(Qe,"epsilon",1e-5);var rs=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 D,this.darkColor=e.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof Te)||!(this.attachment instanceof Te)||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}},ns=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new _e;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.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,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}isActive(){return this.active}update(){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,c=this.mixShearY,l=t!=0||i!=0,r=this.target,o=r.a,a=r.b,h=r.c,d=r.d,f=o*d-a*h>0?F.degRad:-F.degRad,u=this.data.offsetRotation*f,m=this.data.offsetShearY*f,g=this.bones;for(let p=0,v=g.length;p<v;p++){let x=g[p];if(e!=0){let w=x.a,b=x.b,y=x.c,C=x.d,A=Math.atan2(h,o)-Math.atan2(y,w)+u;A>F.PI?A-=F.PI2:A<-F.PI&&(A+=F.PI2),A*=e;let T=Math.cos(A),E=Math.sin(A);x.a=T*w-E*y,x.b=T*b-E*C,x.c=E*w+T*y,x.d=E*b+T*C}if(l){let w=this.temp;r.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(w.x-x.worldX)*t,x.worldY+=(w.y-x.worldY)*i}if(s!=0){let w=Math.sqrt(x.a*x.a+x.c*x.c);w!=0&&(w=(w+(Math.sqrt(o*o+h*h)-w+this.data.offsetScaleX)*s)/w),x.a*=w,x.c*=w}if(n!=0){let w=Math.sqrt(x.b*x.b+x.d*x.d);w!=0&&(w=(w+(Math.sqrt(a*a+d*d)-w+this.data.offsetScaleY)*n)/w),x.b*=w,x.d*=w}if(c>0){let w=x.b,b=x.d,y=Math.atan2(b,w),C=Math.atan2(d,a)-Math.atan2(h,o)-(y-Math.atan2(x.c,x.a));C>F.PI?C-=F.PI2:C<-F.PI&&(C+=F.PI2),C=y+(C+m)*c;let A=Math.sqrt(w*w+b*b);x.b=Math.cos(C)*A,x.d=Math.sin(C)*A}x.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,l=t!=0||i!=0,r=this.target,o=r.a,a=r.b,h=r.c,d=r.d,f=o*d-a*h>0?F.degRad:-F.degRad,u=this.data.offsetRotation*f,m=this.data.offsetShearY*f,g=this.bones;for(let p=0,v=g.length;p<v;p++){let x=g[p];if(e!=0){let w=x.a,b=x.b,y=x.c,C=x.d,A=Math.atan2(h,o)+u;A>F.PI?A-=F.PI2:A<-F.PI&&(A+=F.PI2),A*=e;let T=Math.cos(A),E=Math.sin(A);x.a=T*w-E*y,x.b=T*b-E*C,x.c=E*w+T*y,x.d=E*b+T*C}if(l){let w=this.temp;r.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),x.worldX+=w.x*t,x.worldY+=w.y*i}if(s!=0){let w=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleX)*s+1;x.a*=w,x.c*=w}if(n!=0){let w=(Math.sqrt(a*a+d*d)-1+this.data.offsetScaleY)*n+1;x.b*=w,x.d*=w}if(c>0){let w=Math.atan2(d,a)-Math.atan2(h,o);w>F.PI?w-=F.PI2:w<-F.PI&&(w+=F.PI2);let b=x.b,y=x.d;w=Math.atan2(y,b)+(w-F.PI/2+m)*c;let C=Math.sqrt(b*b+y*y);x.b=Math.cos(w)*C,x.d=Math.sin(w)*C}x.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,l=this.target,r=this.bones;for(let o=0,a=r.length;o<a;o++){let h=r[o],d=h.arotation;if(e!=0){let v=l.arotation-d+this.data.offsetRotation;v-=(16384-(16384.499999999996-v/360|0))*360,d+=v*e}let f=h.ax,u=h.ay;f+=(l.ax-f+this.data.offsetX)*t,u+=(l.ay-u+this.data.offsetY)*i;let m=h.ascaleX,g=h.ascaleY;s!=0&&m!=0&&(m=(m+(l.ascaleX-m+this.data.offsetScaleX)*s)/m),n!=0&&g!=0&&(g=(g+(l.ascaleY-g+this.data.offsetScaleY)*n)/g);let p=h.ashearY;if(c!=0){let v=l.ashearY-p+this.data.offsetShearY;v-=(16384-(16384.499999999996-v/360|0))*360,p+=v*c}h.updateWorldTransformWith(f,u,d,m,g,h.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,l=this.target,r=this.bones;for(let o=0,a=r.length;o<a;o++){let h=r[o],d=h.arotation+(l.arotation+this.data.offsetRotation)*e,f=h.ax+(l.ax+this.data.offsetX)*t,u=h.ay+(l.ay+this.data.offsetY)*i,m=h.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*s+1),g=h.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*n+1),p=h.ashearY+(l.ashearY+this.data.offsetShearY)*c;h.updateWorldTransformWith(f,u,d,m,g,h.ashearX,p)}}},as=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return as.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=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 gi(i,this,null);else{let n=this.bones[i.parent.index];s=new gi(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 rs(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 ss(i,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let i=e.transformConstraints[t];this.transformConstraints.push(new ns(i,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let i=e.pathConstraints[t];this.pathConstraints.push(new Qe(i,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let a=0,h=t.length;a<h;a++){let d=t[a];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin){let a=this.skin.bones;for(let h=0,d=this.skin.bones.length;h<d;h++){let f=this.bones[a[h].index];do f.sorted=!1,f.active=!0,f=f.parent;while(f)}}let i=this.ikConstraints,s=this.transformConstraints,n=this.pathConstraints,c=i.length,l=s.length,r=n.length,o=c+l+r;e:for(let a=0;a<o;a++){for(let h=0;h<c;h++){let d=i[h];if(d.data.order==a){this.sortIkConstraint(d);continue e}}for(let h=0;h<l;h++){let d=s[h];if(d.data.order==a){this.sortTransformConstraint(d);continue e}}for(let h=0;h<r;h++){let d=n[h];if(d.data.order==a){this.sortPathConstraint(d);continue e}}}for(let a=0,h=t.length;a<h;a++)this.sortBone(t[a])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&B.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&&B.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 Ge&&this.sortPathConstraintAttachmentWith(n,s);let c=e.bones,l=c.length;for(let r=0;r<l;r++)this.sortBone(c[r]);this._updateCache.push(e);for(let r=0;r<l;r++)this.sortReset(c[r].children);for(let r=0;r<l;r++)c[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&B.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 Ge))return;let i=e.bones;if(!i)this.sortBone(t);else{let s=this.bones;for(let n=0,c=i.length;n<c;){let l=i[n++];for(l+=n;n<l;)this.sortBone(s[i[n++]])}}}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(){let e=this.bones;for(let i=0,s=e.length;i<s;i++){let n=e[i];n.ax=n.x,n.ay=n.y,n.arotation=n.rotation,n.ascaleX=n.scaleX,n.ascaleY=n.scaleY,n.ashearX=n.shearX,n.ashearY=n.shearY}let t=this._updateCache;for(let i=0,s=t.length;i<s;i++)t[i].update()}updateWorldTransformWith(e){let t=this.getRootBone();if(!t)throw new Error("Root bone must not be null.");let i=e.a,s=e.b,n=e.c,c=e.d;t.worldX=i*this.x+s*this.y+e.worldX,t.worldY=n*this.x+c*this.y+e.worldY;let l=t.rotation+90+t.shearY,r=F.cosDeg(t.rotation+t.shearX)*t.scaleX,o=F.cosDeg(l)*t.scaleY,a=F.sinDeg(t.rotation+t.shearX)*t.scaleX,h=F.sinDeg(l)*t.scaleY;t.a=(i*r+s*a)*this.scaleX,t.b=(i*o+s*h)*this.scaleX,t.c=(n*r+c*a)*this.scaleY,t.d=(n*o+c*h)*this.scaleY;let d=this._updateCache;for(let f=0,u=d.length;f<u;f++){let m=d[f];m!=t&&m.update()}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){let e=this.bones;for(let n=0,c=e.length;n<c;n++)e[n].setToSetupPose();let t=this.ikConstraints;for(let n=0,c=t.length;n<c;n++){let l=t[n];l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}let i=this.transformConstraints;for(let n=0,c=i.length;n<c;n++){let l=i[n],r=l.data;l.mixRotate=r.mixRotate,l.mixX=r.mixX,l.mixY=r.mixY,l.mixScaleX=r.mixScaleX,l.mixScaleY=r.mixScaleY,l.mixShearY=r.mixShearY}let s=this.pathConstraints;for(let n=0,c=s.length;n<c;n++){let l=s[n],r=l.data;l.position=r.position,l.spacing=r.spacing,l.mixRotate=r.mixRotate,l.mixX=r.mixX,l.mixY=r.mixY}}setSlotsToSetupPose(){let e=this.slots;B.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],c=n.data.attachmentName;if(c){let l=e.getAttachment(i,c);l&&n.setAttachment(l)}}}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 c=i[s];if(c.data.name==e){let l=null;if(t&&(l=this.getAttachment(s,t),!l))throw new Error("Attachment not found: "+t+", for slot: "+e);c.setAttachment(l);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let t=this.ikConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.data.name==e)return n}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let t=this.transformConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.data.name==e)return n}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let t=this.pathConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.data.name==e)return n}return null}getBoundsRect(){let e=new _e,t=new _e;return this.getBounds(e,t),{x:e.x,y:e.y,width:t.x,height:t.y}}getBounds(e,t,i=new Array(2)){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let s=this.drawOrder,n=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let o=0,a=s.length;o<a;o++){let h=s[o];if(!h.bone.active)continue;let d=0,f=null,u=h.getAttachment();if(u instanceof ae)d=8,f=B.setArraySize(i,d,0),u.computeWorldVertices(h,f,0,2);else if(u instanceof Ve){let m=u;d=m.worldVerticesLength,f=B.setArraySize(i,d,0),m.computeWorldVertices(h,0,d,f,0,2)}if(f)for(let m=0,g=f.length;m<g;m+=2){let p=f[m],v=f[m+1];n=Math.min(n,p),c=Math.min(c,v),l=Math.max(l,p),r=Math.max(r,v)}}e.set(n,c),t.set(l-n,r-c)}},ls=as;P(ls,"yDown",!1);var yi=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;x=0;y=0;width=0;height=0;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.");let t=this.ikConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let t=this.transformConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let t=this.pathConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}},Ai=class{constructor(e=0,t,i){this.slotIndex=e,this.name=t,this.attachment=i}},It=class{name;attachments=new Array;bones=Array();constraints=new Array;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],c=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==n){c=!0;break}c||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){let n=e.constraints[s],c=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==n){c=!0;break}c||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],c=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==n){c=!0;break}c||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){let n=e.constraints[s],c=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==n){c=!0;break}c||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 Ve?(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 Ai(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 Ai(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],c=n.getAttachment();if(c&&i<t.attachments.length){let l=t.attachments[i];for(let r in l){let o=l[r];if(c==o){let a=this.getAttachment(i,r);a&&n.setAttachment(a);break}}}i++}}},Ci=class{index=0;name;boneData;color=new D(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Yt.Normal;constructor(e,t,i){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!i)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=i}},Yt=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Yt||{}),Si=class extends At{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)}},_s=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new yi;i.name="";let s=new os(e),n=s.readInt32(),c=s.readInt32();i.hash=c==0&&n==0?null:c.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();let l=s.readBoolean();l&&(i.fps=s.readFloat(),i.imagesPath=s.readString(),i.audioPath=s.readString());let r=0;r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("String in string table must not be null.");s.strings.push(h)}r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("Bone name must not be null.");let d=a==0?null:i.bones[s.readInt(!0)],f=new mi(a,h,d);f.rotation=s.readFloat(),f.x=s.readFloat()*t,f.y=s.readFloat()*t,f.scaleX=s.readFloat(),f.scaleY=s.readFloat(),f.shearX=s.readFloat(),f.shearY=s.readFloat(),f.length=s.readFloat()*t,f.transformMode=s.readInt(!0),f.skinRequired=s.readBoolean(),l&&D.rgba8888ToColor(f.color,s.readInt32()),i.bones.push(f)}r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("Slot name must not be null.");let d=i.bones[s.readInt(!0)],f=new Ci(a,h,d);D.rgba8888ToColor(f.color,s.readInt32());let u=s.readInt32();u!=-1&&D.rgb888ToColor(f.darkColor=new D,u),f.attachmentName=s.readStringRef(),f.blendMode=s.readInt(!0),i.slots.push(f)}r=s.readInt(!0);for(let a=0,h;a<r;a++){let d=s.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new pi(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),h=s.readInt(!0);for(let u=0;u<h;u++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.bones[s.readInt(!0)],f.mix=s.readFloat(),f.softness=s.readFloat()*t,f.bendDirection=s.readByte(),f.compress=s.readBoolean(),f.stretch=s.readBoolean(),f.uniform=s.readBoolean(),i.ikConstraints.push(f)}r=s.readInt(!0);for(let a=0,h;a<r;a++){let d=s.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new Si(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),h=s.readInt(!0);for(let u=0;u<h;u++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.bones[s.readInt(!0)],f.local=s.readBoolean(),f.relative=s.readBoolean(),f.offsetRotation=s.readFloat(),f.offsetX=s.readFloat()*t,f.offsetY=s.readFloat()*t,f.offsetScaleX=s.readFloat(),f.offsetScaleY=s.readFloat(),f.offsetShearY=s.readFloat(),f.mixRotate=s.readFloat(),f.mixX=s.readFloat(),f.mixY=s.readFloat(),f.mixScaleX=s.readFloat(),f.mixScaleY=s.readFloat(),f.mixShearY=s.readFloat(),i.transformConstraints.push(f)}r=s.readInt(!0);for(let a=0,h;a<r;a++){let d=s.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new vi(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),h=s.readInt(!0);for(let u=0;u<h;u++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.slots[s.readInt(!0)],f.positionMode=s.readInt(!0),f.spacingMode=s.readInt(!0),f.rotateMode=s.readInt(!0),f.offsetRotation=s.readFloat(),f.position=s.readFloat(),f.positionMode==0&&(f.position*=t),f.spacing=s.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=t),f.mixRotate=s.readFloat(),f.mixX=s.readFloat(),f.mixY=s.readFloat(),i.pathConstraints.push(f)}let o=this.readSkin(s,i,!0,l);o&&(i.defaultSkin=o,i.skins.push(o));{let a=i.skins.length;for(B.setArraySize(i.skins,r=a+s.readInt(!0));a<r;a++){let h=this.readSkin(s,i,!1,l);if(!h)throw new Error("readSkin() should not have returned null.");i.skins[a]=h}}r=this.linkedMeshes.length;for(let a=0;a<r;a++){let h=this.linkedMeshes[a],d=h.skin?i.findSkin(h.skin):i.defaultSkin;if(!d)throw new Error("Not skin found for linked mesh.");if(!h.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(h.slotIndex,h.parent);if(!f)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?f:h.mesh,h.mesh.setParentMesh(f),h.mesh.region!=null&&h.mesh.updateRegion()}this.linkedMeshes.length=0,r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readStringRef();if(!h)throw new Error;let d=new bi(h);d.intValue=s.readInt(!1),d.floatValue=s.readFloat(),d.stringValue=s.readString(),d.audioPath=s.readString(),d.audioPath&&(d.volume=s.readFloat(),d.balance=s.readFloat()),i.events.push(d)}r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(s,h,i))}return i}readSkin(e,t,i,s){let n=null,c=0;if(i){if(c=e.readInt(!0),c==0)return null;n=new It("default")}else{let l=e.readStringRef();if(!l)throw new Error("Skin name must not be null.");n=new It(l),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)]);c=e.readInt(!0)}for(let l=0;l<c;l++){let r=e.readInt(!0);for(let o=0,a=e.readInt(!0);o<a;o++){let h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,n,r,h,s);d&&n.setAttachment(r,h,d)}}return n}readAttachment(e,t,i,s,n,c){let l=this.scale,r=e.readStringRef();switch(r||(r=n),e.readByte()){case Ne.Region:{let o=e.readStringRef(),a=e.readFloat(),h=e.readFloat(),d=e.readFloat(),f=e.readFloat(),u=e.readFloat(),m=e.readFloat(),g=e.readFloat(),p=e.readInt32(),v=this.readSequence(e);o||(o=r);let x=this.attachmentLoader.newRegionAttachment(i,r,o,v);return x?(x.path=o,x.x=h*l,x.y=d*l,x.scaleX=f,x.scaleY=u,x.rotation=a,x.width=m*l,x.height=g*l,D.rgba8888ToColor(x.color,p),x.sequence=v,v==null&&x.updateRegion(),x):null}case Ne.BoundingBox:{let o=e.readInt(!0),a=this.readVertices(e,o),h=c?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(i,r);return d?(d.worldVerticesLength=o<<1,d.vertices=a.vertices,d.bones=a.bones,c&&D.rgba8888ToColor(d.color,h),d):null}case Ne.Mesh:{let o=e.readStringRef(),a=e.readInt32(),h=e.readInt(!0),d=this.readFloatArray(e,h<<1,1),f=this.readShortArray(e),u=this.readVertices(e,h),m=e.readInt(!0),g=this.readSequence(e),p=[],v=0,x=0;c&&(p=this.readShortArray(e),v=e.readFloat(),x=e.readFloat()),o||(o=r);let w=this.attachmentLoader.newMeshAttachment(i,r,o,g);return w?(w.path=o,D.rgba8888ToColor(w.color,a),w.bones=u.bones,w.vertices=u.vertices,w.worldVerticesLength=h<<1,w.triangles=f,w.regionUVs=d,g==null&&w.updateRegion(),w.hullLength=m<<1,w.sequence=g,c&&(w.edges=p,w.width=v*l,w.height=x*l),w):null}case Ne.LinkedMesh:{let o=e.readStringRef(),a=e.readInt32(),h=e.readStringRef(),d=e.readStringRef(),f=e.readBoolean(),u=this.readSequence(e),m=0,g=0;c&&(m=e.readFloat(),g=e.readFloat()),o||(o=r);let p=this.attachmentLoader.newMeshAttachment(i,r,o,u);return p?(p.path=o,D.rgba8888ToColor(p.color,a),p.sequence=u,c&&(p.width=m*l,p.height=g*l),this.linkedMeshes.push(new Ws(p,h,s,d,f)),p):null}case Ne.Path:{let o=e.readBoolean(),a=e.readBoolean(),h=e.readInt(!0),d=this.readVertices(e,h),f=B.newArray(h/3,0);for(let g=0,p=f.length;g<p;g++)f[g]=e.readFloat()*l;let u=c?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(i,r);return m?(m.closed=o,m.constantSpeed=a,m.worldVerticesLength=h<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,c&&D.rgba8888ToColor(m.color,u),m):null}case Ne.Point:{let o=e.readFloat(),a=e.readFloat(),h=e.readFloat(),d=c?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(i,r);return f?(f.x=a*l,f.y=h*l,f.rotation=o,c&&D.rgba8888ToColor(f.color,d),f):null}case Ne.Clipping:{let o=e.readInt(!0),a=e.readInt(!0),h=this.readVertices(e,a),d=c?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(i,r);return f?(f.endSlot=t.slots[o],f.worldVerticesLength=a<<1,f.vertices=h.vertices,f.bones=h.bones,c&&D.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){if(!e.readBoolean())return null;let t=new Ut(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){let i=this.scale,s=t<<1,n=new qs;if(!e.readBoolean())return n.vertices=this.readFloatArray(e,s,i),n;let c=new Array,l=new Array;for(let r=0;r<t;r++){let o=e.readInt(!0);l.push(o);for(let a=0;a<o;a++)l.push(e.readInt(!0)),c.push(e.readFloat()*i),c.push(e.readFloat()*i),c.push(e.readFloat())}return n.vertices=B.toFloatArray(c),n.bones=l,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){let t=e.readInt(!0),i=new Array(t);for(let s=0;s<t;s++)i[s]=e.readShort();return i}readAnimation(e,t,i){e.readInt(!0);let s=new Array,n=this.scale,c=new D,l=new D;for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0);for(let u=0,m=e.readInt(!0);u<m;u++){let g=e.readByte(),p=e.readInt(!0),v=p-1;switch(g){case ir:{let x=new We(p,f);for(let w=0;w<p;w++)x.setFrame(w,e.readFloat(),e.readStringRef());s.push(x);break}case sr:{let x=e.readInt(!0),w=new Jt(p,x,f),b=e.readFloat(),y=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let E=0,R=0;w.setFrame(E,b,y,C,A,T),E!=v;E++){let L=e.readFloat(),X=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;switch(e.readByte()){case Me:w.setStepped(E);break;case Ee:le(e,w,R++,E,0,b,L,y,X,1),le(e,w,R++,E,1,b,L,C,k,1),le(e,w,R++,E,2,b,L,A,M,1),le(e,w,R++,E,3,b,L,T,I,1)}b=L,y=X,C=k,A=M,T=I}s.push(w);break}case rr:{let x=e.readInt(!0),w=new Qt(p,x,f),b=e.readFloat(),y=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let T=0,E=0;w.setFrame(T,b,y,C,A),T!=v;T++){let R=e.readFloat(),L=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;switch(e.readByte()){case Me:w.setStepped(T);break;case Ee:le(e,w,E++,T,0,b,R,y,L,1),le(e,w,E++,T,1,b,R,C,X,1),le(e,w,E++,T,2,b,R,A,k,1)}b=R,y=L,C=X,A=k}s.push(w);break}case nr:{let x=e.readInt(!0),w=new ei(p,x,f),b=e.readFloat(),y=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255;for(let X=0,k=0;w.setFrame(X,b,y,C,A,T,E,R,L),X!=v;X++){let M=e.readFloat(),I=e.readUnsignedByte()/255,W=e.readUnsignedByte()/255,se=e.readUnsignedByte()/255,te=e.readUnsignedByte()/255,oe=e.readUnsignedByte()/255,re=e.readUnsignedByte()/255,ce=e.readUnsignedByte()/255;switch(e.readByte()){case Me:w.setStepped(X);break;case Ee:le(e,w,k++,X,0,b,M,y,I,1),le(e,w,k++,X,1,b,M,C,W,1),le(e,w,k++,X,2,b,M,A,se,1),le(e,w,k++,X,3,b,M,T,te,1),le(e,w,k++,X,4,b,M,E,oe,1),le(e,w,k++,X,5,b,M,R,re,1),le(e,w,k++,X,6,b,M,L,ce,1)}b=M,y=I,C=W,A=se,T=te,E=oe,R=re,L=ce}s.push(w);break}case ar:{let x=e.readInt(!0),w=new ti(p,x,f),b=e.readFloat(),y=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;for(let L=0,X=0;w.setFrame(L,b,y,C,A,T,E,R),L!=v;L++){let k=e.readFloat(),M=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,W=e.readUnsignedByte()/255,se=e.readUnsignedByte()/255,te=e.readUnsignedByte()/255,oe=e.readUnsignedByte()/255;switch(e.readByte()){case Me:w.setStepped(L);break;case Ee:le(e,w,X++,L,0,b,k,y,M,1),le(e,w,X++,L,1,b,k,C,I,1),le(e,w,X++,L,2,b,k,A,W,1),le(e,w,X++,L,3,b,k,T,se,1),le(e,w,X++,L,4,b,k,E,te,1),le(e,w,X++,L,5,b,k,R,oe,1)}b=k,y=M,C=I,A=W,T=se,E=te,R=oe}s.push(w);break}case lr:{let x=new $t(p,e.readInt(!0),f),w=e.readFloat(),b=e.readUnsignedByte()/255;for(let y=0,C=0;x.setFrame(y,w,b),y!=v;y++){let A=e.readFloat(),T=e.readUnsignedByte()/255;switch(e.readByte()){case Me:x.setStepped(y);break;case Ee:le(e,x,C++,y,0,w,A,b,T,1)}w=A,b=T}s.push(x)}}}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0);for(let u=0,m=e.readInt(!0);u<m;u++){let g=e.readByte(),p=e.readInt(!0),v=e.readInt(!0);switch(g){case Gs:s.push(Be(e,new at(p,v,f),1));break;case Hs:s.push(Ti(e,new zt(p,v,f),n));break;case js:s.push(Be(e,new _t(p,v,f),n));break;case Zs:s.push(Be(e,new Wt(p,v,f),n));break;case Ks:s.push(Ti(e,new qt(p,v,f),1));break;case Js:s.push(Be(e,new Gt(p,v,f),1));break;case Qs:s.push(Be(e,new Ht(p,v,f),1));break;case $s:s.push(Ti(e,new jt(p,v,f),1));break;case er:s.push(Be(e,new Zt(p,v,f),1));break;case tr:s.push(Be(e,new Kt(p,v,f),1))}}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=e.readInt(!0),m=u-1,g=new si(u,e.readInt(!0),f),p=e.readFloat(),v=e.readFloat(),x=e.readFloat()*n;for(let w=0,b=0;g.setFrame(w,p,v,x,e.readByte(),e.readBoolean(),e.readBoolean()),w!=m;w++){let y=e.readFloat(),C=e.readFloat(),A=e.readFloat()*n;switch(e.readByte()){case Me:g.setStepped(w);break;case Ee:le(e,g,b++,w,0,p,y,v,C,1),le(e,g,b++,w,1,p,y,x,A,n)}p=y,v=C,x=A}s.push(g)}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=e.readInt(!0),m=u-1,g=new ri(u,e.readInt(!0),f),p=e.readFloat(),v=e.readFloat(),x=e.readFloat(),w=e.readFloat(),b=e.readFloat(),y=e.readFloat(),C=e.readFloat();for(let A=0,T=0;g.setFrame(A,p,v,x,w,b,y,C),A!=m;A++){let E=e.readFloat(),R=e.readFloat(),L=e.readFloat(),X=e.readFloat(),k=e.readFloat(),M=e.readFloat(),I=e.readFloat();switch(e.readByte()){case Me:g.setStepped(A);break;case Ee:le(e,g,T++,A,0,p,E,v,R,1),le(e,g,T++,A,1,p,E,x,L,1),le(e,g,T++,A,2,p,E,w,X,1),le(e,g,T++,A,3,p,E,b,k,1),le(e,g,T++,A,4,p,E,y,M,1),le(e,g,T++,A,5,p,E,C,I,1)}p=E,v=R,x=L,w=X,b=k,y=M,C=I}s.push(g)}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=i.pathConstraints[f];for(let m=0,g=e.readInt(!0);m<g;m++)switch(e.readByte()){case cr:s.push(Be(e,new ni(e.readInt(!0),e.readInt(!0),f),u.positionMode==0?n:1));break;case dr:s.push(Be(e,new ai(e.readInt(!0),e.readInt(!0),f),u.spacingMode==0||u.spacingMode==1?n:1));break;case fr:let p=new li(e.readInt(!0),e.readInt(!0),f),v=e.readFloat(),x=e.readFloat(),w=e.readFloat(),b=e.readFloat();for(let y=0,C=0,A=p.getFrameCount()-1;p.setFrame(y,v,x,w,b),y!=A;y++){let T=e.readFloat(),E=e.readFloat(),R=e.readFloat(),L=e.readFloat();switch(e.readByte()){case Me:p.setStepped(y);break;case Ee:le(e,p,C++,y,0,v,T,x,E,1),le(e,p,C++,y,1,v,T,w,R,1),le(e,p,C++,y,2,v,T,b,L,1)}v=T,x=E,w=R,b=L}s.push(p)}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=i.skins[e.readInt(!0)];for(let u=0,m=e.readInt(!0);u<m;u++){let g=e.readInt(!0);for(let p=0,v=e.readInt(!0);p<v;p++){let x=e.readStringRef();if(!x)throw new Error("attachmentName must not be null.");let w=f.getAttachment(g,x),b=e.readByte(),y=e.readInt(!0),C=y-1;switch(b){case or:{let A=w,T=A.bones,E=A.vertices,R=T?E.length/3*2:E.length,L=e.readInt(!0),X=new ii(y,L,g,A),k=e.readFloat();for(let M=0,I=0;;M++){let W,se=e.readInt(!0);if(se==0)W=T?B.newFloatArray(R):E;else{W=B.newFloatArray(R);let oe=e.readInt(!0);if(se+=oe,n==1)for(let re=oe;re<se;re++)W[re]=e.readFloat();else for(let re=oe;re<se;re++)W[re]=e.readFloat()*n;if(!T)for(let re=0,ce=W.length;re<ce;re++)W[re]+=E[re]}if(X.setFrame(M,k,W),M==C)break;let te=e.readFloat();switch(e.readByte()){case Me:X.setStepped(M);break;case Ee:le(e,X,I++,M,0,k,te,0,1,1)}k=te}s.push(X);break}case hr:{let A=new Je(y,g,w);for(let T=0;T<y;T++){let E=e.readFloat(),R=e.readInt32();A.setFrame(T,E,Ui[R&15],R>>4,e.readFloat())}s.push(A);break}}}}}let r=e.readInt(!0);if(r>0){let h=new qe(r),d=i.slots.length;for(let f=0;f<r;f++){let u=e.readFloat(),m=e.readInt(!0),g=B.newArray(d,0);for(let w=d-1;w>=0;w--)g[w]=-1;let p=B.newArray(d-m,0),v=0,x=0;for(let w=0;w<m;w++){let b=e.readInt(!0);for(;v!=b;)p[x++]=v++;g[v+e.readInt(!0)]=v++}for(;v<d;)p[x++]=v++;for(let w=d-1;w>=0;w--)g[w]==-1&&(g[w]=p[--x]);h.setFrame(f,u,g)}s.push(h)}let o=e.readInt(!0);if(o>0){let h=new lt(o);for(let d=0;d<o;d++){let f=e.readFloat(),u=i.events[e.readInt(!0)],m=new wi(f,u);m.intValue=e.readInt(!1),m.floatValue=e.readFloat(),m.stringValue=e.readBoolean()?e.readString():u.stringValue,m.data.audioPath&&(m.volume=e.readFloat(),m.balance=e.readFloat()),h.setFrame(d,m)}s.push(h)}let a=0;for(let h=0,d=s.length;h<d;h++)a=Math.max(a,s[h].getDuration());return new mt(t,s,a)}},os=class{constructor(e,t=new Array,i=0,s=new DataView(e.buffer)){this.strings=t,this.index=i,this.buffer=s}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),i=t&127;return t&128&&(t=this.readByte(),i|=(t&127)<<7,t&128&&(t=this.readByte(),i|=(t&127)<<14,t&128&&(t=this.readByte(),i|=(t&127)<<21,t&128&&(t=this.readByte(),i|=(t&127)<<28)))),e?i:i>>>1^-(i&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",i=0;for(let s=0;s<e;){let n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(n),s++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Ws=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}},qs=class{constructor(e=null,t=null){this.bones=e,this.vertices=t}},Ne=(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))(Ne||{});function Be(e,t,i){let s=e.readFloat(),n=e.readFloat()*i;for(let c=0,l=0,r=t.getFrameCount()-1;t.setFrame(c,s,n),c!=r;c++){let o=e.readFloat(),a=e.readFloat()*i;switch(e.readByte()){case Me:t.setStepped(c);break;case Ee:le(e,t,l++,c,0,s,o,n,a,i)}s=o,n=a}return t}function Ti(e,t,i){let s=e.readFloat(),n=e.readFloat()*i,c=e.readFloat()*i;for(let l=0,r=0,o=t.getFrameCount()-1;t.setFrame(l,s,n,c),l!=o;l++){let a=e.readFloat(),h=e.readFloat()*i,d=e.readFloat()*i;switch(e.readByte()){case Me:t.setStepped(l);break;case Ee:le(e,t,r++,l,0,s,a,n,h,i),le(e,t,r++,l,1,s,a,c,d,i)}s=a,n=h,c=d}return t}function le(e,t,i,s,n,c,l,r,o,a){t.setBezier(i,s,n,c,r,e.readFloat(),e.readFloat()*a,e.readFloat(),e.readFloat()*a,l,o)}var Gs=0,Hs=1,js=2,Zs=3,Ks=4,Js=5,Qs=6,$s=7,er=8,tr=9,ir=0,sr=1,rr=2,nr=3,ar=4,lr=5,or=0,hr=1,cr=0,dr=1,fr=2,Me=1,Ee=2,hs=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new nt(()=>B.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let i=this.boundingBoxes,s=this.polygons,n=this.polygonPool,c=e.slots,l=c.length;i.length=0,n.freeAll(s),s.length=0;for(let r=0;r<l;r++){let o=c[r];if(!o.bone.active)continue;let a=o.getAttachment();if(a instanceof pt){let h=a;i.push(h);let d=n.obtain();d.length!=h.worldVerticesLength&&(d=B.newFloatArray(h.worldVerticesLength)),s.push(d),h.computeWorldVertices(o,0,h.worldVerticesLength,d,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=this.polygons;for(let c=0,l=n.length;c<l;c++){let r=n[c],o=r;for(let a=0,h=r.length;a<h;a+=2){let d=o[a],f=o[a+1];e=Math.min(e,d),t=Math.min(t,f),i=Math.max(i,d),s=Math.max(s,f)}}this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,i,s){let n=this.minX,c=this.minY,l=this.maxX,r=this.maxY;if(e<=n&&i<=n||t<=c&&s<=c||e>=l&&i>=l||t>=r&&s>=r)return!1;let o=(s-t)/(i-e),a=o*(n-e)+t;if(a>c&&a<r||(a=o*(l-e)+t,a>c&&a<r))return!0;let h=(c-t)/o+e;return h>n&&h<l||(h=(r-t)/o+e,h>n&&h<l)}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,c=n-2,l=!1;for(let r=0;r<n;r+=2){let o=s[r+1],a=s[c+1];if(o<i&&a>=i||a<i&&o>=i){let h=s[r];h+(i-o)/(a-o)*(s[c]-h)<t&&(l=!l)}c=r}return l}intersectsSegment(e,t,i,s){let n=this.polygons;for(let c=0,l=n.length;c<l;c++)if(this.intersectsSegmentPolygon(n[c],e,t,i,s))return this.boundingBoxes[c];return null}intersectsSegmentPolygon(e,t,i,s,n){let c=e,l=e.length,r=t-s,o=i-n,a=t*n-i*s,h=c[l-2],d=c[l-1];for(let f=0;f<l;f+=2){let u=c[f],m=c[f+1],g=h*m-d*u,p=h-u,v=d-m,x=r*v-o*p,w=(a*p-r*g)/x;if((w>=h&&w<=u||w>=u&&w<=h)&&(w>=t&&w<=s||w>=s&&w<=t)){let b=(a*v-o*g)/x;if((b>=d&&b<=m||b>=m&&b<=d)&&(b>=i&&b<=n||b>=n&&b<=i))return!0}h=u,d=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},ye=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 l=0;l<i;l++)s[l]=l;let n=this.isConcaveArray;n.length=0;for(let l=0,r=i;l<r;++l)n[l]=ye.isConcave(l,i,t,s);let c=this.triangles;for(c.length=0;i>3;){let l=i-1,r=0,o=1;for(;;){e:if(!n[r]){let d=s[l]<<1,f=s[r]<<1,u=s[o]<<1,m=t[d],g=t[d+1],p=t[f],v=t[f+1],x=t[u],w=t[u+1];for(let b=(o+1)%i;b!=l;b=(b+1)%i){if(!n[b])continue;let y=s[b]<<1,C=t[y],A=t[y+1];if(ye.positiveArea(x,w,m,g,C,A)&&ye.positiveArea(m,g,p,v,C,A)&&ye.positiveArea(p,v,x,w,C,A))break e}break}if(o==0){do{if(!n[r])break;r--}while(r>0);break}l=r,r=o,o=(o+1)%i}c.push(s[(i+r-1)%i]),c.push(s[r]),c.push(s[(r+1)%i]),s.splice(r,1),n.splice(r,1),i--;let a=(i+r-1)%i,h=r==i?0:r;n[a]=ye.isConcave(a,i,t,s),n[h]=ye.isConcave(h,i,t,s)}return i==3&&(c.push(s[2]),c.push(s[0]),c.push(s[1])),c}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 c=this.polygonIndicesPool.obtain();c.length=0;let l=this.polygonPool.obtain();l.length=0;let r=-1,o=0;for(let a=0,h=t.length;a<h;a+=3){let d=t[a]<<1,f=t[a+1]<<1,u=t[a+2]<<1,m=i[d],g=i[d+1],p=i[f],v=i[f+1],x=i[u],w=i[u+1],b=!1;if(r==d){let y=l.length-4,C=ye.winding(l[y],l[y+1],l[y+2],l[y+3],x,w),A=ye.winding(x,w,l[0],l[1],l[2],l[3]);C==o&&A==o&&(l.push(x),l.push(w),c.push(u),b=!0)}b||(l.length>0?(s.push(l),n.push(c)):(this.polygonPool.free(l),this.polygonIndicesPool.free(c)),l=this.polygonPool.obtain(),l.length=0,l.push(m),l.push(g),l.push(p),l.push(v),l.push(x),l.push(w),c=this.polygonIndicesPool.obtain(),c.length=0,c.push(d),c.push(f),c.push(u),o=ye.winding(m,g,p,v,x,w),r=d)}l.length>0&&(s.push(l),n.push(c));for(let a=0,h=s.length;a<h;a++){if(c=n[a],c.length==0)continue;let d=c[0],f=c[c.length-1];l=s[a];let u=l.length-4,m=l[u],g=l[u+1],p=l[u+2],v=l[u+3],x=l[0],w=l[1],b=l[2],y=l[3],C=ye.winding(m,g,p,v,x,w);for(let A=0;A<h;A++){if(A==a)continue;let T=n[A];if(T.length!=3)continue;let E=T[0],R=T[1],L=T[2],X=s[A],k=X[X.length-2],M=X[X.length-1];if(E!=d||R!=f)continue;let I=ye.winding(m,g,p,v,k,M),W=ye.winding(k,M,x,w,b,y);I==C&&W==C&&(X.length=0,T.length=0,l.push(k),l.push(M),c.push(L),m=p,g=v,p=k,v=M,A=0)}}for(let a=s.length-1;a>=0;a--)l=s[a],l.length==0&&(s.splice(a,1),this.polygonPool.free(l),c=n[a],n.splice(a,1),this.polygonIndicesPool.free(c));return s}static isConcave(e,t,i,s){let n=s[(t+e-1)%t]<<1,c=s[e]<<1,l=s[(e+1)%t]<<1;return!this.positiveArea(i[n],i[n+1],i[c],i[c+1],i[l],i[l+1])}static positiveArea(e,t,i,s,n,c){return e*(c-s)+i*(t-c)+n*(s-t)>=0}static winding(e,t,i,s,n,c){let l=i-e,r=s-t;return n*r-c*l+l*t-e*r>=0?1:-1}},Mt=class{triangulator=new ye;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let i=t.worldVerticesLength,s=B.setArraySize(this.clippingPolygon,i);t.computeWorldVertices(e,0,i,s,0,2);let n=this.clippingPolygon;Mt.makeClockwise(n);let c=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let l=0,r=c.length;l<r;l++){let o=c[l];Mt.makeClockwise(o),o.push(o[0]),o.push(o[1])}return c.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,c,l,r){let o=this.clipOutput,a=this.clippedVertices,h=this.clippedTriangles,d=this.clippingPolygons,f=d.length,u=r?12:8,m=0;a.length=0,h.length=0;e:for(let g=0;g<s;g+=3){let p=i[g]<<1,v=e[p],x=e[p+1],w=n[p],b=n[p+1];p=i[g+1]<<1;let y=e[p],C=e[p+1],A=n[p],T=n[p+1];p=i[g+2]<<1;let E=e[p],R=e[p+1],L=n[p],X=n[p+1];for(let k=0;k<f;k++){let M=a.length;if(this.clip(v,x,y,C,E,R,d[k],o)){let I=o.length;if(I==0)continue;let W=C-R,se=E-y,te=v-E,oe=R-x,re=1/(W*te+se*(x-R)),ce=I>>1,ne=this.clipOutput,ie=B.setArraySize(a,M+ce*u);for(let be=0;be<I;be+=2){let Re=ne[be],xe=ne[be+1];ie[M]=Re,ie[M+1]=xe,ie[M+2]=c.r,ie[M+3]=c.g,ie[M+4]=c.b,ie[M+5]=c.a;let Ce=Re-E,Se=xe-R,Ue=(W*Ce+se*Se)*re,it=(oe*Ce+te*Se)*re,dt=1-Ue-it;ie[M+6]=w*Ue+A*it+L*dt,ie[M+7]=b*Ue+T*it+X*dt,r&&(ie[M+8]=l.r,ie[M+9]=l.g,ie[M+10]=l.b,ie[M+11]=l.a),M+=u}M=h.length;let fe=B.setArraySize(h,M+3*(ce-2));ce--;for(let be=1;be<ce;be++)fe[M]=m,fe[M+1]=m+be,fe[M+2]=m+be+1,M+=3;m+=ce+1}else{let I=B.setArraySize(a,M+3*u);I[M]=v,I[M+1]=x,I[M+2]=c.r,I[M+3]=c.g,I[M+4]=c.b,I[M+5]=c.a,r?(I[M+6]=w,I[M+7]=b,I[M+8]=l.r,I[M+9]=l.g,I[M+10]=l.b,I[M+11]=l.a,I[M+12]=y,I[M+13]=C,I[M+14]=c.r,I[M+15]=c.g,I[M+16]=c.b,I[M+17]=c.a,I[M+18]=A,I[M+19]=T,I[M+20]=l.r,I[M+21]=l.g,I[M+22]=l.b,I[M+23]=l.a,I[M+24]=E,I[M+25]=R,I[M+26]=c.r,I[M+27]=c.g,I[M+28]=c.b,I[M+29]=c.a,I[M+30]=L,I[M+31]=X,I[M+32]=l.r,I[M+33]=l.g,I[M+34]=l.b,I[M+35]=l.a):(I[M+6]=w,I[M+7]=b,I[M+8]=y,I[M+9]=C,I[M+10]=c.r,I[M+11]=c.g,I[M+12]=c.b,I[M+13]=c.a,I[M+14]=A,I[M+15]=T,I[M+16]=E,I[M+17]=R,I[M+18]=c.r,I[M+19]=c.g,I[M+20]=c.b,I[M+21]=c.a,I[M+22]=L,I[M+23]=X),M=h.length;let W=B.setArraySize(h,M+3);W[M]=m,W[M+1]=m+1,W[M+2]=m+2,m+=3;continue e}}}}clip(e,t,i,s,n,c,l,r){let o=r,a=!1,h;l.length%4>=2?(h=r,r=this.scratch):h=this.scratch,h.length=0,h.push(e),h.push(t),h.push(i),h.push(s),h.push(n),h.push(c),h.push(e),h.push(t),r.length=0;let d=l,f=l.length-4;for(let u=0;;u+=2){let m=d[u],g=d[u+1],p=d[u+2],v=d[u+3],x=m-p,w=g-v,b=h,y=h.length-2,C=r.length;for(let T=0;T<y;T+=2){let E=b[T],R=b[T+1],L=b[T+2],X=b[T+3],k=x*(X-v)-w*(L-p)>0;if(x*(R-v)-w*(E-p)>0){if(k){r.push(L),r.push(X);continue}let M=X-R,I=L-E,W=M*(p-m)-I*(v-g);if(Math.abs(W)>1e-6){let se=(I*(g-R)-M*(m-E))/W;r.push(m+(p-m)*se),r.push(g+(v-g)*se)}else r.push(m),r.push(g)}else if(k){let M=X-R,I=L-E,W=M*(p-m)-I*(v-g);if(Math.abs(W)>1e-6){let se=(I*(g-R)-M*(m-E))/W;r.push(m+(p-m)*se),r.push(g+(v-g)*se)}else r.push(m),r.push(g);r.push(L),r.push(X)}a=!0}if(C==r.length)return o.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==f)break;let A=r;r=h,r.length=0,h=A}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 a}static makeClockwise(e){let t=e,i=e.length,s=t[i-2]*t[1]-t[0]*t[i-1],n=0,c=0,l=0,r=0;for(let o=0,a=i-3;o<a;o+=2)n=t[o],c=t[o+1],l=t[o+2],r=t[o+3],s+=n*r-l*c;if(!(s<0))for(let o=0,a=i-2,h=i>>1;o<h;o+=2){let d=t[o],f=t[o+1],u=a-o;t[o]=t[u],t[o+1]=t[u+1],t[u]=d,t[u+1]=f}}},ur=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new yi,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.fps=n.fps,i.imagesPath=n.images),s.bones)for(let c=0;c<s.bones.length;c++){let l=s.bones[c],r=null,o=Y(l,"parent",null);o&&(r=i.findBone(o));let a=new mi(i.bones.length,l.name,r);a.length=Y(l,"length",0)*t,a.x=Y(l,"x",0)*t,a.y=Y(l,"y",0)*t,a.rotation=Y(l,"rotation",0),a.scaleX=Y(l,"scaleX",1),a.scaleY=Y(l,"scaleY",1),a.shearX=Y(l,"shearX",0),a.shearY=Y(l,"shearY",0),a.transformMode=B.enumValue(yt,Y(l,"transform","Normal")),a.skinRequired=Y(l,"skin",!1);let h=Y(l,"color",null);h&&a.color.setFromString(h),i.bones.push(a)}if(s.slots)for(let c=0;c<s.slots.length;c++){let l=s.slots[c],r=i.findBone(l.bone);if(!r)throw new Error(`Couldn't find bone ${l.bone} for slot ${l.name}`);let o=new Ci(i.slots.length,l.name,r),a=Y(l,"color",null);a&&o.color.setFromString(a);let h=Y(l,"dark",null);h&&(o.darkColor=D.fromString(h)),o.attachmentName=Y(l,"attachment",null),o.blendMode=B.enumValue(Yt,Y(l,"blend","normal")),i.slots.push(o)}if(s.ik)for(let c=0;c<s.ik.length;c++){let l=s.ik[c],r=new pi(l.name);r.order=Y(l,"order",0),r.skinRequired=Y(l,"skin",!1);for(let a=0;a<l.bones.length;a++){let h=i.findBone(l.bones[a]);if(!h)throw new Error(`Couldn't find bone ${l.bones[a]} for IK constraint ${l.name}.`);r.bones.push(h)}let o=i.findBone(l.target);if(!o)throw new Error(`Couldn't find target bone ${l.target} for IK constraint ${l.name}.`);r.target=o,r.mix=Y(l,"mix",1),r.softness=Y(l,"softness",0)*t,r.bendDirection=Y(l,"bendPositive",!0)?1:-1,r.compress=Y(l,"compress",!1),r.stretch=Y(l,"stretch",!1),r.uniform=Y(l,"uniform",!1),i.ikConstraints.push(r)}if(s.transform)for(let c=0;c<s.transform.length;c++){let l=s.transform[c],r=new Si(l.name);r.order=Y(l,"order",0),r.skinRequired=Y(l,"skin",!1);for(let h=0;h<l.bones.length;h++){let d=l.bones[h],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${l.name}.`);r.bones.push(f)}let o=l.target,a=i.findBone(o);if(!a)throw new Error(`Couldn't find target bone ${o} for transform constraint ${l.name}.`);r.target=a,r.local=Y(l,"local",!1),r.relative=Y(l,"relative",!1),r.offsetRotation=Y(l,"rotation",0),r.offsetX=Y(l,"x",0)*t,r.offsetY=Y(l,"y",0)*t,r.offsetScaleX=Y(l,"scaleX",0),r.offsetScaleY=Y(l,"scaleY",0),r.offsetShearY=Y(l,"shearY",0),r.mixRotate=Y(l,"mixRotate",1),r.mixX=Y(l,"mixX",1),r.mixY=Y(l,"mixY",r.mixX),r.mixScaleX=Y(l,"mixScaleX",1),r.mixScaleY=Y(l,"mixScaleY",r.mixScaleX),r.mixShearY=Y(l,"mixShearY",1),i.transformConstraints.push(r)}if(s.path)for(let c=0;c<s.path.length;c++){let l=s.path[c],r=new vi(l.name);r.order=Y(l,"order",0),r.skinRequired=Y(l,"skin",!1);for(let h=0;h<l.bones.length;h++){let d=l.bones[h],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${l.name}.`);r.bones.push(f)}let o=l.target,a=i.findSlot(o);if(!a)throw new Error(`Couldn't find target slot ${o} for path constraint ${l.name}.`);r.target=a,r.positionMode=B.enumValue(Ct,Y(l,"positionMode","Percent")),r.spacingMode=B.enumValue(St,Y(l,"spacingMode","Length")),r.rotateMode=B.enumValue(Tt,Y(l,"rotateMode","Tangent")),r.offsetRotation=Y(l,"rotation",0),r.position=Y(l,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=Y(l,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=Y(l,"mixRotate",1),r.mixX=Y(l,"mixX",1),r.mixY=Y(l,"mixY",r.mixX),i.pathConstraints.push(r)}if(s.skins)for(let c=0;c<s.skins.length;c++){let l=s.skins[c],r=new It(l.name);if(l.bones)for(let o=0;o<l.bones.length;o++){let a=l.bones[o],h=i.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${l.name}.`);r.bones.push(h)}if(l.ik)for(let o=0;o<l.ik.length;o++){let a=l.ik[o],h=i.findIkConstraint(a);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${l.name}.`);r.constraints.push(h)}if(l.transform)for(let o=0;o<l.transform.length;o++){let a=l.transform[o],h=i.findTransformConstraint(a);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${l.name}.`);r.constraints.push(h)}if(l.path)for(let o=0;o<l.path.length;o++){let a=l.path[o],h=i.findPathConstraint(a);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${l.name}.`);r.constraints.push(h)}for(let o in l.attachments){let a=i.findSlot(o);if(!a)throw new Error(`Couldn't find slot ${o} for skin ${l.name}.`);let h=l.attachments[o];for(let d in h){let f=this.readAttachment(h[d],r,a.index,d,i);f&&r.setAttachment(a.index,d,f)}}i.skins.push(r),r.name=="default"&&(i.defaultSkin=r)}for(let c=0,l=this.linkedMeshes.length;c<l;c++){let r=this.linkedMeshes[c],o=r.skin?i.findSkin(r.skin):i.defaultSkin;if(!o)throw new Error(`Skin not found: ${r.skin}`);let a=o.getAttachment(r.slotIndex,r.parent);if(!a)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?a:r.mesh,r.mesh.setParentMesh(a),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,s.events)for(let c in s.events){let l=s.events[c],r=new bi(c);r.intValue=Y(l,"int",0),r.floatValue=Y(l,"float",0),r.stringValue=Y(l,"string",""),r.audioPath=Y(l,"audio",null),r.audioPath&&(r.volume=Y(l,"volume",1),r.balance=Y(l,"balance",0)),i.events.push(r)}if(s.animations)for(let c in s.animations){let l=s.animations[c];this.readAnimation(l,c,i)}return i}readAttachment(e,t,i,s,n){let c=this.scale;switch(s=Y(e,"name",s),Y(e,"type","region")){case"region":{let l=Y(e,"path",s),r=this.readSequence(Y(e,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(t,s,l,r);if(!o)return null;o.path=l,o.x=Y(e,"x",0)*c,o.y=Y(e,"y",0)*c,o.scaleX=Y(e,"scaleX",1),o.scaleY=Y(e,"scaleY",1),o.rotation=Y(e,"rotation",0),o.width=e.width*c,o.height=e.height*c,o.sequence=r;let a=Y(e,"color",null);return a&&o.color.setFromString(a),o.region!=null&&o.updateRegion(),o}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(t,s);if(!l)return null;this.readVertices(e,l,e.vertexCount<<1);let r=Y(e,"color",null);return r&&l.color.setFromString(r),l}case"mesh":case"linkedmesh":{let l=Y(e,"path",s),r=this.readSequence(Y(e,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(t,s,l,r);if(!o)return null;o.path=l;let a=Y(e,"color",null);a&&o.color.setFromString(a),o.width=Y(e,"width",0)*c,o.height=Y(e,"height",0)*c,o.sequence=r;let h=Y(e,"parent",null);if(h)return this.linkedMeshes.push(new mr(o,Y(e,"skin",null),i,h,Y(e,"timelines",!0))),o;let d=e.uvs;return this.readVertices(e,o,d.length),o.triangles=e.triangles,o.regionUVs=d,o.region!=null&&o.updateRegion(),o.edges=Y(e,"edges",null),o.hullLength=Y(e,"hull",0)*2,o}case"path":{let l=this.attachmentLoader.newPathAttachment(t,s);if(!l)return null;l.closed=Y(e,"closed",!1),l.constantSpeed=Y(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,l,r<<1);let o=B.newArray(r/3,0);for(let h=0;h<e.lengths.length;h++)o[h]=e.lengths[h]*c;l.lengths=o;let a=Y(e,"color",null);return a&&l.color.setFromString(a),l}case"point":{let l=this.attachmentLoader.newPointAttachment(t,s);if(!l)return null;l.x=Y(e,"x",0)*c,l.y=Y(e,"y",0)*c,l.rotation=Y(e,"rotation",0);let r=Y(e,"color",null);return r&&l.color.setFromString(r),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(t,s);if(!l)return null;let r=Y(e,"end",null);r&&(l.endSlot=n.findSlot(r));let o=e.vertexCount;this.readVertices(e,l,o<<1);let a=Y(e,"color",null);return a&&l.color.setFromString(a),l}}return null}readSequence(e){if(e==null)return null;let t=new Ut(Y(e,"count",0));return t.start=Y(e,"start",1),t.digits=Y(e,"digits",0),t.setupIndex=Y(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=B.toFloatArray(n);if(s!=1)for(let o=0,a=n.length;o<a;o++)r[o]*=s;t.vertices=r;return}let c=new Array,l=new Array;for(let r=0,o=n.length;r<o;){let a=n[r++];l.push(a);for(let h=r+a*4;r<h;r+=4)l.push(n[r]),c.push(n[r+1]*s),c.push(n[r+2]*s),c.push(n[r+3])}t.bones=l,t.vertices=B.toFloatArray(c)}readAnimation(e,t,i){let s=this.scale,n=new Array;if(e.slots)for(let l in e.slots){let r=e.slots[l],o=i.findSlot(l);if(!o)throw new Error("Slot not found: "+l);let a=o.index;for(let h in r){let d=r[h];if(!d)continue;let f=d.length;if(h=="attachment"){let u=new We(f,a);for(let m=0;m<f;m++){let g=d[m];u.setFrame(m,Y(g,"time",0),Y(g,"name",null))}n.push(u)}else if(h=="rgba"){let u=new Jt(f,f<<2,a),m=d[0],g=Y(m,"time",0),p=D.fromString(m.color);for(let v=0,x=0;;v++){u.setFrame(v,g,p.r,p.g,p.b,p.a);let w=d[v+1];if(!w){u.shrink(x);break}let b=Y(w,"time",0),y=D.fromString(w.color),C=m.curve;C&&(x=he(C,u,x,v,0,g,b,p.r,y.r,1),x=he(C,u,x,v,1,g,b,p.g,y.g,1),x=he(C,u,x,v,2,g,b,p.b,y.b,1),x=he(C,u,x,v,3,g,b,p.a,y.a,1)),g=b,p=y,m=w}n.push(u)}else if(h=="rgb"){let u=new Qt(f,f*3,a),m=d[0],g=Y(m,"time",0),p=D.fromString(m.color);for(let v=0,x=0;;v++){u.setFrame(v,g,p.r,p.g,p.b);let w=d[v+1];if(!w){u.shrink(x);break}let b=Y(w,"time",0),y=D.fromString(w.color),C=m.curve;C&&(x=he(C,u,x,v,0,g,b,p.r,y.r,1),x=he(C,u,x,v,1,g,b,p.g,y.g,1),x=he(C,u,x,v,2,g,b,p.b,y.b,1)),g=b,p=y,m=w}n.push(u)}else if(h=="alpha")n.push(Fe(d,new $t(f,f,a),0,1));else if(h=="rgba2"){let u=new ei(f,f*7,a),m=d[0],g=Y(m,"time",0),p=D.fromString(m.light),v=D.fromString(m.dark);for(let x=0,w=0;;x++){u.setFrame(x,g,p.r,p.g,p.b,p.a,v.r,v.g,v.b);let b=d[x+1];if(!b){u.shrink(w);break}let y=Y(b,"time",0),C=D.fromString(b.light),A=D.fromString(b.dark),T=m.curve;T&&(w=he(T,u,w,x,0,g,y,p.r,C.r,1),w=he(T,u,w,x,1,g,y,p.g,C.g,1),w=he(T,u,w,x,2,g,y,p.b,C.b,1),w=he(T,u,w,x,3,g,y,p.a,C.a,1),w=he(T,u,w,x,4,g,y,v.r,A.r,1),w=he(T,u,w,x,5,g,y,v.g,A.g,1),w=he(T,u,w,x,6,g,y,v.b,A.b,1)),g=y,p=C,v=A,m=b}n.push(u)}else if(h=="rgb2"){let u=new ti(f,f*6,a),m=d[0],g=Y(m,"time",0),p=D.fromString(m.light),v=D.fromString(m.dark);for(let x=0,w=0;;x++){u.setFrame(x,g,p.r,p.g,p.b,v.r,v.g,v.b);let b=d[x+1];if(!b){u.shrink(w);break}let y=Y(b,"time",0),C=D.fromString(b.light),A=D.fromString(b.dark),T=m.curve;T&&(w=he(T,u,w,x,0,g,y,p.r,C.r,1),w=he(T,u,w,x,1,g,y,p.g,C.g,1),w=he(T,u,w,x,2,g,y,p.b,C.b,1),w=he(T,u,w,x,3,g,y,v.r,A.r,1),w=he(T,u,w,x,4,g,y,v.g,A.g,1),w=he(T,u,w,x,5,g,y,v.b,A.b,1)),g=y,p=C,v=A,m=b}n.push(u)}}}if(e.bones)for(let l in e.bones){let r=e.bones[l],o=i.findBone(l);if(!o)throw new Error("Bone not found: "+l);let a=o.index;for(let h in r){let d=r[h],f=d.length;if(f!=0){if(h==="rotate")n.push(Fe(d,new at(f,f,a),0,1));else if(h==="translate"){let u=new zt(f,f<<1,a);n.push(Ii(d,u,"x","y",0,s))}else if(h==="translatex"){let u=new _t(f,f,a);n.push(Fe(d,u,0,s))}else if(h==="translatey"){let u=new Wt(f,f,a);n.push(Fe(d,u,0,s))}else if(h==="scale"){let u=new qt(f,f<<1,a);n.push(Ii(d,u,"x","y",1,1))}else if(h==="scalex"){let u=new Gt(f,f,a);n.push(Fe(d,u,1,1))}else if(h==="scaley"){let u=new Ht(f,f,a);n.push(Fe(d,u,1,1))}else if(h==="shear"){let u=new jt(f,f<<1,a);n.push(Ii(d,u,"x","y",0,1))}else if(h==="shearx"){let u=new Zt(f,f,a);n.push(Fe(d,u,0,1))}else if(h==="sheary"){let u=new Kt(f,f,a);n.push(Fe(d,u,0,1))}}}}if(e.ik)for(let l in e.ik){let r=e.ik[l],o=r[0];if(!o)continue;let a=i.findIkConstraint(l);if(!a)throw new Error("IK Constraint not found: "+l);let h=i.ikConstraints.indexOf(a),d=new si(r.length,r.length<<1,h),f=Y(o,"time",0),u=Y(o,"mix",1),m=Y(o,"softness",0)*s;for(let g=0,p=0;;g++){d.setFrame(g,f,u,m,Y(o,"bendPositive",!0)?1:-1,Y(o,"compress",!1),Y(o,"stretch",!1));let v=r[g+1];if(!v){d.shrink(p);break}let x=Y(v,"time",0),w=Y(v,"mix",1),b=Y(v,"softness",0)*s,y=o.curve;y&&(p=he(y,d,p,g,0,f,x,u,w,1),p=he(y,d,p,g,1,f,x,m,b,s)),f=x,u=w,m=b,o=v}n.push(d)}if(e.transform)for(let l in e.transform){let r=e.transform[l],o=r[0];if(!o)continue;let a=i.findTransformConstraint(l);if(!a)throw new Error("Transform constraint not found: "+l);let h=i.transformConstraints.indexOf(a),d=new ri(r.length,r.length*6,h),f=Y(o,"time",0),u=Y(o,"mixRotate",1),m=Y(o,"mixX",1),g=Y(o,"mixY",m),p=Y(o,"mixScaleX",1),v=Y(o,"mixScaleY",p),x=Y(o,"mixShearY",1);for(let w=0,b=0;;w++){d.setFrame(w,f,u,m,g,p,v,x);let y=r[w+1];if(!y){d.shrink(b);break}let C=Y(y,"time",0),A=Y(y,"mixRotate",1),T=Y(y,"mixX",1),E=Y(y,"mixY",T),R=Y(y,"mixScaleX",1),L=Y(y,"mixScaleY",R),X=Y(y,"mixShearY",1),k=o.curve;k&&(b=he(k,d,b,w,0,f,C,u,A,1),b=he(k,d,b,w,1,f,C,m,T,1),b=he(k,d,b,w,2,f,C,g,E,1),b=he(k,d,b,w,3,f,C,p,R,1),b=he(k,d,b,w,4,f,C,v,L,1),b=he(k,d,b,w,5,f,C,x,X,1)),f=C,u=A,m=T,g=E,p=R,v=L,p=R,o=y}n.push(d)}if(e.path)for(let l in e.path){let r=e.path[l],o=i.findPathConstraint(l);if(!o)throw new Error("Path constraint not found: "+l);let a=i.pathConstraints.indexOf(o);for(let h in r){let d=r[h],f=d[0];if(!f)continue;let u=d.length;if(h==="position"){let m=new ni(u,u,a);n.push(Fe(d,m,0,o.positionMode==0?s:1))}else if(h==="spacing"){let m=new ai(u,u,a);n.push(Fe(d,m,0,o.spacingMode==0||o.spacingMode==1?s:1))}else if(h==="mix"){let m=new li(u,u*3,a),g=Y(f,"time",0),p=Y(f,"mixRotate",1),v=Y(f,"mixX",1),x=Y(f,"mixY",v);for(let w=0,b=0;;w++){m.setFrame(w,g,p,v,x);let y=d[w+1];if(!y){m.shrink(b);break}let C=Y(y,"time",0),A=Y(y,"mixRotate",1),T=Y(y,"mixX",1),E=Y(y,"mixY",T),R=f.curve;R&&(b=he(R,m,b,w,0,g,C,p,A,1),b=he(R,m,b,w,1,g,C,v,T,1),b=he(R,m,b,w,2,g,C,x,E,1)),g=C,p=A,v=T,x=E,f=y}n.push(m)}}}if(e.attachments)for(let l in e.attachments){let r=e.attachments[l],o=i.findSkin(l);if(!o)throw new Error("Skin not found: "+l);for(let a in r){let h=r[a],d=i.findSlot(a);if(!d)throw new Error("Slot not found: "+a);let f=d.index;for(let u in h){let m=h[u],g=o.getAttachment(f,u);for(let p in m){let v=m[p],x=v[0];if(x){if(p=="deform"){let w=g.bones,b=g.vertices,y=w?b.length/3*2:b.length,C=new ii(v.length,v.length,f,g),A=Y(x,"time",0);for(let T=0,E=0;;T++){let R,L=Y(x,"vertices",null);if(!L)R=w?B.newFloatArray(y):b;else{R=B.newFloatArray(y);let I=Y(x,"offset",0);if(B.arrayCopy(L,0,R,I,L.length),s!=1)for(let W=I,se=W+L.length;W<se;W++)R[W]*=s;if(!w)for(let W=0;W<y;W++)R[W]+=b[W]}C.setFrame(T,A,R);let X=v[T+1];if(!X){C.shrink(E);break}let k=Y(X,"time",0),M=x.curve;M&&(E=he(M,C,E,T,0,A,k,0,1,1)),A=k,x=X}n.push(C)}else if(p=="sequence"){let w=new Je(v.length,f,g),b=0;for(let y=0;y<v.length;y++){let C=Y(x,"delay",b),A=Y(x,"time",0),T=Ni[Y(x,"mode","hold")],E=Y(x,"index",0);w.setFrame(y,A,T,E,C),b=C,x=v[y+1]}n.push(w)}}}}}}if(e.drawOrder){let l=new qe(e.drawOrder.length),r=i.slots.length,o=0;for(let a=0;a<e.drawOrder.length;a++,o++){let h=e.drawOrder[a],d=null,f=Y(h,"offsets",null);if(f){d=B.newArray(r,-1);let u=B.newArray(r-f.length,0),m=0,g=0;for(let p=0;p<f.length;p++){let v=f[p],x=i.findSlot(v.slot);if(!x)throw new Error("Slot not found: "+x);let w=x.index;for(;m!=w;)u[g++]=m++;d[m+v.offset]=m++}for(;m<r;)u[g++]=m++;for(let p=r-1;p>=0;p--)d[p]==-1&&(d[p]=u[--g])}l.setFrame(o,Y(h,"time",0),d)}n.push(l)}if(e.events){let l=new lt(e.events.length),r=0;for(let o=0;o<e.events.length;o++,r++){let a=e.events[o],h=i.findEvent(a.name);if(!h)throw new Error("Event not found: "+a.name);let d=new wi(B.toSinglePrecision(Y(a,"time",0)),h);d.intValue=Y(a,"int",h.intValue),d.floatValue=Y(a,"float",h.floatValue),d.stringValue=Y(a,"string",h.stringValue),d.data.audioPath&&(d.volume=Y(a,"volume",1),d.balance=Y(a,"balance",0)),l.setFrame(r,d)}n.push(l)}let c=0;for(let l=0,r=n.length;l<r;l++)c=Math.max(c,n[l].getDuration());i.animations.push(new mt(t,n,c))}},mr=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 Fe(e,t,i,s){let n=e[0],c=Y(n,"time",0),l=Y(n,"value",i)*s,r=0;for(let o=0;;o++){t.setFrame(o,c,l);let a=e[o+1];if(!a)return t.shrink(r),t;let h=Y(a,"time",0),d=Y(a,"value",i)*s;n.curve&&(r=he(n.curve,t,r,o,0,c,h,l,d,s)),c=h,l=d,n=a}}function Ii(e,t,i,s,n,c){let l=e[0],r=Y(l,"time",0),o=Y(l,i,n)*c,a=Y(l,s,n)*c,h=0;for(let d=0;;d++){t.setFrame(d,r,o,a);let f=e[d+1];if(!f)return t.shrink(h),t;let u=Y(f,"time",0),m=Y(f,i,n)*c,g=Y(f,s,n)*c,p=l.curve;p&&(h=he(p,t,h,d,0,r,u,o,m,c),h=he(p,t,h,d,1,r,u,a,g,c)),r=u,o=m,a=g,l=f}}function he(e,t,i,s,n,c,l,r,o,a){if(e=="stepped")return t.setStepped(s),i;let h=n<<2,d=e[h],f=e[h+1]*a,u=e[h+2],m=e[h+3]*a;return t.setBezier(i,s,n,c,r,d,f,u,m,l,o),i+1}function Y(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 we=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,c=this.restorables.length;n<c;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)}},Et=class extends di{context;texture=null;boundUnit=0;useMipMaps=!1;constructor(e,t,i=!1){super(t),this.context=e instanceof we?e:new we(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,Et.validateMagFilter(t)),this.useMipMaps=Et.usesMipMaps(e),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(e){switch(e){case 9987:case 9987:case 9985:case 9986:case 9984:return 9729;default:return e}}static usesMipMaps(e){switch(e){case 9987: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(),Et.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)}},ht=Et;P(ht,"DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL",!1);var cs=class extends is{constructor(e,t="",i=new xi){super(s=>new ht(e,s),t,i)}},Ae=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[q]+this.z*t[G]+t[V],this.x*t[H]+this.y*t[N]+this.z*t[j]+t[U],this.x*t[Z]+this.y*t[K]+this.z*t[z]+t[_])}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[q]+this.z*t[G]+t[V])*i,(this.x*t[H]+this.y*t[N]+this.z*t[j]+t[U])*i,(this.x*t[Z]+this.y*t[K]+this.z*t[z]+t[_])*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,q=4,G=8,V=12,H=1,N=5,j=9,U=13,Z=2,K=6,z=10,_=14,Q=3,$=7,ee=11,J=15,ke=class{temp=new Float32Array(16);values=new Float32Array(16);constructor(){let e=this.values;e[O]=1,e[N]=1,e[z]=1,e[J]=1}set(e){return this.values.set(e),this}transpose(){let e=this.temp,t=this.values;return e[O]=t[O],e[q]=t[H],e[G]=t[Z],e[V]=t[Q],e[H]=t[q],e[N]=t[N],e[j]=t[K],e[U]=t[$],e[Z]=t[G],e[K]=t[j],e[z]=t[z],e[_]=t[ee],e[Q]=t[V],e[$]=t[U],e[ee]=t[_],e[J]=t[J],this.set(e)}identity(){let e=this.values;return e[O]=1,e[q]=0,e[G]=0,e[V]=0,e[H]=0,e[N]=1,e[j]=0,e[U]=0,e[Z]=0,e[K]=0,e[z]=1,e[_]=0,e[Q]=0,e[$]=0,e[ee]=0,e[J]=1,this}invert(){let e=this.values,t=this.temp,i=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e[j]*e[K]-e[q]*e[H]*e[z]+e[O]*e[N]*e[z],e[O]=t[O]*s,e[q]=t[q]*s,e[G]=t[G]*s,e[V]=t[V]*s,e[H]=t[H]*s,e[N]=t[N]*s,e[j]=t[j]*s,e[U]=t[U]*s,e[Z]=t[Z]*s,e[K]=t[K]*s,e[z]=t[z]*s,e[_]=t[_]*s,e[Q]=t[Q]*s,e[$]=t[$]*s,e[ee]=t[ee]*s,e[J]=t[J]*s,this}determinant(){let e=this.values;return e[Q]*e[K]*e[j]*e[V]-e[Z]*e[$]*e[j]*e[V]-e[Q]*e[N]*e[z]*e[V]+e[H]*e[$]*e[z]*e[V]+e[Z]*e[N]*e[ee]*e[V]-e[H]*e[K]*e[ee]*e[V]-e[Q]*e[K]*e[G]*e[U]+e[Z]*e[$]*e[G]*e[U]+e[Q]*e[q]*e[z]*e[U]-e[O]*e[$]*e[z]*e[U]-e[Z]*e[q]*e[ee]*e[U]+e[O]*e[K]*e[ee]*e[U]+e[Q]*e[N]*e[G]*e[_]-e[H]*e[$]*e[G]*e[_]-e[Q]*e[q]*e[j]*e[_]+e[O]*e[$]*e[j]*e[_]+e[H]*e[q]*e[ee]*e[_]-e[O]*e[N]*e[ee]*e[_]-e[Z]*e[N]*e[G]*e[J]+e[H]*e[K]*e[G]*e[J]+e[Z]*e[q]*e[j]*e[J]-e[O]*e[K]*e[j]*e[J]-e[H]*e[q]*e[z]*e[J]+e[O]*e[N]*e[z]*e[J]}translate(e,t,i){let s=this.values;return s[V]+=e,s[U]+=t,s[_]+=i,this}copy(){return new ke().set(this.values)}projection(e,t,i,s){this.identity();let n=1/Math.tan(i*(Math.PI/180)/2),c=(t+e)/(e-t),l=2*t*e/(e-t),r=this.values;return r[O]=n/s,r[H]=0,r[Z]=0,r[Q]=0,r[q]=0,r[N]=n,r[K]=0,r[$]=0,r[G]=0,r[j]=0,r[z]=c,r[ee]=-1,r[V]=0,r[U]=0,r[_]=l,r[J]=0,this}ortho2d(e,t,i,s){return this.ortho(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,s=e.values;return t[O]=s[O]*i[O]+s[q]*i[H]+s[G]*i[Z]+s[V]*i[Q],t[q]=s[O]*i[q]+s[q]*i[N]+s[G]*i[K]+s[V]*i[$],t[G]=s[O]*i[G]+s[q]*i[j]+s[G]*i[z]+s[V]*i[ee],t[V]=s[O]*i[V]+s[q]*i[U]+s[G]*i[_]+s[V]*i[J],t[H]=s[H]*i[O]+s[N]*i[H]+s[j]*i[Z]+s[U]*i[Q],t[N]=s[H]*i[q]+s[N]*i[N]+s[j]*i[K]+s[U]*i[$],t[j]=s[H]*i[G]+s[N]*i[j]+s[j]*i[z]+s[U]*i[ee],t[U]=s[H]*i[V]+s[N]*i[U]+s[j]*i[_]+s[U]*i[J],t[Z]=s[Z]*i[O]+s[K]*i[H]+s[z]*i[Z]+s[_]*i[Q],t[K]=s[Z]*i[q]+s[K]*i[N]+s[z]*i[K]+s[_]*i[$],t[z]=s[Z]*i[G]+s[K]*i[j]+s[z]*i[z]+s[_]*i[ee],t[_]=s[Z]*i[V]+s[K]*i[U]+s[z]*i[_]+s[_]*i[J],t[Q]=s[Q]*i[O]+s[$]*i[H]+s[ee]*i[Z]+s[J]*i[Q],t[$]=s[Q]*i[q]+s[$]*i[N]+s[ee]*i[K]+s[J]*i[$],t[ee]=s[Q]*i[G]+s[$]*i[j]+s[ee]*i[z]+s[J]*i[ee],t[J]=s[Q]*i[V]+s[$]*i[U]+s[ee]*i[_]+s[J]*i[J],this.set(this.temp)}lookAt(e,t,i){let s=ke.xAxis,n=ke.yAxis,c=ke.zAxis;c.setFrom(t).normalize(),s.setFrom(t).normalize(),s.cross(i).normalize(),n.setFrom(s).cross(c).normalize(),this.identity();let l=this.values;return l[O]=s.x,l[q]=s.y,l[G]=s.z,l[H]=n.x,l[N]=n.y,l[j]=n.z,l[Z]=-c.x,l[K]=-c.y,l[z]=-c.z,ke.tmpMatrix.identity(),ke.tmpMatrix.values[V]=-e.x,ke.tmpMatrix.values[U]=-e.y,ke.tmpMatrix.values[_]=-e.z,this.multiply(ke.tmpMatrix),this}},Pe=ke;P(Pe,"xAxis",new Ae),P(Pe,"yAxis",new Ae),P(Pe,"zAxis",new Ae),P(Pe,"tmpMatrix",new ke);var ds=class{position=new Ae(0,0,0);direction=new Ae(0,0,-1);up=new Ae(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new Pe;inverseProjectionView=new Pe;projection=new Pe;view=new Pe;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,c=this.viewportWidth,l=this.viewportHeight;e.ortho(n*(-c/2),n*(c/2),n*(-l/2),n*(l/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}},Yi=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=l=>{if(l instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=l.clientX-r.left,this.mouseY=l.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=l=>{if(l instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=l.clientX-r.left,this.mouseY=l.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=l=>{if(l instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=l.clientX-r.left,this.mouseY=l.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=l=>{l.preventDefault();let r=l.deltaY;l.deltaMode==WheelEvent.DOM_DELTA_LINE&&(r*=8),l.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(r*=24),this.listeners.map(o=>{o.wheel&&o.wheel(l.deltaY)})};e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",i,!0),e.addEventListener("mouseup",s,!0),e.addEventListener("wheel",n,!0),e.addEventListener("touchstart",l=>{if(!this.touch0||!this.touch1){var r=l.changedTouches;let o=r.item(0);if(!o)return;let a=e.getBoundingClientRect(),h=o.clientX-a.left,d=o.clientY-a.top,f=new fs(o.identifier,h,d);if(this.mouseX=h,this.mouseY=d,this.buttonDown=!0,!this.touch0)this.touch0=f,this.listeners.map(u=>{u.down&&u.down(f.x,f.y)});else if(!this.touch1){this.touch1=f;let u=this.touch1.x-this.touch0.x,m=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(u*u+m*m),this.listeners.map(g=>{g.zoom&&g.zoom(this.initialPinchDistance,this.initialPinchDistance)})}}l.preventDefault()},!1),e.addEventListener("touchmove",l=>{if(this.touch0){var r=l.changedTouches;let h=e.getBoundingClientRect();for(var o=0;o<r.length;o++){var a=r[o];let d=a.clientX-h.left,f=a.clientY-h.top;this.touch0.identifier===a.identifier&&(this.touch0.x=this.mouseX=d,this.touch0.y=this.mouseY=f,this.listeners.map(u=>{u.dragged&&u.dragged(d,f)})),this.touch1&&this.touch1.identifier===a.identifier&&(this.touch1.x=this.mouseX=d,this.touch1.y=this.mouseY=f)}if(this.touch0&&this.touch1){let d=this.touch1.x-this.touch0.x,f=this.touch1.x-this.touch0.x,u=Math.sqrt(d*d+f*f);this.listeners.map(m=>{m.zoom&&m.zoom(this.initialPinchDistance,u)})}}l.preventDefault()},!1);let c=l=>{if(this.touch0){var r=l.changedTouches;let h=e.getBoundingClientRect();for(var o=0;o<r.length;o++){var a=r[o];let d=a.clientX-h.left,f=a.clientY-h.top;if(this.touch0.identifier===a.identifier)if(this.touch0=null,this.mouseX=d,this.mouseY=f,this.listeners.map(u=>{u.up&&u.up(d,f)}),this.touch1)this.touch0=this.touch1,this.touch1=null,this.mouseX=this.touch0.x,this.mouseX=this.touch0.x,this.buttonDown=!0,this.listeners.map(u=>{u.down&&u.down(this.touch0.x,this.touch0.y)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}l.preventDefault()};e.addEventListener("touchend",c,!1),e.addEventListener("touchcancel",c)}addListener(e){this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}},fs=class{constructor(e,t,i){this.identifier=e,this.x=t,this.y=i}},gr=class{constructor(e,t){this.canvas=e,this.camera=t;let i=0,s=0,n=0,c=0,l=0,r=0,o=0,a=0;new Yi(e).addListener({down:(h,d)=>{i=t.position.x,s=t.position.y,c=r=h,l=o=d,a=t.zoom},dragged:(h,d)=>{let f=h-c,u=d-l,m=t.screenToWorld(new Ae(0,0),e.clientWidth,e.clientHeight),g=t.screenToWorld(new Ae(f,u),e.clientWidth,e.clientHeight).sub(m);t.position.set(i-g.x,s-g.y,0),t.update(),r=h,o=d},wheel:h=>{let d=h/200*t.zoom,f=t.zoom+d;if(f>0){let u=0,m=0;if(h<0)u=r,m=o;else{let v=new Ae(e.clientWidth/2+15,e.clientHeight/2),x=r-v.x,w=e.clientHeight-1-o-v.y;u=v.x-x,m=e.clientHeight-1-v.y+w}let g=t.screenToWorld(new Ae(u,m),e.clientWidth,e.clientHeight);t.zoom=f,t.update();let p=t.screenToWorld(new Ae(u,m),e.clientWidth,e.clientHeight);t.position.add(g.sub(p)),t.update()}},zoom:(h,d)=>{let f=h/d;t.zoom=a*f},up:(h,d)=>{r=h,o=d},moved:(h,d)=>{r=h,o=d}})}},ue=class{constructor(e,t,i){this.vertexShader=t,this.fragmentShader=i,this.vsSource=t,this.fsSource=i,this.context=e instanceof we?e:new we(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=`
|
|
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}},xi=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 c=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(c))}catch(c){this.finish(e,400,JSON.stringify(c))}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 c=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(c))}catch(c){this.finish(e,400,JSON.stringify(c))}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 c=n.length-1,l=s.length;c<l;c+=2)s[c].apply(null,n)}},wi=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}},bi=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(e){this.name=e}},ss=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.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch,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}isActive(){return this.active}update(){if(this.mix==0)return;let e=this.target,t=this.bones;switch(t.length){case 1:this.apply1(t[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(t[0],t[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,i,s,n,c,l){let r=e.parent;if(!r)throw new Error("IK bone must have parent.");let o=r.a,a=r.b,h=r.c,d=r.d,f=-e.ashearX-e.arotation,u=0,m=0;switch(e.data.transformMode){case 1:u=(t-e.worldX)*F.signum(e.skeleton.scaleX),m=(i-e.worldY)*F.signum(e.skeleton.scaleY);break;case 2:let v=Math.abs(o*d-a*h)/Math.max(1e-4,o*o+h*h),x=o/e.skeleton.scaleX,w=h/e.skeleton.scaleY;a=-w*v*e.skeleton.scaleX,d=x*v*e.skeleton.scaleY,f+=Math.atan2(w,x)*F.radDeg;default:let b=t-r.worldX,y=i-r.worldY,C=o*d-a*h;Math.abs(C)<=1e-4?(u=0,m=0):(u=(b*d-y*a)/C-e.ax,m=(y*o-b*h)/C-e.ay)}f+=Math.atan2(m,u)*F.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=e.ascaleX,p=e.ascaleY;if(s||n){switch(e.data.transformMode){case 3:case 4:u=t-e.worldX,m=i-e.worldY}let v=e.data.length*g,x=Math.sqrt(u*u+m*m);if(s&&x<v||n&&x>v&&v>1e-4){let w=(x/v-1)*l+1;g*=w,c&&(p*=w)}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*l,g,p,e.ashearX,e.ashearY)}apply2(e,t,i,s,n,c,l,r,o){let a=e.ax,h=e.ay,d=e.ascaleX,f=e.ascaleY,u=d,m=f,g=t.ascaleX,p=0,v=0,x=0;d<0?(d=-d,p=180,x=-1):(p=0,x=1),f<0&&(f=-f,x=-x),g<0?(g=-g,v=180):v=0;let w=t.ax,b=0,y=0,C=0,A=e.a,T=e.b,E=e.c,R=e.d,L=Math.abs(d-f)<=1e-4;!L||c?(b=0,y=A*w+e.worldX,C=E*w+e.worldY):(b=t.ay,y=A*w+T*b+e.worldX,C=E*w+R*b+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");A=X.a,T=X.b,E=X.c,R=X.d;let k=A*R-T*E,M=y-X.worldX,I=C-X.worldY;k=Math.abs(k)<=1e-4?0:1/k;let W=(M*R-I*T)*k-a,se=(I*A-M*E)*k-h,te=Math.sqrt(W*W+se*se),oe=t.data.length*g,re,ce;if(te<1e-4){this.apply1(e,i,s,!1,c,!1,o),t.updateWorldTransformWith(w,b,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}M=i-X.worldX,I=s-X.worldY;let ne=(M*R-I*T)*k-a,ie=(I*A-M*E)*k-h,fe=ne*ne+ie*ie;if(r!=0){r*=d*(g+1)*.5;let xe=Math.sqrt(fe),Ce=xe-te-oe*d+r;if(Ce>0){let Se=Math.min(1,Ce/(r*2))-1;Se=(Ce-r*(1-Se*Se))/xe,ne-=Se*ne,ie-=Se*ie,fe=ne*ne+ie*ie}}e:if(L){oe*=d;let xe=(fe-te*te-oe*oe)/(2*te*oe);xe<-1?(xe=-1,ce=Math.PI*n):xe>1?(xe=1,ce=0,c&&(A=(Math.sqrt(fe)/(te+oe)-1)*o+1,u*=A,l&&(m*=A))):ce=Math.acos(xe)*n,A=te+oe*xe,T=oe*Math.sin(ce),re=Math.atan2(ie*A-ne*T,ne*A+ie*T)}else{A=d*oe,T=f*oe;let xe=A*A,Ce=T*T,Se=Math.atan2(ie,ne);E=Ce*te*te+xe*fe-xe*Ce;let Ue=-2*Ce*te,it=Ce-xe;if(R=Ue*Ue-4*it*E,R>=0){let st=Math.sqrt(R);Ue<0&&(st=-st),st=-(Ue+st)*.5;let Ts=st/it,Is=E/st,rt=Math.abs(Ts)<Math.abs(Is)?Ts:Is;if(rt*rt<=fe){I=Math.sqrt(fe-rt*rt)*n,re=Se-Math.atan2(I,rt),ce=Math.atan2(I/f,(rt-te)/d);break e}}let dt=F.PI,Pt=te-A,Li=Pt*Pt,As=0,Cs=0,Dt=te+A,Bi=Dt*Dt,Ss=0;E=-A*te/(xe-Ce),E>=-1&&E<=1&&(E=Math.acos(E),M=A*Math.cos(E)+te,I=T*Math.sin(E),R=M*M+I*I,R<Li&&(dt=E,Li=R,Pt=M,As=I),R>Bi&&(Cs=E,Bi=R,Dt=M,Ss=I)),fe<=(Li+Bi)*.5?(re=Se-Math.atan2(As*n,Pt),ce=dt*n):(re=Se-Math.atan2(Ss*n,Dt),ce=Cs*n)}let be=Math.atan2(b,w)*x,Re=e.arotation;re=(re-be)*F.radDeg+p-Re,re>180?re-=360:re<-180&&(re+=360),e.updateWorldTransformWith(a,h,Re+re*o,u,m,0,0),Re=t.arotation,ce=((ce+be)*F.radDeg-t.ashearX)*x+v-Re,ce>180?ce-=360:ce<-180&&(ce+=360),t.updateWorldTransformWith(w,b,Re+ce*o,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},pi=class extends At{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=1;compress=!1;stretch=!1;uniform=!1;mix=1;softness=0;constructor(e){super(e,0,!1)}},vi=class extends At{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=Ct.Fixed;spacingMode=St.Fixed;rotateMode=Tt.Chain;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},Ct=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Ct||{}),St=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(St||{}),Tt=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Tt||{}),Le=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 c=t.findBone(e.bones[s].name);if(!c)throw new Error(`Couldn't find bone ${e.bones[s].name}.`);this.bones.push(c)}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}update(){let e=this.target.getAttachment();if(!(e instanceof Ge))return;let t=this.mixRotate,i=this.mixX,s=this.mixY;if(t==0&&i==0&&s==0)return;let n=this.data,c=n.rotateMode==0,l=n.rotateMode==2,r=this.bones,o=r.length,a=c?o:o+1,h=B.setArraySize(this.spaces,a),d=l?this.lengths=B.setArraySize(this.lengths,o):[],f=this.spacing;switch(n.spacingMode){case 2:if(l)for(let b=0,y=a-1;b<y;b++){let C=r[b],A=C.data.length;if(A<Le.epsilon)d[b]=0;else{let T=A*C.a,E=A*C.c;d[b]=Math.sqrt(T*T+E*E)}}B.arrayFill(h,1,a,f);break;case 3:let x=0;for(let b=0,y=a-1;b<y;){let C=r[b],A=C.data.length;if(A<Le.epsilon)l&&(d[b]=0),h[++b]=f;else{let T=A*C.a,E=A*C.c,R=Math.sqrt(T*T+E*E);l&&(d[b]=R),h[++b]=R,x+=R}}if(x>0){x=a/x*f;for(let b=1;b<a;b++)h[b]*=x}break;default:let w=n.spacingMode==0;for(let b=0,y=a-1;b<y;){let C=r[b],A=C.data.length;if(A<Le.epsilon)l&&(d[b]=0),h[++b]=f;else{let T=A*C.a,E=A*C.c,R=Math.sqrt(T*T+E*E);l&&(d[b]=R),h[++b]=(w?A+f:f)*R/A}}}let u=this.computeWorldPositions(e,a,c),m=u[0],g=u[1],p=n.offsetRotation,v=!1;if(p==0)v=n.rotateMode==1;else{v=!1;let x=this.target.bone;p*=x.a*x.d-x.b*x.c>0?F.degRad:-F.degRad}for(let x=0,w=3;x<o;x++,w+=3){let b=r[x];b.worldX+=(m-b.worldX)*i,b.worldY+=(g-b.worldY)*s;let y=u[w],C=u[w+1],A=y-m,T=C-g;if(l){let E=d[x];if(E!=0){let R=(Math.sqrt(A*A+T*T)/E-1)*t+1;b.a*=R,b.c*=R}}if(m=y,g=C,t>0){let E=b.a,R=b.b,L=b.c,X=b.d,k=0,M=0,I=0;if(c?k=u[w-1]:h[x+1]==0?k=u[w+2]:k=Math.atan2(T,A),k-=Math.atan2(L,E),v){M=Math.cos(k),I=Math.sin(k);let W=b.data.length;m+=(W*(M*E-I*L)-A)*t,g+=(W*(I*E+M*L)-T)*t}else k+=p;k>F.PI?k-=F.PI2:k<-F.PI&&(k+=F.PI2),k*=t,M=Math.cos(k),I=Math.sin(k),b.a=M*E-I*L,b.b=M*R-I*X,b.c=I*E+M*L,b.d=I*R+M*X}b.updateAppliedTransform()}}computeWorldPositions(e,t,i){let s=this.target,n=this.position,c=this.spaces,l=B.setArraySize(this.positions,t*3+2),r=this.world,o=e.closed,a=e.worldVerticesLength,h=a/6,d=Le.NONE;if(!e.constantSpeed){let se=e.lengths;h-=o?1:2;let te=se[h];this.data.positionMode==1&&(n*=te);let oe;switch(this.data.spacingMode){case 2:oe=te;break;case 3:oe=te/t;break;default:oe=1}r=B.setArraySize(this.world,8);for(let re=0,ce=0,ne=0;re<t;re++,ce+=3){let ie=c[re]*oe;n+=ie;let fe=n;if(o)fe%=te,fe<0&&(fe+=te),ne=0;else if(fe<0){d!=Le.BEFORE&&(d=Le.BEFORE,e.computeWorldVertices(s,2,4,r,0,2)),this.addBeforePosition(fe,r,0,l,ce);continue}else if(fe>te){d!=Le.AFTER&&(d=Le.AFTER,e.computeWorldVertices(s,a-6,4,r,0,2)),this.addAfterPosition(fe-te,r,0,l,ce);continue}for(;;ne++){let be=se[ne];if(!(fe>be)){if(ne==0)fe/=be;else{let Re=se[ne-1];fe=(fe-Re)/(be-Re)}break}}ne!=d&&(d=ne,o&&ne==h?(e.computeWorldVertices(s,a-4,4,r,0,2),e.computeWorldVertices(s,0,4,r,4,2)):e.computeWorldVertices(s,ne*6+2,8,r,0,2)),this.addCurvePosition(fe,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],l,ce,i||re>0&&ie==0)}return l}o?(a+=2,r=B.setArraySize(this.world,a),e.computeWorldVertices(s,2,a-4,r,0,2),e.computeWorldVertices(s,0,2,r,a-4,2),r[a-2]=r[0],r[a-1]=r[1]):(h--,a-=4,r=B.setArraySize(this.world,a),e.computeWorldVertices(s,2,a,r,0,2));let f=B.setArraySize(this.curves,h),u=0,m=r[0],g=r[1],p=0,v=0,x=0,w=0,b=0,y=0,C=0,A=0,T=0,E=0,R=0,L=0,X=0,k=0;for(let se=0,te=2;se<h;se++,te+=6)p=r[te],v=r[te+1],x=r[te+2],w=r[te+3],b=r[te+4],y=r[te+5],C=(m-p*2+x)*.1875,A=(g-v*2+w)*.1875,T=((p-x)*3-m+b)*.09375,E=((v-w)*3-g+y)*.09375,R=C*2+T,L=A*2+E,X=(p-m)*.75+C+T*.16666667,k=(v-g)*.75+A+E*.16666667,u+=Math.sqrt(X*X+k*k),X+=R,k+=L,R+=T,L+=E,u+=Math.sqrt(X*X+k*k),X+=R,k+=L,u+=Math.sqrt(X*X+k*k),X+=R+T,k+=L+E,u+=Math.sqrt(X*X+k*k),f[se]=u,m=b,g=y;this.data.positionMode==1&&(n*=u);let M;switch(this.data.spacingMode){case 2:M=u;break;case 3:M=u/t;break;default:M=1}let I=this.segments,W=0;for(let se=0,te=0,oe=0,re=0;se<t;se++,te+=3){let ce=c[se]*M;n+=ce;let ne=n;if(o)ne%=u,ne<0&&(ne+=u),oe=0;else if(ne<0){this.addBeforePosition(ne,r,0,l,te);continue}else if(ne>u){this.addAfterPosition(ne-u,r,a-4,l,te);continue}for(;;oe++){let ie=f[oe];if(!(ne>ie)){if(oe==0)ne/=ie;else{let fe=f[oe-1];ne=(ne-fe)/(ie-fe)}break}}if(oe!=d){d=oe;let ie=oe*6;for(m=r[ie],g=r[ie+1],p=r[ie+2],v=r[ie+3],x=r[ie+4],w=r[ie+5],b=r[ie+6],y=r[ie+7],C=(m-p*2+x)*.03,A=(g-v*2+w)*.03,T=((p-x)*3-m+b)*.006,E=((v-w)*3-g+y)*.006,R=C*2+T,L=A*2+E,X=(p-m)*.3+C+T*.16666667,k=(v-g)*.3+A+E*.16666667,W=Math.sqrt(X*X+k*k),I[0]=W,ie=1;ie<8;ie++)X+=R,k+=L,R+=T,L+=E,W+=Math.sqrt(X*X+k*k),I[ie]=W;X+=R,k+=L,W+=Math.sqrt(X*X+k*k),I[8]=W,X+=R+T,k+=L+E,W+=Math.sqrt(X*X+k*k),I[9]=W,re=0}for(ne*=W;;re++){let ie=I[re];if(!(ne>ie)){if(re==0)ne/=ie;else{let fe=I[re-1];ne=re+(ne-fe)/(ie-fe)}break}}this.addCurvePosition(ne*.1,m,g,p,v,x,w,b,y,l,te,i||se>0&&ce==0)}return l}addBeforePosition(e,t,i,s,n){let c=t[i],l=t[i+1],r=t[i+2]-c,o=t[i+3]-l,a=Math.atan2(o,r);s[n]=c+e*Math.cos(a),s[n+1]=l+e*Math.sin(a),s[n+2]=a}addAfterPosition(e,t,i,s,n){let c=t[i+2],l=t[i+3],r=c-t[i],o=l-t[i+1],a=Math.atan2(o,r);s[n]=c+e*Math.cos(a),s[n+1]=l+e*Math.sin(a),s[n+2]=a}addCurvePosition(e,t,i,s,n,c,l,r,o,a,h,d){if(e==0||isNaN(e)){a[h]=t,a[h+1]=i,a[h+2]=Math.atan2(n-i,s-t);return}let f=e*e,u=f*e,m=1-e,g=m*m,p=g*m,v=m*e,x=v*3,w=m*x,b=x*e,y=t*p+s*w+c*b+r*u,C=i*p+n*w+l*b+o*u;a[h]=y,a[h+1]=C,d&&(e<.001?a[h+2]=Math.atan2(n-i,s-t):a[h+2]=Math.atan2(C-(i*g+n*v*2+l*f),y-(t*g+s*v*2+c*f)))}},Qe=Le;P(Qe,"NONE",-1),P(Qe,"BEFORE",-2),P(Qe,"AFTER",-3),P(Qe,"epsilon",1e-5);var rs=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 D,this.darkColor=e.darkColor?new D:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof Te)||!(this.attachment instanceof Te)||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}},ns=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new _e;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.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,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}isActive(){return this.active}update(){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,c=this.mixShearY,l=t!=0||i!=0,r=this.target,o=r.a,a=r.b,h=r.c,d=r.d,f=o*d-a*h>0?F.degRad:-F.degRad,u=this.data.offsetRotation*f,m=this.data.offsetShearY*f,g=this.bones;for(let p=0,v=g.length;p<v;p++){let x=g[p];if(e!=0){let w=x.a,b=x.b,y=x.c,C=x.d,A=Math.atan2(h,o)-Math.atan2(y,w)+u;A>F.PI?A-=F.PI2:A<-F.PI&&(A+=F.PI2),A*=e;let T=Math.cos(A),E=Math.sin(A);x.a=T*w-E*y,x.b=T*b-E*C,x.c=E*w+T*y,x.d=E*b+T*C}if(l){let w=this.temp;r.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(w.x-x.worldX)*t,x.worldY+=(w.y-x.worldY)*i}if(s!=0){let w=Math.sqrt(x.a*x.a+x.c*x.c);w!=0&&(w=(w+(Math.sqrt(o*o+h*h)-w+this.data.offsetScaleX)*s)/w),x.a*=w,x.c*=w}if(n!=0){let w=Math.sqrt(x.b*x.b+x.d*x.d);w!=0&&(w=(w+(Math.sqrt(a*a+d*d)-w+this.data.offsetScaleY)*n)/w),x.b*=w,x.d*=w}if(c>0){let w=x.b,b=x.d,y=Math.atan2(b,w),C=Math.atan2(d,a)-Math.atan2(h,o)-(y-Math.atan2(x.c,x.a));C>F.PI?C-=F.PI2:C<-F.PI&&(C+=F.PI2),C=y+(C+m)*c;let A=Math.sqrt(w*w+b*b);x.b=Math.cos(C)*A,x.d=Math.sin(C)*A}x.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,l=t!=0||i!=0,r=this.target,o=r.a,a=r.b,h=r.c,d=r.d,f=o*d-a*h>0?F.degRad:-F.degRad,u=this.data.offsetRotation*f,m=this.data.offsetShearY*f,g=this.bones;for(let p=0,v=g.length;p<v;p++){let x=g[p];if(e!=0){let w=x.a,b=x.b,y=x.c,C=x.d,A=Math.atan2(h,o)+u;A>F.PI?A-=F.PI2:A<-F.PI&&(A+=F.PI2),A*=e;let T=Math.cos(A),E=Math.sin(A);x.a=T*w-E*y,x.b=T*b-E*C,x.c=E*w+T*y,x.d=E*b+T*C}if(l){let w=this.temp;r.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),x.worldX+=w.x*t,x.worldY+=w.y*i}if(s!=0){let w=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleX)*s+1;x.a*=w,x.c*=w}if(n!=0){let w=(Math.sqrt(a*a+d*d)-1+this.data.offsetScaleY)*n+1;x.b*=w,x.d*=w}if(c>0){let w=Math.atan2(d,a)-Math.atan2(h,o);w>F.PI?w-=F.PI2:w<-F.PI&&(w+=F.PI2);let b=x.b,y=x.d;w=Math.atan2(y,b)+(w-F.PI/2+m)*c;let C=Math.sqrt(b*b+y*y);x.b=Math.cos(w)*C,x.d=Math.sin(w)*C}x.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,l=this.target,r=this.bones;for(let o=0,a=r.length;o<a;o++){let h=r[o],d=h.arotation;if(e!=0){let v=l.arotation-d+this.data.offsetRotation;v-=(16384-(16384.499999999996-v/360|0))*360,d+=v*e}let f=h.ax,u=h.ay;f+=(l.ax-f+this.data.offsetX)*t,u+=(l.ay-u+this.data.offsetY)*i;let m=h.ascaleX,g=h.ascaleY;s!=0&&m!=0&&(m=(m+(l.ascaleX-m+this.data.offsetScaleX)*s)/m),n!=0&&g!=0&&(g=(g+(l.ascaleY-g+this.data.offsetScaleY)*n)/g);let p=h.ashearY;if(c!=0){let v=l.ashearY-p+this.data.offsetShearY;v-=(16384-(16384.499999999996-v/360|0))*360,p+=v*c}h.updateWorldTransformWith(f,u,d,m,g,h.ashearX,p)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=this.mixScaleX,n=this.mixScaleY,c=this.mixShearY,l=this.target,r=this.bones;for(let o=0,a=r.length;o<a;o++){let h=r[o],d=h.arotation+(l.arotation+this.data.offsetRotation)*e,f=h.ax+(l.ax+this.data.offsetX)*t,u=h.ay+(l.ay+this.data.offsetY)*i,m=h.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*s+1),g=h.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*n+1),p=h.ashearY+(l.ashearY+this.data.offsetShearY)*c;h.updateWorldTransformWith(f,u,d,m,g,h.ashearX,p)}}},as=class{data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return as.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=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 gi(i,this,null);else{let n=this.bones[i.parent.index];s=new gi(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 rs(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 ss(i,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let i=e.transformConstraints[t];this.transformConstraints.push(new ns(i,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let i=e.pathConstraints[t];this.pathConstraints.push(new Qe(i,this))}this.color=new D(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let a=0,h=t.length;a<h;a++){let d=t[a];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin){let a=this.skin.bones;for(let h=0,d=this.skin.bones.length;h<d;h++){let f=this.bones[a[h].index];do f.sorted=!1,f.active=!0,f=f.parent;while(f)}}let i=this.ikConstraints,s=this.transformConstraints,n=this.pathConstraints,c=i.length,l=s.length,r=n.length,o=c+l+r;e:for(let a=0;a<o;a++){for(let h=0;h<c;h++){let d=i[h];if(d.data.order==a){this.sortIkConstraint(d);continue e}}for(let h=0;h<l;h++){let d=s[h];if(d.data.order==a){this.sortTransformConstraint(d);continue e}}for(let h=0;h<r;h++){let d=n[h];if(d.data.order==a){this.sortPathConstraint(d);continue e}}}for(let a=0,h=t.length;a<h;a++)this.sortBone(t[a])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&B.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&&B.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 Ge&&this.sortPathConstraintAttachmentWith(n,s);let c=e.bones,l=c.length;for(let r=0;r<l;r++)this.sortBone(c[r]);this._updateCache.push(e);for(let r=0;r<l;r++)this.sortReset(c[r].children);for(let r=0;r<l;r++)c[r].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&B.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 Ge))return;let i=e.bones;if(!i)this.sortBone(t);else{let s=this.bones;for(let n=0,c=i.length;n<c;){let l=i[n++];for(l+=n;n<l;)this.sortBone(s[i[n++]])}}}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(){let e=this.bones;for(let i=0,s=e.length;i<s;i++){let n=e[i];n.ax=n.x,n.ay=n.y,n.arotation=n.rotation,n.ascaleX=n.scaleX,n.ascaleY=n.scaleY,n.ashearX=n.shearX,n.ashearY=n.shearY}let t=this._updateCache;for(let i=0,s=t.length;i<s;i++)t[i].update()}updateWorldTransformWith(e){let t=this.getRootBone();if(!t)throw new Error("Root bone must not be null.");let i=e.a,s=e.b,n=e.c,c=e.d;t.worldX=i*this.x+s*this.y+e.worldX,t.worldY=n*this.x+c*this.y+e.worldY;let l=t.rotation+90+t.shearY,r=F.cosDeg(t.rotation+t.shearX)*t.scaleX,o=F.cosDeg(l)*t.scaleY,a=F.sinDeg(t.rotation+t.shearX)*t.scaleX,h=F.sinDeg(l)*t.scaleY;t.a=(i*r+s*a)*this.scaleX,t.b=(i*o+s*h)*this.scaleX,t.c=(n*r+c*a)*this.scaleY,t.d=(n*o+c*h)*this.scaleY;let d=this._updateCache;for(let f=0,u=d.length;f<u;f++){let m=d[f];m!=t&&m.update()}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){let e=this.bones;for(let n=0,c=e.length;n<c;n++)e[n].setToSetupPose();let t=this.ikConstraints;for(let n=0,c=t.length;n<c;n++){let l=t[n];l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}let i=this.transformConstraints;for(let n=0,c=i.length;n<c;n++){let l=i[n],r=l.data;l.mixRotate=r.mixRotate,l.mixX=r.mixX,l.mixY=r.mixY,l.mixScaleX=r.mixScaleX,l.mixScaleY=r.mixScaleY,l.mixShearY=r.mixShearY}let s=this.pathConstraints;for(let n=0,c=s.length;n<c;n++){let l=s[n],r=l.data;l.position=r.position,l.spacing=r.spacing,l.mixRotate=r.mixRotate,l.mixX=r.mixX,l.mixY=r.mixY}}setSlotsToSetupPose(){let e=this.slots;B.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],c=n.data.attachmentName;if(c){let l=e.getAttachment(i,c);l&&n.setAttachment(l)}}}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 c=i[s];if(c.data.name==e){let l=null;if(t&&(l=this.getAttachment(s,t),!l))throw new Error("Attachment not found: "+t+", for slot: "+e);c.setAttachment(l);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let t=this.ikConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.data.name==e)return n}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let t=this.transformConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.data.name==e)return n}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let t=this.pathConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.data.name==e)return n}return null}getBoundsRect(){let e=new _e,t=new _e;return this.getBounds(e,t),{x:e.x,y:e.y,width:t.x,height:t.y}}getBounds(e,t,i=new Array(2)){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let s=this.drawOrder,n=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let o=0,a=s.length;o<a;o++){let h=s[o];if(!h.bone.active)continue;let d=0,f=null,u=h.getAttachment();if(u instanceof ae)d=8,f=B.setArraySize(i,d,0),u.computeWorldVertices(h,f,0,2);else if(u instanceof Ve){let m=u;d=m.worldVerticesLength,f=B.setArraySize(i,d,0),m.computeWorldVertices(h,0,d,f,0,2)}if(f)for(let m=0,g=f.length;m<g;m+=2){let p=f[m],v=f[m+1];n=Math.min(n,p),c=Math.min(c,v),l=Math.max(l,p),r=Math.max(r,v)}}e.set(n,c),t.set(l-n,r-c)}},ls=as;P(ls,"yDown",!1);var yi=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;x=0;y=0;width=0;height=0;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.");let t=this.ikConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let t=this.transformConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");let t=this.pathConstraints;for(let i=0,s=t.length;i<s;i++){let n=t[i];if(n.name==e)return n}return null}},Ai=class{constructor(e=0,t,i){this.slotIndex=e,this.name=t,this.attachment=i}},It=class{name;attachments=new Array;bones=Array();constraints=new Array;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],c=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==n){c=!0;break}c||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){let n=e.constraints[s],c=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==n){c=!0;break}c||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],c=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==n){c=!0;break}c||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){let n=e.constraints[s],c=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==n){c=!0;break}c||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 Ve?(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 Ai(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 Ai(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],c=n.getAttachment();if(c&&i<t.attachments.length){let l=t.attachments[i];for(let r in l){let o=l[r];if(c==o){let a=this.getAttachment(i,r);a&&n.setAttachment(a);break}}}i++}}},Ci=class{index=0;name;boneData;color=new D(1,1,1,1);darkColor=null;attachmentName=null;blendMode=Yt.Normal;constructor(e,t,i){if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!i)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=i}},Yt=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Yt||{}),Si=class extends At{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)}},_s=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new yi;i.name="";let s=new os(e),n=s.readInt32(),c=s.readInt32();i.hash=c==0&&n==0?null:c.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();let l=s.readBoolean();l&&(i.fps=s.readFloat(),i.imagesPath=s.readString(),i.audioPath=s.readString());let r=0;r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("String in string table must not be null.");s.strings.push(h)}r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("Bone name must not be null.");let d=a==0?null:i.bones[s.readInt(!0)],f=new mi(a,h,d);f.rotation=s.readFloat(),f.x=s.readFloat()*t,f.y=s.readFloat()*t,f.scaleX=s.readFloat(),f.scaleY=s.readFloat(),f.shearX=s.readFloat(),f.shearY=s.readFloat(),f.length=s.readFloat()*t,f.transformMode=s.readInt(!0),f.skinRequired=s.readBoolean(),l&&D.rgba8888ToColor(f.color,s.readInt32()),i.bones.push(f)}r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("Slot name must not be null.");let d=i.bones[s.readInt(!0)],f=new Ci(a,h,d);D.rgba8888ToColor(f.color,s.readInt32());let u=s.readInt32();u!=-1&&D.rgb888ToColor(f.darkColor=new D,u),f.attachmentName=s.readStringRef(),f.blendMode=s.readInt(!0),i.slots.push(f)}r=s.readInt(!0);for(let a=0,h;a<r;a++){let d=s.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new pi(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),h=s.readInt(!0);for(let u=0;u<h;u++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.bones[s.readInt(!0)],f.mix=s.readFloat(),f.softness=s.readFloat()*t,f.bendDirection=s.readByte(),f.compress=s.readBoolean(),f.stretch=s.readBoolean(),f.uniform=s.readBoolean(),i.ikConstraints.push(f)}r=s.readInt(!0);for(let a=0,h;a<r;a++){let d=s.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new Si(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),h=s.readInt(!0);for(let u=0;u<h;u++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.bones[s.readInt(!0)],f.local=s.readBoolean(),f.relative=s.readBoolean(),f.offsetRotation=s.readFloat(),f.offsetX=s.readFloat()*t,f.offsetY=s.readFloat()*t,f.offsetScaleX=s.readFloat(),f.offsetScaleY=s.readFloat(),f.offsetShearY=s.readFloat(),f.mixRotate=s.readFloat(),f.mixX=s.readFloat(),f.mixY=s.readFloat(),f.mixScaleX=s.readFloat(),f.mixScaleY=s.readFloat(),f.mixShearY=s.readFloat(),i.transformConstraints.push(f)}r=s.readInt(!0);for(let a=0,h;a<r;a++){let d=s.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new vi(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),h=s.readInt(!0);for(let u=0;u<h;u++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.slots[s.readInt(!0)],f.positionMode=s.readInt(!0),f.spacingMode=s.readInt(!0),f.rotateMode=s.readInt(!0),f.offsetRotation=s.readFloat(),f.position=s.readFloat(),f.positionMode==0&&(f.position*=t),f.spacing=s.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=t),f.mixRotate=s.readFloat(),f.mixX=s.readFloat(),f.mixY=s.readFloat(),i.pathConstraints.push(f)}let o=this.readSkin(s,i,!0,l);o&&(i.defaultSkin=o,i.skins.push(o));{let a=i.skins.length;for(B.setArraySize(i.skins,r=a+s.readInt(!0));a<r;a++){let h=this.readSkin(s,i,!1,l);if(!h)throw new Error("readSkin() should not have returned null.");i.skins[a]=h}}r=this.linkedMeshes.length;for(let a=0;a<r;a++){let h=this.linkedMeshes[a],d=h.skin?i.findSkin(h.skin):i.defaultSkin;if(!d)throw new Error("Not skin found for linked mesh.");if(!h.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(h.slotIndex,h.parent);if(!f)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?f:h.mesh,h.mesh.setParentMesh(f),h.mesh.region!=null&&h.mesh.updateRegion()}this.linkedMeshes.length=0,r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readStringRef();if(!h)throw new Error;let d=new bi(h);d.intValue=s.readInt(!1),d.floatValue=s.readFloat(),d.stringValue=s.readString(),d.audioPath=s.readString(),d.audioPath&&(d.volume=s.readFloat(),d.balance=s.readFloat()),i.events.push(d)}r=s.readInt(!0);for(let a=0;a<r;a++){let h=s.readString();if(!h)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(s,h,i))}return i}readSkin(e,t,i,s){let n=null,c=0;if(i){if(c=e.readInt(!0),c==0)return null;n=new It("default")}else{let l=e.readStringRef();if(!l)throw new Error("Skin name must not be null.");n=new It(l),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)]);c=e.readInt(!0)}for(let l=0;l<c;l++){let r=e.readInt(!0);for(let o=0,a=e.readInt(!0);o<a;o++){let h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,n,r,h,s);d&&n.setAttachment(r,h,d)}}return n}readAttachment(e,t,i,s,n,c){let l=this.scale,r=e.readStringRef();switch(r||(r=n),e.readByte()){case Ne.Region:{let o=e.readStringRef(),a=e.readFloat(),h=e.readFloat(),d=e.readFloat(),f=e.readFloat(),u=e.readFloat(),m=e.readFloat(),g=e.readFloat(),p=e.readInt32(),v=this.readSequence(e);o||(o=r);let x=this.attachmentLoader.newRegionAttachment(i,r,o,v);return x?(x.path=o,x.x=h*l,x.y=d*l,x.scaleX=f,x.scaleY=u,x.rotation=a,x.width=m*l,x.height=g*l,D.rgba8888ToColor(x.color,p),x.sequence=v,v==null&&x.updateRegion(),x):null}case Ne.BoundingBox:{let o=e.readInt(!0),a=this.readVertices(e,o),h=c?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(i,r);return d?(d.worldVerticesLength=o<<1,d.vertices=a.vertices,d.bones=a.bones,c&&D.rgba8888ToColor(d.color,h),d):null}case Ne.Mesh:{let o=e.readStringRef(),a=e.readInt32(),h=e.readInt(!0),d=this.readFloatArray(e,h<<1,1),f=this.readShortArray(e),u=this.readVertices(e,h),m=e.readInt(!0),g=this.readSequence(e),p=[],v=0,x=0;c&&(p=this.readShortArray(e),v=e.readFloat(),x=e.readFloat()),o||(o=r);let w=this.attachmentLoader.newMeshAttachment(i,r,o,g);return w?(w.path=o,D.rgba8888ToColor(w.color,a),w.bones=u.bones,w.vertices=u.vertices,w.worldVerticesLength=h<<1,w.triangles=f,w.regionUVs=d,g==null&&w.updateRegion(),w.hullLength=m<<1,w.sequence=g,c&&(w.edges=p,w.width=v*l,w.height=x*l),w):null}case Ne.LinkedMesh:{let o=e.readStringRef(),a=e.readInt32(),h=e.readStringRef(),d=e.readStringRef(),f=e.readBoolean(),u=this.readSequence(e),m=0,g=0;c&&(m=e.readFloat(),g=e.readFloat()),o||(o=r);let p=this.attachmentLoader.newMeshAttachment(i,r,o,u);return p?(p.path=o,D.rgba8888ToColor(p.color,a),p.sequence=u,c&&(p.width=m*l,p.height=g*l),this.linkedMeshes.push(new Ws(p,h,s,d,f)),p):null}case Ne.Path:{let o=e.readBoolean(),a=e.readBoolean(),h=e.readInt(!0),d=this.readVertices(e,h),f=B.newArray(h/3,0);for(let g=0,p=f.length;g<p;g++)f[g]=e.readFloat()*l;let u=c?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(i,r);return m?(m.closed=o,m.constantSpeed=a,m.worldVerticesLength=h<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,c&&D.rgba8888ToColor(m.color,u),m):null}case Ne.Point:{let o=e.readFloat(),a=e.readFloat(),h=e.readFloat(),d=c?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(i,r);return f?(f.x=a*l,f.y=h*l,f.rotation=o,c&&D.rgba8888ToColor(f.color,d),f):null}case Ne.Clipping:{let o=e.readInt(!0),a=e.readInt(!0),h=this.readVertices(e,a),d=c?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(i,r);return f?(f.endSlot=t.slots[o],f.worldVerticesLength=a<<1,f.vertices=h.vertices,f.bones=h.bones,c&&D.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){if(!e.readBoolean())return null;let t=new Ut(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){let i=this.scale,s=t<<1,n=new qs;if(!e.readBoolean())return n.vertices=this.readFloatArray(e,s,i),n;let c=new Array,l=new Array;for(let r=0;r<t;r++){let o=e.readInt(!0);l.push(o);for(let a=0;a<o;a++)l.push(e.readInt(!0)),c.push(e.readFloat()*i),c.push(e.readFloat()*i),c.push(e.readFloat())}return n.vertices=B.toFloatArray(c),n.bones=l,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){let t=e.readInt(!0),i=new Array(t);for(let s=0;s<t;s++)i[s]=e.readShort();return i}readAnimation(e,t,i){e.readInt(!0);let s=new Array,n=this.scale,c=new D,l=new D;for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0);for(let u=0,m=e.readInt(!0);u<m;u++){let g=e.readByte(),p=e.readInt(!0),v=p-1;switch(g){case ir:{let x=new We(p,f);for(let w=0;w<p;w++)x.setFrame(w,e.readFloat(),e.readStringRef());s.push(x);break}case sr:{let x=e.readInt(!0),w=new Jt(p,x,f),b=e.readFloat(),y=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let E=0,R=0;w.setFrame(E,b,y,C,A,T),E!=v;E++){let L=e.readFloat(),X=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;switch(e.readByte()){case Me:w.setStepped(E);break;case Ee:le(e,w,R++,E,0,b,L,y,X,1),le(e,w,R++,E,1,b,L,C,k,1),le(e,w,R++,E,2,b,L,A,M,1),le(e,w,R++,E,3,b,L,T,I,1)}b=L,y=X,C=k,A=M,T=I}s.push(w);break}case rr:{let x=e.readInt(!0),w=new Qt(p,x,f),b=e.readFloat(),y=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let T=0,E=0;w.setFrame(T,b,y,C,A),T!=v;T++){let R=e.readFloat(),L=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;switch(e.readByte()){case Me:w.setStepped(T);break;case Ee:le(e,w,E++,T,0,b,R,y,L,1),le(e,w,E++,T,1,b,R,C,X,1),le(e,w,E++,T,2,b,R,A,k,1)}b=R,y=L,C=X,A=k}s.push(w);break}case nr:{let x=e.readInt(!0),w=new ei(p,x,f),b=e.readFloat(),y=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255;for(let X=0,k=0;w.setFrame(X,b,y,C,A,T,E,R,L),X!=v;X++){let M=e.readFloat(),I=e.readUnsignedByte()/255,W=e.readUnsignedByte()/255,se=e.readUnsignedByte()/255,te=e.readUnsignedByte()/255,oe=e.readUnsignedByte()/255,re=e.readUnsignedByte()/255,ce=e.readUnsignedByte()/255;switch(e.readByte()){case Me:w.setStepped(X);break;case Ee:le(e,w,k++,X,0,b,M,y,I,1),le(e,w,k++,X,1,b,M,C,W,1),le(e,w,k++,X,2,b,M,A,se,1),le(e,w,k++,X,3,b,M,T,te,1),le(e,w,k++,X,4,b,M,E,oe,1),le(e,w,k++,X,5,b,M,R,re,1),le(e,w,k++,X,6,b,M,L,ce,1)}b=M,y=I,C=W,A=se,T=te,E=oe,R=re,L=ce}s.push(w);break}case ar:{let x=e.readInt(!0),w=new ti(p,x,f),b=e.readFloat(),y=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;for(let L=0,X=0;w.setFrame(L,b,y,C,A,T,E,R),L!=v;L++){let k=e.readFloat(),M=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,W=e.readUnsignedByte()/255,se=e.readUnsignedByte()/255,te=e.readUnsignedByte()/255,oe=e.readUnsignedByte()/255;switch(e.readByte()){case Me:w.setStepped(L);break;case Ee:le(e,w,X++,L,0,b,k,y,M,1),le(e,w,X++,L,1,b,k,C,I,1),le(e,w,X++,L,2,b,k,A,W,1),le(e,w,X++,L,3,b,k,T,se,1),le(e,w,X++,L,4,b,k,E,te,1),le(e,w,X++,L,5,b,k,R,oe,1)}b=k,y=M,C=I,A=W,T=se,E=te,R=oe}s.push(w);break}case lr:{let x=new $t(p,e.readInt(!0),f),w=e.readFloat(),b=e.readUnsignedByte()/255;for(let y=0,C=0;x.setFrame(y,w,b),y!=v;y++){let A=e.readFloat(),T=e.readUnsignedByte()/255;switch(e.readByte()){case Me:x.setStepped(y);break;case Ee:le(e,x,C++,y,0,w,A,b,T,1)}w=A,b=T}s.push(x)}}}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0);for(let u=0,m=e.readInt(!0);u<m;u++){let g=e.readByte(),p=e.readInt(!0),v=e.readInt(!0);switch(g){case Gs:s.push(Be(e,new at(p,v,f),1));break;case Hs:s.push(Ti(e,new zt(p,v,f),n));break;case js:s.push(Be(e,new _t(p,v,f),n));break;case Zs:s.push(Be(e,new Wt(p,v,f),n));break;case Ks:s.push(Ti(e,new qt(p,v,f),1));break;case Js:s.push(Be(e,new Gt(p,v,f),1));break;case Qs:s.push(Be(e,new Ht(p,v,f),1));break;case $s:s.push(Ti(e,new jt(p,v,f),1));break;case er:s.push(Be(e,new Zt(p,v,f),1));break;case tr:s.push(Be(e,new Kt(p,v,f),1))}}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=e.readInt(!0),m=u-1,g=new si(u,e.readInt(!0),f),p=e.readFloat(),v=e.readFloat(),x=e.readFloat()*n;for(let w=0,b=0;g.setFrame(w,p,v,x,e.readByte(),e.readBoolean(),e.readBoolean()),w!=m;w++){let y=e.readFloat(),C=e.readFloat(),A=e.readFloat()*n;switch(e.readByte()){case Me:g.setStepped(w);break;case Ee:le(e,g,b++,w,0,p,y,v,C,1),le(e,g,b++,w,1,p,y,x,A,n)}p=y,v=C,x=A}s.push(g)}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=e.readInt(!0),m=u-1,g=new ri(u,e.readInt(!0),f),p=e.readFloat(),v=e.readFloat(),x=e.readFloat(),w=e.readFloat(),b=e.readFloat(),y=e.readFloat(),C=e.readFloat();for(let A=0,T=0;g.setFrame(A,p,v,x,w,b,y,C),A!=m;A++){let E=e.readFloat(),R=e.readFloat(),L=e.readFloat(),X=e.readFloat(),k=e.readFloat(),M=e.readFloat(),I=e.readFloat();switch(e.readByte()){case Me:g.setStepped(A);break;case Ee:le(e,g,T++,A,0,p,E,v,R,1),le(e,g,T++,A,1,p,E,x,L,1),le(e,g,T++,A,2,p,E,w,X,1),le(e,g,T++,A,3,p,E,b,k,1),le(e,g,T++,A,4,p,E,y,M,1),le(e,g,T++,A,5,p,E,C,I,1)}p=E,v=R,x=L,w=X,b=k,y=M,C=I}s.push(g)}for(let h=0,d=e.readInt(!0);h<d;h++){let f=e.readInt(!0),u=i.pathConstraints[f];for(let m=0,g=e.readInt(!0);m<g;m++)switch(e.readByte()){case cr:s.push(Be(e,new ni(e.readInt(!0),e.readInt(!0),f),u.positionMode==0?n:1));break;case dr:s.push(Be(e,new ai(e.readInt(!0),e.readInt(!0),f),u.spacingMode==0||u.spacingMode==1?n:1));break;case fr:let p=new li(e.readInt(!0),e.readInt(!0),f),v=e.readFloat(),x=e.readFloat(),w=e.readFloat(),b=e.readFloat();for(let y=0,C=0,A=p.getFrameCount()-1;p.setFrame(y,v,x,w,b),y!=A;y++){let T=e.readFloat(),E=e.readFloat(),R=e.readFloat(),L=e.readFloat();switch(e.readByte()){case Me:p.setStepped(y);break;case Ee:le(e,p,C++,y,0,v,T,x,E,1),le(e,p,C++,y,1,v,T,w,R,1),le(e,p,C++,y,2,v,T,b,L,1)}v=T,x=E,w=R,b=L}s.push(p)}}for(let h=0,d=e.readInt(!0);h<d;h++){let f=i.skins[e.readInt(!0)];for(let u=0,m=e.readInt(!0);u<m;u++){let g=e.readInt(!0);for(let p=0,v=e.readInt(!0);p<v;p++){let x=e.readStringRef();if(!x)throw new Error("attachmentName must not be null.");let w=f.getAttachment(g,x),b=e.readByte(),y=e.readInt(!0),C=y-1;switch(b){case or:{let A=w,T=A.bones,E=A.vertices,R=T?E.length/3*2:E.length,L=e.readInt(!0),X=new ii(y,L,g,A),k=e.readFloat();for(let M=0,I=0;;M++){let W,se=e.readInt(!0);if(se==0)W=T?B.newFloatArray(R):E;else{W=B.newFloatArray(R);let oe=e.readInt(!0);if(se+=oe,n==1)for(let re=oe;re<se;re++)W[re]=e.readFloat();else for(let re=oe;re<se;re++)W[re]=e.readFloat()*n;if(!T)for(let re=0,ce=W.length;re<ce;re++)W[re]+=E[re]}if(X.setFrame(M,k,W),M==C)break;let te=e.readFloat();switch(e.readByte()){case Me:X.setStepped(M);break;case Ee:le(e,X,I++,M,0,k,te,0,1,1)}k=te}s.push(X);break}case hr:{let A=new Je(y,g,w);for(let T=0;T<y;T++){let E=e.readFloat(),R=e.readInt32();A.setFrame(T,E,Ui[R&15],R>>4,e.readFloat())}s.push(A);break}}}}}let r=e.readInt(!0);if(r>0){let h=new qe(r),d=i.slots.length;for(let f=0;f<r;f++){let u=e.readFloat(),m=e.readInt(!0),g=B.newArray(d,0);for(let w=d-1;w>=0;w--)g[w]=-1;let p=B.newArray(d-m,0),v=0,x=0;for(let w=0;w<m;w++){let b=e.readInt(!0);for(;v!=b;)p[x++]=v++;g[v+e.readInt(!0)]=v++}for(;v<d;)p[x++]=v++;for(let w=d-1;w>=0;w--)g[w]==-1&&(g[w]=p[--x]);h.setFrame(f,u,g)}s.push(h)}let o=e.readInt(!0);if(o>0){let h=new lt(o);for(let d=0;d<o;d++){let f=e.readFloat(),u=i.events[e.readInt(!0)],m=new wi(f,u);m.intValue=e.readInt(!1),m.floatValue=e.readFloat(),m.stringValue=e.readBoolean()?e.readString():u.stringValue,m.data.audioPath&&(m.volume=e.readFloat(),m.balance=e.readFloat()),h.setFrame(d,m)}s.push(h)}let a=0;for(let h=0,d=s.length;h<d;h++)a=Math.max(a,s[h].getDuration());return new mt(t,s,a)}},os=class{constructor(e,t=new Array,i=0,s=new DataView(e.buffer)){this.strings=t,this.index=i,this.buffer=s}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),i=t&127;return t&128&&(t=this.readByte(),i|=(t&127)<<7,t&128&&(t=this.readByte(),i|=(t&127)<<14,t&128&&(t=this.readByte(),i|=(t&127)<<21,t&128&&(t=this.readByte(),i|=(t&127)<<28)))),e?i:i>>>1^-(i&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",i=0;for(let s=0;s<e;){let n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(n),s++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},Ws=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}},qs=class{constructor(e=null,t=null){this.bones=e,this.vertices=t}},Ne=(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))(Ne||{});function Be(e,t,i){let s=e.readFloat(),n=e.readFloat()*i;for(let c=0,l=0,r=t.getFrameCount()-1;t.setFrame(c,s,n),c!=r;c++){let o=e.readFloat(),a=e.readFloat()*i;switch(e.readByte()){case Me:t.setStepped(c);break;case Ee:le(e,t,l++,c,0,s,o,n,a,i)}s=o,n=a}return t}function Ti(e,t,i){let s=e.readFloat(),n=e.readFloat()*i,c=e.readFloat()*i;for(let l=0,r=0,o=t.getFrameCount()-1;t.setFrame(l,s,n,c),l!=o;l++){let a=e.readFloat(),h=e.readFloat()*i,d=e.readFloat()*i;switch(e.readByte()){case Me:t.setStepped(l);break;case Ee:le(e,t,r++,l,0,s,a,n,h,i),le(e,t,r++,l,1,s,a,c,d,i)}s=a,n=h,c=d}return t}function le(e,t,i,s,n,c,l,r,o,a){t.setBezier(i,s,n,c,r,e.readFloat(),e.readFloat()*a,e.readFloat(),e.readFloat()*a,l,o)}var Gs=0,Hs=1,js=2,Zs=3,Ks=4,Js=5,Qs=6,$s=7,er=8,tr=9,ir=0,sr=1,rr=2,nr=3,ar=4,lr=5,or=0,hr=1,cr=0,dr=1,fr=2,Me=1,Ee=2,hs=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new nt(()=>B.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let i=this.boundingBoxes,s=this.polygons,n=this.polygonPool,c=e.slots,l=c.length;i.length=0,n.freeAll(s),s.length=0;for(let r=0;r<l;r++){let o=c[r];if(!o.bone.active)continue;let a=o.getAttachment();if(a instanceof pt){let h=a;i.push(h);let d=n.obtain();d.length!=h.worldVerticesLength&&(d=B.newFloatArray(h.worldVerticesLength)),s.push(d),h.computeWorldVertices(o,0,h.worldVerticesLength,d,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=this.polygons;for(let c=0,l=n.length;c<l;c++){let r=n[c],o=r;for(let a=0,h=r.length;a<h;a+=2){let d=o[a],f=o[a+1];e=Math.min(e,d),t=Math.min(t,f),i=Math.max(i,d),s=Math.max(s,f)}}this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,i,s){let n=this.minX,c=this.minY,l=this.maxX,r=this.maxY;if(e<=n&&i<=n||t<=c&&s<=c||e>=l&&i>=l||t>=r&&s>=r)return!1;let o=(s-t)/(i-e),a=o*(n-e)+t;if(a>c&&a<r||(a=o*(l-e)+t,a>c&&a<r))return!0;let h=(c-t)/o+e;return h>n&&h<l||(h=(r-t)/o+e,h>n&&h<l)}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,c=n-2,l=!1;for(let r=0;r<n;r+=2){let o=s[r+1],a=s[c+1];if(o<i&&a>=i||a<i&&o>=i){let h=s[r];h+(i-o)/(a-o)*(s[c]-h)<t&&(l=!l)}c=r}return l}intersectsSegment(e,t,i,s){let n=this.polygons;for(let c=0,l=n.length;c<l;c++)if(this.intersectsSegmentPolygon(n[c],e,t,i,s))return this.boundingBoxes[c];return null}intersectsSegmentPolygon(e,t,i,s,n){let c=e,l=e.length,r=t-s,o=i-n,a=t*n-i*s,h=c[l-2],d=c[l-1];for(let f=0;f<l;f+=2){let u=c[f],m=c[f+1],g=h*m-d*u,p=h-u,v=d-m,x=r*v-o*p,w=(a*p-r*g)/x;if((w>=h&&w<=u||w>=u&&w<=h)&&(w>=t&&w<=s||w>=s&&w<=t)){let b=(a*v-o*g)/x;if((b>=d&&b<=m||b>=m&&b<=d)&&(b>=i&&b<=n||b>=n&&b<=i))return!0}h=u,d=m}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},ye=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 l=0;l<i;l++)s[l]=l;let n=this.isConcaveArray;n.length=0;for(let l=0,r=i;l<r;++l)n[l]=ye.isConcave(l,i,t,s);let c=this.triangles;for(c.length=0;i>3;){let l=i-1,r=0,o=1;for(;;){e:if(!n[r]){let d=s[l]<<1,f=s[r]<<1,u=s[o]<<1,m=t[d],g=t[d+1],p=t[f],v=t[f+1],x=t[u],w=t[u+1];for(let b=(o+1)%i;b!=l;b=(b+1)%i){if(!n[b])continue;let y=s[b]<<1,C=t[y],A=t[y+1];if(ye.positiveArea(x,w,m,g,C,A)&&ye.positiveArea(m,g,p,v,C,A)&&ye.positiveArea(p,v,x,w,C,A))break e}break}if(o==0){do{if(!n[r])break;r--}while(r>0);break}l=r,r=o,o=(o+1)%i}c.push(s[(i+r-1)%i]),c.push(s[r]),c.push(s[(r+1)%i]),s.splice(r,1),n.splice(r,1),i--;let a=(i+r-1)%i,h=r==i?0:r;n[a]=ye.isConcave(a,i,t,s),n[h]=ye.isConcave(h,i,t,s)}return i==3&&(c.push(s[2]),c.push(s[0]),c.push(s[1])),c}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 c=this.polygonIndicesPool.obtain();c.length=0;let l=this.polygonPool.obtain();l.length=0;let r=-1,o=0;for(let a=0,h=t.length;a<h;a+=3){let d=t[a]<<1,f=t[a+1]<<1,u=t[a+2]<<1,m=i[d],g=i[d+1],p=i[f],v=i[f+1],x=i[u],w=i[u+1],b=!1;if(r==d){let y=l.length-4,C=ye.winding(l[y],l[y+1],l[y+2],l[y+3],x,w),A=ye.winding(x,w,l[0],l[1],l[2],l[3]);C==o&&A==o&&(l.push(x),l.push(w),c.push(u),b=!0)}b||(l.length>0?(s.push(l),n.push(c)):(this.polygonPool.free(l),this.polygonIndicesPool.free(c)),l=this.polygonPool.obtain(),l.length=0,l.push(m),l.push(g),l.push(p),l.push(v),l.push(x),l.push(w),c=this.polygonIndicesPool.obtain(),c.length=0,c.push(d),c.push(f),c.push(u),o=ye.winding(m,g,p,v,x,w),r=d)}l.length>0&&(s.push(l),n.push(c));for(let a=0,h=s.length;a<h;a++){if(c=n[a],c.length==0)continue;let d=c[0],f=c[c.length-1];l=s[a];let u=l.length-4,m=l[u],g=l[u+1],p=l[u+2],v=l[u+3],x=l[0],w=l[1],b=l[2],y=l[3],C=ye.winding(m,g,p,v,x,w);for(let A=0;A<h;A++){if(A==a)continue;let T=n[A];if(T.length!=3)continue;let E=T[0],R=T[1],L=T[2],X=s[A],k=X[X.length-2],M=X[X.length-1];if(E!=d||R!=f)continue;let I=ye.winding(m,g,p,v,k,M),W=ye.winding(k,M,x,w,b,y);I==C&&W==C&&(X.length=0,T.length=0,l.push(k),l.push(M),c.push(L),m=p,g=v,p=k,v=M,A=0)}}for(let a=s.length-1;a>=0;a--)l=s[a],l.length==0&&(s.splice(a,1),this.polygonPool.free(l),c=n[a],n.splice(a,1),this.polygonIndicesPool.free(c));return s}static isConcave(e,t,i,s){let n=s[(t+e-1)%t]<<1,c=s[e]<<1,l=s[(e+1)%t]<<1;return!this.positiveArea(i[n],i[n+1],i[c],i[c+1],i[l],i[l+1])}static positiveArea(e,t,i,s,n,c){return e*(c-s)+i*(t-c)+n*(s-t)>=0}static winding(e,t,i,s,n,c){let l=i-e,r=s-t;return n*r-c*l+l*t-e*r>=0?1:-1}},Mt=class{triangulator=new ye;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let i=t.worldVerticesLength,s=B.setArraySize(this.clippingPolygon,i);t.computeWorldVertices(e,0,i,s,0,2);let n=this.clippingPolygon;Mt.makeClockwise(n);let c=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let l=0,r=c.length;l<r;l++){let o=c[l];Mt.makeClockwise(o),o.push(o[0]),o.push(o[1])}return c.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,c,l,r){let o=this.clipOutput,a=this.clippedVertices,h=this.clippedTriangles,d=this.clippingPolygons,f=d.length,u=r?12:8,m=0;a.length=0,h.length=0;e:for(let g=0;g<s;g+=3){let p=i[g]<<1,v=e[p],x=e[p+1],w=n[p],b=n[p+1];p=i[g+1]<<1;let y=e[p],C=e[p+1],A=n[p],T=n[p+1];p=i[g+2]<<1;let E=e[p],R=e[p+1],L=n[p],X=n[p+1];for(let k=0;k<f;k++){let M=a.length;if(this.clip(v,x,y,C,E,R,d[k],o)){let I=o.length;if(I==0)continue;let W=C-R,se=E-y,te=v-E,oe=R-x,re=1/(W*te+se*(x-R)),ce=I>>1,ne=this.clipOutput,ie=B.setArraySize(a,M+ce*u);for(let be=0;be<I;be+=2){let Re=ne[be],xe=ne[be+1];ie[M]=Re,ie[M+1]=xe,ie[M+2]=c.r,ie[M+3]=c.g,ie[M+4]=c.b,ie[M+5]=c.a;let Ce=Re-E,Se=xe-R,Ue=(W*Ce+se*Se)*re,it=(oe*Ce+te*Se)*re,dt=1-Ue-it;ie[M+6]=w*Ue+A*it+L*dt,ie[M+7]=b*Ue+T*it+X*dt,r&&(ie[M+8]=l.r,ie[M+9]=l.g,ie[M+10]=l.b,ie[M+11]=l.a),M+=u}M=h.length;let fe=B.setArraySize(h,M+3*(ce-2));ce--;for(let be=1;be<ce;be++)fe[M]=m,fe[M+1]=m+be,fe[M+2]=m+be+1,M+=3;m+=ce+1}else{let I=B.setArraySize(a,M+3*u);I[M]=v,I[M+1]=x,I[M+2]=c.r,I[M+3]=c.g,I[M+4]=c.b,I[M+5]=c.a,r?(I[M+6]=w,I[M+7]=b,I[M+8]=l.r,I[M+9]=l.g,I[M+10]=l.b,I[M+11]=l.a,I[M+12]=y,I[M+13]=C,I[M+14]=c.r,I[M+15]=c.g,I[M+16]=c.b,I[M+17]=c.a,I[M+18]=A,I[M+19]=T,I[M+20]=l.r,I[M+21]=l.g,I[M+22]=l.b,I[M+23]=l.a,I[M+24]=E,I[M+25]=R,I[M+26]=c.r,I[M+27]=c.g,I[M+28]=c.b,I[M+29]=c.a,I[M+30]=L,I[M+31]=X,I[M+32]=l.r,I[M+33]=l.g,I[M+34]=l.b,I[M+35]=l.a):(I[M+6]=w,I[M+7]=b,I[M+8]=y,I[M+9]=C,I[M+10]=c.r,I[M+11]=c.g,I[M+12]=c.b,I[M+13]=c.a,I[M+14]=A,I[M+15]=T,I[M+16]=E,I[M+17]=R,I[M+18]=c.r,I[M+19]=c.g,I[M+20]=c.b,I[M+21]=c.a,I[M+22]=L,I[M+23]=X),M=h.length;let W=B.setArraySize(h,M+3);W[M]=m,W[M+1]=m+1,W[M+2]=m+2,m+=3;continue e}}}}clip(e,t,i,s,n,c,l,r){let o=r,a=!1,h;l.length%4>=2?(h=r,r=this.scratch):h=this.scratch,h.length=0,h.push(e),h.push(t),h.push(i),h.push(s),h.push(n),h.push(c),h.push(e),h.push(t),r.length=0;let d=l,f=l.length-4;for(let u=0;;u+=2){let m=d[u],g=d[u+1],p=d[u+2],v=d[u+3],x=m-p,w=g-v,b=h,y=h.length-2,C=r.length;for(let T=0;T<y;T+=2){let E=b[T],R=b[T+1],L=b[T+2],X=b[T+3],k=x*(X-v)-w*(L-p)>0;if(x*(R-v)-w*(E-p)>0){if(k){r.push(L),r.push(X);continue}let M=X-R,I=L-E,W=M*(p-m)-I*(v-g);if(Math.abs(W)>1e-6){let se=(I*(g-R)-M*(m-E))/W;r.push(m+(p-m)*se),r.push(g+(v-g)*se)}else r.push(m),r.push(g)}else if(k){let M=X-R,I=L-E,W=M*(p-m)-I*(v-g);if(Math.abs(W)>1e-6){let se=(I*(g-R)-M*(m-E))/W;r.push(m+(p-m)*se),r.push(g+(v-g)*se)}else r.push(m),r.push(g);r.push(L),r.push(X)}a=!0}if(C==r.length)return o.length=0,!0;if(r.push(r[0]),r.push(r[1]),u==f)break;let A=r;r=h,r.length=0,h=A}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 a}static makeClockwise(e){let t=e,i=e.length,s=t[i-2]*t[1]-t[0]*t[i-1],n=0,c=0,l=0,r=0;for(let o=0,a=i-3;o<a;o+=2)n=t[o],c=t[o+1],l=t[o+2],r=t[o+3],s+=n*r-l*c;if(!(s<0))for(let o=0,a=i-2,h=i>>1;o<h;o+=2){let d=t[o],f=t[o+1],u=a-o;t[o]=t[u],t[o+1]=t[u+1],t[u]=d,t[u+1]=f}}},ur=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new yi,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.fps=n.fps,i.imagesPath=n.images),s.bones)for(let c=0;c<s.bones.length;c++){let l=s.bones[c],r=null,o=Y(l,"parent",null);o&&(r=i.findBone(o));let a=new mi(i.bones.length,l.name,r);a.length=Y(l,"length",0)*t,a.x=Y(l,"x",0)*t,a.y=Y(l,"y",0)*t,a.rotation=Y(l,"rotation",0),a.scaleX=Y(l,"scaleX",1),a.scaleY=Y(l,"scaleY",1),a.shearX=Y(l,"shearX",0),a.shearY=Y(l,"shearY",0),a.transformMode=B.enumValue(yt,Y(l,"transform","Normal")),a.skinRequired=Y(l,"skin",!1);let h=Y(l,"color",null);h&&a.color.setFromString(h),i.bones.push(a)}if(s.slots)for(let c=0;c<s.slots.length;c++){let l=s.slots[c],r=i.findBone(l.bone);if(!r)throw new Error(`Couldn't find bone ${l.bone} for slot ${l.name}`);let o=new Ci(i.slots.length,l.name,r),a=Y(l,"color",null);a&&o.color.setFromString(a);let h=Y(l,"dark",null);h&&(o.darkColor=D.fromString(h)),o.attachmentName=Y(l,"attachment",null),o.blendMode=B.enumValue(Yt,Y(l,"blend","normal")),i.slots.push(o)}if(s.ik)for(let c=0;c<s.ik.length;c++){let l=s.ik[c],r=new pi(l.name);r.order=Y(l,"order",0),r.skinRequired=Y(l,"skin",!1);for(let a=0;a<l.bones.length;a++){let h=i.findBone(l.bones[a]);if(!h)throw new Error(`Couldn't find bone ${l.bones[a]} for IK constraint ${l.name}.`);r.bones.push(h)}let o=i.findBone(l.target);if(!o)throw new Error(`Couldn't find target bone ${l.target} for IK constraint ${l.name}.`);r.target=o,r.mix=Y(l,"mix",1),r.softness=Y(l,"softness",0)*t,r.bendDirection=Y(l,"bendPositive",!0)?1:-1,r.compress=Y(l,"compress",!1),r.stretch=Y(l,"stretch",!1),r.uniform=Y(l,"uniform",!1),i.ikConstraints.push(r)}if(s.transform)for(let c=0;c<s.transform.length;c++){let l=s.transform[c],r=new Si(l.name);r.order=Y(l,"order",0),r.skinRequired=Y(l,"skin",!1);for(let h=0;h<l.bones.length;h++){let d=l.bones[h],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${l.name}.`);r.bones.push(f)}let o=l.target,a=i.findBone(o);if(!a)throw new Error(`Couldn't find target bone ${o} for transform constraint ${l.name}.`);r.target=a,r.local=Y(l,"local",!1),r.relative=Y(l,"relative",!1),r.offsetRotation=Y(l,"rotation",0),r.offsetX=Y(l,"x",0)*t,r.offsetY=Y(l,"y",0)*t,r.offsetScaleX=Y(l,"scaleX",0),r.offsetScaleY=Y(l,"scaleY",0),r.offsetShearY=Y(l,"shearY",0),r.mixRotate=Y(l,"mixRotate",1),r.mixX=Y(l,"mixX",1),r.mixY=Y(l,"mixY",r.mixX),r.mixScaleX=Y(l,"mixScaleX",1),r.mixScaleY=Y(l,"mixScaleY",r.mixScaleX),r.mixShearY=Y(l,"mixShearY",1),i.transformConstraints.push(r)}if(s.path)for(let c=0;c<s.path.length;c++){let l=s.path[c],r=new vi(l.name);r.order=Y(l,"order",0),r.skinRequired=Y(l,"skin",!1);for(let h=0;h<l.bones.length;h++){let d=l.bones[h],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${l.name}.`);r.bones.push(f)}let o=l.target,a=i.findSlot(o);if(!a)throw new Error(`Couldn't find target slot ${o} for path constraint ${l.name}.`);r.target=a,r.positionMode=B.enumValue(Ct,Y(l,"positionMode","Percent")),r.spacingMode=B.enumValue(St,Y(l,"spacingMode","Length")),r.rotateMode=B.enumValue(Tt,Y(l,"rotateMode","Tangent")),r.offsetRotation=Y(l,"rotation",0),r.position=Y(l,"position",0),r.positionMode==0&&(r.position*=t),r.spacing=Y(l,"spacing",0),(r.spacingMode==0||r.spacingMode==1)&&(r.spacing*=t),r.mixRotate=Y(l,"mixRotate",1),r.mixX=Y(l,"mixX",1),r.mixY=Y(l,"mixY",r.mixX),i.pathConstraints.push(r)}if(s.skins)for(let c=0;c<s.skins.length;c++){let l=s.skins[c],r=new It(l.name);if(l.bones)for(let o=0;o<l.bones.length;o++){let a=l.bones[o],h=i.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${l.name}.`);r.bones.push(h)}if(l.ik)for(let o=0;o<l.ik.length;o++){let a=l.ik[o],h=i.findIkConstraint(a);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${l.name}.`);r.constraints.push(h)}if(l.transform)for(let o=0;o<l.transform.length;o++){let a=l.transform[o],h=i.findTransformConstraint(a);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${l.name}.`);r.constraints.push(h)}if(l.path)for(let o=0;o<l.path.length;o++){let a=l.path[o],h=i.findPathConstraint(a);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${l.name}.`);r.constraints.push(h)}for(let o in l.attachments){let a=i.findSlot(o);if(!a)throw new Error(`Couldn't find slot ${o} for skin ${l.name}.`);let h=l.attachments[o];for(let d in h){let f=this.readAttachment(h[d],r,a.index,d,i);f&&r.setAttachment(a.index,d,f)}}i.skins.push(r),r.name=="default"&&(i.defaultSkin=r)}for(let c=0,l=this.linkedMeshes.length;c<l;c++){let r=this.linkedMeshes[c],o=r.skin?i.findSkin(r.skin):i.defaultSkin;if(!o)throw new Error(`Skin not found: ${r.skin}`);let a=o.getAttachment(r.slotIndex,r.parent);if(!a)throw new Error(`Parent mesh not found: ${r.parent}`);r.mesh.timelineAttachment=r.inheritTimeline?a:r.mesh,r.mesh.setParentMesh(a),r.mesh.region!=null&&r.mesh.updateRegion()}if(this.linkedMeshes.length=0,s.events)for(let c in s.events){let l=s.events[c],r=new bi(c);r.intValue=Y(l,"int",0),r.floatValue=Y(l,"float",0),r.stringValue=Y(l,"string",""),r.audioPath=Y(l,"audio",null),r.audioPath&&(r.volume=Y(l,"volume",1),r.balance=Y(l,"balance",0)),i.events.push(r)}if(s.animations)for(let c in s.animations){let l=s.animations[c];this.readAnimation(l,c,i)}return i}readAttachment(e,t,i,s,n){let c=this.scale;switch(s=Y(e,"name",s),Y(e,"type","region")){case"region":{let l=Y(e,"path",s),r=this.readSequence(Y(e,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(t,s,l,r);if(!o)return null;o.path=l,o.x=Y(e,"x",0)*c,o.y=Y(e,"y",0)*c,o.scaleX=Y(e,"scaleX",1),o.scaleY=Y(e,"scaleY",1),o.rotation=Y(e,"rotation",0),o.width=e.width*c,o.height=e.height*c,o.sequence=r;let a=Y(e,"color",null);return a&&o.color.setFromString(a),o.region!=null&&o.updateRegion(),o}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(t,s);if(!l)return null;this.readVertices(e,l,e.vertexCount<<1);let r=Y(e,"color",null);return r&&l.color.setFromString(r),l}case"mesh":case"linkedmesh":{let l=Y(e,"path",s),r=this.readSequence(Y(e,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(t,s,l,r);if(!o)return null;o.path=l;let a=Y(e,"color",null);a&&o.color.setFromString(a),o.width=Y(e,"width",0)*c,o.height=Y(e,"height",0)*c,o.sequence=r;let h=Y(e,"parent",null);if(h)return this.linkedMeshes.push(new mr(o,Y(e,"skin",null),i,h,Y(e,"timelines",!0))),o;let d=e.uvs;return this.readVertices(e,o,d.length),o.triangles=e.triangles,o.regionUVs=d,o.region!=null&&o.updateRegion(),o.edges=Y(e,"edges",null),o.hullLength=Y(e,"hull",0)*2,o}case"path":{let l=this.attachmentLoader.newPathAttachment(t,s);if(!l)return null;l.closed=Y(e,"closed",!1),l.constantSpeed=Y(e,"constantSpeed",!0);let r=e.vertexCount;this.readVertices(e,l,r<<1);let o=B.newArray(r/3,0);for(let h=0;h<e.lengths.length;h++)o[h]=e.lengths[h]*c;l.lengths=o;let a=Y(e,"color",null);return a&&l.color.setFromString(a),l}case"point":{let l=this.attachmentLoader.newPointAttachment(t,s);if(!l)return null;l.x=Y(e,"x",0)*c,l.y=Y(e,"y",0)*c,l.rotation=Y(e,"rotation",0);let r=Y(e,"color",null);return r&&l.color.setFromString(r),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(t,s);if(!l)return null;let r=Y(e,"end",null);r&&(l.endSlot=n.findSlot(r));let o=e.vertexCount;this.readVertices(e,l,o<<1);let a=Y(e,"color",null);return a&&l.color.setFromString(a),l}}return null}readSequence(e){if(e==null)return null;let t=new Ut(Y(e,"count",0));return t.start=Y(e,"start",1),t.digits=Y(e,"digits",0),t.setupIndex=Y(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=B.toFloatArray(n);if(s!=1)for(let o=0,a=n.length;o<a;o++)r[o]*=s;t.vertices=r;return}let c=new Array,l=new Array;for(let r=0,o=n.length;r<o;){let a=n[r++];l.push(a);for(let h=r+a*4;r<h;r+=4)l.push(n[r]),c.push(n[r+1]*s),c.push(n[r+2]*s),c.push(n[r+3])}t.bones=l,t.vertices=B.toFloatArray(c)}readAnimation(e,t,i){let s=this.scale,n=new Array;if(e.slots)for(let l in e.slots){let r=e.slots[l],o=i.findSlot(l);if(!o)throw new Error("Slot not found: "+l);let a=o.index;for(let h in r){let d=r[h];if(!d)continue;let f=d.length;if(h=="attachment"){let u=new We(f,a);for(let m=0;m<f;m++){let g=d[m];u.setFrame(m,Y(g,"time",0),Y(g,"name",null))}n.push(u)}else if(h=="rgba"){let u=new Jt(f,f<<2,a),m=d[0],g=Y(m,"time",0),p=D.fromString(m.color);for(let v=0,x=0;;v++){u.setFrame(v,g,p.r,p.g,p.b,p.a);let w=d[v+1];if(!w){u.shrink(x);break}let b=Y(w,"time",0),y=D.fromString(w.color),C=m.curve;C&&(x=he(C,u,x,v,0,g,b,p.r,y.r,1),x=he(C,u,x,v,1,g,b,p.g,y.g,1),x=he(C,u,x,v,2,g,b,p.b,y.b,1),x=he(C,u,x,v,3,g,b,p.a,y.a,1)),g=b,p=y,m=w}n.push(u)}else if(h=="rgb"){let u=new Qt(f,f*3,a),m=d[0],g=Y(m,"time",0),p=D.fromString(m.color);for(let v=0,x=0;;v++){u.setFrame(v,g,p.r,p.g,p.b);let w=d[v+1];if(!w){u.shrink(x);break}let b=Y(w,"time",0),y=D.fromString(w.color),C=m.curve;C&&(x=he(C,u,x,v,0,g,b,p.r,y.r,1),x=he(C,u,x,v,1,g,b,p.g,y.g,1),x=he(C,u,x,v,2,g,b,p.b,y.b,1)),g=b,p=y,m=w}n.push(u)}else if(h=="alpha")n.push(Fe(d,new $t(f,f,a),0,1));else if(h=="rgba2"){let u=new ei(f,f*7,a),m=d[0],g=Y(m,"time",0),p=D.fromString(m.light),v=D.fromString(m.dark);for(let x=0,w=0;;x++){u.setFrame(x,g,p.r,p.g,p.b,p.a,v.r,v.g,v.b);let b=d[x+1];if(!b){u.shrink(w);break}let y=Y(b,"time",0),C=D.fromString(b.light),A=D.fromString(b.dark),T=m.curve;T&&(w=he(T,u,w,x,0,g,y,p.r,C.r,1),w=he(T,u,w,x,1,g,y,p.g,C.g,1),w=he(T,u,w,x,2,g,y,p.b,C.b,1),w=he(T,u,w,x,3,g,y,p.a,C.a,1),w=he(T,u,w,x,4,g,y,v.r,A.r,1),w=he(T,u,w,x,5,g,y,v.g,A.g,1),w=he(T,u,w,x,6,g,y,v.b,A.b,1)),g=y,p=C,v=A,m=b}n.push(u)}else if(h=="rgb2"){let u=new ti(f,f*6,a),m=d[0],g=Y(m,"time",0),p=D.fromString(m.light),v=D.fromString(m.dark);for(let x=0,w=0;;x++){u.setFrame(x,g,p.r,p.g,p.b,v.r,v.g,v.b);let b=d[x+1];if(!b){u.shrink(w);break}let y=Y(b,"time",0),C=D.fromString(b.light),A=D.fromString(b.dark),T=m.curve;T&&(w=he(T,u,w,x,0,g,y,p.r,C.r,1),w=he(T,u,w,x,1,g,y,p.g,C.g,1),w=he(T,u,w,x,2,g,y,p.b,C.b,1),w=he(T,u,w,x,3,g,y,v.r,A.r,1),w=he(T,u,w,x,4,g,y,v.g,A.g,1),w=he(T,u,w,x,5,g,y,v.b,A.b,1)),g=y,p=C,v=A,m=b}n.push(u)}}}if(e.bones)for(let l in e.bones){let r=e.bones[l],o=i.findBone(l);if(!o)throw new Error("Bone not found: "+l);let a=o.index;for(let h in r){let d=r[h],f=d.length;if(f!=0){if(h==="rotate")n.push(Fe(d,new at(f,f,a),0,1));else if(h==="translate"){let u=new zt(f,f<<1,a);n.push(Ii(d,u,"x","y",0,s))}else if(h==="translatex"){let u=new _t(f,f,a);n.push(Fe(d,u,0,s))}else if(h==="translatey"){let u=new Wt(f,f,a);n.push(Fe(d,u,0,s))}else if(h==="scale"){let u=new qt(f,f<<1,a);n.push(Ii(d,u,"x","y",1,1))}else if(h==="scalex"){let u=new Gt(f,f,a);n.push(Fe(d,u,1,1))}else if(h==="scaley"){let u=new Ht(f,f,a);n.push(Fe(d,u,1,1))}else if(h==="shear"){let u=new jt(f,f<<1,a);n.push(Ii(d,u,"x","y",0,1))}else if(h==="shearx"){let u=new Zt(f,f,a);n.push(Fe(d,u,0,1))}else if(h==="sheary"){let u=new Kt(f,f,a);n.push(Fe(d,u,0,1))}}}}if(e.ik)for(let l in e.ik){let r=e.ik[l],o=r[0];if(!o)continue;let a=i.findIkConstraint(l);if(!a)throw new Error("IK Constraint not found: "+l);let h=i.ikConstraints.indexOf(a),d=new si(r.length,r.length<<1,h),f=Y(o,"time",0),u=Y(o,"mix",1),m=Y(o,"softness",0)*s;for(let g=0,p=0;;g++){d.setFrame(g,f,u,m,Y(o,"bendPositive",!0)?1:-1,Y(o,"compress",!1),Y(o,"stretch",!1));let v=r[g+1];if(!v){d.shrink(p);break}let x=Y(v,"time",0),w=Y(v,"mix",1),b=Y(v,"softness",0)*s,y=o.curve;y&&(p=he(y,d,p,g,0,f,x,u,w,1),p=he(y,d,p,g,1,f,x,m,b,s)),f=x,u=w,m=b,o=v}n.push(d)}if(e.transform)for(let l in e.transform){let r=e.transform[l],o=r[0];if(!o)continue;let a=i.findTransformConstraint(l);if(!a)throw new Error("Transform constraint not found: "+l);let h=i.transformConstraints.indexOf(a),d=new ri(r.length,r.length*6,h),f=Y(o,"time",0),u=Y(o,"mixRotate",1),m=Y(o,"mixX",1),g=Y(o,"mixY",m),p=Y(o,"mixScaleX",1),v=Y(o,"mixScaleY",p),x=Y(o,"mixShearY",1);for(let w=0,b=0;;w++){d.setFrame(w,f,u,m,g,p,v,x);let y=r[w+1];if(!y){d.shrink(b);break}let C=Y(y,"time",0),A=Y(y,"mixRotate",1),T=Y(y,"mixX",1),E=Y(y,"mixY",T),R=Y(y,"mixScaleX",1),L=Y(y,"mixScaleY",R),X=Y(y,"mixShearY",1),k=o.curve;k&&(b=he(k,d,b,w,0,f,C,u,A,1),b=he(k,d,b,w,1,f,C,m,T,1),b=he(k,d,b,w,2,f,C,g,E,1),b=he(k,d,b,w,3,f,C,p,R,1),b=he(k,d,b,w,4,f,C,v,L,1),b=he(k,d,b,w,5,f,C,x,X,1)),f=C,u=A,m=T,g=E,p=R,v=L,p=R,o=y}n.push(d)}if(e.path)for(let l in e.path){let r=e.path[l],o=i.findPathConstraint(l);if(!o)throw new Error("Path constraint not found: "+l);let a=i.pathConstraints.indexOf(o);for(let h in r){let d=r[h],f=d[0];if(!f)continue;let u=d.length;if(h==="position"){let m=new ni(u,u,a);n.push(Fe(d,m,0,o.positionMode==0?s:1))}else if(h==="spacing"){let m=new ai(u,u,a);n.push(Fe(d,m,0,o.spacingMode==0||o.spacingMode==1?s:1))}else if(h==="mix"){let m=new li(u,u*3,a),g=Y(f,"time",0),p=Y(f,"mixRotate",1),v=Y(f,"mixX",1),x=Y(f,"mixY",v);for(let w=0,b=0;;w++){m.setFrame(w,g,p,v,x);let y=d[w+1];if(!y){m.shrink(b);break}let C=Y(y,"time",0),A=Y(y,"mixRotate",1),T=Y(y,"mixX",1),E=Y(y,"mixY",T),R=f.curve;R&&(b=he(R,m,b,w,0,g,C,p,A,1),b=he(R,m,b,w,1,g,C,v,T,1),b=he(R,m,b,w,2,g,C,x,E,1)),g=C,p=A,v=T,x=E,f=y}n.push(m)}}}if(e.attachments)for(let l in e.attachments){let r=e.attachments[l],o=i.findSkin(l);if(!o)throw new Error("Skin not found: "+l);for(let a in r){let h=r[a],d=i.findSlot(a);if(!d)throw new Error("Slot not found: "+a);let f=d.index;for(let u in h){let m=h[u],g=o.getAttachment(f,u);for(let p in m){let v=m[p],x=v[0];if(x){if(p=="deform"){let w=g.bones,b=g.vertices,y=w?b.length/3*2:b.length,C=new ii(v.length,v.length,f,g),A=Y(x,"time",0);for(let T=0,E=0;;T++){let R,L=Y(x,"vertices",null);if(!L)R=w?B.newFloatArray(y):b;else{R=B.newFloatArray(y);let I=Y(x,"offset",0);if(B.arrayCopy(L,0,R,I,L.length),s!=1)for(let W=I,se=W+L.length;W<se;W++)R[W]*=s;if(!w)for(let W=0;W<y;W++)R[W]+=b[W]}C.setFrame(T,A,R);let X=v[T+1];if(!X){C.shrink(E);break}let k=Y(X,"time",0),M=x.curve;M&&(E=he(M,C,E,T,0,A,k,0,1,1)),A=k,x=X}n.push(C)}else if(p=="sequence"){let w=new Je(v.length,f,g),b=0;for(let y=0;y<v.length;y++){let C=Y(x,"delay",b),A=Y(x,"time",0),T=Ni[Y(x,"mode","hold")],E=Y(x,"index",0);w.setFrame(y,A,T,E,C),b=C,x=v[y+1]}n.push(w)}}}}}}if(e.drawOrder){let l=new qe(e.drawOrder.length),r=i.slots.length,o=0;for(let a=0;a<e.drawOrder.length;a++,o++){let h=e.drawOrder[a],d=null,f=Y(h,"offsets",null);if(f){d=B.newArray(r,-1);let u=B.newArray(r-f.length,0),m=0,g=0;for(let p=0;p<f.length;p++){let v=f[p],x=i.findSlot(v.slot);if(!x)throw new Error("Slot not found: "+x);let w=x.index;for(;m!=w;)u[g++]=m++;d[m+v.offset]=m++}for(;m<r;)u[g++]=m++;for(let p=r-1;p>=0;p--)d[p]==-1&&(d[p]=u[--g])}l.setFrame(o,Y(h,"time",0),d)}n.push(l)}if(e.events){let l=new lt(e.events.length),r=0;for(let o=0;o<e.events.length;o++,r++){let a=e.events[o],h=i.findEvent(a.name);if(!h)throw new Error("Event not found: "+a.name);let d=new wi(B.toSinglePrecision(Y(a,"time",0)),h);d.intValue=Y(a,"int",h.intValue),d.floatValue=Y(a,"float",h.floatValue),d.stringValue=Y(a,"string",h.stringValue),d.data.audioPath&&(d.volume=Y(a,"volume",1),d.balance=Y(a,"balance",0)),l.setFrame(r,d)}n.push(l)}let c=0;for(let l=0,r=n.length;l<r;l++)c=Math.max(c,n[l].getDuration());i.animations.push(new mt(t,n,c))}},mr=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 Fe(e,t,i,s){let n=e[0],c=Y(n,"time",0),l=Y(n,"value",i)*s,r=0;for(let o=0;;o++){t.setFrame(o,c,l);let a=e[o+1];if(!a)return t.shrink(r),t;let h=Y(a,"time",0),d=Y(a,"value",i)*s;n.curve&&(r=he(n.curve,t,r,o,0,c,h,l,d,s)),c=h,l=d,n=a}}function Ii(e,t,i,s,n,c){let l=e[0],r=Y(l,"time",0),o=Y(l,i,n)*c,a=Y(l,s,n)*c,h=0;for(let d=0;;d++){t.setFrame(d,r,o,a);let f=e[d+1];if(!f)return t.shrink(h),t;let u=Y(f,"time",0),m=Y(f,i,n)*c,g=Y(f,s,n)*c,p=l.curve;p&&(h=he(p,t,h,d,0,r,u,o,m,c),h=he(p,t,h,d,1,r,u,a,g,c)),r=u,o=m,a=g,l=f}}function he(e,t,i,s,n,c,l,r,o,a){if(e=="stepped")return t.setStepped(s),i;let h=n<<2,d=e[h],f=e[h+1]*a,u=e[h+2],m=e[h+3]*a;return t.setBezier(i,s,n,c,r,d,f,u,m,l,o),i+1}function Y(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 we=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,c=this.restorables.length;n<c;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)}},Et=class extends di{context;texture=null;boundUnit=0;useMipMaps=!1;constructor(e,t,i=!1){super(t),this.context=e instanceof we?e:new we(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,Et.validateMagFilter(t)),this.useMipMaps=Et.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(),Et.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)}},ht=Et;P(ht,"DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL",!1);var cs=class extends is{constructor(e,t="",i=new xi){super(s=>new ht(e,s),t,i)}},Ae=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[q]+this.z*t[G]+t[V],this.x*t[H]+this.y*t[N]+this.z*t[j]+t[U],this.x*t[Z]+this.y*t[K]+this.z*t[z]+t[_])}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[q]+this.z*t[G]+t[V])*i,(this.x*t[H]+this.y*t[N]+this.z*t[j]+t[U])*i,(this.x*t[Z]+this.y*t[K]+this.z*t[z]+t[_])*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,q=4,G=8,V=12,H=1,N=5,j=9,U=13,Z=2,K=6,z=10,_=14,Q=3,$=7,ee=11,J=15,ke=class{temp=new Float32Array(16);values=new Float32Array(16);constructor(){let e=this.values;e[O]=1,e[N]=1,e[z]=1,e[J]=1}set(e){return this.values.set(e),this}transpose(){let e=this.temp,t=this.values;return e[O]=t[O],e[q]=t[H],e[G]=t[Z],e[V]=t[Q],e[H]=t[q],e[N]=t[N],e[j]=t[K],e[U]=t[$],e[Z]=t[G],e[K]=t[j],e[z]=t[z],e[_]=t[ee],e[Q]=t[V],e[$]=t[U],e[ee]=t[_],e[J]=t[J],this.set(e)}identity(){let e=this.values;return e[O]=1,e[q]=0,e[G]=0,e[V]=0,e[H]=0,e[N]=1,e[j]=0,e[U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]*e[H]*e[ee]-e[O]*e[N]*e[ee],t[J]=e[q]*e[j]*e[Z]-e[G]*e[N]*e[Z]+e[G]*e[H]*e[K]-e[O]*e[j]*e[K]-e[q]*e[H]*e[z]+e[O]*e[N]*e[z],e[O]=t[O]*s,e[q]=t[q]*s,e[G]=t[G]*s,e[V]=t[V]*s,e[H]=t[H]*s,e[N]=t[N]*s,e[j]=t[j]*s,e[U]=t[U]*s,e[Z]=t[Z]*s,e[K]=t[K]*s,e[z]=t[z]*s,e[_]=t[_]*s,e[Q]=t[Q]*s,e[$]=t[$]*s,e[ee]=t[ee]*s,e[J]=t[J]*s,this}determinant(){let e=this.values;return e[Q]*e[K]*e[j]*e[V]-e[Z]*e[$]*e[j]*e[V]-e[Q]*e[N]*e[z]*e[V]+e[H]*e[$]*e[z]*e[V]+e[Z]*e[N]*e[ee]*e[V]-e[H]*e[K]*e[ee]*e[V]-e[Q]*e[K]*e[G]*e[U]+e[Z]*e[$]*e[G]*e[U]+e[Q]*e[q]*e[z]*e[U]-e[O]*e[$]*e[z]*e[U]-e[Z]*e[q]*e[ee]*e[U]+e[O]*e[K]*e[ee]*e[U]+e[Q]*e[N]*e[G]*e[_]-e[H]*e[$]*e[G]*e[_]-e[Q]*e[q]*e[j]*e[_]+e[O]*e[$]*e[j]*e[_]+e[H]*e[q]*e[ee]*e[_]-e[O]*e[N]*e[ee]*e[_]-e[Z]*e[N]*e[G]*e[J]+e[H]*e[K]*e[G]*e[J]+e[Z]*e[q]*e[j]*e[J]-e[O]*e[K]*e[j]*e[J]-e[H]*e[q]*e[z]*e[J]+e[O]*e[N]*e[z]*e[J]}translate(e,t,i){let s=this.values;return s[V]+=e,s[U]+=t,s[_]+=i,this}copy(){return new ke().set(this.values)}projection(e,t,i,s){this.identity();let n=1/Math.tan(i*(Math.PI/180)/2),c=(t+e)/(e-t),l=2*t*e/(e-t),r=this.values;return r[O]=n/s,r[H]=0,r[Z]=0,r[Q]=0,r[q]=0,r[N]=n,r[K]=0,r[$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*s[ee],t[J]=i[Q]*s[V]+i[$]*s[U]+i[ee]*s[_]+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[q]*i[H]+s[G]*i[Z]+s[V]*i[Q],t[q]=s[O]*i[q]+s[q]*i[N]+s[G]*i[K]+s[V]*i[$],t[G]=s[O]*i[G]+s[q]*i[j]+s[G]*i[z]+s[V]*i[ee],t[V]=s[O]*i[V]+s[q]*i[U]+s[G]*i[_]+s[V]*i[J],t[H]=s[H]*i[O]+s[N]*i[H]+s[j]*i[Z]+s[U]*i[Q],t[N]=s[H]*i[q]+s[N]*i[N]+s[j]*i[K]+s[U]*i[$],t[j]=s[H]*i[G]+s[N]*i[j]+s[j]*i[z]+s[U]*i[ee],t[U]=s[H]*i[V]+s[N]*i[U]+s[j]*i[_]+s[U]*i[J],t[Z]=s[Z]*i[O]+s[K]*i[H]+s[z]*i[Z]+s[_]*i[Q],t[K]=s[Z]*i[q]+s[K]*i[N]+s[z]*i[K]+s[_]*i[$],t[z]=s[Z]*i[G]+s[K]*i[j]+s[z]*i[z]+s[_]*i[ee],t[_]=s[Z]*i[V]+s[K]*i[U]+s[z]*i[_]+s[_]*i[J],t[Q]=s[Q]*i[O]+s[$]*i[H]+s[ee]*i[Z]+s[J]*i[Q],t[$]=s[Q]*i[q]+s[$]*i[N]+s[ee]*i[K]+s[J]*i[$],t[ee]=s[Q]*i[G]+s[$]*i[j]+s[ee]*i[z]+s[J]*i[ee],t[J]=s[Q]*i[V]+s[$]*i[U]+s[ee]*i[_]+s[J]*i[J],this.set(this.temp)}lookAt(e,t,i){let s=ke.xAxis,n=ke.yAxis,c=ke.zAxis;c.setFrom(t).normalize(),s.setFrom(t).normalize(),s.cross(i).normalize(),n.setFrom(s).cross(c).normalize(),this.identity();let l=this.values;return l[O]=s.x,l[q]=s.y,l[G]=s.z,l[H]=n.x,l[N]=n.y,l[j]=n.z,l[Z]=-c.x,l[K]=-c.y,l[z]=-c.z,ke.tmpMatrix.identity(),ke.tmpMatrix.values[V]=-e.x,ke.tmpMatrix.values[U]=-e.y,ke.tmpMatrix.values[_]=-e.z,this.multiply(ke.tmpMatrix),this}},Pe=ke;P(Pe,"xAxis",new Ae),P(Pe,"yAxis",new Ae),P(Pe,"zAxis",new Ae),P(Pe,"tmpMatrix",new ke);var ds=class{position=new Ae(0,0,0);direction=new Ae(0,0,-1);up=new Ae(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new Pe;inverseProjectionView=new Pe;projection=new Pe;view=new Pe;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,c=this.viewportWidth,l=this.viewportHeight;e.ortho(n*(-c/2),n*(c/2),n*(-l/2),n*(l/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}},Yi=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=l=>{if(l instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=l.clientX-r.left,this.mouseY=l.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=l=>{if(l instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=l.clientX-r.left,this.mouseY=l.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=l=>{if(l instanceof MouseEvent){let r=e.getBoundingClientRect();this.mouseX=l.clientX-r.left,this.mouseY=l.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=l=>{l.preventDefault();let r=l.deltaY;l.deltaMode==WheelEvent.DOM_DELTA_LINE&&(r*=8),l.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(r*=24),this.listeners.map(o=>{o.wheel&&o.wheel(l.deltaY)})};e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",i,!0),e.addEventListener("mouseup",s,!0),e.addEventListener("wheel",n,!0),e.addEventListener("touchstart",l=>{if(!this.touch0||!this.touch1){var r=l.changedTouches;let o=r.item(0);if(!o)return;let a=e.getBoundingClientRect(),h=o.clientX-a.left,d=o.clientY-a.top,f=new fs(o.identifier,h,d);if(this.mouseX=h,this.mouseY=d,this.buttonDown=!0,!this.touch0)this.touch0=f,this.listeners.map(u=>{u.down&&u.down(f.x,f.y)});else if(!this.touch1){this.touch1=f;let u=this.touch1.x-this.touch0.x,m=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(u*u+m*m),this.listeners.map(g=>{g.zoom&&g.zoom(this.initialPinchDistance,this.initialPinchDistance)})}}l.preventDefault()},!1),e.addEventListener("touchmove",l=>{if(this.touch0){var r=l.changedTouches;let h=e.getBoundingClientRect();for(var o=0;o<r.length;o++){var a=r[o];let d=a.clientX-h.left,f=a.clientY-h.top;this.touch0.identifier===a.identifier&&(this.touch0.x=this.mouseX=d,this.touch0.y=this.mouseY=f,this.listeners.map(u=>{u.dragged&&u.dragged(d,f)})),this.touch1&&this.touch1.identifier===a.identifier&&(this.touch1.x=this.mouseX=d,this.touch1.y=this.mouseY=f)}if(this.touch0&&this.touch1){let d=this.touch1.x-this.touch0.x,f=this.touch1.x-this.touch0.x,u=Math.sqrt(d*d+f*f);this.listeners.map(m=>{m.zoom&&m.zoom(this.initialPinchDistance,u)})}}l.preventDefault()},!1);let c=l=>{if(this.touch0){var r=l.changedTouches;let h=e.getBoundingClientRect();for(var o=0;o<r.length;o++){var a=r[o];let d=a.clientX-h.left,f=a.clientY-h.top;if(this.touch0.identifier===a.identifier)if(this.touch0=null,this.mouseX=d,this.mouseY=f,this.listeners.map(u=>{u.up&&u.up(d,f)}),this.touch1)this.touch0=this.touch1,this.touch1=null,this.mouseX=this.touch0.x,this.mouseX=this.touch0.x,this.buttonDown=!0,this.listeners.map(u=>{u.down&&u.down(this.touch0.x,this.touch0.y)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}l.preventDefault()};e.addEventListener("touchend",c,!1),e.addEventListener("touchcancel",c)}addListener(e){this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}},fs=class{constructor(e,t,i){this.identifier=e,this.x=t,this.y=i}},gr=class{constructor(e,t){this.canvas=e,this.camera=t;let i=0,s=0,n=0,c=0,l=0,r=0,o=0,a=0;new Yi(e).addListener({down:(h,d)=>{i=t.position.x,s=t.position.y,c=r=h,l=o=d,a=t.zoom},dragged:(h,d)=>{let f=h-c,u=d-l,m=t.screenToWorld(new Ae(0,0),e.clientWidth,e.clientHeight),g=t.screenToWorld(new Ae(f,u),e.clientWidth,e.clientHeight).sub(m);t.position.set(i-g.x,s-g.y,0),t.update(),r=h,o=d},wheel:h=>{let d=h/200*t.zoom,f=t.zoom+d;if(f>0){let u=0,m=0;if(h<0)u=r,m=o;else{let v=new Ae(e.clientWidth/2+15,e.clientHeight/2),x=r-v.x,w=e.clientHeight-1-o-v.y;u=v.x-x,m=e.clientHeight-1-v.y+w}let g=t.screenToWorld(new Ae(u,m),e.clientWidth,e.clientHeight);t.zoom=f,t.update();let p=t.screenToWorld(new Ae(u,m),e.clientWidth,e.clientHeight);t.position.add(g.sub(p)),t.update()}},zoom:(h,d)=>{let f=h/d;t.zoom=a*f},up:(h,d)=>{r=h,o=d},moved:(h,d)=>{r=h,o=d}})}},ue=class{constructor(e,t,i){this.vertexShader=t,this.fragmentShader=i,this.vsSource=t,this.fsSource=i,this.context=e instanceof we?e:new we(e),this.context.addRestorable(this),this.compile()}context;vs=null;vsSource;fs=null;fsSource;program=null;tmp2x2=new Float32Array(2*2);tmp3x3=new Float32Array(3*3);tmp4x4=new Float32Array(4*4);getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){let e=this.context.gl;try{if(this.vs=this.compileShader(e.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(e.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(t){throw this.dispose(),t}}compileShader(e,t){let i=this.context.gl,s=i.createShader(e);if(!s)throw new Error("Couldn't create shader.");if(i.shaderSource(s,t),i.compileShader(s),!i.getShaderParameter(s,i.COMPILE_STATUS)){let n="Couldn't compile shader: "+i.getShaderInfoLog(s);if(i.deleteShader(s),!i.isContextLost())throw new Error(n)}return s}compileProgram(e,t){let i=this.context.gl,s=i.createProgram();if(!s)throw new Error("Couldn't compile program.");if(i.attachShader(s,e),i.attachShader(s,t),i.linkProgram(s),!i.getProgramParameter(s,i.LINK_STATUS)){let n="Couldn't compile shader program: "+i.getProgramInfoLog(s);if(i.deleteProgram(s),!i.isContextLost())throw new Error(n)}return s}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(e,t){this.context.gl.uniform1i(this.getUniformLocation(e),t)}setUniformf(e,t){this.context.gl.uniform1f(this.getUniformLocation(e),t)}setUniform2f(e,t,i){this.context.gl.uniform2f(this.getUniformLocation(e),t,i)}setUniform3f(e,t,i,s){this.context.gl.uniform3f(this.getUniformLocation(e),t,i,s)}setUniform4f(e,t,i,s,n){this.context.gl.uniform4f(this.getUniformLocation(e),t,i,s,n)}setUniform2x2f(e,t){let i=this.context.gl;this.tmp2x2.set(t),i.uniformMatrix2fv(this.getUniformLocation(e),!1,this.tmp2x2)}setUniform3x3f(e,t){let i=this.context.gl;this.tmp3x3.set(t),i.uniformMatrix3fv(this.getUniformLocation(e),!1,this.tmp3x3)}setUniform4x4f(e,t){let i=this.context.gl;this.tmp4x4.set(t),i.uniformMatrix4fv(this.getUniformLocation(e),!1,this.tmp4x4)}getUniformLocation(e){let t=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=t.getUniformLocation(this.program,e);if(!i&&!t.isContextLost())throw new Error(`Couldn't find location for uniform ${e}`);return i}getAttributeLocation(e){let t=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=t.getAttribLocation(this.program,e);if(i==-1&&!t.isContextLost())throw new Error(`Couldn't find location for attribute ${e}`);return i}dispose(){this.context.removeRestorable(this);let e=this.context.gl;this.vs&&(e.deleteShader(this.vs),this.vs=null),this.fs&&(e.deleteShader(this.fs),this.fs=null),this.program&&(e.deleteProgram(this.program),this.program=null)}static newColoredTextured(e){let t=`
|
|
3
3
|
attribute vec4 ${ue.POSITION};
|
|
4
4
|
attribute vec4 ${ue.COLOR};
|
|
5
5
|
attribute vec2 ${ue.TEXCOORDS};
|
|
@@ -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)}},ge=ue;P(ge,"MVP_MATRIX","u_projTrans"),P(ge,"POSITION","a_position"),P(ge,"COLOR","a_color"),P(ge,"COLOR2","a_color2"),P(ge,"TEXCOORDS","a_texCoords"),P(ge,"SAMPLER","u_texture");var Mi=class{constructor(e,t,i,s){this.attributes=t,this.context=e instanceof we?e:new we(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],c=e.getAttributeLocation(n.name);t.enableVertexAttribArray(c),t.vertexAttribPointer(c,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)}},$e=class{constructor(e,t,i){this.name=e,this.type=t,this.numElements=i}},kt=class extends $e{constructor(){super(ge.POSITION,He.Float,2)}},xr=class extends $e{constructor(){super(ge.POSITION,He.Float,3)}},Ei=class extends $e{constructor(e=0){super(ge.TEXCOORDS+(e==0?"":e),He.Float,2)}},Rt=class extends $e{constructor(){super(ge.COLOR,He.Float,4)}},us=class extends $e{constructor(){super(ge.COLOR2,He.Float,4)}},He=(e=>(e[e.Float=0]="Float",e))(He||{}),De=1,wr=769,ms=770,gs=771,xs=774,je=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 we?e:new we(e);let s=t?[new kt,new Rt,new Ei,new us]:[new kt,new Rt,new Ei];this.mesh=new Mi(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),je.disableCulling&&(this.cullWasEnabled=t.isEnabled(t.CULL_FACE),this.cullWasEnabled&&t.disable(t.CULL_FACE))}setBlendMode(e,t){const i=je.blendModesGL[e],s=t?i.srcRgbPma:i.srcRgb,n=i.srcAlpha,c=i.dstRgb;if(this.srcColorBlend==s&&this.srcAlphaBlend==n&&this.dstBlend==c)return;this.srcColorBlend=s,this.srcAlphaBlend=n,this.dstBlend=c,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(s,c,n,c)}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 c=this.indicesLength,l=0;l<i.length;c++,l++)n[c]=i[l]+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++,je.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),je.disableCulling&&this.cullWasEnabled&&e.enable(e.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let e=je.globalDrawCalls;return je.globalDrawCalls=0,e}dispose(){this.mesh.dispose()}},et=je;P(et,"disableCulling",!1),P(et,"globalDrawCalls",0),P(et,"blendModesGL",[{srcRgb:ms,srcRgbPma:De,dstRgb:gs,srcAlpha:De},{srcRgb:ms,srcRgbPma:De,dstRgb:De,srcAlpha:De},{srcRgb:xs,srcRgbPma:xs,dstRgb:gs,srcAlpha:De},{srcRgb:De,srcRgbPma:De,dstRgb:wr,srcAlpha:De}]);var ki=class{context;isDrawing=!1;mesh;shapeType=pe.Filled;color=new D(1,1,1,1);shader=null;vertexIndex=0;tmp=new _e;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 we?e:new we(e),this.mesh=new Mi(e,[new kt,new Rt],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(pe.Point,1),i||(i=this.color),this.vertex(e,t,i)}line(e,t,i,s,n){this.check(pe.Line,2);let c=this.mesh.getVertices(),l=this.vertexIndex;n||(n=this.color),this.vertex(e,t,n),this.vertex(i,s,n)}triangle(e,t,i,s,n,c,l,r,o,a){this.check(e?pe.Filled:pe.Line,3);let h=this.mesh.getVertices(),d=this.vertexIndex;r||(r=this.color),o||(o=this.color),a||(a=this.color),e?(this.vertex(t,i,r),this.vertex(s,n,o),this.vertex(c,l,a)):(this.vertex(t,i,r),this.vertex(s,n,o),this.vertex(s,n,r),this.vertex(c,l,o),this.vertex(c,l,r),this.vertex(t,i,o))}quad(e,t,i,s,n,c,l,r,o,a,h,d,f){this.check(e?pe.Filled:pe.Line,3);let u=this.mesh.getVertices(),m=this.vertexIndex;a||(a=this.color),h||(h=this.color),d||(d=this.color),f||(f=this.color),e?(this.vertex(t,i,a),this.vertex(s,n,h),this.vertex(c,l,d),this.vertex(c,l,d),this.vertex(r,o,f),this.vertex(t,i,a)):(this.vertex(t,i,a),this.vertex(s,n,h),this.vertex(s,n,h),this.vertex(c,l,d),this.vertex(c,l,d),this.vertex(r,o,f),this.vertex(r,o,f),this.vertex(t,i,a))}rect(e,t,i,s,n,c){this.quad(e,t,i,t+s,i,t+s,i+n,t,i+n,c,c,c,c)}rectLine(e,t,i,s,n,c,l){this.check(e?pe.Filled:pe.Line,8),l||(l=this.color);let r=this.tmp.set(n-i,t-s);r.normalize(),c*=.5;let o=r.x*c,a=r.y*c;e?(this.vertex(t+o,i+a,l),this.vertex(t-o,i-a,l),this.vertex(s+o,n+a,l),this.vertex(s-o,n-a,l),this.vertex(s+o,n+a,l),this.vertex(t-o,i-a,l)):(this.vertex(t+o,i+a,l),this.vertex(t-o,i-a,l),this.vertex(s+o,n+a,l),this.vertex(s-o,n-a,l),this.vertex(s+o,n+a,l),this.vertex(t+o,i+a,l),this.vertex(s-o,n-a,l),this.vertex(t-o,i-a,l))}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(pe.Line,i*2),s||(s=this.color);let n=this.mesh.getVertices(),c=this.vertexIndex;t<<=1,i<<=1;let l=e[t],r=e[t+1],o=t+i;for(let a=t,h=t+i-2;a<h;a+=2){let d=e[a],f=e[a+1],u=0,m=0;a+2>=o?(u=l,m=r):(u=e[a+2],m=e[a+3]),this.vertex(d,f,s),this.vertex(u,m,s)}}circle(e,t,i,s,n,c=0){if(c==0&&(c=Math.max(1,6*F.cbrt(s)|0)),c<=0)throw new Error("segments must be > 0.");n||(n=this.color);let l=2*F.PI/c,r=Math.cos(l),o=Math.sin(l),a=s,h=0;if(e){this.check(pe.Filled,c*3+3),c--;for(let f=0;f<c;f++){this.vertex(t,i,n),this.vertex(t+a,i+h,n);let u=a;a=r*a-o*h,h=o*u+r*h,this.vertex(t+a,i+h,n)}this.vertex(t,i,n),this.vertex(t+a,i+h,n)}else{this.check(pe.Line,c*2+2);for(let f=0;f<c;f++){this.vertex(t+a,i+h,n);let u=a;a=r*a-o*h,h=o*u+r*h,this.vertex(t+a,i+h,n)}this.vertex(t+a,i+h,n)}let d=a;a=s,h=0,this.vertex(t+a,i+h,n)}curve(e,t,i,s,n,c,l,r,o,a){this.check(pe.Line,o*2+2),a||(a=this.color);let h=1/o,d=h*h,f=h*h*h,u=3*h,m=3*d,g=6*d,p=6*f,v=e-i*2+n,x=t-s*2+c,w=(i-n)*3-e+l,b=(s-c)*3-t+r,y=e,C=t,A=(i-e)*u+v*m+w*f,T=(s-t)*u+x*m+b*f,E=v*g+w*p,R=x*g+b*p,L=w*p,X=b*p;for(;o-- >0;)this.vertex(y,C,a),y+=A,C+=T,A+=E,T+=R,E+=L,R+=X,this.vertex(y,C,a);this.vertex(y,C,a),this.vertex(l,r,a)}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()}},pe=(e=>(e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.Filled=4]="Filled",e))(pe||{}),Ri=class{boneLineColor=new D(1,0,0,1);boneOriginColor=new D(0,1,0,1);attachmentLineColor=new D(0,0,1,.5);triangleLineColor=new D(1,.64,0,.5);pathColor=new D().setFromString("FF7F00");clipColor=new D(.8,0,0,2);aabbColor=new D(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 hs;temp=new Array;vertices=B.newFloatArray(2*1024);constructor(e){this.context=e instanceof we?e:new we(e)}draw(e,t,i){let s=t.x,n=t.y,c=this.context.gl,l=this.premultipliedAlpha?c.ONE:c.SRC_ALPHA;e.setBlendMode(l,c.ONE,c.ONE_MINUS_SRC_ALPHA);let r=t.bones;if(this.drawBones){e.setColor(this.boneLineColor);for(let o=0,a=r.length;o<a;o++){let h=r[o];if(i&&i.indexOf(h.data.name)>-1||!h.parent)continue;let d=h.data.length*h.a+h.worldX,f=h.data.length*h.c+h.worldY;e.rectLine(!0,h.worldX,h.worldY,d,f,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 a=0,h=o.length;a<h;a++){let d=o[a],f=d.getAttachment();if(f instanceof ae){let u=f,m=this.vertices;u.computeWorldVertices(d,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 a=0,h=o.length;a<h;a++){let d=o[a];if(!d.bone.active)continue;let f=d.getAttachment();if(!(f instanceof Ve))continue;let u=f,m=this.vertices;u.computeWorldVertices(d,0,u.worldVerticesLength,m,0,2);let g=u.triangles,p=u.hullLength;if(this.drawMeshTriangles){e.setColor(this.triangleLineColor);for(let v=0,x=g.length;v<x;v+=3){let w=g[v]*2,b=g[v+1]*2,y=g[v+2]*2;e.triangle(!1,m[w],m[w+1],m[b],m[b+1],m[y],m[y+1])}}if(this.drawMeshHull&&p>0){e.setColor(this.attachmentLineColor),p=(p>>1)*2;let v=m[p-2],x=m[p-1];for(let w=0,b=p;w<b;w+=2){let y=m[w],C=m[w+1];e.line(y,C,v,x),v=y,x=C}}}}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 a=o.polygons,h=o.boundingBoxes;for(let d=0,f=a.length;d<f;d++){let u=a[d];e.setColor(h[d].color),e.polygon(u,0,u.length)}}if(this.drawPaths){let o=t.slots;for(let a=0,h=o.length;a<h;a++){let d=o[a];if(!d.bone.active)continue;let f=d.getAttachment();if(!(f instanceof Ge))continue;let u=f,m=u.worldVerticesLength,g=this.temp=B.setArraySize(this.temp,m,0);u.computeWorldVertices(d,0,m,g,0,2);let p=this.pathColor,v=g[2],x=g[3],w=0,b=0;if(u.closed){e.setColor(p);let y=g[0],C=g[1],A=g[m-2],T=g[m-1];w=g[m-4],b=g[m-3],e.curve(v,x,y,C,A,T,w,b,32),e.setColor(Ri.LIGHT_GRAY),e.line(v,x,y,C),e.line(w,b,A,T)}m-=4;for(let y=4;y<m;y+=6){let C=g[y],A=g[y+1],T=g[y+2],E=g[y+3];w=g[y+4],b=g[y+5],e.setColor(p),e.curve(v,x,C,A,T,E,w,b,32),e.setColor(Ri.LIGHT_GRAY),e.line(v,x,C,A),e.line(w,b,T,E),v=w,x=b}}}if(this.drawBones){e.setColor(this.boneOriginColor);for(let o=0,a=r.length;o<a;o++){let h=r[o];i&&i.indexOf(h.data.name)>-1||e.circle(!0,h.worldX,h.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=t.slots;e.setColor(this.clipColor);for(let a=0,h=o.length;a<h;a++){let d=o[a];if(!d.bone.active)continue;let f=d.getAttachment();if(!(f instanceof ot))continue;let u=f,m=u.worldVerticesLength,g=this.temp=B.setArraySize(this.temp,m,0);u.computeWorldVertices(d,0,m,g,0,2);for(let p=0,v=g.length;p<v;p+=2){let x=g[p],w=g[p+1],b=g[(p+2)%g.length],y=g[(p+3)%g.length];e.line(x,w,b,y)}}}}dispose(){}},Ft=Ri;P(Ft,"LIGHT_GRAY",new D(.7529411764705882,.7529411764705882,.7529411764705882,1)),P(Ft,"GREEN",new D(0,1,0,1));var br=class{constructor(e,t,i){this.vertices=e,this.numVertices=t,this.numFloats=i}},ws=class{premultipliedAlpha=!1;tempColor=new D;tempColor2=new D;vertices;vertexSize=2+2+4;twoColorTint=!1;renderable=new br([],0,0);clipper=new Mt;temp=new _e;temp2=new _e;temp3=new D;temp4=new D;constructor(e,t=!0){this.twoColorTint=t,t&&(this.vertexSize+=4),this.vertices=B.newFloatArray(this.vertexSize*1024)}draw(e,t,i=-1,s=-1,n=null){let c=this.clipper,l=this.premultipliedAlpha,r=this.twoColorTint,o=null,a=this.renderable,h,d,f=t.drawOrder,u,m=t.color,g=r?12:8,p=!1;i==-1&&(p=!0);for(let v=0,x=f.length;v<x;v++){let w=c.isClipping()?2:g,b=f[v];if(!b.bone.active){c.clipEndWithSlot(b);continue}if(i>=0&&i==b.data.index&&(p=!0),!p){c.clipEndWithSlot(b);continue}s>=0&&s==b.data.index&&(p=!1);let y=b.getAttachment(),C;if(y instanceof ae){let A=y;a.vertices=this.vertices,a.numVertices=4,a.numFloats=w<<2,A.computeWorldVertices(b,a.vertices,0,w),d=ws.QUAD_TRIANGLES,h=A.uvs,C=A.region.texture,u=A.color}else if(y instanceof Ve){let A=y;a.vertices=this.vertices,a.numVertices=A.worldVerticesLength>>1,a.numFloats=a.numVertices*w,a.numFloats>a.vertices.length&&(a.vertices=this.vertices=B.newFloatArray(a.numFloats)),A.computeWorldVertices(b,0,A.worldVerticesLength,a.vertices,0,w),d=A.triangles,C=A.region.texture,h=A.uvs,u=A.color}else if(y instanceof ot){let A=y;c.clipStart(b,A);continue}else{c.clipEndWithSlot(b);continue}if(C){let A=b.color,T=this.tempColor;T.r=m.r*A.r*u.r,T.g=m.g*A.g*u.g,T.b=m.b*A.b*u.b,T.a=m.a*A.a*u.a,l&&(T.r*=T.a,T.g*=T.a,T.b*=T.a);let E=this.tempColor2;b.darkColor?(l?(E.r=b.darkColor.r*T.a,E.g=b.darkColor.g*T.a,E.b=b.darkColor.b*T.a):E.setFromColor(b.darkColor),E.a=l?1:0):E.set(0,0,0,1);let R=b.data.blendMode;if(R!=o&&(o=R,e.setBlendMode(o,l)),c.isClipping()){c.clipTriangles(a.vertices,a.numFloats,d,d.length,h,T,E,r);let L=new Float32Array(c.clippedVertices),X=c.clippedTriangles;n&&n(L,L.length,g),e.draw(C,L,X)}else{let L=a.vertices;if(r)for(let k=2,M=0,I=a.numFloats;k<I;k+=g,M+=2)L[k]=T.r,L[k+1]=T.g,L[k+2]=T.b,L[k+3]=T.a,L[k+4]=h[M],L[k+5]=h[M+1],L[k+6]=E.r,L[k+7]=E.g,L[k+8]=E.b,L[k+9]=E.a;else for(let k=2,M=0,I=a.numFloats;k<I;k+=g,M+=2)L[k]=T.r,L[k+1]=T.g,L[k+2]=T.b,L[k+3]=T.a,L[k+4]=h[M],L[k+5]=h[M+1];let X=a.vertices.subarray(0,a.numFloats);n&&n(a.vertices,a.numFloats,g),e.draw(C,X,d)}}c.clipEndWithSlot(b)}c.clipEnd()}},Fi=ws;P(Fi,"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],Xt=[0,1,2,2,3,0],Lt=new D(1,1,1,1),bs=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 we?t:new we(t),this.twoColorTint=i,this.camera=new ds(e.width,e.height),this.batcherShader=i?ge.newTwoColoredTextured(this.context):ge.newColoredTextured(this.context),this.batcher=new et(this.context,i),this.shapesShader=ge.newColored(this.context),this.shapes=new ki(this.context),this.skeletonRenderer=new Fi(this.context,i),this.skeletonDebugRenderer=new Ft(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,c){this.enableRenderer(this.batcher),c||(c=Lt);var l=0;S[l++]=t,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=0,S[l++]=1,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t+s,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=1,S[l++]=1,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t+s,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=1,S[l++]=0,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=0,S[l++]=0,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l]=0),this.batcher.draw(e,S,Xt)}drawTextureUV(e,t,i,s,n,c,l,r,o,a){this.enableRenderer(this.batcher),a||(a=Lt);var h=0;S[h++]=t,S[h++]=i,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=c,S[h++]=l,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h++]=0),S[h++]=t+s,S[h++]=i,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=r,S[h++]=l,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h++]=0),S[h++]=t+s,S[h++]=i+n,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=r,S[h++]=o,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h++]=0),S[h++]=t,S[h++]=i+n,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=c,S[h++]=o,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h]=0),this.batcher.draw(e,S,Xt)}drawTextureRotated(e,t,i,s,n,c,l,r,o){this.enableRenderer(this.batcher),o||(o=Lt);let a=t+c,h=i+l,d=-c,f=-l,u=s-c,m=n-l,g=d,p=f,v=d,x=m,w=u,b=m,y=u,C=f,A=0,T=0,E=0,R=0,L=0,X=0,k=0,M=0;if(r!=0){let W=F.cosDeg(r),se=F.sinDeg(r);A=W*g-se*p,T=se*g+W*p,k=W*v-se*x,M=se*v+W*x,L=W*w-se*b,X=se*w+W*b,E=L+(A-k),R=X+(T-M)}else A=g,T=p,k=v,M=x,L=w,X=b,E=y,R=C;A+=a,T+=h,E+=a,R+=h,L+=a,X+=h,k+=a,M+=h;var I=0;S[I++]=A,S[I++]=T,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=0,S[I++]=1,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=E,S[I++]=R,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=1,S[I++]=1,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=L,S[I++]=X,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=1,S[I++]=0,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=k,S[I++]=M,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=0,S[I++]=0,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I]=0),this.batcher.draw(e,S,Xt)}drawRegion(e,t,i,s,n,c){this.enableRenderer(this.batcher),c||(c=Lt);var l=0;S[l++]=t,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=e.u,S[l++]=e.v2,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t+s,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=e.u2,S[l++]=e.v2,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t+s,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=e.u2,S[l++]=e.v,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=e.u,S[l++]=e.v,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l]=0),this.batcher.draw(e.page.texture,S,Xt)}line(e,t,i,s,n,c){this.enableRenderer(this.shapes),this.shapes.line(e,t,i,s,n)}triangle(e,t,i,s,n,c,l,r,o,a){this.enableRenderer(this.shapes),this.shapes.triangle(e,t,i,s,n,c,l,r,o,a)}quad(e,t,i,s,n,c,l,r,o,a,h,d,f){this.enableRenderer(this.shapes),this.shapes.quad(e,t,i,s,n,c,l,r,o,a,h,d,f)}rect(e,t,i,s,n,c){this.enableRenderer(this.shapes),this.shapes.rect(e,t,i,s,n,c)}rectLine(e,t,i,s,n,c,l){this.enableRenderer(this.shapes),this.shapes.rectLine(e,t,i,s,n,c,l)}polygon(e,t,i,s){this.enableRenderer(this.shapes),this.shapes.polygon(e,t,i,s)}circle(e,t,i,s,n,c=0){this.enableRenderer(this.shapes),this.shapes.circle(e,t,i,s,n,c)}curve(e,t,i,s,n,c,l,r,o,a){this.enableRenderer(this.shapes),this.shapes.curve(e,t,i,s,n,c,l,r,o,a)}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===Bt.Expand)this.camera.setViewport(s,n);else if(e===Bt.Fit){let c=t.width,l=t.height,r=this.camera.viewportWidth,o=this.camera.viewportHeight,a=o/r,h=l/c,d=a<h?r/c:o/l;this.camera.setViewport(c*d,l*d)}this.camera.update()}enableRenderer(e){this.activeRenderer!==e&&(this.end(),e instanceof et?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(ge.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):e instanceof ki?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(ge.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},Bt=(e=>(e[e.Stretch=0]="Stretch",e[e.Expand=1]="Expand",e[e.Fit=2]="Fit",e))(Bt||{}),ct,tt,ps=0,pr=1,Xi=1,vs=165,ys=108,Ze=163,vr=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new Vt;backgroundColor=new D(.135,.135,.135,1);tempColor=new D;constructor(e){if(this.renderer=e,this.timeKeeper.maxDelta=9,!tt){let t=navigator.userAgent.indexOf("Safari")>-1,i=()=>ps++;tt=new Image,tt.src=Ar,t||(tt.crossOrigin="anonymous"),tt.onload=i,ct=new Image,ct.src=yr,t||(ct.crossOrigin="anonymous"),ct.onload=i}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(e=!1){if(ps<2||e&&this.fadeOut>Xi)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,c=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>Xi)return;i.setFromColor(this.backgroundColor),t=1-this.fadeOut/Xi,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&&(c.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),c.clear(c.COLOR_BUFFER_BIT)),t=1;t*=Math.min(this.fadeIn/pr,1),i.set(t,t,t,t),this.logo||(this.logo=new ht(s.context,tt),this.spinner=new ht(s.context,ct)),s.camera.zoom=Math.max(1,Ze/n.height),s.begin(),s.drawTexture(this.logo,(n.width-vs)/2,(n.height-ys)/2,vs,ys,i),this.spinner&&s.drawTextureRotated(this.spinner,(n.width-Ze)/2,(n.height-Ze)/2,Ze,Ze,Ze/2,Ze/2,this.angle,i),s.end()}},yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKMAAACjCAYAAADmbK6AAAALKElEQVR42u2de2iW5R/GPzuqcwfnnKfNmafl5tTNHWzqNi3DEMQykcAoJSsySkspjSIk0iD/07Kf4R+FnVBDUTshZGpWUEJaaiWFgZlUFmXmIe3HNXthyebeZ77P9H13ffBG8Y8H7ut7vff93N/7fu4vGGPiFZiez/Qtw9lytJajfzfw9z/j+efPOv7cV8W+lUNY2a8T/ayTCRsWFLJA5rtUO1LLkV5p9LJeJizQiHeqnlOtmVFtdTGrrZkJCxYXsTgaI6r9MY4/UpNItW4mFDaXsTlaM6qVZlBq3UwofFrJp0HMWJ9DvXUzobCznJ1BzFjWlTLrZkJh/TDWBzFjTgo51s2EgnKI0Rrx+FiOWzNzVaym91Syx5qZsGBWb2ZFa0ZN6dbMhAWTcpkUrRmXD2K5NTNhgVbH0Zpxbl/mWjMTFvRIo0e0ZpzcncnWzISKtvmiMWNRJ4qslwmVXRXsas2Ix8ZwzFqZsGFREYtaM+Oaa1ljrUzYkJ9G/ok6TlzKjJWZVFor0y7c1Zu7WjLiqiGsskamXdHopyT4vALmzS9k/t19uHtKHlOSIMn6xAtARjIZ1sFcUSZ0Y4La+G6M18hS2IlCn4a+WoC0JNL0d/dUupdnUj40g6EJ2VEdMnhrOG/p5f/jUXz8SgmvaGU6KpNRNsLVQV0OdXf24s63h/P2gWoOrBjMCr2GJFQnnxnIM3q5P1PPmaYv+4ev4/C6UtbpV2gzXCkgL5W8Bwt48OIc6ul6Tp+s4+SyASxLiI4+PYCn1bHzDZxvaQW6vZzto7MYnQIpNkf7kp5EuozYUroqE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zFg4fYDaoKaC6wvOFR4FkIPQFaILxrJAOsHsc/zlfYDWXE8qF22s8Pz5KHxcgEVALBtjJXBSSEOwFhk1Zgy4hitCT4hVw+gFs8/zwxqIBbUgyK7fcyA0PD9XX4iVxhiC0xdof6STWCsoBmKF7+cVCWFXQYyBMxRpf+STX1b0x45AhN0OMSrOGEirhrY/dfQAdjvS7oy+WCF6r1RIFxXWvlTRg1YVqFWBmxZbD99ig9pt0YPQw9rD1nstVri9V+/Ve3XrS/wfim4P5fIFxLoAAAAASUVORK5CYII=",Cr=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 we(e,t.webglConfig),this.renderer=new bs(e,this.context),this.gl=this.context.gl,this.assetManager=new cs(this.context,t.pathPrefix),this.input=new Yi(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 Vt;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 Xs(Pi)})();
|
|
84
|
+
`;return new ue(e,t,i)}},ge=ue;P(ge,"MVP_MATRIX","u_projTrans"),P(ge,"POSITION","a_position"),P(ge,"COLOR","a_color"),P(ge,"COLOR2","a_color2"),P(ge,"TEXCOORDS","a_texCoords"),P(ge,"SAMPLER","u_texture");var Mi=class{constructor(e,t,i,s){this.attributes=t,this.context=e instanceof we?e:new we(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],c=e.getAttributeLocation(n.name);t.enableVertexAttribArray(c),t.vertexAttribPointer(c,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)}},$e=class{constructor(e,t,i){this.name=e,this.type=t,this.numElements=i}},kt=class extends $e{constructor(){super(ge.POSITION,He.Float,2)}},xr=class extends $e{constructor(){super(ge.POSITION,He.Float,3)}},Ei=class extends $e{constructor(e=0){super(ge.TEXCOORDS+(e==0?"":e),He.Float,2)}},Rt=class extends $e{constructor(){super(ge.COLOR,He.Float,4)}},us=class extends $e{constructor(){super(ge.COLOR2,He.Float,4)}},He=(e=>(e[e.Float=0]="Float",e))(He||{}),De=1,wr=769,ms=770,gs=771,xs=774,je=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 we?e:new we(e);let s=t?[new kt,new Rt,new Ei,new us]:[new kt,new Rt,new Ei];this.mesh=new Mi(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),je.disableCulling&&(this.cullWasEnabled=t.isEnabled(t.CULL_FACE),this.cullWasEnabled&&t.disable(t.CULL_FACE))}setBlendMode(e,t){const i=je.blendModesGL[e],s=t?i.srcRgbPma:i.srcRgb,n=i.srcAlpha,c=i.dstRgb;if(this.srcColorBlend==s&&this.srcAlphaBlend==n&&this.dstBlend==c)return;this.srcColorBlend=s,this.srcAlphaBlend=n,this.dstBlend=c,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(s,c,n,c)}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 c=this.indicesLength,l=0;l<i.length;c++,l++)n[c]=i[l]+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++,je.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),je.disableCulling&&this.cullWasEnabled&&e.enable(e.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let e=je.globalDrawCalls;return je.globalDrawCalls=0,e}dispose(){this.mesh.dispose()}},et=je;P(et,"disableCulling",!1),P(et,"globalDrawCalls",0),P(et,"blendModesGL",[{srcRgb:ms,srcRgbPma:De,dstRgb:gs,srcAlpha:De},{srcRgb:ms,srcRgbPma:De,dstRgb:De,srcAlpha:De},{srcRgb:xs,srcRgbPma:xs,dstRgb:gs,srcAlpha:De},{srcRgb:De,srcRgbPma:De,dstRgb:wr,srcAlpha:De}]);var ki=class{context;isDrawing=!1;mesh;shapeType=pe.Filled;color=new D(1,1,1,1);shader=null;vertexIndex=0;tmp=new _e;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 we?e:new we(e),this.mesh=new Mi(e,[new kt,new Rt],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(pe.Point,1),i||(i=this.color),this.vertex(e,t,i)}line(e,t,i,s,n){this.check(pe.Line,2);let c=this.mesh.getVertices(),l=this.vertexIndex;n||(n=this.color),this.vertex(e,t,n),this.vertex(i,s,n)}triangle(e,t,i,s,n,c,l,r,o,a){this.check(e?pe.Filled:pe.Line,3);let h=this.mesh.getVertices(),d=this.vertexIndex;r||(r=this.color),o||(o=this.color),a||(a=this.color),e?(this.vertex(t,i,r),this.vertex(s,n,o),this.vertex(c,l,a)):(this.vertex(t,i,r),this.vertex(s,n,o),this.vertex(s,n,r),this.vertex(c,l,o),this.vertex(c,l,r),this.vertex(t,i,o))}quad(e,t,i,s,n,c,l,r,o,a,h,d,f){this.check(e?pe.Filled:pe.Line,3);let u=this.mesh.getVertices(),m=this.vertexIndex;a||(a=this.color),h||(h=this.color),d||(d=this.color),f||(f=this.color),e?(this.vertex(t,i,a),this.vertex(s,n,h),this.vertex(c,l,d),this.vertex(c,l,d),this.vertex(r,o,f),this.vertex(t,i,a)):(this.vertex(t,i,a),this.vertex(s,n,h),this.vertex(s,n,h),this.vertex(c,l,d),this.vertex(c,l,d),this.vertex(r,o,f),this.vertex(r,o,f),this.vertex(t,i,a))}rect(e,t,i,s,n,c){this.quad(e,t,i,t+s,i,t+s,i+n,t,i+n,c,c,c,c)}rectLine(e,t,i,s,n,c,l){this.check(e?pe.Filled:pe.Line,8),l||(l=this.color);let r=this.tmp.set(n-i,t-s);r.normalize(),c*=.5;let o=r.x*c,a=r.y*c;e?(this.vertex(t+o,i+a,l),this.vertex(t-o,i-a,l),this.vertex(s+o,n+a,l),this.vertex(s-o,n-a,l),this.vertex(s+o,n+a,l),this.vertex(t-o,i-a,l)):(this.vertex(t+o,i+a,l),this.vertex(t-o,i-a,l),this.vertex(s+o,n+a,l),this.vertex(s-o,n-a,l),this.vertex(s+o,n+a,l),this.vertex(t+o,i+a,l),this.vertex(s-o,n-a,l),this.vertex(t-o,i-a,l))}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(pe.Line,i*2),s||(s=this.color);let n=this.mesh.getVertices(),c=this.vertexIndex;t<<=1,i<<=1;let l=e[t],r=e[t+1],o=t+i;for(let a=t,h=t+i-2;a<h;a+=2){let d=e[a],f=e[a+1],u=0,m=0;a+2>=o?(u=l,m=r):(u=e[a+2],m=e[a+3]),this.vertex(d,f,s),this.vertex(u,m,s)}}circle(e,t,i,s,n,c=0){if(c==0&&(c=Math.max(1,6*F.cbrt(s)|0)),c<=0)throw new Error("segments must be > 0.");n||(n=this.color);let l=2*F.PI/c,r=Math.cos(l),o=Math.sin(l),a=s,h=0;if(e){this.check(pe.Filled,c*3+3),c--;for(let f=0;f<c;f++){this.vertex(t,i,n),this.vertex(t+a,i+h,n);let u=a;a=r*a-o*h,h=o*u+r*h,this.vertex(t+a,i+h,n)}this.vertex(t,i,n),this.vertex(t+a,i+h,n)}else{this.check(pe.Line,c*2+2);for(let f=0;f<c;f++){this.vertex(t+a,i+h,n);let u=a;a=r*a-o*h,h=o*u+r*h,this.vertex(t+a,i+h,n)}this.vertex(t+a,i+h,n)}let d=a;a=s,h=0,this.vertex(t+a,i+h,n)}curve(e,t,i,s,n,c,l,r,o,a){this.check(pe.Line,o*2+2),a||(a=this.color);let h=1/o,d=h*h,f=h*h*h,u=3*h,m=3*d,g=6*d,p=6*f,v=e-i*2+n,x=t-s*2+c,w=(i-n)*3-e+l,b=(s-c)*3-t+r,y=e,C=t,A=(i-e)*u+v*m+w*f,T=(s-t)*u+x*m+b*f,E=v*g+w*p,R=x*g+b*p,L=w*p,X=b*p;for(;o-- >0;)this.vertex(y,C,a),y+=A,C+=T,A+=E,T+=R,E+=L,R+=X,this.vertex(y,C,a);this.vertex(y,C,a),this.vertex(l,r,a)}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()}},pe=(e=>(e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.Filled=4]="Filled",e))(pe||{}),Ri=class{boneLineColor=new D(1,0,0,1);boneOriginColor=new D(0,1,0,1);attachmentLineColor=new D(0,0,1,.5);triangleLineColor=new D(1,.64,0,.5);pathColor=new D().setFromString("FF7F00");clipColor=new D(.8,0,0,2);aabbColor=new D(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 hs;temp=new Array;vertices=B.newFloatArray(2*1024);constructor(e){this.context=e instanceof we?e:new we(e)}draw(e,t,i){let s=t.x,n=t.y,c=this.context.gl,l=this.premultipliedAlpha?c.ONE:c.SRC_ALPHA;e.setBlendMode(l,c.ONE,c.ONE_MINUS_SRC_ALPHA);let r=t.bones;if(this.drawBones){e.setColor(this.boneLineColor);for(let o=0,a=r.length;o<a;o++){let h=r[o];if(i&&i.indexOf(h.data.name)>-1||!h.parent)continue;let d=h.data.length*h.a+h.worldX,f=h.data.length*h.c+h.worldY;e.rectLine(!0,h.worldX,h.worldY,d,f,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 a=0,h=o.length;a<h;a++){let d=o[a],f=d.getAttachment();if(f instanceof ae){let u=f,m=this.vertices;u.computeWorldVertices(d,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 a=0,h=o.length;a<h;a++){let d=o[a];if(!d.bone.active)continue;let f=d.getAttachment();if(!(f instanceof Ve))continue;let u=f,m=this.vertices;u.computeWorldVertices(d,0,u.worldVerticesLength,m,0,2);let g=u.triangles,p=u.hullLength;if(this.drawMeshTriangles){e.setColor(this.triangleLineColor);for(let v=0,x=g.length;v<x;v+=3){let w=g[v]*2,b=g[v+1]*2,y=g[v+2]*2;e.triangle(!1,m[w],m[w+1],m[b],m[b+1],m[y],m[y+1])}}if(this.drawMeshHull&&p>0){e.setColor(this.attachmentLineColor),p=(p>>1)*2;let v=m[p-2],x=m[p-1];for(let w=0,b=p;w<b;w+=2){let y=m[w],C=m[w+1];e.line(y,C,v,x),v=y,x=C}}}}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 a=o.polygons,h=o.boundingBoxes;for(let d=0,f=a.length;d<f;d++){let u=a[d];e.setColor(h[d].color),e.polygon(u,0,u.length)}}if(this.drawPaths){let o=t.slots;for(let a=0,h=o.length;a<h;a++){let d=o[a];if(!d.bone.active)continue;let f=d.getAttachment();if(!(f instanceof Ge))continue;let u=f,m=u.worldVerticesLength,g=this.temp=B.setArraySize(this.temp,m,0);u.computeWorldVertices(d,0,m,g,0,2);let p=this.pathColor,v=g[2],x=g[3],w=0,b=0;if(u.closed){e.setColor(p);let y=g[0],C=g[1],A=g[m-2],T=g[m-1];w=g[m-4],b=g[m-3],e.curve(v,x,y,C,A,T,w,b,32),e.setColor(Ri.LIGHT_GRAY),e.line(v,x,y,C),e.line(w,b,A,T)}m-=4;for(let y=4;y<m;y+=6){let C=g[y],A=g[y+1],T=g[y+2],E=g[y+3];w=g[y+4],b=g[y+5],e.setColor(p),e.curve(v,x,C,A,T,E,w,b,32),e.setColor(Ri.LIGHT_GRAY),e.line(v,x,C,A),e.line(w,b,T,E),v=w,x=b}}}if(this.drawBones){e.setColor(this.boneOriginColor);for(let o=0,a=r.length;o<a;o++){let h=r[o];i&&i.indexOf(h.data.name)>-1||e.circle(!0,h.worldX,h.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=t.slots;e.setColor(this.clipColor);for(let a=0,h=o.length;a<h;a++){let d=o[a];if(!d.bone.active)continue;let f=d.getAttachment();if(!(f instanceof ot))continue;let u=f,m=u.worldVerticesLength,g=this.temp=B.setArraySize(this.temp,m,0);u.computeWorldVertices(d,0,m,g,0,2);for(let p=0,v=g.length;p<v;p+=2){let x=g[p],w=g[p+1],b=g[(p+2)%g.length],y=g[(p+3)%g.length];e.line(x,w,b,y)}}}}dispose(){}},Ft=Ri;P(Ft,"LIGHT_GRAY",new D(.7529411764705882,.7529411764705882,.7529411764705882,1)),P(Ft,"GREEN",new D(0,1,0,1));var br=class{constructor(e,t,i){this.vertices=e,this.numVertices=t,this.numFloats=i}},ws=class{premultipliedAlpha=!1;tempColor=new D;tempColor2=new D;vertices;vertexSize=2+2+4;twoColorTint=!1;renderable=new br([],0,0);clipper=new Mt;temp=new _e;temp2=new _e;temp3=new D;temp4=new D;constructor(e,t=!0){this.twoColorTint=t,t&&(this.vertexSize+=4),this.vertices=B.newFloatArray(this.vertexSize*1024)}draw(e,t,i=-1,s=-1,n=null){let c=this.clipper,l=this.premultipliedAlpha,r=this.twoColorTint,o=null,a=this.renderable,h,d,f=t.drawOrder,u,m=t.color,g=r?12:8,p=!1;i==-1&&(p=!0);for(let v=0,x=f.length;v<x;v++){let w=c.isClipping()?2:g,b=f[v];if(!b.bone.active){c.clipEndWithSlot(b);continue}if(i>=0&&i==b.data.index&&(p=!0),!p){c.clipEndWithSlot(b);continue}s>=0&&s==b.data.index&&(p=!1);let y=b.getAttachment(),C;if(y instanceof ae){let A=y;a.vertices=this.vertices,a.numVertices=4,a.numFloats=w<<2,A.computeWorldVertices(b,a.vertices,0,w),d=ws.QUAD_TRIANGLES,h=A.uvs,C=A.region.texture,u=A.color}else if(y instanceof Ve){let A=y;a.vertices=this.vertices,a.numVertices=A.worldVerticesLength>>1,a.numFloats=a.numVertices*w,a.numFloats>a.vertices.length&&(a.vertices=this.vertices=B.newFloatArray(a.numFloats)),A.computeWorldVertices(b,0,A.worldVerticesLength,a.vertices,0,w),d=A.triangles,C=A.region.texture,h=A.uvs,u=A.color}else if(y instanceof ot){let A=y;c.clipStart(b,A);continue}else{c.clipEndWithSlot(b);continue}if(C){let A=b.color,T=this.tempColor;T.r=m.r*A.r*u.r,T.g=m.g*A.g*u.g,T.b=m.b*A.b*u.b,T.a=m.a*A.a*u.a,l&&(T.r*=T.a,T.g*=T.a,T.b*=T.a);let E=this.tempColor2;b.darkColor?(l?(E.r=b.darkColor.r*T.a,E.g=b.darkColor.g*T.a,E.b=b.darkColor.b*T.a):E.setFromColor(b.darkColor),E.a=l?1:0):E.set(0,0,0,1);let R=b.data.blendMode;if(R!=o&&(o=R,e.setBlendMode(o,l)),c.isClipping()){c.clipTriangles(a.vertices,a.numFloats,d,d.length,h,T,E,r);let L=new Float32Array(c.clippedVertices),X=c.clippedTriangles;n&&n(L,L.length,g),e.draw(C,L,X)}else{let L=a.vertices;if(r)for(let k=2,M=0,I=a.numFloats;k<I;k+=g,M+=2)L[k]=T.r,L[k+1]=T.g,L[k+2]=T.b,L[k+3]=T.a,L[k+4]=h[M],L[k+5]=h[M+1],L[k+6]=E.r,L[k+7]=E.g,L[k+8]=E.b,L[k+9]=E.a;else for(let k=2,M=0,I=a.numFloats;k<I;k+=g,M+=2)L[k]=T.r,L[k+1]=T.g,L[k+2]=T.b,L[k+3]=T.a,L[k+4]=h[M],L[k+5]=h[M+1];let X=a.vertices.subarray(0,a.numFloats);n&&n(a.vertices,a.numFloats,g),e.draw(C,X,d)}}c.clipEndWithSlot(b)}c.clipEnd()}},Fi=ws;P(Fi,"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],Xt=[0,1,2,2,3,0],Lt=new D(1,1,1,1),bs=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 we?t:new we(t),this.twoColorTint=i,this.camera=new ds(e.width,e.height),this.batcherShader=i?ge.newTwoColoredTextured(this.context):ge.newColoredTextured(this.context),this.batcher=new et(this.context,i),this.shapesShader=ge.newColored(this.context),this.shapes=new ki(this.context),this.skeletonRenderer=new Fi(this.context,i),this.skeletonDebugRenderer=new Ft(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,c){this.enableRenderer(this.batcher),c||(c=Lt);var l=0;S[l++]=t,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=0,S[l++]=1,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t+s,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=1,S[l++]=1,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t+s,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=1,S[l++]=0,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=0,S[l++]=0,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l]=0),this.batcher.draw(e,S,Xt)}drawTextureUV(e,t,i,s,n,c,l,r,o,a){this.enableRenderer(this.batcher),a||(a=Lt);var h=0;S[h++]=t,S[h++]=i,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=c,S[h++]=l,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h++]=0),S[h++]=t+s,S[h++]=i,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=r,S[h++]=l,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h++]=0),S[h++]=t+s,S[h++]=i+n,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=r,S[h++]=o,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h++]=0),S[h++]=t,S[h++]=i+n,S[h++]=a.r,S[h++]=a.g,S[h++]=a.b,S[h++]=a.a,S[h++]=c,S[h++]=o,this.twoColorTint&&(S[h++]=0,S[h++]=0,S[h++]=0,S[h]=0),this.batcher.draw(e,S,Xt)}drawTextureRotated(e,t,i,s,n,c,l,r,o){this.enableRenderer(this.batcher),o||(o=Lt);let a=t+c,h=i+l,d=-c,f=-l,u=s-c,m=n-l,g=d,p=f,v=d,x=m,w=u,b=m,y=u,C=f,A=0,T=0,E=0,R=0,L=0,X=0,k=0,M=0;if(r!=0){let W=F.cosDeg(r),se=F.sinDeg(r);A=W*g-se*p,T=se*g+W*p,k=W*v-se*x,M=se*v+W*x,L=W*w-se*b,X=se*w+W*b,E=L+(A-k),R=X+(T-M)}else A=g,T=p,k=v,M=x,L=w,X=b,E=y,R=C;A+=a,T+=h,E+=a,R+=h,L+=a,X+=h,k+=a,M+=h;var I=0;S[I++]=A,S[I++]=T,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=0,S[I++]=1,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=E,S[I++]=R,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=1,S[I++]=1,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=L,S[I++]=X,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=1,S[I++]=0,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I++]=0),S[I++]=k,S[I++]=M,S[I++]=o.r,S[I++]=o.g,S[I++]=o.b,S[I++]=o.a,S[I++]=0,S[I++]=0,this.twoColorTint&&(S[I++]=0,S[I++]=0,S[I++]=0,S[I]=0),this.batcher.draw(e,S,Xt)}drawRegion(e,t,i,s,n,c){this.enableRenderer(this.batcher),c||(c=Lt);var l=0;S[l++]=t,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=e.u,S[l++]=e.v2,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t+s,S[l++]=i,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=e.u2,S[l++]=e.v2,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t+s,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=e.u2,S[l++]=e.v,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l++]=0),S[l++]=t,S[l++]=i+n,S[l++]=c.r,S[l++]=c.g,S[l++]=c.b,S[l++]=c.a,S[l++]=e.u,S[l++]=e.v,this.twoColorTint&&(S[l++]=0,S[l++]=0,S[l++]=0,S[l]=0),this.batcher.draw(e.page.texture,S,Xt)}line(e,t,i,s,n,c){this.enableRenderer(this.shapes),this.shapes.line(e,t,i,s,n)}triangle(e,t,i,s,n,c,l,r,o,a){this.enableRenderer(this.shapes),this.shapes.triangle(e,t,i,s,n,c,l,r,o,a)}quad(e,t,i,s,n,c,l,r,o,a,h,d,f){this.enableRenderer(this.shapes),this.shapes.quad(e,t,i,s,n,c,l,r,o,a,h,d,f)}rect(e,t,i,s,n,c){this.enableRenderer(this.shapes),this.shapes.rect(e,t,i,s,n,c)}rectLine(e,t,i,s,n,c,l){this.enableRenderer(this.shapes),this.shapes.rectLine(e,t,i,s,n,c,l)}polygon(e,t,i,s){this.enableRenderer(this.shapes),this.shapes.polygon(e,t,i,s)}circle(e,t,i,s,n,c=0){this.enableRenderer(this.shapes),this.shapes.circle(e,t,i,s,n,c)}curve(e,t,i,s,n,c,l,r,o,a){this.enableRenderer(this.shapes),this.shapes.curve(e,t,i,s,n,c,l,r,o,a)}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===Bt.Expand)this.camera.setViewport(s,n);else if(e===Bt.Fit){let c=t.width,l=t.height,r=this.camera.viewportWidth,o=this.camera.viewportHeight,a=o/r,h=l/c,d=a<h?r/c:o/l;this.camera.setViewport(c*d,l*d)}this.camera.update()}enableRenderer(e){this.activeRenderer!==e&&(this.end(),e instanceof et?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(ge.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):e instanceof ki?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(ge.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},Bt=(e=>(e[e.Stretch=0]="Stretch",e[e.Expand=1]="Expand",e[e.Fit=2]="Fit",e))(Bt||{}),ct,tt,ps=0,pr=1,Xi=1,vs=165,ys=108,Ze=163,vr=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new Vt;backgroundColor=new D(.135,.135,.135,1);tempColor=new D;constructor(e){if(this.renderer=e,this.timeKeeper.maxDelta=9,!tt){let t=navigator.userAgent.indexOf("Safari")>-1,i=()=>ps++;tt=new Image,tt.src=Ar,t||(tt.crossOrigin="anonymous"),tt.onload=i,ct=new Image,ct.src=yr,t||(ct.crossOrigin="anonymous"),ct.onload=i}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(e=!1){if(ps<2||e&&this.fadeOut>Xi)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,c=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>Xi)return;i.setFromColor(this.backgroundColor),t=1-this.fadeOut/Xi,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&&(c.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),c.clear(c.COLOR_BUFFER_BIT)),t=1;t*=Math.min(this.fadeIn/pr,1),i.set(t,t,t,t),this.logo||(this.logo=new ht(s.context,tt),this.spinner=new ht(s.context,ct)),s.camera.zoom=Math.max(1,Ze/n.height),s.begin(),s.drawTexture(this.logo,(n.width-vs)/2,(n.height-ys)/2,vs,ys,i),this.spinner&&s.drawTextureRotated(this.spinner,(n.width-Ze)/2,(n.height-Ze)/2,Ze,Ze,Ze/2,Ze/2,this.angle,i),s.end()}},yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKMAAACjCAYAAADmbK6AAAALKElEQVR42u2de2iW5R/GPzuqcwfnnKfNmafl5tTNHWzqNi3DEMQykcAoJSsySkspjSIk0iD/07Kf4R+FnVBDUTshZGpWUEJaaiWFgZlUFmXmIe3HNXthyebeZ77P9H13ffBG8Y8H7ut7vff93N/7fu4vGGPiFZiez/Qtw9lytJajfzfw9z/j+efPOv7cV8W+lUNY2a8T/ayTCRsWFLJA5rtUO1LLkV5p9LJeJizQiHeqnlOtmVFtdTGrrZkJCxYXsTgaI6r9MY4/UpNItW4mFDaXsTlaM6qVZlBq3UwofFrJp0HMWJ9DvXUzobCznJ1BzFjWlTLrZkJh/TDWBzFjTgo51s2EgnKI0Rrx+FiOWzNzVaym91Syx5qZsGBWb2ZFa0ZN6dbMhAWTcpkUrRmXD2K5NTNhgVbH0Zpxbl/mWjMTFvRIo0e0ZpzcncnWzISKtvmiMWNRJ4qslwmVXRXsas2Ix8ZwzFqZsGFREYtaM+Oaa1ljrUzYkJ9G/ok6TlzKjJWZVFor0y7c1Zu7WjLiqiGsskamXdHopyT4vALmzS9k/t19uHtKHlOSIMn6xAtARjIZ1sFcUSZ0Y4La+G6M18hS2IlCn4a+WoC0JNL0d/dUupdnUj40g6EJ2VEdMnhrOG/p5f/jUXz8SgmvaGU6KpNRNsLVQV0OdXf24s63h/P2gWoOrBjMCr2GJFQnnxnIM3q5P1PPmaYv+4ev4/C6UtbpV2gzXCkgL5W8Bwt48OIc6ul6Tp+s4+SyASxLiI4+PYCn1bHz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FgumZOCuggctKGI4ULZN/vMeSLj0AYMytWEqMLzFg4fYDaoKaC6wvOFR4FkIPQFaILxrJAOsHsc/zlfYDWXE8qF22s8Pz5KHxcgEVALBtjJXBSSEOwFhk1Zgy4hitCT4hVw+gFs8/zwxqIBbUgyK7fcyA0PD9XX4iVxhiC0xdof6STWCsoBmKF7+cVCWFXQYyBMxRpf+STX1b0x45AhN0OMSrOGEirhrY/dfQAdjvS7oy+WCF6r1RIFxXWvlTRg1YVqFWBmxZbD99ig9pt0YPQw9rD1nstVri9V+/Ve3XrS/wfim4P5fIFxLoAAAAASUVORK5CYII=",Cr=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 we(e,t.webglConfig),this.renderer=new bs(e,this.context),this.gl=this.context.gl,this.assetManager=new cs(this.context,t.pathPrefix),this.input=new Yi(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 Vt;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 Xs(Pi)})();
|