"use strict";var spine=(()=>{var Ie=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,_i=Object.getOwnPropertyNames,ji=Object.prototype.hasOwnProperty,Zi=(e,t)=>{for(var s in t)Ie(e,s,{get:t[s],enumerable:!0})},Ki=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _i(t))!ji.call(e,r)&&r!==s&&Ie(e,r,{get:()=>t[r],enumerable:!(i=Hi(t,r))||i.enumerable});return e},Ji=e=>Ki(Ie({},"__esModule",{value:!0}),e),Ws={};Zi(Ws,{AlphaTimeline:()=>ze,Animation:()=>ne,AnimationState:()=>sr,AnimationStateAdapter:()=>ir,AnimationStateData:()=>rr,AssetCache:()=>li,AssetManager:()=>bi,AssetManagerBase:()=>ai,AtlasAttachmentLoader:()=>lr,Attachment:()=>Re,AttachmentTimeline:()=>Ot,BinaryInput:()=>gi,BlendMode:()=>Is,Bone:()=>ms,BoneData:()=>us,BoundingBoxAttachment:()=>hs,CURRENT:()=>ei,CameraController:()=>qr,ClippingAttachment:()=>$t,Color:()=>st,Color2Attribute:()=>Ai,ColorAttribute:()=>me,ConstraintData:()=>ee,CurveTimeline:()=>Ct,CurveTimeline1:()=>yt,CurveTimeline2:()=>ae,DebugUtils:()=>tr,DeformTimeline:()=>Ge,Downloader:()=>gs,DrawOrderTimeline:()=>zt,Event:()=>xs,EventData:()=>ps,EventQueue:()=>Qs,EventTimeline:()=>le,EventType:()=>$s,FIRST:()=>as,FakeTexture:()=>nr,GLTexture:()=>Gt,HOLD_FIRST:()=>he,HOLD_MIX:()=>ti,HOLD_SUBSEQUENT:()=>ls,IkConstraint:()=>oi,IkConstraintData:()=>ws,IkConstraintTimeline:()=>He,Inherit:()=>de,InheritTimeline:()=>De,Input:()=>Ys,IntSet:()=>Qi,Interpolation:()=>qs,LoadingScreen:()=>Zr,M00:()=>D,M01:()=>G,M02:()=>H,M03:()=>N,M10:()=>_,M11:()=>U,M12:()=>j,M13:()=>z,M20:()=>Z,M21:()=>K,M22:()=>W,M23:()=>q,M30:()=>$,M31:()=>tt,M32:()=>et,M33:()=>Q,ManagedWebGLRenderingContext:()=>xt,MathUtils:()=>P,Matrix4:()=>se,Mesh:()=>ks,MeshAttachment:()=>Wt,MixBlend:()=>Zs,MixDirection:()=>Ks,OrthoCamera:()=>vi,PathAttachment:()=>qt,PathConstraint:()=>hi,PathConstraintData:()=>bs,PathConstraintMixTimeline:()=>Ke,PathConstraintPositionTimeline:()=>je,PathConstraintSpacingTimeline:()=>Ze,Physics:()=>ui,PhysicsConstraintDampingTimeline:()=>$e,PhysicsConstraintGravityTimeline:()=>ss,PhysicsConstraintInertiaTimeline:()=>Je,PhysicsConstraintMassTimeline:()=>ts,PhysicsConstraintMixTimeline:()=>is,PhysicsConstraintResetTimeline:()=>rs,PhysicsConstraintStrengthTimeline:()=>Qe,PhysicsConstraintTimeline:()=>Pt,PhysicsConstraintWindTimeline:()=>es,PointAttachment:()=>ni,PolygonBatcher:()=>Xs,Pool:()=>Jt,Position2Attribute:()=>ue,Position3Attribute:()=>Gr,PositionMode:()=>vs,Pow:()=>Gs,PowOut:()=>$i,RGB2Timeline:()=>qe,RGBA2Timeline:()=>We,RGBATimeline:()=>Ne,RGBTimeline:()=>Ue,RegionAttachment:()=>te,ResizeMode:()=>ki,RotateMode:()=>As,RotateTimeline:()=>Qt,SETUP:()=>os,SUBSEQUENT:()=>oe,ScaleTimeline:()=>Xe,ScaleXTimeline:()=>Pe,ScaleYTimeline:()=>Le,SceneRenderer:()=>Yi,SequenceTimeline:()=>ns,Shader:()=>Tt,ShapeRenderer:()=>Ps,ShapeType:()=>Mi,ShearTimeline:()=>Be,ShearXTimeline:()=>Ve,ShearYTimeline:()=>Oe,Skeleton:()=>fi,SkeletonBinary:()=>hr,SkeletonBounds:()=>xi,SkeletonClipping:()=>wi,SkeletonData:()=>Cs,SkeletonDebugRenderer:()=>Ei,SkeletonJson:()=>zr,SkeletonRenderer:()=>Ri,Skin:()=>fe,SkinEntry:()=>Ss,Slot:()=>ci,SlotData:()=>Ts,SpacingMode:()=>ys,SpineCanvas:()=>Qr,StringSet:()=>Me,TexCoordAttribute:()=>Fs,Texture:()=>cs,TextureAtlas:()=>ds,TextureAtlasPage:()=>ri,TextureAtlasRegion:()=>fs,TextureFilter:()=>ce,TextureRegion:()=>ii,TextureWrap:()=>si,TimeKeeper:()=>Ee,Timeline:()=>ft,Touch:()=>yi,TrackEntry:()=>Js,TransformConstraint:()=>di,TransformConstraintData:()=>Ms,TransformConstraintTimeline:()=>_e,TranslateTimeline:()=>Ye,TranslateXTimeline:()=>ke,TranslateYTimeline:()=>Fe,Triangulator:()=>pi,Utils:()=>L,Vector2:()=>Vt,Vector3:()=>At,VertexAttachment:()=>Yt,VertexAttribute:()=>Ht,VertexAttributeType:()=>Ci,WindowedMean:()=>er});var Qi=class{array=new Array;add(e){let t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!=null}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},Me=class{entries={};size=0;add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>("0"+(s*255).toString(16)).slice(-2);return+("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t,s=new Nt){return s.setFromString(t)}},P=class Et{static PI=3.1415927;static PI2=Et.PI*2;static invPI2=1/Et.PI2;static radiansToDegrees=180/Et.PI;static radDeg=Et.radiansToDegrees;static degreesToRadians=Et.PI/180;static degRad=Et.degreesToRadians;static clamp(t,s,i){return ti?i:t}static cosDeg(t){return Math.cos(t*Et.degRad)}static sinDeg(t){return Math.sin(t*Et.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*Et.degRad}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){let s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return Et.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,i){let r=Math.random(),h=s-t;return r<=(i-t)/h?t+Math.sqrt(r*h*(i-t)):s-Math.sqrt((1-r)*h*(s-i))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},qs=class{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}},Gs=class extends qs{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2==0?-2:2)+1}},$i=class extends Gs{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}},L=class Kt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,i,r,h){for(let l=s,n=r;l=s?t:Kt.setArraySize(t,s,i)}static newArray(t,s){let i=new Array(t);for(let r=0;r0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;tthis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},er=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t>1)*l;let n=t.bone.skeleton,a=t.deform,o=this.vertices,c=this.bones;if(!c){a.length>0&&(o=a);let u=t.bone,g=u.worldX,w=u.worldY,b=u.a,x=u.b,p=u.c,v=u.d;for(let y=s,A=h;A=this.regions.length&&(i=this.regions.length-1);let r=this.regions[i];s.region!=r&&(s.region=r,s.updateRegion())}getPath(t,s){let i=t,r=(this.start+s).toString();for(let h=this.digits-r.length;h>0;h--)i+="0";return i+=r,i}static nextID(){return Ae._nextID++}},_s=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(_s||{}),js=[0,1,2,3,4,5,6],ne=class{name;timelines=[];timelineIds=new Me;duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t0&&(t%=this.duration));let a=this.timelines;for(let o=0,c=a.length;o(e[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",e))(Zs||{}),Ks=(e=>(e[e.mixIn=0]="mixIn",e[e.mixOut=1]="mixOut",e))(Ks||{}),rt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},ft=class{propertyIds;frames;constructor(e,t){this.propertyIds=t,this.frames=L.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;it)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let r=s;rt)return r-s;return i-s}},Ct=class extends ft{curves;constructor(e,t,s){super(e,s),this.curves=L.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){let t=this.getFrameCount()+e*18;if(this.curves.length>t){let s=L.newFloatArray(t);L.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,i,r,h,l,n,a,o,c){let d=this.curves,f=this.getFrameCount()+e*18;s==0&&(d[t]=2+f);let m=(i-h*2+n)*.03,u=(r-l*2+a)*.03,g=((h-n)*3-i+o)*.006,w=((l-a)*3-r+c)*.006,b=m*2+g,x=u*2+w,p=(h-i)*.3+m+g*.16666667,v=(l-r)*.3+u+w*.16666667,y=i+p,A=r+v;for(let C=f+18;fe){let a=this.frames[t],o=this.frames[t+s];return o+(e-a)/(r[i]-a)*(r[i+1]-o)}let h=i+18;for(i+=2;i=e){let a=r[i-2],o=r[i-1];return o+(e-a)/(r[i]-a)*(r[i+1]-o)}t+=this.getFrameEntries();let l=r[h-2],n=r[h-1];return n+(e-l)/(this.frames[t]-l)*(this.frames[t+s]-n)}},yt=class extends Ct{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let r=2;r<=s;r+=2)if(t[r]>e){s=r-2;break}let i=this.curves[s>>1];switch(i){case 0:let r=t[s],h=t[s+1];return h+(e-r)/(t[s+2]-r)*(t[s+2+1]-h);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,r){if(e>2];switch(u){case 0:let g=a[m];c=a[m+1],d=a[m+2],f=a[m+3];let w=(s-g)/(a[m+4]-g);c+=(a[m+4+1]-c)*w,d+=(a[m+4+2]-d)*w,f+=(a[m+4+3]-f)*w;break;case 1:c=a[m+1],d=a[m+2],f=a[m+3];break;default:c=this.getBezierValue(s,m,1,u-2),d=this.getBezierValue(s,m,2,u+18-2),f=this.getBezierValue(s,m,3,u+18*2-2)}if(r==1)o.r=c,o.g=d,o.b=f;else{if(h==0){let g=n.data.color;o.r=g.r,o.g=g.g,o.b=g.b}o.r+=(c-o.r)*r,o.g+=(d-o.g)*r,o.b+=(f-o.b)*r}}},ze=class extends yt{slotIndex=0;constructor(e,t,s){super(e,t,rt.alpha+"|"+s),this.slotIndex=s}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.color;if(s>3];switch(p){case 0:let v=a[x];d=a[x+1],f=a[x+2],m=a[x+3],u=a[x+4],g=a[x+5],w=a[x+6],b=a[x+7];let y=(s-v)/(a[x+8]-v);d+=(a[x+8+1]-d)*y,f+=(a[x+8+2]-f)*y,m+=(a[x+8+3]-m)*y,u+=(a[x+8+4]-u)*y,g+=(a[x+8+5]-g)*y,w+=(a[x+8+6]-w)*y,b+=(a[x+8+7]-b)*y;break;case 1:d=a[x+1],f=a[x+2],m=a[x+3],u=a[x+4],g=a[x+5],w=a[x+6],b=a[x+7];break;default:d=this.getBezierValue(s,x,1,p-2),f=this.getBezierValue(s,x,2,p+18-2),m=this.getBezierValue(s,x,3,p+18*2-2),u=this.getBezierValue(s,x,4,p+18*3-2),g=this.getBezierValue(s,x,5,p+18*4-2),w=this.getBezierValue(s,x,6,p+18*5-2),b=this.getBezierValue(s,x,7,p+18*6-2)}if(r==1)o.set(d,f,m,u),c.r=g,c.g=w,c.b=b;else{if(h==0){o.setFromColor(n.data.color);let v=n.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b}o.add((d-o.r)*r,(f-o.g)*r,(m-o.b)*r,(u-o.a)*r),c.r+=(g-c.r)*r,c.g+=(w-c.g)*r,c.b+=(b-c.b)*r}}},qe=class extends Ct{slotIndex=0;constructor(e,t,s){super(e,t,[rt.rgb+"|"+s,rt.rgb2+"|"+s]),this.slotIndex=s}getFrameEntries(){return 7}setFrame(e,t,s,i,r,h,l,n){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i,this.frames[e+3]=r,this.frames[e+4]=h,this.frames[e+5]=l,this.frames[e+6]=n}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=this.frames,o=n.color,c=n.darkColor;if(se){let n=this.frames[t];return s[i+1]*(e-n)/(s[i]-n)}let r=i+18;for(i+=2;i=e){let n=s[i-2],a=s[i-1];return a+(e-n)/(s[i]-n)*(s[i+1]-a)}let h=s[r-2],l=s[r-1];return l+(1-l)*(e-h)/(this.frames[t+this.getFrameEntries()]-h)}apply(e,t,s,i,r,h,l){let n=e.slots[this.slotIndex];if(!n.bone.active)return;let a=n.getAttachment();if(!a||!(a instanceof Yt)||a.timelineAttachment!=this.attachment)return;let o=n.deform;o.length==0&&(h=0);let c=this.vertices,d=c[0].length,f=this.frames;if(s=f[f.length-1]){let x=c[f.length-1];if(r==1)if(h==3){let p=a;if(p.bones)for(let v=0;vi)this.apply(t,s,Number.MAX_VALUE,r,h,l,n),s=-1;else if(s>=a[o-1])return;if(i0&&a[c-1]==d;)c--}for(;c=a[c];c++)r.push(this.events[c])}},zt=class Oi extends ft{static propertyIds=[""+rt.drawOrder];drawOrders;constructor(t){super(t,Oi.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.drawOrders[t]=i}apply(t,s,i,r,h,l,n){if(n==1){l==0&&L.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(i>2];switch(m){case 0:let u=a[f];o=a[f+1],c=a[f+2],d=a[f+3];let g=(s-u)/(a[f+4]-u);o+=(a[f+4+1]-o)*g,c+=(a[f+4+2]-c)*g,d+=(a[f+4+3]-d)*g;break;case 1:o=a[f+1],c=a[f+2],d=a[f+3];break;default:o=this.getBezierValue(s,f,1,m-2),c=this.getBezierValue(s,f,2,m+18-2),d=this.getBezierValue(s,f,3,m+18*2-2)}if(h==0){let u=n.data;n.mixRotate=u.mixRotate+(o-u.mixRotate)*r,n.mixX=u.mixX+(c-u.mixX)*r,n.mixY=u.mixY+(d-u.mixY)*r}else n.mixRotate+=(o-n.mixRotate)*r,n.mixX+=(c-n.mixX)*r,n.mixY+=(d-n.mixY)*r}},Pt=class extends yt{constraintIndex=0;constructor(e,t,s,i){super(e,t,i+"|"+s),this.constraintIndex=s}apply(e,t,s,i,r,h,l){let n;if(this.constraintIndex==-1){const a=s>=this.frames[0]?this.getCurveValue(s):0;for(const o of e.physicsConstraints)o.active&&this.global(o.data)&&this.set(o,this.getAbsoluteValue2(s,r,h,this.get(o),this.setup(o),a))}else n=e.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(s,r,h,this.get(n),this.setup(n)))}},Je=class extends Pt{constructor(e,t,s){super(e,t,s,rt.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Qe=class extends Pt{constructor(e,t,s){super(e,t,s,rt.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},$e=class extends Pt{constructor(e,t,s){super(e,t,s,rt.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},ts=class extends Pt{constructor(e,t,s){super(e,t,s,rt.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},es=class extends Pt{constructor(e,t,s){super(e,t,s,rt.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},ss=class extends Pt{constructor(e,t,s){super(e,t,s,rt.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},is=class extends Pt{constructor(e,t,s){super(e,t,s,rt.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},rs=class Di extends ft{static propertyIds=[rt.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,Di.propertyIds),this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,r,h,l,n){let a;if(this.constraintIndex!=-1&&(a=t.physicsConstraints[this.constraintIndex],!a.active))return;const o=this.frames;if(s>i)this.apply(t,s,Number.MAX_VALUE,[],h,l,n),s=-1;else if(s>=o[o.length-1])return;if(!(i=o[ft.search1(o,s)+1]))if(a!=null)a.reset();else for(const c of t.physicsConstraints)c.active&&c.reset()}},ns=class Lt extends ft{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,i){super(t,[rt.sequence+"|"+s+"|"+i.sequence.id]),this.slotIndex=s,this.attachment=i}getFrameEntries(){return Lt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,r,h){let l=this.frames;t*=Lt.ENTRIES,l[t]=s,l[t+Lt.MODE]=i|r<<4,l[t+Lt.DELAY]=h}apply(t,s,i,r,h,l,n){let a=t.slots[this.slotIndex];if(!a.bone.active)return;let o=a.attachment,c=this.attachment;if(o!=c&&(!(o instanceof Yt)||o.timelineAttachment!=c))return;if(n==1){l==0&&(a.sequenceIndex=-1);return}let d=this.frames;if(i>4,b=this.attachment.sequence.regions.length,x=js[u&15];if(x!=0)switch(w+=(i-m)/g+1e-5|0,x){case 1:w=Math.min(b-1,w);break;case 2:w%=b;break;case 3:{let p=(b<<1)-2;w=p==0?0:w%p,w>=b&&(w=p-w);break}case 4:w=Math.max(b-1-w,0);break;case 5:w=b-1-w%b;break;case 6:{let p=(b<<1)-2;w=p==0?0:(w+b-1)%p,w>=b&&(w=p-w)}}a.sequenceIndex=w}},sr=class Ce{static _emptyAnimation=new ne("",[],0);static emptyAnimation(){return Ce._emptyAnimation}data;tracks=new Array;timeScale=1;unkeyedState=0;events=new Array;listeners=new Array;queue=new Qs(this);propertyIDs=new Me;animationsChanged=!1;trackEntryPool=new Jt(()=>new Js);constructor(t){this.data=t}update(t){t*=this.timeScale;let s=this.tracks;for(let i=0,r=s.length;i0){if(h.delay-=l,h.delay>0)continue;l=-h.delay,h.delay=0}let n=h.next;if(n){let a=h.trackLast-n.delay;if(a>=0){for(n.delay=0,n.trackTime+=h.timeScale==0?0:(a/h.timeScale+t)*n.timeScale,h.trackTime+=l,this.setCurrent(i,n,!0);n.mixingFrom;)n.mixTime+=t,n=n.mixingFrom;continue}}else if(h.trackLast>=h.trackEnd&&!h.mixingFrom){s[i]=null,this.queue.end(h),this.clearNext(h);continue}if(h.mixingFrom&&this.updateMixingFrom(h,t)){let a=h.mixingFrom;for(h.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}h.trackTime+=l}this.queue.drain()}updateMixingFrom(t,s){let i=t.mixingFrom;if(!i)return!0;let r=this.updateMixingFrom(i,s);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.nextTrackLast!=-1&&t.mixTime>=t.mixDuration?((i.totalAlpha==0||t.mixDuration==0)&&(t.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),r):(i.trackTime+=s*i.timeScale,t.mixTime+=s,!1)}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let s=this.events,i=this.tracks,r=!1;for(let f=0,m=i.length;f0)continue;r=!0;let g=f==0?1:u.mixBlend,w=u.alpha;u.mixingFrom?w*=this.applyMixingFrom(u,t,g):u.trackTime>=u.trackEnd&&!u.next&&(w=0);let b=w>=u.alphaAttachmentThreshold,x=u.animationLast,p=u.getAnimationTime(),v=p,y=s;u.reverse&&(v=u.animation.duration-v,y=null);let A=u.animation.timelines,C=A.length;if(f==0&&w==1||g==3){f==0&&(b=!0);for(let S=0;S1&&(h=1),i!=1&&(i=r.mixBlend));let l=h=r.alphaAttachmentThreshold):(L.webkit602BugfixHelper(S,i),n&&y instanceof zt&&C==0&&(A=0),y.apply(s,f,u,g,S,C,A))}}return t.mixDuration>0&&this.queueEvents(r,m),this.events.length=0,r.nextAnimationLast=m,r.nextTrackLast=r.trackTime,h}applyAttachmentTimeline(t,s,i,r,h){var l=s.slots[t.slotIndex];l.bone.active&&(i=0,p=g>=0;Math.abs(w)<=90&&P.signum(w)!=P.signum(u)&&(Math.abs(g-b)>180?(m+=360*P.signum(g),p=x):b!=0?m-=360*P.signum(g):p=x),p!=x&&(m+=360*P.signum(g)),l[n]=m}l[n+1]=u,o.rotation=d+m*r}queueEvents(t,s){let i=t.animationStart,r=t.animationEnd,h=r-i,l=t.trackLast%h,n=this.events,a=0,o=n.length;for(;ar||this.queue.event(t,d)}let c=!1;if(t.loop)if(h==0)c=!0;else{const d=Math.floor(t.trackTime/h);c=d>0&&d>Math.floor(t.trackLast/h)}else c=s>=r&&t.animationLast=this.tracks.length)return;let s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let i=s;for(;;){let r=i.mixingFrom;if(!r)break;this.queue.end(r),i.mixingFrom=null,i.mixingTo=null,i=r}this.tracks[s.trackIndex]=null,this.queue.drain()}setCurrent(t,s,i){let r=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,r&&(i&&this.queue.interrupt(r),s.mixingFrom=r,r.mixingTo=s,s.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(s.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,i=!1){let r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error("Animation not found: "+s);return this.setAnimationWith(t,r,i)}setAnimationWith(t,s,i=!1){if(!s)throw new Error("animation cannot be null.");let r=!0,h=this.expandToIndex(t);h&&(h.nextTrackLast==-1?(this.tracks[t]=h.mixingFrom,this.queue.interrupt(h),this.queue.end(h),this.clearNext(h),h=h.mixingFrom,r=!1):this.clearNext(h));let l=this.trackEntry(t,s,i,h);return this.setCurrent(t,l,r),this.queue.drain(),l}addAnimation(t,s,i=!1,r=0){let h=this.data.skeletonData.findAnimation(s);if(!h)throw new Error("Animation not found: "+s);return this.addAnimationWith(t,h,i,r)}addAnimationWith(t,s,i=!1,r=0){if(!s)throw new Error("animation cannot be null.");let h=this.expandToIndex(t);if(h)for(;h.next;)h=h.next;let l=this.trackEntry(t,s,i,h);return h?(h.next=l,l.previous=h,r<=0&&(r=Math.max(r+h.getTrackComplete()-l.mixDuration,0))):(this.setCurrent(t,l,!0),this.queue.drain(),r<0&&(r=0)),l.delay=r,l}setEmptyAnimation(t,s=0){let i=this.setAnimationWith(t,Ce.emptyAnimation(),!1);return i.mixDuration=s,i.trackEnd=s,i}addEmptyAnimation(t,s=0,i=0){let r=this.addAnimationWith(t,Ce.emptyAnimation(),!1,i);return i<=0&&(r.delay=Math.max(r.delay+r.mixDuration-s,0)),r.mixDuration=s,r.trackEnd=s,r}setEmptyAnimations(t=0){let s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,r=this.tracks.length;i0){h[a]=ti,l[a]=d;continue t}break}h[a]=he}}}getCurrent(t){return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){let s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Js=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;holdPrevious=!1;reverse=!1;shortestRotation=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;_mixDuration=0;interruptAlpha=0;totalAlpha=0;get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}mixBlend=2;timelineMode=new Array;timelineHoldMix=new Array;timelinesRotation=new Array;reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime=0}},Qs=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects;for(let t=0;t(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))($s||{}),ir=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},oe=0,as=1,ls=2,he=3,ti=4,os=1,ei=2,rr=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let i=this.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(i,r,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let i=e.name+"."+t.name;this.animationToMixTime[i]=s}getMix(e,t){let s=e.name+"."+t.name,i=this.animationToMixTime[s];return i===void 0?this.defaultMix:i}},hs=class Ni extends Yt{color=new st(1,1,1,1);constructor(t){super(t)}copy(){let t=new Ni(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},$t=class Ui extends Yt{endSlot=null;color=new st(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){let t=new Ui(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},cs=class{_image;constructor(e){this._image=e}getImage(){return this._image}},ce=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(ce||{}),si=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(si||{}),ii=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},nr=class extends cs{setFilters(e,t){}setWraps(e,t){}dispose(){}},ds=class{pages=new Array;regions=new Array;constructor(e){let t=new ar(e),s=new Array(4),i={};i.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},i.format=()=>{},i.filter=o=>{o.minFilter=L.enumValue(ce,s[1]),o.magFilter=L.enumValue(ce,s[2])},i.repeat=o=>{s[1].indexOf("x")!=-1&&(o.uWrap=10497),s[1].indexOf("y")!=-1&&(o.vWrap=10497)},i.pma=o=>{o.pma=s[1]=="true"};var r={};r.xy=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2])},r.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},r.bounds=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2]),o.width=parseInt(s[3]),o.height=parseInt(s[4])},r.offset=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2])},r.orig=o=>{o.originalWidth=parseInt(s[1]),o.originalHeight=parseInt(s[2])},r.offsets=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2]),o.originalWidth=parseInt(s[3]),o.originalHeight=parseInt(s[4])},r.rotate=o=>{let c=s[1];c=="true"?o.degrees=90:c!="false"&&(o.degrees=parseInt(c))},r.index=o=>{o.index=parseInt(s[1])};let h=t.readLine();for(;h&&h.trim().length==0;)h=t.readLine();for(;!(!h||h.trim().length==0||t.readEntry(s,h)==0);)h=t.readLine();let l=null,n=null,a=null;for(;h!==null;)if(h.trim().length==0)l=null,h=t.readLine();else if(l){let o=new fs(l,h);for(;;){let c=t.readEntry(s,h=t.readLine());if(c==0)break;let d=r[s[0]];if(d)d(o);else{n||(n=[]),a||(a=[]),n.push(s[0]);let f=[];for(let m=0;m0&&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 ri(h.trim());t.readEntry(s,h=t.readLine())!=0;){let o=i[s[0]];o&&o(l)}this.pages.push(l)}}findRegion(e){for(let t=0;t=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,r=s+1;;i++){let h=t.indexOf(",",r);if(h==-1)return e[i]=t.substr(r).trim(),i;if(e[i]=t.substr(r,h-r).trim(),r=h+1,i==4)return 4}}},ri=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=new Array;constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},fs=class extends ii{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},Wt=class Ds extends Yt{region=null;path;regionUVs=[];uvs=[];triangles=[];color=new st(1,1,1,1);width=0;height=0;hullLength=0;edges=[];parentMesh=null;sequence=null;tempColor=new st(0,0,0,0);constructor(t,s){super(t),this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=L.newFloatArray(t.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,h=this.region.v,l=0,n=0;if(this.region instanceof fs){let a=this.region,o=a.page,c=o.width,d=o.height;switch(a.degrees){case 90:r-=(a.originalHeight-a.offsetY-a.height)/c,h-=(a.originalWidth-a.offsetX-a.width)/d,l=a.originalHeight/c,n=a.originalWidth/d;for(let f=0;f= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}},de=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(de||{}),ms=class{data;skeleton;parent=null;children=new Array;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;ax=0;ay=0;arotation=0;ascaleX=0;ascaleY=0;ashearX=0;ashearY=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;inherit=0;sorted=!1;active=!1;constructor(e,t,s){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,i,r,h,l){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=h,this.ashearY=l;let n=this.parent;if(!n){let f=this.skeleton;const m=f.scaleX,u=f.scaleY,g=(s+h)*P.degRad,w=(s+90+l)*P.degRad;this.a=Math.cos(g)*i*m,this.b=Math.cos(w)*r*m,this.c=Math.sin(g)*i*u,this.d=Math.sin(w)*r*u,this.worldX=e*m+f.x,this.worldY=t*u+f.y;return}let a=n.a,o=n.b,c=n.c,d=n.d;switch(this.worldX=a*e+o*t+n.worldX,this.worldY=c*e+d*t+n.worldY,this.inherit){case 0:{const f=(s+h)*P.degRad,m=(s+90+l)*P.degRad,u=Math.cos(f)*i,g=Math.cos(m)*r,w=Math.sin(f)*i,b=Math.sin(m)*r;this.a=a*u+o*w,this.b=a*g+o*b,this.c=c*u+d*w,this.d=c*g+d*b;return}case 1:{const f=(s+h)*P.degRad,m=(s+90+l)*P.degRad;this.a=Math.cos(f)*i,this.b=Math.cos(m)*r,this.c=Math.sin(f)*i,this.d=Math.sin(m)*r;break}case 2:{let f=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;a*=f,c*=m;let u=a*a+c*c,g=0;u>1e-4?(u=Math.abs(a*d*m-o*f*c)/u,o=c*u,d=a*u,g=Math.atan2(c,a)*P.radDeg):(a=0,c=0,g=90-Math.atan2(d,o)*P.radDeg);const w=(s+h-g)*P.degRad,b=(s+l-g+90)*P.degRad,x=Math.cos(w)*i,p=Math.cos(b)*r,v=Math.sin(w)*i,y=Math.sin(b)*r;this.a=a*x-o*v,this.b=a*p-o*y,this.c=c*x+d*v,this.d=c*p+d*y;break}case 3:case 4:{s*=P.degRad;const f=Math.cos(s),m=Math.sin(s);let u=(a*f+o*m)/this.skeleton.scaleX,g=(c*f+d*m)/this.skeleton.scaleY,w=Math.sqrt(u*u+g*g);w>1e-5&&(w=1/w),u*=w,g*=w,w=Math.sqrt(u*u+g*g),this.inherit==3&&a*d-o*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w),s=Math.PI/2+Math.atan2(g,u);const b=Math.cos(s)*w,x=Math.sin(s)*w;h*=P.degRad,l=(90+l)*P.degRad;const p=Math.cos(h)*i,v=Math.cos(l)*r,y=Math.sin(h)*i,A=Math.sin(l)*r;this.a=u*p+b*y,this.b=u*v+b*A,this.c=g*p+x*y,this.d=g*v+x*A;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*P.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*P.radDeg;return}let t=e.a,s=e.b,i=e.c,r=e.d,h=1/(t*r-s*i),l=r*h,n=s*h,a=i*h,o=t*h,c=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=c*l-d*n,this.ay=d*o-c*a;let f,m,u,g;if(this.inherit==1)f=this.a,m=this.b,u=this.c,g=this.d;else{switch(this.inherit){case 2:{let v=Math.abs(t*r-s*i)/(t*t+i*i);s=-i*this.skeleton.scaleX*v/this.skeleton.scaleY,r=t*this.skeleton.scaleY*v/this.skeleton.scaleX,h=1/(t*r-s*i),l=r*h,n=s*h;break}case 3:case 4:let w=P.cosDeg(this.rotation),b=P.sinDeg(this.rotation);t=(t*w+s*b)/this.skeleton.scaleX,i=(i*w+r*b)/this.skeleton.scaleY;let x=Math.sqrt(t*t+i*i);x>1e-5&&(x=1/x),t*=x,i*=x,x=Math.sqrt(t*t+i*i),this.inherit==3&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x);let p=P.PI/2+Math.atan2(i,t);s=Math.cos(p)*x,r=Math.sin(p)*x,h=1/(t*r-s*i),l=r*h,n=s*h,a=i*h,o=t*h}f=l*this.a-n*this.c,m=l*this.b-n*this.d,u=o*this.c-a*this.a,g=o*this.d-a*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+u*u),this.ascaleX>1e-4){let w=f*g-m*u;this.ascaleY=w/this.ascaleX,this.ashearY=-Math.atan2(f*m+u*g,w)*P.radDeg,this.arotation=Math.atan2(u,f)*P.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,m)*P.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*P.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*P.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,i=e.y-this.worldY;return e.x=s*this.d*t-i*this.b*t,e.y=i*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=P.sinDeg(e),s=P.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*P.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=P.sinDeg(e),s=P.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*P.radDeg}rotateWorld(e){e*=P.degRad;const t=Math.sin(e),s=Math.cos(e),i=this.a,r=this.b;this.a=s*i-t*this.c,this.b=s*r-t*this.d,this.c=t*i+s*this.c,this.d=t*r+s*this.d}},ee=class{constructor(e,t,s){this.name=e,this.order=t,this.skinRequired=s}},ai=class{pathPrefix="";textureLoader;downloader;cache;errors={};toLoad=0;loaded=0;constructor(e,t="",s=new gs,i=new li){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=i}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{let i=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(i)};requestAnimationFrame(i)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadBinary(e,h=>{this.success(t,e,h),i(h)},(h,l)=>{const n=`Couldn't load binary ${e}: status ${h}, ${l}`;this.error(s,e,n),r(n)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,i=>{this.success(t,e,i)},(i,r)=>{this.error(s,e,`Couldn't load text ${e}: status ${i}, ${r}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{this.downloader.downloadJson(e,h=>{this.success(t,e,h),i(h)},(h,l)=>{const n=`Couldn't load JSON ${e}: status ${h}, ${l}`;this.error(s,e,n),r(n)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const i=this.cache.assetsLoaded[e],r=i!==void 0;return r&&(this.cache.assetsLoaded[e]=i.then(h=>(h=h instanceof Image||h instanceof ImageBitmap?this.textureLoader(h):h,this.success(t,e,h),h)).catch(h=>this.error(s,e,h))),r}loadTexture(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(n=>{if(n.ok)return n.blob();const a=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(a)}).then(n=>n?createImageBitmap(n,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(n=>{if(n){const a=this.createTexture(e,n);this.success(t,e,a),i(a)}});else{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>{const a=this.createTexture(e,n);this.success(t,e,a),i(a)},n.onerror=()=>{const a=`Couldn't load image: ${e}`;this.error(s,e,a),r(a)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),n.src=e}}))}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let r=e.lastIndexOf("/"),h=r>=0?e.substring(0,r+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((l,n)=>{this.downloader.downloadText(e,a=>{try{const o=this.createTextureAtlas(e,a);let c=o.pages.length,d=!1;if(c===0){this.success(t,e,o),l(o);return}for(let f of o.pages)this.loadTexture(i?i[f.name]:h+f.name,(m,u)=>{d||(f.setTexture(u),--c==0&&(this.success(t,e,o),l(o)))},(m,u)=>{if(!d){const g=`Couldn't load texture ${e} page image: ${m}`;this.error(s,e,g),n(g)}d=!0})}catch(o){const c=`Couldn't parse texture atlas ${e}: ${o.message}`;this.error(s,e,c),n(c)}},(a,o)=>{const c=`Couldn't load texture atlas ${e}: status ${a}, ${o}`;this.error(s,e,c),n(c)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{},i){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,h)=>{this.downloader.downloadText(e,l=>{try{const n=this.createTextureAtlas(e,l);this.success(t,e,n),r(n)}catch(n){const a=`Couldn't parse texture atlas ${e}: ${n.message}`;this.error(s,e,a),h(a)}},(l,n)=>{const a=`Couldn't load texture atlas ${e}: status ${l}, ${n}`;this.error(s,e,a),h(a)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(i,r)=>t(r),(i,r)=>s(r))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(i,r)=>t(r),(i,r)=>s(r))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.cache.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?` `+s:""))}remove(e){e=this.pathPrefix+e;let t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(let e in this.cache.assets){let t=this.cache.assets[e];t.dispose&&t.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(e){const t=this.cache.assets[e];if(t instanceof ds){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t){const s=new ds(t);return s.dispose=()=>{if(!(this.cache.assetsRefCount[e]<=0)){this.disposeAssetInternal(e);for(const i of s.pages)i.texture?.dispose()}},s}createTexture(e,t){const s=this.textureLoader(t),i=s.dispose.bind(s);return s.dispose=()=>{this.disposeAssetInternal(e)&&i()},s}},li=class Se{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=Se.AVAILABLE_CACHES.get(t);if(s)return s;const i=new Se;return Se.AVAILABLE_CACHES.set(t,i),i}async addAsset(t,s){this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=await s}},gs=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),r=0;r{this.finish(e,r.status,r.responseText)};r.onload=h,r.onerror=h,r.send()}downloadJson(e,t,s){this.downloadText(e,i=>{t(JSON.parse(i))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const i=this.rawDataUris[e];if(i&&!i.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(i))}catch(l){this.finish(e,400,JSON.stringify(l))}return}let r=new XMLHttpRequest;r.open("GET",i||e,!0),r.responseType="arraybuffer";let h=()=>{this.finish(e,r.status,r.response)};r.onload=()=>{r.status==200||r.status==0?this.finish(e,200,new Uint8Array(r.response)):h()},r.onerror=h,r.send()}start(e,t,s){let i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,s)}}finish(e,t,s){let i=this.callbacks[e];delete this.callbacks[e];let r=t==200||t==0?[s]:[t,s];for(let h=r.length-1,l=i.length;h180?f-=360:f<-180&&(f+=360);let g=e.ascaleX,w=e.ascaleY;if(i||r){switch(e.inherit){case 3:case 4:m=t-e.worldX,u=s-e.worldY}const b=e.data.length*g;if(b>1e-4){const x=m*m+u*u;if(i&&xb*b){const p=(Math.sqrt(x)/b-1)*l+1;g*=p,h&&(w*=p)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*l,g,w,e.ashearX,e.ashearY)}apply2(e,t,s,i,r,h,l,n,a){if(e.inherit!=0||t.inherit!=0)return;let o=e.ax,c=e.ay,d=e.ascaleX,f=e.ascaleY,m=d,u=f,g=t.ascaleX,w=0,b=0,x=0;d<0?(d=-d,w=180,x=-1):(w=0,x=1),f<0&&(f=-f,x=-x),g<0?(g=-g,b=180):b=0;let p=t.ax,v=0,y=0,A=0,C=e.a,S=e.b,I=e.c,k=e.d,Y=Math.abs(d-f)<=1e-4;!Y||h?(v=0,y=C*p+e.worldX,A=I*p+e.worldY):(v=t.ay,y=C*p+S*v+e.worldX,A=I*p+k*v+e.worldY);let X=e.parent;if(!X)throw new Error("IK parent must itself have a parent.");C=X.a,S=X.b,I=X.c,k=X.d;let F=C*k-S*I,R=y-X.worldX,M=A-X.worldY;F=Math.abs(F)<=1e-4?0:1/F;let V=(R*k-M*S)*F-o,B=(M*C-R*I)*F-c,O=Math.sqrt(V*V+B*B),it=t.data.length*g,ct,ot;if(O<1e-4){this.apply1(e,s,i,!1,h,!1,a),t.updateWorldTransformWith(p,v,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}R=s-X.worldX,M=i-X.worldY;let ut=(R*k-M*S)*F-o,J=(M*C-R*I)*F-c,nt=ut*ut+J*J;if(n!=0){n*=d*(g+1)*.5;let mt=Math.sqrt(nt),pt=mt-O-it*d+n;if(pt>0){let wt=Math.min(1,pt/(n*2))-1;wt=(pt-n*(1-wt*wt))/mt,ut-=wt*ut,J-=wt*J,nt=ut*ut+J*J}}t:if(Y){it*=d;let mt=(nt-O*O-it*it)/(2*O*it);mt<-1?(mt=-1,ot=Math.PI*r):mt>1?(mt=1,ot=0,h&&(C=(Math.sqrt(nt)/(O+it)-1)*a+1,m*=C,l&&(u*=C))):ot=Math.acos(mt)*r,C=O+it*mt,S=it*Math.sin(ot),ct=Math.atan2(J*C-ut*S,ut*C+J*S)}else{C=d*it,S=f*it;let mt=C*C,pt=S*S,wt=Math.atan2(J,ut);I=pt*O*O+mt*nt-mt*pt;let Mt=-2*pt*O,jt=pt-mt;if(k=Mt*Mt-4*jt*I,k>=0){let Zt=Math.sqrt(k);Mt<0&&(Zt=-Zt),Zt=-(Mt+Zt)*.5;let re=Zt/jt,Li=I/Zt,ye=Math.abs(re)=0){M=Math.sqrt(re)*r,ct=wt-Math.atan2(M,ye),ot=Math.atan2(M/f,(ye-O)/d);break t}}let ie=P.PI,be=O-C,Vs=be*be,Fi=0,Xi=0,ve=O+C,Os=ve*ve,Pi=0;I=-C*O/(mt-pt),I>=-1&&I<=1&&(I=Math.acos(I),R=C*Math.cos(I)+O,M=S*Math.sin(I),k=R*R+M*M,kOs&&(Xi=I,Os=k,ve=R,Pi=M)),nt<=(Vs+Os)*.5?(ct=wt-Math.atan2(Fi*r,be),ot=ie*r):(ct=wt-Math.atan2(Pi*r,ve),ot=Xi*r)}let ht=Math.atan2(v,p)*x,bt=e.arotation;ct=(ct-ht)*P.radDeg+w-bt,ct>180?ct-=360:ct<-180&&(ct+=360),e.updateWorldTransformWith(o,c,bt+ct*a,m,u,0,0),bt=t.arotation,ot=((ot+ht)*P.radDeg-t.ashearX)*x+b-bt,ot>180?ot-=360:ot<-180&&(ot+=360),t.updateWorldTransformWith(p,v,bt+ot*a,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},ws=class extends ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}bendDirection=0;compress=!1;stretch=!1;uniform=!1;mix=0;softness=0;constructor(e){super(e,0,!1)}},bs=class extends ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;constructor(e){super(e,0,!1)}},vs=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(vs||{}),ys=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(ys||{}),As=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(As||{}),hi=class Bt{static NONE=-1;static BEFORE=-2;static AFTER=-3;static epsilon=1e-5;data;bones;target;position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;spaces=new Array;positions=new Array;world=new Array;curves=new Array;lengths=new Array;segments=new Array;active=!1;constructor(t,s){if(!t)throw new Error("data cannot be null.");if(!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let r=0,h=t.bones.length;r0){v=d/v*u;for(let A=1;A0?P.degRad:-P.degRad}for(let v=0,y=3;v0){let Y=A.a,X=A.b,F=A.c,R=A.d,M=0,V=0,B=0;if(n?M=g[y-1]:f[v+1]==0?M=g[y+2]:M=Math.atan2(k,I),M-=Math.atan2(F,Y),p){V=Math.cos(M),B=Math.sin(M);let O=A.data.length;w+=(O*(V*Y-B*F)-I)*i,b+=(O*(B*Y+V*F)-k)*i}else M+=x;M>P.PI?M-=P.PI2:M<-P.PI&&(M+=P.PI2),M*=i,V=Math.cos(M),B=Math.sin(M),A.a=V*Y-B*F,A.b=V*X-B*R,A.c=B*Y+V*F,A.d=B*X+V*R}A.updateAppliedTransform()}}computeWorldPositions(t,s,i){let r=this.target,h=this.position,l=this.spaces,n=L.setArraySize(this.positions,s*3+2),a=this.world,o=t.closed,c=t.worldVerticesLength,d=c/6,f=Bt.NONE;if(!t.constantSpeed){let O=t.lengths;d-=o?1:2;let it=O[d];this.data.positionMode==1&&(h*=it);let ct;switch(this.data.spacingMode){case 2:ct=it;break;case 3:ct=it/s;break;default:ct=1}a=L.setArraySize(this.world,8);for(let ot=0,ut=0,J=0;otit){f!=Bt.AFTER&&(f=Bt.AFTER,t.computeWorldVertices(r,c-6,4,a,0,2)),this.addAfterPosition(ht-it,a,0,n,ut);continue}for(;;J++){let bt=O[J];if(!(ht>bt)){if(J==0)ht/=bt;else{let mt=O[J-1];ht=(ht-mt)/(bt-mt)}break}}J!=f&&(f=J,o&&J==d?(t.computeWorldVertices(r,c-4,4,a,0,2),t.computeWorldVertices(r,0,4,a,4,2)):t.computeWorldVertices(r,J*6+2,8,a,0,2)),this.addCurvePosition(ht,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],n,ut,i||ot>0&&nt==0)}return n}o?(c+=2,a=L.setArraySize(this.world,c),t.computeWorldVertices(r,2,c-4,a,0,2),t.computeWorldVertices(r,0,2,a,c-4,2),a[c-2]=a[0],a[c-1]=a[1]):(d--,c-=4,a=L.setArraySize(this.world,c),t.computeWorldVertices(r,2,c,a,0,2));let m=L.setArraySize(this.curves,d),u=0,g=a[0],w=a[1],b=0,x=0,p=0,v=0,y=0,A=0,C=0,S=0,I=0,k=0,Y=0,X=0,F=0,R=0;for(let O=0,it=2;Ou){this.addAfterPosition(J-u,a,c-4,n,it);continue}for(;;ct++){let nt=m[ct];if(!(J>nt)){if(ct==0)J/=nt;else{let ht=m[ct-1];J=(J-ht)/(nt-ht)}break}}if(ct!=f){f=ct;let nt=ct*6;for(g=a[nt],w=a[nt+1],b=a[nt+2],x=a[nt+3],p=a[nt+4],v=a[nt+5],y=a[nt+6],A=a[nt+7],C=(g-b*2+p)*.03,S=(w-x*2+v)*.03,I=((b-p)*3-g+y)*.006,k=((x-v)*3-w+A)*.006,Y=C*2+I,X=S*2+k,F=(b-g)*.3+C+I*.16666667,R=(x-w)*.3+S+k*.16666667,B=Math.sqrt(F*F+R*R),V[0]=B,nt=1;nt<8;nt++)F+=Y,R+=X,Y+=I,X+=k,B+=Math.sqrt(F*F+R*R),V[nt]=B;F+=Y,R+=X,B+=Math.sqrt(F*F+R*R),V[8]=B,F+=Y+I,R+=X+k,B+=Math.sqrt(F*F+R*R),V[9]=B,ot=0}for(J*=B;;ot++){let nt=V[ot];if(!(J>nt)){if(ot==0)J/=nt;else{let ht=V[ot-1];J=ot+(J-ht)/(nt-ht)}break}}this.addCurvePosition(J*.1,g,w,b,x,p,v,y,A,n,it,i||O>0&&ut==0)}return n}addBeforePosition(t,s,i,r,h){let l=s[i],n=s[i+1],a=s[i+2]-l,o=s[i+3]-n,c=Math.atan2(o,a);r[h]=l+t*Math.cos(c),r[h+1]=n+t*Math.sin(c),r[h+2]=c}addAfterPosition(t,s,i,r,h){let l=s[i+2],n=s[i+3],a=l-s[i],o=n-s[i+1],c=Math.atan2(o,a);r[h]=l+t*Math.cos(c),r[h+1]=n+t*Math.sin(c),r[h+2]=c}addCurvePosition(t,s,i,r,h,l,n,a,o,c,d,f){if(t==0||isNaN(t)){c[d]=s,c[d+1]=i,c[d+2]=Math.atan2(h-i,r-s);return}let m=t*t,u=m*t,g=1-t,w=g*g,b=w*g,x=g*t,p=x*3,v=g*p,y=p*t,A=s*b+r*v+l*y+a*u,C=i*b+h*v+n*y+o*u;c[d]=A,c[d+1]=C,f&&(t<.001?c[d+2]=Math.atan2(h-i,r-s):c[d+2]=Math.atan2(C-(i*w+h*x*2+n*m),A-(s*w+r*x*2+l*m)))}},or=class{data;_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xVelocity=0;yOffset=0;yVelocity=0;rotateOffset=0;rotateVelocity=0;scaleOffset=0;scaleVelocity=0;active=!1;skeleton;remaining=0;lastTime=0;constructor(e,t){this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,i=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,h=this.data.scaleX>0,l=this.bone,n=l.data.length;switch(e){case 0:return;case 1:this.reset();case 2:const a=this.skeleton,o=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=o,this.lastTime=a.time;const c=l.worldX,d=l.worldY;if(this._reset)this._reset=!1,this.ux=c,this.uy=d;else{let f=this.remaining,m=this.inertia,u=this.data.step,g=this.skeleton.data.referenceScale,w=-1,b=this.data.limit*o,x=b*Math.abs(a.scaleY);if(b*=Math.abs(a.scaleX),s||i){if(s){const p=(this.ux-c)*m;this.xOffset+=p>b?b:p<-b?-b:p,this.ux=c}if(i){const p=(this.uy-d)*m;this.yOffset+=p>x?x:p<-x?-x:p,this.uy=d}if(f>=u){w=Math.pow(this.damping,60*u);const p=this.massInverse*u,v=this.strength,y=this.wind*g*a.scaleX,A=this.gravity*g*a.scaleY;do s&&(this.xVelocity+=(y-this.xOffset*v)*p,this.xOffset+=this.xVelocity*u,this.xVelocity*=w),i&&(this.yVelocity-=(A+this.yOffset*v)*p,this.yOffset+=this.yVelocity*u,this.yVelocity*=w),f-=u;while(f>=u)}s&&(l.worldX+=this.xOffset*t*this.data.x),i&&(l.worldY+=this.yOffset*t*this.data.y)}if(r||h){let p=Math.atan2(l.c,l.a),v=0,y=0,A=0,C=this.cx-l.worldX,S=this.cy-l.worldY;if(C>b?C=b:C<-b&&(C=-b),S>x?S=x:S<-x&&(S=-x),r){A=(this.data.rotate+this.data.shearX)*t;let I=Math.atan2(S+this.ty,C+this.tx)-p-this.rotateOffset*A;this.rotateOffset+=(I-Math.ceil(I*P.invPI2-.5)*P.PI2)*m,I=this.rotateOffset*A+p,v=Math.cos(I),y=Math.sin(I),h&&(I=n*l.getWorldScaleX(),I>0&&(this.scaleOffset+=(C*v+S*y)*m/I))}else{v=Math.cos(p),y=Math.sin(p);const I=n*l.getWorldScaleX();I>0&&(this.scaleOffset+=(C*v+S*y)*m/I)}if(f=this.remaining,f>=u){w==-1&&(w=Math.pow(this.damping,60*u));const I=this.massInverse*u,k=this.strength,Y=this.wind,X=fi.yDown?-this.gravity:this.gravity,F=n/g;for(;;)if(f-=u,h&&(this.scaleVelocity+=(Y*v-X*y-this.scaleOffset*k)*I,this.scaleOffset+=this.scaleVelocity*u,this.scaleVelocity*=w),r){if(this.rotateVelocity-=((Y*y+X*v)*F+this.rotateOffset*k)*I,this.rotateOffset+=this.rotateVelocity*u,this.rotateVelocity*=w,f0){let f=0;this.data.rotate>0&&(f=a*this.data.rotate,o=Math.sin(f),c=Math.cos(f),d=l.b,l.b=c*d-o*l.d,l.d=o*d+c*l.d),f+=a*this.data.shearX,o=Math.sin(f),c=Math.cos(f),d=l.a,l.a=c*d-o*l.c,l.c=o*d+c*l.c}else a*=this.data.rotate,o=Math.sin(a),c=Math.cos(a),d=l.a,l.a=c*d-o*l.c,l.c=o*d+c*l.c,d=l.b,l.b=c*d-o*l.d,l.d=o*d+c*l.d}if(h){const a=1+this.scaleOffset*t*this.data.scaleX;l.a*=a,l.c*=a}e!=3&&(this.tx=n*l.a,this.ty=n*l.c),l.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const i=s*P.degRad,r=Math.cos(i),h=Math.sin(i),l=this.cx-e,n=this.cy-t;this.translate(l*r-n*h-l,l*h+n*r-n)}},ci=class{data;bone;color;darkColor=null;attachment=null;attachmentState=0;sequenceIndex=-1;deform=new Array;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new st,this.darkColor=e.darkColor?new st:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof Yt)||!(this.attachment instanceof Yt)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},di=class{data;bones;target;mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;temp=new Vt;active=!1;constructor(e,t){if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i0?P.degRad:-P.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,g=this.bones;for(let w=0,b=g.length;wP.PI?C-=P.PI2:C<-P.PI&&(C+=P.PI2),C*=e;let S=Math.cos(C),I=Math.sin(C);x.a=S*p-I*y,x.b=S*v-I*A,x.c=I*p+S*y,x.d=I*v+S*A}if(l){let p=this.temp;n.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),x.worldX+=(p.x-x.worldX)*t,x.worldY+=(p.y-x.worldY)*s}if(i!=0){let p=Math.sqrt(x.a*x.a+x.c*x.c);p!=0&&(p=(p+(Math.sqrt(a*a+c*c)-p+this.data.offsetScaleX)*i)/p),x.a*=p,x.c*=p}if(r!=0){let p=Math.sqrt(x.b*x.b+x.d*x.d);p!=0&&(p=(p+(Math.sqrt(o*o+d*d)-p+this.data.offsetScaleY)*r)/p),x.b*=p,x.d*=p}if(h>0){let p=x.b,v=x.d,y=Math.atan2(v,p),A=Math.atan2(d,o)-Math.atan2(c,a)-(y-Math.atan2(x.c,x.a));A>P.PI?A-=P.PI2:A<-P.PI&&(A+=P.PI2),A=y+(A+u)*h;let C=Math.sqrt(p*p+v*v);x.b=Math.cos(A)*C,x.d=Math.sin(A)*C}x.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=t!=0||s!=0,n=this.target,a=n.a,o=n.b,c=n.c,d=n.d,f=a*d-o*c>0?P.degRad:-P.degRad,m=this.data.offsetRotation*f,u=this.data.offsetShearY*f,g=this.bones;for(let w=0,b=g.length;wP.PI?C-=P.PI2:C<-P.PI&&(C+=P.PI2),C*=e;let S=Math.cos(C),I=Math.sin(C);x.a=S*p-I*y,x.b=S*v-I*A,x.c=I*p+S*y,x.d=I*v+S*A}if(l){let p=this.temp;n.localToWorld(p.set(this.data.offsetX,this.data.offsetY)),x.worldX+=p.x*t,x.worldY+=p.y*s}if(i!=0){let p=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleX)*i+1;x.a*=p,x.c*=p}if(r!=0){let p=(Math.sqrt(o*o+d*d)-1+this.data.offsetScaleY)*r+1;x.b*=p,x.d*=p}if(h>0){let p=Math.atan2(d,o)-Math.atan2(c,a);p>P.PI?p-=P.PI2:p<-P.PI&&(p+=P.PI2);let v=x.b,y=x.d;p=Math.atan2(y,v)+(p-P.PI/2+u)*h;let A=Math.sqrt(v*v+y*y);x.b=Math.cos(p)*A,x.d=Math.sin(p)*A}x.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,h=this.mixShearY,l=this.target,n=this.bones;for(let a=0,o=n.length;as.data.name==t)??null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(s=>s.data.name==t)??null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(s=>s.data.name==t)??null}findPhysicsConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(s=>s.data.name==t)??null}getBoundsRect(t){let s=new Vt,i=new Vt;return this.getBounds(s,i,void 0,t),{x:s.x,y:s.y,width:i.x,height:i.y}}getBounds(t,s,i=new Array(2),r=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");let h=this.drawOrder,l=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let c=0,d=h.length;c(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(ui||{}),mi=class extends ee{_bone=null;set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;constructor(e){super(e,0,!1)}},Cs=class{name=null;bones=new Array;slots=new Array;skins=new Array;defaultSkin=null;events=new Array;animations=new Array;ikConstraints=new Array;transformConstraints=new Array;pathConstraints=new Array;physicsConstraints=new Array;x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=0;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}},Is=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Is||{}),Ms=class extends ee{bones=new Array;_target=null;set target(e){this._target=e}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;offsetRotation=0;offsetX=0;offsetY=0;offsetScaleX=0;offsetScaleY=0;offsetShearY=0;relative=!1;local=!1;constructor(e){super(e,0,!1)}},hr=class{scale=1;attachmentLoader;linkedMeshes=new Array;constructor(e){this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Cs;s.name="";let i=new gi(e),r=i.readInt32(),h=i.readInt32();s.hash=h==0&&r==0?null:h.toString(16)+r.toString(16),s.version=i.readString(),s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat(),s.referenceScale=i.readFloat()*t;let l=i.readBoolean();l&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let n=0;n=i.readInt(!0);for(let o=0;o>1&3,f.rotateMode=m>>3&3,(m&128)!=0&&(f.offsetRotation=i.readFloat()),f.position=i.readFloat(),f.positionMode==0&&(f.position*=t),f.spacing=i.readFloat(),(f.spacingMode==0||f.spacingMode==1)&&(f.spacing*=t),f.mixRotate=i.readFloat(),f.mixX=i.readFloat(),f.mixY=i.readFloat(),s.pathConstraints.push(f)}n=i.readInt(!0);for(let o=0,c;o>4,e.readFloat())}i.push(y);break}}}}}let h=e.readInt(!0);if(h>0){let a=new zt(h),o=s.slots.length;for(let c=0;c=0;b--)m[b]=-1;let u=L.newArray(o-f,0),g=0,w=0;for(let b=0;b=0;b--)m[b]==-1&&(m[b]=u[--w]);a.setFrame(c,d,m)}i.push(a)}let l=e.readInt(!0);if(l>0){let a=new le(l);for(let o=0;o>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="",s=0;for(let i=0;i>4){case 12:case 13:t+=String.fromCharCode((r&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(r),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},cr=class{parent;skinIndex;slotIndex;mesh;inheritTimeline;constructor(e,t,s,i,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}},dr=class{constructor(e=null,t=null,s=0){this.bones=e,this.vertices=t,this.length=s}};function gt(e,t,s){let i=e.readFloat(),r=e.readFloat()*s;for(let h=0,l=0,n=t.getFrameCount()-1;t.setFrame(h,i,r),h!=n;h++){let a=e.readFloat(),o=e.readFloat()*s;switch(e.readByte()){case kt:t.setStepped(h);break;case Ft:at(e,t,l++,h,0,i,a,r,o,s)}i=a,r=o}return t}function Es(e,t,s){let i=e.readFloat(),r=e.readFloat()*s,h=e.readFloat()*s;for(let l=0,n=0,a=t.getFrameCount()-1;t.setFrame(l,i,r,h),l!=a;l++){let o=e.readFloat(),c=e.readFloat()*s,d=e.readFloat()*s;switch(e.readByte()){case kt:t.setStepped(l);break;case Ft:at(e,t,n++,l,0,i,o,r,c,s),at(e,t,n++,l,1,i,o,h,d,s)}i=o,r=c,h=d}return t}function at(e,t,s,i,r,h,l,n,a,o){t.setBezier(s,i,r,h,n,e.readFloat(),e.readFloat()*o,e.readFloat(),e.readFloat()*o,l,a)}var fr=0,ur=1,mr=2,gr=3,xr=4,pr=5,wr=6,br=7,vr=8,yr=9,Ar=10,Cr=0,Sr=1,Tr=2,Ir=3,Mr=4,Er=5,Rr=0,Yr=1,kr=0,Fr=1,Xr=2,Pr=0,Lr=1,Br=2,Vr=4,Or=5,Dr=6,Nr=7,Ur=8,kt=1,Ft=2,xi=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=new Array;polygons=new Array;polygonPool=new Jt(()=>L.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,h=e.slots,l=h.length;s.length=0,r.freeAll(i),i.length=0;for(let n=0;n=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let r=this.minX,h=this.minY,l=this.maxX,n=this.maxY;if(e<=r&&s<=r||t<=h&&i<=h||e>=l&&s>=l||t>=n&&i>=n)return!1;let a=(i-t)/(s-e),o=a*(r-e)+t;if(o>h&&oh&&or&&cr&&ce.minX&&this.minYe.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,r=s.length;i=s||o=s){let c=i[n];c+(s-a)/(o-a)*(i[h]-c)=c&&p<=m||p>=m&&p<=c)&&(p>=t&&p<=i||p>=i&&p<=t)){let v=(o*b-a*g)/x;if((v>=d&&v<=u||v>=u&&v<=d)&&(v>=s&&v<=r||v>=r&&v<=s))return!0}c=m,d=u}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");let t=this.boundingBoxes.indexOf(e);return t==-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},pi=class vt{convexPolygons=new Array;convexPolygonsIndices=new Array;indicesArray=new Array;isConcaveArray=new Array;triangles=new Array;polygonPool=new Jt(()=>new Array);polygonIndicesPool=new Jt(()=>new Array);triangulate(t){let s=t,i=t.length>>1,r=this.indicesArray;r.length=0;for(let n=0;n3;){let n=i-1,a=0,o=1;for(;;){t:if(!h[a]){let f=r[n]<<1,m=r[a]<<1,u=r[o]<<1,g=s[f],w=s[f+1],b=s[m],x=s[m+1],p=s[u],v=s[u+1];for(let y=(o+1)%i;y!=n;y=(y+1)%i){if(!h[y])continue;let A=r[y]<<1,C=s[A],S=s[A+1];if(vt.positiveArea(p,v,g,w,C,S)&&vt.positiveArea(g,w,b,x,C,S)&&vt.positiveArea(b,x,p,v,C,S))break t}break}if(o==0){do{if(!h[a])break;a--}while(a>0);break}n=a,a=o,o=(o+1)%i}l.push(r[(i+a-1)%i]),l.push(r[a]),l.push(r[(a+1)%i]),r.splice(a,1),h.splice(a,1),i--;let c=(i+a-1)%i,d=a==i?0:a;h[c]=vt.isConcave(c,i,s,r),h[d]=vt.isConcave(d,i,s,r)}return i==3&&(l.push(r[2]),l.push(r[0]),l.push(r[1])),l}decompose(t,s){let i=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;let h=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(h),h.length=0;let l=this.polygonIndicesPool.obtain();l.length=0;let n=this.polygonPool.obtain();n.length=0;let a=-1,o=0;for(let c=0,d=s.length;c0?(r.push(n),h.push(l)):(this.polygonPool.free(n),this.polygonIndicesPool.free(l)),n=this.polygonPool.obtain(),n.length=0,n.push(g),n.push(w),n.push(b),n.push(x),n.push(p),n.push(v),l=this.polygonIndicesPool.obtain(),l.length=0,l.push(f),l.push(m),l.push(u),o=vt.winding(g,w,b,x,p,v),a=f)}n.length>0&&(r.push(n),h.push(l));for(let c=0,d=r.length;c=0;c--)n=r[c],n.length==0&&(r.splice(c,1),this.polygonPool.free(n),l=h[c],h.splice(c,1),this.polygonIndicesPool.free(l));return r}static isConcave(t,s,i,r){let h=r[(s+t-1)%s]<<1,l=r[t]<<1,n=r[(t+1)%s]<<1;return!this.positiveArea(i[h],i[h+1],i[l],i[l+1],i[n],i[n+1])}static positiveArea(t,s,i,r,h,l){return t*(l-r)+i*(s-l)+h*(r-s)>=0}static winding(t,s,i,r,h,l){let n=i-t,a=r-s;return h*a-l*n+n*s-t*a>=0?1:-1}},wi=class Us{triangulator=new pi;clippingPolygon=new Array;clipOutput=new Array;clippedVertices=new Array;clippedUVs=new Array;clippedTriangles=new Array;scratch=new Array;clipAttachment=null;clippingPolygons=null;clipStart(t,s){if(this.clipAttachment)return 0;this.clipAttachment=s;let i=s.worldVerticesLength,r=L.setArraySize(this.clippingPolygon,i);s.computeWorldVertices(t,0,i,r,0,2);let h=this.clippingPolygon;Us.makeClockwise(h);let l=this.clippingPolygons=this.triangulator.decompose(h,this.triangulator.triangulate(h));for(let n=0,a=l.length;n>1,A=this.clipOutput,C=L.setArraySize(h,p+y*2);for(let I=0;I>1,ut=this.clipOutput,J=L.setArraySize(o,R+ot*m);for(let ht=0;ht>1,it=this.clipOutput,ct=L.setArraySize(l,Y+O*2),ot=L.setArraySize(n,Y+O*2);for(let J=0;J=2?(d=a,a=this.scratch):d=this.scratch,d.length=0,d.push(t),d.push(s),d.push(i),d.push(r),d.push(h),d.push(l),d.push(t),d.push(s),a.length=0;let f=n.length-4,m=n;for(let u=0;;u+=2){let g=m[u],w=m[u+1],b=g-m[u+2],x=w-m[u+3],p=a.length,v=d;for(let A=0,C=d.length-2;Ab*(w-Y),F=x*(g-S)-b*(w-I);if(F>0){if(X){a.push(k),a.push(Y);continue}let R=k-S,M=Y-I,V=F/(R*x-M*b);if(V>=0&&V<=1)a.push(S+R*V),a.push(I+M*V);else{a.push(k),a.push(Y);continue}}else if(X){let R=k-S,M=Y-I,V=F/(R*x-M*b);if(V>=0&&V<=1)a.push(S+R*V),a.push(I+M*V),a.push(k),a.push(Y);else{a.push(k),a.push(Y);continue}}c=!0}if(p==a.length)return o.length=0,!0;if(a.push(a[0]),a.push(a[1]),u==f)break;let y=a;a=d,a.length=0,d=y}if(o!=a){o.length=0;for(let u=0,g=a.length-2;u>1;o0){let o=s.findPhysicsConstraint(l);if(!o)throw new Error("Physics constraint not found: "+l);a=s.physicsConstraints.indexOf(o)}for(let o in n){let c=n[o],d=c[0];if(!d)continue;let f=c.length;if(o=="reset"){const u=new rs(f,a);for(let g=0;d!=null;d=c[g+1],g++)u.setFrame(g,E(d,"time",0));r.push(u);continue}let m;if(o=="inertia")m=new Je(f,f,a);else if(o=="strength")m=new Qe(f,f,a);else if(o=="damping")m=new $e(f,f,a);else if(o=="mass")m=new ts(f,f,a);else if(o=="wind")m=new es(f,f,a);else if(o=="gravity")m=new ss(f,f,a);else if(o=="mix")m=new is(f,f,a);else continue;r.push(St(c,m,0,1))}}if(e.attachments)for(let l in e.attachments){let n=e.attachments[l],a=s.findSkin(l);if(!a)throw new Error("Skin not found: "+l);for(let o in n){let c=n[o],d=s.findSlot(o);if(!d)throw new Error("Slot not found: "+o);let f=d.index;for(let m in c){let u=c[m],g=a.getAttachment(f,m);for(let w in u){let b=u[w],x=b[0];if(x){if(w=="deform"){let p=g.bones,v=g.vertices,y=p?v.length/3*2:v.length,A=new Ge(b.length,b.length,f,g),C=E(x,"time",0);for(let S=0,I=0;;S++){let k,Y=E(x,"vertices",null);if(!Y)k=p?L.newFloatArray(y):v;else{k=L.newFloatArray(y);let M=E(x,"offset",0);if(L.arrayCopy(Y,0,k,M,Y.length),i!=1)for(let V=M,B=V+Y.length;V=0;w--)d[w]==-1&&(d[w]=m[--g])}l.setFrame(a,E(c,"time",0),d)}r.push(l)}if(e.events){let l=new le(e.events.length),n=0;for(let a=0;a"u"&&(Math.fround=function(e){return function(t){return e[0]=t,e[0]}}(new Float32Array(1)));var xt=class{canvas;gl;restorables=[];constructor(e,t={alpha:!0}){if(e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext)this.gl=e,this.canvas=this.gl.canvas;else{const s=e;this.gl=s.getContext("webgl2",t)||s.getContext("webgl",t),this.canvas=s,s.addEventListener("webglcontextlost",this.contextLostHandler),s.addEventListener("webglcontextrestored",this.contextRestoredHandler)}}contextLostHandler=e=>{e&&e.preventDefault()};contextRestoredHandler=()=>{for(let e=0,t=this.restorables.length;e-1&&this.restorables.splice(t,1)}},Gt=class Te extends cs{context;texture=null;boundUnit=0;useMipMaps=!1;static DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL=!1;constructor(t,s,i=!1){super(s),this.context=t instanceof xt?t:new xt(t),this.useMipMaps=i,this.restore(),this.context.addRestorable(this)}setFilters(t,s){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,Te.validateMagFilter(s)),this.useMipMaps=Te.usesMipMaps(t),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(t){switch(t){case 9987:case 9985:case 9986:case 9984:return 9729;default:return t}}static usesMipMaps(t){switch(t){case 9987:case 9985:case 9986:case 9984:return!0;default:return!1}}setWraps(t,s){let i=this.context.gl;this.bind(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,s)}update(t){let s=this.context.gl;this.texture||(this.texture=this.context.gl.createTexture()),this.bind(),Te.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,this._image),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,t?s.LINEAR_MIPMAP_LINEAR:s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),t&&s.generateMipmap(s.TEXTURE_2D)}restore(){this.texture=null,this.update(this.useMipMaps)}bind(t=0){let s=this.context.gl;this.boundUnit=t,s.activeTexture(s.TEXTURE0+t),s.bindTexture(s.TEXTURE_2D,this.texture)}unbind(){let t=this.context.gl;t.activeTexture(t.TEXTURE0+this.boundUnit),t.bindTexture(t.TEXTURE_2D,null)}dispose(){this.context.removeRestorable(this),this.context.gl.deleteTexture(this.texture)}},bi=class extends ai{constructor(e,t="",s=new gs){super(i=>new Gt(e,i),t,s)}},At=class{x=0;y=0;z=0;constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.z=s}setFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,s){return this.x=e,this.y=t,this.z=s,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}normalize(){let e=this.length();return e==0?this:(e=1/e,this.x*=e,this.y*=e,this.z*=e,this)}cross(e){return this.set(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}multiply(e){let t=e.values;return this.set(this.x*t[D]+this.y*t[G]+this.z*t[H]+t[N],this.x*t[_]+this.y*t[U]+this.z*t[j]+t[z],this.x*t[Z]+this.y*t[K]+this.z*t[W]+t[q])}project(e){let t=e.values,s=1/(this.x*t[$]+this.y*t[tt]+this.z*t[et]+t[Q]);return this.set((this.x*t[D]+this.y*t[G]+this.z*t[H]+t[N])*s,(this.x*t[_]+this.y*t[U]+this.z*t[j]+t[z])*s,(this.x*t[Z]+this.y*t[K]+this.z*t[W]+t[q])*s)}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distance(e){let t=e.x-this.x,s=e.y-this.y,i=e.z-this.z;return Math.sqrt(t*t+s*s+i*i)}},D=0,G=4,H=8,N=12,_=1,U=5,j=9,z=13,Z=2,K=6,W=10,q=14,$=3,tt=7,et=11,Q=15,se=class Rt{temp=new Float32Array(16);values=new Float32Array(16);static xAxis=new At;static yAxis=new At;static zAxis=new At;static tmpMatrix=new Rt;constructor(){let t=this.values;t[D]=1,t[U]=1,t[W]=1,t[Q]=1}set(t){return this.values.set(t),this}transpose(){let t=this.temp,s=this.values;return t[D]=s[D],t[G]=s[_],t[H]=s[Z],t[N]=s[$],t[_]=s[G],t[U]=s[U],t[j]=s[K],t[z]=s[tt],t[Z]=s[H],t[K]=s[j],t[W]=s[W],t[q]=s[et],t[$]=s[N],t[t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math.PI/180)/2),l=(s+t)/(t-s),n=2*s*t/(t-s),a=this.values;return a[D]=h/r,a[_]=0,a[Z]=0,a[$]=0,a[G]=0,a[U]=h,a[K]=0,a[tt]=0,a[H]=0,a[j]=0,a[W]=l,a[et]=-1,a[N]=0,a[z]=0,a[q]=n,a[Q]=0,this}ortho2d(t,s,i,r){return this.ortho(t,t+i,s,s+r,0,1)}ortho(t,s,i,r,h,l){this.identity();let n=2/(s-t),a=2/(r-i),o=-2/(l-h),c=-(s+t)/(s-t),d=-(r+i)/(r-i),f=-(l+h)/(l-h),m=this.values;return m[D]=n,m[_]=0,m[Z]=0,m[$]=0,m[G]=0,m[U]=a,m[K]=0,m[tt]=0,m[H]=0,m[j]=0,m[W]=o,m[et]=0,m[N]=c,m[z]=d,m[q]=f,m[Q]=1,this}multiply(t){let s=this.temp,i=this.values,r=t.values;return s[D]=i[D]*r[D]+i[G]*r[_]+i[H]*r[Z]+i[N]*r[$],s[G]=i[D]*r[G]+i[G]*r[U]+i[H]*r[K]+i[N]*r[tt],s[H]=i[D]*r[H]+i[G]*r[j]+i[H]*r[W]+i[N]*r[et],s[N]=i[D]*r[N]+i[G]*r[z]+i[H]*r[q]+i[N]*r[Q],s[_]=i[_]*r[D]+i[U]*r[_]+i[j]*r[Z]+i[z]*r[$],s[U]=i[_]*r[G]+i[U]*r[U]+i[j]*r[K]+i[z]*r[tt],s[j]=i[_]*r[H]+i[U]*r[j]+i[j]*r[W]+i[z]*r[et],s[z]=i[_]*r[N]+i[U]*r[z]+i[j]*r[q]+i[z]*r[Q],s[Z]=i[Z]*r[D]+i[K]*r[_]+i[W]*r[Z]+i[q]*r[$],s[K]=i[Z]*r[G]+i[K]*r[U]+i[W]*r[K]+i[q]*r[tt],s[W]=i[Z]*r[H]+i[K]*r[j]+i[W]*r[W]+i[q]*r[et],s[q]=i[Z]*r[N]+i[K]*r[z]+i[W]*r[q]+i[q]*r[Q],s[$]=i[$]*r[D]+i[tt]*r[_]+i[et]*r[Z]+i[Q]*r[$],s[tt]=i[$]*r[G]+i[tt]*r[U]+i[et]*r[K]+i[Q]*r[tt],s[et]=i[$]*r[H]+i[tt]*r[j]+i[et]*r[W]+i[Q]*r[et],s[Q]=i[$]*r[N]+i[tt]*r[z]+i[et]*r[q]+i[Q]*r[Q],this.set(this.temp)}multiplyLeft(t){let s=this.temp,i=this.values,r=t.values;return s[D]=r[D]*i[D]+r[G]*i[_]+r[H]*i[Z]+r[N]*i[$],s[G]=r[D]*i[G]+r[G]*i[U]+r[H]*i[K]+r[N]*i[tt],s[H]=r[D]*i[H]+r[G]*i[j]+r[H]*i[W]+r[N]*i[et],s[N]=r[D]*i[N]+r[G]*i[z]+r[H]*i[q]+r[N]*i[Q],s[_]=r[_]*i[D]+r[U]*i[_]+r[j]*i[Z]+r[z]*i[$],s[U]=r[_]*i[G]+r[U]*i[U]+r[j]*i[K]+r[z]*i[tt],s[j]=r[_]*i[H]+r[U]*i[j]+r[j]*i[W]+r[z]*i[et],s[z]=r[_]*i[N]+r[U]*i[z]+r[j]*i[q]+r[z]*i[Q],s[Z]=r[Z]*i[D]+r[K]*i[_]+r[W]*i[Z]+r[q]*i[$],s[K]=r[Z]*i[G]+r[K]*i[U]+r[W]*i[K]+r[q]*i[tt],s[W]=r[Z]*i[H]+r[K]*i[j]+r[W]*i[W]+r[q]*i[et],s[q]=r[Z]*i[N]+r[K]*i[z]+r[W]*i[q]+r[q]*i[Q],s[$]=r[$]*i[D]+r[tt]*i[_]+r[et]*i[Z]+r[Q]*i[$],s[tt]=r[$]*i[G]+r[tt]*i[U]+r[et]*i[K]+r[Q]*i[tt],s[et]=r[$]*i[H]+r[tt]*i[j]+r[et]*i[W]+r[Q]*i[et],s[Q]=r[$]*i[N]+r[tt]*i[z]+r[et]*i[q]+r[Q]*i[Q],this.set(this.temp)}lookAt(t,s,i){let r=Rt.xAxis,h=Rt.yAxis,l=Rt.zAxis;l.setFrom(s).normalize(),r.setFrom(s).normalize(),r.cross(i).normalize(),h.setFrom(r).cross(l).normalize(),this.identity();let n=this.values;return n[D]=r.x,n[G]=r.y,n[H]=r.z,n[_]=h.x,n[U]=h.y,n[j]=h.z,n[Z]=-l.x,n[K]=-l.y,n[W]=-l.z,Rt.tmpMatrix.identity(),Rt.tmpMatrix.values[N]=-t.x,Rt.tmpMatrix.values[z]=-t.y,Rt.tmpMatrix.values[q]=-t.z,this.multiply(Rt.tmpMatrix),this}},vi=class{position=new At(0,0,0);direction=new At(0,0,-1);up=new At(0,1,0);near=0;far=100;zoom=1;viewportWidth=0;viewportHeight=0;projectionView=new se;inverseProjectionView=new se;projection=new se;view=new se;constructor(e,t){this.viewportWidth=e,this.viewportHeight=t,this.update()}update(){let e=this.projection,t=this.view,s=this.projectionView,i=this.inverseProjectionView,r=this.zoom,h=this.viewportWidth,l=this.viewportHeight;e.ortho(r*(-h/2),r*(h/2),r*(-l/2),r*(l/2),this.near,this.far),t.lookAt(this.position,this.direction,this.up),s.set(e.values),s.multiply(t),i.set(s.values).invert()}screenToWorld(e,t,s){let i=e.x,r=s-e.y-1;return e.x=2*i/t-1,e.y=2*r/s-1,e.z=2*e.z-1,e.project(this.inverseProjectionView),e}worldToScreen(e,t,s){return e.project(this.projectionView),e.x=t*(e.x+1)/2,e.y=s*(e.y+1)/2,e.z=(e.z+1)/2,e}setViewport(e,t){this.viewportWidth=e,this.viewportHeight=t}},Ys=class{element;mouseX=0;mouseY=0;buttonDown=!1;touch0=null;touch1=null;initialPinchDistance=0;listeners=new Array;autoPreventDefault;isTouch=!1;callbacks;constructor(e,t=!0){this.element=e,this.autoPreventDefault=t,this.callbacks=this.setupCallbacks(e)}setupCallbacks(e){const t=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=e.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.buttonDown=!0,this.listeners.map(c=>{c.down&&c.down(this.mouseX,this.mouseY,a)})}},s=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=e.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.listeners.map(c=>{this.buttonDown?c.dragged&&c.dragged(this.mouseX,this.mouseY,a):c.moved&&c.moved(this.mouseX,this.mouseY,a)})}},i=a=>{if(a instanceof MouseEvent&&!this.isTouch){let o=e.getBoundingClientRect();this.mouseX=a.clientX-o.left,this.mouseY=a.clientY-o.top,this.buttonDown=!1,this.listeners.map(c=>{c.up&&c.up(this.mouseX,this.mouseY,a)})}},r=a=>{this.autoPreventDefault&&a.preventDefault();let o=a.deltaY;a.deltaMode==WheelEvent.DOM_DELTA_LINE&&(o*=8),a.deltaMode==WheelEvent.DOM_DELTA_PAGE&&(o*=24),this.listeners.map(c=>{c.wheel&&c.wheel(a.deltaY,a)})},h=a=>{if(this.isTouch=!0,!this.touch0||!this.touch1){var o=a.changedTouches;let c=o.item(0);if(!c)return;let d=e.getBoundingClientRect(),f=c.clientX-d.left,m=c.clientY-d.top,u=new yi(c.identifier,f,m);if(this.mouseX=f,this.mouseY=m,this.buttonDown=!0,!this.touch0)this.touch0=u,this.listeners.map(g=>{g.down&&g.down(u.x,u.y,a)});else if(!this.touch1){this.touch1=u;let g=this.touch1.x-this.touch0.x,w=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(g*g+w*w),this.listeners.map(b=>{b.zoom&&b.zoom(this.initialPinchDistance,this.initialPinchDistance,a)})}}this.autoPreventDefault&&a.preventDefault()},l=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let f=e.getBoundingClientRect();for(var c=0;c{g.dragged&&g.dragged(m,u,a)})),this.touch1&&this.touch1.identifier===d.identifier&&(this.touch1.x=this.mouseX=m,this.touch1.y=this.mouseY=u)}if(this.touch0&&this.touch1){let m=this.touch1.x-this.touch0.x,u=this.touch1.x-this.touch0.x,g=Math.sqrt(m*m+u*u);this.listeners.map(w=>{w.zoom&&w.zoom(this.initialPinchDistance,g,a)})}}this.autoPreventDefault&&a.preventDefault()},n=a=>{if(this.isTouch=!0,this.touch0){var o=a.changedTouches;let f=e.getBoundingClientRect();for(var c=0;c{g.up&&g.up(m,u,a)}),this.touch1)this.touch0=this.touch1,this.touch1=null,this.mouseX=this.touch0.x,this.mouseX=this.touch0.x,this.buttonDown=!0,this.listeners.map(g=>{g.down&&g.down(this.touch0.x,this.touch0.y,a)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}this.autoPreventDefault&&a.preventDefault()};return e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",s,!0),e.addEventListener("mouseup",i,!0),e.addEventListener("wheel",r,!0),e.addEventListener("touchstart",h,{passive:!1,capture:!1}),e.addEventListener("touchmove",l,{passive:!1,capture:!1}),e.addEventListener("touchend",n,{passive:!1,capture:!1}),e.addEventListener("touchcancel",n),{mouseDown:t,mouseMove:s,mouseUp:i,mouseWheel:r,touchStart:h,touchMove:l,touchEnd:n}}dispose(){const e=this.element;e.removeEventListener("mousedown",this.callbacks.mouseDown,!0),e.removeEventListener("mousemove",this.callbacks.mouseMove,!0),e.removeEventListener("mouseup",this.callbacks.mouseUp,!0),e.removeEventListener("wheel",this.callbacks.mouseWheel,!0),e.removeEventListener("touchstart",this.callbacks.touchStart,{capture:!1}),e.removeEventListener("touchmove",this.callbacks.touchMove,{capture:!1}),e.removeEventListener("touchend",this.callbacks.touchEnd,{capture:!1}),e.removeEventListener("touchcancel",this.callbacks.touchEnd),this.listeners.length=0}addListener(e){this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}},yi=class{constructor(e,t,s){this.identifier=e,this.x=t,this.y=s}},qr=class{constructor(e,t){this.canvas=e,this.camera=t;let s=0,i=0,r=0,h=0,l=0,n=0,a=0,o=0;new Ys(e).addListener({down:(c,d)=>{s=t.position.x,i=t.position.y,h=n=c,l=a=d,o=t.zoom},dragged:(c,d)=>{let f=c-h,m=d-l,u=t.screenToWorld(new At(0,0),e.clientWidth,e.clientHeight),g=t.screenToWorld(new At(f,m),e.clientWidth,e.clientHeight).sub(u);t.position.set(s-g.x,i-g.y,0),t.update(),n=c,a=d},wheel:c=>{let d=c/200*t.zoom,f=t.zoom+d;if(f>0){let m=0,u=0;if(c<0)m=n,u=a;else{let b=new At(e.clientWidth/2+15,e.clientHeight/2),x=n-b.x,p=e.clientHeight-1-a-b.y;m=b.x-x,u=e.clientHeight-1-b.y+p}let g=t.screenToWorld(new At(m,u),e.clientWidth,e.clientHeight);t.zoom=f,t.update();let w=t.screenToWorld(new At(m,u),e.clientWidth,e.clientHeight);t.position.add(g.sub(w)),t.update()}},zoom:(c,d)=>{let f=c/d;t.zoom=o*f},up:(c,d)=>{n=c,a=d},moved:(c,d)=>{n=c,a=d}})}},Tt=class dt{constructor(t,s,i){this.vertexShader=s,this.fragmentShader=i,this.vsSource=s,this.fsSource=i,this.context=t instanceof xt?t:new xt(t),this.context.addRestorable(this),this.compile()}static MVP_MATRIX="u_projTrans";static POSITION="a_position";static COLOR="a_color";static COLOR2="a_color2";static TEXCOORDS="a_texCoords";static SAMPLER="u_texture";context;vs=null;vsSource;fs=null;fsSource;program=null;tmp2x2=new Float32Array(2*2);tmp3x3=new Float32Array(3*3);tmp4x4=new Float32Array(4*4);getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){let t=this.context.gl;try{if(this.vs=this.compileShader(t.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(t.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(s){throw this.dispose(),s}}compileShader(t,s){let i=this.context.gl,r=i.createShader(t);if(!r)throw new Error("Couldn't create shader.");if(i.shaderSource(r,s),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS)){let h="Couldn't compile shader: "+i.getShaderInfoLog(r);if(i.deleteShader(r),!i.isContextLost())throw new Error(h)}return r}compileProgram(t,s){let i=this.context.gl,r=i.createProgram();if(!r)throw new Error("Couldn't compile program.");if(i.attachShader(r,t),i.attachShader(r,s),i.linkProgram(r),!i.getProgramParameter(r,i.LINK_STATUS)){let h="Couldn't compile shader program: "+i.getProgramInfoLog(r);if(i.deleteProgram(r),!i.isContextLost())throw new Error(h)}return r}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(t,s){this.context.gl.uniform1i(this.getUniformLocation(t),s)}setUniformf(t,s){this.context.gl.uniform1f(this.getUniformLocation(t),s)}setUniform2f(t,s,i){this.context.gl.uniform2f(this.getUniformLocation(t),s,i)}setUniform3f(t,s,i,r){this.context.gl.uniform3f(this.getUniformLocation(t),s,i,r)}setUniform4f(t,s,i,r,h){this.context.gl.uniform4f(this.getUniformLocation(t),s,i,r,h)}setUniform2x2f(t,s){let i=this.context.gl;this.tmp2x2.set(s),i.uniformMatrix2fv(this.getUniformLocation(t),!1,this.tmp2x2)}setUniform3x3f(t,s){let i=this.context.gl;this.tmp3x3.set(s),i.uniformMatrix3fv(this.getUniformLocation(t),!1,this.tmp3x3)}setUniform4x4f(t,s){let i=this.context.gl;this.tmp4x4.set(s),i.uniformMatrix4fv(this.getUniformLocation(t),!1,this.tmp4x4)}getUniformLocation(t){let s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=s.getUniformLocation(this.program,t);if(!i&&!s.isContextLost())throw new Error(`Couldn't find location for uniform ${t}`);return i}getAttributeLocation(t){let s=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let i=s.getAttribLocation(this.program,t);if(i==-1&&!s.isContextLost())throw new Error(`Couldn't find location for attribute ${t}`);return i}dispose(){this.context.removeRestorable(this);let t=this.context.gl;this.vs&&(t.deleteShader(this.vs),this.vs=null),this.fs&&(t.deleteShader(this.fs),this.fs=null),this.program&&(t.deleteProgram(this.program),this.program=null)}static newColoredTextured(t){let s=` attribute vec4 ${dt.POSITION}; attribute vec4 ${dt.COLOR}; attribute vec2 ${dt.TEXCOORDS}; uniform mat4 ${dt.MVP_MATRIX}; varying vec4 v_color; varying vec2 v_texCoords; void main () { v_color = ${dt.COLOR}; v_texCoords = ${dt.TEXCOORDS}; gl_Position = ${dt.MVP_MATRIX} * ${dt.POSITION}; } `,i=` #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 dt(t,s,i)}static newTwoColoredTextured(t){let s=` attribute vec4 ${dt.POSITION}; attribute vec4 ${dt.COLOR}; attribute vec4 ${dt.COLOR2}; attribute vec2 ${dt.TEXCOORDS}; uniform mat4 ${dt.MVP_MATRIX}; varying vec4 v_light; varying vec4 v_dark; varying vec2 v_texCoords; void main () { v_light = ${dt.COLOR}; v_dark = ${dt.COLOR2}; v_texCoords = ${dt.TEXCOORDS}; gl_Position = ${dt.MVP_MATRIX} * ${dt.POSITION}; } `,i=` #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 dt(t,s,i)}static newColored(t){let s=` attribute vec4 ${dt.POSITION}; attribute vec4 ${dt.COLOR}; uniform mat4 ${dt.MVP_MATRIX}; varying vec4 v_color; void main () { v_color = ${dt.COLOR}; gl_Position = ${dt.MVP_MATRIX} * ${dt.POSITION}; } `,i=` #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 dt(t,s,i)}},ks=class{constructor(e,t,s,i){this.attributes=t,this.context=e instanceof xt?e:new xt(e),this.elementsPerVertex=0;for(let r=0;rthis.vertices.length)throw Error("Mesh can't store more than "+this.maxVertices()+" vertices");this.vertices.set(e,0),this.verticesLength=e.length}setIndices(e){if(this.dirtyIndices=!0,e.length>this.indices.length)throw Error("Mesh can't store more than "+this.maxIndices()+" indices");this.indices.set(e,0),this.indicesLength=e.length}draw(e,t){this.drawWithOffset(e,t,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(e,t,s,i){let r=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(e),this.indicesLength>0?r.drawElements(t,i,r.UNSIGNED_SHORT,s*2):r.drawArrays(t,s,i),this.unbind(e)}bind(e){let t=this.context.gl;t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer);let s=0;for(let i=0;i0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(e){let t=this.context.gl;for(let s=0;s0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}update(){let e=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=e.createBuffer()),e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),e.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=e.createBuffer()),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),e.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);let e=this.context.gl;e.deleteBuffer(this.verticesBuffer),e.deleteBuffer(this.indicesBuffer)}},Ht=class{constructor(e,t,s){this.name=e,this.type=t,this.numElements=s}},ue=class extends Ht{constructor(){super(Tt.POSITION,0,2)}},Gr=class extends Ht{constructor(){super(Tt.POSITION,0,3)}},Fs=class extends Ht{constructor(e=0){super(Tt.TEXCOORDS+(e==0?"":e),0,2)}},me=class extends Ht{constructor(){super(Tt.COLOR,0,4)}},Ai=class extends Ht{constructor(){super(Tt.COLOR2,0,4)}},Ci=(e=>(e[e.Float=0]="Float",e))(Ci||{}),Xt=1,Hr=769,Si=770,Ti=771,Ii=774,Xs=class Ut{static disableCulling=!1;context;drawCalls=0;static globalDrawCalls=0;isDrawing=!1;mesh;shader=null;lastTexture=null;verticesLength=0;indicesLength=0;srcColorBlend;srcAlphaBlend;dstBlend;cullWasEnabled=!1;constructor(t,s=!0,i=10920){if(i>10920)throw new Error("Can't have more than 10920 triangles per batch: "+i);this.context=t instanceof xt?t:new xt(t);let r=s?[new ue,new me,new Fs,new Ai]:[new ue,new me,new Fs];this.mesh=new ks(t,r,i,i*3);let h=this.context.gl;this.srcColorBlend=h.SRC_ALPHA,this.srcAlphaBlend=h.ONE,this.dstBlend=h.ONE_MINUS_SRC_ALPHA}begin(t){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=t,this.lastTexture=null,this.isDrawing=!0;let s=this.context.gl;s.enable(s.BLEND),s.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),Ut.disableCulling&&(this.cullWasEnabled=s.isEnabled(s.CULL_FACE),this.cullWasEnabled&&s.disable(s.CULL_FACE))}static blendModesGL=[{srcRgb:Si,srcRgbPma:Xt,dstRgb:Ti,srcAlpha:Xt},{srcRgb:Si,srcRgbPma:Xt,dstRgb:Xt,srcAlpha:Xt},{srcRgb:Ii,srcRgbPma:Ii,dstRgb:Ti,srcAlpha:Xt},{srcRgb:Xt,srcRgbPma:Xt,dstRgb:Hr,srcAlpha:Xt}];setBlendMode(t,s){const i=Ut.blendModesGL[t],r=s?i.srcRgbPma:i.srcRgb,h=i.srcAlpha,l=i.dstRgb;if(this.srcColorBlend==r&&this.srcAlphaBlend==h&&this.dstBlend==l)return;this.srcColorBlend=r,this.srcAlphaBlend=h,this.dstBlend=l,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(r,l,h,l)}draw(t,s,i){t!=this.lastTexture?(this.flush(),this.lastTexture=t):(this.verticesLength+s.length>this.mesh.getVertices().length||this.indicesLength+i.length>this.mesh.getIndices().length)&&this.flush();let r=this.mesh.numVertices();this.mesh.getVertices().set(s,this.verticesLength),this.verticesLength+=s.length,this.mesh.setVerticesLength(this.verticesLength);let h=this.mesh.getIndices();for(let l=this.indicesLength,n=0;n0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;let t=this.context.gl;t.disable(t.BLEND),Ut.disableCulling&&this.cullWasEnabled&&t.enable(t.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let t=Ut.globalDrawCalls;return Ut.globalDrawCalls=0,t}dispose(){this.mesh.dispose()}},Ps=class{context;isDrawing=!1;mesh;shapeType=4;color=new st(1,1,1,1);shader=null;vertexIndex=0;tmp=new Vt;srcColorBlend;srcAlphaBlend;dstBlend;constructor(e,t=10920){if(t>10920)throw new Error("Can't have more than 10920 triangles per batch: "+t);this.context=e instanceof xt?e:new xt(e),this.mesh=new ks(e,[new ue,new me],t,0);let s=this.context.gl;this.srcColorBlend=s.SRC_ALPHA,this.srcAlphaBlend=s.ONE,this.dstBlend=s.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("ShapeRenderer.begin() has already been called");this.shader=e,this.vertexIndex=0,this.isDrawing=!0;let t=this.context.gl;t.enable(t.BLEND),t.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend)}setBlendMode(e,t,s){this.srcColorBlend=e,this.srcAlphaBlend=t,this.dstBlend=s,this.isDrawing&&(this.flush(),this.context.gl.blendFuncSeparate(e,s,t,s))}setColor(e){this.color.setFromColor(e)}setColorWith(e,t,s,i){this.color.set(e,t,s,i)}point(e,t,s){this.check(0,1),s||(s=this.color),this.vertex(e,t,s)}line(e,t,s,i,r){this.check(1,2);let h=this.mesh.getVertices(),l=this.vertexIndex;r||(r=this.color),this.vertex(e,t,r),this.vertex(s,i,r)}triangle(e,t,s,i,r,h,l,n,a,o){this.check(e?4:1,3);let c=this.mesh.getVertices(),d=this.vertexIndex;n||(n=this.color),a||(a=this.color),o||(o=this.color),e?(this.vertex(t,s,n),this.vertex(i,r,a),this.vertex(h,l,o)):(this.vertex(t,s,n),this.vertex(i,r,a),this.vertex(i,r,n),this.vertex(h,l,a),this.vertex(h,l,n),this.vertex(t,s,a))}quad(e,t,s,i,r,h,l,n,a,o,c,d,f){this.check(e?4:1,3);let m=this.mesh.getVertices(),u=this.vertexIndex;o||(o=this.color),c||(c=this.color),d||(d=this.color),f||(f=this.color),e?(this.vertex(t,s,o),this.vertex(i,r,c),this.vertex(h,l,d),this.vertex(h,l,d),this.vertex(n,a,f),this.vertex(t,s,o)):(this.vertex(t,s,o),this.vertex(i,r,c),this.vertex(i,r,c),this.vertex(h,l,d),this.vertex(h,l,d),this.vertex(n,a,f),this.vertex(n,a,f),this.vertex(t,s,o))}rect(e,t,s,i,r,h){this.quad(e,t,s,t+i,s,t+i,s+r,t,s+r,h,h,h,h)}rectLine(e,t,s,i,r,h,l){this.check(e?4:1,8),l||(l=this.color);let n=this.tmp.set(r-s,t-i);n.normalize(),h*=.5;let a=n.x*h,o=n.y*h;e?(this.vertex(t+a,s+o,l),this.vertex(t-a,s-o,l),this.vertex(i+a,r+o,l),this.vertex(i-a,r-o,l),this.vertex(i+a,r+o,l),this.vertex(t-a,s-o,l)):(this.vertex(t+a,s+o,l),this.vertex(t-a,s-o,l),this.vertex(i+a,r+o,l),this.vertex(i-a,r-o,l),this.vertex(i+a,r+o,l),this.vertex(t+a,s+o,l),this.vertex(i-a,r-o,l),this.vertex(t-a,s-o,l))}x(e,t,s){this.line(e-s,t-s,e+s,t+s),this.line(e-s,t+s,e+s,t-s)}polygon(e,t,s,i){if(s<3)throw new Error("Polygon must contain at least 3 vertices");this.check(1,s*2),i||(i=this.color);let r=this.mesh.getVertices(),h=this.vertexIndex;t<<=1,s<<=1;let l=e[t],n=e[t+1],a=t+s;for(let o=t,c=t+s-2;o=a?(m=l,u=n):(m=e[o+2],u=e[o+3]),this.vertex(d,f,i),this.vertex(m,u,i)}}circle(e,t,s,i,r,h=0){if(h==0&&(h=Math.max(1,6*P.cbrt(i)|0)),h<=0)throw new Error("segments must be > 0.");r||(r=this.color);let l=2*P.PI/h,n=Math.cos(l),a=Math.sin(l),o=i,c=0;if(e){this.check(4,h*3+3),h--;for(let f=0;f0;)this.vertex(y,A,o),y+=C,A+=S,C+=I,S+=k,I+=Y,k+=X,this.vertex(y,A,o);this.vertex(y,A,o),this.vertex(l,n,o)}vertex(e,t,s){let i=this.vertexIndex,r=this.mesh.getVertices();r[i++]=e,r[i++]=t,r[i++]=s.r,r[i++]=s.g,r[i++]=s.b,r[i++]=s.a,this.vertexIndex=i}end(){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");this.flush();let e=this.context.gl;e.disable(e.BLEND),this.isDrawing=!1}flush(){if(this.vertexIndex!=0){if(!this.shader)throw new Error("No shader set.");this.mesh.setVerticesLength(this.vertexIndex),this.mesh.draw(this.shader,this.shapeType),this.vertexIndex=0}}check(e,t){if(!this.isDrawing)throw new Error("ShapeRenderer.begin() has not been called");if(this.shapeType==e)if(this.mesh.maxVertices()-this.mesh.numVertices()(e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.Filled=4]="Filled",e))(Mi||{}),Ei=class zs{boneLineColor=new st(1,0,0,1);boneOriginColor=new st(0,1,0,1);attachmentLineColor=new st(0,0,1,.5);triangleLineColor=new st(1,.64,0,.5);pathColor=new st().setFromString("FF7F00");clipColor=new st(.8,0,0,2);aabbColor=new st(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 xi;temp=new Array;vertices=L.newFloatArray(2*1024);static LIGHT_GRAY=new st(192/255,192/255,192/255,1);static GREEN=new st(0,1,0,1);constructor(t){this.context=t instanceof xt?t:new xt(t)}draw(t,s,i){let r=s.x,h=s.y,l=this.context.gl,n=this.premultipliedAlpha?l.ONE:l.SRC_ALPHA;t.setBlendMode(n,l.ONE,l.ONE_MINUS_SRC_ALPHA);let a=s.bones;if(this.drawBones){t.setColor(this.boneLineColor);for(let o=0,c=a.length;o-1||!d.parent)continue;let f=d.data.length*d.a+d.worldX,m=d.data.length*d.c+d.worldY;t.rectLine(!0,d.worldX,d.worldY,f,m,this.boneWidth*this.scale)}this.drawSkeletonXY&&t.x(r,h,4*this.scale)}if(this.drawRegionAttachments){t.setColor(this.attachmentLineColor);let o=s.slots;for(let c=0,d=o.length;c0){t.setColor(this.attachmentLineColor),b=(b>>1)*2;let x=g[b-2],p=g[b-1];for(let v=0,y=b;v-1||t.circle(!0,d.worldX,d.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let o=s.slots;t.setColor(this.clipColor);for(let c=0,d=o.length;c=0&&i==y.data.index&&(b=!0),!b){l.clipEndWithSlot(y);continue}r>=0&&r==y.data.index&&(b=!1);let A=y.getAttachment(),C;if(A instanceof te){let S=A;c.vertices=this.vertices,c.numVertices=4,c.numFloats=v<<2,S.computeWorldVertices(y,c.vertices,0,v),f=Gi.QUAD_TRIANGLES,d=S.uvs,C=S.region.texture,u=S.color}else if(A instanceof Wt){let S=A;c.vertices=this.vertices,c.numVertices=S.worldVerticesLength>>1,c.numFloats=c.numVertices*v,c.numFloats>c.vertices.length&&(c.vertices=this.vertices=L.newFloatArray(c.numFloats)),S.computeWorldVertices(y,0,S.worldVerticesLength,c.vertices,0,v),f=S.triangles,C=S.region.texture,d=S.uvs,u=S.color}else if(A instanceof $t){let S=A;l.clipStart(y,S);continue}else{l.clipEndWithSlot(y);continue}if(C){let S=y.color,I=this.tempColor,k=y.data.blendMode,Y=this.pmaAdditiveBatching&&n&&k==1,X=g.a*S.a*u.a;I.r=g.r*S.r*u.r,I.g=g.g*S.g*u.g,I.b=g.b*S.b*u.b,I.a=Y?0:X,n&&(I.r*=X,I.g*=X,I.b*=X);let F=this.tempColor2;y.darkColor?(n?(F.r=y.darkColor.r*I.a,F.g=y.darkColor.g*I.a,F.b=y.darkColor.b*I.a):F.setFromColor(y.darkColor),F.a=n?1:0):F.set(0,0,0,1);let R=Y?0:k;if(R!=o&&(o=R,t.setBlendMode(o,n)),l.isClipping()){l.clipTriangles(c.vertices,f,f.length,d,I,F,a);let M=new Float32Array(l.clippedVertices),V=l.clippedTriangles;h&&h(M,M.length,w),t.draw(C,M,V)}else{let M=c.vertices;if(a)for(let B=2,O=0,it=c.numFloats;B(e[e.Stretch=0]="Stretch",e[e.Expand=1]="Expand",e[e.Fit=2]="Fit",e))(ki||{}),_t,Dt,Ls=0,jr=1,Bs=1,pe=165,we=108,It=163,Zr=class{renderer;logo=null;spinner=null;angle=0;fadeOut=0;fadeIn=0;timeKeeper=new Ee;backgroundColor=new st(.135,.135,.135,1);tempColor=new st;constructor(e){if(this.renderer=e,this.timeKeeper.maxDelta=9,!Dt){let t=navigator.userAgent.indexOf("Safari")>-1,s=()=>Ls++;Dt=new Image,Dt.src=Jr,t||(Dt.crossOrigin="anonymous"),Dt.onload=s,_t=new Image,_t.src=Kr,t||(_t.crossOrigin="anonymous"),_t.onload=s}}dispose(){this.logo?.dispose(),this.spinner?.dispose()}draw(e=!1){if(Ls<2||e&&this.fadeOut>Bs)return;this.timeKeeper.update();let t=Math.abs(Math.sin(this.timeKeeper.totalTime+.25));this.angle-=this.timeKeeper.delta*200*(1+1.5*Math.pow(t,5));let s=this.tempColor,i=this.renderer,r=i.canvas,h=i.context.gl;if(i.resize(1),i.camera.position.set(r.width/2,r.height/2,0),i.batcher.setBlendMode(0,!0),e){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>Bs)return;s.setFromColor(this.backgroundColor),t=1-this.fadeOut/Bs,t=1-(t-1)*(t-1),s.a*=t,s.a>0&&(i.camera.zoom=1,i.begin(),i.quad(!0,0,0,r.width,0,r.width,r.height,0,r.height,s,s,s,s),i.end())}else this.fadeIn+=this.timeKeeper.delta,this.backgroundColor.a>0&&(h.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),h.clear(h.COLOR_BUFFER_BIT)),t=1;t*=Math.min(this.fadeIn/jr,1),s.set(t,t,t,t),this.logo||(this.logo=new Gt(i.context,Dt),this.spinner=new Gt(i.context,_t)),i.camera.zoom=Math.max(1,It/r.height),i.begin(),i.drawTexture(this.logo,(r.width-pe)/2,(r.height-we)/2,pe,we,s),this.spinner&&i.drawTextureRotated(this.spinner,(r.width-It)/2,(r.height-It)/2,It,It,It/2,It/2,this.angle,s),i.end()}drawInCoordinates(e,t){if(Ls<2)return;this.timeKeeper.update();let s=this.renderer;s.batcher.setBlendMode(0,!0),this.logo||(this.logo=new Gt(s.context,Dt),this.spinner=new Gt(s.context,_t));const i=e-pe/2,r=t-we/2;s.drawTexture(this.logo,i,r,pe,we),this.angle-=this.timeKeeper.delta*500,this.spinner&&s.drawTextureRotated(this.spinner,i,r-25,It,It,It/2,It/2,this.angle)}},Kr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKMAAACjCAYAAADmbK6AAAALKElEQVR42u2de2iW5R/GPzuqcwfnnKfNmafl5tTNHWzqNi3DEMQykcAoJSsySkspjSIk0iD/07Kf4R+FnVBDUTshZGpWUEJaaiWFgZlUFmXmIe3HNXthyebeZ77P9H13ffBG8Y8H7ut7vff93N/7fu4vGGPiFZiez/Qtw9lytJajfzfw9z/j+efPOv7cV8W+lUNY2a8T/ayTCRsWFLJA5rtUO1LLkV5p9LJeJizQiHeqnlO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gwqayZgZNkA7oKQQCxctByYg0XIIEQQuRitGVHblMTA2ShKGPDpC6wu+DEgJqg2rDGDBtAF4Q6RAojp1xXGmSMbImVcR+YWNY04eQCtUG1ofUJ2/uvcETIgUhhdAE5GAlkKShjwHTNmhhODKgJqQ2sC14uOgyfD0IbRF+MlQaZAiZWyn2yJsTJATqGnHQO2Jhh+xlsACFCG0QbRtdyzQFZCZSxYPpmTS7Q5cjJHYNBYIkZpu99HoUQ/o4QIYSIZUZfjJ4ZMjZI32wZBDMU5yhy8pZTULl4XYP5fagMyEVoy4oupTpGduwnkloSlKEwY+AcQU4MhRTD6ovXBRwFzwWgCSEF0QVjJUGmgEllTS5OLlCIlIN1mS9mx/cZ5eLDALpCTI2RAhkTZQqYoTgpoCPECbaBHQ2ETL3PUl98ECAXYijG0OyYAmQoTG7W5ODkAF1CnVgm2JQx4okPA+gCMTbGskBGgRmaOblAh5GTORIrfKFx4VH4EIAxIXIxlg2SBbMvECY3e7oApbDaIgQu5/2HmeEKEINYiwSRi7EQkLFgumZOCuggctKGI4ULZN/vMeSLj0AYMytWEqMLzFg4fYDaoKaC6wvOFR4FkIPQFaILxrJAOsHsc/zlfYDWXE8qF22s8Pz5KHxcgEVALBtjJXBSSEOwFhk1Zgy4hitCT4hVw+gFs8/zwxqIBbUgyK7fcyA0PD9XX4iVxhiC0xdof6STWCsoBmKF7+cVCWFXQYyBMxRpf+STX1b0x45AhN0OMSrOGEirhrY/dfQAdjvS7oy+WCF6r1RIFxXWvlTRg1YVqFWBmxZbD99ig9pt0YPQw9rD1nstVri9V+/Ve3XrS/wfim4P5fIFxLoAAAAASUVORK5CYII=",Qr=class{constructor(e,t){this.config=t,t.pathPrefix||(t.pathPrefix=""),t.app||(t.app={loadAssets:()=>{},initialize:()=>{},update:()=>{},render:()=>{},error:()=>{},dispose:()=>{}}),t.webglConfig||(t.webglConfig={alpha:!0}),this.htmlCanvas=e,this.context=new xt(e,t.webglConfig),this.renderer=new Yi(e,this.context),this.gl=this.context.gl,this.assetManager=new bi(this.context,t.pathPrefix),this.input=new Ys(e),t.app.loadAssets&&t.app.loadAssets(this);let s=()=>{this.disposed||(requestAnimationFrame(s),this.time.update(),t.app.update&&t.app.update(this,this.time.delta),t.app.render&&t.app.render(this))},i=()=>{if(!this.disposed){if(this.assetManager.isLoadingComplete()){this.assetManager.hasErrors()?t.app.error&&t.app.error(this,this.assetManager.getErrors()):(t.app.initialize&&t.app.initialize(this),s());return}requestAnimationFrame(i)}};requestAnimationFrame(i)}context;time=new Ee;htmlCanvas;gl;renderer;assetManager;input;disposed=!1;clear(e,t,s,i){this.gl.clearColor(e,t,s,i),this.gl.clear(this.gl.COLOR_BUFFER_BIT)}dispose(){this.config.app.dispose&&this.config.app.dispose(this),this.disposed=!0}};return Ji(Ws)})();