143 lines
248 KiB
JavaScript
143 lines
248 KiB
JavaScript
"use strict";var spine=(()=>{var Yt=Object.defineProperty,nr=Object.getOwnPropertyDescriptor,ar=Object.getOwnPropertyNames,lr=Object.prototype.hasOwnProperty,or=(t,e)=>{for(var i in e)Yt(t,i,{get:e[i],enumerable:!0})},hr=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ar(e))!lr.call(t,r)&&r!==i&&Yt(t,r,{get:()=>e[r],enumerable:!(s=nr(e,r))||s.enumerable});return t},cr=t=>hr(Yt({},"__esModule",{value:!0}),t),Ji={};or(Ji,{AlphaTimeline:()=>Ht,Animation:()=>ht,AnimationState:()=>rs,AnimationStateAdapter:()=>gr,AnimationStateData:()=>cs,AssetCache:()=>ws,AssetManager:()=>Xi,AssetManagerBase:()=>ps,AtlasAttachmentLoader:()=>gs,Attachment:()=>Lt,AttachmentTimeline:()=>Ne,BinaryInput:()=>Ts,BlendMode:()=>Yi,Bone:()=>xi,BoneData:()=>wi,BoundingBoxAttachment:()=>fi,CURRENT:()=>hs,CameraController:()=>Qr,ClippingAttachment:()=>tt,Color:()=>V,Color2Attribute:()=>Fs,ColorAttribute:()=>xt,ConstraintData:()=>st,CurveTimeline:()=>Se,CurveTimeline1:()=>Ae,CurveTimeline2:()=>ct,DebugUtils:()=>fr,DeformTimeline:()=>Zt,Downloader:()=>bi,DrawOrderTimeline:()=>qe,Event:()=>vi,EventData:()=>yi,EventQueue:()=>as,EventTimeline:()=>dt,EventType:()=>ls,FIRST:()=>ci,FakeTexture:()=>pr,GLTexture:()=>_e,HOLD_FIRST:()=>ft,HOLD_MIX:()=>os,HOLD_SUBSEQUENT:()=>di,IkConstraint:()=>xs,IkConstraintData:()=>Ai,IkConstraintTimeline:()=>Jt,Inherit:()=>gt,InheritTimeline:()=>zt,Input:()=>nt,IntSet:()=>dr,Interpolation:()=>Ki,LoadingScreen:()=>Us,M00:()=>O,M01:()=>q,M02:()=>G,M03:()=>D,M10:()=>H,M11:()=>N,M12:()=>_,M13:()=>U,M20:()=>j,M21:()=>Z,M22:()=>W,M23:()=>z,M30:()=>Q,M31:()=>$,M32:()=>ee,M33:()=>K,ManagedWebGLRenderingContext:()=>ge,MathUtils:()=>P,Matrix4:()=>rt,Mesh:()=>Bi,MeshAttachment:()=>Ge,MixBlend:()=>is,MixDirection:()=>ss,OrthoCamera:()=>Rs,PathAttachment:()=>He,PathConstraint:()=>bs,PathConstraintData:()=>Ci,PathConstraintMixTimeline:()=>ei,PathConstraintPositionTimeline:()=>Qt,PathConstraintSpacingTimeline:()=>$t,Physics:()=>As,PhysicsConstraintDampingTimeline:()=>si,PhysicsConstraintGravityTimeline:()=>ai,PhysicsConstraintInertiaTimeline:()=>ti,PhysicsConstraintMassTimeline:()=>ri,PhysicsConstraintMixTimeline:()=>li,PhysicsConstraintResetTimeline:()=>oi,PhysicsConstraintStrengthTimeline:()=>ii,PhysicsConstraintTimeline:()=>Be,PhysicsConstraintWindTimeline:()=>ni,PointAttachment:()=>ms,PolygonBatcher:()=>Oi,Pool:()=>$e,Position2Attribute:()=>wt,Position3Attribute:()=>$r,PositionMode:()=>Si,Pow:()=>Qi,PowOut:()=>ur,RGB2Timeline:()=>jt,RGBA2Timeline:()=>_t,RGBATimeline:()=>qt,RGBTimeline:()=>Gt,RegionAttachment:()=>it,ResizeMode:()=>Ns,RotateMode:()=>ki,RotateTimeline:()=>et,SETUP:()=>ui,SUBSEQUENT:()=>ut,ScaleTimeline:()=>Vt,ScaleXTimeline:()=>Ot,ScaleYTimeline:()=>Dt,SceneRenderer:()=>Ni,SequenceTimeline:()=>hi,Shader:()=>ke,ShapeRenderer:()=>Di,ShapeType:()=>Vs,ShearTimeline:()=>Nt,ShearXTimeline:()=>Ut,ShearYTimeline:()=>Wt,Skeleton:()=>Ei,SkeletonBinary:()=>Ss,SkeletonBounds:()=>ks,SkeletonClipping:()=>Is,SkeletonData:()=>Ii,SkeletonDebugRenderer:()=>Os,SkeletonJson:()=>Ms,SkeletonRenderer:()=>Ds,Skin:()=>pt,SkinEntry:()=>Mi,Slot:()=>vs,SlotData:()=>Ri,SpacingMode:()=>Ti,SpineCanvas:()=>an,SpinePlayer:()=>ln,SpinePlayerEditor:()=>gn,StringSet:()=>Ft,TexCoordAttribute:()=>Vi,Texture:()=>mi,TextureAtlas:()=>gi,TextureAtlasPage:()=>fs,TextureAtlasRegion:()=>pi,TextureFilter:()=>mt,TextureRegion:()=>us,TextureWrap:()=>ds,TimeKeeper:()=>ot,Timeline:()=>ue,Touch:()=>Ys,TrackEntry:()=>ns,TransformConstraint:()=>ys,TransformConstraintData:()=>Fi,TransformConstraintTimeline:()=>Kt,TranslateTimeline:()=>Pt,TranslateXTimeline:()=>Xt,TranslateYTimeline:()=>Bt,Triangulator:()=>Es,Utils:()=>X,Vector2:()=>Ce,Vector3:()=>ve,VertexAttachment:()=>Ye,VertexAttribute:()=>je,VertexAttributeType:()=>Ls,WindowedMean:()=>mr});var dr=class{array=new Array;add(t){let e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},Ft=class{entries={};size=0;add(t){let e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){let e=this.size;for(var i=0,s=t.length;i<s;i++)this.add(t[i]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},V=class We{constructor(e=0,i=0,s=0,r=0){this.r=e,this.g=i,this.b=s,this.a=r}static WHITE=new We(1,1,1,1);static RED=new We(1,0,0,1);static GREEN=new We(0,1,0,1);static BLUE=new We(0,0,1,1);static MAGENTA=new We(1,0,1,1);set(e,i,s,r){return this.r=e,this.g=i,this.b=s,this.a=r,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,i,s,r){return this.r+=e,this.g+=i,this.b+=s,this.a+=r,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,i){e.r=((i&4278190080)>>>24)/255,e.g=((i&16711680)>>>16)/255,e.b=((i&65280)>>>8)/255,e.a=(i&255)/255}static rgb888ToColor(e,i){e.r=((i&16711680)>>>16)/255,e.g=((i&65280)>>>8)/255,e.b=(i&255)/255}toRgb888(){const e=i=>("0"+(i*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,i=new We){return i.setFromString(e)}},P=class Me{static PI=3.1415927;static PI2=Me.PI*2;static invPI2=1/Me.PI2;static radiansToDegrees=180/Me.PI;static radDeg=Me.radiansToDegrees;static degreesToRadians=Me.PI/180;static degRad=Me.degreesToRadians;static clamp(e,i,s){return e<i?i:e>s?s:e}static cosDeg(e){return Math.cos(e*Me.degRad)}static sinDeg(e){return Math.sin(e*Me.degRad)}static atan2Deg(e,i){return Math.atan2(e,i)*Me.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let i=Math.pow(Math.abs(e),.3333333333333333);return e<0?-i:i}static randomTriangular(e,i){return Me.randomTriangularWith(e,i,(e+i)*.5)}static randomTriangularWith(e,i,s){let r=Math.random(),h=i-e;return r<=(s-e)/h?e+Math.sqrt(r*h*(s-e)):i-Math.sqrt((1-r)*h*(i-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Ki=class{apply(t,e,i){return t+(e-t)*this.applyInternal(i)}},Qi=class extends Ki{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}},ur=class extends Qi{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},X=class Qe{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,i,s,r,h){for(let l=i,n=r;l<i+h;l++,n++)s[n]=e[l]}static arrayFill(e,i,s,r){for(let h=i;h<s;h++)e[h]=r}static setArraySize(e,i,s=0){let r=e.length;if(r==i)return e;if(e.length=i,r<i)for(let h=r;h<i;h++)e[h]=s;return e}static ensureArrayCapacity(e,i,s=0){return e.length>=i?e:Qe.setArraySize(e,i,s)}static newArray(e,i){let s=new Array(e);for(let r=0;r<e;r++)s[r]=i;return s}static newFloatArray(e){if(Qe.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let i=new Array(e);for(let s=0;s<i.length;s++)i[s]=0;return i}}static newShortArray(e){if(Qe.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let i=new Array(e);for(let s=0;s<i.length;s++)i[s]=0;return i}}static toFloatArray(e){return Qe.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Qe.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,i){}static contains(e,i,s=!0){for(var r=0;r<e.length;r++)if(e[r]==i)return!0;return!1}static enumValue(e,i){return e[i[0].toUpperCase()+i.slice(1)]}},fr=class{static logBones(t){for(let e=0;e<t.bones.length;e++){let i=t.bones[e];console.log(i.data.name+", "+i.a+", "+i.b+", "+i.c+", "+i.d+", "+i.worldX+", "+i.worldY)}}},$e=class{items=new Array;instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Ce=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}},ot=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},mr=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},Lt=class{name;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},Ye=class js extends Lt{static nextID=0;id=js.nextID++;bones=null;vertices=[];worldVerticesLength=0;timelineAttachment=this;constructor(e){super(e)}computeWorldVertices(e,i,s,r,h,l){s=h+(s>>1)*l;let n=e.bone.skeleton,a=e.deform,o=this.vertices,c=this.bones;if(!c){a.length>0&&(o=a);let f=e.bone,g=f.worldX,w=f.worldY,b=f.a,p=f.b,x=f.c,v=f.d;for(let y=i,A=h;A<s;y+=2,A+=l){let C=o[y],S=o[y+1];r[A]=C*b+S*p+g,r[A+1]=C*x+S*v+w}return}let u=0,d=0;for(let f=0;f<i;f+=2){let g=c[u];u+=g+1,d+=g}let m=n.bones;if(a.length==0)for(let f=h,g=d*3;f<s;f+=l){let w=0,b=0,p=c[u++];for(p+=u;u<p;u++,g+=3){let x=m[c[u]],v=o[g],y=o[g+1],A=o[g+2];w+=(v*x.a+y*x.b+x.worldX)*A,b+=(v*x.c+y*x.d+x.worldY)*A}r[f]=w,r[f+1]=b}else{let f=a;for(let g=h,w=d*3,b=d<<1;g<s;g+=l){let p=0,x=0,v=c[u++];for(v+=u;u<v;u++,w+=3,b+=2){let y=m[c[u]],A=o[w]+f[b],C=o[w+1]+f[b+1],S=o[w+2];p+=(A*y.a+C*y.b+y.worldX)*S,x+=(A*y.c+C*y.d+y.worldY)*S}r[g]=p,r[g+1]=x}}}copyTo(e){this.bones?(e.bones=new Array(this.bones.length),X.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=X.newFloatArray(this.vertices.length),X.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment}},$i=class Et{static _nextID=0;id=Et.nextID();regions;start=0;digits=0;setupIndex=0;constructor(e){this.regions=new Array(e)}copy(){let e=new Et(this.regions.length);return X.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,i){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let r=this.regions[s];i.region!=r&&(i.region=r,i.updateRegion())}getPath(e,i){let s=e,r=(this.start+i).toString();for(let h=this.digits-r.length;h>0;h--)s+="0";return s+=r,s}static nextID(){return Et._nextID++}},es=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(es||{}),ts=[0,1,2,3,4,5,6],ht=class{name;timelines=[];timelineIds=new Ft;duration;constructor(t,e,i){if(!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=i}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,i,s,r,h,l,n){if(!t)throw new Error("skeleton cannot be null.");s&&this.duration!=0&&(i%=this.duration,e>0&&(e%=this.duration));let a=this.timelines;for(let o=0,c=a.length;o<c;o++)a[o].apply(t,e,i,r,h,l,n)}},is=(t=>(t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add",t))(is||{}),ss=(t=>(t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut",t))(ss||{}),se={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},ue=class{propertyIds;frames;constructor(t,e){this.propertyIds=e,this.frames=X.newFloatArray(t*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(t,e){let i=t.length;for(let s=1;s<i;s++)if(t[s]>e)return s-1;return i-1}static search(t,e,i){let s=t.length;for(let r=i;r<s;r+=i)if(t[r]>e)return r-i;return s-i}},Se=class extends ue{curves;constructor(t,e,i){super(t,i),this.curves=X.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+t*18;if(this.curves.length>e){let i=X.newFloatArray(e);X.arrayCopy(this.curves,0,i,0,e),this.curves=i}}setBezier(t,e,i,s,r,h,l,n,a,o,c){let u=this.curves,d=this.getFrameCount()+t*18;i==0&&(u[e]=2+d);let m=(s-h*2+n)*.03,f=(r-l*2+a)*.03,g=((h-n)*3-s+o)*.006,w=((l-a)*3-r+c)*.006,b=m*2+g,p=f*2+w,x=(h-s)*.3+m+g*.16666667,v=(l-r)*.3+f+w*.16666667,y=s+x,A=r+v;for(let C=d+18;d<C;d+=2)u[d]=y,u[d+1]=A,x+=b,v+=p,b+=g,p+=w,y+=x,A+=v}getBezierValue(t,e,i,s){let r=this.curves;if(r[s]>t){let a=this.frames[e],o=this.frames[e+i];return o+(t-a)/(r[s]-a)*(r[s+1]-o)}let h=s+18;for(s+=2;s<h;s+=2)if(r[s]>=t){let a=r[s-2],o=r[s-1];return o+(t-a)/(r[s]-a)*(r[s+1]-o)}e+=this.getFrameEntries();let l=r[h-2],n=r[h-1];return n+(t-l)/(this.frames[e]-l)*(this.frames[e+i]-n)}},Ae=class extends Se{constructor(t,e,i){super(t,e,[i])}getFrameEntries(){return 2}setFrame(t,e,i){t<<=1,this.frames[t]=e,this.frames[t+1]=i}getCurveValue(t){let e=this.frames,i=e.length-2;for(let r=2;r<=i;r+=2)if(e[r]>t){i=r-2;break}let s=this.curves[i>>1];switch(s){case 0:let r=e[i],h=e[i+1];return h+(t-r)/(e[i+2]-r)*(e[i+2+1]-h);case 1:return e[i+1]}return this.getBezierValue(t,i,1,s-2)}getRelativeValue(t,e,i,s,r){if(t<this.frames[0]){switch(i){case 0:return r;case 1:return s+(r-s)*e}return s}let h=this.getCurveValue(t);switch(i){case 0:return r+h*e;case 1:case 2:h+=r-s}return s+h*e}getAbsoluteValue(t,e,i,s,r){if(t<this.frames[0]){switch(i){case 0:return r;case 1:return s+(r-s)*e}return s}let h=this.getCurveValue(t);return i==0?r+(h-r)*e:s+(h-s)*e}getAbsoluteValue2(t,e,i,s,r,h){if(t<this.frames[0]){switch(i){case 0:return r;case 1:return s+(r-s)*e}return s}return i==0?r+(h-r)*e:s+(h-s)*e}getScaleValue(t,e,i,s,r,h){const l=this.frames;if(t<l[0]){switch(i){case 0:return h;case 1:return r+(h-r)*e}return r}let n=this.getCurveValue(t)*h;if(e==1)return i==3?r+n-h:n;if(s==1)switch(i){case 0:return h+(Math.abs(n)*P.signum(h)-h)*e;case 1:case 2:return r+(Math.abs(n)*P.signum(r)-r)*e}else{let a=0;switch(i){case 0:return a=Math.abs(h)*P.signum(n),a+(n-a)*e;case 1:case 2:return a=Math.abs(r)*P.signum(n),a+(n-a)*e}}return r+(n-h)*e}},ct=class extends Se{constructor(t,e,i,s){super(t,e,[i,s])}getFrameEntries(){return 3}setFrame(t,e,i,s){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s}},et=class extends Ae{boneIndex=0;constructor(t,e,i){super(t,e,se.rotate+"|"+i),this.boneIndex=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(i,r,h,n.rotation,n.data.rotation))}},Pt=class extends ct{boneIndex=0;constructor(t,e,i){super(t,e,se.x+"|"+i,se.y+"|"+i),this.boneIndex=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(i<a[0]){switch(h){case 0:n.x=n.data.x,n.y=n.data.y;return;case 1:n.x+=(n.data.x-n.x)*r,n.y+=(n.data.y-n.y)*r}return}let o=0,c=0,u=ue.search(a,i,3),d=this.curves[u/3];switch(d){case 0:let m=a[u];o=a[u+1],c=a[u+2];let f=(i-m)/(a[u+3]-m);o+=(a[u+3+1]-o)*f,c+=(a[u+3+2]-c)*f;break;case 1:o=a[u+1],c=a[u+2];break;default:o=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}switch(h){case 0:n.x=n.data.x+o*r,n.y=n.data.y+c*r;break;case 1:case 2:n.x+=(n.data.x+o-n.x)*r,n.y+=(n.data.y+c-n.y)*r;break;case 3:n.x+=o*r,n.y+=c*r}}},Xt=class extends Ae{boneIndex=0;constructor(t,e,i){super(t,e,se.x+"|"+i),this.boneIndex=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(i,r,h,n.x,n.data.x))}},Bt=class extends Ae{boneIndex=0;constructor(t,e,i){super(t,e,se.y+"|"+i),this.boneIndex=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(i,r,h,n.y,n.data.y))}},Vt=class extends ct{boneIndex=0;constructor(t,e,i){super(t,e,se.scaleX+"|"+i,se.scaleY+"|"+i),this.boneIndex=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(i<a[0]){switch(h){case 0:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case 1:n.scaleX+=(n.data.scaleX-n.scaleX)*r,n.scaleY+=(n.data.scaleY-n.scaleY)*r}return}let o,c,u=ue.search(a,i,3),d=this.curves[u/3];switch(d){case 0:let m=a[u];o=a[u+1],c=a[u+2];let f=(i-m)/(a[u+3]-m);o+=(a[u+3+1]-o)*f,c+=(a[u+3+2]-c)*f;break;case 1:o=a[u+1],c=a[u+2];break;default:o=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}if(o*=n.data.scaleX,c*=n.data.scaleY,r==1)h==3?(n.scaleX+=o-n.data.scaleX,n.scaleY+=c-n.data.scaleY):(n.scaleX=o,n.scaleY=c);else{let m=0,f=0;if(l==1)switch(h){case 0:m=n.data.scaleX,f=n.data.scaleY,n.scaleX=m+(Math.abs(o)*P.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*P.signum(f)-f)*r;break;case 1:case 2:m=n.scaleX,f=n.scaleY,n.scaleX=m+(Math.abs(o)*P.signum(m)-m)*r,n.scaleY=f+(Math.abs(c)*P.signum(f)-f)*r;break;case 3:n.scaleX+=(o-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}else switch(h){case 0:m=Math.abs(n.data.scaleX)*P.signum(o),f=Math.abs(n.data.scaleY)*P.signum(c),n.scaleX=m+(o-m)*r,n.scaleY=f+(c-f)*r;break;case 1:case 2:m=Math.abs(n.scaleX)*P.signum(o),f=Math.abs(n.scaleY)*P.signum(c),n.scaleX=m+(o-m)*r,n.scaleY=f+(c-f)*r;break;case 3:n.scaleX+=(o-n.data.scaleX)*r,n.scaleY+=(c-n.data.scaleY)*r}}}},Ot=class extends Ae{boneIndex=0;constructor(t,e,i){super(t,e,se.scaleX+"|"+i),this.boneIndex=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(i,r,h,l,n.scaleX,n.data.scaleX))}},Dt=class extends Ae{boneIndex=0;constructor(t,e,i){super(t,e,se.scaleY+"|"+i),this.boneIndex=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(i,r,h,l,n.scaleY,n.data.scaleY))}},Nt=class extends ct{boneIndex=0;constructor(t,e,i){super(t,e,se.shearX+"|"+i,se.shearY+"|"+i),this.boneIndex=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;let a=this.frames;if(i<a[0]){switch(h){case 0:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case 1:n.shearX+=(n.data.shearX-n.shearX)*r,n.shearY+=(n.data.shearY-n.shearY)*r}return}let o=0,c=0,u=ue.search(a,i,3),d=this.curves[u/3];switch(d){case 0:let m=a[u];o=a[u+1],c=a[u+2];let f=(i-m)/(a[u+3]-m);o+=(a[u+3+1]-o)*f,c+=(a[u+3+2]-c)*f;break;case 1:o=a[u+1],c=a[u+2];break;default:o=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}switch(h){case 0:n.shearX=n.data.shearX+o*r,n.shearY=n.data.shearY+c*r;break;case 1:case 2:n.shearX+=(n.data.shearX+o-n.shearX)*r,n.shearY+=(n.data.shearY+c-n.shearY)*r;break;case 3:n.shearX+=o*r,n.shearY+=c*r}}},Ut=class extends Ae{boneIndex=0;constructor(t,e,i){super(t,e,se.shearX+"|"+i),this.boneIndex=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(i,r,h,n.shearX,n.data.shearX))}},Wt=class extends Ae{boneIndex=0;constructor(t,e,i){super(t,e,se.shearY+"|"+i),this.boneIndex=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(i,r,h,n.shearY,n.data.shearY))}},zt=class extends ue{boneIndex=0;constructor(t,e){super(t,[se.inherit+"|"+e]),this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,i){t*=2,this.frames[t]=e,this.frames[t+1]=i}apply(t,e,i,s,r,h,l){let n=t.bones[this.boneIndex];if(!n.active)return;if(l==1){h==0&&(n.inherit=n.data.inherit);return}let a=this.frames;if(i<a[0]){(h==0||h==1)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[ue.search(a,i,2)+1]}},qt=class extends Se{slotIndex=0;constructor(t,e,i){super(t,e,[se.rgb+"|"+i,se.alpha+"|"+i]),this.slotIndex=i}getFrameEntries(){return 5}setFrame(t,e,i,s,r,h){t*=5,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s,this.frames[t+3]=r,this.frames[t+4]=h}apply(t,e,i,s,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color;if(i<a[0]){let w=n.data.color;switch(h){case 0:o.setFromColor(w);return;case 1:o.add((w.r-o.r)*r,(w.g-o.g)*r,(w.b-o.b)*r,(w.a-o.a)*r)}return}let c=0,u=0,d=0,m=0,f=ue.search(a,i,5),g=this.curves[f/5];switch(g){case 0:let w=a[f];c=a[f+1],u=a[f+2],d=a[f+3],m=a[f+4];let b=(i-w)/(a[f+5]-w);c+=(a[f+5+1]-c)*b,u+=(a[f+5+2]-u)*b,d+=(a[f+5+3]-d)*b,m+=(a[f+5+4]-m)*b;break;case 1:c=a[f+1],u=a[f+2],d=a[f+3],m=a[f+4];break;default:c=this.getBezierValue(i,f,1,g-2),u=this.getBezierValue(i,f,2,g+18-2),d=this.getBezierValue(i,f,3,g+18*2-2),m=this.getBezierValue(i,f,4,g+18*3-2)}r==1?o.set(c,u,d,m):(h==0&&o.setFromColor(n.data.color),o.add((c-o.r)*r,(u-o.g)*r,(d-o.b)*r,(m-o.a)*r))}},Gt=class extends Se{slotIndex=0;constructor(t,e,i){super(t,e,[se.rgb+"|"+i]),this.slotIndex=i}getFrameEntries(){return 4}setFrame(t,e,i,s,r){t<<=2,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s,this.frames[t+3]=r}apply(t,e,i,s,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color;if(i<a[0]){let g=n.data.color;switch(h){case 0:o.r=g.r,o.g=g.g,o.b=g.b;return;case 1:o.r+=(g.r-o.r)*r,o.g+=(g.g-o.g)*r,o.b+=(g.b-o.b)*r}return}let c=0,u=0,d=0,m=ue.search(a,i,4),f=this.curves[m>>2];switch(f){case 0:let g=a[m];c=a[m+1],u=a[m+2],d=a[m+3];let w=(i-g)/(a[m+4]-g);c+=(a[m+4+1]-c)*w,u+=(a[m+4+2]-u)*w,d+=(a[m+4+3]-d)*w;break;case 1:c=a[m+1],u=a[m+2],d=a[m+3];break;default:c=this.getBezierValue(i,m,1,f-2),u=this.getBezierValue(i,m,2,f+18-2),d=this.getBezierValue(i,m,3,f+18*2-2)}if(r==1)o.r=c,o.g=u,o.b=d;else{if(h==0){let g=n.data.color;o.r=g.r,o.g=g.g,o.b=g.b}o.r+=(c-o.r)*r,o.g+=(u-o.g)*r,o.b+=(d-o.b)*r}}},Ht=class extends Ae{slotIndex=0;constructor(t,e,i){super(t,e,se.alpha+"|"+i),this.slotIndex=i}apply(t,e,i,s,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(i<this.frames[0]){let c=n.data.color;switch(h){case 0:a.a=c.a;return;case 1:a.a+=(c.a-a.a)*r}return}let o=this.getCurveValue(i);r==1?a.a=o:(h==0&&(a.a=n.data.color.a),a.a+=(o-a.a)*r)}},_t=class extends Se{slotIndex=0;constructor(t,e,i){super(t,e,[se.rgb+"|"+i,se.alpha+"|"+i,se.rgb2+"|"+i]),this.slotIndex=i}getFrameEntries(){return 8}setFrame(t,e,i,s,r,h,l,n,a){t<<=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s,this.frames[t+3]=r,this.frames[t+4]=h,this.frames[t+5]=l,this.frames[t+6]=n,this.frames[t+7]=a}apply(t,e,i,s,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color,c=n.darkColor;if(i<a[0]){let v=n.data.color,y=n.data.darkColor;switch(h){case 0:o.setFromColor(v),c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:o.add((v.r-o.r)*r,(v.g-o.g)*r,(v.b-o.b)*r,(v.a-o.a)*r),c.r+=(y.r-c.r)*r,c.g+=(y.g-c.g)*r,c.b+=(y.b-c.b)*r}return}let u=0,d=0,m=0,f=0,g=0,w=0,b=0,p=ue.search(a,i,8),x=this.curves[p>>3];switch(x){case 0:let v=a[p];u=a[p+1],d=a[p+2],m=a[p+3],f=a[p+4],g=a[p+5],w=a[p+6],b=a[p+7];let y=(i-v)/(a[p+8]-v);u+=(a[p+8+1]-u)*y,d+=(a[p+8+2]-d)*y,m+=(a[p+8+3]-m)*y,f+=(a[p+8+4]-f)*y,g+=(a[p+8+5]-g)*y,w+=(a[p+8+6]-w)*y,b+=(a[p+8+7]-b)*y;break;case 1:u=a[p+1],d=a[p+2],m=a[p+3],f=a[p+4],g=a[p+5],w=a[p+6],b=a[p+7];break;default:u=this.getBezierValue(i,p,1,x-2),d=this.getBezierValue(i,p,2,x+18-2),m=this.getBezierValue(i,p,3,x+18*2-2),f=this.getBezierValue(i,p,4,x+18*3-2),g=this.getBezierValue(i,p,5,x+18*4-2),w=this.getBezierValue(i,p,6,x+18*5-2),b=this.getBezierValue(i,p,7,x+18*6-2)}if(r==1)o.set(u,d,m,f),c.r=g,c.g=w,c.b=b;else{if(h==0){o.setFromColor(n.data.color);let v=n.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}o.add((u-o.r)*r,(d-o.g)*r,(m-o.b)*r,(f-o.a)*r),c.r+=(g-c.r)*r,c.g+=(w-c.g)*r,c.b+=(b-c.b)*r}}},jt=class extends Se{slotIndex=0;constructor(t,e,i){super(t,e,[se.rgb+"|"+i,se.rgb2+"|"+i]),this.slotIndex=i}getFrameEntries(){return 7}setFrame(t,e,i,s,r,h,l,n){t*=7,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s,this.frames[t+3]=r,this.frames[t+4]=h,this.frames[t+5]=l,this.frames[t+6]=n}apply(t,e,i,s,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color,c=n.darkColor;if(i<a[0]){let v=n.data.color,y=n.data.darkColor;switch(h){case 0:o.r=v.r,o.g=v.g,o.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b;return;case 1:o.r+=(v.r-o.r)*r,o.g+=(v.g-o.g)*r,o.b+=(v.b-o.b)*r,c.r+=(y.r-c.r)*r,c.g+=(y.g-c.g)*r,c.b+=(y.b-c.b)*r}return}let u=0,d=0,m=0,f=0,g=0,w=0,b=0,p=ue.search(a,i,7),x=this.curves[p/7];switch(x){case 0:let v=a[p];u=a[p+1],d=a[p+2],m=a[p+3],g=a[p+4],w=a[p+5],b=a[p+6];let y=(i-v)/(a[p+7]-v);u+=(a[p+7+1]-u)*y,d+=(a[p+7+2]-d)*y,m+=(a[p+7+3]-m)*y,g+=(a[p+7+4]-g)*y,w+=(a[p+7+5]-w)*y,b+=(a[p+7+6]-b)*y;break;case 1:u=a[p+1],d=a[p+2],m=a[p+3],g=a[p+4],w=a[p+5],b=a[p+6];break;default:u=this.getBezierValue(i,p,1,x-2),d=this.getBezierValue(i,p,2,x+18-2),m=this.getBezierValue(i,p,3,x+18*2-2),g=this.getBezierValue(i,p,4,x+18*3-2),w=this.getBezierValue(i,p,5,x+18*4-2),b=this.getBezierValue(i,p,6,x+18*5-2)}if(r==1)o.r=u,o.g=d,o.b=m,c.r=g,c.g=w,c.b=b;else{if(h==0){let v=n.data.color,y=n.data.darkColor;o.r=v.r,o.g=v.g,o.b=v.b,c.r=y.r,c.g=y.g,c.b=y.b}o.r+=(u-o.r)*r,o.g+=(d-o.g)*r,o.b+=(m-o.b)*r,c.r+=(g-c.r)*r,c.g+=(w-c.g)*r,c.b+=(b-c.b)*r}}},Ne=class extends ue{slotIndex=0;attachmentNames;constructor(t,e){super(t,[se.attachment+"|"+e]),this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i}apply(t,e,i,s,r,h,l){let n=t.slots[this.slotIndex];if(n.bone.active){if(l==1){h==0&&this.setAttachment(t,n,n.data.attachmentName);return}if(i<this.frames[0]){(h==0||h==1)&&this.setAttachment(t,n,n.data.attachmentName);return}this.setAttachment(t,n,this.attachmentNames[ue.search1(this.frames,i)])}}setAttachment(t,e,i){e.setAttachment(i?t.getAttachment(this.slotIndex,i):null)}},Zt=class extends Se{slotIndex=0;attachment;vertices;constructor(t,e,i,s){super(t,e,[se.deform+"|"+i+"|"+s.id]),this.slotIndex=i,this.attachment=s,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.vertices[t]=i}setBezier(t,e,i,s,r,h,l,n,a,o,c){let u=this.curves,d=this.getFrameCount()+t*18;i==0&&(u[e]=2+d);let m=(s-h*2+n)*.03,f=a*.03-l*.06,g=((h-n)*3-s+o)*.006,w=(l-a+.33333333)*.018,b=m*2+g,p=f*2+w,x=(h-s)*.3+m+g*.16666667,v=l*.3+f+w*.16666667,y=s+x,A=v;for(let C=d+18;d<C;d+=2)u[d]=y,u[d+1]=A,x+=b,v+=p,b+=g,p+=w,y+=x,A+=v}getCurvePercent(t,e){let i=this.curves,s=i[e];switch(s){case 0:let n=this.frames[e];return(t-n)/(this.frames[e+this.getFrameEntries()]-n);case 1:return 0}if(s-=2,i[s]>t){let n=this.frames[e];return i[s+1]*(t-n)/(i[s]-n)}let r=s+18;for(s+=2;s<r;s+=2)if(i[s]>=t){let n=i[s-2],a=i[s-1];return a+(t-n)/(i[s]-n)*(i[s+1]-a)}let h=i[r-2],l=i[r-1];return l+(1-l)*(t-h)/(this.frames[e+this.getFrameEntries()]-h)}apply(t,e,i,s,r,h,l){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof Ye)||a.timelineAttachment!=this.attachment)return;let o=n.deform;o.length==0&&(h=0);let c=this.vertices,u=c[0].length,d=this.frames;if(i<d[0]){switch(h){case 0:o.length=0;return;case 1:if(r==1){o.length=0;return}o.length=u;let p=a;if(p.bones){r=1-r;for(var m=0;m<u;m++)o[m]*=r}else{let x=p.vertices;for(var m=0;m<u;m++)o[m]+=(x[m]-o[m])*r}}return}if(o.length=u,i>=d[d.length-1]){let p=c[d.length-1];if(r==1)if(h==3){let x=a;if(x.bones)for(let v=0;v<u;v++)o[v]+=p[v];else{let v=x.vertices;for(let y=0;y<u;y++)o[y]+=p[y]-v[y]}}else X.arrayCopy(p,0,o,0,u);else switch(h){case 0:{let v=a;if(v.bones)for(let y=0;y<u;y++)o[y]=p[y]*r;else{let y=v.vertices;for(let A=0;A<u;A++){let C=y[A];o[A]=C+(p[A]-C)*r}}break}case 1:case 2:for(let v=0;v<u;v++)o[v]+=(p[v]-o[v])*r;break;case 3:let x=a;if(x.bones)for(let v=0;v<u;v++)o[v]+=p[v]*r;else{let v=x.vertices;for(let y=0;y<u;y++)o[y]+=(p[y]-v[y])*r}}return}let f=ue.search1(d,i),g=this.getCurvePercent(i,f),w=c[f],b=c[f+1];if(r==1)if(h==3){let p=a;if(p.bones)for(let x=0;x<u;x++){let v=w[x];o[x]+=v+(b[x]-v)*g}else{let x=p.vertices;for(let v=0;v<u;v++){let y=w[v];o[v]+=y+(b[v]-y)*g-x[v]}}}else for(let p=0;p<u;p++){let x=w[p];o[p]=x+(b[p]-x)*g}else switch(h){case 0:{let x=a;if(x.bones)for(let v=0;v<u;v++){let y=w[v];o[v]=(y+(b[v]-y)*g)*r}else{let v=x.vertices;for(let y=0;y<u;y++){let A=w[y],C=v[y];o[y]=C+(A+(b[y]-A)*g-C)*r}}break}case 1:case 2:for(let x=0;x<u;x++){let v=w[x];o[x]+=(v+(b[x]-v)*g-o[x])*r}break;case 3:let p=a;if(p.bones)for(let x=0;x<u;x++){let v=w[x];o[x]+=(v+(b[x]-v)*g)*r}else{let x=p.vertices;for(let v=0;v<u;v++){let y=w[v];o[v]+=(y+(b[v]-y)*g-x[v])*r}}}}},dt=class Zs extends ue{static propertyIds=[""+se.event];events;constructor(e){super(e,Zs.propertyIds),this.events=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,i){this.frames[e]=i.time,this.events[e]=i}apply(e,i,s,r,h,l,n){if(!r)return;let a=this.frames,o=this.frames.length;if(i>s)this.apply(e,i,Number.MAX_VALUE,r,h,l,n),i=-1;else if(i>=a[o-1])return;if(s<a[0])return;let c=0;if(i<a[0])c=0;else{c=ue.search1(a,i)+1;let u=a[c];for(;c>0&&a[c-1]==u;)c--}for(;c<o&&s>=a[c];c++)r.push(this.events[c])}},qe=class Js extends ue{static propertyIds=[""+se.drawOrder];drawOrders;constructor(e){super(e,Js.propertyIds),this.drawOrders=new Array(e)}getFrameCount(){return this.frames.length}setFrame(e,i,s){this.frames[e]=i,this.drawOrders[e]=s}apply(e,i,s,r,h,l,n){if(n==1){l==0&&X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}if(s<this.frames[0]){(l==0||l==1)&&X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);return}let a=ue.search1(this.frames,s),o=this.drawOrders[a];if(!o)X.arrayCopy(e.slots,0,e.drawOrder,0,e.slots.length);else{let c=e.drawOrder,u=e.slots;for(let d=0,m=o.length;d<m;d++)c[d]=u[o[d]]}}},Jt=class extends Se{constraintIndex=0;constructor(t,e,i){super(t,e,[se.ikConstraint+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 6}setFrame(t,e,i,s,r,h,l){t*=6,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=s,this.frames[t+3]=r,this.frames[t+4]=h?1:0,this.frames[t+5]=l?1:0}apply(t,e,i,s,r,h,l){let n=t.ikConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(i<a[0]){switch(h){case 0:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case 1:n.mix+=(n.data.mix-n.mix)*r,n.softness+=(n.data.softness-n.softness)*r,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let o=0,c=0,u=ue.search(a,i,6),d=this.curves[u/6];switch(d){case 0:let m=a[u];o=a[u+1],c=a[u+2];let f=(i-m)/(a[u+6]-m);o+=(a[u+6+1]-o)*f,c+=(a[u+6+2]-c)*f;break;case 1:o=a[u+1],c=a[u+2];break;default:o=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}h==0?(n.mix=n.data.mix+(o-n.data.mix)*r,n.softness=n.data.softness+(c-n.data.softness)*r,l==1?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=a[u+3],n.compress=a[u+4]!=0,n.stretch=a[u+5]!=0)):(n.mix+=(o-n.mix)*r,n.softness+=(c-n.softness)*r,l==0&&(n.bendDirection=a[u+3],n.compress=a[u+4]!=0,n.stretch=a[u+5]!=0))}},Kt=class extends Se{constraintIndex=0;constructor(t,e,i){super(t,e,[se.transformConstraint+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 7}setFrame(t,e,i,s,r,h,l,n){let a=this.frames;t*=7,a[t]=e,a[t+1]=i,a[t+2]=s,a[t+3]=r,a[t+4]=h,a[t+5]=l,a[t+6]=n}apply(t,e,i,s,r,h,l){let n=t.transformConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(i<a[0]){let b=n.data;switch(h){case 0:n.mixRotate=b.mixRotate,n.mixX=b.mixX,n.mixY=b.mixY,n.mixScaleX=b.mixScaleX,n.mixScaleY=b.mixScaleY,n.mixShearY=b.mixShearY;return;case 1:n.mixRotate+=(b.mixRotate-n.mixRotate)*r,n.mixX+=(b.mixX-n.mixX)*r,n.mixY+=(b.mixY-n.mixY)*r,n.mixScaleX+=(b.mixScaleX-n.mixScaleX)*r,n.mixScaleY+=(b.mixScaleY-n.mixScaleY)*r,n.mixShearY+=(b.mixShearY-n.mixShearY)*r}return}let o,c,u,d,m,f,g=ue.search(a,i,7),w=this.curves[g/7];switch(w){case 0:let b=a[g];o=a[g+1],c=a[g+2],u=a[g+3],d=a[g+4],m=a[g+5],f=a[g+6];let p=(i-b)/(a[g+7]-b);o+=(a[g+7+1]-o)*p,c+=(a[g+7+2]-c)*p,u+=(a[g+7+3]-u)*p,d+=(a[g+7+4]-d)*p,m+=(a[g+7+5]-m)*p,f+=(a[g+7+6]-f)*p;break;case 1:o=a[g+1],c=a[g+2],u=a[g+3],d=a[g+4],m=a[g+5],f=a[g+6];break;default:o=this.getBezierValue(i,g,1,w-2),c=this.getBezierValue(i,g,2,w+18-2),u=this.getBezierValue(i,g,3,w+18*2-2),d=this.getBezierValue(i,g,4,w+18*3-2),m=this.getBezierValue(i,g,5,w+18*4-2),f=this.getBezierValue(i,g,6,w+18*5-2)}if(h==0){let b=n.data;n.mixRotate=b.mixRotate+(o-b.mixRotate)*r,n.mixX=b.mixX+(c-b.mixX)*r,n.mixY=b.mixY+(u-b.mixY)*r,n.mixScaleX=b.mixScaleX+(d-b.mixScaleX)*r,n.mixScaleY=b.mixScaleY+(m-b.mixScaleY)*r,n.mixShearY=b.mixShearY+(f-b.mixShearY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(u-n.mixY)*r,n.mixScaleX+=(d-n.mixScaleX)*r,n.mixScaleY+=(m-n.mixScaleY)*r,n.mixShearY+=(f-n.mixShearY)*r}},Qt=class extends Ae{constraintIndex=0;constructor(t,e,i){super(t,e,se.pathConstraintPosition+"|"+i),this.constraintIndex=i}apply(t,e,i,s,r,h,l){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(i,r,h,n.position,n.data.position))}},$t=class extends Ae{constraintIndex=0;constructor(t,e,i){super(t,e,se.pathConstraintSpacing+"|"+i),this.constraintIndex=i}apply(t,e,i,s,r,h,l){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(i,r,h,n.spacing,n.data.spacing))}},ei=class extends Se{constraintIndex=0;constructor(t,e,i){super(t,e,[se.pathConstraintMix+"|"+i]),this.constraintIndex=i}getFrameEntries(){return 4}setFrame(t,e,i,s,r){let h=this.frames;t<<=2,h[t]=e,h[t+1]=i,h[t+2]=s,h[t+3]=r}apply(t,e,i,s,r,h,l){let n=t.pathConstraints[this.constraintIndex];if(!n.active)return;let a=this.frames;if(i<a[0]){switch(h){case 0:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case 1:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*r,n.mixX+=(n.data.mixX-n.mixX)*r,n.mixY+=(n.data.mixY-n.mixY)*r}return}let o,c,u,d=ue.search(a,i,4),m=this.curves[d>>2];switch(m){case 0:let f=a[d];o=a[d+1],c=a[d+2],u=a[d+3];let g=(i-f)/(a[d+4]-f);o+=(a[d+4+1]-o)*g,c+=(a[d+4+2]-c)*g,u+=(a[d+4+3]-u)*g;break;case 1:o=a[d+1],c=a[d+2],u=a[d+3];break;default:o=this.getBezierValue(i,d,1,m-2),c=this.getBezierValue(i,d,2,m+18-2),u=this.getBezierValue(i,d,3,m+18*2-2)}if(h==0){let f=n.data;n.mixRotate=f.mixRotate+(o-f.mixRotate)*r,n.mixX=f.mixX+(c-f.mixX)*r,n.mixY=f.mixY+(u-f.mixY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(u-n.mixY)*r}},Be=class extends Ae{constraintIndex=0;constructor(t,e,i,s){super(t,e,s+"|"+i),this.constraintIndex=i}apply(t,e,i,s,r,h,l){let n;if(this.constraintIndex==-1){const a=i>=this.frames[0]?this.getCurveValue(i):0;for(const o of t.physicsConstraints)o.active&&this.global(o.data)&&this.set(o,this.getAbsoluteValue2(i,r,h,this.get(o),this.setup(o),a))}else n=t.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(i,r,h,this.get(n),this.setup(n)))}},ti=class extends Be{constructor(t,e,i){super(t,e,i,se.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ii=class extends Be{constructor(t,e,i){super(t,e,i,se.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},si=class extends Be{constructor(t,e,i){super(t,e,i,se.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},ri=class extends Be{constructor(t,e,i){super(t,e,i,se.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},ni=class extends Be{constructor(t,e,i){super(t,e,i,se.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},ai=class extends Be{constructor(t,e,i){super(t,e,i,se.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},li=class extends Be{constructor(t,e,i){super(t,e,i,se.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},oi=class Ks extends ue{static propertyIds=[se.physicsConstraintReset.toString()];constraintIndex;constructor(e,i){super(e,Ks.propertyIds),this.constraintIndex=i}getFrameCount(){return this.frames.length}setFrame(e,i){this.frames[e]=i}apply(e,i,s,r,h,l,n){let a;if(this.constraintIndex!=-1&&(a=e.physicsConstraints[this.constraintIndex],!a.active))return;const o=this.frames;if(i>s)this.apply(e,i,Number.MAX_VALUE,[],h,l,n),i=-1;else if(i>=o[o.length-1])return;if(!(s<o[0])&&(i<o[0]||s>=o[ue.search1(o,i)+1]))if(a!=null)a.reset();else for(const c of e.physicsConstraints)c.active&&c.reset()}},hi=class Oe extends ue{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,i,s){super(e,[se.sequence+"|"+i+"|"+s.sequence.id]),this.slotIndex=i,this.attachment=s}getFrameEntries(){return Oe.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,i,s,r,h){let l=this.frames;e*=Oe.ENTRIES,l[e]=i,l[e+Oe.MODE]=s|r<<4,l[e+Oe.DELAY]=h}apply(e,i,s,r,h,l,n){let a=e.slots[this.slotIndex];if(!a.bone.active)return;let o=a.attachment,c=this.attachment;if(o!=c&&(!(o instanceof Ye)||o.timelineAttachment!=c))return;if(n==1){l==0&&(a.sequenceIndex=-1);return}let u=this.frames;if(s<u[0]){(l==0||l==1)&&(a.sequenceIndex=-1);return}let d=ue.search(u,s,Oe.ENTRIES),m=u[d],f=u[d+Oe.MODE],g=u[d+Oe.DELAY];if(!this.attachment.sequence)return;let w=f>>4,b=this.attachment.sequence.regions.length,p=ts[f&15];if(p!=0)switch(w+=(s-m)/g+1e-5|0,p){case 1:w=Math.min(b-1,w);break;case 2:w%=b;break;case 3:{let x=(b<<1)-2;w=x==0?0:w%x,w>=b&&(w=x-w);break}case 4:w=Math.max(b-1-w,0);break;case 5:w=b-1-w%b;break;case 6:{let x=(b<<1)-2;w=x==0?0:(w+b-1)%x,w>=b&&(w=x-w)}}a.sequenceIndex=w}},rs=class It{static _emptyAnimation=new ht("<empty>",[],0);static emptyAnimation(){return It._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new as(this);propertyIDs=new Ft;animationsChanged=!1;trackEntryPool=new $e(()=>new ns);constructor(e){this.data=e}update(e){e*=this.timeScale;let i=this.tracks;for(let s=0,r=i.length;s<r;s++){let h=i[s];if(!h)continue;h.animationLast=h.nextAnimationLast,h.trackLast=h.nextTrackLast;let l=e*h.timeScale;if(h.delay>0){if(h.delay-=l,h.delay>0)continue;l=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+e)*n.timeScale,h.trackTime+=l,this.setCurrent(s,n,!0);n.mixingFrom;)n.mixTime+=e,n=n.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){i[s]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,e)){let a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=l}this.queue.drain()}updateMixingFrom(e,i){let s=e.mixingFrom;if(!s)return!0;let r=this.updateMixingFrom(s,i);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),r):(s.trackTime+=i*s.timeScale,e.mixTime+=i,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let i=this.events,s=this.tracks,r=!1;for(let d=0,m=s.length;d<m;d++){let f=s[d];if(!f||f.delay>0)continue;r=!0;let g=d==0?1:f.mixBlend,w=f.alpha;f.mixingFrom?w*=this.applyMixingFrom(f,e,g):f.trackTime>=f.trackEnd&&!f.next&&(w=0);let b=w>=f.alphaAttachmentThreshold,p=f.animationLast,x=f.getAnimationTime(),v=x,y=i;f.reverse&&(v=f.animation.duration-v,y=null);let A=f.animation.timelines,C=A.length;if(d==0&&w==1||g==3){d==0&&(b=!0);for(let S=0;S<C;S++){X.webkit602BugfixHelper(w,g);var h=A[S];h instanceof Ne?this.applyAttachmentTimeline(h,e,v,g,b):h.apply(e,p,v,y,w,g,0)}}else{let S=f.timelineMode,k=f.shortestRotation,R=!k&&f.timelinesRotation.length!=C<<1;R&&(f.timelinesRotation.length=C<<1);for(let Y=0;Y<C;Y++){let F=A[Y],L=S[Y]==ut?g:0;!k&&F instanceof et?this.applyRotateTimeline(F,e,v,w,L,f.timelinesRotation,Y<<1,R):F instanceof Ne?this.applyAttachmentTimeline(F,e,v,g,b):(X.webkit602BugfixHelper(w,g),F.apply(e,p,v,y,w,L,0))}}this.queueEvents(f,x),i.length=0,f.nextAnimationLast=x,f.nextTrackLast=f.trackTime}for(var l=this.unkeyedState+ui,n=e.slots,a=0,o=e.slots.length;a<o;a++){var c=n[a];if(c.attachmentState==l){var u=c.data.attachmentName;c.setAttachment(u?e.getAttachment(c.data.index,u):null)}}return this.unkeyedState+=2,this.queue.drain(),r}applyMixingFrom(e,i,s){let r=e.mixingFrom;r.mixingFrom&&this.applyMixingFrom(r,i,s);let h=0;e.mixDuration==0?(h=1,s==1&&(s=0)):(h=e.mixTime/e.mixDuration,h>1&&(h=1),s!=1&&(s=r.mixBlend));let l=h<r.mixAttachmentThreshold,n=h<r.mixDrawOrderThreshold,a=r.animation.timelines,o=a.length,c=r.alpha*e.interruptAlpha,u=c*(1-h),d=r.animationLast,m=r.getAnimationTime(),f=m,g=null;if(r.reverse?f=r.animation.duration-f:h<r.eventThreshold&&(g=this.events),s==3)for(let w=0;w<o;w++)a[w].apply(i,d,f,g,u,s,1);else{let w=r.timelineMode,b=r.timelineHoldMix,p=r.shortestRotation,x=!p&&r.timelinesRotation.length!=o<<1;x&&(r.timelinesRotation.length=o<<1),r.totalAlpha=0;for(let v=0;v<o;v++){let y=a[v],A=1,C,S=0;switch(w[v]){case ut:if(!n&&y instanceof qe)continue;C=s,S=u;break;case ci:C=0,S=u;break;case di:C=s,S=c;break;case ft:C=0,S=c;break;default:C=0;let k=b[v];S=c*Math.max(0,1-k.mixTime/k.mixDuration);break}r.totalAlpha+=S,!p&&y instanceof et?this.applyRotateTimeline(y,i,f,S,C,r.timelinesRotation,v<<1,x):y instanceof Ne?this.applyAttachmentTimeline(y,i,f,C,l&&S>=r.alphaAttachmentThreshold):(X.webkit602BugfixHelper(S,s),n&&y instanceof qe&&C==0&&(A=0),y.apply(i,d,f,g,S,C,A))}}return e.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,h}applyAttachmentTimeline(e,i,s,r,h){var l=i.slots[e.slotIndex];l.bone.active&&(s<e.frames[0]?(r==0||r==1)&&this.setAttachment(i,l,l.data.attachmentName,h):this.setAttachment(i,l,e.attachmentNames[ue.search1(e.frames,s)],h),l.attachmentState<=this.unkeyedState&&(l.attachmentState=this.unkeyedState+ui))}setAttachment(e,i,s,r){i.setAttachment(s?e.getAttachment(i.data.index,s):null),r&&(i.attachmentState=this.unkeyedState+hs)}applyRotateTimeline(e,i,s,r,h,l,n,a){if(a&&(l[n]=0),r==1){e.apply(i,0,s,null,1,h,0);return}let o=i.bones[e.boneIndex];if(!o.active)return;let c=e.frames,u=0,d=0;if(s<c[0])switch(h){case 0:o.rotation=o.data.rotation;default:return;case 1:u=o.rotation,d=o.data.rotation}else u=h==0?o.data.rotation:o.rotation,d=o.data.rotation+e.getCurveValue(s);let m=0,f=d-u;if(f-=Math.ceil(f/360-.5)*360,f==0)m=l[n];else{let g=0,w=0;a?(g=0,w=f):(g=l[n],w=l[n+1]);let b=g-g%360;m=f+b;let p=f>=0,x=g>=0;Math.abs(w)<=90&&P.signum(w)!=P.signum(f)&&(Math.abs(g-b)>180?(m+=360*P.signum(g),x=p):b!=0?m-=360*P.signum(g):x=p),x!=p&&(m+=360*P.signum(g)),l[n]=m}l[n+1]=f,o.rotation=u+m*r}queueEvents(e,i){let s=e.animationStart,r=e.animationEnd,h=r-s,l=e.trackLast%h,n=this.events,a=0,o=n.length;for(;a<o;a++){let u=n[a];if(u.time<l)break;u.time>r||this.queue.event(e,u)}let c=!1;if(e.loop)if(h==0)c=!0;else{const u=Math.floor(e.trackTime/h);c=u>0&&u>Math.floor(e.trackLast/h)}else c=i>=r&&e.animationLast<r;for(c&&this.queue.complete(e);a<o;a++){let u=n[a];u.time<s||this.queue.event(e,u)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,s=this.tracks.length;i<s;i++)this.clearTrack(i);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let i=this.tracks[e];if(!i)return;this.queue.end(i),this.clearNext(i);let s=i;for(;;){let r=s.mixingFrom;if(!r)break;this.queue.end(r),s.mixingFrom=null,s.mixingTo=null,s=r}this.tracks[i.trackIndex]=null,this.queue.drain()}setCurrent(e,i,s){let r=this.expandToIndex(e);this.tracks[e]=i,i.previous=null,r&&(s&&this.queue.interrupt(r),i.mixingFrom=r,r.mixingTo=i,i.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(i.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(i)}setAnimation(e,i,s=!1){let r=this.data.skeletonData.findAnimation(i);if(!r)throw new Error("Animation not found: "+i);return this.setAnimationWith(e,r,s)}setAnimationWith(e,i,s=!1){if(!i)throw new Error("animation cannot be null.");let r=!0,h=this.expandToIndex(e);h&&(h.nextTrackLast==-1?(this.tracks[e]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,r=!1):this.clearNext(h));let l=this.trackEntry(e,i,s,h);return this.setCurrent(e,l,r),this.queue.drain(),l}addAnimation(e,i,s=!1,r=0){let h=this.data.skeletonData.findAnimation(i);if(!h)throw new Error("Animation not found: "+i);return this.addAnimationWith(e,h,s,r)}addAnimationWith(e,i,s=!1,r=0){if(!i)throw new Error("animation cannot be null.");let h=this.expandToIndex(e);if(h)for(;h.next;)h=h.next;let l=this.trackEntry(e,i,s,h);return h?(h.next=l,l.previous=h,r<=0&&(r=Math.max(r+h.getTrackComplete()-l.mixDuration,0))):(this.setCurrent(e,l,!0),this.queue.drain(),r<0&&(r=0)),l.delay=r,l}setEmptyAnimation(e,i=0){let s=this.setAnimationWith(e,It.emptyAnimation(),!1);return s.mixDuration=i,s.trackEnd=i,s}addEmptyAnimation(e,i=0,s=0){let r=this.addAnimationWith(e,It.emptyAnimation(),!1,s);return s<=0&&(r.delay=Math.max(r.delay+r.mixDuration-i,0)),r.mixDuration=i,r.trackEnd=i,r}setEmptyAnimations(e=0){let i=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,r=this.tracks.length;s<r;s++){let h=this.tracks[s];h&&this.setEmptyAnimation(h.trackIndex,e)}this.queue.drainDisabled=i,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(X.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,i,s,r){let h=this.trackEntryPool.obtain();return h.reset(),h.trackIndex=e,h.animation=i,h.loop=s,h.holdPrevious=!1,h.reverse=!1,h.shortestRotation=!1,h.eventThreshold=0,h.alphaAttachmentThreshold=0,h.mixAttachmentThreshold=0,h.mixDrawOrderThreshold=0,h.animationStart=0,h.animationEnd=i.duration,h.animationLast=-1,h.nextAnimationLast=-1,h.delay=0,h.trackTime=0,h.trackLast=-1,h.nextTrackLast=-1,h.trackEnd=Number.MAX_VALUE,h.timeScale=1,h.alpha=1,h.mixTime=0,h.mixDuration=r?this.data.getMix(r.animation,i):0,h.interruptAlpha=1,h.totalAlpha=0,h.mixBlend=2,h}clearNext(e){let i=e.next;for(;i;)this.queue.dispose(i),i=i.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let i=0,s=e.length;i<s;i++){let r=e[i];if(r){for(;r.mixingFrom;)r=r.mixingFrom;do(!r.mixingTo||r.mixBlend!=3)&&this.computeHold(r),r=r.mixingTo;while(r)}}}computeHold(e){let i=e.mixingTo,s=e.animation.timelines,r=e.animation.timelines.length,h=e.timelineMode;h.length=r;let l=e.timelineHoldMix;l.length=0;let n=this.propertyIDs;if(i&&i.holdPrevious){for(let a=0;a<r;a++)h[a]=n.addAll(s[a].getPropertyIds())?ft:di;return}e:for(let a=0;a<r;a++){let o=s[a],c=o.getPropertyIds();if(!n.addAll(c))h[a]=ut;else if(!i||o instanceof Ne||o instanceof qe||o instanceof dt||!i.animation.hasTimeline(c))h[a]=ci;else{for(let u=i.mixingTo;u;u=u.mixingTo)if(!u.animation.hasTimeline(c)){if(e.mixDuration>0){h[a]=os,l[a]=u;continue e}break}h[a]=ft}}}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 i=this.listeners.indexOf(e);i>=0&&this.listeners.splice(i,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},ns=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,e<=0&&(this.previous!=null?e=Math.max(e+this.previous.getTrackComplete()-t,0):e=0),this.delay=e}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 t=this.animationEnd-this.animationStart;return t==0?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(t!=0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},as=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let i=0;i<t.length;i+=2){let s=t[i],r=t[i+1];switch(s){case 0:r.listener&&r.listener.start&&r.listener.start(r);for(let l=0;l<e.length;l++){let n=e[l];n.start&&n.start(r)}break;case 1:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let l=0;l<e.length;l++){let n=e[l];n.interrupt&&n.interrupt(r)}break;case 2:r.listener&&r.listener.end&&r.listener.end(r);for(let l=0;l<e.length;l++){let n=e[l];n.end&&n.end(r)}case 3:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let l=0;l<e.length;l++){let n=e[l];n.dispose&&n.dispose(r)}this.animState.trackEntryPool.free(r);break;case 4:r.listener&&r.listener.complete&&r.listener.complete(r);for(let l=0;l<e.length;l++){let n=e[l];n.complete&&n.complete(r)}break;case 5:let h=t[i+++2];r.listener&&r.listener.event&&r.listener.event(r,h);for(let l=0;l<e.length;l++){let n=e[l];n.event&&n.event(r,h)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},ls=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(ls||{}),gr=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},ut=0,ci=1,di=2,ft=3,os=4,ui=1,hs=2,cs=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,i){let s=this.skeletonData.findAnimation(t);if(!s)throw new Error("Animation not found: "+t);let r=this.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);this.setMixWith(s,r,i)}setMixWith(t,e,i){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let s=t.name+"."+e.name;this.animationToMixTime[s]=i}getMix(t,e){let i=t.name+"."+e.name,s=this.animationToMixTime[i];return s===void 0?this.defaultMix:s}},fi=class Qs extends Ye{color=new V(1,1,1,1);constructor(e){super(e)}copy(){let e=new Qs(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},tt=class $s extends Ye{endSlot=null;color=new V(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){let e=new $s(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.color.setFromColor(this.color),e}},mi=class{_image;constructor(t){this._image=t}getImage(){return this._image}},mt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(mt||{}),ds=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(ds||{}),us=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},pr=class extends mi{setFilters(t,e){}setWraps(t,e){}dispose(){}},gi=class{pages=new Array;regions=new Array;constructor(t){let e=new wr(t),i=new Array(4),s={};s.size=o=>{o.width=parseInt(i[1]),o.height=parseInt(i[2])},s.format=()=>{},s.filter=o=>{o.minFilter=X.enumValue(mt,i[1]),o.magFilter=X.enumValue(mt,i[2])},s.repeat=o=>{i[1].indexOf("x")!=-1&&(o.uWrap=10497),i[1].indexOf("y")!=-1&&(o.vWrap=10497)},s.pma=o=>{o.pma=i[1]=="true"};var r={};r.xy=o=>{o.x=parseInt(i[1]),o.y=parseInt(i[2])},r.size=o=>{o.width=parseInt(i[1]),o.height=parseInt(i[2])},r.bounds=o=>{o.x=parseInt(i[1]),o.y=parseInt(i[2]),o.width=parseInt(i[3]),o.height=parseInt(i[4])},r.offset=o=>{o.offsetX=parseInt(i[1]),o.offsetY=parseInt(i[2])},r.orig=o=>{o.originalWidth=parseInt(i[1]),o.originalHeight=parseInt(i[2])},r.offsets=o=>{o.offsetX=parseInt(i[1]),o.offsetY=parseInt(i[2]),o.originalWidth=parseInt(i[3]),o.originalHeight=parseInt(i[4])},r.rotate=o=>{let c=i[1];c=="true"?o.degrees=90:c!="false"&&(o.degrees=parseInt(c))},r.index=o=>{o.index=parseInt(i[1])};let h=e.readLine();for(;h&&h.trim().length==0;)h=e.readLine();for(;!(!h||h.trim().length==0||e.readEntry(i,h)==0);)h=e.readLine();let l=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)l=null,h=e.readLine();else if(l){let o=new pi(l,h);for(;;){let c=e.readEntry(i,h=e.readLine());if(c==0)break;let u=r[i[0]];if(u)u(o);else{n||(n=[]),a||(a=[]),n.push(i[0]);let d=[];for(let m=0;m<c;m++)d.push(parseInt(i[m+1]));a.push(d)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height),n&&n.length>0&&a&&a.length>0&&(o.names=n,o.values=a,n=null,a=null),o.u=o.x/l.width,o.v=o.y/l.height,o.degrees==90?(o.u2=(o.x+o.height)/l.width,o.v2=(o.y+o.width)/l.height):(o.u2=(o.x+o.width)/l.width,o.v2=(o.y+o.height)/l.height),this.regions.push(o)}else{for(l=new fs(h.trim());e.readEntry(i,h=e.readLine())!=0;){let o=s[i[0]];o&&o(l)}this.pages.push(l)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let i of this.pages)i.setTexture(t.get(e+i.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},wr=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length==0))return 0;let i=e.indexOf(":");if(i==-1)return 0;t[0]=e.substr(0,i).trim();for(let s=1,r=i+1;;s++){let h=e.indexOf(",",r);if(h==-1)return t[s]=e.substr(r).trim(),s;if(t[s]=e.substr(r,h-r).trim(),r=h+1,s==4)return 4}}},fs=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},pi=class extends us{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},Ge=class Hi extends Ye{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new V(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new V(0,0,0,0);constructor(e,i){super(e),this.path=i}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.regionUVs;(!this.uvs||this.uvs.length!=e.length)&&(this.uvs=X.newFloatArray(e.length));let i=this.uvs,s=this.uvs.length,r=this.region.u,h=this.region.v,l=0,n=0;if(this.region instanceof pi){let a=this.region,o=a.page,c=o.width,u=o.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/u,l=a.originalHeight/c,n=a.originalWidth/u;for(let d=0;d<s;d+=2)i[d]=r+e[d+1]*l,i[d+1]=h+(1-e[d])*n;return;case 180:r-=(a.originalWidth-a.offsetX-a.width)/c,h-=a.offsetY/u,l=a.originalWidth/c,n=a.originalHeight/u;for(let d=0;d<s;d+=2)i[d]=r+(1-e[d])*l,i[d+1]=h+(1-e[d+1])*n;return;case 270:r-=a.offsetY/c,h-=a.offsetX/u,l=a.originalHeight/c,n=a.originalWidth/u;for(let d=0;d<s;d+=2)i[d]=r+(1-e[d+1])*l,i[d+1]=h+e[d]*n;return}r-=a.offsetX/c,h-=(a.originalHeight-a.offsetY-a.height)/u,l=a.originalWidth/c,n=a.originalHeight/u}else this.region?(l=this.region.u2-r,n=this.region.v2-h):(r=h=0,l=n=1);for(let a=0;a<s;a+=2)i[a]=r+e[a]*l,i[a+1]=h+e[a+1]*n}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 Hi(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=new Array(this.regionUVs.length),X.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.uvs=this.uvs instanceof Float32Array?X.newFloatArray(this.uvs.length):new Array(this.uvs.length),X.arrayCopy(this.uvs,0,e.uvs,0,this.uvs.length),e.triangles=new Array(this.triangles.length),X.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),X.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}computeWorldVertices(e,i,s,r,h,l){this.sequence!=null&&this.sequence.apply(e,this),super.computeWorldVertices(e,i,s,r,h,l)}newLinkedMesh(){let e=new Hi(this.name,this.path);return e.region=this.region,e.color.setFromColor(this.color),e.timelineAttachment=this.timelineAttachment,e.setParentMesh(this.parentMesh?this.parentMesh:this),e.region!=null&&e.updateRegion(),e}},He=class er extends Ye{lengths=[];closed=!1;constantSpeed=!1;color=new V(1,1,1,1);constructor(e){super(e)}copy(){let e=new er(this.name);return this.copyTo(e),e.lengths=new Array(this.lengths.length),X.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},ms=class tr extends Ye{x=0;y=0;rotation=0;color=new V(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,i){return i.x=this.x*e.a+this.y*e.b+e.worldX,i.y=this.x*e.c+this.y*e.d+e.worldY,i}computeWorldRotation(e){const i=this.rotation*P.degRad,s=Math.cos(i),r=Math.sin(i),h=s*e.a+r*e.b,l=s*e.c+r*e.d;return P.atan2Deg(l,h)}copy(){let e=new tr(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},it=class ir extends Lt{x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;color=new V(1,1,1,1);path;region=null;sequence=null;offset=X.newFloatArray(8);uvs=X.newFloatArray(8);tempColor=new V(1,1,1,1);constructor(e,i){super(e),this.path=i}updateRegion(){if(!this.region)throw new Error("Region not set.");let e=this.region,i=this.uvs;if(e==null){i[0]=0,i[1]=0,i[2]=0,i[3]=1,i[4]=1,i[5]=1,i[6]=1,i[7]=0;return}let s=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,h=-this.width/2*this.scaleX+this.region.offsetX*s,l=-this.height/2*this.scaleY+this.region.offsetY*r,n=h+this.region.width*s,a=l+this.region.height*r,o=this.rotation*P.degRad,c=Math.cos(o),u=Math.sin(o),d=this.x,m=this.y,f=h*c+d,g=h*u,w=l*c+m,b=l*u,p=n*c+d,x=n*u,v=a*c+m,y=a*u,A=this.offset;A[0]=f-b,A[1]=w+g,A[2]=f-y,A[3]=v+g,A[4]=p-y,A[5]=v+x,A[6]=p-b,A[7]=w+x,e.degrees==90?(i[0]=e.u2,i[1]=e.v2,i[2]=e.u,i[3]=e.v2,i[4]=e.u,i[5]=e.v,i[6]=e.u2,i[7]=e.v):(i[0]=e.u,i[1]=e.v2,i[2]=e.u,i[3]=e.v,i[4]=e.u2,i[5]=e.v,i[6]=e.u2,i[7]=e.v2)}computeWorldVertices(e,i,s,r){this.sequence!=null&&this.sequence.apply(e,this);let h=e.bone,l=this.offset,n=h.worldX,a=h.worldY,o=h.a,c=h.b,u=h.c,d=h.d,m=0,f=0;m=l[0],f=l[1],i[s]=m*o+f*c+n,i[s+1]=m*u+f*d+a,s+=r,m=l[2],f=l[3],i[s]=m*o+f*c+n,i[s+1]=m*u+f*d+a,s+=r,m=l[4],f=l[5],i[s]=m*o+f*c+n,i[s+1]=m*u+f*d+a,s+=r,m=l[6],f=l[7],i[s]=m*o+f*c+n,i[s+1]=m*u+f*d+a}copy(){let e=new ir(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,X.arrayCopy(this.uvs,0,e.uvs,0,8),X.arrayCopy(this.offset,0,e.offset,0,8),e.color.setFromColor(this.color),e.sequence=this.sequence!=null?this.sequence.copy():null,e}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},gs=class{atlas;constructor(t){this.atlas=t}loadSequence(t,e,i){let s=i.regions;for(let r=0,h=s.length;r<h;r++){let l=i.getPath(e,r),n=this.atlas.findRegion(l);if(n==null)throw new Error("Region not found in atlas: "+l+" (sequence: "+t+")");s[r]=n}}newRegionAttachment(t,e,i,s){let r=new it(e,i);if(s!=null)this.loadSequence(e,i,s);else{let h=this.atlas.findRegion(i);if(!h)throw new Error("Region not found in atlas: "+i+" (region attachment: "+e+")");r.region=h}return r}newMeshAttachment(t,e,i,s){let r=new Ge(e,i);if(s!=null)this.loadSequence(e,i,s);else{let h=this.atlas.findRegion(i);if(!h)throw new Error("Region not found in atlas: "+i+" (mesh attachment: "+e+")");r.region=h}return r}newBoundingBoxAttachment(t,e){return new fi(e)}newPathAttachment(t,e){return new He(e)}newPointAttachment(t,e){return new ms(e)}newClippingAttachment(t,e){return new tt(e)}},wi=class{index=0;name;parent=null;length=0;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;inherit=0;skinRequired=!1;color=new V;icon;visible=!1;constructor(t,e,i){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=i}},gt=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(gt||{}),xi=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(t,e,i){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=i,this.setToSetupPose()}isActive(){return this.active}update(t){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(t,e,i,s,r,h,l){this.ax=t,this.ay=e,this.arotation=i,this.ascaleX=s,this.ascaleY=r,this.ashearX=h,this.ashearY=l;let n=this.parent;if(!n){let d=this.skeleton;const m=d.scaleX,f=d.scaleY,g=(i+h)*P.degRad,w=(i+90+l)*P.degRad;this.a=Math.cos(g)*s*m,this.b=Math.cos(w)*r*m,this.c=Math.sin(g)*s*f,this.d=Math.sin(w)*r*f,this.worldX=t*m+d.x,this.worldY=e*f+d.y;return}let a=n.a,o=n.b,c=n.c,u=n.d;switch(this.worldX=a*t+o*e+n.worldX,this.worldY=c*t+u*e+n.worldY,this.inherit){case 0:{const d=(i+h)*P.degRad,m=(i+90+l)*P.degRad,f=Math.cos(d)*s,g=Math.cos(m)*r,w=Math.sin(d)*s,b=Math.sin(m)*r;this.a=a*f+o*w,this.b=a*g+o*b,this.c=c*f+u*w,this.d=c*g+u*b;return}case 1:{const d=(i+h)*P.degRad,m=(i+90+l)*P.degRad;this.a=Math.cos(d)*s,this.b=Math.cos(m)*r,this.c=Math.sin(d)*s,this.d=Math.sin(m)*r;break}case 2:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=d,c*=m;let f=a*a+c*c,g=0;f>1e-4?(f=Math.abs(a*u*m-o*d*c)/f,o=c*f,u=a*f,g=Math.atan2(c,a)*P.radDeg):(a=0,c=0,g=90-Math.atan2(u,o)*P.radDeg);const w=(i+h-g)*P.degRad,b=(i+l-g+90)*P.degRad,p=Math.cos(w)*s,x=Math.cos(b)*r,v=Math.sin(w)*s,y=Math.sin(b)*r;this.a=a*p-o*v,this.b=a*x-o*y,this.c=c*p+u*v,this.d=c*x+u*y;break}case 3:case 4:{i*=P.degRad;const d=Math.cos(i),m=Math.sin(i);let f=(a*d+o*m)/this.skeleton.scaleX,g=(c*d+u*m)/this.skeleton.scaleY,w=Math.sqrt(f*f+g*g);w>1e-5&&(w=1/w),f*=w,g*=w,w=Math.sqrt(f*f+g*g),this.inherit==3&&a*u-o*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),i=Math.PI/2+Math.atan2(g,f);const b=Math.cos(i)*w,p=Math.sin(i)*w;h*=P.degRad,l=(90+l)*P.degRad;const x=Math.cos(h)*s,v=Math.cos(l)*r,y=Math.sin(h)*s,A=Math.sin(l)*r;this.a=f*x+b*y,this.b=f*v+b*A,this.c=g*x+p*y,this.d=g*v+p*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*P.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*P.radDeg;return}let e=t.a,i=t.b,s=t.c,r=t.d,h=1/(e*r-i*s),l=r*h,n=i*h,a=s*h,o=e*h,c=this.worldX-t.worldX,u=this.worldY-t.worldY;this.ax=c*l-u*n,this.ay=u*o-c*a;let d,m,f,g;if(this.inherit==1)d=this.a,m=this.b,f=this.c,g=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(e*r-i*s)/(e*e+s*s);i=-s*this.skeleton.scaleX*v/this.skeleton.scaleY,r=e*this.skeleton.scaleY*v/this.skeleton.scaleX,h=1/(e*r-i*s),l=r*h,n=i*h;break}case 3:case 4:let w=P.cosDeg(this.rotation),b=P.sinDeg(this.rotation);e=(e*w+i*b)/this.skeleton.scaleX,s=(s*w+r*b)/this.skeleton.scaleY;let p=Math.sqrt(e*e+s*s);p>1e-5&&(p=1/p),e*=p,s*=p,p=Math.sqrt(e*e+s*s),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(p=-p);let x=P.PI/2+Math.atan2(s,e);i=Math.cos(x)*p,r=Math.sin(x)*p,h=1/(e*r-i*s),l=r*h,n=i*h,a=s*h,o=e*h}d=l*this.a-n*this.c,m=l*this.b-n*this.d,f=o*this.c-a*this.a,g=o*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+f*f),this.ascaleX>1e-4){let w=d*g-m*f;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(d*m+f*g,w)*P.radDeg,this.arotation=Math.atan2(f,d)*P.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,m)*P.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*P.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*P.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),i=t.x-this.worldX,s=t.y-this.worldY;return t.x=i*this.d*e-s*this.b*e,t.y=s*this.a*e-i*this.c*e,t}localToWorld(t){let e=t.x,i=t.y;return t.x=e*this.a+i*this.b+this.worldX,t.y=e*this.c+i*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.parent==null?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=P.sinDeg(t),i=P.cosDeg(t);return Math.atan2(this.a*e-this.c*i,this.d*i-this.b*e)*P.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=P.sinDeg(t),i=P.cosDeg(t);return Math.atan2(i*this.c+e*this.d,i*this.a+e*this.b)*P.radDeg}rotateWorld(t){t*=P.degRad;const e=Math.sin(t),i=Math.cos(t),s=this.a,r=this.b;this.a=i*s-e*this.c,this.b=i*r-e*this.d,this.c=e*s+i*this.c,this.d=e*r+i*this.d}},st=class{constructor(t,e,i){this.name=t,this.order=e,this.skinRequired=i}},ps=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(t,e="",i=new bi,s=new ws){this.textureLoader=t,this.pathPrefix=e,this.downloader=i,this.cache=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,i){this.toLoad--,this.loaded++,this.cache.assets[e]=i,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,i)}error(t,e,i){this.toLoad--,this.loaded++,this.errors[e]=i,t&&t(e,i)}loadAll(){return new Promise((e,i)=>{let s=()=>{if(this.isLoadingComplete()){this.hasErrors()?i(this.errors):e(this);return}requestAnimationFrame(s)};requestAnimationFrame(s)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},i=()=>{}){t=this.start(t),!this.reuseAssets(t,e,i)&&(this.cache.assetsLoaded[t]=new Promise((s,r)=>{this.downloader.downloadBinary(t,h=>{this.success(e,t,h),s(h)},(h,l)=>{const n=`Couldn't load binary ${t}: status ${h}, ${l}`;this.error(i,t,n),r(n)})}))}loadText(t,e=()=>{},i=()=>{}){t=this.start(t),this.downloader.downloadText(t,s=>{this.success(e,t,s)},(s,r)=>{this.error(i,t,`Couldn't load text ${t}: status ${s}, ${r}`)})}loadJson(t,e=()=>{},i=()=>{}){t=this.start(t),!this.reuseAssets(t,e,i)&&(this.cache.assetsLoaded[t]=new Promise((s,r)=>{this.downloader.downloadJson(t,h=>{this.success(e,t,h),s(h)},(h,l)=>{const n=`Couldn't load JSON ${t}: status ${h}, ${l}`;this.error(i,t,n),r(n)})}))}reuseAssets(t,e=()=>{},i=()=>{}){const s=this.cache.assetsLoaded[t],r=s!==void 0;return r&&(this.cache.assetsLoaded[t]=s.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(e,t,h),h)).catch(h=>this.error(i,t,h))),r}loadTexture(t,e=()=>{},i=()=>{}){t=this.start(t),!this.reuseAssets(t,e,i)&&(this.cache.assetsLoaded[t]=new Promise((s,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${t}`;this.error(i,t,`Couldn't load image: ${t}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.textureLoader(n);this.success(e,t,a),s(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.textureLoader(n);this.success(e,t,a),s(a)},n.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(i,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),n.src=t}}))}loadTextureAtlas(t,e=()=>{},i=()=>{},s){let r=t.lastIndexOf("/"),h=r>=0?t.substring(0,r+1):"";t=this.start(t),!this.reuseAssets(t,e,i)&&(this.cache.assetsLoaded[t]=new Promise((l,n)=>{this.downloader.downloadText(t,a=>{try{let o=new gi(a),c=o.pages.length,u=!1;for(let d of o.pages)this.loadTexture(s?s[d.name]:h+d.name,(m,f)=>{u||(d.setTexture(f),--c==0&&(this.success(e,t,o),l(o)))},(m,f)=>{if(!u){const g=`Couldn't load texture ${t} page image: ${m}`;this.error(i,t,g),n(g)}u=!0})}catch(o){const c=`Couldn't parse texture atlas ${t}: ${o.message}`;this.error(i,t,c),n(c)}},(a,o)=>{const c=`Couldn't load texture atlas ${t}: status ${a}, ${o}`;this.error(i,t,c),n(c)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},i=()=>{},s){t=this.start(t),!this.reuseAssets(t,e,i)&&(this.cache.assetsLoaded[t]=new Promise((r,h)=>{this.downloader.downloadText(t,l=>{try{const n=new gi(l);this.success(e,t,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${t}: ${n.message}`;this.error(i,t,a),h(a)}},(l,n)=>{const a=`Couldn't load texture atlas ${t}: status ${l}, ${n}`;this.error(i,t,a),h(a)})}))}async loadBinaryAsync(t){return new Promise((e,i)=>{this.loadBinary(t,(s,r)=>e(r),(s,r)=>i(r))})}async loadJsonAsync(t){return new Promise((e,i)=>{this.loadJson(t,(s,r)=>e(r),(s,r)=>i(r))})}async loadTextureAsync(t){return new Promise((e,i)=>{this.loadTexture(t,(s,r)=>e(r),(s,r)=>i(r))})}async loadTextureAtlasAsync(t){return new Promise((e,i)=>{this.loadTextureAtlas(t,(s,r)=>e(r),(s,r)=>i(r))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,i)=>{this.loadTextureAtlasButNoTextures(t,(s,r)=>e(r),(s,r)=>i(r))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.cache.assets[t];if(e)return e;let i=this.errors[t];throw Error("Asset not found: "+t+(i?`
|
|
`+i:""))}remove(t){t=this.pathPrefix+t;let e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(let t in this.cache.assets){let e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){--this.cache.assetsRefCount[t]===0&&this.remove(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},ws=class Mt{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const i=Mt.AVAILABLE_CACHES.get(e);if(i)return i;const s=new Mt;return Mt.AVAILABLE_CACHES.set(e,s),s}async addAsset(e,i){this.assetsLoaded[e]=Promise.resolve(i),this.assets[e]=await i}},bi=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!=-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),i=e.length,s=new Uint8Array(i),r=0;r<i;r++)s[r]=e.charCodeAt(r);return s}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e==-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,i){if(this.start(t,e,i))return;const s=this.rawDataUris[t];if(s&&!s.includes(".")){try{this.finish(t,200,this.dataUriToString(s))}catch(l){this.finish(t,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.open("GET",s||t,!0);let h=()=>{this.finish(t,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(t,e,i){this.downloadText(t,s=>{e(JSON.parse(s))},i)}downloadBinary(t,e,i){if(this.start(t,e,i))return;const s=this.rawDataUris[t];if(s&&!s.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(s))}catch(l){this.finish(t,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.open("GET",s||t,!0),r.responseType="arraybuffer";let h=()=>{this.finish(t,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(t,200,new Uint8Array(r.response)):h()},r.onerror=h,r.send()}start(t,e,i){let s=this.callbacks[t];try{if(s)return!0;this.callbacks[t]=s=[]}finally{s.push(e,i)}}finish(t,e,i){let s=this.callbacks[t];delete this.callbacks[t];let r=e==200||e==0?[i]:[e,i];for(let h=r.length-1,l=s.length;h<l;h+=2)s[h].apply(null,r)}},vi=class{data;intValue=0;floatValue=0;stringValue=null;time=0;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},yi=class{name;intValue=0;floatValue=0;stringValue=null;audioPath=null;volume=0;balance=0;constructor(t){this.name=t}},xs=class{data;bones;target;bendDirection=0;compress=!1;stretch=!1;mix=1;softness=0;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(r)}let i=e.findBone(t.target.name);if(!i)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=i,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(this.mix==0)return;let e=this.target,i=this.bones;switch(i.length){case 1:this.apply1(i[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(i[0],i[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(t,e,i,s,r,h,l){let n=t.parent;if(!n)throw new Error("IK bone must have parent.");let a=n.a,o=n.b,c=n.c,u=n.d,d=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case 1:m=(e-t.worldX)*P.signum(t.skeleton.scaleX),f=(i-t.worldY)*P.signum(t.skeleton.scaleY);break;case 2:let b=Math.abs(a*u-o*c)/Math.max(1e-4,a*a+c*c),p=a/t.skeleton.scaleX,x=c/t.skeleton.scaleY;o=-x*b*t.skeleton.scaleX,u=p*b*t.skeleton.scaleY,d+=Math.atan2(x,p)*P.radDeg;default:let v=e-n.worldX,y=i-n.worldY,A=a*u-o*c;Math.abs(A)<=1e-4?(m=0,f=0):(m=(v*u-y*o)/A-t.ax,f=(y*a-v*c)/A-t.ay)}d+=Math.atan2(f,m)*P.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let g=t.ascaleX,w=t.ascaleY;if(s||r){switch(t.inherit){case 3:case 4:m=e-t.worldX,f=i-t.worldY}const b=t.data.length*g;if(b>1e-4){const p=m*m+f*f;if(s&&p<b*b||r&&p>b*b){const x=(Math.sqrt(p)/b-1)*l+1;g*=x,h&&(w*=x)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*l,g,w,t.ashearX,t.ashearY)}apply2(t,e,i,s,r,h,l,n,a){if(t.inherit!=0||e.inherit!=0)return;let o=t.ax,c=t.ay,u=t.ascaleX,d=t.ascaleY,m=u,f=d,g=e.ascaleX,w=0,b=0,p=0;u<0?(u=-u,w=180,p=-1):(w=0,p=1),d<0&&(d=-d,p=-p),g<0?(g=-g,b=180):b=0;let x=e.ax,v=0,y=0,A=0,C=t.a,S=t.b,k=t.c,R=t.d,Y=Math.abs(u-d)<=1e-4;!Y||h?(v=0,y=C*x+t.worldX,A=k*x+t.worldY):(v=e.ay,y=C*x+S*v+t.worldX,A=k*x+R*v+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");C=F.a,S=F.b,k=F.c,R=F.d;let L=C*R-S*k,I=y-F.worldX,M=A-F.worldY;L=Math.abs(L)<=1e-4?0:1/L;let B=(I*R-M*S)*L-o,ie=(M*C-I*k)*L-c,te=Math.sqrt(B*B+ie*ie),re=e.data.length*g,ce,oe;if(te<1e-4){this.apply1(t,i,s,!1,h,!1,a),e.updateWorldTransformWith(x,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}I=i-F.worldX,M=s-F.worldY;let fe=(I*R-M*S)*L-o,J=(M*C-I*k)*L-c,ne=fe*fe+J*J;if(n!=0){n*=u*(g+1)*.5;let me=Math.sqrt(ne),we=me-te-re*u+n;if(we>0){let xe=Math.min(1,we/(n*2))-1;xe=(we-n*(1-xe*xe))/me,fe-=xe*fe,J-=xe*J,ne=fe*fe+J*J}}e:if(Y){re*=u;let me=(ne-te*te-re*re)/(2*te*re);me<-1?(me=-1,oe=Math.PI*r):me>1?(me=1,oe=0,h&&(C=(Math.sqrt(ne)/(te+re)-1)*a+1,m*=C,l&&(f*=C))):oe=Math.acos(me)*r,C=te+re*me,S=re*Math.sin(oe),ce=Math.atan2(J*C-fe*S,fe*C+J*S)}else{C=u*re,S=d*re;let me=C*C,we=S*S,xe=Math.atan2(J,fe);k=we*te*te+me*ne-me*we;let Ie=-2*we*te,Je=we-me;if(R=Ie*Ie-4*Je*k,R>=0){let Ke=Math.sqrt(R);Ie<0&&(Ke=-Ke),Ke=-(Ie+Ke)*.5;let lt=Ke/Je,_s=k/Ke,kt=Math.abs(lt)<Math.abs(_s)?lt:_s;if(lt=ne-kt*kt,lt>=0){M=Math.sqrt(lt)*r,ce=xe-Math.atan2(M,kt),oe=Math.atan2(M/d,(kt-te)/u);break e}}let at=P.PI,St=te-C,qi=St*St,qs=0,Gs=0,Tt=te+C,Gi=Tt*Tt,Hs=0;k=-C*te/(me-we),k>=-1&&k<=1&&(k=Math.acos(k),I=C*Math.cos(k)+te,M=S*Math.sin(k),R=I*I+M*M,R<qi&&(at=k,qi=R,St=I,qs=M),R>Gi&&(Gs=k,Gi=R,Tt=I,Hs=M)),ne<=(qi+Gi)*.5?(ce=xe-Math.atan2(qs*r,St),oe=at*r):(ce=xe-Math.atan2(Hs*r,Tt),oe=Gs*r)}let he=Math.atan2(v,x)*p,be=t.arotation;ce=(ce-he)*P.radDeg+w-be,ce>180?ce-=360:ce<-180&&(ce+=360),t.updateWorldTransformWith(o,c,be+ce*a,m,f,0,0),be=e.arotation,oe=((oe+he)*P.radDeg-e.ashearX)*p+b-be,oe>180?oe-=360:oe<-180&&(oe+=360),e.updateWorldTransformWith(x,v,be+oe*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},Ai=class extends st{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(t){super(t,0,!1)}},Ci=class extends st{bones=new Array;_target=null;set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(t){super(t,0,!1)}},Si=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(Si||{}),Ti=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(Ti||{}),ki=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(ki||{}),bs=class De{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(e,i){if(!e)throw new Error("data cannot be null.");if(!i)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let r=0,h=e.bones.length;r<h;r++){let l=i.findBone(e.bones[r].name);if(!l)throw new Error(`Couldn't find bone ${e.bones[r].name}.`);this.bones.push(l)}let s=i.findSlot(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=s,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let i=this.target.getAttachment();if(!(i instanceof He))return;let s=this.mixRotate,r=this.mixX,h=this.mixY;if(s==0&&r==0&&h==0)return;let l=this.data,n=l.rotateMode==0,a=l.rotateMode==2,o=this.bones,c=o.length,u=n?c:c+1,d=X.setArraySize(this.spaces,u),m=a?this.lengths=X.setArraySize(this.lengths,c):[],f=this.spacing;switch(l.spacingMode){case 2:if(a)for(let A=0,C=u-1;A<C;A++){let S=o[A],k=S.data.length,R=k*S.a,Y=k*S.c;m[A]=Math.sqrt(R*R+Y*Y)}X.arrayFill(d,1,u,f);break;case 3:let v=0;for(let A=0,C=u-1;A<C;){let S=o[A],k=S.data.length;if(k<De.epsilon)a&&(m[A]=0),d[++A]=f;else{let R=k*S.a,Y=k*S.c,F=Math.sqrt(R*R+Y*Y);a&&(m[A]=F),d[++A]=F,v+=F}}if(v>0){v=u/v*f;for(let A=1;A<u;A++)d[A]*=v}break;default:let y=l.spacingMode==0;for(let A=0,C=u-1;A<C;){let S=o[A],k=S.data.length;if(k<De.epsilon)a&&(m[A]=0),d[++A]=f;else{let R=k*S.a,Y=k*S.c,F=Math.sqrt(R*R+Y*Y);a&&(m[A]=F),d[++A]=(y?k+f:f)*F/k}}}let g=this.computeWorldPositions(i,u,n),w=g[0],b=g[1],p=l.offsetRotation,x=!1;if(p==0)x=l.rotateMode==1;else{x=!1;let v=this.target.bone;p*=v.a*v.d-v.b*v.c>0?P.degRad:-P.degRad}for(let v=0,y=3;v<c;v++,y+=3){let A=o[v];A.worldX+=(w-A.worldX)*r,A.worldY+=(b-A.worldY)*h;let C=g[y],S=g[y+1],k=C-w,R=S-b;if(a){let Y=m[v];if(Y!=0){let F=(Math.sqrt(k*k+R*R)/Y-1)*s+1;A.a*=F,A.c*=F}}if(w=C,b=S,s>0){let Y=A.a,F=A.b,L=A.c,I=A.d,M=0,B=0,ie=0;if(n?M=g[y-1]:d[v+1]==0?M=g[y+2]:M=Math.atan2(R,k),M-=Math.atan2(L,Y),x){B=Math.cos(M),ie=Math.sin(M);let te=A.data.length;w+=(te*(B*Y-ie*L)-k)*s,b+=(te*(ie*Y+B*L)-R)*s}else M+=p;M>P.PI?M-=P.PI2:M<-P.PI&&(M+=P.PI2),M*=s,B=Math.cos(M),ie=Math.sin(M),A.a=B*Y-ie*L,A.b=B*F-ie*I,A.c=ie*Y+B*L,A.d=ie*F+B*I}A.updateAppliedTransform()}}computeWorldPositions(e,i,s){let r=this.target,h=this.position,l=this.spaces,n=X.setArraySize(this.positions,i*3+2),a=this.world,o=e.closed,c=e.worldVerticesLength,u=c/6,d=De.NONE;if(!e.constantSpeed){let te=e.lengths;u-=o?1:2;let re=te[u];this.data.positionMode==1&&(h*=re);let ce;switch(this.data.spacingMode){case 2:ce=re;break;case 3:ce=re/i;break;default:ce=1}a=X.setArraySize(this.world,8);for(let oe=0,fe=0,J=0;oe<i;oe++,fe+=3){let ne=l[oe]*ce;h+=ne;let he=h;if(o)he%=re,he<0&&(he+=re),J=0;else if(he<0){d!=De.BEFORE&&(d=De.BEFORE,e.computeWorldVertices(r,2,4,a,0,2)),this.addBeforePosition(he,a,0,n,fe);continue}else if(he>re){d!=De.AFTER&&(d=De.AFTER,e.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition(he-re,a,0,n,fe);continue}for(;;J++){let be=te[J];if(!(he>be)){if(J==0)he/=be;else{let me=te[J-1];he=(he-me)/(be-me)}break}}J!=d&&(d=J,o&&J==u?(e.computeWorldVertices(r,c-4,4,a,0,2),e.computeWorldVertices(r,0,4,a,4,2)):e.computeWorldVertices(r,J*6+2,8,a,0,2)),this.addCurvePosition(he,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,fe,s||oe>0&&ne==0)}return n}o?(c+=2,a=X.setArraySize(this.world,c),e.computeWorldVertices(r,2,c-4,a,0,2),e.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(u--,c-=4,a=X.setArraySize(this.world,c),e.computeWorldVertices(r,2,c,a,0,2));let m=X.setArraySize(this.curves,u),f=0,g=a[0],w=a[1],b=0,p=0,x=0,v=0,y=0,A=0,C=0,S=0,k=0,R=0,Y=0,F=0,L=0,I=0;for(let te=0,re=2;te<u;te++,re+=6)b=a[re],p=a[re+1],x=a[re+2],v=a[re+3],y=a[re+4],A=a[re+5],C=(g-b*2+x)*.1875,S=(w-p*2+v)*.1875,k=((b-x)*3-g+y)*.09375,R=((p-v)*3-w+A)*.09375,Y=C*2+k,F=S*2+R,L=(b-g)*.75+C+k*.16666667,I=(p-w)*.75+S+R*.16666667,f+=Math.sqrt(L*L+I*I),L+=Y,I+=F,Y+=k,F+=R,f+=Math.sqrt(L*L+I*I),L+=Y,I+=F,f+=Math.sqrt(L*L+I*I),L+=Y+k,I+=F+R,f+=Math.sqrt(L*L+I*I),m[te]=f,g=y,w=A;this.data.positionMode==1&&(h*=f);let M;switch(this.data.spacingMode){case 2:M=f;break;case 3:M=f/i;break;default:M=1}let B=this.segments,ie=0;for(let te=0,re=0,ce=0,oe=0;te<i;te++,re+=3){let fe=l[te]*M;h+=fe;let J=h;if(o)J%=f,J<0&&(J+=f),ce=0;else if(J<0){this.addBeforePosition(J,a,0,n,re);continue}else if(J>f){this.addAfterPosition(J-f,a,c-4,n,re);continue}for(;;ce++){let ne=m[ce];if(!(J>ne)){if(ce==0)J/=ne;else{let he=m[ce-1];J=(J-he)/(ne-he)}break}}if(ce!=d){d=ce;let ne=ce*6;for(g=a[ne],w=a[ne+1],b=a[ne+2],p=a[ne+3],x=a[ne+4],v=a[ne+5],y=a[ne+6],A=a[ne+7],C=(g-b*2+x)*.03,S=(w-p*2+v)*.03,k=((b-x)*3-g+y)*.006,R=((p-v)*3-w+A)*.006,Y=C*2+k,F=S*2+R,L=(b-g)*.3+C+k*.16666667,I=(p-w)*.3+S+R*.16666667,ie=Math.sqrt(L*L+I*I),B[0]=ie,ne=1;ne<8;ne++)L+=Y,I+=F,Y+=k,F+=R,ie+=Math.sqrt(L*L+I*I),B[ne]=ie;L+=Y,I+=F,ie+=Math.sqrt(L*L+I*I),B[8]=ie,L+=Y+k,I+=F+R,ie+=Math.sqrt(L*L+I*I),B[9]=ie,oe=0}for(J*=ie;;oe++){let ne=B[oe];if(!(J>ne)){if(oe==0)J/=ne;else{let he=B[oe-1];J=oe+(J-he)/(ne-he)}break}}this.addCurvePosition(J*.1,g,w,b,p,x,v,y,A,n,re,s||te>0&&fe==0)}return n}addBeforePosition(e,i,s,r,h){let l=i[s],n=i[s+1],a=i[s+2]-l,o=i[s+3]-n,c=Math.atan2(o,a);r[h]=l+e*Math.cos(c),r[h+1]=n+e*Math.sin(c),r[h+2]=c}addAfterPosition(e,i,s,r,h){let l=i[s+2],n=i[s+3],a=l-i[s],o=n-i[s+1],c=Math.atan2(o,a);r[h]=l+e*Math.cos(c),r[h+1]=n+e*Math.sin(c),r[h+2]=c}addCurvePosition(e,i,s,r,h,l,n,a,o,c,u,d){if(e==0||isNaN(e)){c[u]=i,c[u+1]=s,c[u+2]=Math.atan2(h-s,r-i);return}let m=e*e,f=m*e,g=1-e,w=g*g,b=w*g,p=g*e,x=p*3,v=g*x,y=x*e,A=i*b+r*v+l*y+a*f,C=s*b+h*v+n*y+o*f;c[u]=A,c[u+1]=C,d&&(e<.001?c[u+2]=Math.atan2(h-s,r-i):c[u+2]=Math.atan2(C-(s*w+h*p*2+n*m),A-(i*w+r*p*2+l*m)))}},xr=class{data;_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(t,e){this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(e==0)return;const i=this.data.x>0,s=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,l=this.bone,n=l.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,o=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=o,this.lastTime=a.time;const c=l.worldX,u=l.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=u;else{let d=this.remaining,m=this.inertia,f=this.data.step,g=this.skeleton.data.referenceScale,w=-1,b=this.data.limit*o,p=b*Math.abs(a.scaleY);if(b*=Math.abs(a.scaleX),i||s){if(i){const x=(this.ux-c)*m;this.xOffset+=x>b?b:x<-b?-b:x,this.ux=c}if(s){const x=(this.uy-u)*m;this.yOffset+=x>p?p:x<-p?-p:x,this.uy=u}if(d>=f){w=Math.pow(this.damping,60*f);const x=this.massInverse*f,v=this.strength,y=this.wind*g*a.scaleX,A=this.gravity*g*a.scaleY;do i&&(this.xVelocity+=(y-this.xOffset*v)*x,this.xOffset+=this.xVelocity*f,this.xVelocity*=w),s&&(this.yVelocity-=(A+this.yOffset*v)*x,this.yOffset+=this.yVelocity*f,this.yVelocity*=w),d-=f;while(d>=f)}i&&(l.worldX+=this.xOffset*e*this.data.x),s&&(l.worldY+=this.yOffset*e*this.data.y)}if(r||h){let x=Math.atan2(l.c,l.a),v=0,y=0,A=0,C=this.cx-l.worldX,S=this.cy-l.worldY;if(C>b?C=b:C<-b&&(C=-b),S>p?S=p:S<-p&&(S=-p),r){A=(this.data.rotate+this.data.shearX)*e;let k=Math.atan2(S+this.ty,C+this.tx)-x-this.rotateOffset*A;this.rotateOffset+=(k-Math.ceil(k*P.invPI2-.5)*P.PI2)*m,k=this.rotateOffset*A+x,v=Math.cos(k),y=Math.sin(k),h&&(k=n*l.getWorldScaleX(),k>0&&(this.scaleOffset+=(C*v+S*y)*m/k))}else{v=Math.cos(x),y=Math.sin(x);const k=n*l.getWorldScaleX();k>0&&(this.scaleOffset+=(C*v+S*y)*m/k)}if(d=this.remaining,d>=f){w==-1&&(w=Math.pow(this.damping,60*f));const k=this.massInverse*f,R=this.strength,Y=this.wind,F=Ei.yDown?-this.gravity:this.gravity,L=n/g;for(;;)if(d-=f,h&&(this.scaleVelocity+=(Y*v-F*y-this.scaleOffset*R)*k,this.scaleOffset+=this.scaleVelocity*f,this.scaleVelocity*=w),r){if(this.rotateVelocity-=((Y*y+F*v)*L+this.rotateOffset*R)*k,this.rotateOffset+=this.rotateVelocity*f,this.rotateVelocity*=w,d<f)break;const I=this.rotateOffset*A+x;v=Math.cos(I),y=Math.sin(I)}else if(d<f)break}}this.remaining=d}this.cx=l.worldX,this.cy=l.worldY;break;case 3:i&&(l.worldX+=this.xOffset*e*this.data.x),s&&(l.worldY+=this.yOffset*e*this.data.y)}if(r){let a=this.rotateOffset*e,o=0,c=0,u=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=a*this.data.rotate,o=Math.sin(d),c=Math.cos(d),u=l.b,l.b=c*u-o*l.d,l.d=o*u+c*l.d),d+=a*this.data.shearX,o=Math.sin(d),c=Math.cos(d),u=l.a,l.a=c*u-o*l.c,l.c=o*u+c*l.c}else a*=this.data.rotate,o=Math.sin(a),c=Math.cos(a),u=l.a,l.a=c*u-o*l.c,l.c=o*u+c*l.c,u=l.b,l.b=c*u-o*l.d,l.d=o*u+c*l.d}if(h){const a=1+this.scaleOffset*e*this.data.scaleX;l.a*=a,l.c*=a}t!=3&&(this.tx=n*l.a,this.ty=n*l.c),l.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,i){const s=i*P.degRad,r=Math.cos(s),h=Math.sin(s),l=this.cx-t,n=this.cy-e;this.translate(l*r-n*h-l,l*h+n*r-n)}},vs=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new V,this.darkColor=t.darkColor?new V:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&((!(t instanceof Ye)||!(this.attachment instanceof Ye)||t.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},ys=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Ce;active=!1;constructor(t,e){if(!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let r=e.findBone(t.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(r)}let i=e.findBone(t.target.name);if(!i)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=i,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){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 t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=e!=0||i!=0,n=this.target,a=n.a,o=n.b,c=n.c,u=n.d,d=a*u-o*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*d,f=this.data.offsetShearY*d,g=this.bones;for(let w=0,b=g.length;w<b;w++){let p=g[w];if(t!=0){let x=p.a,v=p.b,y=p.c,A=p.d,C=Math.atan2(c,a)-Math.atan2(y,x)+m;C>P.PI?C-=P.PI2:C<-P.PI&&(C+=P.PI2),C*=t;let S=Math.cos(C),k=Math.sin(C);p.a=S*x-k*y,p.b=S*v-k*A,p.c=k*x+S*y,p.d=k*v+S*A}if(l){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(x.x-p.worldX)*e,p.worldY+=(x.y-p.worldY)*i}if(s!=0){let x=Math.sqrt(p.a*p.a+p.c*p.c);x!=0&&(x=(x+(Math.sqrt(a*a+c*c)-x+this.data.offsetScaleX)*s)/x),p.a*=x,p.c*=x}if(r!=0){let x=Math.sqrt(p.b*p.b+p.d*p.d);x!=0&&(x=(x+(Math.sqrt(o*o+u*u)-x+this.data.offsetScaleY)*r)/x),p.b*=x,p.d*=x}if(h>0){let x=p.b,v=p.d,y=Math.atan2(v,x),A=Math.atan2(u,o)-Math.atan2(c,a)-(y-Math.atan2(p.c,p.a));A>P.PI?A-=P.PI2:A<-P.PI&&(A+=P.PI2),A=y+(A+f)*h;let C=Math.sqrt(x*x+v*v);p.b=Math.cos(A)*C,p.d=Math.sin(A)*C}p.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=e!=0||i!=0,n=this.target,a=n.a,o=n.b,c=n.c,u=n.d,d=a*u-o*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*d,f=this.data.offsetShearY*d,g=this.bones;for(let w=0,b=g.length;w<b;w++){let p=g[w];if(t!=0){let x=p.a,v=p.b,y=p.c,A=p.d,C=Math.atan2(c,a)+m;C>P.PI?C-=P.PI2:C<-P.PI&&(C+=P.PI2),C*=t;let S=Math.cos(C),k=Math.sin(C);p.a=S*x-k*y,p.b=S*v-k*A,p.c=k*x+S*y,p.d=k*v+S*A}if(l){let x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),p.worldX+=x.x*e,p.worldY+=x.y*i}if(s!=0){let x=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*s+1;p.a*=x,p.c*=x}if(r!=0){let x=(Math.sqrt(o*o+u*u)-1+this.data.offsetScaleY)*r+1;p.b*=x,p.d*=x}if(h>0){let x=Math.atan2(u,o)-Math.atan2(c,a);x>P.PI?x-=P.PI2:x<-P.PI&&(x+=P.PI2);let v=p.b,y=p.d;x=Math.atan2(y,v)+(x-P.PI/2+f)*h;let A=Math.sqrt(v*v+y*y);p.b=Math.cos(x)*A,p.d=Math.sin(x)*A}p.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=this.target,n=this.bones;for(let a=0,o=n.length;a<o;a++){let c=n[a],u=c.arotation;t!=0&&(u+=(l.arotation-u+this.data.offsetRotation)*t);let d=c.ax,m=c.ay;d+=(l.ax-d+this.data.offsetX)*e,m+=(l.ay-m+this.data.offsetY)*i;let f=c.ascaleX,g=c.ascaleY;s!=0&&f!=0&&(f=(f+(l.ascaleX-f+this.data.offsetScaleX)*s)/f),r!=0&&g!=0&&(g=(g+(l.ascaleY-g+this.data.offsetScaleY)*r)/g);let w=c.ashearY;h!=0&&(w+=(l.ashearY-w+this.data.offsetShearY)*h),c.updateWorldTransformWith(d,m,u,f,g,c.ashearX,w)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,i=this.mixY,s=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=this.target,n=this.bones;for(let a=0,o=n.length;a<o;a++){let c=n[a],u=c.arotation+(l.arotation+this.data.offsetRotation)*t,d=c.ax+(l.ax+this.data.offsetX)*e,m=c.ay+(l.ay+this.data.offsetY)*i,f=c.ascaleX*((l.ascaleX-1+this.data.offsetScaleX)*s+1),g=c.ascaleY*((l.ascaleY-1+this.data.offsetScaleY)*r+1),w=c.ashearY+(l.ashearY+this.data.offsetShearY)*h;c.updateWorldTransformWith(d,m,u,f,g,c.ashearX,w)}}},Ei=class _i{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;data;bones;slots;drawOrder;ikConstraints;transformConstraints;pathConstraints;physicsConstraints;_updateCache=new Array;skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return _i.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let s=e.bones[i],r;if(!s.parent)r=new xi(s,this,null);else{let h=this.bones[s.parent.index];r=new xi(s,this,h),h.children.push(r)}this.bones.push(r)}this.slots=new Array,this.drawOrder=new Array;for(let i=0;i<e.slots.length;i++){let s=e.slots[i],r=this.bones[s.boneData.index],h=new vs(s,r);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(let i=0;i<e.ikConstraints.length;i++){let s=e.ikConstraints[i];this.ikConstraints.push(new xs(s,this))}this.transformConstraints=new Array;for(let i=0;i<e.transformConstraints.length;i++){let s=e.transformConstraints[i];this.transformConstraints.push(new ys(s,this))}this.pathConstraints=new Array;for(let i=0;i<e.pathConstraints.length;i++){let s=e.pathConstraints[i];this.pathConstraints.push(new bs(s,this))}this.physicsConstraints=new Array;for(let i=0;i<e.physicsConstraints.length;i++){let s=e.physicsConstraints[i];this.physicsConstraints.push(new xr(s,this))}this.color=new V(1,1,1,1),this.updateCache()}updateCache(){let e=this._updateCache;e.length=0;let i=this.bones;for(let d=0,m=i.length;d<m;d++){let f=i[d];f.sorted=f.data.skinRequired,f.active=!f.sorted}if(this.skin){let d=this.skin.bones;for(let m=0,f=this.skin.bones.length;m<f;m++){let g=this.bones[d[m].index];do g.sorted=!1,g.active=!0,g=g.parent;while(g)}}let s=this.ikConstraints,r=this.transformConstraints,h=this.pathConstraints,l=this.physicsConstraints,n=s.length,a=r.length,o=h.length,c=this.physicsConstraints.length,u=n+a+o+c;e:for(let d=0;d<u;d++){for(let m=0;m<n;m++){let f=s[m];if(f.data.order==d){this.sortIkConstraint(f);continue e}}for(let m=0;m<a;m++){let f=r[m];if(f.data.order==d){this.sortTransformConstraint(f);continue e}}for(let m=0;m<o;m++){let f=h[m];if(f.data.order==d){this.sortPathConstraint(f);continue e}}for(let m=0;m<c;m++){const f=l[m];if(f.data.order==d){this.sortPhysicsConstraint(f);continue e}}}for(let d=0,m=i.length;d<m;d++)this.sortBone(i[d])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;let i=e.target;this.sortBone(i);let s=e.bones,r=s[0];if(this.sortBone(r),s.length==1)this._updateCache.push(e),this.sortReset(r.children);else{let h=s[s.length-1];this.sortBone(h),this._updateCache.push(e),this.sortReset(r.children),h.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;let i=e.target,s=i.data.index,r=i.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,r),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,r);for(let a=0,o=this.data.skins.length;a<o;a++)this.sortPathConstraintAttachment(this.data.skins[a],s,r);let h=i.getAttachment();h instanceof He&&this.sortPathConstraintAttachmentWith(h,r);let l=e.bones,n=l.length;for(let a=0;a<n;a++)this.sortBone(l[a]);this._updateCache.push(e);for(let a=0;a<n;a++)this.sortReset(l[a].children);for(let a=0;a<n;a++)l[a].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&X.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let i=e.bones,s=i.length;if(e.data.local)for(let r=0;r<s;r++){let h=i[r];this.sortBone(h.parent),this.sortBone(h)}else for(let r=0;r<s;r++)this.sortBone(i[r]);this._updateCache.push(e);for(let r=0;r<s;r++)this.sortReset(i[r].children);for(let r=0;r<s;r++)i[r].sorted=!0}sortPathConstraintAttachment(e,i,s){let r=e.attachments[i];if(r)for(let h in r)this.sortPathConstraintAttachmentWith(r[h],s)}sortPathConstraintAttachmentWith(e,i){if(!(e instanceof He))return;let s=e.bones;if(!s)this.sortBone(i);else{let r=this.bones;for(let h=0,l=s.length;h<l;){let n=s[h++];for(n+=h;h<n;)this.sortBone(r[s[h++]])}}}sortPhysicsConstraint(e){const i=e.bone;e.active=i.active&&(!e.data.skinRequired||this.skin!=null&&X.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(i),this._updateCache.push(e),this.sortReset(i.children),i.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let i=e.parent;i&&this.sortBone(i),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let i=0,s=e.length;i<s;i++){let r=e[i];r.active&&(r.sorted&&this.sortReset(r.children),r.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let i=this.bones;for(let r=0,h=i.length;r<h;r++){let l=i[r];l.ax=l.x,l.ay=l.y,l.arotation=l.rotation,l.ascaleX=l.scaleX,l.ascaleY=l.scaleY,l.ashearX=l.shearX,l.ashearY=l.shearY}let s=this._updateCache;for(let r=0,h=s.length;r<h;r++)s[r].update(e)}updateWorldTransformWith(e,i){if(!i)throw new Error("parent cannot be null.");let s=this.bones;for(let w=1,b=s.length;w<b;w++){let p=s[w];p.ax=p.x,p.ay=p.y,p.arotation=p.rotation,p.ascaleX=p.scaleX,p.ascaleY=p.scaleY,p.ashearX=p.shearX,p.ashearY=p.shearY}let r=this.getRootBone();if(!r)throw new Error("Root bone must not be null.");let h=i.a,l=i.b,n=i.c,a=i.d;r.worldX=h*this.x+l*this.y+i.worldX,r.worldY=n*this.x+a*this.y+i.worldY;const o=(r.rotation+r.shearX)*P.degRad,c=(r.rotation+90+r.shearY)*P.degRad,u=Math.cos(o)*r.scaleX,d=Math.cos(c)*r.scaleY,m=Math.sin(o)*r.scaleX,f=Math.sin(c)*r.scaleY;r.a=(h*u+l*m)*this.scaleX,r.b=(h*d+l*f)*this.scaleX,r.c=(n*u+a*m)*this.scaleY,r.d=(n*d+a*f)*this.scaleY;let g=this._updateCache;for(let w=0,b=g.length;w<b;w++){let p=g[w];p!=r&&p.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;X.arrayCopy(e,0,this.drawOrder,0,e.length);for(let i=0,s=e.length;i<s;i++)e[i].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let i=this.bones;for(let s=0,r=i.length;s<r;s++){let h=i[s];if(h.data.name==e)return h}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let s=0,r=i.length;s<r;s++){let h=i[s];if(h.data.name==e)return h}return null}setSkinByName(e){let i=this.data.findSkin(e);if(!i)throw new Error("Skin not found: "+e);this.setSkin(i)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let i=this.slots;for(let s=0,r=i.length;s<r;s++){let h=i[s],l=h.data.attachmentName;if(l){let n=e.getAttachment(s,l);n&&h.setAttachment(n)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,i){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,i)}getAttachment(e,i){if(!i)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,i);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,i):null}setAttachment(e,i){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let r=0,h=s.length;r<h;r++){let l=s[r];if(l.data.name==e){let n=null;if(i&&(n=this.getAttachment(r,i),!n))throw new Error("Attachment not found: "+i+", for slot: "+e);l.setAttachment(n);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(i=>i.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(i=>i.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(i=>i.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(i=>i.data.name==e)??null}getBoundsRect(e){let i=new Ce,s=new Ce;return this.getBounds(i,s,void 0,e),{x:i.x,y:i.y,width:s.x,height:s.y}}getBounds(e,i,s=new Array(2),r=null){if(!e)throw new Error("offset cannot be null.");if(!i)throw new Error("size cannot be null.");let h=this.drawOrder,l=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let c=0,u=h.length;c<u;c++){let d=h[c];if(!d.bone.active)continue;let m=0,f=null,g=null,w=d.getAttachment();if(w instanceof it)m=8,f=X.setArraySize(s,m,0),w.computeWorldVertices(d,f,0,2),g=_i.quadTriangles;else if(w instanceof Ge){let b=w;m=b.worldVerticesLength,f=X.setArraySize(s,m,0),b.computeWorldVertices(d,0,m,f,0,2),g=b.triangles}else if(w instanceof tt&&r!=null){r.clipStart(d,w);continue}if(f&&g){r!=null&&r.isClipping()&&(r.clipTriangles(f,g,g.length),f=r.clippedVertices,m=r.clippedVertices.length);for(let b=0,p=f.length;b<p;b+=2){let x=f[b],v=f[b+1];l=Math.min(l,x),n=Math.min(n,v),a=Math.max(a,x),o=Math.max(o,v)}}r?.clipEndWithSlot(d)}r?.clipEnd(),e.set(l,n),i.set(a-l,o-n)}update(e){this.time+=e}physicsTranslate(e,i){const s=this.physicsConstraints;for(let r=0,h=s.length;r<h;r++)s[r].translate(e,i)}physicsRotate(e,i,s){const r=this.physicsConstraints;for(let h=0,l=r.length;h<l;h++)r[h].rotate(e,i,s)}},As=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(As||{}),Cs=class extends st{_bone=null;set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(t){super(t,0,!1)}},Ii=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let i=0,s=e.length;i<s;i++){let r=e[i];if(r.name==t)return r}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let i=0,s=e.length;i<s;i++){let r=e[i];if(r.name==t)return r}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let i=0,s=e.length;i<s;i++){let r=e[i];if(r.name==t)return r}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let i=0,s=e.length;i<s;i++){let r=e[i];if(r.name==t)return r}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let i=0,s=e.length;i<s;i++){let r=e[i];if(r.name==t)return r}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let i=0,s=e.length;i<s;i++){const r=e[i];if(r.name==t)return r}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let i=0,s=e.length;i<s;i++){const r=e[i];if(r.name==t)return r}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let i=0,s=e.length;i<s;i++){const r=e[i];if(r.name==t)return r}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let i=0,s=e.length;i<s;i++){const r=e[i];if(r.name==t)return r}return null}},Mi=class{constructor(t=0,e,i){this.slotIndex=t,this.name=e,this.attachment=i}},pt=class{name;attachments=new Array;bones=Array();constraints=new Array;color=new V(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,i){if(!i)throw new Error("attachment cannot be null.");let s=this.attachments;t>=s.length&&(s.length=t+1),s[t]||(s[t]={}),s[t][e]=i}addSkin(t){for(let s=0;s<t.bones.length;s++){let r=t.bones[s],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==r){h=!0;break}h||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){let r=t.constraints[s],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==r){h=!0;break}h||this.constraints.push(r)}let e=t.getAttachments();for(let s=0;s<e.length;s++){var i=e[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){let r=t.bones[s],h=!1;for(let l=0;l<this.bones.length;l++)if(this.bones[l]==r){h=!0;break}h||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){let r=t.constraints[s],h=!1;for(let l=0;l<this.constraints.length;l++)if(this.constraints[l]==r){h=!0;break}h||this.constraints.push(r)}let e=t.getAttachments();for(let s=0;s<e.length;s++){var i=e[s];i.attachment&&(i.attachment instanceof Ge?(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(t,e){let i=this.attachments[t];return i?i[e]:null}removeAttachment(t,e){let i=this.attachments[t];i&&delete i[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let i=this.attachments[e];if(i)for(let s in i){let r=i[s];r&&t.push(new Mi(e,s,r))}}return t}getAttachmentsForSlot(t,e){let i=this.attachments[t];if(i)for(let s in i){let r=i[s];r&&e.push(new Mi(t,s,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let i=0;for(let s=0;s<t.slots.length;s++){let r=t.slots[s],h=r.getAttachment();if(h&&i<e.attachments.length){let l=e.attachments[i];for(let n in l){let a=l[n];if(h==a){let o=this.getAttachment(i,n);o&&r.setAttachment(o);break}}}i++}}},Ri=class{index=0;name;boneData;color=new V(1,1,1,1);darkColor=null;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,i){if(t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!i)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=i}},Yi=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Yi||{}),Fi=class extends st{bones=new Array;_target=null;set target(t){this._target=t}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(t){super(t,0,!1)}},Ss=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,i=new Ii;i.name="";let s=new Ts(t),r=s.readInt32(),h=s.readInt32();i.hash=h==0&&r==0?null:h.toString(16)+r.toString(16),i.version=s.readString(),i.x=s.readFloat(),i.y=s.readFloat(),i.width=s.readFloat(),i.height=s.readFloat(),i.referenceScale=s.readFloat()*e;let l=s.readBoolean();l&&(i.fps=s.readFloat(),i.imagesPath=s.readString(),i.audioPath=s.readString());let n=0;n=s.readInt(!0);for(let o=0;o<n;o++){let c=s.readString();if(!c)throw new Error("String in string table must not be null.");s.strings.push(c)}n=s.readInt(!0);for(let o=0;o<n;o++){let c=s.readString();if(!c)throw new Error("Bone name must not be null.");let u=o==0?null:i.bones[s.readInt(!0)],d=new wi(o,c,u);d.rotation=s.readFloat(),d.x=s.readFloat()*e,d.y=s.readFloat()*e,d.scaleX=s.readFloat(),d.scaleY=s.readFloat(),d.shearX=s.readFloat(),d.shearY=s.readFloat(),d.length=s.readFloat()*e,d.inherit=s.readByte(),d.skinRequired=s.readBoolean(),l&&(V.rgba8888ToColor(d.color,s.readInt32()),d.icon=s.readString()??void 0,d.visible=s.readBoolean()),i.bones.push(d)}n=s.readInt(!0);for(let o=0;o<n;o++){let c=s.readString();if(!c)throw new Error("Slot name must not be null.");let u=i.bones[s.readInt(!0)],d=new Ri(o,c,u);V.rgba8888ToColor(d.color,s.readInt32());let m=s.readInt32();m!=-1&&V.rgb888ToColor(d.darkColor=new V,m),d.attachmentName=s.readStringRef(),d.blendMode=s.readInt(!0),l&&(d.visible=s.readBoolean()),i.slots.push(d)}n=s.readInt(!0);for(let o=0,c;o<n;o++){let u=s.readString();if(!u)throw new Error("IK constraint data name must not be null.");let d=new Ai(u);d.order=s.readInt(!0),c=s.readInt(!0);for(let f=0;f<c;f++)d.bones.push(i.bones[s.readInt(!0)]);d.target=i.bones[s.readInt(!0)];let m=s.readByte();d.skinRequired=(m&1)!=0,d.bendDirection=(m&2)!=0?1:-1,d.compress=(m&4)!=0,d.stretch=(m&8)!=0,d.uniform=(m&16)!=0,(m&32)!=0&&(d.mix=(m&64)!=0?s.readFloat():1),(m&128)!=0&&(d.softness=s.readFloat()*e),i.ikConstraints.push(d)}n=s.readInt(!0);for(let o=0,c;o<n;o++){let u=s.readString();if(!u)throw new Error("Transform constraint data name must not be null.");let d=new Fi(u);d.order=s.readInt(!0),c=s.readInt(!0);for(let f=0;f<c;f++)d.bones.push(i.bones[s.readInt(!0)]);d.target=i.bones[s.readInt(!0)];let m=s.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=s.readFloat()),(m&16)!=0&&(d.offsetX=s.readFloat()*e),(m&32)!=0&&(d.offsetY=s.readFloat()*e),(m&64)!=0&&(d.offsetScaleX=s.readFloat()),(m&128)!=0&&(d.offsetScaleY=s.readFloat()),m=s.readByte(),(m&1)!=0&&(d.offsetShearY=s.readFloat()),(m&2)!=0&&(d.mixRotate=s.readFloat()),(m&4)!=0&&(d.mixX=s.readFloat()),(m&8)!=0&&(d.mixY=s.readFloat()),(m&16)!=0&&(d.mixScaleX=s.readFloat()),(m&32)!=0&&(d.mixScaleY=s.readFloat()),(m&64)!=0&&(d.mixShearY=s.readFloat()),i.transformConstraints.push(d)}n=s.readInt(!0);for(let o=0,c;o<n;o++){let u=s.readString();if(!u)throw new Error("Path constraint data name must not be null.");let d=new Ci(u);d.order=s.readInt(!0),d.skinRequired=s.readBoolean(),c=s.readInt(!0);for(let f=0;f<c;f++)d.bones.push(i.bones[s.readInt(!0)]);d.target=i.slots[s.readInt(!0)];const m=s.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=s.readFloat()),d.position=s.readFloat(),d.positionMode==0&&(d.position*=e),d.spacing=s.readFloat(),(d.spacingMode==0||d.spacingMode==1)&&(d.spacing*=e),d.mixRotate=s.readFloat(),d.mixX=s.readFloat(),d.mixY=s.readFloat(),i.pathConstraints.push(d)}n=s.readInt(!0);for(let o=0,c;o<n;o++){const u=s.readString();if(!u)throw new Error("Physics constraint data name must not be null.");const d=new Cs(u);d.order=s.readInt(!0),d.bone=i.bones[s.readInt(!0)];let m=s.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=s.readFloat()),(m&4)!=0&&(d.y=s.readFloat()),(m&8)!=0&&(d.rotate=s.readFloat()),(m&16)!=0&&(d.scaleX=s.readFloat()),(m&32)!=0&&(d.shearX=s.readFloat()),d.limit=((m&64)!=0?s.readFloat():5e3)*e,d.step=1/s.readUnsignedByte(),d.inertia=s.readFloat(),d.strength=s.readFloat(),d.damping=s.readFloat(),d.massInverse=(m&128)!=0?s.readFloat():1,d.wind=s.readFloat(),d.gravity=s.readFloat(),m=s.readByte(),(m&1)!=0&&(d.inertiaGlobal=!0),(m&2)!=0&&(d.strengthGlobal=!0),(m&4)!=0&&(d.dampingGlobal=!0),(m&8)!=0&&(d.massGlobal=!0),(m&16)!=0&&(d.windGlobal=!0),(m&32)!=0&&(d.gravityGlobal=!0),(m&64)!=0&&(d.mixGlobal=!0),d.mix=(m&128)!=0?s.readFloat():1,i.physicsConstraints.push(d)}let a=this.readSkin(s,i,!0,l);a&&(i.defaultSkin=a,i.skins.push(a));{let o=i.skins.length;for(X.setArraySize(i.skins,n=o+s.readInt(!0));o<n;o++){let c=this.readSkin(s,i,!1,l);if(!c)throw new Error("readSkin() should not have returned null.");i.skins[o]=c}}n=this.linkedMeshes.length;for(let o=0;o<n;o++){let c=this.linkedMeshes[o];const u=i.skins[c.skinIndex];if(!c.parent)throw new Error("Linked mesh parent must not be null");let d=u.getAttachment(c.slotIndex,c.parent);if(!d)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?d:c.mesh,c.mesh.setParentMesh(d),c.mesh.region!=null&&c.mesh.updateRegion()}this.linkedMeshes.length=0,n=s.readInt(!0);for(let o=0;o<n;o++){let c=s.readString();if(!c)throw new Error("Event data name must not be null");let u=new yi(c);u.intValue=s.readInt(!1),u.floatValue=s.readFloat(),u.stringValue=s.readString(),u.audioPath=s.readString(),u.audioPath&&(u.volume=s.readFloat(),u.balance=s.readFloat()),i.events.push(u)}n=s.readInt(!0);for(let o=0;o<n;o++){let c=s.readString();if(!c)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(s,c,i))}return i}readSkin(t,e,i,s){let r=null,h=0;if(i){if(h=t.readInt(!0),h==0)return null;r=new pt("default")}else{let l=t.readString();if(!l)throw new Error("Skin name must not be null.");r=new pt(l),s&&V.rgba8888ToColor(r.color,t.readInt32()),r.bones.length=t.readInt(!0);for(let n=0,a=r.bones.length;n<a;n++)r.bones[n]=e.bones[t.readInt(!0)];for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let n=0,a=t.readInt(!0);n<a;n++)r.constraints.push(e.physicsConstraints[t.readInt(!0)]);h=t.readInt(!0)}for(let l=0;l<h;l++){let n=t.readInt(!0);for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");let u=this.readAttachment(t,e,r,n,c,s);u&&r.setAttachment(n,c,u)}}return r}readAttachment(t,e,i,s,r,h){let l=this.scale,n=t.readByte();const a=(n&8)!=0?t.readStringRef():r;if(!a)throw new Error("Attachment name must not be null");switch(n&7){case 0:{let o=(n&16)!=0?t.readStringRef():null;const c=(n&32)!=0?t.readInt32():4294967295,u=(n&64)!=0?this.readSequence(t):null;let d=(n&128)!=0?t.readFloat():0,m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat();o||(o=a);let x=this.attachmentLoader.newRegionAttachment(i,a,o,u);return x?(x.path=o,x.x=m*l,x.y=f*l,x.scaleX=g,x.scaleY=w,x.rotation=d,x.width=b*l,x.height=p*l,V.rgba8888ToColor(x.color,c),x.sequence=u,u==null&&x.updateRegion(),x):null}case 1:{let o=this.readVertices(t,(n&16)!=0),c=h?t.readInt32():0,u=this.attachmentLoader.newBoundingBoxAttachment(i,a);return u?(u.worldVerticesLength=o.length,u.vertices=o.vertices,u.bones=o.bones,h&&V.rgba8888ToColor(u.color,c),u):null}case 2:{let o=(n&16)!=0?t.readStringRef():a;const c=(n&32)!=0?t.readInt32():4294967295,u=(n&64)!=0?this.readSequence(t):null,d=t.readInt(!0),m=this.readVertices(t,(n&128)!=0),f=this.readFloatArray(t,m.length,1),g=this.readShortArray(t,(m.length-d-2)*3);let w=[],b=0,p=0;h&&(w=this.readShortArray(t,t.readInt(!0)),b=t.readFloat(),p=t.readFloat()),o||(o=a);let x=this.attachmentLoader.newMeshAttachment(i,a,o,u);return x?(x.path=o,V.rgba8888ToColor(x.color,c),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=g,x.regionUVs=f,u==null&&x.updateRegion(),x.hullLength=d<<1,x.sequence=u,h&&(x.edges=w,x.width=b*l,x.height=p*l),x):null}case 3:{const o=(n&16)!=0?t.readStringRef():a;if(o==null)throw new Error("Path of linked mesh must not be null");const c=(n&32)!=0?t.readInt32():4294967295,u=(n&64)!=0?this.readSequence(t):null,d=(n&128)!=0,m=t.readInt(!0),f=t.readStringRef();let g=0,w=0;h&&(g=t.readFloat(),w=t.readFloat());let b=this.attachmentLoader.newMeshAttachment(i,a,o,u);return b?(b.path=o,V.rgba8888ToColor(b.color,c),b.sequence=u,h&&(b.width=g*l,b.height=w*l),this.linkedMeshes.push(new br(b,m,s,f,d)),b):null}case 4:{const o=(n&16)!=0,c=(n&32)!=0,u=this.readVertices(t,(n&64)!=0),d=X.newArray(u.length/6,0);for(let g=0,w=d.length;g<w;g++)d[g]=t.readFloat()*l;const m=h?t.readInt32():0,f=this.attachmentLoader.newPathAttachment(i,a);return f?(f.closed=o,f.constantSpeed=c,f.worldVerticesLength=u.length,f.vertices=u.vertices,f.bones=u.bones,f.lengths=d,h&&V.rgba8888ToColor(f.color,m),f):null}case 5:{const o=t.readFloat(),c=t.readFloat(),u=t.readFloat(),d=h?t.readInt32():0,m=this.attachmentLoader.newPointAttachment(i,a);return m?(m.x=c*l,m.y=u*l,m.rotation=o,h&&V.rgba8888ToColor(m.color,d),m):null}case 6:{const o=t.readInt(!0),c=this.readVertices(t,(n&16)!=0);let u=h?t.readInt32():0,d=this.attachmentLoader.newClippingAttachment(i,a);return d?(d.endSlot=e.slots[o],d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,h&&V.rgba8888ToColor(d.color,u),d):null}}return null}readSequence(t){let e=new $i(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const i=this.scale,s=t.readInt(!0),r=new vr;if(r.length=s<<1,!e)return r.vertices=this.readFloatArray(t,r.length,i),r;let h=new Array,l=new Array;for(let n=0;n<s;n++){let a=t.readInt(!0);l.push(a);for(let o=0;o<a;o++)l.push(t.readInt(!0)),h.push(t.readFloat()*i),h.push(t.readFloat()*i),h.push(t.readFloat())}return r.vertices=X.toFloatArray(h),r.bones=l,r}readFloatArray(t,e,i){let s=new Array(e);if(i==1)for(let r=0;r<e;r++)s[r]=t.readFloat();else for(let r=0;r<e;r++)s[r]=t.readFloat()*i;return s}readShortArray(t,e){let i=new Array(e);for(let s=0;s<e;s++)i[s]=t.readInt(!0);return i}readAnimation(t,e,i){t.readInt(!0);let s=new Array,r=this.scale;for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0);for(let u=0,d=t.readInt(!0);u<d;u++){let m=t.readByte(),f=t.readInt(!0),g=f-1;switch(m){case Fr:{let w=new Ne(f,c);for(let b=0;b<f;b++)w.setFrame(b,t.readFloat(),t.readStringRef());s.push(w);break}case Lr:{let w=t.readInt(!0),b=new qt(f,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let C=0,S=0;b.setFrame(C,p,x,v,y,A),C!=g;C++){let k=t.readFloat(),R=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;switch(t.readByte()){case Fe:b.setStepped(C);break;case Le:ae(t,b,S++,C,0,p,k,x,R,1),ae(t,b,S++,C,1,p,k,v,Y,1),ae(t,b,S++,C,2,p,k,y,F,1),ae(t,b,S++,C,3,p,k,A,L,1)}p=k,x=R,v=Y,y=F,A=L}s.push(b);break}case Pr:{let w=t.readInt(!0),b=new Gt(f,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255;for(let A=0,C=0;b.setFrame(A,p,x,v,y),A!=g;A++){let S=t.readFloat(),k=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255;switch(t.readByte()){case Fe:b.setStepped(A);break;case Le:ae(t,b,C++,A,0,p,S,x,k,1),ae(t,b,C++,A,1,p,S,v,R,1),ae(t,b,C++,A,2,p,S,y,Y,1)}p=S,x=k,v=R,y=Y}s.push(b);break}case Xr:{let w=t.readInt(!0),b=new _t(f,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let R=0,Y=0;b.setFrame(R,p,x,v,y,A,C,S,k),R!=g;R++){let F=t.readFloat(),L=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,ie=t.readUnsignedByte()/255,te=t.readUnsignedByte()/255,re=t.readUnsignedByte()/255;switch(t.readByte()){case Fe:b.setStepped(R);break;case Le:ae(t,b,Y++,R,0,p,F,x,L,1),ae(t,b,Y++,R,1,p,F,v,I,1),ae(t,b,Y++,R,2,p,F,y,M,1),ae(t,b,Y++,R,3,p,F,A,B,1),ae(t,b,Y++,R,4,p,F,C,ie,1),ae(t,b,Y++,R,5,p,F,S,te,1),ae(t,b,Y++,R,6,p,F,k,re,1)}p=F,x=L,v=I,y=M,A=B,C=ie,S=te,k=re}s.push(b);break}case Br:{let w=t.readInt(!0),b=new jt(f,w,c),p=t.readFloat(),x=t.readUnsignedByte()/255,v=t.readUnsignedByte()/255,y=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,S=t.readUnsignedByte()/255;for(let k=0,R=0;b.setFrame(k,p,x,v,y,A,C,S),k!=g;k++){let Y=t.readFloat(),F=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,B=t.readUnsignedByte()/255,ie=t.readUnsignedByte()/255;switch(t.readByte()){case Fe:b.setStepped(k);break;case Le:ae(t,b,R++,k,0,p,Y,x,F,1),ae(t,b,R++,k,1,p,Y,v,L,1),ae(t,b,R++,k,2,p,Y,y,I,1),ae(t,b,R++,k,3,p,Y,A,M,1),ae(t,b,R++,k,4,p,Y,C,B,1),ae(t,b,R++,k,5,p,Y,S,ie,1)}p=Y,x=F,v=L,y=I,A=M,C=B,S=ie}s.push(b);break}case Vr:{let w=new Ht(f,t.readInt(!0),c),b=t.readFloat(),p=t.readUnsignedByte()/255;for(let x=0,v=0;w.setFrame(x,b,p),x!=g;x++){let y=t.readFloat(),A=t.readUnsignedByte()/255;switch(t.readByte()){case Fe:w.setStepped(x);break;case Le:ae(t,w,v++,x,0,b,y,p,A,1)}b=y,p=A}s.push(w)}}}}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0);for(let u=0,d=t.readInt(!0);u<d;u++){let m=t.readByte(),f=t.readInt(!0);if(m==Yr){let w=new zt(f,c);for(let b=0;b<f;b++)w.setFrame(b,t.readFloat(),t.readByte());s.push(w);continue}let g=t.readInt(!0);switch(m){case yr:s.push(pe(t,new et(f,g,c),1));break;case Ar:s.push(Li(t,new Pt(f,g,c),r));break;case Cr:s.push(pe(t,new Xt(f,g,c),r));break;case Sr:s.push(pe(t,new Bt(f,g,c),r));break;case Tr:s.push(Li(t,new Vt(f,g,c),1));break;case kr:s.push(pe(t,new Ot(f,g,c),1));break;case Er:s.push(pe(t,new Dt(f,g,c),1));break;case Ir:s.push(Li(t,new Nt(f,g,c),1));break;case Mr:s.push(pe(t,new Ut(f,g,c),1));break;case Rr:s.push(pe(t,new Wt(f,g,c),1))}}}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0),u=t.readInt(!0),d=u-1,m=new Jt(u,t.readInt(!0),c),f=t.readByte(),g=t.readFloat(),w=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,b=(f&4)!=0?t.readFloat()*r:0;for(let p=0,x=0;m.setFrame(p,g,w,b,(f&8)!=0?1:-1,(f&16)!=0,(f&32)!=0),p!=d;p++){f=t.readByte();const v=t.readFloat(),y=(f&1)!=0?(f&2)!=0?t.readFloat():1:0,A=(f&4)!=0?t.readFloat()*r:0;(f&64)!=0?m.setStepped(p):(f&128)!=0&&(ae(t,m,x++,p,0,g,v,w,y,1),ae(t,m,x++,p,1,g,v,b,A,r)),g=v,w=y,b=A}s.push(m)}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0),u=t.readInt(!0),d=u-1,m=new Kt(u,t.readInt(!0),c),f=t.readFloat(),g=t.readFloat(),w=t.readFloat(),b=t.readFloat(),p=t.readFloat(),x=t.readFloat(),v=t.readFloat();for(let y=0,A=0;m.setFrame(y,f,g,w,b,p,x,v),y!=d;y++){let C=t.readFloat(),S=t.readFloat(),k=t.readFloat(),R=t.readFloat(),Y=t.readFloat(),F=t.readFloat(),L=t.readFloat();switch(t.readByte()){case Fe:m.setStepped(y);break;case Le:ae(t,m,A++,y,0,f,C,g,S,1),ae(t,m,A++,y,1,f,C,w,k,1),ae(t,m,A++,y,2,f,C,b,R,1),ae(t,m,A++,y,3,f,C,p,Y,1),ae(t,m,A++,y,4,f,C,x,F,1),ae(t,m,A++,y,5,f,C,v,L,1)}f=C,g=S,w=k,b=R,p=Y,x=F,v=L}s.push(m)}for(let a=0,o=t.readInt(!0);a<o;a++){let c=t.readInt(!0),u=i.pathConstraints[c];for(let d=0,m=t.readInt(!0);d<m;d++){const f=t.readByte(),g=t.readInt(!0),w=t.readInt(!0);switch(f){case Nr:s.push(pe(t,new Qt(g,w,c),u.positionMode==0?r:1));break;case Ur:s.push(pe(t,new $t(g,w,c),u.spacingMode==0||u.spacingMode==1?r:1));break;case Wr:let b=new ei(g,w,c),p=t.readFloat(),x=t.readFloat(),v=t.readFloat(),y=t.readFloat();for(let A=0,C=0,S=b.getFrameCount()-1;b.setFrame(A,p,x,v,y),A!=S;A++){let k=t.readFloat(),R=t.readFloat(),Y=t.readFloat(),F=t.readFloat();switch(t.readByte()){case Fe:b.setStepped(A);break;case Le:ae(t,b,C++,A,0,p,k,x,R,1),ae(t,b,C++,A,1,p,k,v,Y,1),ae(t,b,C++,A,2,p,k,y,F,1)}p=k,x=R,v=Y,y=F}s.push(b)}}}for(let a=0,o=t.readInt(!0);a<o;a++){const c=t.readInt(!0)-1;for(let u=0,d=t.readInt(!0);u<d;u++){const m=t.readByte(),f=t.readInt(!0);if(m==Jr){const w=new oi(f,c);for(let b=0;b<f;b++)w.setFrame(b,t.readFloat());s.push(w);continue}const g=t.readInt(!0);switch(m){case zr:s.push(pe(t,new ti(f,g,c),1));break;case qr:s.push(pe(t,new ii(f,g,c),1));break;case Gr:s.push(pe(t,new si(f,g,c),1));break;case Hr:s.push(pe(t,new ri(f,g,c),1));break;case _r:s.push(pe(t,new ni(f,g,c),1));break;case jr:s.push(pe(t,new ai(f,g,c),1));break;case Zr:s.push(pe(t,new li(f,g,c),1))}}}for(let a=0,o=t.readInt(!0);a<o;a++){let c=i.skins[t.readInt(!0)];for(let u=0,d=t.readInt(!0);u<d;u++){let m=t.readInt(!0);for(let f=0,g=t.readInt(!0);f<g;f++){let w=t.readStringRef();if(!w)throw new Error("attachmentName must not be null.");let b=c.getAttachment(m,w),p=t.readByte(),x=t.readInt(!0),v=x-1;switch(p){case Or:{let y=b,A=y.bones,C=y.vertices,S=A?C.length/3*2:C.length,k=t.readInt(!0),R=new Zt(x,k,m,y),Y=t.readFloat();for(let F=0,L=0;;F++){let I,M=t.readInt(!0);if(M==0)I=A?X.newFloatArray(S):C;else{I=X.newFloatArray(S);let ie=t.readInt(!0);if(M+=ie,r==1)for(let te=ie;te<M;te++)I[te]=t.readFloat();else for(let te=ie;te<M;te++)I[te]=t.readFloat()*r;if(!A)for(let te=0,re=I.length;te<re;te++)I[te]+=C[te]}if(R.setFrame(F,Y,I),F==v)break;let B=t.readFloat();switch(t.readByte()){case Fe:R.setStepped(F);break;case Le:ae(t,R,L++,F,0,Y,B,0,1,1)}Y=B}s.push(R);break}case Dr:{let y=new hi(x,m,b);for(let A=0;A<x;A++){let C=t.readFloat(),S=t.readInt32();y.setFrame(A,C,ts[S&15],S>>4,t.readFloat())}s.push(y);break}}}}}let h=t.readInt(!0);if(h>0){let a=new qe(h),o=i.slots.length;for(let c=0;c<h;c++){let u=t.readFloat(),d=t.readInt(!0),m=X.newArray(o,0);for(let b=o-1;b>=0;b--)m[b]=-1;let f=X.newArray(o-d,0),g=0,w=0;for(let b=0;b<d;b++){let p=t.readInt(!0);for(;g!=p;)f[w++]=g++;m[g+t.readInt(!0)]=g++}for(;g<o;)f[w++]=g++;for(let b=o-1;b>=0;b--)m[b]==-1&&(m[b]=f[--w]);a.setFrame(c,u,m)}s.push(a)}let l=t.readInt(!0);if(l>0){let a=new dt(l);for(let o=0;o<l;o++){let c=t.readFloat(),u=i.events[t.readInt(!0)],d=new vi(c,u);d.intValue=t.readInt(!1),d.floatValue=t.readFloat(),d.stringValue=t.readString(),d.stringValue==null&&(d.stringValue=u.stringValue),d.data.audioPath&&(d.volume=t.readFloat(),d.balance=t.readFloat()),a.setFrame(o,d)}s.push(a)}let n=0;for(let a=0,o=s.length;a<o;a++)n=Math.max(n,s[a].getDuration());return new ht(e,s,n)}},Ts=class{constructor(t,e=new Array,i=0,s=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=i,this.buffer=s}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),i=e&127;return(e&128)!=0&&(e=this.readByte(),i|=(e&127)<<7,(e&128)!=0&&(e=this.readByte(),i|=(e&127)<<14,(e&128)!=0&&(e=this.readByte(),i|=(e&127)<<21,(e&128)!=0&&(e=this.readByte(),i|=(e&127)<<28)))),t?i:i>>>1^-(i&1)}readStringRef(){let t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="",i=0;for(let s=0;s<t;){let r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(r),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}},br=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(t,e,i,s,r){this.mesh=t,this.skinIndex=e,this.slotIndex=i,this.parent=s,this.inheritTimeline=r}},vr=class{constructor(t=null,e=null,i=0){this.bones=t,this.vertices=e,this.length=i}};function pe(t,e,i){let s=t.readFloat(),r=t.readFloat()*i;for(let h=0,l=0,n=e.getFrameCount()-1;e.setFrame(h,s,r),h!=n;h++){let a=t.readFloat(),o=t.readFloat()*i;switch(t.readByte()){case Fe:e.setStepped(h);break;case Le:ae(t,e,l++,h,0,s,a,r,o,i)}s=a,r=o}return e}function Li(t,e,i){let s=t.readFloat(),r=t.readFloat()*i,h=t.readFloat()*i;for(let l=0,n=0,a=e.getFrameCount()-1;e.setFrame(l,s,r,h),l!=a;l++){let o=t.readFloat(),c=t.readFloat()*i,u=t.readFloat()*i;switch(t.readByte()){case Fe:e.setStepped(l);break;case Le:ae(t,e,n++,l,0,s,o,r,c,i),ae(t,e,n++,l,1,s,o,h,u,i)}s=o,r=c,h=u}return e}function ae(t,e,i,s,r,h,l,n,a,o){e.setBezier(i,s,r,h,n,t.readFloat(),t.readFloat()*o,t.readFloat(),t.readFloat()*o,l,a)}var yr=0,Ar=1,Cr=2,Sr=3,Tr=4,kr=5,Er=6,Ir=7,Mr=8,Rr=9,Yr=10,Fr=0,Lr=1,Pr=2,Xr=3,Br=4,Vr=5,Or=0,Dr=1,Nr=0,Ur=1,Wr=2,zr=0,qr=1,Gr=2,Hr=4,_r=5,jr=6,Zr=7,Jr=8,Fe=1,Le=2,ks=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new $e(()=>X.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");let i=this.boundingBoxes,s=this.polygons,r=this.polygonPool,h=t.slots,l=h.length;i.length=0,r.freeAll(s),s.length=0;for(let n=0;n<l;n++){let a=h[n];if(!a.bone.active)continue;let o=a.getAttachment();if(o instanceof fi){let c=o;i.push(c);let u=r.obtain();u.length!=c.worldVerticesLength&&(u=X.newFloatArray(c.worldVerticesLength)),s.push(u),c.computeWorldVertices(a,0,c.worldVerticesLength,u,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=this.polygons;for(let h=0,l=r.length;h<l;h++){let n=r[h],a=n;for(let o=0,c=n.length;o<c;o+=2){let u=a[o],d=a[o+1];t=Math.min(t,u),e=Math.min(e,d),i=Math.max(i,u),s=Math.max(s,d)}}this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,i,s){let r=this.minX,h=this.minY,l=this.maxX,n=this.maxY;if(t<=r&&i<=r||e<=h&&s<=h||t>=l&&i>=l||e>=n&&s>=n)return!1;let a=(s-e)/(i-t),o=a*(r-t)+e;if(o>h&&o<n||(o=a*(l-t)+e,o>h&&o<n))return!0;let c=(h-e)/a+t;return c>r&&c<l||(c=(n-e)/a+t,c>r&&c<l)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let i=this.polygons;for(let s=0,r=i.length;s<r;s++)if(this.containsPointPolygon(i[s],t,e))return this.boundingBoxes[s];return null}containsPointPolygon(t,e,i){let s=t,r=t.length,h=r-2,l=!1;for(let n=0;n<r;n+=2){let a=s[n+1],o=s[h+1];if(a<i&&o>=i||o<i&&a>=i){let c=s[n];c+(i-a)/(o-a)*(s[h]-c)<e&&(l=!l)}h=n}return l}intersectsSegment(t,e,i,s){let r=this.polygons;for(let h=0,l=r.length;h<l;h++)if(this.intersectsSegmentPolygon(r[h],t,e,i,s))return this.boundingBoxes[h];return null}intersectsSegmentPolygon(t,e,i,s,r){let h=t,l=t.length,n=e-s,a=i-r,o=e*r-i*s,c=h[l-2],u=h[l-1];for(let d=0;d<l;d+=2){let m=h[d],f=h[d+1],g=c*f-u*m,w=c-m,b=u-f,p=n*b-a*w,x=(o*w-n*g)/p;if((x>=c&&x<=m||x>=m&&x<=c)&&(x>=e&&x<=s||x>=s&&x<=e)){let v=(o*b-a*g)/p;if((v>=u&&v<=f||v>=f&&v<=u)&&(v>=i&&v<=r||v>=r&&v<=i))return!0}c=m,u=f}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return e==-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Es=class ye{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new $e(()=>new Array);polygonIndicesPool=new $e(()=>new Array);triangulate(e){let i=e,s=e.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n<s;n++)r[n]=n;let h=this.isConcaveArray;h.length=0;for(let n=0,a=s;n<a;++n)h[n]=ye.isConcave(n,s,i,r);let l=this.triangles;for(l.length=0;s>3;){let n=s-1,a=0,o=1;for(;;){e:if(!h[a]){let d=r[n]<<1,m=r[a]<<1,f=r[o]<<1,g=i[d],w=i[d+1],b=i[m],p=i[m+1],x=i[f],v=i[f+1];for(let y=(o+1)%s;y!=n;y=(y+1)%s){if(!h[y])continue;let A=r[y]<<1,C=i[A],S=i[A+1];if(ye.positiveArea(x,v,g,w,C,S)&&ye.positiveArea(g,w,b,p,C,S)&&ye.positiveArea(b,p,x,v,C,S))break e}break}if(o==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=o,o=(o+1)%s}l.push(r[(s+a-1)%s]),l.push(r[a]),l.push(r[(a+1)%s]),r.splice(a,1),h.splice(a,1),s--;let c=(s+a-1)%s,u=a==s?0:a;h[c]=ye.isConcave(c,s,i,r),h[u]=ye.isConcave(u,s,i,r)}return s==3&&(l.push(r[2]),l.push(r[0]),l.push(r[1])),l}decompose(e,i){let s=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let l=this.polygonIndicesPool.obtain();l.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,o=0;for(let c=0,u=i.length;c<u;c+=3){let d=i[c]<<1,m=i[c+1]<<1,f=i[c+2]<<1,g=s[d],w=s[d+1],b=s[m],p=s[m+1],x=s[f],v=s[f+1],y=!1;if(a==d){let A=n.length-4,C=ye.winding(n[A],n[A+1],n[A+2],n[A+3],x,v),S=ye.winding(x,v,n[0],n[1],n[2],n[3]);C==o&&S==o&&(n.push(x),n.push(v),l.push(f),y=!0)}y||(n.length>0?(r.push(n),h.push(l)):(this.polygonPool.free(n),this.polygonIndicesPool.free(l)),n=this.polygonPool.obtain(),n.length=0,n.push(g),n.push(w),n.push(b),n.push(p),n.push(x),n.push(v),l=this.polygonIndicesPool.obtain(),l.length=0,l.push(d),l.push(m),l.push(f),o=ye.winding(g,w,b,p,x,v),a=d)}n.length>0&&(r.push(n),h.push(l));for(let c=0,u=r.length;c<u;c++){if(l=h[c],l.length==0)continue;let d=l[0],m=l[l.length-1];n=r[c];let f=n.length-4,g=n[f],w=n[f+1],b=n[f+2],p=n[f+3],x=n[0],v=n[1],y=n[2],A=n[3],C=ye.winding(g,w,b,p,x,v);for(let S=0;S<u;S++){if(S==c)continue;let k=h[S];if(k.length!=3)continue;let R=k[0],Y=k[1],F=k[2],L=r[S],I=L[L.length-2],M=L[L.length-1];if(R!=d||Y!=m)continue;let B=ye.winding(g,w,b,p,I,M),ie=ye.winding(I,M,x,v,y,A);B==C&&ie==C&&(L.length=0,k.length=0,n.push(I),n.push(M),l.push(F),g=b,w=p,b=I,p=M,S=0)}}for(let c=r.length-1;c>=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),l=h[c],h.splice(c,1),this.polygonIndicesPool.free(l));return r}static isConcave(e,i,s,r){let h=r[(i+e-1)%i]<<1,l=r[e]<<1,n=r[(e+1)%i]<<1;return!this.positiveArea(s[h],s[h+1],s[l],s[l+1],s[n],s[n+1])}static positiveArea(e,i,s,r,h,l){return e*(l-r)+s*(i-l)+h*(r-i)>=0}static winding(e,i,s,r,h,l){let n=s-e,a=r-i;return h*a-l*n+n*i-e*a>=0?1:-1}},Is=class ji{triangulator=new Es;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(e,i){if(this.clipAttachment)return 0;this.clipAttachment=i;let s=i.worldVerticesLength,r=X.setArraySize(this.clippingPolygon,s);i.computeWorldVertices(e,0,s,r,0,2);let h=this.clippingPolygon;ji.makeClockwise(h);let l=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let n=0,a=l.length;n<a;n++){let o=l[n];ji.makeClockwise(o),o.push(o[0]),o.push(o[1])}return l.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,i,s,r,h,l,n,a){let o,c,u,d,m,f;typeof i=="number"?(o=s,c=r,u=h,d=l,m=n,f=a):(o=i,c=s,u=r,d=h,m=l,f=n),u&&d&&m&&typeof f=="boolean"?this.clipTrianglesRender(e,o,c,u,d,m,f):this.clipTrianglesNoRender(e,o,c)}clipTrianglesNoRender(e,i,s){let r=this.clipOutput,h=this.clippedVertices,l=this.clippedTriangles,n=this.clippingPolygons,a=n.length,o=0;h.length=0,l.length=0;for(let c=0;c<s;c+=3){let u=i[c]<<1,d=e[u],m=e[u+1];u=i[c+1]<<1;let f=e[u],g=e[u+1];u=i[c+2]<<1;let w=e[u],b=e[u+1];for(let p=0;p<a;p++){let x=h.length;if(this.clip(d,m,f,g,w,b,n[p],r)){let v=r.length;if(v==0)continue;let y=v>>1,A=this.clipOutput,C=X.setArraySize(h,x+y*2);for(let k=0;k<v;k+=2,x+=2){let R=A[k],Y=A[k+1];C[x]=R,C[x+1]=Y}x=l.length;let S=X.setArraySize(l,x+3*(y-2));y--;for(let k=1;k<y;k++,x+=3)S[x]=o,S[x+1]=o+k,S[x+2]=o+k+1;o+=y+1}else{let v=X.setArraySize(h,x+6);v[x]=d,v[x+1]=m,v[x+2]=f,v[x+3]=g,v[x+4]=w,v[x+5]=b,x=l.length;let y=X.setArraySize(l,x+3);y[x]=o,y[x+1]=o+1,y[x+2]=o+2,o+=3;break}}}}clipTrianglesRender(e,i,s,r,h,l,n){let a=this.clipOutput,o=this.clippedVertices,c=this.clippedTriangles,u=this.clippingPolygons,d=u.length,m=n?12:8,f=0;o.length=0,c.length=0;for(let g=0;g<s;g+=3){let w=i[g]<<1,b=e[w],p=e[w+1],x=r[w],v=r[w+1];w=i[g+1]<<1;let y=e[w],A=e[w+1],C=r[w],S=r[w+1];w=i[g+2]<<1;let k=e[w],R=e[w+1],Y=r[w],F=r[w+1];for(let L=0;L<d;L++){let I=o.length;if(this.clip(b,p,y,A,k,R,u[L],a)){let M=a.length;if(M==0)continue;let B=A-R,ie=k-y,te=b-k,re=R-p,ce=1/(B*te+ie*(p-R)),oe=M>>1,fe=this.clipOutput,J=X.setArraySize(o,I+oe*m);for(let he=0;he<M;he+=2,I+=m){let be=fe[he],me=fe[he+1];J[I]=be,J[I+1]=me,J[I+2]=h.r,J[I+3]=h.g,J[I+4]=h.b,J[I+5]=h.a;let we=be-k,xe=me-R,Ie=(B*we+ie*xe)*ce,Je=(re*we+te*xe)*ce,at=1-Ie-Je;J[I+6]=x*Ie+C*Je+Y*at,J[I+7]=v*Ie+S*Je+F*at,n&&(J[I+8]=l.r,J[I+9]=l.g,J[I+10]=l.b,J[I+11]=l.a)}I=c.length;let ne=X.setArraySize(c,I+3*(oe-2));oe--;for(let he=1;he<oe;he++,I+=3)ne[I]=f,ne[I+1]=f+he,ne[I+2]=f+he+1;f+=oe+1}else{let M=X.setArraySize(o,I+3*m);M[I]=b,M[I+1]=p,M[I+2]=h.r,M[I+3]=h.g,M[I+4]=h.b,M[I+5]=h.a,n?(M[I+6]=x,M[I+7]=v,M[I+8]=l.r,M[I+9]=l.g,M[I+10]=l.b,M[I+11]=l.a,M[I+12]=y,M[I+13]=A,M[I+14]=h.r,M[I+15]=h.g,M[I+16]=h.b,M[I+17]=h.a,M[I+18]=C,M[I+19]=S,M[I+20]=l.r,M[I+21]=l.g,M[I+22]=l.b,M[I+23]=l.a,M[I+24]=k,M[I+25]=R,M[I+26]=h.r,M[I+27]=h.g,M[I+28]=h.b,M[I+29]=h.a,M[I+30]=Y,M[I+31]=F,M[I+32]=l.r,M[I+33]=l.g,M[I+34]=l.b,M[I+35]=l.a):(M[I+6]=x,M[I+7]=v,M[I+8]=y,M[I+9]=A,M[I+10]=h.r,M[I+11]=h.g,M[I+12]=h.b,M[I+13]=h.a,M[I+14]=C,M[I+15]=S,M[I+16]=k,M[I+17]=R,M[I+18]=h.r,M[I+19]=h.g,M[I+20]=h.b,M[I+21]=h.a,M[I+22]=Y,M[I+23]=F),I=c.length;let B=X.setArraySize(c,I+3);B[I]=f,B[I+1]=f+1,B[I+2]=f+2,f+=3;break}}}}clipTrianglesUnpacked(e,i,s,r){let h=this.clipOutput,l=this.clippedVertices,n=this.clippedUVs,a=this.clippedTriangles,o=this.clippingPolygons,c=o.length,u=0;l.length=0,n.length=0,a.length=0;for(let d=0;d<s;d+=3){let m=i[d]<<1,f=e[m],g=e[m+1],w=r[m],b=r[m+1];m=i[d+1]<<1;let p=e[m],x=e[m+1],v=r[m],y=r[m+1];m=i[d+2]<<1;let A=e[m],C=e[m+1],S=r[m],k=r[m+1];for(let R=0;R<c;R++){let Y=l.length;if(this.clip(f,g,p,x,A,C,o[R],h)){let F=h.length;if(F==0)continue;let L=x-C,I=A-p,M=f-A,B=C-g,ie=1/(L*M+I*(g-C)),te=F>>1,re=this.clipOutput,ce=X.setArraySize(l,Y+te*2),oe=X.setArraySize(n,Y+te*2);for(let J=0;J<F;J+=2,Y+=2){let ne=re[J],he=re[J+1];ce[Y]=ne,ce[Y+1]=he;let be=ne-A,me=he-C,we=(L*be+I*me)*ie,xe=(B*be+M*me)*ie,Ie=1-we-xe;oe[Y]=w*we+v*xe+S*Ie,oe[Y+1]=b*we+y*xe+k*Ie}Y=a.length;let fe=X.setArraySize(a,Y+3*(te-2));te--;for(let J=1;J<te;J++,Y+=3)fe[Y]=u,fe[Y+1]=u+J,fe[Y+2]=u+J+1;u+=te+1}else{let F=X.setArraySize(l,Y+6);F[Y]=f,F[Y+1]=g,F[Y+2]=p,F[Y+3]=x,F[Y+4]=A,F[Y+5]=C;let L=X.setArraySize(n,Y+3*2);L[Y]=w,L[Y+1]=b,L[Y+2]=v,L[Y+3]=y,L[Y+4]=S,L[Y+5]=k,Y=a.length;let I=X.setArraySize(a,Y+3);I[Y]=u,I[Y+1]=u+1,I[Y+2]=u+2,u+=3;break}}}}clip(e,i,s,r,h,l,n,a){let o=a,c=!1,u;n.length%4>=2?(u=a,a=this.scratch):u=this.scratch,u.length=0,u.push(e),u.push(i),u.push(s),u.push(r),u.push(h),u.push(l),u.push(e),u.push(i),a.length=0;let d=n.length-4,m=n;for(let f=0;;f+=2){let g=m[f],w=m[f+1],b=g-m[f+2],p=w-m[f+3],x=a.length,v=u;for(let A=0,C=u.length-2;A<C;){let S=v[A],k=v[A+1];A+=2;let R=v[A],Y=v[A+1],F=p*(g-R)>b*(w-Y),L=p*(g-S)-b*(w-k);if(L>0){if(F){a.push(R),a.push(Y);continue}let I=R-S,M=Y-k,B=L/(I*p-M*b);if(B>=0&&B<=1)a.push(S+I*B),a.push(k+M*B);else{a.push(R),a.push(Y);continue}}else if(F){let I=R-S,M=Y-k,B=L/(I*p-M*b);if(B>=0&&B<=1)a.push(S+I*B),a.push(k+M*B),a.push(R),a.push(Y);else{a.push(R),a.push(Y);continue}}c=!0}if(x==a.length)return o.length=0,!0;if(a.push(a[0]),a.push(a[1]),f==d)break;let y=a;a=u,a.length=0,u=y}if(o!=a){o.length=0;for(let f=0,g=a.length-2;f<g;f++)o[f]=a[f]}else o.length=o.length-2;return c}static makeClockwise(e){let i=e,s=e.length,r=i[s-2]*i[1]-i[0]*i[s-1],h=0,l=0,n=0,a=0;for(let o=0,c=s-3;o<c;o+=2)h=i[o],l=i[o+1],n=i[o+2],a=i[o+3],r+=h*a-n*l;if(!(r<0))for(let o=0,c=s-2,u=s>>1;o<u;o+=2){let d=i[o],m=i[o+1],f=c-o;i[o]=i[f],i[o+1]=i[f+1],i[f]=d,i[f+1]=m}}},Ms=class{attachmentLoader;scale=1;linkedMeshes=new Array;constructor(t){this.attachmentLoader=t}readSkeletonData(t){let e=this.scale,i=new Ii,s=typeof t=="string"?JSON.parse(t):t,r=s.skeleton;if(r&&(i.hash=r.hash,i.version=r.spine,i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height,i.referenceScale=E(r,"referenceScale",100)*e,i.fps=r.fps,i.imagesPath=r.images??null,i.audioPath=r.audio??null),s.bones)for(let h=0;h<s.bones.length;h++){let l=s.bones[h],n=null,a=E(l,"parent",null);a&&(n=i.findBone(a));let o=new wi(i.bones.length,l.name,n);o.length=E(l,"length",0)*e,o.x=E(l,"x",0)*e,o.y=E(l,"y",0)*e,o.rotation=E(l,"rotation",0),o.scaleX=E(l,"scaleX",1),o.scaleY=E(l,"scaleY",1),o.shearX=E(l,"shearX",0),o.shearY=E(l,"shearY",0),o.inherit=X.enumValue(gt,E(l,"inherit","Normal")),o.skinRequired=E(l,"skin",!1);let c=E(l,"color",null);c&&o.color.setFromString(c),i.bones.push(o)}if(s.slots)for(let h=0;h<s.slots.length;h++){let l=s.slots[h],n=l.name,a=i.findBone(l.bone);if(!a)throw new Error(`Couldn't find bone ${l.bone} for slot ${n}`);let o=new Ri(i.slots.length,n,a),c=E(l,"color",null);c&&o.color.setFromString(c);let u=E(l,"dark",null);u&&(o.darkColor=V.fromString(u)),o.attachmentName=E(l,"attachment",null),o.blendMode=X.enumValue(Yi,E(l,"blend","normal")),o.visible=E(l,"visible",!0),i.slots.push(o)}if(s.ik)for(let h=0;h<s.ik.length;h++){let l=s.ik[h],n=new Ai(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);for(let o=0;o<l.bones.length;o++){let c=i.findBone(l.bones[o]);if(!c)throw new Error(`Couldn't find bone ${l.bones[o]} for IK constraint ${l.name}.`);n.bones.push(c)}let a=i.findBone(l.target);if(!a)throw new Error(`Couldn't find target bone ${l.target} for IK constraint ${l.name}.`);n.target=a,n.mix=E(l,"mix",1),n.softness=E(l,"softness",0)*e,n.bendDirection=E(l,"bendPositive",!0)?1:-1,n.compress=E(l,"compress",!1),n.stretch=E(l,"stretch",!1),n.uniform=E(l,"uniform",!1),i.ikConstraints.push(n)}if(s.transform)for(let h=0;h<s.transform.length;h++){let l=s.transform[h],n=new Fi(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let u=l.bones[c],d=i.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for transform constraint ${l.name}.`);n.bones.push(d)}let a=l.target,o=i.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${l.name}.`);n.target=o,n.local=E(l,"local",!1),n.relative=E(l,"relative",!1),n.offsetRotation=E(l,"rotation",0),n.offsetX=E(l,"x",0)*e,n.offsetY=E(l,"y",0)*e,n.offsetScaleX=E(l,"scaleX",0),n.offsetScaleY=E(l,"scaleY",0),n.offsetShearY=E(l,"shearY",0),n.mixRotate=E(l,"mixRotate",1),n.mixX=E(l,"mixX",1),n.mixY=E(l,"mixY",n.mixX),n.mixScaleX=E(l,"mixScaleX",1),n.mixScaleY=E(l,"mixScaleY",n.mixScaleX),n.mixShearY=E(l,"mixShearY",1),i.transformConstraints.push(n)}if(s.path)for(let h=0;h<s.path.length;h++){let l=s.path[h],n=new Ci(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);for(let c=0;c<l.bones.length;c++){let u=l.bones[c],d=i.findBone(u);if(!d)throw new Error(`Couldn't find bone ${u} for path constraint ${l.name}.`);n.bones.push(d)}let a=l.target,o=i.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${l.name}.`);n.target=o,n.positionMode=X.enumValue(Si,E(l,"positionMode","Percent")),n.spacingMode=X.enumValue(Ti,E(l,"spacingMode","Length")),n.rotateMode=X.enumValue(ki,E(l,"rotateMode","Tangent")),n.offsetRotation=E(l,"rotation",0),n.position=E(l,"position",0),n.positionMode==0&&(n.position*=e),n.spacing=E(l,"spacing",0),(n.spacingMode==0||n.spacingMode==1)&&(n.spacing*=e),n.mixRotate=E(l,"mixRotate",1),n.mixX=E(l,"mixX",1),n.mixY=E(l,"mixY",n.mixX),i.pathConstraints.push(n)}if(s.physics)for(let h=0;h<s.physics.length;h++){const l=s.physics[h],n=new Cs(l.name);n.order=E(l,"order",0),n.skinRequired=E(l,"skin",!1);const a=l.bone,o=i.findBone(a);if(o==null)throw new Error("Physics bone not found: "+a);n.bone=o,n.x=E(l,"x",0),n.y=E(l,"y",0),n.rotate=E(l,"rotate",0),n.scaleX=E(l,"scaleX",0),n.shearX=E(l,"shearX",0),n.limit=E(l,"limit",5e3)*e,n.step=1/E(l,"fps",60),n.inertia=E(l,"inertia",1),n.strength=E(l,"strength",100),n.damping=E(l,"damping",1),n.massInverse=1/E(l,"mass",1),n.wind=E(l,"wind",0),n.gravity=E(l,"gravity",0),n.mix=E(l,"mix",1),n.inertiaGlobal=E(l,"inertiaGlobal",!1),n.strengthGlobal=E(l,"strengthGlobal",!1),n.dampingGlobal=E(l,"dampingGlobal",!1),n.massGlobal=E(l,"massGlobal",!1),n.windGlobal=E(l,"windGlobal",!1),n.gravityGlobal=E(l,"gravityGlobal",!1),n.mixGlobal=E(l,"mixGlobal",!1),i.physicsConstraints.push(n)}if(s.skins)for(let h=0;h<s.skins.length;h++){let l=s.skins[h],n=new pt(l.name);if(l.bones)for(let a=0;a<l.bones.length;a++){let o=l.bones[a],c=i.findBone(o);if(!c)throw new Error(`Couldn't find bone ${o} for skin ${l.name}.`);n.bones.push(c)}if(l.ik)for(let a=0;a<l.ik.length;a++){let o=l.ik[a],c=i.findIkConstraint(o);if(!c)throw new Error(`Couldn't find IK constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.transform)for(let a=0;a<l.transform.length;a++){let o=l.transform[a],c=i.findTransformConstraint(o);if(!c)throw new Error(`Couldn't find transform constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.path)for(let a=0;a<l.path.length;a++){let o=l.path[a],c=i.findPathConstraint(o);if(!c)throw new Error(`Couldn't find path constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}if(l.physics)for(let a=0;a<l.physics.length;a++){let o=l.physics[a],c=i.findPhysicsConstraint(o);if(!c)throw new Error(`Couldn't find physics constraint ${o} for skin ${l.name}.`);n.constraints.push(c)}for(let a in l.attachments){let o=i.findSlot(a);if(!o)throw new Error(`Couldn't find slot ${a} for skin ${l.name}.`);let c=l.attachments[a];for(let u in c){let d=this.readAttachment(c[u],n,o.index,u,i);d&&n.setAttachment(o.index,u,d)}}i.skins.push(n),n.name=="default"&&(i.defaultSkin=n)}for(let h=0,l=this.linkedMeshes.length;h<l;h++){let n=this.linkedMeshes[h],a=n.skin?i.findSkin(n.skin):i.defaultSkin;if(!a)throw new Error(`Skin not found: ${n.skin}`);let o=a.getAttachment(n.slotIndex,n.parent);if(!o)throw new Error(`Parent mesh not found: ${n.parent}`);n.mesh.timelineAttachment=n.inheritTimeline?o:n.mesh,n.mesh.setParentMesh(o),n.mesh.region!=null&&n.mesh.updateRegion()}if(this.linkedMeshes.length=0,s.events)for(let h in s.events){let l=s.events[h],n=new yi(h);n.intValue=E(l,"int",0),n.floatValue=E(l,"float",0),n.stringValue=E(l,"string",""),n.audioPath=E(l,"audio",null),n.audioPath&&(n.volume=E(l,"volume",1),n.balance=E(l,"balance",0)),i.events.push(n)}if(s.animations)for(let h in s.animations){let l=s.animations[h];this.readAnimation(l,h,i)}return i}readAttachment(t,e,i,s,r){let h=this.scale;switch(s=E(t,"name",s),E(t,"type","region")){case"region":{let l=E(t,"path",s),n=this.readSequence(E(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,s,l,n);if(!a)return null;a.path=l,a.x=E(t,"x",0)*h,a.y=E(t,"y",0)*h,a.scaleX=E(t,"scaleX",1),a.scaleY=E(t,"scaleY",1),a.rotation=E(t,"rotation",0),a.width=t.width*h,a.height=t.height*h,a.sequence=n;let o=E(t,"color",null);return o&&a.color.setFromString(o),a.region!=null&&a.updateRegion(),a}case"boundingbox":{let l=this.attachmentLoader.newBoundingBoxAttachment(e,s);if(!l)return null;this.readVertices(t,l,t.vertexCount<<1);let n=E(t,"color",null);return n&&l.color.setFromString(n),l}case"mesh":case"linkedmesh":{let l=E(t,"path",s),n=this.readSequence(E(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,s,l,n);if(!a)return null;a.path=l;let o=E(t,"color",null);o&&a.color.setFromString(o),a.width=E(t,"width",0)*h,a.height=E(t,"height",0)*h,a.sequence=n;let c=E(t,"parent",null);if(c)return this.linkedMeshes.push(new Kr(a,E(t,"skin",null),i,c,E(t,"timelines",!0))),a;let u=t.uvs;return this.readVertices(t,a,u.length),a.triangles=t.triangles,a.regionUVs=u,a.region!=null&&a.updateRegion(),a.edges=E(t,"edges",null),a.hullLength=E(t,"hull",0)*2,a}case"path":{let l=this.attachmentLoader.newPathAttachment(e,s);if(!l)return null;l.closed=E(t,"closed",!1),l.constantSpeed=E(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,l,n<<1);let a=X.newArray(n/3,0);for(let c=0;c<t.lengths.length;c++)a[c]=t.lengths[c]*h;l.lengths=a;let o=E(t,"color",null);return o&&l.color.setFromString(o),l}case"point":{let l=this.attachmentLoader.newPointAttachment(e,s);if(!l)return null;l.x=E(t,"x",0)*h,l.y=E(t,"y",0)*h,l.rotation=E(t,"rotation",0);let n=E(t,"color",null);return n&&l.color.setFromString(n),l}case"clipping":{let l=this.attachmentLoader.newClippingAttachment(e,s);if(!l)return null;let n=E(t,"end",null);n&&(l.endSlot=r.findSlot(n));let a=t.vertexCount;this.readVertices(t,l,a<<1);let o=E(t,"color",null);return o&&l.color.setFromString(o),l}}return null}readSequence(t){if(t==null)return null;let e=new $i(E(t,"count",0));return e.start=E(t,"start",1),e.digits=E(t,"digits",0),e.setupIndex=E(t,"setup",0),e}readVertices(t,e,i){let s=this.scale;e.worldVerticesLength=i;let r=t.vertices;if(i==r.length){let n=X.toFloatArray(r);if(s!=1)for(let a=0,o=r.length;a<o;a++)n[a]*=s;e.vertices=n;return}let h=new Array,l=new Array;for(let n=0,a=r.length;n<a;){let o=r[n++];l.push(o);for(let c=n+o*4;n<c;n+=4)l.push(r[n]),h.push(r[n+1]*s),h.push(r[n+2]*s),h.push(r[n+3])}e.bones=l,e.vertices=X.toFloatArray(h)}readAnimation(t,e,i){let s=this.scale,r=new Array;if(t.slots)for(let l in t.slots){let n=t.slots[l],a=i.findSlot(l);if(!a)throw new Error("Slot not found: "+l);let o=a.index;for(let c in n){let u=n[c];if(!u)continue;let d=u.length;if(c=="attachment"){let m=new Ne(d,o);for(let f=0;f<d;f++){let g=u[f];m.setFrame(f,E(g,"time",0),E(g,"name",null))}r.push(m)}else if(c=="rgba"){let m=new qt(d,d<<2,o),f=u[0],g=E(f,"time",0),w=V.fromString(f.color);for(let b=0,p=0;;b++){m.setFrame(b,g,w.r,w.g,w.b,w.a);let x=u[b+1];if(!x){m.shrink(p);break}let v=E(x,"time",0),y=V.fromString(x.color),A=f.curve;A&&(p=le(A,m,p,b,0,g,v,w.r,y.r,1),p=le(A,m,p,b,1,g,v,w.g,y.g,1),p=le(A,m,p,b,2,g,v,w.b,y.b,1),p=le(A,m,p,b,3,g,v,w.a,y.a,1)),g=v,w=y,f=x}r.push(m)}else if(c=="rgb"){let m=new Gt(d,d*3,o),f=u[0],g=E(f,"time",0),w=V.fromString(f.color);for(let b=0,p=0;;b++){m.setFrame(b,g,w.r,w.g,w.b);let x=u[b+1];if(!x){m.shrink(p);break}let v=E(x,"time",0),y=V.fromString(x.color),A=f.curve;A&&(p=le(A,m,p,b,0,g,v,w.r,y.r,1),p=le(A,m,p,b,1,g,v,w.g,y.g,1),p=le(A,m,p,b,2,g,v,w.b,y.b,1)),g=v,w=y,f=x}r.push(m)}else if(c=="alpha")r.push(Te(u,new Ht(d,d,o),0,1));else if(c=="rgba2"){let m=new _t(d,d*7,o),f=u[0],g=E(f,"time",0),w=V.fromString(f.light),b=V.fromString(f.dark);for(let p=0,x=0;;p++){m.setFrame(p,g,w.r,w.g,w.b,w.a,b.r,b.g,b.b);let v=u[p+1];if(!v){m.shrink(x);break}let y=E(v,"time",0),A=V.fromString(v.light),C=V.fromString(v.dark),S=f.curve;S&&(x=le(S,m,x,p,0,g,y,w.r,A.r,1),x=le(S,m,x,p,1,g,y,w.g,A.g,1),x=le(S,m,x,p,2,g,y,w.b,A.b,1),x=le(S,m,x,p,3,g,y,w.a,A.a,1),x=le(S,m,x,p,4,g,y,b.r,C.r,1),x=le(S,m,x,p,5,g,y,b.g,C.g,1),x=le(S,m,x,p,6,g,y,b.b,C.b,1)),g=y,w=A,b=C,f=v}r.push(m)}else if(c=="rgb2"){let m=new jt(d,d*6,o),f=u[0],g=E(f,"time",0),w=V.fromString(f.light),b=V.fromString(f.dark);for(let p=0,x=0;;p++){m.setFrame(p,g,w.r,w.g,w.b,b.r,b.g,b.b);let v=u[p+1];if(!v){m.shrink(x);break}let y=E(v,"time",0),A=V.fromString(v.light),C=V.fromString(v.dark),S=f.curve;S&&(x=le(S,m,x,p,0,g,y,w.r,A.r,1),x=le(S,m,x,p,1,g,y,w.g,A.g,1),x=le(S,m,x,p,2,g,y,w.b,A.b,1),x=le(S,m,x,p,3,g,y,b.r,C.r,1),x=le(S,m,x,p,4,g,y,b.g,C.g,1),x=le(S,m,x,p,5,g,y,b.b,C.b,1)),g=y,w=A,b=C,f=v}r.push(m)}}}if(t.bones)for(let l in t.bones){let n=t.bones[l],a=i.findBone(l);if(!a)throw new Error("Bone not found: "+l);let o=a.index;for(let c in n){let u=n[c],d=u.length;if(d!=0){if(c==="rotate")r.push(Te(u,new et(d,d,o),0,1));else if(c==="translate"){let m=new Pt(d,d<<1,o);r.push(Pi(u,m,"x","y",0,s))}else if(c==="translatex"){let m=new Xt(d,d,o);r.push(Te(u,m,0,s))}else if(c==="translatey"){let m=new Bt(d,d,o);r.push(Te(u,m,0,s))}else if(c==="scale"){let m=new Vt(d,d<<1,o);r.push(Pi(u,m,"x","y",1,1))}else if(c==="scalex"){let m=new Ot(d,d,o);r.push(Te(u,m,1,1))}else if(c==="scaley"){let m=new Dt(d,d,o);r.push(Te(u,m,1,1))}else if(c==="shear"){let m=new Nt(d,d<<1,o);r.push(Pi(u,m,"x","y",0,1))}else if(c==="shearx"){let m=new Ut(d,d,o);r.push(Te(u,m,0,1))}else if(c==="sheary"){let m=new Wt(d,d,o);r.push(Te(u,m,0,1))}else if(c==="inherit"){let m=new zt(d,a.index);for(let f=0;f<u.length;f++){let g=u[f];m.setFrame(f,E(g,"time",0),X.enumValue(gt,E(g,"inherit","Normal")))}r.push(m)}}}}if(t.ik)for(let l in t.ik){let n=t.ik[l],a=n[0];if(!a)continue;let o=i.findIkConstraint(l);if(!o)throw new Error("IK Constraint not found: "+l);let c=i.ikConstraints.indexOf(o),u=new Jt(n.length,n.length<<1,c),d=E(a,"time",0),m=E(a,"mix",1),f=E(a,"softness",0)*s;for(let g=0,w=0;;g++){u.setFrame(g,d,m,f,E(a,"bendPositive",!0)?1:-1,E(a,"compress",!1),E(a,"stretch",!1));let b=n[g+1];if(!b){u.shrink(w);break}let p=E(b,"time",0),x=E(b,"mix",1),v=E(b,"softness",0)*s,y=a.curve;y&&(w=le(y,u,w,g,0,d,p,m,x,1),w=le(y,u,w,g,1,d,p,f,v,s)),d=p,m=x,f=v,a=b}r.push(u)}if(t.transform)for(let l in t.transform){let n=t.transform[l],a=n[0];if(!a)continue;let o=i.findTransformConstraint(l);if(!o)throw new Error("Transform constraint not found: "+l);let c=i.transformConstraints.indexOf(o),u=new Kt(n.length,n.length*6,c),d=E(a,"time",0),m=E(a,"mixRotate",1),f=E(a,"mixX",1),g=E(a,"mixY",f),w=E(a,"mixScaleX",1),b=E(a,"mixScaleY",w),p=E(a,"mixShearY",1);for(let x=0,v=0;;x++){u.setFrame(x,d,m,f,g,w,b,p);let y=n[x+1];if(!y){u.shrink(v);break}let A=E(y,"time",0),C=E(y,"mixRotate",1),S=E(y,"mixX",1),k=E(y,"mixY",S),R=E(y,"mixScaleX",1),Y=E(y,"mixScaleY",R),F=E(y,"mixShearY",1),L=a.curve;L&&(v=le(L,u,v,x,0,d,A,m,C,1),v=le(L,u,v,x,1,d,A,f,S,1),v=le(L,u,v,x,2,d,A,g,k,1),v=le(L,u,v,x,3,d,A,w,R,1),v=le(L,u,v,x,4,d,A,b,Y,1),v=le(L,u,v,x,5,d,A,p,F,1)),d=A,m=C,f=S,g=k,w=R,b=Y,w=R,a=y}r.push(u)}if(t.path)for(let l in t.path){let n=t.path[l],a=i.findPathConstraint(l);if(!a)throw new Error("Path constraint not found: "+l);let o=i.pathConstraints.indexOf(a);for(let c in n){let u=n[c],d=u[0];if(!d)continue;let m=u.length;if(c==="position"){let f=new Qt(m,m,o);r.push(Te(u,f,0,a.positionMode==0?s:1))}else if(c==="spacing"){let f=new $t(m,m,o);r.push(Te(u,f,0,a.spacingMode==0||a.spacingMode==1?s:1))}else if(c==="mix"){let f=new ei(m,m*3,o),g=E(d,"time",0),w=E(d,"mixRotate",1),b=E(d,"mixX",1),p=E(d,"mixY",b);for(let x=0,v=0;;x++){f.setFrame(x,g,w,b,p);let y=u[x+1];if(!y){f.shrink(v);break}let A=E(y,"time",0),C=E(y,"mixRotate",1),S=E(y,"mixX",1),k=E(y,"mixY",S),R=d.curve;R&&(v=le(R,f,v,x,0,g,A,w,C,1),v=le(R,f,v,x,1,g,A,b,S,1),v=le(R,f,v,x,2,g,A,p,k,1)),g=A,w=C,b=S,p=k,d=y}r.push(f)}}}if(t.physics)for(let l in t.physics){let n=t.physics[l],a=-1;if(l.length>0){let o=i.findPhysicsConstraint(l);if(!o)throw new Error("Physics constraint not found: "+l);a=i.physicsConstraints.indexOf(o)}for(let o in n){let c=n[o],u=c[0];if(!u)continue;let d=c.length;if(o=="reset"){const f=new oi(d,a);for(let g=0;u!=null;u=c[g+1],g++)f.setFrame(g,E(u,"time",0));r.push(f);continue}let m;if(o=="inertia")m=new ti(d,d,a);else if(o=="strength")m=new ii(d,d,a);else if(o=="damping")m=new si(d,d,a);else if(o=="mass")m=new ri(d,d,a);else if(o=="wind")m=new ni(d,d,a);else if(o=="gravity")m=new ai(d,d,a);else if(o=="mix")m=new li(d,d,a);else continue;r.push(Te(c,m,0,1))}}if(t.attachments)for(let l in t.attachments){let n=t.attachments[l],a=i.findSkin(l);if(!a)throw new Error("Skin not found: "+l);for(let o in n){let c=n[o],u=i.findSlot(o);if(!u)throw new Error("Slot not found: "+o);let d=u.index;for(let m in c){let f=c[m],g=a.getAttachment(d,m);for(let w in f){let b=f[w],p=b[0];if(p){if(w=="deform"){let x=g.bones,v=g.vertices,y=x?v.length/3*2:v.length,A=new Zt(b.length,b.length,d,g),C=E(p,"time",0);for(let S=0,k=0;;S++){let R,Y=E(p,"vertices",null);if(!Y)R=x?X.newFloatArray(y):v;else{R=X.newFloatArray(y);let M=E(p,"offset",0);if(X.arrayCopy(Y,0,R,M,Y.length),s!=1)for(let B=M,ie=B+Y.length;B<ie;B++)R[B]*=s;if(!x)for(let B=0;B<y;B++)R[B]+=v[B]}A.setFrame(S,C,R);let F=b[S+1];if(!F){A.shrink(k);break}let L=E(F,"time",0),I=p.curve;I&&(k=le(I,A,k,S,0,C,L,0,1,1)),C=L,p=F}r.push(A)}else if(w=="sequence"){let x=new hi(b.length,d,g),v=0;for(let y=0;y<b.length;y++){let A=E(p,"delay",v),C=E(p,"time",0),S=es[E(p,"mode","hold")],k=E(p,"index",0);x.setFrame(y,C,S,k,A),v=A,p=b[y+1]}r.push(x)}}}}}}if(t.drawOrder){let l=new qe(t.drawOrder.length),n=i.slots.length,a=0;for(let o=0;o<t.drawOrder.length;o++,a++){let c=t.drawOrder[o],u=null,d=E(c,"offsets",null);if(d){u=X.newArray(n,-1);let m=X.newArray(n-d.length,0),f=0,g=0;for(let w=0;w<d.length;w++){let b=d[w],p=i.findSlot(b.slot);if(!p)throw new Error("Slot not found: "+p);let x=p.index;for(;f!=x;)m[g++]=f++;u[f+b.offset]=f++}for(;f<n;)m[g++]=f++;for(let w=n-1;w>=0;w--)u[w]==-1&&(u[w]=m[--g])}l.setFrame(a,E(c,"time",0),u)}r.push(l)}if(t.events){let l=new dt(t.events.length),n=0;for(let a=0;a<t.events.length;a++,n++){let o=t.events[a],c=i.findEvent(o.name);if(!c)throw new Error("Event not found: "+o.name);let u=new vi(X.toSinglePrecision(E(o,"time",0)),c);u.intValue=E(o,"int",c.intValue),u.floatValue=E(o,"float",c.floatValue),u.stringValue=E(o,"string",c.stringValue),u.data.audioPath&&(u.volume=E(o,"volume",1),u.balance=E(o,"balance",0)),l.setFrame(n,u)}r.push(l)}let h=0;for(let l=0,n=r.length;l<n;l++)h=Math.max(h,r[l].getDuration());i.animations.push(new ht(e,r,h))}},Kr=class{parent;skin;slotIndex;mesh;inheritTimeline;constructor(t,e,i,s,r){this.mesh=t,this.skin=e,this.slotIndex=i,this.parent=s,this.inheritTimeline=r}};function Te(t,e,i,s){let r=t[0],h=E(r,"time",0),l=E(r,"value",i)*s,n=0;for(let a=0;;a++){e.setFrame(a,h,l);let o=t[a+1];if(!o)return e.shrink(n),e;let c=E(o,"time",0),u=E(o,"value",i)*s;r.curve&&(n=le(r.curve,e,n,a,0,h,c,l,u,s)),h=c,l=u,r=o}}function Pi(t,e,i,s,r,h){let l=t[0],n=E(l,"time",0),a=E(l,i,r)*h,o=E(l,s,r)*h,c=0;for(let u=0;;u++){e.setFrame(u,n,a,o);let d=t[u+1];if(!d)return e.shrink(c),e;let m=E(d,"time",0),f=E(d,i,r)*h,g=E(d,s,r)*h,w=l.curve;w&&(c=le(w,e,c,u,0,n,m,a,f,h),c=le(w,e,c,u,1,n,m,o,g,h)),n=m,a=f,o=g,l=d}}function le(t,e,i,s,r,h,l,n,a,o){if(t=="stepped")return e.setStepped(s),i;let c=r<<2,u=t[c],d=t[c+1]*o,m=t[c+2],f=t[c+3]*o;return e.setBezier(i,s,r,h,n,u,d,m,f,l,a),i+1}function E(t,e,i){return t[e]!==void 0?t[e]:i}typeof Math.fround>"u"&&(Math.fround=function(t){return function(e){return t[0]=e,t[0]}}(new Float32Array(1)));var ge=class{canvas;gl;restorables=[];constructor(t,e={alpha:!0}){if(t instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext)this.gl=t,this.canvas=this.gl.canvas;else{const i=t;this.gl=i.getContext("webgl2",e)||i.getContext("webgl",e),this.canvas=i,i.addEventListener("webglcontextlost",this.contextLostHandler),i.addEventListener("webglcontextrestored",this.contextRestoredHandler)}}contextLostHandler=t=>{t&&t.preventDefault()};contextRestoredHandler=()=>{for(let t=0,e=this.restorables.length;t<e;t++)this.restorables[t].restore()};dispose(){this.canvas.removeEventListener("webglcontextlost",this.contextLostHandler),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredHandler)}addRestorable(t){this.restorables.push(t)}removeRestorable(t){const e=this.restorables.indexOf(t);e>-1&&this.restorables.splice(e,1)}},_e=class Rt extends mi{context;texture=null;boundUnit=0;useMipMaps=!1;static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL=!1;constructor(e,i,s=!1){super(i),this.context=e instanceof ge?e:new ge(e),this.useMipMaps=s,this.restore(),this.context.addRestorable(this)}setFilters(e,i){let s=this.context.gl;this.bind(),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,Rt.validateMagFilter(i)),this.useMipMaps=Rt.usesMipMaps(e),this.useMipMaps&&s.generateMipmap(s.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,i){let s=this.context.gl;this.bind(),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,i)}update(e){let i=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind(),Rt.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL&&i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,this._image),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,e?i.LINEAR_MIPMAP_LINEAR:i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),e&&i.generateMipmap(i.TEXTURE_2D)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(e=0){let i=this.context.gl;this.boundUnit=e,i.activeTexture(i.TEXTURE0+e),i.bindTexture(i.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)}},Xi=class extends ps{constructor(t,e="",i=new bi){super(s=>new _e(t,s),e,i)}},ve=class{x=0;y=0;z=0;constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}setFrom(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}set(t,e,i){return this.x=t,this.y=e,this.z=i,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}scale(t){return this.x*=t,this.y*=t,this.z*=t,this}normalize(){let t=this.length();return t==0?this:(t=1/t,this.x*=t,this.y*=t,this.z*=t,this)}cross(t){return this.set(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)}multiply(t){let e=t.values;return this.set(this.x*e[O]+this.y*e[q]+this.z*e[G]+e[D],this.x*e[H]+this.y*e[N]+this.z*e[_]+e[U],this.x*e[j]+this.y*e[Z]+this.z*e[W]+e[z])}project(t){let e=t.values,i=1/(this.x*e[Q]+this.y*e[$]+this.z*e[ee]+e[K]);return this.set((this.x*e[O]+this.y*e[q]+this.z*e[G]+e[D])*i,(this.x*e[H]+this.y*e[N]+this.z*e[_]+e[U])*i,(this.x*e[j]+this.y*e[Z]+this.z*e[W]+e[z])*i)}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(t){let e=t.x-this.x,i=t.y-this.y,s=t.z-this.z;return Math.sqrt(e*e+i*i+s*s)}},O=0,q=4,G=8,D=12,H=1,N=5,_=9,U=13,j=2,Z=6,W=10,z=14,Q=3,$=7,ee=11,K=15,rt=class Re{temp=new Float32Array(16);values=new Float32Array(16);static xAxis=new ve;static yAxis=new ve;static zAxis=new ve;static tmpMatrix=new Re;constructor(){let e=this.values;e[O]=1,e[N]=1,e[W]=1,e[K]=1}set(e){return this.values.set(e),this}transpose(){let e=this.temp,i=this.values;return e[O]=i[O],e[q]=i[H],e[G]=i[j],e[D]=i[Q],e[H]=i[q],e[N]=i[N],e[_]=i[Z],e[U]=i[$],e[j]=i[G],e[Z]=i[_],e[W]=i[W],e[z]=i[ee],e[Q]=i[D],e[$]=i[U],e[ee]=i[z],e[K]=i[K],this.set(e)}identity(){let e=this.values;return e[O]=1,e[q]=0,e[G]=0,e[D]=0,e[H]=0,e[N]=1,e[_]=0,e[U]=0,e[j]=0,e[Z]=0,e[W]=1,e[z]=0,e[Q]=0,e[$]=0,e[ee]=0,e[K]=1,this}invert(){let e=this.values,i=this.temp,s=e[Q]*e[Z]*e[_]*e[D]-e[j]*e[$]*e[_]*e[D]-e[Q]*e[N]*e[W]*e[D]+e[H]*e[$]*e[W]*e[D]+e[j]*e[N]*e[ee]*e[D]-e[H]*e[Z]*e[ee]*e[D]-e[Q]*e[Z]*e[G]*e[U]+e[j]*e[$]*e[G]*e[U]+e[Q]*e[q]*e[W]*e[U]-e[O]*e[$]*e[W]*e[U]-e[j]*e[q]*e[ee]*e[U]+e[O]*e[Z]*e[ee]*e[U]+e[Q]*e[N]*e[G]*e[z]-e[H]*e[$]*e[G]*e[z]-e[Q]*e[q]*e[_]*e[z]+e[O]*e[$]*e[_]*e[z]+e[H]*e[q]*e[ee]*e[z]-e[O]*e[N]*e[ee]*e[z]-e[j]*e[N]*e[G]*e[K]+e[H]*e[Z]*e[G]*e[K]+e[j]*e[q]*e[_]*e[K]-e[O]*e[Z]*e[_]*e[K]-e[H]*e[q]*e[W]*e[K]+e[O]*e[N]*e[W]*e[K];if(s==0)throw new Error("non-invertible matrix");let r=1/s;return i[O]=e[_]*e[z]*e[$]-e[U]*e[W]*e[$]+e[U]*e[Z]*e[ee]-e[N]*e[z]*e[ee]-e[_]*e[Z]*e[K]+e[N]*e[W]*e[K],i[q]=e[D]*e[W]*e[$]-e[G]*e[z]*e[$]-e[D]*e[Z]*e[ee]+e[q]*e[z]*e[ee]+e[G]*e[Z]*e[K]-e[q]*e[W]*e[K],i[G]=e[G]*e[U]*e[$]-e[D]*e[_]*e[$]+e[D]*e[N]*e[ee]-e[q]*e[U]*e[ee]-e[G]*e[N]*e[K]+e[q]*e[_]*e[K],i[D]=e[D]*e[_]*e[Z]-e[G]*e[U]*e[Z]-e[D]*e[N]*e[W]+e[q]*e[U]*e[W]+e[G]*e[N]*e[z]-e[q]*e[_]*e[z],i[H]=e[U]*e[W]*e[Q]-e[_]*e[z]*e[Q]-e[U]*e[j]*e[ee]+e[H]*e[z]*e[ee]+e[_]*e[j]*e[K]-e[H]*e[W]*e[K],i[N]=e[G]*e[z]*e[Q]-e[D]*e[W]*e[Q]+e[D]*e[j]*e[ee]-e[O]*e[z]*e[ee]-e[G]*e[j]*e[K]+e[O]*e[W]*e[K],i[_]=e[D]*e[_]*e[Q]-e[G]*e[U]*e[Q]-e[D]*e[H]*e[ee]+e[O]*e[U]*e[ee]+e[G]*e[H]*e[K]-e[O]*e[_]*e[K],i[U]=e[G]*e[U]*e[j]-e[D]*e[_]*e[j]+e[D]*e[H]*e[W]-e[O]*e[U]*e[W]-e[G]*e[H]*e[z]+e[O]*e[_]*e[z],i[j]=e[N]*e[z]*e[Q]-e[U]*e[Z]*e[Q]+e[U]*e[j]*e[$]-e[H]*e[z]*e[$]-e[N]*e[j]*e[K]+e[H]*e[Z]*e[K],i[Z]=e[D]*e[Z]*e[Q]-e[q]*e[z]*e[Q]-e[D]*e[j]*e[$]+e[O]*e[z]*e[$]+e[q]*e[j]*e[K]-e[O]*e[Z]*e[K],i[W]=e[q]*e[U]*e[Q]-e[D]*e[N]*e[Q]+e[D]*e[H]*e[$]-e[O]*e[U]*e[$]-e[q]*e[H]*e[K]+e[O]*e[N]*e[K],i[z]=e[D]*e[N]*e[j]-e[q]*e[U]*e[j]-e[D]*e[H]*e[Z]+e[O]*e[U]*e[Z]+e[q]*e[H]*e[z]-e[O]*e[N]*e[z],i[Q]=e[_]*e[Z]*e[Q]-e[N]*e[W]*e[Q]-e[_]*e[j]*e[$]+e[H]*e[W]*e[$]+e[N]*e[j]*e[ee]-e[H]*e[Z]*e[ee],i[$]=e[q]*e[W]*e[Q]-e[G]*e[Z]*e[Q]+e[G]*e[j]*e[$]-e[O]*e[W]*e[$]-e[q]*e[j]*e[ee]+e[O]*e[Z]*e[ee],i[ee]=e[G]*e[N]*e[Q]-e[q]*e[_]*e[Q]-e[G]*e[H]*e[$]+e[O]*e[_]*e[$]+e[q]*e[H]*e[ee]-e[O]*e[N]*e[ee],i[K]=e[q]*e[_]*e[j]-e[G]*e[N]*e[j]+e[G]*e[H]*e[Z]-e[O]*e[_]*e[Z]-e[q]*e[H]*e[W]+e[O]*e[N]*e[W],e[O]=i[O]*r,e[q]=i[q]*r,e[G]=i[G]*r,e[D]=i[D]*r,e[H]=i[H]*r,e[N]=i[N]*r,e[_]=i[_]*r,e[U]=i[U]*r,e[j]=i[j]*r,e[Z]=i[Z]*r,e[W]=i[W]*r,e[z]=i[z]*r,e[Q]=i[Q]*r,e[$]=i[$]*r,e[ee]=i[ee]*r,e[K]=i[K]*r,this}determinant(){let e=this.values;return e[Q]*e[Z]*e[_]*e[D]-e[j]*e[$]*e[_]*e[D]-e[Q]*e[N]*e[W]*e[D]+e[H]*e[$]*e[W]*e[D]+e[j]*e[N]*e[ee]*e[D]-e[H]*e[Z]*e[ee]*e[D]-e[Q]*e[Z]*e[G]*e[U]+e[j]*e[$]*e[G]*e[U]+e[Q]*e[q]*e[W]*e[U]-e[O]*e[$]*e[W]*e[U]-e[j]*e[q]*e[ee]*e[U]+e[O]*e[Z]*e[ee]*e[U]+e[Q]*e[N]*e[G]*e[z]-e[H]*e[$]*e[G]*e[z]-e[Q]*e[q]*e[_]*e[z]+e[O]*e[$]*e[_]*e[z]+e[H]*e[q]*e[ee]*e[z]-e[O]*e[N]*e[ee]*e[z]-e[j]*e[N]*e[G]*e[K]+e[H]*e[Z]*e[G]*e[K]+e[j]*e[q]*e[_]*e[K]-e[O]*e[Z]*e[_]*e[K]-e[H]*e[q]*e[W]*e[K]+e[O]*e[N]*e[W]*e[K]}translate(e,i,s){let r=this.values;return r[D]+=e,r[U]+=i,r[z]+=s,this}copy(){return new Re().set(this.values)}projection(e,i,s,r){this.identity();let h=1/Math.tan(s*(Math.PI/180)/2),l=(i+e)/(e-i),n=2*i*e/(e-i),a=this.values;return a[O]=h/r,a[H]=0,a[j]=0,a[Q]=0,a[q]=0,a[N]=h,a[Z]=0,a[$]=0,a[G]=0,a[_]=0,a[W]=l,a[ee]=-1,a[D]=0,a[U]=0,a[z]=n,a[K]=0,this}ortho2d(e,i,s,r){return this.ortho(e,e+s,i,i+r,0,1)}ortho(e,i,s,r,h,l){this.identity();let n=2/(i-e),a=2/(r-s),o=-2/(l-h),c=-(i+e)/(i-e),u=-(r+s)/(r-s),d=-(l+h)/(l-h),m=this.values;return m[O]=n,m[H]=0,m[j]=0,m[Q]=0,m[q]=0,m[N]=a,m[Z]=0,m[$]=0,m[G]=0,m[_]=0,m[W]=o,m[ee]=0,m[D]=c,m[U]=u,m[z]=d,m[K]=1,this}multiply(e){let i=this.temp,s=this.values,r=e.values;return i[O]=s[O]*r[O]+s[q]*r[H]+s[G]*r[j]+s[D]*r[Q],i[q]=s[O]*r[q]+s[q]*r[N]+s[G]*r[Z]+s[D]*r[$],i[G]=s[O]*r[G]+s[q]*r[_]+s[G]*r[W]+s[D]*r[ee],i[D]=s[O]*r[D]+s[q]*r[U]+s[G]*r[z]+s[D]*r[K],i[H]=s[H]*r[O]+s[N]*r[H]+s[_]*r[j]+s[U]*r[Q],i[N]=s[H]*r[q]+s[N]*r[N]+s[_]*r[Z]+s[U]*r[$],i[_]=s[H]*r[G]+s[N]*r[_]+s[_]*r[W]+s[U]*r[ee],i[U]=s[H]*r[D]+s[N]*r[U]+s[_]*r[z]+s[U]*r[K],i[j]=s[j]*r[O]+s[Z]*r[H]+s[W]*r[j]+s[z]*r[Q],i[Z]=s[j]*r[q]+s[Z]*r[N]+s[W]*r[Z]+s[z]*r[$],i[W]=s[j]*r[G]+s[Z]*r[_]+s[W]*r[W]+s[z]*r[ee],i[z]=s[j]*r[D]+s[Z]*r[U]+s[W]*r[z]+s[z]*r[K],i[Q]=s[Q]*r[O]+s[$]*r[H]+s[ee]*r[j]+s[K]*r[Q],i[$]=s[Q]*r[q]+s[$]*r[N]+s[ee]*r[Z]+s[K]*r[$],i[ee]=s[Q]*r[G]+s[$]*r[_]+s[ee]*r[W]+s[K]*r[ee],i[K]=s[Q]*r[D]+s[$]*r[U]+s[ee]*r[z]+s[K]*r[K],this.set(this.temp)}multiplyLeft(e){let i=this.temp,s=this.values,r=e.values;return i[O]=r[O]*s[O]+r[q]*s[H]+r[G]*s[j]+r[D]*s[Q],i[q]=r[O]*s[q]+r[q]*s[N]+r[G]*s[Z]+r[D]*s[$],i[G]=r[O]*s[G]+r[q]*s[_]+r[G]*s[W]+r[D]*s[ee],i[D]=r[O]*s[D]+r[q]*s[U]+r[G]*s[z]+r[D]*s[K],i[H]=r[H]*s[O]+r[N]*s[H]+r[_]*s[j]+r[U]*s[Q],i[N]=r[H]*s[q]+r[N]*s[N]+r[_]*s[Z]+r[U]*s[$],i[_]=r[H]*s[G]+r[N]*s[_]+r[_]*s[W]+r[U]*s[ee],i[U]=r[H]*s[D]+r[N]*s[U]+r[_]*s[z]+r[U]*s[K],i[j]=r[j]*s[O]+r[Z]*s[H]+r[W]*s[j]+r[z]*s[Q],i[Z]=r[j]*s[q]+r[Z]*s[N]+r[W]*s[Z]+r[z]*s[$],i[W]=r[j]*s[G]+r[Z]*s[_]+r[W]*s[W]+r[z]*s[ee],i[z]=r[j]*s[D]+r[Z]*s[U]+r[W]*s[z]+r[z]*s[K],i[Q]=r[Q]*s[O]+r[$]*s[H]+r[ee]*s[j]+r[K]*s[Q],i[$]=r[Q]*s[q]+r[$]*s[N]+r[ee]*s[Z]+r[K]*s[$],i[ee]=r[Q]*s[G]+r[$]*s[_]+r[ee]*s[W]+r[K]*s[ee],i[K]=r[Q]*s[D]+r[$]*s[U]+r[ee]*s[z]+r[K]*s[K],this.set(this.temp)}lookAt(e,i,s){let r=Re.xAxis,h=Re.yAxis,l=Re.zAxis;l.setFrom(i).normalize(),r.setFrom(i).normalize(),r.cross(s).normalize(),h.setFrom(r).cross(l).normalize(),this.identity();let n=this.values;return n[O]=r.x,n[q]=r.y,n[G]=r.z,n[H]=h.x,n[N]=h.y,n[_]=h.z,n[j]=-l.x,n[Z]=-l.y,n[W]=-l.z,Re.tmpMatrix.identity(),Re.tmpMatrix.values[D]=-e.x,Re.tmpMatrix.values[U]=-e.y,Re.tmpMatrix.values[z]=-e.z,this.multiply(Re.tmpMatrix),this}},Rs=class{position=new ve(0,0,0);direction=new ve(0,0,-1);up=new ve(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new rt;inverseProjectionView=new rt;projection=new rt;view=new rt;constructor(t,e){this.viewportWidth=t,this.viewportHeight=e,this.update()}update(){let t=this.projection,e=this.view,i=this.projectionView,s=this.inverseProjectionView,r=this.zoom,h=this.viewportWidth,l=this.viewportHeight;t.ortho(r*(-h/2),r*(h/2),r*(-l/2),r*(l/2),this.near,this.far),e.lookAt(this.position,this.direction,this.up),i.set(t.values),i.multiply(e),s.set(i.values).invert()}screenToWorld(t,e,i){let s=t.x,r=i-t.y-1;return t.x=2*s/e-1,t.y=2*r/i-1,t.z=2*t.z-1,t.project(this.inverseProjectionView),t}worldToScreen(t,e,i){return t.project(this.projectionView),t.x=e*(t.x+1)/2,t.y=i*(t.y+1)/2,t.z=(t.z+1)/2,t}setViewport(t,e){this.viewportWidth=t,this.viewportHeight=e}},nt=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=new Array;autoPreventDefault;isTouch=!1;callbacks;constructor(t,e=!0){this.element=t,this.autoPreventDefault=e,this.callbacks=this.setupCallbacks(t)}setupCallbacks(t){const e=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=t.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.buttonDown=!0,this.listeners.map(c=>{c.down&&c.down(this.mouseX,this.mouseY,a)})}},i=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=t.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.listeners.map(c=>{this.buttonDown?c.dragged&&c.dragged(this.mouseX,this.mouseY,a):c.moved&&c.moved(this.mouseX,this.mouseY,a)})}},s=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=t.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.buttonDown=!1,this.listeners.map(c=>{c.up&&c.up(this.mouseX,this.mouseY,a)})}},r=a=>{this.autoPreventDefault&&a.preventDefault();let o=a.deltaY;a.deltaMode==WheelEvent.DOM_DELTA_LINE&&(o*=8),a.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(o*=24),this.listeners.map(c=>{c.wheel&&c.wheel(a.deltaY,a)})},h=a=>{if(this.isTouch=!0,!this.touch0||!this.touch1){var o=a.changedTouches;let c=o.item(0);if(!c)return;let u=t.getBoundingClientRect(),d=c.clientX-u.left,m=c.clientY-u.top,f=new Ys(c.identifier,d,m);if(this.mouseX=d,this.mouseY=m,this.buttonDown=!0,!this.touch0)this.touch0=f,this.listeners.map(g=>{g.down&&g.down(f.x,f.y,a)});else if(!this.touch1){this.touch1=f;let g=this.touch1.x-this.touch0.x,w=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(g*g+w*w),this.listeners.map(b=>{b.zoom&&b.zoom(this.initialPinchDistance,this.initialPinchDistance,a)})}}this.autoPreventDefault&&a.preventDefault()},l=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let d=t.getBoundingClientRect();for(var c=0;c<o.length;c++){var u=o[c];let m=u.clientX-d.left,f=u.clientY-d.top;this.touch0.identifier===u.identifier&&(this.touch0.x=this.mouseX=m,this.touch0.y=this.mouseY=f,this.listeners.map(g=>{g.dragged&&g.dragged(m,f,a)})),this.touch1&&this.touch1.identifier===u.identifier&&(this.touch1.x=this.mouseX=m,this.touch1.y=this.mouseY=f)}if(this.touch0&&this.touch1){let m=this.touch1.x-this.touch0.x,f=this.touch1.x-this.touch0.x,g=Math.sqrt(m*m+f*f);this.listeners.map(w=>{w.zoom&&w.zoom(this.initialPinchDistance,g,a)})}}this.autoPreventDefault&&a.preventDefault()},n=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let d=t.getBoundingClientRect();for(var c=0;c<o.length;c++){var u=o[c];let m=u.clientX-d.left,f=u.clientY-d.top;if(this.touch0.identifier===u.identifier)if(this.touch0=null,this.mouseX=m,this.mouseY=f,this.listeners.map(g=>{g.up&&g.up(m,f,a)}),this.touch1)this.touch0=this.touch1,this.touch1=null,this.mouseX=this.touch0.x,this.mouseX=this.touch0.x,this.buttonDown=!0,this.listeners.map(g=>{g.down&&g.down(this.touch0.x,this.touch0.y,a)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}this.autoPreventDefault&&a.preventDefault()};return t.addEventListener("mousedown",e,!0),t.addEventListener("mousemove",i,!0),t.addEventListener("mouseup",s,!0),t.addEventListener("wheel",r,!0),t.addEventListener("touchstart",h,{passive:!1,capture:!1}),t.addEventListener("touchmove",l,{passive:!1,capture:!1}),t.addEventListener("touchend",n,{passive:!1,capture:!1}),t.addEventListener("touchcancel",n),{mouseDown:e,mouseMove:i,mouseUp:s,mouseWheel:r,touchStart:h,touchMove:l,touchEnd:n}}dispose(){const t=this.element;t.removeEventListener("mousedown",this.callbacks.mouseDown,!0),t.removeEventListener("mousemove",this.callbacks.mouseMove,!0),t.removeEventListener("mouseup",this.callbacks.mouseUp,!0),t.removeEventListener("wheel",this.callbacks.mouseWheel,!0),t.removeEventListener("touchstart",this.callbacks.touchStart,{capture:!1}),t.removeEventListener("touchmove",this.callbacks.touchMove,{capture:!1}),t.removeEventListener("touchend",this.callbacks.touchEnd,{capture:!1}),t.removeEventListener("touchcancel",this.callbacks.touchEnd),this.listeners.length=0}addListener(t){this.listeners.push(t)}removeListener(t){let e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},Ys=class{constructor(t,e,i){this.identifier=t,this.x=e,this.y=i}},Qr=class{constructor(t,e){this.canvas=t,this.camera=e;let i=0,s=0,r=0,h=0,l=0,n=0,a=0,o=0;new nt(t).addListener({down:(c,u)=>{i=e.position.x,s=e.position.y,h=n=c,l=a=u,o=e.zoom},dragged:(c,u)=>{let d=c-h,m=u-l,f=e.screenToWorld(new ve(0,0),t.clientWidth,t.clientHeight),g=e.screenToWorld(new ve(d,m),t.clientWidth,t.clientHeight).sub(f);e.position.set(i-g.x,s-g.y,0),e.update(),n=c,a=u},wheel:c=>{let u=c/200*e.zoom,d=e.zoom+u;if(d>0){let m=0,f=0;if(c<0)m=n,f=a;else{let b=new ve(t.clientWidth/2+15,t.clientHeight/2),p=n-b.x,x=t.clientHeight-1-a-b.y;m=b.x-p,f=t.clientHeight-1-b.y+x}let g=e.screenToWorld(new ve(m,f),t.clientWidth,t.clientHeight);e.zoom=d,e.update();let w=e.screenToWorld(new ve(m,f),t.clientWidth,t.clientHeight);e.position.add(g.sub(w)),e.update()}},zoom:(c,u)=>{let d=c/u;e.zoom=o*d},up:(c,u)=>{n=c,a=u},moved:(c,u)=>{n=c,a=u}})}},ke=class de{constructor(e,i,s){this.vertexShader=i,this.fragmentShader=s,this.vsSource=i,this.fsSource=s,this.context=e instanceof ge?e:new ge(e),this.context.addRestorable(this),this.compile()}static MVP_MATRIX="u_projTrans";static POSITION="a_position";static COLOR="a_color";static COLOR2="a_color2";static TEXCOORDS="a_texCoords";static SAMPLER="u_texture";context;vs=null;vsSource;fs=null;fsSource;program=null;tmp2x2=new Float32Array(2*2);tmp3x3=new Float32Array(3*3);tmp4x4=new Float32Array(4*4);getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){let 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(i){throw this.dispose(),i}}compileShader(e,i){let s=this.context.gl,r=s.createShader(e);if(!r)throw new Error("Couldn't create shader.");if(s.shaderSource(r,i),s.compileShader(r),!s.getShaderParameter(r,s.COMPILE_STATUS)){let h="Couldn't compile shader: "+s.getShaderInfoLog(r);if(s.deleteShader(r),!s.isContextLost())throw new Error(h)}return r}compileProgram(e,i){let s=this.context.gl,r=s.createProgram();if(!r)throw new Error("Couldn't compile program.");if(s.attachShader(r,e),s.attachShader(r,i),s.linkProgram(r),!s.getProgramParameter(r,s.LINK_STATUS)){let h="Couldn't compile shader program: "+s.getProgramInfoLog(r);if(s.deleteProgram(r),!s.isContextLost())throw new Error(h)}return r}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(e,i){this.context.gl.uniform1i(this.getUniformLocation(e),i)}setUniformf(e,i){this.context.gl.uniform1f(this.getUniformLocation(e),i)}setUniform2f(e,i,s){this.context.gl.uniform2f(this.getUniformLocation(e),i,s)}setUniform3f(e,i,s,r){this.context.gl.uniform3f(this.getUniformLocation(e),i,s,r)}setUniform4f(e,i,s,r,h){this.context.gl.uniform4f(this.getUniformLocation(e),i,s,r,h)}setUniform2x2f(e,i){let s=this.context.gl;this.tmp2x2.set(i),s.uniformMatrix2fv(this.getUniformLocation(e),!1,this.tmp2x2)}setUniform3x3f(e,i){let s=this.context.gl;this.tmp3x3.set(i),s.uniformMatrix3fv(this.getUniformLocation(e),!1,this.tmp3x3)}setUniform4x4f(e,i){let s=this.context.gl;this.tmp4x4.set(i),s.uniformMatrix4fv(this.getUniformLocation(e),!1,this.tmp4x4)}getUniformLocation(e){let i=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let s=i.getUniformLocation(this.program,e);if(!s&&!i.isContextLost())throw new Error(`Couldn't find location for uniform ${e}`);return s}getAttributeLocation(e){let i=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let s=i.getAttribLocation(this.program,e);if(s==-1&&!i.isContextLost())throw new Error(`Couldn't find location for attribute ${e}`);return s}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 i=`
|
|
attribute vec4 ${de.POSITION};
|
|
attribute vec4 ${de.COLOR};
|
|
attribute vec2 ${de.TEXCOORDS};
|
|
uniform mat4 ${de.MVP_MATRIX};
|
|
varying vec4 v_color;
|
|
varying vec2 v_texCoords;
|
|
|
|
void main () {
|
|
v_color = ${de.COLOR};
|
|
v_texCoords = ${de.TEXCOORDS};
|
|
gl_Position = ${de.MVP_MATRIX} * ${de.POSITION};
|
|
}
|
|
`,s=`
|
|
#ifdef GL_ES
|
|
#define LOWP lowp
|
|
precision mediump float;
|
|
#else
|
|
#define LOWP
|
|
#endif
|
|
varying LOWP vec4 v_color;
|
|
varying vec2 v_texCoords;
|
|
uniform sampler2D u_texture;
|
|
|
|
void main () {
|
|
gl_FragColor = v_color * texture2D(u_texture, v_texCoords);
|
|
}
|
|
`;return new de(e,i,s)}static newTwoColoredTextured(e){let i=`
|
|
attribute vec4 ${de.POSITION};
|
|
attribute vec4 ${de.COLOR};
|
|
attribute vec4 ${de.COLOR2};
|
|
attribute vec2 ${de.TEXCOORDS};
|
|
uniform mat4 ${de.MVP_MATRIX};
|
|
varying vec4 v_light;
|
|
varying vec4 v_dark;
|
|
varying vec2 v_texCoords;
|
|
|
|
void main () {
|
|
v_light = ${de.COLOR};
|
|
v_dark = ${de.COLOR2};
|
|
v_texCoords = ${de.TEXCOORDS};
|
|
gl_Position = ${de.MVP_MATRIX} * ${de.POSITION};
|
|
}
|
|
`,s=`
|
|
#ifdef GL_ES
|
|
#define LOWP lowp
|
|
precision mediump float;
|
|
#else
|
|
#define LOWP
|
|
#endif
|
|
varying LOWP vec4 v_light;
|
|
varying LOWP vec4 v_dark;
|
|
varying vec2 v_texCoords;
|
|
uniform sampler2D u_texture;
|
|
|
|
void main () {
|
|
vec4 texColor = texture2D(u_texture, v_texCoords);
|
|
gl_FragColor.a = texColor.a * v_light.a;
|
|
gl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;
|
|
}
|
|
`;return new de(e,i,s)}static newColored(e){let i=`
|
|
attribute vec4 ${de.POSITION};
|
|
attribute vec4 ${de.COLOR};
|
|
uniform mat4 ${de.MVP_MATRIX};
|
|
varying vec4 v_color;
|
|
|
|
void main () {
|
|
v_color = ${de.COLOR};
|
|
gl_Position = ${de.MVP_MATRIX} * ${de.POSITION};
|
|
}
|
|
`,s=`
|
|
#ifdef GL_ES
|
|
#define LOWP lowp
|
|
precision mediump float;
|
|
#else
|
|
#define LOWP
|
|
#endif
|
|
varying LOWP vec4 v_color;
|
|
|
|
void main () {
|
|
gl_FragColor = v_color;
|
|
}
|
|
`;return new de(e,i,s)}},Bi=class{constructor(t,e,i,s){this.attributes=e,this.context=t instanceof ge?t:new ge(t),this.elementsPerVertex=0;for(let r=0;r<e.length;r++)this.elementsPerVertex+=e[r].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(t){this.dirtyVertices=!0,this.verticesLength=t}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(t){this.dirtyIndices=!0,this.indicesLength=t}getIndices(){return this.indices}getVertexSizeInFloats(){let t=0;for(var e=0;e<this.attributes.length;e++){let i=this.attributes[e];t+=i.numElements}return t}setVertices(t){if(this.dirtyVertices=!0,t.length>this.vertices.length)throw Error("Mesh can't store more than "+this.maxVertices()+" vertices");this.vertices.set(t,0),this.verticesLength=t.length}setIndices(t){if(this.dirtyIndices=!0,t.length>this.indices.length)throw Error("Mesh can't store more than "+this.maxIndices()+" indices");this.indices.set(t,0),this.indicesLength=t.length}draw(t,e){this.drawWithOffset(t,e,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(t,e,i,s){let r=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(t),this.indicesLength>0?r.drawElements(e,s,r.UNSIGNED_SHORT,i*2):r.drawArrays(e,i,s),this.unbind(t)}bind(t){let e=this.context.gl;e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer);let i=0;for(let s=0;s<this.attributes.length;s++){let r=this.attributes[s],h=t.getAttributeLocation(r.name);e.enableVertexAttribArray(h),e.vertexAttribPointer(h,r.numElements,e.FLOAT,!1,this.elementsPerVertex*4,i*4),i+=r.numElements}this.indicesLength>0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(t){let e=this.context.gl;for(let i=0;i<this.attributes.length;i++){let s=this.attributes[i],r=t.getAttributeLocation(s.name);e.disableVertexAttribArray(r)}e.bindBuffer(e.ARRAY_BUFFER,null),this.indicesLength>0&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}update(){let t=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),t.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=t.createBuffer()),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),t.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);let t=this.context.gl;t.deleteBuffer(this.verticesBuffer),t.deleteBuffer(this.indicesBuffer)}},je=class{constructor(t,e,i){this.name=t,this.type=e,this.numElements=i}},wt=class extends je{constructor(){super(ke.POSITION,0,2)}},$r=class extends je{constructor(){super(ke.POSITION,0,3)}},Vi=class extends je{constructor(t=0){super(ke.TEXCOORDS+(t==0?"":t),0,2)}},xt=class extends je{constructor(){super(ke.COLOR,0,4)}},Fs=class extends je{constructor(){super(ke.COLOR2,0,4)}},Ls=(t=>(t[t.Float=0]="Float",t))(Ls||{}),Pe=1,en=769,Ps=770,Xs=771,Bs=774,Oi=class ze{static disableCulling=!1;context;drawCalls=0;static globalDrawCalls=0;isDrawing=!1;mesh;shader=null;lastTexture=null;verticesLength=0;indicesLength=0;srcColorBlend;srcAlphaBlend;dstBlend;cullWasEnabled=!1;constructor(e,i=!0,s=10920){if(s>10920)throw new Error("Can't have more than 10920 triangles per batch: "+s);this.context=e instanceof ge?e:new ge(e);let r=i?[new wt,new xt,new Vi,new Fs]:[new wt,new xt,new Vi];this.mesh=new Bi(e,r,s,s*3);let h=this.context.gl;this.srcColorBlend=h.SRC_ALPHA,this.srcAlphaBlend=h.ONE,this.dstBlend=h.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 i=this.context.gl;i.enable(i.BLEND),i.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),ze.disableCulling&&(this.cullWasEnabled=i.isEnabled(i.CULL_FACE),this.cullWasEnabled&&i.disable(i.CULL_FACE))}static blendModesGL=[{srcRgb:Ps,srcRgbPma:Pe,dstRgb:Xs,srcAlpha:Pe},{srcRgb:Ps,srcRgbPma:Pe,dstRgb:Pe,srcAlpha:Pe},{srcRgb:Bs,srcRgbPma:Bs,dstRgb:Xs,srcAlpha:Pe},{srcRgb:Pe,srcRgbPma:Pe,dstRgb:en,srcAlpha:Pe}];setBlendMode(e,i){const s=ze.blendModesGL[e],r=i?s.srcRgbPma:s.srcRgb,h=s.srcAlpha,l=s.dstRgb;if(this.srcColorBlend==r&&this.srcAlphaBlend==h&&this.dstBlend==l)return;this.srcColorBlend=r,this.srcAlphaBlend=h,this.dstBlend=l,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(r,l,h,l)}draw(e,i,s){e!=this.lastTexture?(this.flush(),this.lastTexture=e):(this.verticesLength+i.length>this.mesh.getVertices().length||this.indicesLength+s.length>this.mesh.getIndices().length)&&this.flush();let r=this.mesh.numVertices();this.mesh.getVertices().set(i,this.verticesLength),this.verticesLength+=i.length,this.mesh.setVerticesLength(this.verticesLength);let h=this.mesh.getIndices();for(let l=this.indicesLength,n=0;n<s.length;l++,n++)h[l]=s[n]+r;this.indicesLength+=s.length,this.mesh.setIndicesLength(this.indicesLength)}flush(){if(this.verticesLength!=0){if(!this.lastTexture)throw new Error("No texture set.");if(!this.shader)throw new Error("No shader set.");this.lastTexture.bind(),this.mesh.draw(this.shader,this.context.gl.TRIANGLES),this.verticesLength=0,this.indicesLength=0,this.mesh.setVerticesLength(0),this.mesh.setIndicesLength(0),this.drawCalls++,ze.globalDrawCalls++}}end(){if(!this.isDrawing)throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");(this.verticesLength>0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;let e=this.context.gl;e.disable(e.BLEND),ze.disableCulling&&this.cullWasEnabled&&e.enable(e.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let e=ze.globalDrawCalls;return ze.globalDrawCalls=0,e}dispose(){this.mesh.dispose()}},Di=class{context;isDrawing=!1;mesh;shapeType=4;color=new V(1,1,1,1);shader=null;vertexIndex=0;tmp=new Ce;srcColorBlend;srcAlphaBlend;dstBlend;constructor(t,e=10920){if(e>10920)throw new Error("Can't have more than 10920 triangles per batch: "+e);this.context=t instanceof ge?t:new ge(t),this.mesh=new Bi(t,[new wt,new xt],e,0);let i=this.context.gl;this.srcColorBlend=i.SRC_ALPHA,this.srcAlphaBlend=i.ONE,this.dstBlend=i.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=t,this.vertexIndex=0,this.isDrawing=!0;let e=this.context.gl;e.enable(e.BLEND),e.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(t,e,i){this.srcColorBlend=t,this.srcAlphaBlend=e,this.dstBlend=i,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(t,i,e,i))}setColor(t){this.color.setFromColor(t)}setColorWith(t,e,i,s){this.color.set(t,e,i,s)}point(t,e,i){this.check(0,1),i||(i=this.color),this.vertex(t,e,i)}line(t,e,i,s,r){this.check(1,2);let h=this.mesh.getVertices(),l=this.vertexIndex;r||(r=this.color),this.vertex(t,e,r),this.vertex(i,s,r)}triangle(t,e,i,s,r,h,l,n,a,o){this.check(t?4:1,3);let c=this.mesh.getVertices(),u=this.vertexIndex;n||(n=this.color),a||(a=this.color),o||(o=this.color),t?(this.vertex(e,i,n),this.vertex(s,r,a),this.vertex(h,l,o)):(this.vertex(e,i,n),this.vertex(s,r,a),this.vertex(s,r,n),this.vertex(h,l,a),this.vertex(h,l,n),this.vertex(e,i,a))}quad(t,e,i,s,r,h,l,n,a,o,c,u,d){this.check(t?4:1,3);let m=this.mesh.getVertices(),f=this.vertexIndex;o||(o=this.color),c||(c=this.color),u||(u=this.color),d||(d=this.color),t?(this.vertex(e,i,o),this.vertex(s,r,c),this.vertex(h,l,u),this.vertex(h,l,u),this.vertex(n,a,d),this.vertex(e,i,o)):(this.vertex(e,i,o),this.vertex(s,r,c),this.vertex(s,r,c),this.vertex(h,l,u),this.vertex(h,l,u),this.vertex(n,a,d),this.vertex(n,a,d),this.vertex(e,i,o))}rect(t,e,i,s,r,h){this.quad(t,e,i,e+s,i,e+s,i+r,e,i+r,h,h,h,h)}rectLine(t,e,i,s,r,h,l){this.check(t?4:1,8),l||(l=this.color);let n=this.tmp.set(r-i,e-s);n.normalize(),h*=.5;let a=n.x*h,o=n.y*h;t?(this.vertex(e+a,i+o,l),this.vertex(e-a,i-o,l),this.vertex(s+a,r+o,l),this.vertex(s-a,r-o,l),this.vertex(s+a,r+o,l),this.vertex(e-a,i-o,l)):(this.vertex(e+a,i+o,l),this.vertex(e-a,i-o,l),this.vertex(s+a,r+o,l),this.vertex(s-a,r-o,l),this.vertex(s+a,r+o,l),this.vertex(e+a,i+o,l),this.vertex(s-a,r-o,l),this.vertex(e-a,i-o,l))}x(t,e,i){this.line(t-i,e-i,t+i,e+i),this.line(t-i,e+i,t+i,e-i)}polygon(t,e,i,s){if(i<3)throw new Error("Polygon must contain at least 3 vertices");this.check(1,i*2),s||(s=this.color);let r=this.mesh.getVertices(),h=this.vertexIndex;e<<=1,i<<=1;let l=t[e],n=t[e+1],a=e+i;for(let o=e,c=e+i-2;o<c;o+=2){let u=t[o],d=t[o+1],m=0,f=0;o+2>=a?(m=l,f=n):(m=t[o+2],f=t[o+3]),this.vertex(u,d,s),this.vertex(m,f,s)}}circle(t,e,i,s,r,h=0){if(h==0&&(h=Math.max(1,6*P.cbrt(s)|0)),h<=0)throw new Error("segments must be > 0.");r||(r=this.color);let l=2*P.PI/h,n=Math.cos(l),a=Math.sin(l),o=s,c=0;if(t){this.check(4,h*3+3),h--;for(let d=0;d<h;d++){this.vertex(e,i,r),this.vertex(e+o,i+c,r);let m=o;o=n*o-a*c,c=a*m+n*c,this.vertex(e+o,i+c,r)}this.vertex(e,i,r),this.vertex(e+o,i+c,r)}else{this.check(1,h*2+2);for(let d=0;d<h;d++){this.vertex(e+o,i+c,r);let m=o;o=n*o-a*c,c=a*m+n*c,this.vertex(e+o,i+c,r)}this.vertex(e+o,i+c,r)}let u=o;o=s,c=0,this.vertex(e+o,i+c,r)}curve(t,e,i,s,r,h,l,n,a,o){this.check(1,a*2+2),o||(o=this.color);let c=1/a,u=c*c,d=c*c*c,m=3*c,f=3*u,g=6*u,w=6*d,b=t-i*2+r,p=e-s*2+h,x=(i-r)*3-t+l,v=(s-h)*3-e+n,y=t,A=e,C=(i-t)*m+b*f+x*d,S=(s-e)*m+p*f+v*d,k=b*g+x*w,R=p*g+v*w,Y=x*w,F=v*w;for(;a-- >0;)this.vertex(y,A,o),y+=C,A+=S,C+=k,S+=R,k+=Y,R+=F,this.vertex(y,A,o);this.vertex(y,A,o),this.vertex(l,n,o)}vertex(t,e,i){let s=this.vertexIndex,r=this.mesh.getVertices();r[s++]=t,r[s++]=e,r[s++]=i.r,r[s++]=i.g,r[s++]=i.b,r[s++]=i.a,this.vertexIndex=s}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();let t=this.context.gl;t.disable(t.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(t,e){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType==t)if(this.mesh.maxVertices()-this.mesh.numVertices()<e)this.flush();else return;else this.flush(),this.shapeType=t}dispose(){this.mesh.dispose()}},Vs=(t=>(t[t.Point=0]="Point",t[t.Line=1]="Line",t[t.Filled=4]="Filled",t))(Vs||{}),Os=class Zi{boneLineColor=new V(1,0,0,1);boneOriginColor=new V(0,1,0,1);attachmentLineColor=new V(0,0,1,.5);triangleLineColor=new V(1,.64,0,.5);pathColor=new V().setFromString("FF7F00");clipColor=new V(.8,0,0,2);aabbColor=new V(0,1,0,.5);drawBones=!0;drawRegionAttachments=!0;drawBoundingBoxes=!0;drawMeshHull=!0;drawMeshTriangles=!0;drawPaths=!0;drawSkeletonXY=!1;drawClipping=!0;premultipliedAlpha=!1;scale=1;boneWidth=2;context;bounds=new ks;temp=new Array;vertices=X.newFloatArray(2*1024);static LIGHT_GRAY=new V(192/255,192/255,192/255,1);static GREEN=new V(0,1,0,1);constructor(e){this.context=e instanceof ge?e:new ge(e)}draw(e,i,s){let r=i.x,h=i.y,l=this.context.gl,n=this.premultipliedAlpha?l.ONE:l.SRC_ALPHA;e.setBlendMode(n,l.ONE,l.ONE_MINUS_SRC_ALPHA);let a=i.bones;if(this.drawBones){e.setColor(this.boneLineColor);for(let o=0,c=a.length;o<c;o++){let u=a[o];if(s&&s.indexOf(u.data.name)>-1||!u.parent)continue;let d=u.data.length*u.a+u.worldX,m=u.data.length*u.c+u.worldY;e.rectLine(!0,u.worldX,u.worldY,d,m,this.boneWidth*this.scale)}this.drawSkeletonXY&&e.x(r,h,4*this.scale)}if(this.drawRegionAttachments){e.setColor(this.attachmentLineColor);let o=i.slots;for(let c=0,u=o.length;c<u;c++){let d=o[c],m=d.getAttachment();if(m instanceof it){let f=m,g=this.vertices;f.computeWorldVertices(d,g,0,2),e.line(g[0],g[1],g[2],g[3]),e.line(g[2],g[3],g[4],g[5]),e.line(g[4],g[5],g[6],g[7]),e.line(g[6],g[7],g[0],g[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){let o=i.slots;for(let c=0,u=o.length;c<u;c++){let d=o[c];if(!d.bone.active)continue;let m=d.getAttachment();if(!(m instanceof Ge))continue;let f=m,g=this.vertices;f.computeWorldVertices(d,0,f.worldVerticesLength,g,0,2);let w=f.triangles,b=f.hullLength;if(this.drawMeshTriangles){e.setColor(this.triangleLineColor);for(let p=0,x=w.length;p<x;p+=3){let v=w[p]*2,y=w[p+1]*2,A=w[p+2]*2;e.triangle(!1,g[v],g[v+1],g[y],g[y+1],g[A],g[A+1])}}if(this.drawMeshHull&&b>0){e.setColor(this.attachmentLineColor),b=(b>>1)*2;let p=g[b-2],x=g[b-1];for(let v=0,y=b;v<y;v+=2){let A=g[v],C=g[v+1];e.line(A,C,p,x),p=A,x=C}}}}if(this.drawBoundingBoxes){let o=this.bounds;o.update(i,!0),e.setColor(this.aabbColor),e.rect(!1,o.minX,o.minY,o.getWidth(),o.getHeight());let c=o.polygons,u=o.boundingBoxes;for(let d=0,m=c.length;d<m;d++){let f=c[d];e.setColor(u[d].color),e.polygon(f,0,f.length)}}if(this.drawPaths){let o=i.slots;for(let c=0,u=o.length;c<u;c++){let d=o[c];if(!d.bone.active)continue;let m=d.getAttachment();if(!(m instanceof He))continue;let f=m,g=f.worldVerticesLength,w=this.temp=X.setArraySize(this.temp,g,0);f.computeWorldVertices(d,0,g,w,0,2);let b=this.pathColor,p=w[2],x=w[3],v=0,y=0;if(f.closed){e.setColor(b);let A=w[0],C=w[1],S=w[g-2],k=w[g-1];v=w[g-4],y=w[g-3],e.curve(p,x,A,C,S,k,v,y,32),e.setColor(Zi.LIGHT_GRAY),e.line(p,x,A,C),e.line(v,y,S,k)}g-=4;for(let A=4;A<g;A+=6){let C=w[A],S=w[A+1],k=w[A+2],R=w[A+3];v=w[A+4],y=w[A+5],e.setColor(b),e.curve(p,x,C,S,k,R,v,y,32),e.setColor(Zi.LIGHT_GRAY),e.line(p,x,C,S),e.line(v,y,k,R),p=v,x=y}}}if(this.drawBones){e.setColor(this.boneOriginColor);for(let o=0,c=a.length;o<c;o++){let u=a[o];s&&s.indexOf(u.data.name)>-1||e.circle(!0,u.worldX,u.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=i.slots;e.setColor(this.clipColor);for(let c=0,u=o.length;c<u;c++){let d=o[c];if(!d.bone.active)continue;let m=d.getAttachment();if(!(m instanceof tt))continue;let f=m,g=f.worldVerticesLength,w=this.temp=X.setArraySize(this.temp,g,0);f.computeWorldVertices(d,0,g,w,0,2);for(let b=0,p=w.length;b<p;b+=2){let x=w[b],v=w[b+1],y=w[(b+2)%w.length],A=w[(b+3)%w.length];e.line(x,v,y,A)}}}}dispose(){}},tn=class{constructor(t,e,i){this.vertices=t,this.numVertices=e,this.numFloats=i}},Ds=class sr{static QUAD_TRIANGLES=[0,1,2,2,3,0];premultipliedAlpha=!1;tempColor=new V;tempColor2=new V;vertices;vertexSize=8;twoColorTint=!1;renderable=new tn([],0,0);clipper=new Is;temp=new Ce;temp2=new Ce;temp3=new V;temp4=new V;constructor(e,i=!0){this.twoColorTint=i,i&&(this.vertexSize+=4),this.vertices=X.newFloatArray(this.vertexSize*1024)}draw(e,i,s=-1,r=-1,h=null){let l=this.clipper,n=this.premultipliedAlpha,a=this.twoColorTint,o=null,c=this.renderable,u,d,m=i.drawOrder,f,g=i.color,w=a?12:8,b=!1;s==-1&&(b=!0);for(let p=0,x=m.length;p<x;p++){let v=l.isClipping()?2:w,y=m[p];if(!y.bone.active){l.clipEndWithSlot(y);continue}if(s>=0&&s==y.data.index&&(b=!0),!b){l.clipEndWithSlot(y);continue}r>=0&&r==y.data.index&&(b=!1);let A=y.getAttachment(),C;if(A instanceof it){let S=A;c.vertices=this.vertices,c.numVertices=4,c.numFloats=v<<2,S.computeWorldVertices(y,c.vertices,0,v),d=sr.QUAD_TRIANGLES,u=S.uvs,C=S.region.texture,f=S.color}else if(A instanceof Ge){let S=A;c.vertices=this.vertices,c.numVertices=S.worldVerticesLength>>1,c.numFloats=c.numVertices*v,c.numFloats>c.vertices.length&&(c.vertices=this.vertices=X.newFloatArray(c.numFloats)),S.computeWorldVertices(y,0,S.worldVerticesLength,c.vertices,0,v),d=S.triangles,C=S.region.texture,u=S.uvs,f=S.color}else if(A instanceof tt){let S=A;l.clipStart(y,S);continue}else{l.clipEndWithSlot(y);continue}if(C){let S=y.color,k=this.tempColor;k.r=g.r*S.r*f.r,k.g=g.g*S.g*f.g,k.b=g.b*S.b*f.b,k.a=g.a*S.a*f.a,n&&(k.r*=k.a,k.g*=k.a,k.b*=k.a);let R=this.tempColor2;y.darkColor?(n?(R.r=y.darkColor.r*k.a,R.g=y.darkColor.g*k.a,R.b=y.darkColor.b*k.a):R.setFromColor(y.darkColor),R.a=n?1:0):R.set(0,0,0,1);let Y=y.data.blendMode;if(Y!=o&&(o=Y,e.setBlendMode(o,n)),l.isClipping()){l.clipTriangles(c.vertices,d,d.length,u,k,R,a);let F=new Float32Array(l.clippedVertices),L=l.clippedTriangles;h&&h(F,F.length,w),e.draw(C,F,L)}else{let F=c.vertices;if(a)for(let I=2,M=0,B=c.numFloats;I<B;I+=w,M+=2)F[I]=k.r,F[I+1]=k.g,F[I+2]=k.b,F[I+3]=k.a,F[I+4]=u[M],F[I+5]=u[M+1],F[I+6]=R.r,F[I+7]=R.g,F[I+8]=R.b,F[I+9]=R.a;else for(let I=2,M=0,B=c.numFloats;I<B;I+=w,M+=2)F[I]=k.r,F[I+1]=k.g,F[I+2]=k.b,F[I+3]=k.a,F[I+4]=u[M],F[I+5]=u[M+1];let L=c.vertices.subarray(0,c.numFloats);h&&h(c.vertices,c.numFloats,w),e.draw(C,L,d)}}l.clipEndWithSlot(y)}l.clipEnd()}getSkeletonClipping(){return this.clipper}},T=[0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0],bt=[0,1,2,2,3,0],vt=new V(1,1,1,1),Ni=class{context;canvas;camera;batcher;twoColorTint=!1;batcherShader;shapes;shapesShader;activeRenderer=null;skeletonRenderer;skeletonDebugRenderer;constructor(t,e,i=!0){this.canvas=t,this.context=e instanceof ge?e:new ge(e),this.twoColorTint=i,this.camera=new Rs(t.width,t.height),this.batcherShader=i?ke.newTwoColoredTextured(this.context):ke.newColoredTextured(this.context),this.batcher=new Oi(this.context,i),this.shapesShader=ke.newColored(this.context),this.shapes=new Di(this.context),this.skeletonRenderer=new Ds(this.context,i),this.skeletonDebugRenderer=new Os(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(t,e=!1,i=-1,s=-1,r=null){this.enableRenderer(this.batcher),this.skeletonRenderer.premultipliedAlpha=e,this.skeletonRenderer.draw(this.batcher,t,i,s,r)}drawSkeletonDebug(t,e=!1,i){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.premultipliedAlpha=e,this.skeletonDebugRenderer.draw(this.shapes,t,i)}drawTexture(t,e,i,s,r,h){this.enableRenderer(this.batcher),h||(h=vt);var l=0;T[l++]=e,T[l++]=i,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=0,T[l++]=1,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+s,T[l++]=i,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=1,T[l++]=1,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+s,T[l++]=i+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=1,T[l++]=0,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e,T[l++]=i+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=0,T[l++]=0,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l]=0),this.batcher.draw(t,T,bt)}drawTextureUV(t,e,i,s,r,h,l,n,a,o){this.enableRenderer(this.batcher),o||(o=vt);var c=0;T[c++]=e,T[c++]=i,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=h,T[c++]=l,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=e+s,T[c++]=i,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=n,T[c++]=l,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=e+s,T[c++]=i+r,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=n,T[c++]=a,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c++]=0),T[c++]=e,T[c++]=i+r,T[c++]=o.r,T[c++]=o.g,T[c++]=o.b,T[c++]=o.a,T[c++]=h,T[c++]=a,this.twoColorTint&&(T[c++]=0,T[c++]=0,T[c++]=0,T[c]=0),this.batcher.draw(t,T,bt)}drawTextureRotated(t,e,i,s,r,h,l,n,a){this.enableRenderer(this.batcher),a||(a=vt);let o=e+h,c=i+l,u=-h,d=-l,m=s-h,f=r-l,g=u,w=d,b=u,p=f,x=m,v=f,y=m,A=d,C=0,S=0,k=0,R=0,Y=0,F=0,L=0,I=0;if(n!=0){let B=P.cosDeg(n),ie=P.sinDeg(n);C=B*g-ie*w,S=ie*g+B*w,L=B*b-ie*p,I=ie*b+B*p,Y=B*x-ie*v,F=ie*x+B*v,k=Y+(C-L),R=F+(S-I)}else C=g,S=w,L=b,I=p,Y=x,F=v,k=y,R=A;C+=o,S+=c,k+=o,R+=c,Y+=o,F+=c,L+=o,I+=c;var M=0;T[M++]=C,T[M++]=S,T[M++]=a.r,T[M++]=a.g,T[M++]=a.b,T[M++]=a.a,T[M++]=0,T[M++]=1,this.twoColorTint&&(T[M++]=0,T[M++]=0,T[M++]=0,T[M++]=0),T[M++]=k,T[M++]=R,T[M++]=a.r,T[M++]=a.g,T[M++]=a.b,T[M++]=a.a,T[M++]=1,T[M++]=1,this.twoColorTint&&(T[M++]=0,T[M++]=0,T[M++]=0,T[M++]=0),T[M++]=Y,T[M++]=F,T[M++]=a.r,T[M++]=a.g,T[M++]=a.b,T[M++]=a.a,T[M++]=1,T[M++]=0,this.twoColorTint&&(T[M++]=0,T[M++]=0,T[M++]=0,T[M++]=0),T[M++]=L,T[M++]=I,T[M++]=a.r,T[M++]=a.g,T[M++]=a.b,T[M++]=a.a,T[M++]=0,T[M++]=0,this.twoColorTint&&(T[M++]=0,T[M++]=0,T[M++]=0,T[M]=0),this.batcher.draw(t,T,bt)}drawRegion(t,e,i,s,r,h){this.enableRenderer(this.batcher),h||(h=vt);var l=0;T[l++]=e,T[l++]=i,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u,T[l++]=t.v2,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+s,T[l++]=i,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u2,T[l++]=t.v2,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e+s,T[l++]=i+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u2,T[l++]=t.v,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l++]=0),T[l++]=e,T[l++]=i+r,T[l++]=h.r,T[l++]=h.g,T[l++]=h.b,T[l++]=h.a,T[l++]=t.u,T[l++]=t.v,this.twoColorTint&&(T[l++]=0,T[l++]=0,T[l++]=0,T[l]=0),this.batcher.draw(t.page.texture,T,bt)}line(t,e,i,s,r,h){this.enableRenderer(this.shapes),this.shapes.line(t,e,i,s,r)}triangle(t,e,i,s,r,h,l,n,a,o){this.enableRenderer(this.shapes),this.shapes.triangle(t,e,i,s,r,h,l,n,a,o)}quad(t,e,i,s,r,h,l,n,a,o,c,u,d){this.enableRenderer(this.shapes),this.shapes.quad(t,e,i,s,r,h,l,n,a,o,c,u,d)}rect(t,e,i,s,r,h){this.enableRenderer(this.shapes),this.shapes.rect(t,e,i,s,r,h)}rectLine(t,e,i,s,r,h,l){this.enableRenderer(this.shapes),this.shapes.rectLine(t,e,i,s,r,h,l)}polygon(t,e,i,s){this.enableRenderer(this.shapes),this.shapes.polygon(t,e,i,s)}circle(t,e,i,s,r,h=0){this.enableRenderer(this.shapes),this.shapes.circle(t,e,i,s,r,h)}curve(t,e,i,s,r,h,l,n,a,o){this.enableRenderer(this.shapes),this.shapes.curve(t,e,i,s,r,h,l,n,a,o)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(t){let e=this.canvas;var i=window.devicePixelRatio||1,s=Math.round(e.clientWidth*i),r=Math.round(e.clientHeight*i);if((e.width!=s||e.height!=r)&&(e.width=s,e.height=r),this.context.gl.viewport(0,0,e.width,e.height),t===1)this.camera.setViewport(s,r);else if(t===2){let h=e.width,l=e.height,n=this.camera.viewportWidth,a=this.camera.viewportHeight,o=a/n,c=l/h,u=o<c?n/h:a/l;this.camera.setViewport(h*u,l*u)}this.camera.update()}enableRenderer(t){this.activeRenderer!==t&&(this.end(),t instanceof Oi?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(ke.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):t instanceof Di?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(ke.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}},Ns=(t=>(t[t.Stretch=0]="Stretch",t[t.Expand=1]="Expand",t[t.Fit=2]="Fit",t))(Ns||{}),Ze,Ue,Ui=0,sn=1,Wi=1,yt=165,At=108,Ee=163,Us=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new ot;backgroundColor=new V(.135,.135,.135,1);tempColor=new V;constructor(t){if(this.renderer=t,this.timeKeeper.maxDelta=9,!Ue){let e=navigator.userAgent.indexOf("Safari")>-1,i=()=>Ui++;Ue=new Image,Ue.src=nn,e||(Ue.crossOrigin="anonymous"),Ue.onload=i,Ze=new Image,Ze.src=rn,e||(Ze.crossOrigin="anonymous"),Ze.onload=i}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(t=!1){if(Ui<2||t&&this.fadeOut>Wi)return;this.timeKeeper.update();let e=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(e,5));let i=this.tempColor,s=this.renderer,r=s.canvas,h=s.context.gl;if(s.resize(1),s.camera.position.set(r.width/2,r.height/2,0),s.batcher.setBlendMode(0,!0),t){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>Wi)return;i.setFromColor(this.backgroundColor),e=1-this.fadeOut/Wi,e=1-(e-1)*(e-1),i.a*=e,i.a>0&&(s.camera.zoom=1,s.begin(),s.quad(!0,0,0,r.width,0,r.width,r.height,0,r.height,i,i,i,i),s.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(h.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),h.clear(h.COLOR_BUFFER_BIT)),e=1;e*=Math.min(this.fadeIn/sn,1),i.set(e,e,e,e),this.logo||(this.logo=new _e(s.context,Ue),this.spinner=new _e(s.context,Ze)),s.camera.zoom=Math.max(1,Ee/r.height),s.begin(),s.drawTexture(this.logo,(r.width-yt)/2,(r.height-At)/2,yt,At,i),this.spinner&&s.drawTextureRotated(this.spinner,(r.width-Ee)/2,(r.height-Ee)/2,Ee,Ee,Ee/2,Ee/2,this.angle,i),s.end()}drawInCoordinates(t,e){if(Ui<2)return;this.timeKeeper.update();let i=this.renderer;i.batcher.setBlendMode(0,!0),this.logo||(this.logo=new _e(i.context,Ue),this.spinner=new _e(i.context,Ze));const s=t-yt/2,r=e-At/2;i.drawTexture(this.logo,s,r,yt,At),this.angle-=this.timeKeeper.delta*500,this.spinner&&i.drawTextureRotated(this.spinner,s,r-25,Ee,Ee,Ee/2,Ee/2,this.angle)}},rn="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+PYCn1bHzDZxvaQW6vZzto7MYnQIpNkf7kp5EuozYUroqEjcNKHHd0Tl9mBPN1pk+hFeieGBnBtog7UXjsj9pWg+m6duecw2cay1OC/uxMC47KmP9OIYfoz1YoC20J/rzRG4quTZK2EAyJGs20qwUbYw0aNRmUxtvfUW/uEtNzc1NB1/X8LVyd15hh82F43AvD+VlXcsSJEZa1CQ3ejleAO7oxR3RDP0XN91X4+NXYb8nkv7UNTwV7e0YTdu7I3g33t7tuaEbNwSZpps2fSyvs4M2Tjhot+jb0Xzbltj8r5j/xVt/6Z1Ob93U1ZYO691EhhzchcHeXosVjcNZysyezLw4xRZt05R+fTeuj8vOj+zKyG0j2aZcVVs6v+QalnjrMFZASQYl2nBoSyz06e3j/Xk8rgWYmMvEICu2pm1HOTuc7okV8FgRj0XukwzanhvCc/F+72TjoQjdObN1OFuDLmh0xP+WHtxiI10ukJlCprb4guiv1fP+avZrS1C7NAkliHZjDtZwMMgqbukAltpMlwuMy2FcEBPqvfLLar5Uqi0hBdEwryy+Mv5n6zkbjTBa+dlMlwvUZFETZKGiFM7tvbhdJ3gSVRO0wzIjnxmvl/J6a6JsGMYGrahtpssFeqbR841S3mhN80OjOaSDEdqd6SjaMKgzgzRK7q1ib3PT9sYyNo7JZoyNFNvRcVMZmy7WOvIuryv/Zvdmdt90+nY0bRp3AvROohFwdwW7dTG7RFlbwlqdrbOBYg005NAQmZU0HWt1rXMBH1Xw0dQ8pmqzoaPmdhun7bHZjNVe9qP9eFQfO1VkUmHjhAVUZ1GtnKFSbjrkrPfy4i4UW5t/6ZxM54J0CqxFe81KpGsQyE4h23oYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjLna+bdOy+IiFquIpGq16Pb79cNYv3IIK/X/ugx+Ui6TVKvYVU9Nc8gX8od8Ir/IN/KPfCQ/yVfyl/6/pfJvLChkQdD6wyqntquCXYuKWJSfRr6D0dEAxV3xlw/khyD+kd/ku/88cHo+09tS3LBpO1HHCVUqcIA6CqB4K+6X6x35L/JM2loXurlWmUmlA5XogOIcK8/If5HncrSWo7F6cKIWPjT/RXGOlWfkv8hzaWsN4uaaysE6WIkOKM6x8oz8F3kusXqo2vxC5jtYiQ4ozrH0TeS5qIZcrB7qkrwdA8U5Vp6R/yLPZV8V+2L14Cl5THGwEh1QnGPlGfkv8lyUlIzFQ1cNYVVHrcjZ0VCcFe9Y+Eb+izy3ceclUl43aFN52DXXssYpnY6a4qFS8ZcP2uIf+e7inRh6pdFrdTGrm8uiHx/L8T2V7NGWzvJBLJ/bl7mTuzO5qBNFDoiJID/IF/KHfCK/yDfyT3O7d/KbfNfS80hNIrU0g9L6HOq1x5iTQo6FNpeLfCQ/yVfyl3xmXYwxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHNk9z4JwJ0SqKTdQkbyEwhU393T6V7zzR6pieR3tE1ITeVXImhe6BXDGZFdRbVeank2TBhcaEMr0rwbixj49IBLL2/L/ffmMuNHfqO9tFZjJYBd1ewO3Lx+IcVfKhqna5nHZYR6XFPH+5R3eeI5t9fx/fvjeC9Jdew5OKZKqFR/RDVKL6vL/f9PJafmyvHsL+a/ff24V6NmjZQbGchVbY6UM2BluqHv1rCqzVZ1KQlkZboepCdQvacPsz5bjTfXao+yMEaDt7Wk9tSIMVGig3TejCtJSM2bSpkPjWPqd1S6Zao+lORSYWmgkOjORRNwZqd5ezMSiHLRooNr5XwWjS6/1XHX9vL2T67N7M1iyXa9JCrYjVrS1gbpJyw6hBfsmiNCYT0P9/A+Wj1/6qGr5YNYFlJBiWJogEzezLz/ZG8/9s4fgtSyuvNYbyp1IONFBtu7sHNv4/j9yAxUHWrdaWsG9+N8XHd+YxkMpSy+aySz841cC5oXbmHCnnI74yxAgZ3YbDeB4PEQCOpBpFNZWwa2ZWRcdnxLsl00crtRB0n2lLg8JNRfDKoM4NsolgBSmw/UMADba1+qpmqfyf6x1u/0a/og3I+aEunP6/i86osqmygcGarF4p54dex/Bo0LqfqOfVwIQ/HW5/RSkwV1oN2WLlHTc82TljAwM4M1O5LWwYKZTjibYXNS0N5KcjKTe10PadfLObFuJwK4ozp+UzXDBTUjL+M5ZcBnRkQV53dMIwNQTu6bSTbVEzbi5awuVByd2E/FgaN0Tc1fKOzBHHV2aAdVSdv6s5NNkp7cSH/++xAng2yyHx+CM/H21YhfdPp+0U1X0TbSZnXx8faG9Aop0MS0cToh1p+iLcpOkLj9t/JOk5eqoPHxnDsyf486an5yqCDK7XZ1O4oZ4dWyy3FSXHUAYq47uyYbMZoGmhpG3DlEFb6uNiVBhpyaHhnBO8oJmfqOROJjzIiP43hJ8UxITqqX56S2Hur2KsOnq3nrE6PPNKPRwrSKbAZrjTQNZmuE7oxYXMZmxWbw9dxWFu4W4ezVedOE6qzI7oyYkY+M7TPeWsPbk2UX1qioSN+E3OZqOR2cReKE+qQRFN0Pi7y73g/UawU1KzezJpXwLz5hczX1ueUPKYkNb6GJQZ+j7/aAfRZREsv+quGsMoamXZBW2Gt5eU0alorEzYsKmJRa/m4NdeyxlqZsCGa84DKnVorEzboC7podis69DfIJmwufHMc7famvvmxZiYsKOtKWbRm1OcW1syEBboSJFozLh/EcmtmwgIluaM14/phrLdmJixYXMTiaM24p5I91syEBTphFOR7Y2tmwgJNvUFOr+tov3UzoaAv44KYUatv62ZCoemdhtG0+hzqrZsJBR08DWLG0gxKrZu50qvpxos3U5NItW4mFPp1ot+lPlpq2lYXs9qamVBZUMiC1ox4pJYjvlfStAu6GmTLcLboMtPIV4/6im5fFfuUi9QIap2MiWP+D96R1vPmsD/fAAAAAElFTkSuQmCC",nn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKUAAABsCAYAAAALzHKmAAAQ7klEQVR42u3da4xdVRUA4D0zd2Y6nZY59DVtZ1puS9+lzC0YAi2UQ8AAQczFpPgA9VIeIQbirRqJ0cBUBVGjDr/QCKSNRSMmpuODxAdxqhgwxkhFjf6Sxh/+UUNVNGJCzR7uTvas7LXX2q9zzp3em6y0gTN3Zu75utZe5+yztxC9V+/Ve5X9En1Vjd7J6SFbLNF7naPw+l2jh7YHMBWssqMHtlsRdim4qsLtIawaPiHEQOLoNrA9iIkQDnRrVA1qD2LZ8ISoxYqKo13sQAtBWBayQWZUAXGRQM9JjCngDVY0UqJNDbQrMcaGmArdUKpIjbYiQLsCZCyIMQBy8QwnilR4Q5AuCpxFYvRFmBLbEiwKwpsSaWycVQGZBKMrwBjA9BhxDe57u2L2hOoKNCbOrgAZitEVYUxoKSMErQvSxYIzCkguRg5EF4AUhqUlhy/YUKSxcRaKsioYOQhD4I0yYxkR3PcJBcuFysmgsXAWBTMJyBCMIQh9kGGxXIXvexCQXbHGAMrBWTbM2CCpMSMLIxehC77lSJwXGth7M0FzoVJIXXDWQnGmhOkL0ic7YhhtWdGGkAuPAjUWGoF4faCmwBkbZmyUqUCyMqMLRA4+E6IsdTjidUHKBYrh9CnpRcH0ypKxsyOGEYNIIeTCOz91OIJ1QYoB5eAMyZo+MFNnyVTZ0YiRC9EGEMOyAgshxErHsL2XK1gOUgwohtM1a5YNM7Rsu4K0ZkcbRm4mpPBRwFZ5hg9eCqkrUB+csWGGogzNkqEgrdnRhpGLkINudaLgwvVB6oqzCjCTZElb2Y4B0gUjBtEG0ARnDRLjjoG9DwcshtQGlIPTljVjwUySLWNkyRCQVHa0ZUUTRAwgF91a33BEy0VKAcVwwqwZC2bqbOlUurllOxQkJzNyINoAYqjWhYYjWg5SCiiG05Q1U8FMjTIoS8YE6YORi1BHtJ4KIcQEEtTXUWAxpK44YVlPBdO1jCdFWTZIE8bVGEYMIRPcZGBw4HKQcoBiOE1ZMzbMgVQwU6JMAdKEEcuIJogUvg1YCCE2gsCO42DlIIVAKZwpYJaSLVNnSU6XjYHUmxhTmXaFaMO3EYkLqMC+FsLlIoVAKZzMrEnBhJeLfLNlKMrYWRIDCbOkFSSVHbHM6AKRC6/ODUewNqQ+OLlZkxpjUmV8MBbMUJSxyzY3Q1IgTRgxiBRCHdem0KDAUkBh9sRwwjEnAXMMgTnKhFlUtiwkS5rGka4g9SaGgxFmRC7AzTCEEBcyA36dDSsXqAtOLkysjGMwY5XxVChjZ0kuSCo7YlkRQsQQYtDEFsegsLoCxUp7Kpgps2UslFGzJGccSYHUmxhOZqwzEZqAbfUMCisHKIZzgsCpl3MTzMwTpi1bYp2477gyFKUxS7qWbdjY2EBS2dGE0QQRA7gNCyHEdhjE8RhUDlBT9tzgmjWZMFNlSy+Urk1OzCyJlW0XkK4YOQh1cDtcgwBrQmoDWkdgboBZE8mYsJSHlnFbJ+5bwmOPJ7lZkirbC8aRsMvmgtTHjBhGE0QbwJ2egUE1ITVlUC5OmDVdYNrKuN70xM6WoShjlW4464dbtiFIWK6x7GjESEHUUe0iYncnbMdQSE0Z1ITTNOb0hRmjjLtmS9dmJ2rp1jtuKktyyrb6YLEMCUHq2dGG0QQRQ7f72kzc+cJecerne8Wvv7JNPHPvenEkz8Sh3UtFc92QyGt9Yko/HgOLAIUZlItTz5ouMF3KuE+2jFLCQ1D6lm6fLMkBacuOJowYRBUXyfjuHjF3NhdnsfjvAfH6E9vFt9XxKgikEKgJZyyYalzOLeMu2bLbULI6bh+QGwmQ+rgRlumdGEQAao+K56bEL2woVUwOiev0r8OAUjiJrMmFCbvykGxZRAmPitK1dHM7bohyMsuyi/I8f0+e57fJYIKEZXpXo9E4mOf5XTKyLLvCBLETF8uY2SKepkC+dpX4T02Ivepr4HvZcOZ5fmee54fyPL+DmTUhzAs6n4n8bN5dr9f3YdkSg8nsxG0lPBVKVpNjG0/aGhzfLDmRZdnumZmZp8+c+cdZPV555fSr7Xb7s0jJ3i5Pcue4MxKkPPkvvXTqz/B92u32l0wYOzG1fkhcd/py8Rcbyq/vFM/KY1WA95h/3zzP71bfU6JsNpsfgj+P/FlbrdaDGExYyuXvLz8H+DudODH700ajcSM3W6Yu4alQ1spCOTd38jcKocTZbh9+9NixY99XJ8AEUkcpo9W64yH197m5k7+bnZ19QT+J09NHntQhwji/Jg58qi6++ofLxJ8gSFneVw2Ka4QQDfh1Ok4dZavVmtZ/nrm5k7/Vf55O1tRhboUw5+ZOvqyOl5+R/FyOHj32PYVU/tloNG5IXcKrhJIzngwp3fNjomazea/64BuNxts646f50lWv169utw9/DmtqdJQyZFaSJVuV6nq9fqMEof5/vV6/CYBqgJDlee+yAbF/+4i4ZWqZeNfaIfHWzn+Hx0KcEuU9+s8jv3ej0bhVlXOZydX/k0iRMeb8P0D5e6tj8zy/Xb9UJIc56h/yqVOnXul8lmuZ2bJslKmbHG7XrbpCmCXFRLvdfqQD6jTS3Jiy5I4OykM6ADV+1Eu1DmV6evopBORexzDi1L+X/HnGxsb2w3Hm9PSRJ9QxWPOTZdmlKht2hi+w6dkox5bqffI8fye3hDteGqKaHVsHXihKl0tB+h0cY+lute54AGRKDCW89LNTRynHb7ChUWVVjetOnJh9EYBUyPZeNCoOtsbFQwdXi4/esELcd+tq8cCHJ8UXp+viy9efLz7AgamjlKXc1AA1m83DoIRDlFubzeb96hhZLVTlgJ24gttutx+ONa50bHZKRenaeTs1OfpAfnr6yOOdE7EZdNwmlKocntXLNkA5JTGq47Ds+Lf94lWsyfnXleLfnIwJUN4DOnNYwuUxh2A3Ln9XULrfK8t3J27Tu3BVwiOjXJqoAy8UZej1yclGo3GTLN+gu3w+z/P3YaWbQqk3Ne12e4ZC+c8rxWsYytcPiP9RpZxCqWDKnxOiBNlyAUpOnGsoh4tA2Rm8X9xqtT6md5wyZmYe+0YRKL+1S/wYQ3n8zctBl5SBUv5djivfjMOPduIzcizeiYfr9foVvUwZG+XCuzibZKnSceZ5/v4QlKp8y7ElhnJlTeTP7BI/kllRYfzrfvHqFy4UX1vaL/aVlSmROzwbwdS29T2UcEwZF+V8ozM2lu1VY812u/15akypGh3TmFJesJbHHD167IdUxz3YJy5bNySuX1mbvy55CbMLtzU6tjGlsdFptVqfUMc0Go23F4wy1l2dSnbfvpMwVPe9WWVLDsrOJaF9MFu2Wq1PqmNkGce67xiXhTjdNwdlvV6/BgxfbPfBfVCetxi6b9/rlCup65QzM48dl2OjLMv26CibzeZ96sTIzEFdpwQXz9U1yrtVlpR/Zll2Fec65Y6l4pbbx8XHH9kknvzJlPjlHy8Tp29eKT5ou0aJoIT3w3dBlLDzVpfAJEZ1XOdaJZxnOSlvPMjPzxFljIvng914RwebsjYO7uhMyHu46sOfnf3Oz2TXDW6vvYxdFoIXz3Wc8J5zs9n8iOn2IrxTc2BM3Glqdp7dI553uaOjxrhwcob+MyuUpjs6WZZdon8OcigjPx8V+u+GTWFTSWEx3WYcdJ225jNDSE4q0GHCzlueHOyujn6bUWYgeb9ZZUaQPe+GzQ+Gc8+oOGhC+c1d4gfI16n3XDAhQ7+9qE9l01E2Go132GYKyXE1NiFDTcpoNpv3LOYJGWXNErJNW9sEp63p2RKiVPMn1bS1DgxsyhoGdGpmizj+xtXiDYnx7/vFmce3iWdW1cTVGEY4hQ2ZW0nNq8Qm/M6XbXm3S100lwGedFybuvNOibLI+ZS2ceU4eAxiEuvCkfmU8ycToDxETe6FgCBQHeqyAbFvfEhcO7BwDuXFCEbTZF840XeHK0jYcbs2OIGle0mVJ/mmnClEPQqxyTY5I8/zFhif7fSZee4bnrPOU4AssnRXHaVTCTd14dRDY3UbTIiSeFhsN/aMjgnqthFx880rxX3yATL5p3y4LPXzOaBkUyBjZMlYpbtQlIOBD475ZEusjMNSvkXe6VEoJVDkeZ2dzIfIFsRzU+JF2OyM9M9fTC/6SUYOyFQPjQ2nWiUjxnPfw5EeHqMWIqAeIFsAU847lJM2JM6xsewt1OIDLs99P7ZFHNdB/upS8XtPiD7PfLuCXJNolYyyFiNI/Zit65ItrOVafFbHcFohY7hPTN21Tjz4uc3iqfsnxKdX1MTl1OoYRFaMsToGB6Trw2JFP/OdZC2hJZ7ZkrMoAbbSGmelDJ91hFKuJeS7jlBMkJnrAqqJlgMUZS/dArPlGHNdSg5M3xXXtvquuEatvIYtDRhpxbUJuIgqsU5lGWtUploK0KuEU9mSW8YpmFQ556xNuYW7NiW13B+FkMiKHIy+C6eGgBxJvMR0oSv5hi6+z4HJyZoU0M2RVvDlrOQbcxVfX5AhZbuqy0v7ZstYMLHlAVlLTF9ALLbvu9Y5Zylpn/XOsd0ibIvxr2KCLHpp6SCUIdnSZSF+WzfOhem6GD+1KwR3Z4jNjrtDpNoZwmWd8yrupZN6Hx3fbMmFSe0Swdq2ZIPjxk1112Duo8OBGLrBkw/IoncdK2XHsdC9dHz204m50xh3tzFq1zFqtzHXrfCw7OgDsqyNnZLszVijsmXgrmNcmGtS78lIoMX2aJz03fKO2sDJddPQSCDPiQ1DfWBycY6XtXstc2PQKuxgG2McmXTPb9/9vmuJYXKyJrWjbeg+3xPM4O73nWqvbyw7xgZZSJbEUBa157cNJjdr2vb+5iA1YV3HxYscj30PDCEHIgcjtfm8K8hSsmRotkwFk5s1TTghUAopB6xrjHMBBkI0YYTZ0dZlxwLpkiWDULpmy5gwqayZgZNkA7oKQQCxctByYg0XIIEQQuRitGVHblMTA2ShKGPDpC6wu+DEgJqg2rDGDBtAF4Q6RAojp1xXGmSMbImVcR+YWNY04eQCtUG1ofUJ2/uvcETIgUhhdAE5GAlkKShjwHTNmhhODKgJqQ2sC14uOgyfD0IbRF+MlQaZAiZWyn2yJsTJATqGnHQO2Jhh+xlsACFCG0QbRtdyzQFZCZSxYPpmTS7Q5cjJHYNBYIkZpu99HoUQ/o4QIYSIZUZfjJ4ZMjZI32wZBDMU5yhy8pZTULl4XYP5fagMyEVoy4oupTpGduwnkloSlKEwY+AcQU4MhRTD6ovXBRwFzwWgCSEF0QVjJUGmgEllTS5OLlCIlIN1mS9mx/cZ5eLDALpCTI2RAhkTZQqYoTgpoCPECbaBHQ2ETL3PUl98ECAXYijG0OyYAmQoTG7W5ODkAF1CnVgm2JQx4okPA+gCMTbGskBGgRmaOblAh5GTORIrfKFx4VH4EIAxIXIxlg2SBbMvECY3e7oApbDaIgQu5/2HmeEKEINYiwSRi7EQkLFgumZOCuggctKGI4ULZN/vMeSLj0AYMytWEqMLzFg4fYDaoKaC6wvOFR4FkIPQFaILxrJAOsHsc/zlfYDWXE8qF22s8Pz5KHxcgEVALBtjJXBSSEOwFhk1Zgy4hitCT4hVw+gFs8/zwxqIBbUgyK7fcyA0PD9XX4iVxhiC0xdof6STWCsoBmKF7+cVCWFXQYyBMxRpf+STX1b0x45AhN0OMSrOGEirhrY/dfQAdjvS7oy+WCF6r1RIFxXWvlTRg1YVqFWBmxZbD99ig9pt0YPQw9rD1nstVri9V+/Ve3XrS/wfim4P5fIFxLoAAAAASUVORK5CYII=",an=class{constructor(t,e){this.config=e,e.pathPrefix||(e.pathPrefix=""),e.app||(e.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),e.webglConfig||(e.webglConfig={alpha:!0}),this.htmlCanvas=t,this.context=new ge(t,e.webglConfig),this.renderer=new Ni(t,this.context),this.gl=this.context.gl,this.assetManager=new Xi(this.context,e.pathPrefix),this.input=new nt(t),e.app.loadAssets&&e.app.loadAssets(this);let i=()=>{this.disposed||(requestAnimationFrame(i),this.time.update(),e.app.update&&e.app.update(this,this.time.delta),e.app.render&&e.app.render(this))},s=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?e.app.error&&e.app.error(this,this.assetManager.getErrors()):(e.app.initialize&&e.app.initialize(this),i());return}requestAnimationFrame(s)}};requestAnimationFrame(s)}context;time=new ot;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(t,e,i,s){this.gl.clearColor(t,e,i,s),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}},ln=class{constructor(t,e){this.config=e;let i=typeof t=="string"?document.getElementById(t):t;if(i==null)throw new Error("SpinePlayer parent not found: "+t);this.parent=i,e.showControls===void 0&&(e.showControls=!0);let s=e.showControls?`
|
|
<div class="spine-player-controls spine-player-popup-parent spine-player-controls-hidden">
|
|
<div class="spine-player-timeline"></div>
|
|
<div class="spine-player-buttons">
|
|
<button class="spine-player-button spine-player-button-icon-pause"></button>
|
|
<div class="spine-player-button-spacer"></div>
|
|
<button class="spine-player-button spine-player-button-icon-speed"></button>
|
|
<button class="spine-player-button spine-player-button-icon-animations"></button>
|
|
<button class="spine-player-button spine-player-button-icon-skins"></button>
|
|
<button class="spine-player-button spine-player-button-icon-settings"></button>
|
|
<button class="spine-player-button spine-player-button-icon-fullscreen"></button>
|
|
<img class="spine-player-button-icon-spine-logo" src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20104%2031.16%22%3E%3Cpath%20d%3D%22M104%2012.68a1.31%201.31%200%200%201-.37%201%201.28%201.28%200%200%201-.85.31H91.57a10.51%2010.51%200%200%200%20.29%202.55%204.92%204.92%200%200%200%201%202%204.27%204.27%200%200%200%201.64%201.26%206.89%206.89%200%200%200%202.6.44%2010.66%2010.66%200%200%200%202.17-.2%2012.81%2012.81%200%200%200%201.64-.44q.69-.25%201.14-.44a1.87%201.87%200%200%201%20.68-.2.44.44%200%200%201%20.27.04.43.43%200%200%201%20.16.2%201.38%201.38%200%200%201%20.09.37%204.89%204.89%200%200%201%200%20.58%204.14%204.14%200%200%201%200%20.43v.32a.83.83%200%200%201-.09.26%201.1%201.1%200%200%201-.17.22%202.77%202.77%200%200%201-.61.34%208.94%208.94%200%200%201-1.32.46%2018.54%2018.54%200%200%201-1.88.41%2013.78%2013.78%200%200%201-2.28.18%2010.55%2010.55%200%200%201-3.68-.59%206.82%206.82%200%200%201-2.66-1.74%207.44%207.44%200%200%201-1.63-2.89%2013.48%2013.48%200%200%201-.55-4%2012.76%2012.76%200%200%201%20.57-3.94%208.35%208.35%200%200%201%201.64-3%207.15%207.15%200%200%201%202.58-1.87%208.47%208.47%200%200%201%203.39-.65%208.19%208.19%200%200%201%203.41.64%206.46%206.46%200%200%201%202.32%201.73%207%207%200%200%201%201.3%202.54%2011.17%2011.17%200%200%201%20.43%203.13zm-3.14-.93a5.69%205.69%200%200%200-1.09-3.86%204.17%204.17%200%200%200-3.42-1.4%204.52%204.52%200%200%200-2%20.44%204.41%204.41%200%200%200-1.47%201.15A5.29%205.29%200%200%200%2092%209.75a7%207%200%200%200-.36%202zM80.68%2021.94a.42.42%200%200%201-.08.26.59.59%200%200%201-.25.18%201.74%201.74%200%200%201-.47.11%206.31%206.31%200%200%201-.76%200%206.5%206.5%200%200%201-.78%200%201.74%201.74%200%200%201-.47-.11.59.59%200%200%201-.25-.18.42.42%200%200%201-.08-.26V12a9.8%209.8%200%200%200-.23-2.35%204.86%204.86%200%200%200-.66-1.53%202.88%202.88%200%200%200-1.13-1%203.57%203.57%200%200%200-1.6-.34%204%204%200%200%200-2.35.83A12.71%2012.71%200%200%200%2069.11%2010v11.9a.42.42%200%200%201-.08.26.59.59%200%200%201-.25.18%201.74%201.74%200%200%201-.47.11%206.51%206.51%200%200%201-.78%200%206.31%206.31%200%200%201-.76%200%201.88%201.88%200%200%201-.48-.11.52.52%200%200%201-.25-.18.46.46%200%200%201-.07-.26v-17a.53.53%200%200%201%20.03-.21.5.5%200%200%201%20.23-.19%201.28%201.28%200%200%201%20.44-.11%208.53%208.53%200%200%201%201.39%200%201.12%201.12%200%200%201%20.43.11.6.6%200%200%201%20.22.19.47.47%200%200%201%20.07.26V7.2a10.46%2010.46%200%200%201%202.87-2.36%206.17%206.17%200%200%201%202.88-.75%206.41%206.41%200%200%201%202.87.58%205.16%205.16%200%200%201%201.88%201.54%206.15%206.15%200%200%201%201%202.26%2013.46%2013.46%200%200%201%20.31%203.11z%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M43.35%202.86c.09%202.6%201.89%204%205.48%204.61%203%20.48%205.79.24%206.69-2.37%201.75-5.09-2.4-3.82-6-4.39s-6.31-2.03-6.17%202.15zm1.08%2010.69c.33%201.94%202.14%203.06%204.91%203s4.84-1.16%205.13-3.25c.53-3.88-2.53-2.38-5.3-2.3s-5.4-1.26-4.74%202.55zM48%2022.44c.55%201.45%202.06%202.06%204.1%201.63s3.45-1.11%203.33-2.76c-.21-3.06-2.22-2.1-4.26-1.66S47%2019.6%2048%2022.44zm1.78%206.78c.16%201.22%201.22%202%202.88%201.93s2.92-.67%203.13-2c.4-2.43-1.46-1.53-3.12-1.51s-3.17-.82-2.89%201.58z%22%20fill%3D%22%23ff4000%22%2F%3E%3Cpath%20d%3D%22M35.28%2013.16a15.33%2015.33%200%200%201-.48%204%208.75%208.75%200%200%201-1.42%203%206.35%206.35%200%200%201-2.32%201.91%207.14%207.14%200%200%201-3.16.67%206.1%206.1%200%200%201-1.4-.15%205.34%205.34%200%200%201-1.26-.47%207.29%207.29%200%200%201-1.24-.81q-.61-.49-1.29-1.15v8.51a.47.47%200%200%201-.08.26.56.56%200%200%201-.25.19%201.74%201.74%200%200%201-.47.11%206.47%206.47%200%200%201-.78%200%206.26%206.26%200%200%201-.76%200%201.89%201.89%200%200%201-.48-.11.49.49%200%200%201-.25-.19.51.51%200%200%201-.07-.26V4.91a.57.57%200%200%201%20.06-.27.46.46%200%200%201%20.23-.18%201.47%201.47%200%200%201%20.44-.1%207.41%207.41%200%200%201%201.3%200%201.45%201.45%200%200%201%20.43.1.52.52%200%200%201%20.24.18.51.51%200%200%201%20.07.27V7.2a18.06%2018.06%200%200%201%201.49-1.38%209%209%200%200%201%201.45-1%206.82%206.82%200%200%201%201.49-.59%207.09%207.09%200%200%201%204.78.52%206%206%200%200%201%202.13%202%208.79%208.79%200%200%201%201.2%202.9%2015.72%2015.72%200%200%201%20.4%203.51zm-3.28.36a15.64%2015.64%200%200%200-.2-2.53%207.32%207.32%200%200%200-.69-2.17%204.06%204.06%200%200%200-1.3-1.51%203.49%203.49%200%200%200-2-.57%204.1%204.1%200%200%200-1.2.18%204.92%204.92%200%200%200-1.2.57%208.54%208.54%200%200%200-1.28%201A15.77%2015.77%200%200%200%2022.76%2010v6.77a13.53%2013.53%200%200%200%202.46%202.4%204.12%204.12%200%200%200%202.44.83%203.56%203.56%200%200%200%202-.57A4.28%204.28%200%200%200%2031%2018a7.58%207.58%200%200%200%20.77-2.12%2011.43%2011.43%200%200%200%20.23-2.36zM12%2017.3a5.39%205.39%200%200%201-.48%202.33%204.73%204.73%200%200%201-1.37%201.72%206.19%206.19%200%200%201-2.12%201.06%209.62%209.62%200%200%201-2.71.36%2010.38%2010.38%200%200%201-3.21-.5A7.63%207.63%200%200%201%201%2021.82a3.25%203.25%200%200%201-.66-.43%201.09%201.09%200%200%201-.3-.53%203.59%203.59%200%200%201-.04-.93%204.06%204.06%200%200%201%200-.61%202%202%200%200%201%20.09-.4.42.42%200%200%201%20.16-.22.43.43%200%200%201%20.24-.07%201.35%201.35%200%200%201%20.61.26q.41.26%201%20.56a9.22%209.22%200%200%200%201.41.55%206.25%206.25%200%200%200%201.87.26%205.62%205.62%200%200%200%201.44-.17%203.48%203.48%200%200%200%201.12-.5%202.23%202.23%200%200%200%20.73-.84%202.68%202.68%200%200%200%20.26-1.21%202%202%200%200%200-.37-1.21%203.55%203.55%200%200%200-1-.87%208.09%208.09%200%200%200-1.36-.66l-1.56-.61a16%2016%200%200%201-1.57-.73%206%206%200%200%201-1.37-1%204.52%204.52%200%200%201-1-1.4%204.69%204.69%200%200%201-.37-2%204.88%204.88%200%200%201%20.39-1.87%204.46%204.46%200%200%201%201.16-1.61%205.83%205.83%200%200%201%201.94-1.11A8.06%208.06%200%200%201%206.53%204a8.28%208.28%200%200%201%201.36.11%209.36%209.36%200%200%201%201.23.28%205.92%205.92%200%200%201%20.94.37%204.09%204.09%200%200%201%20.59.35%201%201%200%200%201%20.26.26.83.83%200%200%201%20.09.26%201.32%201.32%200%200%200%20.06.35%203.87%203.87%200%200%201%200%20.51%204.76%204.76%200%200%201%200%20.56%201.39%201.39%200%200%201-.09.39.5.5%200%200%201-.16.22.35.35%200%200%201-.21.07%201%201%200%200%201-.49-.21%207%207%200%200%200-.83-.44%209.26%209.26%200%200%200-1.2-.44%205.49%205.49%200%200%200-1.58-.16%204.93%204.93%200%200%200-1.4.18%202.69%202.69%200%200%200-1%20.51%202.16%202.16%200%200%200-.59.83%202.43%202.43%200%200%200-.2%201%202%202%200%200%200%20.38%201.24%203.6%203.6%200%200%200%201%20.88%208.25%208.25%200%200%200%201.38.68l1.58.62q.8.32%201.59.72a6%206%200%200%201%201.39%201%204.37%204.37%200%200%201%201%201.36%204.46%204.46%200%200%201%20.37%201.8z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E">
|
|
</div></div>`:"";this.parent.appendChild(this.dom=Ve(`<div class="spine-player" style="position:relative;height:100%"><canvas class="spine-player-canvas" style="display:block;width:100%;height:100%"></canvas>${s}</div>`));try{this.validateConfig(e)}catch(r){this.showError(r.message,r)}this.initialize(),this.addEventListener(window,"resize",()=>this.drawFrame(!1)),requestAnimationFrame(()=>this.drawFrame())}parent;dom;canvas=null;context=null;sceneRenderer=null;loadingScreen=null;assetManager=null;bg=new V;bgFullscreen=new V;playerControls=null;timelineSlider=null;playButton=null;skinButton=null;animationButton=null;playTime=0;selectedBones=[];cancelId=0;popup=null;error=!1;skeleton=null;animationState=null;paused=!0;speed=1;time=new ot;stopRequestAnimationFrame=!1;disposed=!1;viewport={};currentViewport={};previousViewport={};viewportTransitionStart=0;eventListeners=[];input;dispose(){this.sceneRenderer?.dispose(),this.loadingScreen?.dispose(),this.assetManager?.dispose(),this.context?.dispose();for(var t=0;t<this.eventListeners.length;t++){var e=this.eventListeners[t];e.target.removeEventListener(e.event,e.func)}this.input?.dispose(),this.canvas&&(this.canvas.width=0,this.canvas.height=0),this.parent.removeChild(this.dom),this.disposed=!0}addEventListener(t,e,i){this.eventListeners.push({target:t,event:e,func:i}),t.addEventListener(e,i)}validateConfig(t){if(!t)throw new Error("A configuration object must be passed to to new SpinePlayer().");if(t.skelUrl&&(t.skeleton=t.skelUrl),!t.skeleton&&!t.jsonUrl&&!t.binaryUrl)throw new Error("A URL must be specified for the skeleton JSON or binary file.");if(t.scale||(t.scale=1),!t.atlas&&!t.atlasUrl)throw new Error("A URL must be specified for the atlas file.");if(t.jsonUrl&&!t.skeleton&&(t.skeleton=t.jsonUrl),t.binaryUrl&&!t.skeleton&&(t.skeleton=t.binaryUrl),t.atlasUrl&&!t.atlas&&(t.atlas=t.atlasUrl),t.backgroundColor||(t.backgroundColor=t.alpha?"00000000":"000000"),t.fullScreenBackgroundColor||(t.fullScreenBackgroundColor=t.backgroundColor),t.backgroundImage&&!t.backgroundImage.url&&(t.backgroundImage=void 0),t.premultipliedAlpha===void 0&&(t.premultipliedAlpha=!0),t.preserveDrawingBuffer===void 0&&(t.preserveDrawingBuffer=!1),t.mipmaps===void 0&&(t.mipmaps=!0),t.interactive===void 0&&(t.interactive=!0),t.debug||(t.debug={bones:!1,clipping:!1,bounds:!1,hulls:!1,meshes:!1,paths:!1,points:!1,regions:!1}),t.animations&&t.animation&&t.animations.indexOf(t.animation)<0)throw new Error("Animation '"+t.animation+"' is not in the config animation list: "+zi(t.animations));if(t.skins&&t.skin&&t.skins.indexOf(t.skin)<0)throw new Error("Default skin '"+t.skin+"' is not in the config skins list: "+zi(t.skins));t.viewport||(t.viewport={}),t.viewport.animations||(t.viewport.animations={}),t.viewport.debugRender===void 0&&(t.viewport.debugRender=!1),t.viewport.transitionTime===void 0&&(t.viewport.transitionTime=.25),t.controlBones||(t.controlBones=[]),t.showLoading===void 0&&(t.showLoading=!0),t.defaultMix===void 0&&(t.defaultMix=.25)}initialize(){let t=this.config,e=this.dom;if(!t.alpha){let i=t.backgroundColor;this.dom.style.backgroundColor=(i.charAt(0)=="#"?i:"#"+i).substr(0,7)}try{this.canvas=Xe(e,"spine-player-canvas"),this.context=new ge(this.canvas,{alpha:t.alpha,preserveDrawingBuffer:t.preserveDrawingBuffer}),this.sceneRenderer=new Ni(this.canvas,this.context,!0),t.showLoading&&(this.loadingScreen=new Us(this.sceneRenderer))}catch(i){return this.showError(`Sorry, your browser does not support WebGL, or you have disabled WebGL in your browser settings.
|
|
Please use the latest version of Firefox, Chrome, Edge, or Safari.`,i),null}if(this.assetManager=new Xi(this.context,"",t.downloader),t.rawDataURIs)for(let i in t.rawDataURIs)this.assetManager.setRawDataURI(i,t.rawDataURIs[i]);if(t.skeleton.endsWith(".json")?this.assetManager.loadJson(t.skeleton):this.assetManager.loadBinary(t.skeleton),this.assetManager.loadTextureAtlas(t.atlas),t.backgroundImage&&this.assetManager.loadTexture(t.backgroundImage.url),this.bg.setFromString(t.backgroundColor),this.bgFullscreen.setFromString(t.fullScreenBackgroundColor),t.showControls){this.playerControls=e.children[1];let i=this.playerControls.children,s=i[0],r=i[1].children;this.playButton=r[0];let h=r[2];this.animationButton=r[3],this.skinButton=r[4];let l=r[5],n=r[6],a=r[7];this.timelineSlider=new Ws,s.appendChild(this.timelineSlider.create()),this.timelineSlider.change=f=>{this.pause();let w=this.animationState.getCurrent(0).animation.duration*f;this.animationState.update(w-this.playTime),this.animationState.apply(this.skeleton),this.skeleton.update(w-this.playTime),this.skeleton.updateWorldTransform(2),this.playTime=w},this.playButton.onclick=()=>this.paused?this.play():this.pause(),h.onclick=()=>this.showSpeedDialog(h),this.animationButton.onclick=()=>this.showAnimationsDialog(this.animationButton),this.skinButton.onclick=()=>this.showSkinsDialog(this.skinButton),l.onclick=()=>this.showSettingsDialog(l);let o=this.canvas.clientWidth,c=this.canvas.clientHeight,u=this.canvas.style.width,d=this.canvas.style.height,m=!1;n.onclick=()=>{let f=()=>{m=!m,m||(this.canvas.style.width=o+"px",this.canvas.style.height=c+"px",this.drawFrame(!1),requestAnimationFrame(()=>{this.canvas.style.width=u,this.canvas.style.height=d}))},g=e;g.onfullscreenchange=f,g.onwebkitfullscreenchange=f;let w=document;w.fullscreenElement||w.webkitFullscreenElement||w.mozFullScreenElement||w.msFullscreenElement?w.exitFullscreen?w.exitFullscreen():w.mozCancelFullScreen?w.mozCancelFullScreen():w.webkitExitFullscreen?w.webkitExitFullscreen():w.msExitFullscreen&&w.msExitFullscreen():(o=this.canvas.clientWidth,c=this.canvas.clientHeight,u=this.canvas.style.width,d=this.canvas.style.height,g.requestFullscreen?g.requestFullscreen():g.webkitRequestFullScreen?g.webkitRequestFullScreen():g.mozRequestFullScreen?g.mozRequestFullScreen():g.msRequestFullscreen&&g.msRequestFullscreen())},a.onclick=()=>window.open("http://esotericsoftware.com")}return e}loadSkeleton(){if(this.error)return;this.assetManager.hasErrors()&&this.showError(`Error: Assets could not be loaded.
|
|
`+zi(this.assetManager.getErrors()));let t=this.config,e=this.assetManager.require(t.atlas),i=this.context.gl,s=i.getExtension("EXT_texture_filter_anisotropic"),r=i.getParameter(i.VERSION).indexOf("WebGL 1.0")!=-1;for(let c of e.pages){let u=c.minFilter;var h=t.mipmaps,l=P.isPowerOfTwo(c.width)&&P.isPowerOfTwo(c.height);r&&!l&&(h=!1),h&&(s?(i.texParameterf(i.TEXTURE_2D,s.TEXTURE_MAX_ANISOTROPY_EXT,8),u=9987):u=9729,c.texture.setFilters(u,9728)),u!=9728&&u!=9729&&c.texture.update(!0)}let n;try{let c,u,d=new gs(e);if(t.skeleton.endsWith(".json")){if(u=this.assetManager.remove(t.skeleton),!u)throw new Error("Empty JSON data.");if(t.jsonField&&(u=u[t.jsonField],!u))throw new Error("JSON field does not exist: "+t.jsonField);c=new Ms(d)}else u=this.assetManager.remove(t.skeleton),c=new Ss(d);c.scale=t.scale,n=c.readSkeletonData(u)}catch(c){this.showError(`Error: Could not load skeleton data.
|
|
${c.message}`,c);return}this.skeleton=new Ei(n);let a=new cs(n);a.defaultMix=t.defaultMix,this.animationState=new rs(a),t.controlBones.forEach(c=>{n.findBone(c)||this.showError(`Error: Control bone does not exist in skeleton: ${c}`)}),!t.skin&&n.skins.length&&(t.skin=n.skins[0].name),t.skins&&t.skin.length&&t.skins.forEach(c=>{this.skeleton.data.findSkin(c)||this.showError(`Error: Skin in config list does not exist in skeleton: ${c}`)}),t.skin&&(this.skeleton.data.findSkin(t.skin)||this.showError(`Error: Skin does not exist in skeleton: ${t.skin}`),this.skeleton.setSkinByName(t.skin),this.skeleton.setSlotsToSetupPose()),Object.getOwnPropertyNames(t.viewport.animations).forEach(c=>{n.findAnimation(c)||this.showError(`Error: Animation for which a viewport was specified does not exist in skeleton: ${c}`)}),t.animations&&t.animations.length&&(t.animations.forEach(c=>{this.skeleton.data.findAnimation(c)||this.showError(`Error: Animation in config list does not exist in skeleton: ${c}`)}),t.animation||(t.animation=t.animations[0])),t.animation&&!n.findAnimation(t.animation)&&this.showError(`Error: Animation does not exist in skeleton: ${t.animation}`),this.setupInput(),t.showControls&&((n.skins.length==1||t.skins&&t.skins.length==1)&&this.skinButton.classList.add("spine-player-hidden"),(n.animations.length==1||t.animations&&t.animations.length==1)&&this.animationButton.classList.add("spine-player-hidden")),t.success&&t.success(this);let o=this.animationState.getCurrent(0);o?(this.currentViewport.x===void 0&&this.setViewport(o.animation),t.animation||(t.animation=o.animation?.name),this.play()):t.animation?(o=this.setAnimation(t.animation),this.play()):(o=this.animationState.setEmptyAnimation(0),o.trackEnd=1e8,this.skeleton.updateWorldTransform(2),this.setViewport(o.animation),this.pause())}setupInput(){let t=this.config,e=t.controlBones;if(!e.length&&!t.showControls)return;let i=this.selectedBones=new Array(e.length),s=this.canvas,r=null,h=new Ce,l=new ve,n=new ve,a=new Ce,o=this.skeleton,c=this.sceneRenderer;if(t.interactive){let u=function(d,m){n.set(d,s.clientHeight-m,0),h.x=h.y=0;let f=24,g=0,w=null;for(let b=0;b<e.length;b++){i[b]=null;let p=o.findBone(e[b]);if(!p)continue;let x=c.camera.worldToScreen(l.set(p.worldX,p.worldY,0),s.clientWidth,s.clientHeight).distance(n);x<f&&(f=x,w=p,g=b,h.x=l.x-n.x,h.y=l.y-n.y)}return w&&(i[g]=w),w};this.input=new nt(s),this.input.addListener({down:(d,m)=>{r=u(d,m)},up:()=>{r?r=null:t.showControls&&(this.paused?this.play():this.pause())},dragged:(d,m)=>{r&&(d=P.clamp(d+h.x,0,s.clientWidth),m=P.clamp(m-h.y,0,s.clientHeight),c.camera.screenToWorld(l.set(d,m,0),s.clientWidth,s.clientHeight),r.parent?(r.parent.worldToLocal(a.set(l.x-o.x,l.y-o.y)),r.x=a.x,r.y=a.y):(r.x=l.x-o.x,r.y=l.y-o.y))},moved:(d,m)=>u(d,m)})}if(t.showControls){this.addEventListener(document,"mousemove",g=>{g instanceof MouseEvent&&f(g.clientX,g.clientY)}),this.addEventListener(document,"touchmove",g=>{if(g instanceof TouchEvent){let w=g.changedTouches;if(w.length){let b=w[0];f(b.clientX,b.clientY)}}});let u=(g,w,b)=>{let p=g-b.left,x=w-b.top;return p>=0&&p<=b.width&&x>=0&&x<=b.height},d=!0,m=!1,f=(g,w)=>{let b=Xe(this.dom,"spine-player-popup");d=u(g,w,this.playerControls.getBoundingClientRect()),m=u(g,w,s.getBoundingClientRect()),clearTimeout(this.cancelId),!b&&!d&&!m&&!this.paused?this.playerControls.classList.add("spine-player-controls-hidden"):this.playerControls.classList.remove("spine-player-controls-hidden"),!d&&!b&&!this.paused&&(this.cancelId=setTimeout(()=>{this.paused||this.playerControls.classList.add("spine-player-controls-hidden")},1e3))}}}play(){this.paused=!1;let t=this.config;t.showControls&&(this.cancelId=setTimeout(()=>{this.paused||this.playerControls.classList.add("spine-player-controls-hidden")},1e3),this.playButton.classList.remove("spine-player-button-icon-play"),this.playButton.classList.add("spine-player-button-icon-pause"),t.animation||(t.animations&&t.animations.length?t.animation=t.animations[0]:this.skeleton.data.animations.length&&(t.animation=this.skeleton.data.animations[0].name),t.animation&&this.setAnimation(t.animation)))}pause(){this.paused=!0,this.config.showControls&&(this.playerControls.classList.remove("spine-player-controls-hidden"),clearTimeout(this.cancelId),this.playButton.classList.remove("spine-player-button-icon-pause"),this.playButton.classList.add("spine-player-button-icon-play"))}setAnimation(t,e=!0){return t=this.setViewport(t),this.animationState.setAnimationWith(0,t,e)}addAnimation(t,e=!0,i=0){return t=this.setViewport(t),this.animationState.addAnimationWith(0,t,e,i)}setViewport(t){if(typeof t=="string"){let r=this.skeleton.data.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);t=r}this.previousViewport=this.currentViewport;let e=this.config.viewport,i=this.currentViewport={padLeft:e.padLeft!==void 0?e.padLeft:"10%",padRight:e.padRight!==void 0?e.padRight:"10%",padTop:e.padTop!==void 0?e.padTop:"10%",padBottom:e.padBottom!==void 0?e.padBottom:"10%"};e.x!==void 0&&e.y!==void 0&&e.width&&e.height?(i.x=e.x,i.y=e.y,i.width=e.width,i.height=e.height):this.calculateAnimationViewport(t,i);let s=this.config.viewport.animations[t.name];return s&&(s.x!==void 0&&s.y!==void 0&&s.width&&s.height&&(i.x=s.x,i.y=s.y,i.width=s.width,i.height=s.height),s.padLeft!==void 0&&(i.padLeft=s.padLeft),s.padRight!==void 0&&(i.padRight=s.padRight),s.padTop!==void 0&&(i.padTop=s.padTop),s.padBottom!==void 0&&(i.padBottom=s.padBottom)),i.padLeft=this.percentageToWorldUnit(i.width,i.padLeft),i.padRight=this.percentageToWorldUnit(i.width,i.padRight),i.padBottom=this.percentageToWorldUnit(i.height,i.padBottom),i.padTop=this.percentageToWorldUnit(i.height,i.padTop),this.viewportTransitionStart=performance.now(),t}percentageToWorldUnit(t,e){return typeof e=="string"?t*parseFloat(e.substr(0,e.length-1))/100:e}calculateAnimationViewport(t,e){this.skeleton.setToSetupPose();let i=100,s=t.duration?t.duration/i:0,r=0,h=1e8,l=-1e8,n=1e8,a=-1e8,o=new Ce,c=new Ce;const u=new Array(2);for(let d=0;d<i;d++,r+=s)t.apply(this.skeleton,r,r,!1,[],1,0,0),this.skeleton.updateWorldTransform(2),this.skeleton.getBounds(o,c,u,this.sceneRenderer.skeletonRenderer.getSkeletonClipping()),!isNaN(o.x)&&!isNaN(o.y)&&!isNaN(c.x)&&!isNaN(c.y)?(h=Math.min(o.x,h),l=Math.max(o.x+c.x,l),n=Math.min(o.y,n),a=Math.max(o.y+c.y,a)):this.showError("Animation bounds are invalid: "+t.name);e.x=h,e.y=n,e.width=l-h,e.height=a-n}drawFrame(t=!0){try{if(this.error||this.disposed)return;t&&!this.stopRequestAnimationFrame&&requestAnimationFrame(()=>this.drawFrame());let e=document,s=e.fullscreenElement||e.webkitFullscreenElement||e.mozFullScreenElement||e.msFullscreenElement?this.bgFullscreen:this.bg;this.time.update();let r=this.time.delta,h=!this.assetManager.isLoadingComplete();!this.skeleton&&!h&&this.loadSkeleton();let l=this.skeleton,n=this.config;if(l){let a=this.sceneRenderer;a.resize(1);let o=this.paused?0:r*this.speed;if(n.frame&&n.frame(this,o),!this.paused&&(l.update(o),this.animationState.update(o),this.animationState.apply(l),n.updateWorldTransform?n.updateWorldTransform(this,o):l.updateWorldTransform(2),n.showControls)){this.playTime+=o;let f=this.animationState.getCurrent(0);if(f){let g=f.animation.duration;for(;this.playTime>=g&&g!=0;)this.playTime-=g;this.playTime=Math.max(0,Math.min(this.playTime,g)),this.timelineSlider.setValue(this.playTime/g)}}let c=this.viewport;if(c.x=this.currentViewport.x-this.currentViewport.padLeft,c.y=this.currentViewport.y-this.currentViewport.padBottom,c.width=this.currentViewport.width+this.currentViewport.padLeft+this.currentViewport.padRight,c.height=this.currentViewport.height+this.currentViewport.padBottom+this.currentViewport.padTop,this.previousViewport){let f=(performance.now()-this.viewportTransitionStart)/1e3/n.viewport.transitionTime;if(f<1){let g=this.previousViewport.x-this.previousViewport.padLeft,w=this.previousViewport.y-this.previousViewport.padBottom,b=this.previousViewport.width+this.previousViewport.padLeft+this.previousViewport.padRight,p=this.previousViewport.height+this.previousViewport.padBottom+this.previousViewport.padTop;c.x=g+(c.x-g)*f,c.y=w+(c.y-w)*f,c.width=b+(c.width-b)*f,c.height=p+(c.height-p)*f}}a.camera.zoom=this.canvas.height/this.canvas.width>c.height/c.width?c.width/this.canvas.width:c.height/this.canvas.height,a.camera.position.x=c.x+c.width/2,a.camera.position.y=c.y+c.height/2;let u=this.context.gl;u.clearColor(s.r,s.g,s.b,s.a),u.clear(u.COLOR_BUFFER_BIT),n.update&&n.update(this,o),a.begin();let d=n.backgroundImage;if(d){let f=this.assetManager.require(d.url);d.x!==void 0&&d.y!==void 0&&d.width&&d.height?a.drawTexture(f,d.x,d.y,d.width,d.height):a.drawTexture(f,c.x,c.y,c.width,c.height)}a.drawSkeleton(l,n.premultipliedAlpha),Number(a.skeletonDebugRenderer.drawBones=n.debug.bones??!1)+Number(a.skeletonDebugRenderer.drawBoundingBoxes=n.debug.bounds??!1)+Number(a.skeletonDebugRenderer.drawClipping=n.debug.clipping??!1)+Number(a.skeletonDebugRenderer.drawMeshHull=n.debug.hulls??!1)+Number(a.skeletonDebugRenderer.drawPaths=n.debug.paths??!1)+Number(a.skeletonDebugRenderer.drawRegionAttachments=n.debug.regions??!1)+Number(a.skeletonDebugRenderer.drawMeshTriangles=n.debug.meshes??!1)>0&&a.drawSkeletonDebug(l,n.premultipliedAlpha);let m=n.controlBones;if(m.length){let f=this.selectedBones;u.lineWidth(2);for(let g=0;g<m.length;g++){let w=l.findBone(m[g]);if(!w)continue;let b=f[g]?hn:dn,p=f[g]?cn:un;a.circle(!0,l.x+w.worldX,l.y+w.worldY,20,b),a.circle(!1,l.x+w.worldX,l.y+w.worldY,20,p)}}n.viewport.debugRender&&(u.lineWidth(1),a.rect(!1,this.currentViewport.x,this.currentViewport.y,this.currentViewport.width,this.currentViewport.height,V.GREEN),a.rect(!1,c.x,c.y,c.width,c.height,V.RED)),a.end(),n.draw&&n.draw(this,o)}n.showLoading&&(this.loadingScreen.backgroundColor.setFromColor(s),this.loadingScreen.draw(!h)),h&&n.loading&&n.loading(this,r)}catch(e){this.showError(`Error: Unable to render skeleton.
|
|
${e.message}`,e)}}startRendering(){this.stopRequestAnimationFrame=!1,requestAnimationFrame(()=>this.drawFrame())}stopRendering(){this.stopRequestAnimationFrame=!0}hidePopup(t){return this.popup!=null&&this.popup.hide(t)}showSpeedDialog(t){let e="speed";if(this.hidePopup(e))return;let i=new Ct(e,t,this,this.playerControls,`
|
|
<div class="spine-player-popup-title">Speed</div>
|
|
<hr>
|
|
<div class="spine-player-row" style="align-items:center;padding:8px">
|
|
<div class="spine-player-column">
|
|
<div class="spine-player-speed-slider" style="margin-bottom:4px"></div>
|
|
<div class="spine-player-row" style="justify-content:space-between"><div>0.1x</div><div>1x</div><div>2x</div></div>
|
|
</div>
|
|
</div>`),s=new Ws(2,.1,!0);Xe(i.dom,"spine-player-speed-slider").appendChild(s.create()),s.setValue(this.speed/2),s.change=r=>this.speed=r*2,i.show()}showAnimationsDialog(t){let e="animations";if(this.hidePopup(e)||!this.skeleton||!this.skeleton.data.animations.length)return;let i=new Ct(e,t,this,this.playerControls,'<div class="spine-player-popup-title">Animations</div><hr><ul class="spine-player-list"></ul>'),s=Xe(i.dom,"spine-player-list");this.skeleton.data.animations.forEach(r=>{if(this.config.animations&&this.config.animations.indexOf(r.name)<0)return;let h=Ve('<li class="spine-player-list-item selectable"><div class="selectable-circle"></div><div class="selectable-text"></div></li>');r.name==this.config.animation&&h.classList.add("selected"),Xe(h,"selectable-text").innerText=r.name,s.appendChild(h),h.onclick=()=>{zs(s.children,"selected"),h.classList.add("selected"),this.config.animation=r.name,this.playTime=0,this.setAnimation(r.name),this.play()}}),i.show()}showSkinsDialog(t){let e="skins";if(this.hidePopup(e)||!this.skeleton||!this.skeleton.data.animations.length)return;let i=new Ct(e,t,this,this.playerControls,'<div class="spine-player-popup-title">Skins</div><hr><ul class="spine-player-list"></ul>'),s=Xe(i.dom,"spine-player-list");this.skeleton.data.skins.forEach(r=>{if(this.config.skins&&this.config.skins.indexOf(r.name)<0)return;let h=Ve('<li class="spine-player-list-item selectable"><div class="selectable-circle"></div><div class="selectable-text"></div></li>');r.name==this.config.skin&&h.classList.add("selected"),Xe(h,"selectable-text").innerText=r.name,s.appendChild(h),h.onclick=()=>{zs(s.children,"selected"),h.classList.add("selected"),this.config.skin=r.name,this.skeleton.setSkinByName(this.config.skin),this.skeleton.setSlotsToSetupPose()}}),i.show()}showSettingsDialog(t){let e="settings";if(this.hidePopup(e)||!this.skeleton||!this.skeleton.data.animations.length)return;let i=new Ct(e,t,this,this.playerControls,'<div class="spine-player-popup-title">Debug</div><hr><ul class="spine-player-list"></li>'),s=Xe(i.dom,"spine-player-list"),r=(h,l)=>{let n=Ve('<li class="spine-player-list-item"></li>'),a=new on(h);n.appendChild(a.create());let o=this.config.debug;a.setEnabled(o[l]),a.change=c=>o[l]=c,s.appendChild(n)};r("Bones","bones"),r("Regions","regions"),r("Meshes","meshes"),r("Bounds","bounds"),r("Paths","paths"),r("Clipping","clipping"),r("Points","points"),r("Hulls","hulls"),i.show()}showError(t,e){if(this.error){if(e)throw e}else{throw this.error=!0,this.dom.appendChild(Ve('<div class="spine-player-error" style="background:#000;color:#fff;position:absolute;top:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;overflow:auto;z-index:999">'+t.replace(`
|
|
`,"<br><br>")+"</div>")),this.config.error&&this.config.error(this,t),e||new Error(t);console.log(e)}}},Ct=class{constructor(t,e,i,s,r){this.id=t,this.button=e,this.player=i,this.dom=Ve('<div class="spine-player-popup spine-player-hidden"></div>'),this.dom.innerHTML=r,s.appendChild(this.dom),this.className="spine-player-button-icon-"+t+"-selected"}dom;className;windowClickListener;dispose(){}hide(t){return this.dom.remove(),this.button.classList.remove(this.className),this.id==t?(this.player.popup=null,!0):!1}show(){this.player.popup=this,this.button.classList.add(this.className),this.dom.classList.remove("spine-player-hidden");let t=!1,e=()=>{t||requestAnimationFrame(e);let r=this.player.dom,h=Math.abs(r.getBoundingClientRect().bottom-r.getBoundingClientRect().bottom),l=Math.abs(r.getBoundingClientRect().right-r.getBoundingClientRect().right);this.dom.style.maxHeight=r.clientHeight-h-l+"px"};requestAnimationFrame(e);let i=!0,s=r=>{if(i||this.player.popup!=this){i=!1;return}this.dom.contains(r.target)||(this.dom.remove(),window.removeEventListener("click",s),this.button.classList.remove(this.className),this.player.popup=null,t=!0)};this.player.addEventListener(window,"click",s)}},on=class{constructor(t){this.text=t}switch=null;enabled=!1;change=()=>{};create(){return this.switch=Ve(`
|
|
<div class="spine-player-switch">
|
|
<span class="spine-player-switch-text">${this.text}</span>
|
|
<div class="spine-player-switch-knob-area">
|
|
<div class="spine-player-switch-knob"></div>
|
|
</div>
|
|
</div>`),this.switch.addEventListener("click",()=>{this.setEnabled(!this.enabled),this.change&&this.change(this.enabled)}),this.switch}setEnabled(t){t?this.switch?.classList.add("active"):this.switch?.classList.remove("active"),this.enabled=t}isEnabled(){return this.enabled}},Ws=class{constructor(t=0,e=.1,i=!1){this.snaps=t,this.snapPercentage=e,this.big=i}slider=null;value=null;knob=null;change=()=>{};create(){this.slider=Ve(`
|
|
<div class="spine-player-slider ${this.big?"big":""}">
|
|
<div class="spine-player-slider-value"></div>
|
|
<!--<div class="spine-player-slider-knob"></div>-->
|
|
</div>`),this.value=Xe(this.slider,"spine-player-slider-value"),this.setValue(0);let t=!1;return new nt(this.slider).addListener({down:(e,i)=>{t=!0,this.value?.classList.add("hovering")},up:(e,i)=>{t=!1,this.change&&this.change(this.setValue(e/this.slider.clientWidth)),this.value?.classList.remove("hovering")},moved:(e,i)=>{t&&this.change&&this.change(this.setValue(e/this.slider.clientWidth))},dragged:(e,i)=>{this.change&&this.change(this.setValue(e/this.slider.clientWidth))}}),this.slider}setValue(t){if(t=Math.max(0,Math.min(1,t)),this.snaps){let e=1/this.snaps,i=t%e;i<e*this.snapPercentage?t=t-i:i>e-e*this.snapPercentage&&(t=t-i+e),t=Math.max(0,Math.min(1,t))}return this.value.style.width=""+t*100+"%",t}};function Xe(t,e){return t.getElementsByClassName(e)[0]}function Ve(t){let e=document.createElement("div");return e.innerHTML=t,e.children[0]}function zs(t,e){for(let i=0;i<t.length;i++)t[i].classList.remove(e)}function zi(t){return JSON.stringify(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var hn=new V(.478,0,0,.25),cn=new V(1,1,1,1),dn=new V(.478,0,0,.5),un=new V(1,0,0,.8);function fn(t){return new Promise((e,i)=>{const s=document.createElement("script");s.src=t,s.onload=()=>e(),s.onerror=()=>i(new Error(`Script load error for ${t}`)),document.head.appendChild(s)})}function mn(t){return new Promise((e,i)=>{const s=document.createElement("link");s.href=t,s.rel="stylesheet",s.onload=()=>e(),s.onerror=()=>i(new Error(`CSS load error for ${t}`)),document.head.appendChild(s)})}var gn=class rr{constructor(e){this.parent=e,this.load()}static DEFAULT_CODE=`
|
|
<script src="https://esotericsoftware.com/files/spine-player/4.1/spine-player.js"><\/script>
|
|
<link rel="stylesheet" href="https://esotericsoftware.com/files/spine-player/4.1/spine-player.css">
|
|
|
|
<div id="player-container" style="width: 100vw; height: 100vh;"></div>
|
|
|
|
<script>
|
|
new spine.SpinePlayer("player-container", {
|
|
jsonUrl: "https://esotericsoftware.com/files/examples/4.1/spineboy/export/spineboy-pro.json",
|
|
atlasUrl: "https://esotericsoftware.com/files/examples/4.1/spineboy/export/spineboy-pma.atlas"
|
|
});
|
|
<\/script>
|
|
`.trim();prefix=`<html>
|
|
<head>
|
|
<style>
|
|
body { margin: 0px; }
|
|
</style>
|
|
</head>
|
|
<body>`.trim();postfix="</body>";code;player;async load(){await Promise.all([fn("https://www.unpkg.com/codemirror@5.51.0/lib/codemirror.js"),mn("https://www.unpkg.com/codemirror@5.51.0/lib/codemirror.css")]),this.render(this.parent)}render(e){let i=`
|
|
<div style="display: flex; flex-direction: column; width: 100%; height: 100%;">
|
|
<div style="width: 100%; height: 50%"></div>
|
|
<iframe style="width: 100%; height: 50%; outline: none; border: none;"></iframe>
|
|
</div>
|
|
`;e.innerHTML=i;let s=e.children[0].children[0];this.player=e.children[0].children[1],requestAnimationFrame(()=>{this.code=CodeMirror(s,{lineNumbers:!0,tabSize:3,indentUnit:3,indentWithTabs:!0,scrollBarStyle:"native",mode:"htmlmixed",theme:"monokai"}),this.code.on("change",()=>{this.startPlayer()}),s.children[0].style.height="100%",this.setCode(rr.DEFAULT_CODE)})}setPreAndPostfix(e,i){this.prefix=e,this.postfix=i,this.startPlayer()}setCode(e){this.code.setValue(e),this.startPlayer()}timerId=0;startPlayer(){clearTimeout(this.timerId),this.timerId=setTimeout(()=>{let e=this.code.getDoc().getValue();e=this.prefix+e+this.postfix,e=window.btoa(e),this.player.src="",this.player.src="data:text/html;base64,"+e},500)}};return cr(Ji)})();
|