1var Mi=Object.defineProperty;var Fi=(A,e,t)=>e in A?Mi(A,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):A[e]=t;var d=(A,e,t)=>Fi(A,typeof e!="symbol"?e+"":e,t);class Zr{constructor(){d(this,"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}}class Vs{constructor(){d(this,"entries",{});d(this,"size",0)}add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,i=e.length;s<i;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}}const Le=class Le{constructor(e=0,t=0,s=0,i=0){d(this,"r");d(this,"g");d(this,"b");d(this,"a");this.r=e,this.g=t,this.b=s,this.a=i}set(e,t,s,i){return this.r=e,this.g=t,this.b=s,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,i){return this.r+=e,this.g+=t,this.b+=s,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e){return new Le().setFromString(e)}};d(Le,"WHITE",new Le(1,1,1,1)),d(Le,"RED",new Le(1,0,0,1)),d(Le,"GREEN",new Le(0,1,0,1)),d(Le,"BLUE",new Le(0,0,1,1)),d(Le,"MAGENTA",new Le(1,0,1,1));let N=Le;const ye=class ye{static clamp(e,t,s){return e<t?t:e>s?s:e}static cosDeg(e){return Math.cos(e*ye.degRad)}static sinDeg(e){return Math.sin(e*ye.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ye.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ye.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let i=Math.random(),r=t-e;return i<=(s-e)/r?e+Math.sqrt(i*r*(s-e)):t-Math.sqrt((1-i)*r*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}};d(ye,"PI",3.1415927),d(ye,"PI2",ye.PI*2),d(ye,"invPI2",1/ye.PI2),d(ye,"radiansToDegrees",180/ye.PI),d(ye,"radDeg",ye.radiansToDegrees),d(ye,"degreesToRadians",ye.PI/180),d(ye,"degRad",ye.degreesToRadians);let V=ye;class Ri{apply(e,t,s){return e+(t-e)*this.applyInternal(s)}}class Yi extends Ri{constructor(t){super();d(this,"power",2);this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class Kr extends Yi{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2==0?-1:1)+1}}const $e=class $e{static arrayCopy(e,t,s,i,r){for(let o=t,a=i;o<t+r;o++,a++)s[a]=e[o]}static arrayFill(e,t,s,i){for(let r=t;r<s;r++)e[r]=i}static setArraySize(e,t,s=0){let i=e.length;if(i==t)return e;if(e.length=t,i<t)for(let r=i;r<t;r++)e[r]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:$e.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t;return s}static newFloatArray(e){if($e.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static newShortArray(e){if($e.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static toFloatArray(e){return $e.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return $e.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,s=!0){for(var i=0;i<e.length;i++)if(e[i]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}};d($e,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");let O=$e;class Jr{static logBones(e){for(let t=0;t<e.bones.length;t++){let s=e.bones[t];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}}class Bt{constructor(e){d(this,"items",new Array);d(this,"instantiator");this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}}class He{constructor(e=0,t=0){d(this,"x");d(this,"y");this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}}class us{constructor(){d(this,"maxDelta",.064);d(this,"framesPerSecond",0);d(this,"delta",0);d(this,"totalTime",0);d(this,"lastTime",Date.now()/1e3);d(this,"frameCount",0);d(this,"frameTime",0)}update(){let e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class Qr{constructor(e=32){d(this,"values");d(this,"addedValues",0);d(this,"lastValue",0);d(this,"mean",0);d(this,"dirty",!0);this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}
1getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}}class Os{constructor(e){d(this,"name");if(!e)throw new Error("name cannot be null.");this.name=e}}const zt=class zt extends Os{constructor(t){super(t);d(this,"id",zt.nextID++);d(this,"bones",null);d(this,"vertices",[]);d(this,"worldVerticesLength",0);d(this,"timelineAttachment",this)}computeWorldVertices(t,s,i,r,o,a){i=o+(i>>1)*a;let c=t.bone.skeleton,n=t.deform,l=this.vertices,h=this.bones;if(!h){n.length>0&&(l=n);let g=t.bone,p=g.worldX,b=g.worldY,y=g.a,w=g.b,x=g.c,C=g.d;for(let v=s,S=o;S<i;v+=2,S+=a){let I=l[v],E=l[v+1];r[S]=I*y+E*w+p,r[S+1]=I*x+E*C+b}return}let f=0,u=0;for(let g=0;g<s;g+=2){let p=h[f];f+=p+1,u+=p}let m=c.bones;if(n.length==0)for(let g=o,p=u*3;g<i;g+=a){let b=0,y=0,w=h[f++];for(w+=f;f<w;f++,p+=3){let x=m[h[f]],C=l[p],v=l[p+1],S=l[p+2];b+=(C*x.a+v*x.b+x.worldX)*S,y+=(C*x.c+v*x.d+x.worldY)*S}r[g]=b,r[g+1]=y}else{let g=n;for(let p=o,b=u*3,y=u<<1;p<i;p+=a){let w=0,x=0,C=h[f++];for(C+=f;f<C;f++,b+=3,y+=2){let v=m[h[f]],S=l[b]+g[y],I=l[b+1]+g[y+1],E=l[b+2];w+=(S*v.a+I*v.b+v.worldX)*E,x+=(S*v.c+I*v.d+v.worldY)*E}r[p]=w,r[p+1]=x}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),O.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=O.newFloatArray(this.vertices.length),O.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}};d(zt,"nextID",0);let ze=zt;const ut=class ut{constructor(e){d(this,"id",ut.nextID());d(this,"regions");d(this,"start",0);d(this,"digits",0);d(this,"setupIndex",0);this.regions=new Array(e)}copy(){let e=new ut(this.regions.length);return O.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];t.region!=i&&(t.region=i,t.updateRegion())}getPath(e,t){let s=e,i=(this.start+t).toString();for(let r=this.digits-i.length;r>0;r--)s+="0";return s+=i,s}static nextID(){return ut._nextID++}};d(ut,"_nextID",0);let Pt=ut;var Ce;(function(A){A[A.hold=0]="hold",A[A.once=1]="once",A[A.loop=2]="loop",A[A.pingpong=3]="pingpong",A[A.onceReverse=4]="onceReverse",A[A.loopReverse=5]="loopReverse",A[A.pingpongReverse=6]="pingpongReverse"})(Ce||(Ce={}));const Ns=[Ce.hold,Ce.once,Ce.loop,Ce.pingpong,Ce.onceReverse,Ce.loopReverse,Ce.pingpongReverse];class fs{constructor(e,t,s){d(this,"name");d(this,"timelines",[]);d(this,"timelineIds",new Vs);d(this,"duration");if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,i,r,o,a,c){if(!e)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let n=this.timelines;for(let l=0,h=n.length;l<h;l++)n[l].apply(e,t,s,r,o,a,c)}}var P;(function(A){A[A.setup=0]="setup",A[A.first=1]="first",A[A.replace=2]="replace",A[A.add=3]="add"})(P||(P={}));var ke;(function(A){A[A.mixIn=0]="mixIn",A[A.mixOut=1]="mixOut"})(ke||(ke={}));const ae={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};class pe{constructor(e,t){d(this,"propertyIds");d(this,"frames");this.propertyIds=t,this.frames=O.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let i=1;i<s;i++)if(e[i]>t)return i-1;return s-1}static search(e,t,s){let i=e.length;for(let r=s;r<i;r+=s)if(e[r]>t)return r-s;return i-s}}class Ze extends pe{constructor(t,s,i){super(t,i);d(this,"curves");
1this.curves=O.newFloatArray(t+s*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let s=this.getFrameCount()+t*18;if(this.curves.length>s){let i=O.newFloatArray(s);O.arrayCopy(this.curves,0,i,0,s),this.curves=i}}setBezier(t,s,i,r,o,a,c,n,l,h,f){let u=this.curves,m=this.getFrameCount()+t*18;i==0&&(u[s]=2+m);let g=(r-a*2+n)*.03,p=(o-c*2+l)*.03,b=((a-n)*3-r+h)*.006,y=((c-l)*3-o+f)*.006,w=g*2+b,x=p*2+y,C=(a-r)*.3+g+b*.16666667,v=(c-o)*.3+p+y*.16666667,S=r+C,I=o+v;for(let E=m+18;m<E;m+=2)u[m]=S,u[m+1]=I,C+=w,v+=x,w+=b,x+=y,S+=C,I+=v}getBezierValue(t,s,i,r){let o=this.curves;if(o[r]>t){let l=this.frames[s],h=this.frames[s+i];return h+(t-l)/(o[r]-l)*(o[r+1]-h)}let a=r+18;for(r+=2;r<a;r+=2)if(o[r]>=t){let l=o[r-2],h=o[r-1];return h+(t-l)/(o[r]-l)*(o[r+1]-h)}s+=this.getFrameEntries();let c=o[a-2],n=o[a-1];return n+(t-c)/(this.frames[s]-c)*(this.frames[s+i]-n)}}class We extends Ze{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],o=t[s+1];return o+(e-r)/(t[s+2]-r)*(t[s+2+1]-o);case 1:return t[s+1]}return this.getBezierValue(e,s,1,i-2)}getRelativeValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case P.setup:return r;case P.first:return i+(r-i)*t}return i}let o=this.getCurveValue(e);switch(s){case P.setup:return r+o*t;case P.first:case P.replace:o+=r-i}return i+o*t}getAbsoluteValue(e,t,s,i,r){if(e<this.frames[0]){switch(s){case P.setup:return r;case P.first:return i+(r-i)*t}return i}let o=this.getCurveValue(e);return s==P.setup?r+(o-r)*t:i+(o-i)*t}getAbsoluteValue2(e,t,s,i,r,o){if(e<this.frames[0]){switch(s){case P.setup:return r;case P.first:return i+(r-i)*t}return i}return s==P.setup?r+(o-r)*t:i+(o-i)*t}getScaleValue(e,t,s,i,r,o){const a=this.frames;if(e<a[0]){switch(s){case P.setup:return o;case P.first:return r+(o-r)*t}return r}let c=this.getCurveValue(e)*o;if(t==1)return s==P.add?r+c-o:c;if(i==ke.mixOut)switch(s){case P.setup:return o+(Math.abs(c)*V.signum(o)-o)*t;case P.first:case P.replace:return r+(Math.abs(c)*V.signum(r)-r)*t}else{let n=0;switch(s){case P.setup:return n=Math.abs(o)*V.signum(c),n+(c-n)*t;case P.first:case P.replace:return n=Math.abs(r)*V.signum(c),n+(c-n)*t}}return r+(c-o)*t}}class ms extends Ze{constructor(e,t,s,i){super(e,t,[s,i])}getFrameEntries(){return 3}setFrame(e,t,s,i){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=i}}class Vt extends We{constructor(t,s,i){super(t,s,ae.rotate+"|"+i);d(this,"boneIndex",0);this.boneIndex=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];n.active&&(n.rotation=this.getRelativeValue(i,o,a,n.rotation,n.data.rotation))}}class Ds extends ms{constructor(t,s,i){super(t,s,ae.x+"|"+i,ae.y+"|"+i);d(this,"boneIndex",0);this.boneIndex=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];if(!n.active)return;let l=this.frames;if(i<l[0]){switch(a){case P.setup:n.x=n.data.x,n.y=n.data.y;return;case P.first:n.x+=(n.data.x-n.x)*o,n.y+=(n.data.y-n.y)*o}return}let h=0,f=0,u=pe.search(l,i,3),m=this.curves[u/3];switch(m){case 0:let g=l[u];h=l[u+1],f=l[u+2];let p=(i-g)/(l[u+3]-g);h+=(l[u+3+1]-h)*p,f+=(l[u+3+2]-f)*p;break;case 1:h=l[u+1],f=l[u+2];break;default:h=this.getBezierValue(i,u,1,m-2),f=this.getBezierValue(i,u,2,m+18-2)}switch(a){case P.setup:n.x=n.data.x+h*o,n.y=n.data.y+f*o;break;case P.first:case P.replace:n.x+=(n.data.x+h-n.x)*o,n.y+=(n.data.y+f-n.y)*o;break;case P.add:n.x+=h*o,n.y+=f*o}}}class Us extends We{constructor(t,s,i){super(t,s,ae.x+"|"+i);d(this,"boneIndex",0);this.boneIndex=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];n.active&&(n.x=this.getRelativeValue(i,o,a,n.x,n.data.x))}}class zs extends We{constructor(t,s,i){super(t,s,ae.y+"|"+i);d(this,"boneIndex",0);this.boneIndex=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];n.active&&(n.y=this.getRelativeValue(i,o,a,n.y,n.data.y))}}class Ws extends ms{constructor(t,s,i){super(t,s,ae.scaleX+"|"+i,ae.scaleY+"|"+i);d(this,"boneIndex",0);this.boneIndex=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];if(!n.active)return;let l=this.frames;if(i<l[0]){switch(a){case P.setup:n.scaleX=n.data.scaleX,n.scaleY=n.data.scaleY;return;case P.first:n.scaleX+=(n.data.scaleX-n.scaleX)*o,n.scaleY+=(n.data.scaleY-n.scaleY)*o}return}let h,f,u=pe.search(l,i,3),m=this.curves[u/3];switch(m){case 0:let g=l[u];h=l[u+1],f=l[u+2];let p=(i-g)/(l[u+3]-g);h+=(l[u+3+1]-h)*p,f+=(l[u+3+2]-f)*p;break;case 1:h=l[u+1],f=l[u+2];break;default:h=this.getBezierValue(i,u,1,m-2),f=this.getBezierValue(i,u,2,m+18-2)}if(h*=n.data.scaleX,f*=n.data.scaleY,o==1)a==P.add?(n.scaleX+=h-n.data.scaleX,n.scaleY+=f-n.data.scaleY):(n.scaleX=h,n.scaleY=f);else{let g=0,p=0;if(c==ke.mixOut)switch(a){case P.setup:g=n.data.scaleX,p=n.data.scaleY,n.scaleX=g+(Math.abs(h)*V.signum(g)-g)*o,n.scaleY=p+(Math.abs(f)*V.signum(p)-p)*o;break;case P.first:case P.replace:g=n.scaleX,p=n.scaleY,n.scaleX=g+(Math.abs(h)*V.signum(g)-g)*o,n.scaleY=p+(Math.abs(f)*V.signum(p)-p)*o;break;case P.add:n.scaleX+=(h-n.data.scaleX)*o,n.scaleY+=(f-n.data.scaleY)*o}else switch(a){case P.setup:g=Math.abs(n.data.scaleX)*V.signum(h),p=Math.abs(n.data.scaleY)*V.signum(f),n.scaleX=g+(h-g)*o,n.scaleY=p+(f-p)*o;break;case P.first:case P.replace:g=Math.abs(n.scaleX)*V.signum(h),p=Math.abs(n.scaleY)*V.signum(f),n.scaleX=g+(h-g)*o,n.scaleY=p+(f-p)*o;break;case P.add:n.scaleX+=(h-n.data.scaleX)*o,n.scaleY+=(f-n.data.scaleY)*o}}}}class qs extends We{constructor(t,s,i){super(t,s,ae.scaleX+"|"+i);d(this,"boneIndex",0);this.boneIndex=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];n.active&&(n.scaleX=this.getScaleValue(i,o,a,c,n.scaleX,n.data.scaleX))}}class Gs extends We{constructor(t,s,i){super(t,s,ae.scaleY+"|"+i);d(this,"boneIndex",0);this.boneIndex=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];n.active&&(n.scaleY=this.getScaleValue(i,o,a,c,n.scaleY,n.data.scaleY))}}class Hs extends ms{constructor(t,s,i){super(t,s,ae.shearX+"|"+i,ae.shearY+"|"+i);d(this,"boneIndex",0);this.boneIndex=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];if(!n.active)return;let l=this.frames;if(i<l[0]){switch(a){case P.setup:n.shearX=n.data.shearX,n.shearY=n.data.shearY;return;case P.first:n.shearX+=(n.data.shearX-n.shearX)*o,n.shearY+=(n.data.shearY-n.shearY)*o}return}let h=0,f=0,u=pe.search(l,i,3),m=this.curves[u/3];switch(m){case 0:let g=l[u];h=l[u+1],f=l[u+2];let p=(i-g)/(l[u+3]-g);h+=(l[u+3+1]-h)*p,f+=(l[u+3+2]-f)*p;break;case 1:h=l[u+1],f=l[u+2];break;default:h=this.getBezierValue(i,u,1,m-2),f=this.getBezierValue(i,u,2,m+18-2)}switch(a){case P.setup:n.shearX=n.data.shearX+h*o,n.shearY=n.data.shearY+f*o;break;case P.first:case P.replace:n.shearX+=(n.data.shearX+h-n.shearX)*o,n.shearY+=(n.data.shearY+f-n.shearY)*o;break;case P.add:n.shearX+=h*o,n.shearY+=f*o}}}class js extends We{constructor(t,s,i){super(t,s,ae.shearX+"|"+i);d(this,"boneIndex",0);this.boneIndex=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];n.active&&(n.shearX=this.getRelativeValue(i,o,a,n.shearX,n.data.shearX))}}class Zs extends We{constructor(t,s,i){super(t,s,ae.shearY+"|"+i);d(this,"boneIndex",0);this.boneIndex=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];n.active&&(n.shearY=this.getRelativeValue(i,o,a,n.shearY,n.data.shearY))}}
1class Ks extends pe{constructor(t,s){super(t,[ae.inherit+"|"+s]);d(this,"boneIndex",0);this.boneIndex=s}getFrameEntries(){return 2}setFrame(t,s,i){t*=2,this.frames[t]=s,this.frames[t+1]=i}apply(t,s,i,r,o,a,c){let n=t.bones[this.boneIndex];if(!n.active)return;if(c==ke.mixOut){a==P.setup&&(n.inherit=n.data.inherit);return}let l=this.frames;if(i<l[0]){(a==P.setup||a==P.first)&&(n.inherit=n.data.inherit);return}n.inherit=this.frames[pe.search(l,i,2)+1]}}class Js extends Ze{constructor(t,s,i){super(t,s,[ae.rgb+"|"+i,ae.alpha+"|"+i]);d(this,"slotIndex",0);this.slotIndex=i}getFrameEntries(){return 5}setFrame(t,s,i,r,o,a){t*=5,this.frames[t]=s,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a}apply(t,s,i,r,o,a,c){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let l=this.frames,h=n.color;if(i<l[0]){let y=n.data.color;switch(a){case P.setup:h.setFromColor(y);return;case P.first:h.add((y.r-h.r)*o,(y.g-h.g)*o,(y.b-h.b)*o,(y.a-h.a)*o)}return}let f=0,u=0,m=0,g=0,p=pe.search(l,i,5),b=this.curves[p/5];switch(b){case 0:let y=l[p];f=l[p+1],u=l[p+2],m=l[p+3],g=l[p+4];let w=(i-y)/(l[p+5]-y);f+=(l[p+5+1]-f)*w,u+=(l[p+5+2]-u)*w,m+=(l[p+5+3]-m)*w,g+=(l[p+5+4]-g)*w;break;case 1:f=l[p+1],u=l[p+2],m=l[p+3],g=l[p+4];break;default:f=this.getBezierValue(i,p,1,b-2),u=this.getBezierValue(i,p,2,b+18-2),m=this.getBezierValue(i,p,3,b+18*2-2),g=this.getBezierValue(i,p,4,b+18*3-2)}o==1?h.set(f,u,m,g):(a==P.setup&&h.setFromColor(n.data.color),h.add((f-h.r)*o,(u-h.g)*o,(m-h.b)*o,(g-h.a)*o))}}class Qs extends Ze{constructor(t,s,i){super(t,s,[ae.rgb+"|"+i]);d(this,"slotIndex",0);this.slotIndex=i}getFrameEntries(){return 4}setFrame(t,s,i,r,o){t<<=2,this.frames[t]=s,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=o}apply(t,s,i,r,o,a,c){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let l=this.frames,h=n.color;if(i<l[0]){let b=n.data.color;switch(a){case P.setup:h.r=b.r,h.g=b.g,h.b=b.b;return;case P.first:h.r+=(b.r-h.r)*o,h.g+=(b.g-h.g)*o,h.b+=(b.b-h.b)*o}return}let f=0,u=0,m=0,g=pe.search(l,i,4),p=this.curves[g>>2];switch(p){case 0:let b=l[g];f=l[g+1],u=l[g+2],m=l[g+3];let y=(i-b)/(l[g+4]-b);f+=(l[g+4+1]-f)*y,u+=(l[g+4+2]-u)*y,m+=(l[g+4+3]-m)*y;break;case 1:f=l[g+1],u=l[g+2],m=l[g+3];break;default:f=this.getBezierValue(i,g,1,p-2),u=this.getBezierValue(i,g,2,p+18-2),m=this.getBezierValue(i,g,3,p+18*2-2)}if(o==1)h.r=f,h.g=u,h.b=m;else{if(a==P.setup){let b=n.data.color;h.r=b.r,h.g=b.g,h.b=b.b}h.r+=(f-h.r)*o,h.g+=(u-h.g)*o,h.b+=(m-h.b)*o}}}class _s extends We{constructor(t,s,i){super(t,s,ae.alpha+"|"+i);d(this,"slotIndex",0);this.slotIndex=i}apply(t,s,i,r,o,a,c){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let l=n.color;if(i<this.frames[0]){let f=n.data.color;switch(a){case P.setup:l.a=f.a;return;case P.first:l.a+=(f.a-l.a)*o}return}let h=this.getCurveValue(i);o==1?l.a=h:(a==P.setup&&(l.a=n.data.color.a),l.a+=(h-l.a)*o)}}class $s extends Ze{constructor(t,s,i){super(t,s,[ae.rgb+"|"+i,ae.alpha+"|"+i,ae.rgb2+"|"+i]);d(this,"slotIndex",0);this.slotIndex=i}getFrameEntries(){return 8}setFrame(t,s,i,r,o,a,c,n,l){t<<=3,this.frames[t]=s,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a,this.frames[t+5]=c,this.frames[t+6]=n,this.frames[t+7]=l}apply(t,s,i,r,o,a,c){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let l=this.frames,h=n.color,f=n.darkColor;if(i<l[0]){let v=n.data.color,S=n.data.darkColor;switch(a){case P.setup:h.setFromColor(v),f.r=S.r,f.g=S.g,f.b=S.b;return;case P.first:h.add((v.r-h.r)*o,(v.g-h.g)*o,(v.b-h.b)*o,(v.a-h.a)*o),f.r+=(S.r-f.r)*o,f.g+=(S.g-f.g)*o,f.b+=(S.b-f.b)*o}return}let u=0,m=0,g=0,p=0,b=0,y=0,w=0,x=pe.search(l,i,8),C=this.curves[x>>3];switch(C){case 0:let v=l[x];u=l[x+1],m=l[x+2],g=l[x+3],p=l[x+4],b=l[x+5],y=l[x+6],w=l[x+7];let S=(i-v)/(l[x+8]-v);u+=(l[x+8+1]-u)*S,m+=(l[x+8+2]-m)*S,g+=(l[x+8+3]-g)*S,p+=(l[x+8+4]-p)*S,b+=(l[x+8+5]-b)*S,y+=(l[x+8+6]-y)*S,w+=(l[x+8+7]-w)*S;break;case 1:u=l[x+1],m=l[x+2],g=l[x+3],p=l[x+4],b=l[x+5],y=l[x+6],w=l[x+7];break;default:u=this.getBezierValue(i,x,1,C-2),m=this.getBezierValue(i,x,2,C+18-2),g=this.getBezierValue(i,x,3,C+18*2-2),p=this.getBezierValue(i,x,4,C+18*3-2),b=this.getBezierValue(i,x,5,C+18*4-2),y=this.getBezierValue(i,x,6,C+18*5-2),w=this.getBezierValue(i,x,7,C+18*6-2)}if(o==1)h.set(u,m,g,p),f.r=b,f.g=y,f.b=w;else{if(a==P.setup){h.setFromColor(n.data.color);let v=n.data.darkColor;f.r=v.r,f.g=v.g,f.b=v.b}h.add((u-h.r)*o,(m-h.g)*o,(g-h.b)*o,(p-h.a)*o),f.r+=(b-f.r)*o,f.g+=(y-f.g)*o,f.b+=(w-f.b)*o}}}class ei extends Ze{constructor(t,s,i){super(t,s,[ae.rgb+"|"+i,ae.rgb2+"|"+i]);d(this,"slotIndex",0);this.slotIndex=i}getFrameEntries(){return 7}setFrame(t,s,i,r,o,a,c,n){t*=7,this.frames[t]=s,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a,this.frames[t+5]=c,this.frames[t+6]=n}
1apply(t,s,i,r,o,a,c){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let l=this.frames,h=n.color,f=n.darkColor;if(i<l[0]){let C=n.data.color,v=n.data.darkColor;switch(a){case P.setup:h.r=C.r,h.g=C.g,h.b=C.b,f.r=v.r,f.g=v.g,f.b=v.b;return;case P.first:h.r+=(C.r-h.r)*o,h.g+=(C.g-h.g)*o,h.b+=(C.b-h.b)*o,f.r+=(v.r-f.r)*o,f.g+=(v.g-f.g)*o,f.b+=(v.b-f.b)*o}return}let u=0,m=0,g=0,p=0,b=0,y=0,w=pe.search(l,i,7),x=this.curves[w/7];switch(x){case 0:let C=l[w];u=l[w+1],m=l[w+2],g=l[w+3],p=l[w+4],b=l[w+5],y=l[w+6];let v=(i-C)/(l[w+7]-C);u+=(l[w+7+1]-u)*v,m+=(l[w+7+2]-m)*v,g+=(l[w+7+3]-g)*v,p+=(l[w+7+4]-p)*v,b+=(l[w+7+5]-b)*v,y+=(l[w+7+6]-y)*v;break;case 1:u=l[w+1],m=l[w+2],g=l[w+3],p=l[w+4],b=l[w+5],y=l[w+6];break;default:u=this.getBezierValue(i,w,1,x-2),m=this.getBezierValue(i,w,2,x+18-2),g=this.getBezierValue(i,w,3,x+18*2-2),p=this.getBezierValue(i,w,4,x+18*3-2),b=this.getBezierValue(i,w,5,x+18*4-2),y=this.getBezierValue(i,w,6,x+18*5-2)}if(o==1)h.r=u,h.g=m,h.b=g,f.r=p,f.g=b,f.b=y;else{if(a==P.setup){let C=n.data.color,v=n.data.darkColor;h.r=C.r,h.g=C.g,h.b=C.b,f.r=v.r,f.g=v.g,f.b=v.b}h.r+=(u-h.r)*o,h.g+=(m-h.g)*o,h.b+=(g-h.b)*o,f.r+=(p-f.r)*o,f.g+=(b-f.g)*o,f.b+=(y-f.b)*o}}}class ct extends pe{constructor(t,s){super(t,[ae.attachment+"|"+s]);d(this,"slotIndex",0);d(this,"attachmentNames");this.slotIndex=s,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.attachmentNames[t]=i}apply(t,s,i,r,o,a,c){let n=t.slots[this.slotIndex];if(n.bone.active){if(c==ke.mixOut){a==P.setup&&this.setAttachment(t,n,n.data.attachmentName);return}if(i<this.frames[0]){(a==P.setup||a==P.first)&&this.setAttachment(t,n,n.data.attachmentName);return}this.setAttachment(t,n,this.attachmentNames[pe.search1(this.frames,i)])}}setAttachment(t,s,i){s.setAttachment(i?t.getAttachment(this.slotIndex,i):null)}}class ti extends Ze{constructor(t,s,i,r){super(t,s,[ae.deform+"|"+i+"|"+r.id]);d(this,"slotIndex",0);d(this,"attachment");d(this,"vertices");this.slotIndex=i,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,i){this.frames[t]=s,this.vertices[t]=i}setBezier(t,s,i,r,o,a,c,n,l,h,f){let u=this.curves,m=this.getFrameCount()+t*18;i==0&&(u[s]=2+m);let g=(r-a*2+n)*.03,p=l*.03-c*.06,b=((a-n)*3-r+h)*.006,y=(c-l+.33333333)*.018,w=g*2+b,x=p*2+y,C=(a-r)*.3+g+b*.16666667,v=c*.3+p+y*.16666667,S=r+C,I=v;for(let E=m+18;m<E;m+=2)u[m]=S,u[m+1]=I,C+=w,v+=x,w+=b,x+=y,S+=C,I+=v}getCurvePercent(t,s){let i=this.curves,r=i[s];switch(r){case 0:let n=this.frames[s];return(t-n)/(this.frames[s+this.getFrameEntries()]-n);case 1:return 0}if(r-=2,i[r]>t){let n=this.frames[s];return i[r+1]*(t-n)/(i[r]-n)}let o=r+18;for(r+=2;r<o;r+=2)if(i[r]>=t){let n=i[r-2],l=i[r-1];return l+(t-n)/(i[r]-n)*(i[r+1]-l)}let a=i[o-2],c=i[o-1];return c+(1-c)*(t-a)/(this.frames[s+this.getFrameEntries()]-a)}apply(t,s,i,r,o,a,c){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let l=n.getAttachment();if(!l||!(l instanceof ze)||l.timelineAttachment!=this.attachment)return;let h=n.deform;h.length==0&&(a=P.setup);let f=this.vertices,u=f[0].length,m=this.frames;if(i<m[0]){switch(a){case P.setup:h.length=0;return;case P.first:if(o==1){h.length=0;return}h.length=u;let x=l;if(x.bones){o=1-o;for(var g=0;g<u;g++)h[g]*=o}else{let C=x.vertices;for(var g=0;g<u;g++)h[g]+=(C[g]-h[g])*o}}return}if(h.length=u,i>=m[m.length-1]){let x=f[m.length-1];if(o==1)if(a==P.add){let C=l;if(C.bones)for(let v=0;v<u;v++)h[v]+=x[v];else{let v=C.vertices;for(let S=0;S<u;S++)h[S]+=x[S]-v[S]}}else O.arrayCopy(x,0,h,0,u);else switch(a){case P.setup:{let v=l;if(v.bones)for(let S=0;S<u;S++)h[S]=x[S]*o;else{let S=v.vertices;for(let I=0;I<u;I++){let E=S[I];h[I]=E+(x[I]-E)*o}}break}case P.first:case P.replace:for(let v=0;v<u;v++)h[v]+=(x[v]-h[v])*o;break;case P.add:let C=l;if(C.bones)for(let v=0;v<u;v++)h[v]+=x[v]*o;else{let v=C.vertices;for(let S=0;S<u;S++)h[S]+=(x[S]-v[S])*o}}return}let p=pe.search1(m,i),b=this.getCurvePercent(i,p),y=f[p],w=f[p+1];if(o==1)if(a==P.add){let x=l;if(x.bones)for(let C=0;C<u;C++){let v=y[C];h[C]+=v+(w[C]-v)*b}else{let C=x.vertices;for(let v=0;v<u;v++){let S=y[v];h[v]+=S+(w[v]-S)*b-C[v]}}}else for(let x=0;x<u;x++){let C=y[x];h[x]=C+(w[x]-C)*b}else switch(a){case P.setup:{let C=l;if(C.bones)for(let v=0;v<u;v++){let S=y[v];h[v]=(S+(w[v]-S)*b)*o}else{let v=C.vertices;for(let S=0;S<u;S++){let I=y[S],E=v[S];h[S]=E+(I+(w[S]-I)*b-E)*o}}break}case P.first:case P.replace:for(let C=0;C<u;C++){let v=y[C];h[C]+=(v+(w[C]-v)*b-h[C])*o}break;case P.add:let x=l;if(x.bones)for(let C=0;C<u;C++){let v=y[C];h[C]+=(v+(w[C]-v)*b)*o}else{let C=x.vertices;for(let v=0;v<u;v++){let S=y[v];h[v]+=(S+(w[v]-S)*b-C[v])*o}}}}}const Wt=class Wt extends pe{constructor(t){super(t,Wt.propertyIds);d(this,"events");this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,i,r,o,a,c){if(!r)return;let n=this.frames,l=this.frames.length;if(s>i)this.apply(t,s,Number.MAX_VALUE,r,o,a,c),s=-1;else if(s>=n[l-1])return;if(i<n[0])return;let h=0;if(s<n[0])h=0;else{h=pe.search1(n,s)+1;let f=n[h];for(;h>0&&n[h-1]==f;)h--}for(;h<l&&i>=n[h];h++)r.push(this.events[h])}};d(Wt,"propertyIds",[""+ae.event]);let St=Wt;const qt=class qt extends pe{constructor(t){super(t,qt.propertyIds);d(this,"drawOrders");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,o,a,c){if(c==ke.mixOut){a==P.setup&&O.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(i<this.frames[0]){(a==P.setup||a==P.first)&&O.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let n=pe.search1(this.frames,i),l=this.drawOrders[n];if(!l)O.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let h=t.drawOrder,f=t.slots;for(let u=0,m=l.length;u<m;
1u++)h[u]=f[l[u]]}}};d(qt,"propertyIds",[""+ae.drawOrder]);let it=qt;class si extends Ze{constructor(t,s,i){super(t,s,[ae.ikConstraint+"|"+i]);d(this,"constraintIndex",0);this.constraintIndex=i}getFrameEntries(){return 6}setFrame(t,s,i,r,o,a,c){t*=6,this.frames[t]=s,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a?1:0,this.frames[t+5]=c?1:0}apply(t,s,i,r,o,a,c){let n=t.ikConstraints[this.constraintIndex];if(!n.active)return;let l=this.frames;if(i<l[0]){switch(a){case P.setup:n.mix=n.data.mix,n.softness=n.data.softness,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch;return;case P.first:n.mix+=(n.data.mix-n.mix)*o,n.softness+=(n.data.softness-n.softness)*o,n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch}return}let h=0,f=0,u=pe.search(l,i,6),m=this.curves[u/6];switch(m){case 0:let g=l[u];h=l[u+1],f=l[u+2];let p=(i-g)/(l[u+6]-g);h+=(l[u+6+1]-h)*p,f+=(l[u+6+2]-f)*p;break;case 1:h=l[u+1],f=l[u+2];break;default:h=this.getBezierValue(i,u,1,m-2),f=this.getBezierValue(i,u,2,m+18-2)}a==P.setup?(n.mix=n.data.mix+(h-n.data.mix)*o,n.softness=n.data.softness+(f-n.data.softness)*o,c==ke.mixOut?(n.bendDirection=n.data.bendDirection,n.compress=n.data.compress,n.stretch=n.data.stretch):(n.bendDirection=l[u+3],n.compress=l[u+4]!=0,n.stretch=l[u+5]!=0)):(n.mix+=(h-n.mix)*o,n.softness+=(f-n.softness)*o,c==ke.mixIn&&(n.bendDirection=l[u+3],n.compress=l[u+4]!=0,n.stretch=l[u+5]!=0))}}class ii extends Ze{constructor(t,s,i){super(t,s,[ae.transformConstraint+"|"+i]);d(this,"constraintIndex",0);this.constraintIndex=i}getFrameEntries(){return 7}setFrame(t,s,i,r,o,a,c,n){let l=this.frames;t*=7,l[t]=s,l[t+1]=i,l[t+2]=r,l[t+3]=o,l[t+4]=a,l[t+5]=c,l[t+6]=n}apply(t,s,i,r,o,a,c){let n=t.transformConstraints[this.constraintIndex];if(!n.active)return;let l=this.frames;if(i<l[0]){let w=n.data;switch(a){case P.setup:n.mixRotate=w.mixRotate,n.mixX=w.mixX,n.mixY=w.mixY,n.mixScaleX=w.mixScaleX,n.mixScaleY=w.mixScaleY,n.mixShearY=w.mixShearY;return;case P.first:n.mixRotate+=(w.mixRotate-n.mixRotate)*o,n.mixX+=(w.mixX-n.mixX)*o,n.mixY+=(w.mixY-n.mixY)*o,n.mixScaleX+=(w.mixScaleX-n.mixScaleX)*o,n.mixScaleY+=(w.mixScaleY-n.mixScaleY)*o,n.mixShearY+=(w.mixShearY-n.mixShearY)*o}return}let h,f,u,m,g,p,b=pe.search(l,i,7),y=this.curves[b/7];switch(y){case 0:let w=l[b];h=l[b+1],f=l[b+2],u=l[b+3],m=l[b+4],g=l[b+5],p=l[b+6];let x=(i-w)/(l[b+7]-w);h+=(l[b+7+1]-h)*x,f+=(l[b+7+2]-f)*x,u+=(l[b+7+3]-u)*x,m+=(l[b+7+4]-m)*x,g+=(l[b+7+5]-g)*x,p+=(l[b+7+6]-p)*x;break;case 1:h=l[b+1],f=l[b+2],u=l[b+3],m=l[b+4],g=l[b+5],p=l[b+6];break;default:h=this.getBezierValue(i,b,1,y-2),f=this.getBezierValue(i,b,2,y+18-2),u=this.getBezierValue(i,b,3,y+18*2-2),m=this.getBezierValue(i,b,4,y+18*3-2),g=this.getBezierValue(i,b,5,y+18*4-2),p=this.getBezierValue(i,b,6,y+18*5-2)}if(a==P.setup){let w=n.data;n.mixRotate=w.mixRotate+(h-w.mixRotate)*o,n.mixX=w.mixX+(f-w.mixX)*o,n.mixY=w.mixY+(u-w.mixY)*o,n.mixScaleX=w.mixScaleX+(m-w.mixScaleX)*o,n.mixScaleY=w.mixScaleY+(g-w.mixScaleY)*o,n.mixShearY=w.mixShearY+(p-w.mixShearY)*o}else n.mixRotate+=(h-n.mixRotate)*o,n.mixX+=(f-n.mixX)*o,n.mixY+=(u-n.mixY)*o,n.mixScaleX+=(m-n.mixScaleX)*o,n.mixScaleY+=(g-n.mixScaleY)*o,n.mixShearY+=(p-n.mixShearY)*o}}class ri extends We{constructor(t,s,i){super(t,s,ae.pathConstraintPosition+"|"+i);d(this,"constraintIndex",0);this.constraintIndex=i}apply(t,s,i,r,o,a,c){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.position=this.getAbsoluteValue(i,o,a,n.position,n.data.position))}}class ni extends We{constructor(t,s,i){super(t,s,ae.pathConstraintSpacing+"|"+i);d(this,"constraintIndex",0);this.constraintIndex=i}apply(t,s,i,r,o,a,c){let n=t.pathConstraints[this.constraintIndex];n.active&&(n.spacing=this.getAbsoluteValue(i,o,a,n.spacing,n.data.spacing))}}class ai extends Ze{constructor(t,s,i){super(t,s,[ae.pathConstraintMix+"|"+i]);d(this,"constraintIndex",0);this.constraintIndex=i}getFrameEntries(){return 4}setFrame(t,s,i,r,o){let a=this.frames;t<<=2,a[t]=s,a[t+1]=i,a[t+2]=r,a[t+3]=o}apply(t,s,i,r,o,a,c){let n=t.pathConstraints[this.constraintIndex];if(!n.active)return;let l=this.frames;if(i<l[0]){switch(a){case P.setup:n.mixRotate=n.data.mixRotate,n.mixX=n.data.mixX,n.mixY=n.data.mixY;return;case P.first:n.mixRotate+=(n.data.mixRotate-n.mixRotate)*o,n.mixX+=(n.data.mixX-n.mixX)*o,n.mixY+=(n.data.mixY-n.mixY)*o}return}let h,f,u,m=pe.search(l,i,4),g=this.curves[m>>2];switch(g){case 0:let p=l[m];h=l[m+1],f=l[m+2],u=l[m+3];let b=(i-p)/(l[m+4]-p);
1h+=(l[m+4+1]-h)*b,f+=(l[m+4+2]-f)*b,u+=(l[m+4+3]-u)*b;break;case 1:h=l[m+1],f=l[m+2],u=l[m+3];break;default:h=this.getBezierValue(i,m,1,g-2),f=this.getBezierValue(i,m,2,g+18-2),u=this.getBezierValue(i,m,3,g+18*2-2)}if(a==P.setup){let p=n.data;n.mixRotate=p.mixRotate+(h-p.mixRotate)*o,n.mixX=p.mixX+(f-p.mixX)*o,n.mixY=p.mixY+(u-p.mixY)*o}else n.mixRotate+=(h-n.mixRotate)*o,n.mixX+=(f-n.mixX)*o,n.mixY+=(u-n.mixY)*o}}class lt extends We{constructor(t,s,i,r){super(t,s,r+"|"+i);d(this,"constraintIndex",0);this.constraintIndex=i}apply(t,s,i,r,o,a,c){let n;if(this.constraintIndex==-1){const l=i>=this.frames[0]?this.getCurveValue(i):0;for(const h of t.physicsConstraints)h.active&&this.global(h.data)&&this.set(h,this.getAbsoluteValue2(i,o,a,this.get(h),this.setup(h),l))}else n=t.physicsConstraints[this.constraintIndex],n.active&&this.set(n,this.getAbsoluteValue(i,o,a,this.get(n),this.setup(n)))}}class li extends lt{constructor(e,t,s){super(e,t,s,ae.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}}class oi extends lt{constructor(e,t,s){super(e,t,s,ae.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}}class hi extends lt{constructor(e,t,s){super(e,t,s,ae.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}}class ci extends lt{constructor(e,t,s){super(e,t,s,ae.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}}class di extends lt{constructor(e,t,s){super(e,t,s,ae.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}}class ui extends lt{constructor(e,t,s){super(e,t,s,ae.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}}class fi extends lt{constructor(e,t,s){super(e,t,s,ae.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}}const Gt=class Gt extends pe{constructor(t,s){super(t,Gt.propertyIds);d(this,"constraintIndex");this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,i,r,o,a,c){let n;if(this.constraintIndex!=-1&&(n=t.physicsConstraints[this.constraintIndex],!n.active))return;const l=this.frames;if(s>i)this.apply(t,s,Number.MAX_VALUE,[],o,a,c),s=-1;else if(s>=l[l.length-1])return;if(!(i<l[0])&&(s<l[0]||i>=l[pe.search1(l,s)+1]))if(n!=null)n.reset();else for(const h of t.physicsConstraints)h.active&&h.reset()}};d(Gt,"propertyIds",[ae.physicsConstraintReset.toString()]);let Ot=Gt;const Ve=class Ve extends pe{constructor(t,s,i){super(t,[ae.sequence+"|"+s+"|"+i.sequence.id]);d(this,"slotIndex");d(this,"attachment");this.slotIndex=s,this.attachment=i}getFrameEntries(){return Ve.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,i,r,o){let a=this.frames;t*=Ve.ENTRIES,a[t]=s,a[t+Ve.MODE]=i|r<<4,a[t+Ve.DELAY]=o}apply(t,s,i,r,o,a,c){let n=t.slots[this.slotIndex];if(!n.bone.active)return;let l=n.attachment,h=this.attachment;if(l!=h&&(!(l instanceof ze)||l.timelineAttachment!=h))return;let f=this.frames;if(i<f[0]){(a==P.setup||a==P.first)&&(n.sequenceIndex=-1);return}let u=pe.search(f,i,Ve.ENTRIES),m=f[u],g=f[u+Ve.MODE],p=f[u+Ve.DELAY];if(!this.attachment.sequence)return;let b=g>>4,y=this.attachment.sequence.regions.length,w=Ns[g&15];if(w!=Ce.hold)switch(b+=(i-m)/p+1e-5|0,w){case Ce.once:b=Math.min(y-1,b);break;case Ce.loop:b%=y;break;case Ce.pingpong:{let x=(y<<1)-2;b=x==0?0:b%x,b>=y&&(b=x-b);break}case Ce.onceReverse:b=Math.max(y-1-b,0);break;case Ce.loopReverse:b=y-1-b%y;break;case Ce.pingpongReverse:{let x=(y<<1)-2;b=x==0?0:(b+y-1)%x,b>=y&&(b=x-b)}}n.sequenceIndex=b}};d(Ve,"ENTRIES",3),d(Ve,"MODE",1),d(Ve,"DELAY",2);let Nt=Ve;const ft=class ft{constructor(e){d(this,"data");d(this,"tracks",new Array);d(this,"timeScale",1);d(this,"unkeyedState",0);d(this,"events",new Array);d(this,"listeners",new Array);d(this,"queue",new Xi(this));d(this,"propertyIDs",new Vs);d(this,"animationsChanged",!1);d(this,"trackEntryPool",new Bt(()=>new Li));this.data=e}static emptyAnimation(){return ft._emptyAnimation}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let o=e*r.timeScale;if(r.delay>0){if(r.delay-=o,r.delay>0)continue;o=-r.delay,r.delay=0}let a=r.next;if(a){let c=r.trackLast-a.delay;if(c>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(c/r.timeScale+e)*a.timeScale,r.trackTime+=o,this.setCurrent(s,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){t[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,e)){let c=r.mixingFrom;for(r.mixingFrom=null,c&&(c.mixingTo=null);c;)this.queue.end(c),c=c.mixingFrom}r.trackTime+=o}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.mixTime>0&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,i=!1;for(let f=0,u=s.length;f<u;f++){let m=s[f];if(!m||m.delay>0)continue;i=!0;
1let g=f==0?P.first:m.mixBlend,p=m.alpha;m.mixingFrom?p*=this.applyMixingFrom(m,e,g):m.trackTime>=m.trackEnd&&!m.next&&(p=0);let b=p>=m.alphaAttachmentThreshold,y=m.animationLast,w=m.getAnimationTime(),x=w,C=t;m.reverse&&(x=m.animation.duration-x,C=null);let v=m.animation.timelines,S=v.length;if(f==0&&p==1||g==P.add){f==0&&(b=!0);for(let I=0;I<S;I++){O.webkit602BugfixHelper(p,g);var r=v[I];r instanceof ct?this.applyAttachmentTimeline(r,e,x,g,b):r.apply(e,y,x,C,p,g,ke.mixIn)}}else{let I=m.timelineMode,E=m.shortestRotation,F=!E&&m.timelinesRotation.length!=S<<1;F&&(m.timelinesRotation.length=S<<1);for(let R=0;R<S;R++){let L=v[R],B=I[R]==$t?g:P.setup;!E&&L instanceof Vt?this.applyRotateTimeline(L,e,x,p,B,m.timelinesRotation,R<<1,F):L instanceof ct?this.applyAttachmentTimeline(L,e,x,g,b):(O.webkit602BugfixHelper(p,g),L.apply(e,y,x,C,p,B,ke.mixIn))}}this.queueEvents(m,w),t.length=0,m.nextAnimationLast=w,m.nextTrackLast=m.trackTime}for(var o=this.unkeyedState+As,a=e.slots,c=0,n=e.slots.length;c<n;c++){var l=a[c];if(l.attachmentState==o){var h=l.data.attachmentName;l.setAttachment(h?e.getAttachment(l.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,t,s){let i=e.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,t,s);let r=0;e.mixDuration==0?(r=1,s==P.first&&(s=P.setup)):(r=e.mixTime/e.mixDuration,r>1&&(r=1),s!=P.first&&(s=i.mixBlend));let o=r<i.mixAttachmentThreshold,a=r<i.mixDrawOrderThreshold,c=i.animation.timelines,n=c.length,l=i.alpha*e.interruptAlpha,h=l*(1-r),f=i.animationLast,u=i.getAnimationTime(),m=u,g=null;if(i.reverse?m=i.animation.duration-m:r<i.eventThreshold&&(g=this.events),s==P.add)for(let p=0;p<n;p++)c[p].apply(t,f,m,g,h,s,ke.mixOut);else{let p=i.timelineMode,b=i.timelineHoldMix,y=i.shortestRotation,w=!y&&i.timelinesRotation.length!=n<<1;w&&(i.timelinesRotation.length=n<<1),i.totalAlpha=0;for(let x=0;x<n;x++){let C=c[x],v=ke.mixOut,S,I=0;switch(p[x]){case $t:if(!a&&C instanceof it)continue;S=s,I=h;break;case vs:S=P.setup,I=h;break;case Cs:S=s,I=l;break;case es:S=P.setup,I=l;break;default:S=P.setup;let E=b[x];I=l*Math.max(0,1-E.mixTime/E.mixDuration);break}i.totalAlpha+=I,!y&&C instanceof Vt?this.applyRotateTimeline(C,t,m,I,S,i.timelinesRotation,x<<1,w):C instanceof ct?this.applyAttachmentTimeline(C,t,m,S,o&&I>=i.alphaAttachmentThreshold):(O.webkit602BugfixHelper(I,s),a&&C instanceof it&&S==P.setup&&(v=ke.mixIn),C.apply(t,f,m,g,I,S,v))}}return e.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(e,t,s,i,r){var o=t.slots[e.slotIndex];o.bone.active&&(s<e.frames[0]?(i==P.setup||i==P.first)&&this.setAttachment(t,o,o.data.attachmentName,r):this.setAttachment(t,o,e.attachmentNames[pe.search1(e.frames,s)],r),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+As))}setAttachment(e,t,s,i){t.setAttachment(s?e.getAttachment(t.data.index,s):null),i&&(t.attachmentState=this.unkeyedState+Pi)}applyRotateTimeline(e,t,s,i,r,o,a,c){if(c&&(o[a]=0),i==1){e.apply(t,0,s,null,1,r,ke.mixIn);return}let n=t.bones[e.boneIndex];if(!n.active)return;let l=e.frames,h=0,f=0;if(s<l[0])switch(r){case P.setup:n.rotation=n.data.rotation;default:return;case P.first:h=n.rotation,f=n.data.rotation}else h=r==P.setup?n.data.rotation:n.rotation,f=n.data.rotation+e.getCurveValue(s);let u=0,m=f-h;if(m-=Math.ceil(m/360-.5)*360,m==0)u=o[a];else{let g=0,p=0;c?(g=0,p=m):(g=o[a],p=o[a+1]);let b=g-g%360;u=m+b;let y=m>=0,w=g>=0;Math.abs(p)<=90&&V.signum(p)!=V.signum(m)&&(Math.abs(g-b)>180?(u+=360*V.signum(g),w=y):b!=0?u-=360*V.signum(g):w=y),w!=y&&(u+=360*V.signum(g)),o[a]=u}o[a+1]=m,n.rotation=h+u*i}queueEvents(e,t){let s=e.animationStart,i=e.animationEnd,r=i-s,o=e.trackLast%r,a=this.events,c=0,n=a.length;for(;c<n;c++){let h=a[c];if(h.time<o)break;h.time>i||this.queue.event(e,h)}let l=!1;if(e.loop)if(r==0)l=!0;else{const h=Math.floor(e.trackTime/r);l=h>0&&h>Math.floor(e.trackLast/r)}else l=t>=i&&e.animationLast<i;for(l&&this.queue.complete(e);c<n;c++){let h=a[c];h.time<s||this.queue.event(e,h)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let i=s.mixingFrom;if(!i)break;this.queue.end(i),s.mixingFrom=null,s.mixingTo=null,s=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let i=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,i&&(s&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let i=this.data.skeletonData.findAnimation(t);
1if(!i)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,i,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast==-1?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));let o=this.trackEntry(e,t,s,r);return this.setCurrent(e,o,i),this.queue.drain(),o}addAnimation(e,t,s=!1,i=0){let r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,r,s,i)}addAnimationWith(e,t,s=!1,i=0){if(!t)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;let o=this.trackEntry(e,t,s,r);return r?(r.next=o,o.previous=r,i<=0&&(i+=r.getTrackComplete()-o.mixDuration)):(this.setCurrent(e,o,!0),this.queue.drain()),o.delay=i,o}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,ft.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let i=this.addAnimationWith(e,ft.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-t),i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,i=this.tracks.length;s<i;s++){let r=this.tracks[s];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(O.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,i){let r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=t,r.loop=s,r.holdPrevious=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=i?this.data.getMix(i.animation,t):0,r.interruptAlpha=1,r.totalAlpha=0,r.mixBlend=P.replace,r}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let i=e[t];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do(!i.mixingTo||i.mixBlend!=P.add)&&this.computeHold(i),i=i.mixingTo;while(i)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,i=e.animation.timelines.length,r=e.timelineMode;r.length=i;let o=e.timelineHoldMix;o.length=0;let a=this.propertyIDs;if(t&&t.holdPrevious){for(let c=0;c<i;c++)r[c]=a.addAll(s[c].getPropertyIds())?es:Cs;return}e:for(let c=0;c<i;c++){let n=s[c],l=n.getPropertyIds();if(!a.addAll(l))r[c]=$t;else if(!t||n instanceof ct||n instanceof it||n instanceof St||!t.animation.hasTimeline(l))r[c]=vs;else{for(let h=t.mixingTo;h;h=h.mixingTo)if(!h.animation.hasTimeline(l)){if(e.mixDuration>0){r[c]=Bi,o[c]=h;continue e}break}r[c]=es}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}};d(ft,"_emptyAnimation",new fs("<empty>",[],0));let ns=ft;class Li{constructor(){d(this,"animation",null);d(this,"previous",null);d(this,"next",null);d(this,"mixingFrom",null);d(this,"mixingTo",null);d(this,"listener",null);d(this,"trackIndex",0);d(this,"loop",!1);d(this,"holdPrevious",!1);d(this,"reverse",!1);d(this,"shortestRotation",!1);d(this,"eventThreshold",0);d(this,"mixAttachmentThreshold",0);d(this,"alphaAttachmentThreshold",0);d(this,"mixDrawOrderThreshold",0);d(this,"animationStart",0);d(this,"animationEnd",0);d(this,"animationLast",0);d(this,"nextAnimationLast",0);d(this,"delay",0);d(this,"trackTime",0);d(this,"trackLast",0);d(this,"nextTrackLast",0);d(this,"trackEnd",0);d(this,"timeScale",0);d(this,"alpha",0);d(this,"mixTime",0);d(this,"_mixDuration",0);d(this,"interruptAlpha",0);d(this,"totalAlpha",0);d(this,"mixBlend",P.replace);d(this,"timelineMode",new Array);d(this,"timelineHoldMix",new Array);d(this,"timelinesRotation",new Array)}get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,this.previous!=null&&t<=0&&(t+=this.previous.getTrackComplete()-e),this.delay=t}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}}class Xi{constructor(e){d(this,"objects",[]);d(this,"drainDisabled",!1);d(this,"animState");this.animState=e}start(e){this.objects.push(Re.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(Re.interrupt),this.objects.push(e)}end(e){this.objects.push(Re.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(Re.dispose),this.objects.push(e)}complete(e){this.objects.push(Re.complete),this.objects.push(e)}event(e,t){this.objects.push(Re.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects,t=this.animState.listeners;for(let s=0;s<e.length;s+=2){let i=e[s],r=e[s+1];switch(i){case Re.start:r.listener&&r.listener.start&&r.listener.start(r);for(let a=0;a<t.length;a++){let c=t[a];c.start&&c.start(r)}break;case Re.interrupt:r.listener&&r.listener.interrupt&&r.listener.interrupt(r);for(let a=0;a<t.length;a++){let c=t[a];c.interrupt&&c.interrupt(r)}break;case Re.end:r.listener&&r.listener.end&&r.listener.end(r);for(let a=0;a<t.length;a++){let c=t[a];c.end&&c.end(r)}case Re.dispose:r.listener&&r.listener.dispose&&r.listener.dispose(r);for(let a=0;a<t.length;a++){let c=t[a];c.dispose&&c.dispose(r)}this.animState.trackEntryPool.free(r);break;case Re.complete:r.listener&&r.listener.complete&&r.listener.complete(r);for(let a=0;a<t.length;a++){let c=t[a];c.complete&&c.complete(r)}break;case Re.event:let o=e[s+++2];r.listener&&r.listener.event&&r.listener.event(r,o);for(let a=0;a<t.length;a++){let c=t[a];c.event&&c.event(r,o)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var Re;(function(A){A[A.start=0]="start",A[A.interrupt=1]="interrupt",A[A.end=2]="end",A[A.dispose=3]="dispose",A[A.complete=4]="complete",A[A.event=5]="event"})(Re||(Re={}));class _r{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}}const $t=0,vs=1,Cs=2,es=3,Bi=4,As=1,Pi=2;class Vi{constructor(e){d(this,"skeletonData");d(this,"animationToMixTime",{});d(this,"defaultMix",0);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);
1if(!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}}class Zt extends ze{constructor(t){super(t);d(this,"color",new N(1,1,1,1))}copy(){let t=new Zt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class yt extends ze{constructor(t){super(t);d(this,"endSlot",null);d(this,"color",new N(.2275,.2275,.8078,1))}copy(){let t=new yt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class mi{constructor(e){d(this,"_image");this._image=e}getImage(){return this._image}}var be;(function(A){A[A.Nearest=9728]="Nearest",A[A.Linear=9729]="Linear",A[A.MipMap=9987]="MipMap",A[A.MipMapNearestNearest=9984]="MipMapNearestNearest",A[A.MipMapLinearNearest=9985]="MipMapLinearNearest",A[A.MipMapNearestLinear=9986]="MipMapNearestLinear",A[A.MipMapLinearLinear=9987]="MipMapLinearLinear"})(be||(be={}));var xt;(function(A){A[A.MirroredRepeat=33648]="MirroredRepeat",A[A.ClampToEdge=33071]="ClampToEdge",A[A.Repeat=10497]="Repeat"})(xt||(xt={}));class Oi{constructor(){d(this,"texture");d(this,"u",0);d(this,"v",0);d(this,"u2",0);d(this,"v2",0);d(this,"width",0);d(this,"height",0);d(this,"degrees",0);d(this,"offsetX",0);d(this,"offsetY",0);d(this,"originalWidth",0);d(this,"originalHeight",0)}}class $r extends mi{setFilters(e,t){}setWraps(e,t){}dispose(){}}class Ni{constructor(e){d(this,"pages",new Array);d(this,"regions",new Array);let t=new Di(e),s=new Array(4),i={};i.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},i.format=()=>{},i.filter=l=>{l.minFilter=O.enumValue(be,s[1]),l.magFilter=O.enumValue(be,s[2])},i.repeat=l=>{s[1].indexOf("x")!=-1&&(l.uWrap=xt.Repeat),s[1].indexOf("y")!=-1&&(l.vWrap=xt.Repeat)},i.pma=l=>{l.pma=s[1]=="true"};var r={};r.xy=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2])},r.size=l=>{l.width=parseInt(s[1]),l.height=parseInt(s[2])},r.bounds=l=>{l.x=parseInt(s[1]),l.y=parseInt(s[2]),l.width=parseInt(s[3]),l.height=parseInt(s[4])},r.offset=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2])},r.orig=l=>{l.originalWidth=parseInt(s[1]),l.originalHeight=parseInt(s[2])},r.offsets=l=>{l.offsetX=parseInt(s[1]),l.offsetY=parseInt(s[2]),l.originalWidth=parseInt(s[3]),l.originalHeight=parseInt(s[4])},r.rotate=l=>{let h=s[1];h=="true"?l.degrees=90:h!="false"&&(l.degrees=parseInt(h))},r.index=l=>{l.index=parseInt(s[1])};let o=t.readLine();for(;o&&o.trim().length==0;)o=t.readLine();for(;!(!o||o.trim().length==0||t.readEntry(s,o)==0);)o=t.readLine();let a=null,c=null,n=null;for(;o!==null;)if(o.trim().length==0)a=null,o=t.readLine();else if(a){let l=new gi(a,o);for(;;){let h=t.readEntry(s,o=t.readLine());if(h==0)break;let f=r[s[0]];if(f)f(l);else{c||(c=[]),n||(n=[]),c.push(s[0]);let u=[];for(let m=0;m<h;m++)u.push(parseInt(s[m+1]));n.push(u)}}l.originalWidth==0&&l.originalHeight==0&&(l.originalWidth=l.width,l.originalHeight=l.height),c&&c.length>0&&n&&n.length>0&&(l.names=c,l.values=n,c=null,n=null),l.u=l.x/a.width,l.v=l.y/a.height,l.degrees==90?(l.u2=(l.x+l.height)/a.width,l.v2=(l.y+l.width)/a.height):(l.u2=(l.x+l.width)/a.width,l.v2=(l.y+l.height)/a.height),this.regions.push(l)}else{for(a=new Ui(o.trim());t.readEntry(s,o=t.readLine())!=0;){let l=i[s[0]];l&&l(a)}this.pages.push(a)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){var e;for(let t=0;t<this.pages.length;t++)(e=this.pages[t].texture)==null||e.dispose()}}class Di{constructor(e){d(this,"lines");d(this,"index",0);this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let i=1,r=s+1;;i++){let o=t.indexOf(",",r);if(o==-1)return e[i]=t.substr(r).trim(),i;
1if(e[i]=t.substr(r,o-r).trim(),r=o+1,i==4)return 4}}}class Ui{constructor(e){d(this,"name");d(this,"minFilter",be.Nearest);d(this,"magFilter",be.Nearest);d(this,"uWrap",xt.ClampToEdge);d(this,"vWrap",xt.ClampToEdge);d(this,"texture",null);d(this,"width",0);d(this,"height",0);d(this,"pma",!1);d(this,"regions",new Array);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}}class gi extends Oi{constructor(t,s){super();d(this,"page");d(this,"name");d(this,"x",0);d(this,"y",0);d(this,"offsetX",0);d(this,"offsetY",0);d(this,"originalWidth",0);d(this,"originalHeight",0);d(this,"index",0);d(this,"degrees",0);d(this,"names",null);d(this,"values",null);this.page=t,this.name=s,t.regions.push(this)}}class tt extends ze{constructor(t,s){super(t);d(this,"region",null);d(this,"path");d(this,"regionUVs",[]);d(this,"uvs",[]);d(this,"triangles",[]);d(this,"color",new N(1,1,1,1));d(this,"width",0);d(this,"height",0);d(this,"hullLength",0);d(this,"edges",[]);d(this,"parentMesh",null);d(this,"sequence",null);d(this,"tempColor",new N(0,0,0,0));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=O.newFloatArray(t.length));let s=this.uvs,i=this.uvs.length,r=this.region.u,o=this.region.v,a=0,c=0;if(this.region instanceof gi){let n=this.region,l=n.page,h=l.width,f=l.height;switch(n.degrees){case 90:r-=(n.originalHeight-n.offsetY-n.height)/h,o-=(n.originalWidth-n.offsetX-n.width)/f,a=n.originalHeight/h,c=n.originalWidth/f;for(let u=0;u<i;u+=2)s[u]=r+t[u+1]*a,s[u+1]=o+(1-t[u])*c;return;case 180:r-=(n.originalWidth-n.offsetX-n.width)/h,o-=n.offsetY/f,a=n.originalWidth/h,c=n.originalHeight/f;for(let u=0;u<i;u+=2)s[u]=r+(1-t[u])*a,s[u+1]=o+(1-t[u+1])*c;return;case 270:r-=n.offsetY/h,o-=n.offsetX/f,a=n.originalHeight/h,c=n.originalWidth/f;for(let u=0;u<i;u+=2)s[u]=r+(1-t[u+1])*a,s[u+1]=o+t[u]*c;return}r-=n.offsetX/h,o-=(n.originalHeight-n.offsetY-n.height)/f,a=n.originalWidth/h,c=n.originalHeight/f}else this.region?(a=this.region.u2-r,c=this.region.v2-o):(r=o=0,a=c=1);for(let n=0;n<i;n+=2)s[n]=r+t[n]*a,s[n+1]=o+t[n+1]*c}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new tt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),O.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),O.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),O.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),O.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,i,r,o,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,i,r,o,a)}newLinkedMesh(){let t=new tt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}}class nt extends ze{constructor(t){super(t);d(this,"lengths",[]);d(this,"closed",!1);d(this,"constantSpeed",!1);d(this,"color",new N(1,1,1,1))}copy(){let t=new nt(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),O.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class gs extends ze{constructor(t){super(t);d(this,"x",0);d(this,"y",0);d(this,"rotation",0);d(this,"color",new N(.38,.94,0,1))}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*V.degRad,i=Math.cos(s),r=Math.sin(s),o=i*t.a+r*t.b,a=i*t.c+r*t.d;return V.atan2Deg(a,o)}copy(){let t=new gs(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}
1const de=class de extends Os{constructor(t,s){super(t);d(this,"x",0);d(this,"y",0);d(this,"scaleX",1);d(this,"scaleY",1);d(this,"rotation",0);d(this,"width",0);d(this,"height",0);d(this,"color",new N(1,1,1,1));d(this,"path");d(this,"region",null);d(this,"sequence",null);d(this,"offset",O.newFloatArray(8));d(this,"uvs",O.newFloatArray(8));d(this,"tempColor",new N(1,1,1,1));this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let i=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,o=-this.width/2*this.scaleX+this.region.offsetX*i,a=-this.height/2*this.scaleY+this.region.offsetY*r,c=o+this.region.width*i,n=a+this.region.height*r,l=this.rotation*V.degRad,h=Math.cos(l),f=Math.sin(l),u=this.x,m=this.y,g=o*h+u,p=o*f,b=a*h+m,y=a*f,w=c*h+u,x=c*f,C=n*h+m,v=n*f,S=this.offset;S[0]=g-y,S[1]=b+p,S[2]=g-v,S[3]=C+p,S[4]=w-v,S[5]=C+x,S[6]=w-y,S[7]=b+x,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,i,r){this.sequence!=null&&this.sequence.apply(t,this);let o=t.bone,a=this.offset,c=o.worldX,n=o.worldY,l=o.a,h=o.b,f=o.c,u=o.d,m=0,g=0;m=a[0],g=a[1],s[i]=m*l+g*h+c,s[i+1]=m*f+g*u+n,i+=r,m=a[2],g=a[3],s[i]=m*l+g*h+c,s[i+1]=m*f+g*u+n,i+=r,m=a[4],g=a[5],s[i]=m*l+g*h+c,s[i+1]=m*f+g*u+n,i+=r,m=a[6],g=a[7],s[i]=m*l+g*h+c,s[i+1]=m*f+g*u+n}copy(){let t=new de(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,O.arrayCopy(this.uvs,0,t.uvs,0,8),O.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}};d(de,"X1",0),d(de,"Y1",1),d(de,"C1R",2),d(de,"C1G",3),d(de,"C1B",4),d(de,"C1A",5),d(de,"U1",6),d(de,"V1",7),d(de,"X2",8),d(de,"Y2",9),d(de,"C2R",10),d(de,"C2G",11),d(de,"C2B",12),d(de,"C2A",13),d(de,"U2",14),d(de,"V2",15),d(de,"X3",16),d(de,"Y3",17),d(de,"C3R",18),d(de,"C3G",19),d(de,"C3B",20),d(de,"C3A",21),d(de,"U3",22),d(de,"V3",23),d(de,"X4",24),d(de,"Y4",25),d(de,"C4R",26),d(de,"C4G",27),d(de,"C4B",28),d(de,"C4A",29),d(de,"U4",30),d(de,"V4",31);let wt=de;class zi{constructor(e){d(this,"atlas");this.atlas=e}loadSequence(e,t,s){let i=s.regions;for(let r=0,o=i.length;r<o;r++){let a=s.getPath(t,r),c=this.atlas.findRegion(a);if(c==null)throw new Error("Region not found in atlas: "+a+" (sequence: "+e+")");i[r]=c}}newRegionAttachment(e,t,s,i){let r=new wt(t,s);if(i!=null)this.loadSequence(t,s,i);else{let o=this.atlas.findRegion(s);if(!o)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");r.region=o}return r}newMeshAttachment(e,t,s,i){let r=new tt(t,s);if(i!=null)this.loadSequence(t,s,i);else{let o=this.atlas.findRegion(s);if(!o)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");r.region=o}return r}newBoundingBoxAttachment(e,t){return new Zt(t)}newPathAttachment(e,t){return new nt(t)}newPointAttachment(e,t){return new gs(t)}newClippingAttachment(e,t){return new yt(t)}}class pi{constructor(e,t,s){d(this,"index",0);d(this,"name");d(this,"parent",null);d(this,"length",0);d(this,"x",0);d(this,"y",0);d(this,"rotation",0);d(this,"scaleX",1);d(this,"scaleY",1);d(this,"shearX",0);d(this,"shearY",0);d(this,"inherit",xe.Normal);d(this,"skinRequired",!1);d(this,"color",new N);d(this,"icon");d(this,"visible",!1);if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}}var xe;(function(A){A[A.Normal=0]="Normal",A[A.OnlyTranslation=1]="OnlyTranslation",A[A.NoRotationOrReflection=2]="NoRotationOrReflection",A[A.NoScale=3]="NoScale",A[A.NoScaleOrReflection=4]="NoScaleOrReflection"})(xe||(xe={}));class Ss{constructor(e,t,s){d(this,"data");d(this,"skeleton");d(this,"parent",null);d(this,"children",new Array);d(this,"x",0);d(this,"y",0);d(this,"rotation",0);d(this,"scaleX",0);d(this,"scaleY",0);d(this,"shearX",0);d(this,"shearY",0);d(this,"ax",0);d(this,"ay",0);d(this,"arotation",0);d(this,"ascaleX",0);d(this,"ascaleY",0);d(this,"ashearX",0);d(this,"ashearY",0);d(this,"a",0);d(this,"b",0);d(this,"c",0);d(this,"d",0);d(this,"worldY",0);d(this,"worldX",0);d(this,"inherit",xe.Normal);d(this,"sorted",!1);d(this,"active",!1);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,o,a){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=i,this.ascaleY=r,this.ashearX=o,this.ashearY=a;let c=this.parent;if(!c){let u=this.skeleton;const m=u.scaleX,g=u.scaleY,p=(s+o)*V.degRad,b=(s+90+a)*V.degRad;this.a=Math.cos(p)*i*m,this.b=Math.cos(b)*r*m,this.c=Math.sin(p)*i*g,this.d=Math.sin(b)*r*g,this.worldX=e*m+u.x,this.worldY=t*g+u.y;return}let n=c.a,l=c.b,h=c.c,f=c.d;switch(this.worldX=n*e+l*t+c.worldX,this.worldY=h*e+f*t+c.worldY,this.inherit){case xe.Normal:{const u=(s+o)*V.degRad,m=(s+90+a)*V.degRad,g=Math.cos(u)*i,p=Math.cos(m)*r,b=Math.sin(u)*i,y=Math.sin(m)*r;this.a=n*g+l*b,this.b=n*p+l*y,this.c=h*g+f*b,this.d=h*p+f*y;return}case xe.OnlyTranslation:{const u=(s+o)*V.degRad,m=(s+90+a)*V.degRad;this.a=Math.cos(u)*i,this.b=Math.cos(m)*r,this.c=Math.sin(u)*i,this.d=Math.sin(m)*r;break}case xe.NoRotationOrReflection:{let u=n*n+h*h,m=0;u>1e-4?(u=Math.abs(n*f-l*h)/u,n/=this.skeleton.scaleX,h/=this.skeleton.scaleY,l=h*u,f=n*u,m=Math.atan2(h,n)*V.radDeg):(n=0,h=0,m=90-Math.atan2(f,l)*V.radDeg);const g=(s+o-m)*V.degRad,p=(s+a-m+90)*V.degRad,b=Math.cos(g)*i,y=Math.cos(p)*r,w=Math.sin(g)*i,x=Math.sin(p)*r;this.a=n*b-l*w,this.b=n*y-l*x,this.c=h*b+f*w,this.d=h*y+f*x;break}case xe.NoScale:case xe.NoScaleOrReflection:{s*=V.degRad;const u=Math.cos(s),m=Math.sin(s);let g=(n*u+l*m)/this.skeleton.scaleX,p=(h*u+f*m)/this.skeleton.scaleY,b=M
1ath.sqrt(g*g+p*p);b>1e-5&&(b=1/b),g*=b,p*=b,b=Math.sqrt(g*g+p*p),this.inherit==xe.NoScale&&n*f-l*h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(b=-b),s=Math.PI/2+Math.atan2(p,g);const y=Math.cos(s)*b,w=Math.sin(s)*b;o*=V.degRad,a=(90+a)*V.degRad;const x=Math.cos(o)*i,C=Math.cos(a)*r,v=Math.sin(o)*i,S=Math.sin(a)*r;this.a=g*x+y*v,this.b=g*C+y*S,this.c=p*x+w*v,this.d=p*C+w*S;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)*V.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)*V.radDeg;return}let t=e.a,s=e.b,i=e.c,r=e.d,o=1/(t*r-s*i),a=r*o,c=s*o,n=i*o,l=t*o,h=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=h*a-f*c,this.ay=f*l-h*n;let u,m,g,p;if(this.inherit==xe.OnlyTranslation)u=this.a,m=this.b,g=this.c,p=this.d;else{switch(this.inherit){case xe.NoRotationOrReflection:{let C=Math.abs(t*r-s*i)/(t*t+i*i),v=t/this.skeleton.scaleX;s=-(i/this.skeleton.scaleY)*C*this.skeleton.scaleX,r=v*C*this.skeleton.scaleY,o=1/(t*r-s*i),a=r*o,c=s*o;break}case xe.NoScale:case xe.NoScaleOrReflection:let b=V.cosDeg(this.rotation),y=V.sinDeg(this.rotation);t=(t*b+s*y)/this.skeleton.scaleX,i=(i*b+r*y)/this.skeleton.scaleY;let w=Math.sqrt(t*t+i*i);w>1e-5&&(w=1/w),t*=w,i*=w,w=Math.sqrt(t*t+i*i),this.inherit==xe.NoScale&&o<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(w=-w);let x=V.PI/2+Math.atan2(i,t);s=Math.cos(x)*w,r=Math.sin(x)*w,o=1/(t*r-s*i),a=r*o,c=s*o,n=i*o,l=t*o}u=a*this.a-c*this.c,m=a*this.b-c*this.d,g=l*this.c-n*this.a,p=l*this.d-n*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(u*u+g*g),this.ascaleX>1e-4){let b=u*p-m*g;this.ascaleY=b/this.ascaleX,this.ashearY=-Math.atan2(u*m+g*p,b)*V.radDeg,this.arotation=Math.atan2(g,u)*V.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,m)*V.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*V.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*V.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=V.sinDeg(e),s=V.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*V.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=V.sinDeg(e),s=V.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*V.radDeg}rotateWorld(e){e*=V.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}}class Kt{constructor(e,t,s){d(this,"name");d(this,"order");d(this,"skinRequired");this.name=e,this.order=t,this.skinRequired=s}}class Wi{constructor(e,t="",s=new xi){d(this,"pathPrefix","");d(this,"textureLoader");d(this,"downloader");d(this,"assets",{});d(this,"errors",{});d(this,"toLoad",0);d(this,"loaded",0);this.textureLoader=e,this.pathPrefix=t,this.downloader=s}start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.assets[t]=s,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=()=>
1{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.downloader.downloadBinary(e,i=>{this.success(t,e,i)},(i,r)=>{this.error(s,e,`Couldn't load binary ${e}: status ${i}, ${r}`)})}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.downloader.downloadJson(e,i=>{this.success(t,e,i)},(i,r)=>{this.error(s,e,`Couldn't load JSON ${e}: status ${i}, ${r}`)})}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(o=>o.ok?o.blob():(this.error(s,e,`Couldn't load image: ${e}`),null)).then(o=>o?createImageBitmap(o,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(o=>{o&&this.success(t,e,this.textureLoader(o))});else{let o=new Image;o.crossOrigin="anonymous",o.onload=()=>{this.success(t,e,this.textureLoader(o))},o.onerror=()=>{this.error(s,e,`Couldn't load image: ${e}`)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),o.src=e}}loadTextureAtlas(e,t=()=>{},s=()=>{},i){let r=e.lastIndexOf("/"),o=r>=0?e.substring(0,r+1):"";e=this.start(e),this.downloader.downloadText(e,a=>{try{let c=new Ni(a),n=c.pages.length,l=!1;for(let h of c.pages)this.loadTexture(i?i[h.name]:o+h.name,(f,u)=>{l||(h.setTexture(u),--n==0&&this.success(t,e,c))},(f,u)=>{l||this.error(s,e,`Couldn't load texture atlas ${e} page image: ${f}`),l=!0})}catch(c){this.error(s,e,`Couldn't parse texture atlas ${e}: ${c.message}`)}},(a,c)=>{this.error(s,e,`Couldn't load texture atlas ${e}: status ${a}, ${c}`)})}get(e){return this.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;let t=this.assets[e];if(t)return t;let s=this.errors[e];throw Error("Asset not found: "+e+(s?` 2`+s:""))}remove(e){e=this.pathPrefix+e;let t=this.assets[e];return t.dispose&&t.dispose(),delete this.assets[e],t}removeAll(){for(let e in this.assets){let t=this.assets[e];t.dispose&&t.dispose()}this.assets={}}isLoadingComplete(){return this.toLoad==0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}}class xi{constructor(){d(this,"callbacks",{});d(this,"rawDataUris",{})}dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!=-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){for(var t=window.atob(e),s=t.length,i=new Uint8Array(s),r=0;r<s;r++)i[r]=t.charCodeAt(r);return i}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t==-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}
2downloadText(e,t,s){if(this.start(e,t,s))return;if(this.rawDataUris[e]){try{let o=this.rawDataUris[e];this.finish(e,200,this.dataUriToString(o))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",e,!0);let r=()=>{this.finish(e,i.status,i.responseText)};i.onload=r,i.onerror=r,i.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;if(this.rawDataUris[e]){try{let o=this.rawDataUris[e];this.finish(e,200,this.dataUriToUint8Array(o))}catch(o){this.finish(e,400,JSON.stringify(o))}return}let i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer";let r=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status==200||i.status==0?this.finish(e,200,new Uint8Array(i.response)):r()},i.onerror=r,i.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 o=r.length-1,a=i.length;o<a;o+=2)i[o].apply(null,r)}}class wi{constructor(e,t){d(this,"data");d(this,"intValue",0);d(this,"floatValue",0);d(this,"stringValue",null);d(this,"time",0);d(this,"volume",0);d(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}}class bi{constructor(e){d(this,"name");d(this,"intValue",0);d(this,"floatValue",0);d(this,"stringValue",null);d(this,"audioPath",null);d(this,"volume",0);d(this,"balance",0);this.name=e}}class qi{constructor(e,t){d(this,"data");d(this,"bones");d(this,"target");d(this,"bendDirection",0);d(this,"compress",!1);d(this,"stretch",!1);d(this,"mix",1);d(this,"softness",0);d(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,i,r,o,a){let c=e.parent;if(!c)throw new Error("IK bone must have parent.");let n=c.a,l=c.b,h=c.c,f=c.d,u=-e.ashearX-e.arotation,m=0,g=0;switch(e.inherit){case xe.OnlyTranslation:m=(t-e.worldX)*V.signum(e.skeleton.scaleX),g=(s-e.worldY)*V.signum(e.skeleton.scaleY);break;case xe.NoRotationOrReflection:let y=Math.abs(n*f-l*h)/Math.max(1e-4,n*n+h*h),w=n/e.skeleton.scaleX,x=h/e.skeleton.scaleY;l=-x*y*e.skeleton.scaleX,f=w*y*e.skeleton.scaleY,u+=Math.atan2(x,w)*V.radDeg;default:let C=t-c.worldX,v=s-c.worldY,S=n*f-l*h;Math.abs(S)<=1e-4?(m=0,g=0):(m=(C*f-v*l)/S-e.ax,g=(v*n-C*h)/S-e.ay)}u+=Math.atan2(g,m)*V.radDeg,e.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let p=e.ascaleX,b=e.ascaleY;if(i||r){switch(e.inherit){case xe.NoScale:case xe.NoScaleOrReflection:m=t-e.worldX,g=s-e.worldY}const y=e.data.length*p;if(y>1e-4){const w=m*m+g*g;if(i&&w<y*y||r&&w>y*y){const x=(Math.sqrt(w)/y-1)*a+1;p*=x,o&&(b*=x)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+u*a,p,b,e.ashearX,e.ashearY)}apply2(e,t,s,i,r,o,a,c,n){if(e.inherit!=xe.Normal||t.inherit!=xe.Normal)return;let l=e.ax,h=e.ay,f=e.ascaleX,u=e.ascaleY,m=f,g=u,p=t.ascaleX,b=0,y=0,w=0;f<0?(f=-f,b=180,w=-1):(b=0,w=1),u<0&&(u=-u,w=-w),p<0?(p=-p,y=180):y=0;let x=t.ax,C=0,v=0,S=0,I=e.a,E=e.b,F=e.c,R=e.d,L=Math.abs(f-u)<=1e-4;!L||o?(C=0,v=I*x+e.worldX,S=F*x+e.worldY):(C=t.ay,v=I*x+E*C+e.worldX,S=F*x+R*C+e.worldY);let B=e.parent;if(!B)throw new Error("IK parent must itself have a parent.");I=B.a,E=B.b,F=B.c,R=B.d;let T=I*R-E*F,Y=v-B.worldX,X=S-B.worldY;T=Math.abs(T)<=1e-4?0:1/T;
2let re=(Y*R-X*E)*T-l,ne=(X*I-Y*F)*T-h,ee=Math.sqrt(re*re+ne*ne),ce=t.data.length*p,me,ge;if(ee<1e-4){this.apply1(e,s,i,!1,o,!1,n),t.updateWorldTransformWith(x,C,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}Y=s-B.worldX,X=i-B.worldY;let D=(Y*R-X*E)*T-l,le=(X*I-Y*F)*T-h,oe=D*D+le*le;if(c!=0){c*=f*(p+1)*.5;let we=Math.sqrt(oe),Ae=we-ee-ce*f+c;if(Ae>0){let Se=Math.min(1,Ae/(c*2))-1;Se=(Ae-c*(1-Se*Se))/we,D-=Se*D,le-=Se*le,oe=D*D+le*le}}e:if(L){ce*=f;let we=(oe-ee*ee-ce*ce)/(2*ee*ce);we<-1?(we=-1,ge=Math.PI*r):we>1?(we=1,ge=0,o&&(I=(Math.sqrt(oe)/(ee+ce)-1)*n+1,m*=I,a&&(g*=I))):ge=Math.acos(we)*r,I=ee+ce*we,E=ce*Math.sin(ge),me=Math.atan2(le*I-D*E,D*I+le*E)}else{I=f*ce,E=u*ce;let we=I*I,Ae=E*E,Se=Math.atan2(le,D);F=Ae*ee*ee+we*oe-we*Ae;let _e=-2*Ae*ee,vt=Ae-we;if(R=_e*_e-4*vt*F,R>=0){let ot=Math.sqrt(R);_e<0&&(ot=-ot),ot=-(_e+ot)*.5;let Ct=ot/vt,ys=F/ot,Rt=Math.abs(Ct)<Math.abs(ys)?Ct:ys;if(Ct=oe-Rt*Rt,Ct>=0){X=Math.sqrt(Ct)*r,me=Se-Math.atan2(X,Rt),ge=Math.atan2(X/u,(Rt-ee)/f);break e}}let ps=V.PI,Mt=ee-I,Qt=Mt*Mt,xs=0,ws=0,Ft=ee+I,_t=Ft*Ft,bs=0;F=-I*ee/(we-Ae),F>=-1&&F<=1&&(F=Math.acos(F),Y=I*Math.cos(F)+ee,X=E*Math.sin(F),R=Y*Y+X*X,R<Qt&&(ps=F,Qt=R,Mt=Y,xs=X),R>_t&&(ws=F,_t=R,Ft=Y,bs=X)),oe<=(Qt+_t)*.5?(me=Se-Math.atan2(xs*r,Mt),ge=ps*r):(me=Se-Math.atan2(bs*r,Ft),ge=ws*r)}let Pe=Math.atan2(C,x)*w,Fe=e.arotation;me=(me-Pe)*V.radDeg+b-Fe,me>180?me-=360:me<-180&&(me+=360),e.updateWorldTransformWith(l,h,Fe+me*n,m,g,0,0),Fe=t.arotation,ge=((ge+Pe)*V.radDeg-t.ashearX)*w+y-Fe,ge>180?ge-=360:ge<-180&&(ge+=360),t.updateWorldTransformWith(x,C,Fe+ge*n,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}}class yi extends Kt{constructor(t){super(t,0,!1);d(this,"bones",new Array);d(this,"_target",null);d(this,"bendDirection",0);d(this,"compress",!1);d(this,"stretch",!1);d(this,"uniform",!1);d(this,"mix",0);d(this,"softness",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class vi extends Kt{constructor(t){super(t,0,!1);d(this,"bones",new Array);d(this,"_target",null);d(this,"positionMode",je.Fixed);d(this,"spacingMode",ve.Fixed);d(this,"rotateMode",rt.Chain);d(this,"offsetRotation",0);d(this,"position",0);d(this,"spacing",0);d(this,"mixRotate",0);d(this,"mixX",0);d(this,"mixY",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var je;(function(A){A[A.Fixed=0]="Fixed",A[A.Percent=1]="Percent"})(je||(je={}));var ve;(function(A){A[A.Length=0]="Length",A[A.Fixed=1]="Fixed",A[A.Percent=2]="Percent",A[A.Proportional=3]="Proportional"})(ve||(ve={}));var rt;(function(A){A[A.Tangent=0]="Tangent",A[A.Chain=1]="Chain",A[A.ChainScale=2]="ChainScale"})(rt||(rt={}));const Xe=class Xe{constructor(e,t){d(this,"data");d(this,"bones");d(this,"target");d(this,"position",0);d(this,"spacing",0);d(this,"mixRotate",0);d(this,"mixX",0);d(this,"mixY",0);d(this,"spaces",new Array);d(this,"positions",new Array);d(this,"world",new Array);d(this,"curves",new Array);d(this,"lengths",new Array);d(this,"segments",new Array);d(this,"active",!1);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,r=e.bones.length;i<r;i++){let o=t.findBone(e.bones[i].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(o)}let s=t.findSlot(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=s,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof nt))return;let s=this.mixRotate,i=this.mixX,r=this.mixY;if(s==0&&i==0&&r==0)return;let o=this.data,a=o.rotateMode==rt.Tangent,c=o.rotateMode==rt.ChainScale,n=this.bones,l=n.length,h=a?l:l+1,f=O.setArraySize(this.spaces,h),u=c?this.lengths=O.setArraySize(this.lengths,l):[],m=this.spacing;switch(o.spacingMode){case ve.Percent:if(c)for(let v=0,S=h-1;v<S;v++){let I=n[v],E=I.data.length,F=E*I.a,R=E*I.c;
2u[v]=Math.sqrt(F*F+R*R)}O.arrayFill(f,1,h,m);break;case ve.Proportional:let x=0;for(let v=0,S=h-1;v<S;){let I=n[v],E=I.data.length;if(E<Xe.epsilon)c&&(u[v]=0),f[++v]=m;else{let F=E*I.a,R=E*I.c,L=Math.sqrt(F*F+R*R);c&&(u[v]=L),f[++v]=L,x+=L}}if(x>0){x=h/x*m;for(let v=1;v<h;v++)f[v]*=x}break;default:let C=o.spacingMode==ve.Length;for(let v=0,S=h-1;v<S;){let I=n[v],E=I.data.length;if(E<Xe.epsilon)c&&(u[v]=0),f[++v]=m;else{let F=E*I.a,R=E*I.c,L=Math.sqrt(F*F+R*R);c&&(u[v]=L),f[++v]=(C?E+m:m)*L/E}}}let g=this.computeWorldPositions(t,h,a),p=g[0],b=g[1],y=o.offsetRotation,w=!1;if(y==0)w=o.rotateMode==rt.Chain;else{w=!1;let x=this.target.bone;y*=x.a*x.d-x.b*x.c>0?V.degRad:-V.degRad}for(let x=0,C=3;x<l;x++,C+=3){let v=n[x];v.worldX+=(p-v.worldX)*i,v.worldY+=(b-v.worldY)*r;let S=g[C],I=g[C+1],E=S-p,F=I-b;if(c){let R=u[x];if(R!=0){let L=(Math.sqrt(E*E+F*F)/R-1)*s+1;v.a*=L,v.c*=L}}if(p=S,b=I,s>0){let R=v.a,L=v.b,B=v.c,T=v.d,Y=0,X=0,re=0;if(a?Y=g[C-1]:f[x+1]==0?Y=g[C+2]:Y=Math.atan2(F,E),Y-=Math.atan2(B,R),w){X=Math.cos(Y),re=Math.sin(Y);let ne=v.data.length;p+=(ne*(X*R-re*B)-E)*s,b+=(ne*(re*R+X*B)-F)*s}else Y+=y;Y>V.PI?Y-=V.PI2:Y<-V.PI&&(Y+=V.PI2),Y*=s,X=Math.cos(Y),re=Math.sin(Y),v.a=X*R-re*B,v.b=X*L-re*T,v.c=re*R+X*B,v.d=re*L+X*T}v.updateAppliedTransform()}}computeWorldPositions(e,t,s){let i=this.target,r=this.position,o=this.spaces,a=O.setArraySize(this.positions,t*3+2),c=this.world,n=e.closed,l=e.worldVerticesLength,h=l/6,f=Xe.NONE;if(!e.constantSpeed){let ne=e.lengths;h-=n?1:2;let ee=ne[h];this.data.positionMode==je.Percent&&(r*=ee);let ce;switch(this.data.spacingMode){case ve.Percent:ce=ee;break;case ve.Proportional:ce=ee/t;break;default:ce=1}c=O.setArraySize(this.world,8);for(let me=0,ge=0,D=0;me<t;me++,ge+=3){let le=o[me]*ce;r+=le;let oe=r;if(n)oe%=ee,oe<0&&(oe+=ee),D=0;else if(oe<0){f!=Xe.BEFORE&&(f=Xe.BEFORE,e.computeWorldVertices(i,2,4,c,0,2)),this.addBeforePosition(oe,c,0,a,ge);continue}else if(oe>ee){f!=Xe.AFTER&&(f=Xe.AFTER,e.computeWorldVertices(i,l-6,4,c,0,2)),this.addAfterPosition(oe-ee,c,0,a,ge);continue}for(;;D++){let Pe=ne[D];if(!(oe>Pe)){if(D==0)oe/=Pe;else{let Fe=ne[D-1];oe=(oe-Fe)/(Pe-Fe)}break}}D!=f&&(f=D,n&&D==h?(e.computeWorldVertices(i,l-4,4,c,0,2),e.computeWorldVertices(i,0,4,c,4,2)):e.computeWorldVertices(i,D*6+2,8,c,0,2)),this.addCurvePosition(oe,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],a,ge,s||me>0&&le==0)}return a}n?(l+=2,c=O.setArraySize(this.world,l),e.computeWorldVertices(i,2,l-4,c,0,2),e.computeWorldVertices(i,0,2,c,l-4,2),c[l-2]=c[0],c[l-1]=c[1]):(h--,l-=4,c=O.setArraySize(this.world,l),e.computeWorldVertices(i,2,l,c,0,2));let u=O.setArraySize(this.curves,h),m=0,g=c[0],p=c[1],b=0,y=0,w=0,x=0,C=0,v=0,S=0,I=0,E=0,F=0,R=0,L=0,B=0,T=0;for(let ne=0,ee=2;ne<h;ne++,ee+=6)b=c[ee],y=c[ee+1],w=c[ee+2],x=c[ee+3],C=c[ee+4],v=c[ee+5],S=(g-b*2+w)*.1875,I=(p-y*2+x)*.1875,E=((b-w)*3-g+C)*.09375,F=((y-x)*3-p+v)*.09375,R=S*2+E,L=I*2+F,B=(b-g)*.75+S+E*.16666667,T=(y-p)*.75+I+F*.16666667,m+=Math.sqrt(B*B+T*T),B+=R,T+=L,R+=E,L+=F,m+=Math.sqrt(B*B+T*T),B+=R,T+=L,m+=Math.sqrt(B*B+T*T),B+=R+E,T+=L+F,m+=Math.sqrt(B*B+T*T),u[ne]=m,g=C,p=v;this.data.positionMode==je.Percent&&(r*=m);let Y;switch(this.data.spacingMode){case ve.Percent:Y=m;break;case ve.Proportional:Y=m/t;break;default:Y=1}let X=this.segments,re=0;for(let ne=0,ee=0,ce=0,me=0;ne<t;ne++,ee+=3){let ge=o[ne]*Y;r+=ge;let D=r;if(n)D%=m,D<0&&(D+=m),ce=0;else if(D<0){this.addBeforePosition(D,c,0,a,ee);continue}else if(D>m){this.addAfterPosition(D-m,c,l-4,a,ee);continue}for(;;ce++){let le=u[ce];if(!(D>le)){if(ce==0)D/=le;else{let oe=u[ce-1];D=(D-oe)/(le-oe)}break}}if(ce!=f){f=ce;let le=ce*6;for(g=c[le],p=c[le+1],b=c[le+2],y=c[le+3],w=c[le+4],x=c[le+5],C=c[le+6],v=c[le+7],S=(g-b*2+w)*.03,I=(p-y*2+x)*.03,E=((b-w)*3-g+C)*.006,F=((y-x)*3-p+v)*.006,R=S*2+E,L=I*2+F,B=(b-g)*.3+S+E*.16666667,T=(y-p)*.3+I+F*.16666667,re=Math.sqrt(B*B+T*T),X[0]=re,le=1;le<8;le++)B+=R,T+=L,R+=E,L+=F,re+=Math.sqrt(B*B+T*T),X[le]=re;B+=R,T+=L,re+=Math.sqrt(B*B+T*T),X[8]=re,B+=R+E,T+=L+F,re+=Math.sqrt(B*B+T*T),X[9]=re,me=0}for(D*=re;;me++){let le=X[me];if(!(D>le)){if(me==0)D/=le;else{let oe=X[me-1];D=me+(D-oe)/(le-oe)}break}}this.addCurvePosition(D*.1,g,p,b,y,w,x,C,v,a,ee,s||ne>0&&ge==0)}return a}
2addBeforePosition(e,t,s,i,r){let o=t[s],a=t[s+1],c=t[s+2]-o,n=t[s+3]-a,l=Math.atan2(n,c);i[r]=o+e*Math.cos(l),i[r+1]=a+e*Math.sin(l),i[r+2]=l}addAfterPosition(e,t,s,i,r){let o=t[s+2],a=t[s+3],c=o-t[s],n=a-t[s+1],l=Math.atan2(n,c);i[r]=o+e*Math.cos(l),i[r+1]=a+e*Math.sin(l),i[r+2]=l}addCurvePosition(e,t,s,i,r,o,a,c,n,l,h,f){if(e==0||isNaN(e)){l[h]=t,l[h+1]=s,l[h+2]=Math.atan2(r-s,i-t);return}let u=e*e,m=u*e,g=1-e,p=g*g,b=p*g,y=g*e,w=y*3,x=g*w,C=w*e,v=t*b+i*x+o*C+c*m,S=s*b+r*x+a*C+n*m;l[h]=v,l[h+1]=S,f&&(e<.001?l[h+2]=Math.atan2(r-s,i-t):l[h+2]=Math.atan2(S-(s*p+r*y*2+a*u),v-(t*p+i*y*2+o*u)))}};d(Xe,"NONE",-1),d(Xe,"BEFORE",-2),d(Xe,"AFTER",-3),d(Xe,"epsilon",1e-5);let as=Xe;class Gi{constructor(e,t){d(this,"data");d(this,"_bone",null);d(this,"inertia",0);d(this,"strength",0);d(this,"damping",0);d(this,"massInverse",0);d(this,"wind",0);d(this,"gravity",0);d(this,"mix",0);d(this,"_reset",!0);d(this,"ux",0);d(this,"uy",0);d(this,"cx",0);d(this,"cy",0);d(this,"tx",0);d(this,"ty",0);d(this,"xOffset",0);d(this,"xVelocity",0);d(this,"yOffset",0);d(this,"yVelocity",0);d(this,"rotateOffset",0);d(this,"rotateVelocity",0);d(this,"scaleOffset",0);d(this,"scaleVelocity",0);d(this,"active",!1);d(this,"skeleton");d(this,"remaining",0);d(this,"lastTime",0);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}set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}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,o=this.data.scaleX>0,a=this.bone,c=a.data.length;switch(e){case Ue.none:return;case Ue.reset:this.reset();case Ue.update:const n=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=n.time;const h=a.worldX,f=a.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=f;else{let u=this.remaining,m=this.inertia,g=this.data.step,p=this.skeleton.data.referenceScale,b=-1,y=this.data.limit*l,w=y*Math.abs(n.scaleY);if(y*=Math.abs(n.scaleX),s||i){if(s){const x=(this.ux-h)*m;this.xOffset+=x>y?y:x<-y?-y:x,this.ux=h}if(i){const x=(this.uy-f)*m;this.yOffset+=x>w?w:x<-w?-w:x,this.uy=f}if(u>=g){b=Math.pow(this.damping,60*g);const x=this.massInverse*g,C=this.strength,v=this.wind*p,S=(It.yDown?-this.gravity:this.gravity)*p;do s&&(this.xVelocity+=(v-this.xOffset*C)*x,this.xOffset+=this.xVelocity*g,this.xVelocity*=b),i&&(this.yVelocity-=(S+this.yOffset*C)*x,this.yOffset+=this.yVelocity*g,this.yVelocity*=b),u-=g;while(u>=g)}s&&(a.worldX+=this.xOffset*t*this.data.x),i&&(a.worldY+=this.yOffset*t*this.data.y)}if(r||o){let x=Math.atan2(a.c,a.a),C=0,v=0,S=0,I=this.cx-a.worldX,E=this.cy-a.worldY;if(I>y?I=y:I<-y&&(I=-y),E>w?E=w:E<-w&&(E=-w),r){S=(this.data.rotate+this.data.shearX)*t;let F=Math.atan2(E+this.ty,I+this.tx)-x-this.rotateOffset*S;this.rotateOffset+=(F-Math.ceil(F*V.invPI2-.5)*V.PI2)*m,F=this.rotateOffset*S+x,C=Math.cos(F),v=Math.sin(F),o&&(F=c*a.getWorldScaleX(),F>0&&(this.scaleOffset+=(I*C+E*v)*m/F))}else{C=Math.cos(x),v=Math.sin(x);const F=c*a.getWorldScaleX();F>0&&(this.scaleOffset+=(I*C+E*v)*m/F)}if(u=this.remaining,u>=g){b==-1&&(b=Math.pow(this.damping,60*g));const F=this.massInverse*g,R=this.strength,L=this.wind,B=It.yDown?-this.gravity:this.gravity,T=c/p;for(;;)if(u-=g,o&&(this.scaleVelocity+=(L*C-B*v-this.scaleOffset*R)*F,this.scaleOffset+=this.scaleVelocity*g,this.scaleVelocity*=b),r){if(this.rotateVelocity-=((L*v+B*C)*T+this.rotateOffset*R)*F,this.rotateOffset+=this.rotateVelocity*g,this.rotateVelocity*=b,u<g)break;const Y=this.rotateOffset*S+x;C=Math.cos(Y),v=Math.sin(Y)}else if(u<g)break}}this.remaining=u}this.cx=a.worldX,this.cy=a.worldY;break;case Ue.pose:s&&(a.worldX+=this.xOffset*t*this.data.x),i&&(a.worldY+=this.yOffset*t*this.data.y)}if(r){let n=this.rotateOffset*t,l=0,h=0,f=0;if(this.data.shearX>0){let u=0;this.data.rotate>0&&(u=n*this.data.rotate,l=Math.sin(u),h=Math.cos(u),f=a.b,a.b=h*f-l*a.d,a.d=l*f+h*a.d),u+=n*this.data.shearX,l=Math.sin(u),h=Math.cos(u),f=a.a,a.a=h*f-l*a.c,a.c=l*f+h*a.c}else n*=this.data.rotate,l=Math.sin(n),h=Math.cos(n),f=a.a,a.a=h*f-l*a.c,a.c=l*f+h*a.c,f=a.b,a.b=h*f-l*a.d,a.d=l*f+h*a.d}if(o){const n=1+this.scaleOffset*t*this.data.scaleX;a.a*=n,a.c*=n}e!=Ue.pose&&(this.tx=c*a.a,this.ty=c*a.c),a.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}
2rotate(e,t,s){const i=s*V.degRad,r=Math.cos(i),o=Math.sin(i),a=this.cx-e,c=this.cy-t;this.translate(a*r-c*o-a,a*o+c*r-c)}}class Hi{constructor(e,t){d(this,"data");d(this,"bone");d(this,"color");d(this,"darkColor",null);d(this,"attachment",null);d(this,"attachmentState",0);d(this,"sequenceIndex",-1);d(this,"deform",new Array);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 N,this.darkColor=e.darkColor?new N:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ze)||!(this.attachment instanceof ze)||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}}class ji{constructor(e,t){d(this,"data");d(this,"bones");d(this,"target");d(this,"mixRotate",0);d(this,"mixX",0);d(this,"mixY",0);d(this,"mixScaleX",0);d(this,"mixScaleY",0);d(this,"mixShearY",0);d(this,"temp",new He);d(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let i=0;i<e.bones.length;i++){let r=t.findBone(e.bones[i].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[i].name}.`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=t!=0||s!=0,c=this.target,n=c.a,l=c.b,h=c.c,f=c.d,u=n*f-l*h>0?V.degRad:-V.degRad,m=this.data.offsetRotation*u,g=this.data.offsetShearY*u,p=this.bones;for(let b=0,y=p.length;b<y;b++){let w=p[b];if(e!=0){let x=w.a,C=w.b,v=w.c,S=w.d,I=Math.atan2(h,n)-Math.atan2(v,x)+m;I>V.PI?I-=V.PI2:I<-V.PI&&(I+=V.PI2),I*=e;let E=Math.cos(I),F=Math.sin(I);w.a=E*x-F*v,w.b=E*C-F*S,w.c=F*x+E*v,w.d=F*C+E*S}if(a){let x=this.temp;c.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),w.worldX+=(x.x-w.worldX)*t,w.worldY+=(x.y-w.worldY)*s}if(i!=0){let x=Math.sqrt(w.a*w.a+w.c*w.c);x!=0&&(x=(x+(Math.sqrt(n*n+h*h)-x+this.data.offsetScaleX)*i)/x),w.a*=x,w.c*=x}if(r!=0){let x=Math.sqrt(w.b*w.b+w.d*w.d);x!=0&&(x=(x+(Math.sqrt(l*l+f*f)-x+this.data.offsetScaleY)*r)/x),w.b*=x,w.d*=x}if(o>0){let x=w.b,C=w.d,v=Math.atan2(C,x),S=Math.atan2(f,l)-Math.atan2(h,n)-(v-Math.atan2(w.c,w.a));S>V.PI?S-=V.PI2:S<-V.PI&&(S+=V.PI2),S=v+(S+g)*o;let I=Math.sqrt(x*x+C*C);w.b=Math.cos(S)*I,w.d=Math.sin(S)*I}w.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=t!=0||s!=0,c=this.target,n=c.a,l=c.b,h=c.c,f=c.d,u=n*f-l*h>0?V.degRad:-V.degRad,m=this.data.offsetRotation*u,g=this.data.offsetShearY*u,p=this.bones;for(let b=0,y=p.length;b<y;b++){let w=p[b];if(e!=0){let x=w.a,C=w.b,v=w.c,S=w.d,I=Math.atan2(h,n)+m;I>V.PI?I-=V.PI2:I<-V.PI&&(I+=V.PI2),I*=e;let E=Math.cos(I),F=Math.sin(I);w.a=E*x-F*v,w.b=E*C-F*S,w.c=F*x+E*v,w.d=F*C+E*S}if(a){let x=this.temp;c.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),w.worldX+=x.x*t,w.worldY+=x.y*s}if(i!=0){let x=(Math.sqrt(n*n+h*h)-1+this.data.offsetScaleX)*i+1;w.a*=x,w.c*=x}if(r!=0){let x=(Math.sqrt(l*l+f*f)-1+this.data.offsetScaleY)*r+1;w.b*=x,w.d*=x}if(o>0){let x=Math.atan2(f,l)-Math.atan2(h,n);x>V.PI?x-=V.PI2:x<-V.PI&&(x+=V.PI2);let C=w.b,v=w.d;x=Math.atan2(v,C)+(x-V.PI/2+g)*o;let S=Math.sqrt(C*C+v*v);w.b=Math.cos(x)*S,w.d=Math.sin(x)*S}w.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=this.target,c=this.bones;for(let n=0,l=c.length;n<l;n++){let h=c[n],f=h.arotation;
2e!=0&&(f+=(a.arotation-f+this.data.offsetRotation)*e);let u=h.ax,m=h.ay;u+=(a.ax-u+this.data.offsetX)*t,m+=(a.ay-m+this.data.offsetY)*s;let g=h.ascaleX,p=h.ascaleY;i!=0&&g!=0&&(g=(g+(a.ascaleX-g+this.data.offsetScaleX)*i)/g),r!=0&&p!=0&&(p=(p+(a.ascaleY-p+this.data.offsetScaleY)*r)/p);let b=h.ashearY;o!=0&&(b+=(a.ashearY-b+this.data.offsetShearY)*o),h.updateWorldTransformWith(u,m,f,g,p,h.ashearX,b)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,i=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=this.target,c=this.bones;for(let n=0,l=c.length;n<l;n++){let h=c[n],f=h.arotation+(a.arotation+this.data.offsetRotation)*e,u=h.ax+(a.ax+this.data.offsetX)*t,m=h.ay+(a.ay+this.data.offsetY)*s,g=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*i+1),p=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*r+1),b=h.ashearY+(a.ashearY+this.data.offsetShearY)*o;h.updateWorldTransformWith(u,m,f,g,p,h.ashearX,b)}}}const mt=class mt{constructor(e){d(this,"data");d(this,"bones");d(this,"slots");d(this,"drawOrder");d(this,"ikConstraints");d(this,"transformConstraints");d(this,"pathConstraints");d(this,"physicsConstraints");d(this,"_updateCache",new Array);d(this,"skin",null);d(this,"color");d(this,"scaleX",1);d(this,"_scaleY",1);d(this,"x",0);d(this,"y",0);d(this,"time",0);if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let s=e.bones[t],i;if(!s.parent)i=new Ss(s,this,null);else{let r=this.bones[s.parent.index];i=new Ss(s,this,r),r.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let s=e.slots[t],i=this.bones[s.boneData.index],r=new Hi(s,i);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let s=e.ikConstraints[t];this.ikConstraints.push(new qi(s,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let s=e.transformConstraints[t];this.transformConstraints.push(new ji(s,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let s=e.pathConstraints[t];this.pathConstraints.push(new as(s,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let s=e.physicsConstraints[t];this.physicsConstraints.push(new Gi(s,this))}this.color=new N(1,1,1,1),this.updateCache()}get scaleY(){return mt.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let f=0,u=t.length;f<u;f++){let m=t[f];m.sorted=m.data.skinRequired,m.active=!m.sorted}if(this.skin){let f=this.skin.bones;for(let u=0,m=this.skin.bones.length;u<m;u++){let g=this.bones[f[u].index];do g.sorted=!1,g.active=!0,g=g.parent;while(g)}}let s=this.ikConstraints,i=this.transformConstraints,r=this.pathConstraints,o=this.physicsConstraints,a=s.length,c=i.length,n=r.length,l=this.physicsConstraints.length,h=a+c+n+l;e:for(let f=0;f<h;f++){for(let u=0;u<a;u++){let m=s[u];if(m.data.order==f){this.sortIkConstraint(m);continue e}}for(let u=0;u<c;u++){let m=i[u];if(m.data.order==f){this.sortTransformConstraint(m);continue e}}for(let u=0;u<n;u++){let m=r[u];if(m.data.order==f){this.sortPathConstraint(m);continue e}}for(let u=0;u<l;u++){const m=o[u];if(m.data.order==f){this.sortPhysicsConstraint(m);continue e}}}for(let f=0,u=t.length;f<u;f++)this.sortBone(t[f])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&O.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let s=e.bones,i=s[0];if(this.sortBone(i),s.length==1)this._updateCache.push(e),this.sortReset(i.children);else{let r=s[s.length-1];this.sortBone(r),this._updateCache.push(e),this.sortReset(i.children),r.sorted=!0}
2}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&O.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,s=t.data.index,i=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let c=0,n=this.data.skins.length;c<n;c++)this.sortPathConstraintAttachment(this.data.skins[c],s,i);let r=t.getAttachment();r instanceof nt&&this.sortPathConstraintAttachmentWith(r,i);let o=e.bones,a=o.length;for(let c=0;c<a;c++)this.sortBone(o[c]);this._updateCache.push(e);for(let c=0;c<a;c++)this.sortReset(o[c].children);for(let c=0;c<a;c++)o[c].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&O.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,s=t.length;if(e.data.local)for(let i=0;i<s;i++){let r=t[i];this.sortBone(r.parent),this.sortBone(r)}else for(let i=0;i<s;i++)this.sortBone(t[i]);this._updateCache.push(e);for(let i=0;i<s;i++)this.sortReset(t[i].children);for(let i=0;i<s;i++)t[i].sorted=!0}sortPathConstraintAttachment(e,t,s){let i=e.attachments[t];if(i)for(let r in i)this.sortPathConstraintAttachmentWith(i[r],s)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof nt))return;let s=e.bones;if(!s)this.sortBone(t);else{let i=this.bones;for(let r=0,o=s.length;r<o;){let a=s[r++];for(a+=r;r<a;)this.sortBone(i[s[r++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&O.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,s=e.length;t<s;t++){let i=e[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let t=this.bones;for(let i=0,r=t.length;i<r;i++){let o=t[i];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let s=this._updateCache;for(let i=0,r=s.length;i<r;i++)s[i].update(e)}updateWorldTransformWith(e,t){let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let i=t.a,r=t.b,o=t.c,a=t.d;s.worldX=i*this.x+r*this.y+t.worldX,s.worldY=o*this.x+a*this.y+t.worldY;const c=(s.rotation+s.shearX)*V.degRad,n=(s.rotation+90+s.shearY)*V.degRad,l=Math.cos(c)*s.scaleX,h=Math.cos(n)*s.scaleY,f=Math.sin(c)*s.scaleX,u=Math.sin(n)*s.scaleY;s.a=(i*l+r*f)*this.scaleX,s.b=(i*h+r*u)*this.scaleX,s.c=(o*l+a*f)*this.scaleY,s.d=(o*h+a*u)*this.scaleY;let m=this._updateCache;for(let g=0,p=m.length;g<p;g++){let b=m[g];b!=s&&b.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;O.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,s=e.length;t<s;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.data.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.data.name==e)return r}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let s=0,i=t.length;s<i;s++){let r=t[s],o=r.data.attachmentName;if(o){let a=e.getAttachment(s,o);a&&r.setAttachment(a)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,t);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,r=s.length;i<r;i++){let o=s[i];if(o.data.name==e){let a=null;if(t&&(a=this.getAttachment(i,t),!a))throw new Error("Attachment not found: "+t+", for slot: "+e);o.setAttachment(a);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(){let e=new He,t=new He;return this.getBounds(e,t),{x:e.x,y:e.y,width:t.x,height:t.y}}getBounds(e,t,s=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let r=this.drawOrder,o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(let l=0,h=r.length;l<h;l++){let f=r[l];if(!f.bone.active)continue;let u=0,m=null,g=null,p=f.getAttachment();if(p instanceof wt)u=8,m=O.setArraySize(s,u,0),p.computeWorldVertices(f,m,0,2),g=mt.quadTriangles;else if(p instanceof tt){let b=p;u=b.worldVerticesLength,m=O.setArraySize(s,u,0),b.computeWorldVertices(f,0,u,m,0,2),g=b.triangles}else if(p instanceof yt&&i!=null){i.clipStart(f,p);continue}
2if(m&&g){i!=null&&i.isClipping()&&(i.clipTriangles(m,g,g.length),m=i.clippedVertices,u=i.clippedVertices.length);for(let b=0,y=m.length;b<y;b+=2){let w=m[b],x=m[b+1];o=Math.min(o,w),a=Math.min(a,x),c=Math.max(c,w),n=Math.max(n,x)}}i!=null&&i.clipEndWithSlot(f)}i!=null&&i.clipEnd(),e.set(o,a),t.set(c-o,n-a)}update(e){this.time+=e}physicsTranslate(e,t){const s=this.physicsConstraints;for(let i=0,r=s.length;i<r;i++)s[i].translate(e,t)}physicsRotate(e,t,s){const i=this.physicsConstraints;for(let r=0,o=i.length;r<o;r++)i[r].rotate(e,t,s)}};d(mt,"quadTriangles",[0,1,2,2,3,0]),d(mt,"yDown",!1);let It=mt;var Ue;(function(A){A[A.none=0]="none",A[A.reset=1]="reset",A[A.update=2]="update",A[A.pose=3]="pose"})(Ue||(Ue={}));class Ci extends Kt{constructor(t){super(t,0,!1);d(this,"_bone",null);d(this,"x",0);d(this,"y",0);d(this,"rotate",0);d(this,"scaleX",0);d(this,"shearX",0);d(this,"limit",0);d(this,"step",0);d(this,"inertia",0);d(this,"strength",0);d(this,"damping",0);d(this,"massInverse",0);d(this,"wind",0);d(this,"gravity",0);d(this,"mix",0);d(this,"inertiaGlobal",!1);d(this,"strengthGlobal",!1);d(this,"dampingGlobal",!1);d(this,"massGlobal",!1);d(this,"windGlobal",!1);d(this,"gravityGlobal",!1);d(this,"mixGlobal",!1)}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}}class Ai{constructor(){d(this,"name",null);d(this,"bones",new Array);d(this,"slots",new Array);d(this,"skins",new Array);d(this,"defaultSkin",null);d(this,"events",new Array);d(this,"animations",new Array);d(this,"ikConstraints",new Array);d(this,"transformConstraints",new Array);d(this,"pathConstraints",new Array);d(this,"physicsConstraints",new Array);d(this,"x",0);d(this,"y",0);d(this,"width",0);d(this,"height",0);d(this,"referenceScale",100);d(this,"version",null);d(this,"hash",null);d(this,"fps",0);d(this,"imagesPath",null);d(this,"audioPath",null)}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,i=t.length;s<i;s++){let r=t[s];if(r.name==e)return r}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,i=t.length;s<i;s++){const r=t[s];if(r.name==e)return r}return null}}class Is{constructor(e=0,t,s){d(this,"slotIndex");d(this,"name");d(this,"attachment");this.slotIndex=e,this.name=t,this.attachment=s}}class ls{constructor(e){d(this,"name");d(this,"attachments",new Array);d(this,"bones",Array());d(this,"constraints",new Array);d(this,"color",new N(.99607843,.61960787,.30980393,1));if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;e>=i.length&&(i.length=e+1),i[e]||(i[e]={}),i[e][t]=s}addSkin(e){for(let i=0;i<e.bones.length;i++){let r=e.bones[i],o=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){o=!0;break}o||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],o=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){o=!0;break}o||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;
2i++){let r=e.bones[i],o=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){o=!0;break}o||this.bones.push(r)}for(let i=0;i<e.constraints.length;i++){let r=e.constraints[i],o=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){o=!0;break}o||this.constraints.push(r)}let t=e.getAttachments();for(let i=0;i<t.length;i++){var s=t[i];s.attachment&&(s.attachment instanceof tt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let i in s){let r=s[i];r&&e.push(new Is(t,i,r))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let i in s){let r=s[i];r&&t.push(new Is(e,i,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let i=0;i<e.slots.length;i++){let r=e.slots[i],o=r.getAttachment();if(o&&s<t.attachments.length){let a=t.attachments[s];for(let c in a){let n=a[c];if(o==n){let l=this.getAttachment(s,c);l&&r.setAttachment(l);break}}}s++}}}class Si{constructor(e,t,s){d(this,"index",0);d(this,"name");d(this,"boneData");d(this,"color",new N(1,1,1,1));d(this,"darkColor",null);d(this,"attachmentName",null);d(this,"blendMode",Et.Normal);d(this,"visible",!0);if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}}var Et;(function(A){A[A.Normal=0]="Normal",A[A.Additive=1]="Additive",A[A.Multiply=2]="Multiply",A[A.Screen=3]="Screen"})(Et||(Et={}));class Ii extends Kt{constructor(t){super(t,0,!1);d(this,"bones",new Array);d(this,"_target",null);d(this,"mixRotate",0);d(this,"mixX",0);d(this,"mixY",0);d(this,"mixScaleX",0);d(this,"mixScaleY",0);d(this,"mixShearY",0);d(this,"offsetRotation",0);d(this,"offsetX",0);d(this,"offsetY",0);d(this,"offsetScaleX",0);d(this,"offsetScaleY",0);d(this,"offsetShearY",0);d(this,"relative",!1);d(this,"local",!1)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class Zi{constructor(e){d(this,"scale",1);d(this,"attachmentLoader");d(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ai;s.name="";let i=new Ki(e),r=i.readInt32(),o=i.readInt32();s.hash=o==0&&r==0?null:o.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 a=i.readBoolean();a&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let c=0;c=i.readInt(!0);for(let l=0;l<c;l++){let h=i.readString();if(!h)throw new Error("String in string table must not be null.");i.strings.push(h)}c=i.readInt(!0);for(let l=0;l<c;l++){let h=i.readString();if(!h)throw new Error("Bone name must not be null.");let f=l==0?null:s.bones[i.readInt(!0)],u=new pi(l,h,f);u.rotation=i.readFloat(),u.x=i.readFloat()*t,u.y=i.readFloat()*t,u.scaleX=i.readFloat(),u.scaleY=i.readFloat(),u.shearX=i.readFloat(),u.shearY=i.readFloat(),u.length=i.readFloat()*t,u.inherit=i.readByte(),u.skinRequired=i.readBoolean(),a&&(N.rgba8888ToColor(u.color,i.readInt32()),u.icon=i.readString()??void 0,u.visible=i.readBoolean()),s.bones.push(u)}c=i.readInt(!0);for(let l=0;l<c;l++){let h=i.readString();if(!h)throw new Error("Slot name must not be null.");let f=s.bones[i.readInt(!0)],u=new Si(l,h,f);N.rgba8888ToColor(u.color,i.readInt32());let m=i.readInt32();m!=-1&&N.rgb888ToColor(u.darkColor=new N,m),u.attachmentName=i.readStringRef(),u.blendMode=i.readInt(!0),a&&(u.visible=i.readBoolean()),s.slots.push(u)}c=i.readInt(!0);for(let l=0,h;l<c;l++){let f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");let u=new yi(f);u.order=i.readInt(!0),h=i.readInt(!0);for(let g=0;g<h;
2g++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.bendDirection=m&2?1:-1,u.compress=(m&4)!=0,u.stretch=(m&8)!=0,u.uniform=(m&16)!=0,m&32&&(u.mix=m&64?i.readFloat():1),m&128&&(u.softness=i.readFloat()*t),s.ikConstraints.push(u)}c=i.readInt(!0);for(let l=0,h;l<c;l++){let f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let u=new Ii(f);u.order=i.readInt(!0),h=i.readInt(!0);for(let g=0;g<h;g++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,u.local=(m&2)!=0,u.relative=(m&4)!=0,m&8&&(u.offsetRotation=i.readFloat()),m&16&&(u.offsetX=i.readFloat()*t),m&32&&(u.offsetY=i.readFloat()*t),m&64&&(u.offsetScaleX=i.readFloat()),m&128&&(u.offsetScaleY=i.readFloat()),m=i.readByte(),m&1&&(u.offsetShearY=i.readFloat()),m&2&&(u.mixRotate=i.readFloat()),m&4&&(u.mixX=i.readFloat()),m&8&&(u.mixY=i.readFloat()),m&16&&(u.mixScaleX=i.readFloat()),m&32&&(u.mixScaleY=i.readFloat()),m&64&&(u.mixShearY=i.readFloat()),s.transformConstraints.push(u)}c=i.readInt(!0);for(let l=0,h;l<c;l++){let f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");let u=new vi(f);u.order=i.readInt(!0),u.skinRequired=i.readBoolean(),h=i.readInt(!0);for(let g=0;g<h;g++)u.bones.push(s.bones[i.readInt(!0)]);u.target=s.slots[i.readInt(!0)];const m=i.readByte();u.positionMode=m&1,u.spacingMode=m>>1&3,u.rotateMode=m>>3&3,m&128&&(u.offsetRotation=i.readFloat()),u.position=i.readFloat(),u.positionMode==je.Fixed&&(u.position*=t),u.spacing=i.readFloat(),(u.spacingMode==ve.Length||u.spacingMode==ve.Fixed)&&(u.spacing*=t),u.mixRotate=i.readFloat(),u.mixX=i.readFloat(),u.mixY=i.readFloat(),s.pathConstraints.push(u)}c=i.readInt(!0);for(let l=0,h;l<c;l++){const f=i.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const u=new Ci(f);u.order=i.readInt(!0),u.bone=s.bones[i.readInt(!0)];let m=i.readByte();u.skinRequired=(m&1)!=0,m&2&&(u.x=i.readFloat()),m&4&&(u.y=i.readFloat()),m&8&&(u.rotate=i.readFloat()),m&16&&(u.scaleX=i.readFloat()),m&32&&(u.shearX=i.readFloat()),u.limit=(m&64?i.readFloat():5e3)*t,u.step=1/i.readUnsignedByte(),u.inertia=i.readFloat(),u.strength=i.readFloat(),u.damping=i.readFloat(),u.massInverse=m&128?i.readFloat():1,u.wind=i.readFloat(),u.gravity=i.readFloat(),m=i.readByte(),m&1&&(u.inertiaGlobal=!0),m&2&&(u.strengthGlobal=!0),m&4&&(u.dampingGlobal=!0),m&8&&(u.massGlobal=!0),m&16&&(u.windGlobal=!0),m&32&&(u.gravityGlobal=!0),m&64&&(u.mixGlobal=!0),u.mix=m&128?i.readFloat():1,s.physicsConstraints.push(u)}let n=this.readSkin(i,s,!0,a);n&&(s.defaultSkin=n,s.skins.push(n));{let l=s.skins.length;for(O.setArraySize(s.skins,c=l+i.readInt(!0));l<c;l++){let h=this.readSkin(i,s,!1,a);if(!h)throw new Error("readSkin() should not have returned null.");s.skins[l]=h}}c=this.linkedMeshes.length;for(let l=0;l<c;l++){let h=this.linkedMeshes[l];const f=s.skins[h.skinIndex];if(!h.parent)throw new Error("Linked mesh parent must not be null");let u=f.getAttachment(h.slotIndex,h.parent);if(!u)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?u:h.mesh,h.mesh.setParentMesh(u),h.mesh.region!=null&&h.mesh.updateRegion()}this.linkedMeshes.length=0,c=i.readInt(!0);for(let l=0;l<c;l++){let h=i.readString();if(!h)throw new Error("Event data name must not be null");let f=new bi(h);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}c=i.readInt(!0);for(let l=0;l<c;l++){let h=i.readString();if(!h)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,h,s))}return s}readSkin(e,t,s,i){let r=null,o=0;if(s){if(o=e.readInt(!0),o==0)return null;r=new ls("default")}else{let a=e.readString();if(!a)throw new Error("Skin name must not be null.");r=new ls(a),i&&N.rgba8888ToColor(r.color,e.readInt32()),r.bones.length=e.readInt(!0);for(let c=0,n=r.bones.length;c<n;c++)r.bones[c]=t.bones[e.readInt(!0)];for(let c=0,n=e.readInt(!0);c<n;c++)r.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let c=0,n=e.readInt(!0);c<n;c++)r.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let c=0,n=e.readInt(!0);c<n;c++)r.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let c=0,n=e.readInt(!0);c<n;c++)r.constraints.push(t.physicsConstraints[e.readInt(!0)]);o=e.readInt(!0)}for(let a=0;a<o;a++){let c=e.readInt(!0);for(let n=0,l=e.readInt(!0);n<l;n++){let h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,r,c,h,i);f&&r.setAttachment(c,h,f)}}return r}readAttachment(e,t,s,i,r,o){let a=this.scale,c=e.readByte();const n=c&8?e.readStringRef():r;if(!n)throw new Error("Attachment name must not be null");switch(c&7){case Qe.Region:{let l=c&16?e.readStringRef():null;const h=c&32?e.readInt32():4294967295,f=c&64?this.readSequence(e):null;let u=c&128?e.readFloat():0,m=e.readFloat(),g=e.readFloat(),p=e.readFloat(),b=e.readFloat(),y=e.readFloat(),w=e.readFloat();l||(l=n);let x=this.attachmentLoader.newRegionAttachment(s,n,l,f);return x?(x.path=l,x.x=m*a,x.y=g*a,x.scaleX=p,x.scaleY=b,x.rotation=u,x.width=y*a,x.height=w*a,N.rgba8888ToColor(x.color,h),x.sequence=f,f==null&&x.updateRegion(),x):null}case Qe.BoundingBox:{let l=this.readVertices(e,(c&16)!=0),h=o?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,n);return f?(f.worldVerticesLength=l.length,f.vertices=l.vertices,f.bones=l.bones,o&&N.rgba8888ToColor(f.color,h),f):null}case Qe.Mesh:{let l=c&16?e.readStringRef():n;const h=c&32?e.readInt32():4294967295,f=c&64?this.readSequence(e):null,u=e.readInt(!0),m=this.readVertices(e,(c&128)!=0),g=this.readFloatArray(e,m.length,1),p=this.readShortArray(e,(m.length-u-2)*3);let b=[],y=0,w=0;o&&(b=this.readShortArray(e,e.readInt(!0)),y=e.readFloat(),w=e.readFloat()),l||(l=n);let x=this.attachmentLoader.newMeshAttachment(s,n,l,f);return x?(x.path=l,N.rgba8888ToColor(x.color,h),x.bones=m.bones,x.vertices=m.vertices,x.worldVerticesLength=m.length,x.triangles=p,x.regionUVs=g,f==null&&x.updateRegion(),x.hullLength=u<<1,x.sequence=f,o&&(x.edges=b,x.width=y*a,x.height=w*a),x):null}case Qe.LinkedMesh:{const l=c&16?e.readStringRef():n;if(l==null)throw new Error("Path of linked mesh must not be null");const h=c&32?e.readInt32():4294967295,f=c&64?this.readSequence(e):null,u=(c&128)!=0,m=e.readInt(!0),g=e.readStringRef();let p=0,b=0;o&&(p=e.readFloat(),b=e.readFloat());let y=this.attachmentLoader.newMeshAttachment(s,n,l,f);return y?(y.path=l,N.rgba8888ToColor(y.color,h),y.sequence=f,o&&(y.width=p*a,y.height=b*a),this.linkedMeshes.push(new Ji(y,m,i,g,u)),y):null}case Qe.Path:{const l=(c&16)!=0,h=(c&32)!=0,f=this.readVertices(e,(c&64)!=0),u=O.newArray(f.length/6,0);for(let p=0,b=u.length;p<b;p++)u[p]=e.readFloat()*a;const m=o?e.readInt32():0,g=this.attachmentLoader.newPathAttachment(s,n);return g?(g.closed=l,g.constantSpeed=h,g.worldVerticesLength=f.length,g.vertices=f.vertices,g.bones=f.bones,g.lengths=u,o&&N.rgba8888ToColor(g.color,m),g):null}case Qe.Point:{const l=e.readFloat(),h=e.readFloat(),f=e.readFloat(),u=o?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,n);
2return m?(m.x=h*a,m.y=f*a,m.rotation=l,o&&N.rgba8888ToColor(m.color,u),m):null}case Qe.Clipping:{const l=e.readInt(!0),h=this.readVertices(e,(c&16)!=0);let f=o?e.readInt32():0,u=this.attachmentLoader.newClippingAttachment(s,n);return u?(u.endSlot=t.slots[l],u.worldVerticesLength=h.length,u.vertices=h.vertices,u.bones=h.bones,o&&N.rgba8888ToColor(u.color,f),u):null}}return null}readSequence(e){let t=new Pt(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,i=e.readInt(!0),r=new Qi;if(r.length=i<<1,!t)return r.vertices=this.readFloatArray(e,r.length,s),r;let o=new Array,a=new Array;for(let c=0;c<i;c++){let n=e.readInt(!0);a.push(n);for(let l=0;l<n;l++)a.push(e.readInt(!0)),o.push(e.readFloat()*s),o.push(e.readFloat()*s),o.push(e.readFloat())}return r.vertices=O.toFloatArray(o),r.bones=a,r}readFloatArray(e,t,s){let i=new Array(t);if(s==1)for(let r=0;r<t;r++)i[r]=e.readFloat();else for(let r=0;r<t;r++)i[r]=e.readFloat()*s;return i}readShortArray(e,t){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let i=new Array,r=this.scale;for(let n=0,l=e.readInt(!0);n<l;n++){let h=e.readInt(!0);for(let f=0,u=e.readInt(!0);f<u;f++){let m=e.readByte(),g=e.readInt(!0),p=g-1;switch(m){case hr:{let b=new ct(g,h);for(let y=0;y<g;y++)b.setFrame(y,e.readFloat(),e.readStringRef());i.push(b);break}case cr:{let b=e.readInt(!0),y=new Js(g,b,h),w=e.readFloat(),x=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let I=0,E=0;y.setFrame(I,w,x,C,v,S),I!=p;I++){let F=e.readFloat(),R=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;switch(e.readByte()){case qe:y.setStepped(I);break;case Ge:he(e,y,E++,I,0,w,F,x,R,1),he(e,y,E++,I,1,w,F,C,L,1),he(e,y,E++,I,2,w,F,v,B,1),he(e,y,E++,I,3,w,F,S,T,1)}w=F,x=R,C=L,v=B,S=T}i.push(y);break}case dr:{let b=e.readInt(!0),y=new Qs(g,b,h),w=e.readFloat(),x=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255;for(let S=0,I=0;y.setFrame(S,w,x,C,v),S!=p;S++){let E=e.readFloat(),F=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255;switch(e.readByte()){case qe:y.setStepped(S);break;case Ge:he(e,y,I++,S,0,w,E,x,F,1),he(e,y,I++,S,1,w,E,C,R,1),he(e,y,I++,S,2,w,E,v,L,1)}w=E,x=F,C=R,v=L}i.push(y);break}case ur:{let b=e.readInt(!0),y=new $s(g,b,h),w=e.readFloat(),x=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;for(let R=0,L=0;y.setFrame(R,w,x,C,v,S,I,E,F),R!=p;R++){let B=e.readFloat(),T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,re=e.readUnsignedByte()/255,ne=e.readUnsignedByte()/255,ee=e.readUnsignedByte()/255,ce=e.readUnsignedByte()/255;switch(e.readByte()){case qe:y.setStepped(R);break;case Ge:he(e,y,L++,R,0,w,B,x,T,1),he(e,y,L++,R,1,w,B,C,Y,1),he(e,y,L++,R,2,w,B,v,X,1),he(e,y,L++,R,3,w,B,S,re,1),he(e,y,L++,R,4,w,B,I,ne,1),he(e,y,L++,R,5,w,B,E,ee,1),he(e,y,L++,R,6,w,B,F,ce,1)}w=B,x=T,C=Y,v=X,S=re,I=ne,E=ee,F=ce}i.push(y);break}case fr:{let b=e.readInt(!0),y=new ei(g,b,h),w=e.readFloat(),x=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,v=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;for(let F=0,R=0;y.setFrame(F,w,x,C,v,S,I,E),F!=p;F++){let L=e.readFloat(),B=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,re=e.readUnsignedByte()/255,ne=e.readUnsignedByte()/255;switch(e.readByte()){case qe:y.setStepped(F);break;case Ge:he(e,y,R++,F,0,w,L,x,B,1),he(e,y,R++,F,1,w,L,C,T,1),he(e,y,R++,F,2,w,L,v,Y,1),he(e,y,R++,F,3,w,L,S,X,1),he(e,y,R++,F,4,w,L,I,re,1),he(e,y,R++,F,5,w,L,E,ne,1)}w=L,x=B,C=T,v=Y,S=X,I=re,E=ne}i.push(y);break}case mr:{let b=new _s(g,e.readInt(!0),h),y=e.readFloat(),w=e.readUnsignedByte()/255;for(let x=0,C=0;b.setFrame(x,y,w),x!=p;x++){let v=e.readFloat(),S=e.readUnsignedByte()/255;switch(e.readByte()){case qe:b.setStepped(x);break;case Ge:he(e,b,C++,x,0,y,v,w,S,1)}y=v,w=S}i.push(b)}}}}for(let n=0,l=e.readInt(!0);n<l;n++){let h=e.readInt(!0);for(let f=0,u=e.readInt(!0);f<u;f++){let m=e.readByte(),g=e.readInt(!0);if(m==or){let b=new Ks(g,h);for(let y=0;y<g;
2y++)b.setFrame(y,e.readFloat(),e.readByte());i.push(b);continue}let p=e.readInt(!0);switch(m){case _i:i.push(Ie(e,new Vt(g,p,h),1));break;case $i:i.push(ts(e,new Ds(g,p,h),r));break;case er:i.push(Ie(e,new Us(g,p,h),r));break;case tr:i.push(Ie(e,new zs(g,p,h),r));break;case sr:i.push(ts(e,new Ws(g,p,h),1));break;case ir:i.push(Ie(e,new qs(g,p,h),1));break;case rr:i.push(Ie(e,new Gs(g,p,h),1));break;case nr:i.push(ts(e,new Hs(g,p,h),1));break;case ar:i.push(Ie(e,new js(g,p,h),1));break;case lr:i.push(Ie(e,new Zs(g,p,h),1))}}}for(let n=0,l=e.readInt(!0);n<l;n++){let h=e.readInt(!0),f=e.readInt(!0),u=f-1,m=new si(f,e.readInt(!0),h),g=e.readByte(),p=e.readFloat(),b=g&1?g&2?e.readFloat():1:0,y=g&4?e.readFloat()*r:0;for(let w=0,x=0;m.setFrame(w,p,b,y,g&8?1:-1,(g&16)!=0,(g&32)!=0),w!=u;w++){g=e.readByte();const C=e.readFloat(),v=g&1?g&2?e.readFloat():1:0,S=g&4?e.readFloat()*r:0;g&64?m.setStepped(w):g&128&&(he(e,m,x++,w,0,p,C,b,v,1),he(e,m,x++,w,1,p,C,y,S,r)),p=C,b=v,y=S}i.push(m)}for(let n=0,l=e.readInt(!0);n<l;n++){let h=e.readInt(!0),f=e.readInt(!0),u=f-1,m=new ii(f,e.readInt(!0),h),g=e.readFloat(),p=e.readFloat(),b=e.readFloat(),y=e.readFloat(),w=e.readFloat(),x=e.readFloat(),C=e.readFloat();for(let v=0,S=0;m.setFrame(v,g,p,b,y,w,x,C),v!=u;v++){let I=e.readFloat(),E=e.readFloat(),F=e.readFloat(),R=e.readFloat(),L=e.readFloat(),B=e.readFloat(),T=e.readFloat();switch(e.readByte()){case qe:m.setStepped(v);break;case Ge:he(e,m,S++,v,0,g,I,p,E,1),he(e,m,S++,v,1,g,I,b,F,1),he(e,m,S++,v,2,g,I,y,R,1),he(e,m,S++,v,3,g,I,w,L,1),he(e,m,S++,v,4,g,I,x,B,1),he(e,m,S++,v,5,g,I,C,T,1)}g=I,p=E,b=F,y=R,w=L,x=B,C=T}i.push(m)}for(let n=0,l=e.readInt(!0);n<l;n++){let h=e.readInt(!0),f=s.pathConstraints[h];for(let u=0,m=e.readInt(!0);u<m;u++){const g=e.readByte(),p=e.readInt(!0),b=e.readInt(!0);switch(g){case xr:i.push(Ie(e,new ri(p,b,h),f.positionMode==je.Fixed?r:1));break;case wr:i.push(Ie(e,new ni(p,b,h),f.spacingMode==ve.Length||f.spacingMode==ve.Fixed?r:1));break;case br:let y=new ai(p,b,h),w=e.readFloat(),x=e.readFloat(),C=e.readFloat(),v=e.readFloat();for(let S=0,I=0,E=y.getFrameCount()-1;y.setFrame(S,w,x,C,v),S!=E;S++){let F=e.readFloat(),R=e.readFloat(),L=e.readFloat(),B=e.readFloat();switch(e.readByte()){case qe:y.setStepped(S);break;case Ge:he(e,y,I++,S,0,w,F,x,R,1),he(e,y,I++,S,1,w,F,C,L,1),he(e,y,I++,S,2,w,F,v,B,1)}w=F,x=R,C=L,v=B}i.push(y)}}}for(let n=0,l=e.readInt(!0);n<l;n++){const h=e.readInt(!0)-1;for(let f=0,u=e.readInt(!0);f<u;f++){const m=e.readByte(),g=e.readInt(!0);if(m==kr){const b=new Ot(g,h);for(let y=0;y<g;y++)b.setFrame(y,e.readFloat());i.push(b);continue}const p=e.readInt(!0);switch(m){case yr:i.push(Ie(e,new li(g,p,h),1));break;case vr:i.push(Ie(e,new oi(g,p,h),1));break;case Cr:i.push(Ie(e,new hi(g,p,h),1));break;case Ar:i.push(Ie(e,new ci(g,p,h),1));break;case Sr:i.push(Ie(e,new di(g,p,h),1));break;case Ir:i.push(Ie(e,new ui(g,p,h),1));break;case Er:i.push(Ie(e,new fi(g,p,h),1))}}}for(let n=0,l=e.readInt(!0);n<l;n++){let h=s.skins[e.readInt(!0)];for(let f=0,u=e.readInt(!0);f<u;f++){let m=e.readInt(!0);for(let g=0,p=e.readInt(!0);g<p;g++){let b=e.readStringRef();if(!b)throw new Error("attachmentName must not be null.");let y=h.getAttachment(m,b),w=e.readByte(),x=e.readInt(!0),C=x-1;switch(w){case gr:{let v=y,S=v.bones,I=v.vertices,E=S?I.length/3*2:I.length,F=e.readInt(!0),R=new ti(x,F,m,v),L=e.readFloat();for(let B=0,T=0;;B++){let Y,X=e.readInt(!0);if(X==0)Y=S?O.newFloatArray(E):I;else{Y=O.newFloatArray(E);let ne=e.readInt(!0);if(X+=ne,r==1)for(let ee=ne;ee<X;ee++)Y[ee]=e.readFloat();else for(let ee=ne;ee<X;ee++)Y[ee]=e.readFloat()*r;if(!S)for(let ee=0,ce=Y.length;ee<ce;ee++)Y[ee]+=I[ee]}if(R.setFrame(B,L,Y),B==C)break;let re=e.readFloat();switch(e.readByte()){case qe:R.setStepped(B);break;case Ge:he(e,R,T++,B,0,L,re,0,1,1)}L=re}i.push(R);break}case pr:{let v=new Nt(x,m,y);for(let S=0;S<x;S++){let I=e.readFloat(),E=e.readInt32();v.setFrame(S,I,Ns[E&15],E>>4,e.readFloat())}i.push(v);break}}}}}let o=e.readInt(!0);if(o>0){let n=new it(o),l=s.slots.length;for(let h=0;h<o;h++){let f=e.readFloat(),u=e.readInt(!0),m=O.newArray(l,0);for(let y=l-1;y>=0;y--)m[y]=-1;let g=O.newArray(l-u,0),p=0,b=0;for(let y=0;y<u;y++){let w=e.readInt(!0);for(;p!=w;)g[b++]=p++;m[p+e.readInt(!0)]=p++}for(;p<l;)g[b++]=p++;for(let y=l-1;y>=0;y--)m[y]==-1&&(m[y]=g[--b]);
2n.setFrame(h,f,m)}i.push(n)}let a=e.readInt(!0);if(a>0){let n=new St(a);for(let l=0;l<a;l++){let h=e.readFloat(),f=s.events[e.readInt(!0)],u=new wi(h,f);u.intValue=e.readInt(!1),u.floatValue=e.readFloat(),u.stringValue=e.readString(),u.stringValue==null&&(u.stringValue=f.stringValue),u.data.audioPath&&(u.volume=e.readFloat(),u.balance=e.readFloat()),n.setFrame(l,u)}i.push(n)}let c=0;for(let n=0,l=i.length;n<l;n++)c=Math.max(c,i[n].getDuration());return new fs(t,i,c)}}class Ki{constructor(e,t=new Array,s=0,i=new DataView(e instanceof ArrayBuffer?e:e.buffer)){d(this,"strings");d(this,"index");d(this,"buffer");this.strings=t,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return t&128&&(t=this.readByte(),s|=(t&127)<<7,t&128&&(t=this.readByte(),s|=(t&127)<<14,t&128&&(t=this.readByte(),s|=(t&127)<<21,t&128&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="";for(let s=0;s<e;){let i=this.readUnsignedByte();switch(i>>4){case 12:case 13:t+=String.fromCharCode((i&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(i),s++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}}let Ji=class{constructor(e,t,s,i,r){d(this,"parent");d(this,"skinIndex");d(this,"slotIndex");d(this,"mesh");d(this,"inheritTimeline");this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}};class Qi{constructor(e=null,t=null,s=0){d(this,"bones");d(this,"vertices");d(this,"length");this.bones=e,this.vertices=t,this.length=s}}var Qe;(function(A){A[A.Region=0]="Region",A[A.BoundingBox=1]="BoundingBox",A[A.Mesh=2]="Mesh",A[A.LinkedMesh=3]="LinkedMesh",A[A.Path=4]="Path",A[A.Point=5]="Point",A[A.Clipping=6]="Clipping"})(Qe||(Qe={}));function Ie(A,e,t){let s=A.readFloat(),i=A.readFloat()*t;for(let r=0,o=0,a=e.getFrameCount()-1;e.setFrame(r,s,i),r!=a;r++){let c=A.readFloat(),n=A.readFloat()*t;switch(A.readByte()){case qe:e.setStepped(r);break;case Ge:he(A,e,o++,r,0,s,c,i,n,t)}s=c,i=n}return e}function ts(A,e,t){let s=A.readFloat(),i=A.readFloat()*t,r=A.readFloat()*t;for(let o=0,a=0,c=e.getFrameCount()-1;e.setFrame(o,s,i,r),o!=c;o++){let n=A.readFloat(),l=A.readFloat()*t,h=A.readFloat()*t;switch(A.readByte()){case qe:e.setStepped(o);break;case Ge:he(A,e,a++,o,0,s,n,i,l,t),he(A,e,a++,o,1,s,n,r,h,t)}s=n,i=l,r=h}return e}function he(A,e,t,s,i,r,o,a,c,n){e.setBezier(t,s,i,r,a,A.readFloat(),A.readFloat()*n,A.readFloat(),A.readFloat()*n,o,c)}const _i=0,$i=1,er=2,tr=3,sr=4,ir=5,rr=6,nr=7,ar=8,lr=9,or=10,hr=0,cr=1,dr=2,ur=3,fr=4,mr=5,gr=0,pr=1,xr=0,wr=1,br=2,yr=0,vr=1,Cr=2,Ar=4,Sr=5,Ir=6,Er=7,kr=8,qe=1,Ge=2;class Tr{constructor(){d(this,"minX",0);d(this,"minY",0);d(this,"maxX",0);d(this,"maxY",0);d(this,"boundingBoxes",new Array);d(this,"polygons",new Array);d(this,"polygonPool",new Bt(()=>O.newFloatArray(16)))}update(e,t){if(!e)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,r=this.polygonPool,o=e.slots,a=o.length;s.length=0,r.freeAll(i),i.length=0;for(let c=0;c<a;c++){let n=o[c];if(!n.bone.active)continue;let l=n.getAttachment();if(l instanceof Zt){let h=l;s.push(h);let f=r.obtain();f.length!=h.worldVerticesLength&&(f=O.newFloatArray(h.worldVerticesLength)),i.push(f),h.computeWorldVertices(n,0,h.worldVerticesLength,f,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,r=this.polygons;for(let o=0,a=r.length;o<a;o++){let c=r[o],n=c;for(let l=0,h=c.length;l<h;l+=2){let f=n[l],u=n[l+1];e=Math.min(e,f),t=Math.min(t,u),s=Math.max(s,f),i=Math.max(i,u)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=i}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,i){let r=this.minX,o=this.minY,a=this.maxX,c=this.maxY;if(e<=r&&s<=r||t<=o&&i<=o||e>=a&&s>=a||t>=c&&i>=c)return!1;let n=(i-t)/(s-e),l=n*(r-e)+t;if(l>o&&l<c||(l=n*(a-e)+t,l>o&&l<c))return!0;let h=(o-t)/n+e;return h>r&&h<a||(h=(c-t)/n+e,h>r&&h<a)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){let s=this.polygons;for(let i=0,r=s.length;i<r;i++)if(this.containsPointPolygon(s[i],e,t))return this.boundingBoxes[i];return null}containsPointPolygon(e,t,s){let i=e,r=e.length,o=r-2,a=!1;for(let c=0;c<r;c+=2){let n=i[c+1],l=i[o+1];if(n<s&&l>=s||l<s&&n>=s){let h=i[c];h+(s-n)/(l-n)*(i[o]-h)<t&&(a=!a)}o=c}return a}intersectsSegment(e,t,s,i){let r=this.polygons;for(let o=0,a=r.length;o<a;o++)if(this.intersectsSegmentPolygon(r[o],e,t,s,i))return this.boundingBoxes[o];return null}intersectsSegmentPolygon(e,t,s,i,r){let o=e,a=e.length,c=t-i,n=s-r,l=t*r-s*i,h=o[a-2],f=o[a-1];for(let u=0;u<a;u+=2){let m=o[u],g=o[u+1],p=h*g-f*m,b=h-m,y=f-g,w=c*y-n*b,x=(l*b-c*p)/w;if((x>=h&&x<=m||x>=m&&x<=h)&&(x>=t&&x<=i||x>=i&&x<=t)){let C=(l*y-n*p)/w;if((C>=f&&C<=g||C>=g&&C<=f)&&(C>=s&&C<=r||C>=r&&C<=s))return!0}h=m,f=g}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}}class Ye{constructor(){d(this,"convexPolygons",new Array);d(this,"convexPolygonsIndices",new Array);d(this,"indicesArray",new Array);d(this,"isConcaveArray",new Array);d(this,"triangles",new Array);d(this,"polygonPool",new Bt(()=>new Array));d(this,"polygonIndicesPool",new Bt(()=>new Array))}triangulate(e){let t=e,s=e.length>>1,i=this.indicesArray;i.length=0;for(let a=0;a<s;a++)i[a]=a;let r=this.isConcaveArray;r.length=0;for(let a=0,c=s;a<c;++a)r[a]=Ye.isConcave(a,s,t,i);let o=this.triangles;for(o.length=0;s>3;){let a=s-1,c=0,n=1;for(;;){e:if(!r[c]){let f=i[a]<<1,u=i[c]<<1,m=i[n]<<1,g=t[f],p=t[f+1],b=t[u],y=t[u+1],w=t[m],x=t[m+1];for(let C=(n+1)%s;C!=a;C=(C+1)%s){if(!r[C])continue;let v=i[C]<<1,S=t[v],I=t[v+1];if(Ye.positiveArea(w,x,g,p,S,I)&&Ye.positiveArea(g,p,b,y,S,I)&&Ye.positiveArea(b,y,w,x,S,I))break e}break}if(n==0){do{if(!r[c])break;c--}while(c>0);break}a=c,c=n,n=(n+1)%s}o.push(i[(s+c-1)%s]),o.push(i[c]),o.push(i[(c+1)%s]),i.splice(c,1),r.splice(c,1),s--;let l=(s+c-1)%s,h=c==s?0:c;r[l]=Ye.isConcave(l,s,t,i),r[h]=Ye.isConcave(h,s,t,i)}return s==3&&(o.push(i[2]),o.push(i[0]),o.push(i[1])),o}decompose(e,t){let s=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let a=this.polygonPool.obtain();a.length=0;let c=-1,n=0;for(let l=0,h=t.length;l<h;l+=3){let f=t[l]<<1,u=t[l+1]<<1,m=t[l+2]<<1,g=s[f],p=s[f+1],b=s[u],y=s[u+1],w=s[m],x=s[m+1],C=!1;if(c==f){let v=a.length-4,S=Ye.winding(a[v],a[v+1],a[v+2],a[v+3],w,x),I=Ye.winding(w,x,a[0],a[1],a[2],a[3]);S==n&&I==n&&(a.push(w),a.push(x),o.push(m),C=!0)}C||(a.length>0?(i.push(a),r.push(o)):(this.polygonPool.free(a),this.polygonIndicesPool.free(o)),a=this.polygonPool.obtain(),a.length=0,a.push(g),a.push(p),a.push(b),a.push(y),a.push(w),a.push(x),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(f),o.push(u),o.push(m),n=Ye.winding(g,p,b,y,w,x),c=f)}a.length>0&&(i.push(a),r.push(o));for(let l=0,h=i.length;l<h;l++){if(o=r[l],o.length==0)continue;let f=o[0],u=o[o.length-1];a=i[l];let m=a.length-4,g=a[m],p=a[m+1],b=a[m+2],y=a[m+3],w=a[0],x=a[1],C=a[2],v=a[3],S=Ye.winding(g,p,b,y,w,x);for(let I=0;I<h;I++){if(I==l)continue;let E=r[I];if(E.length!=3)continue;let F=E[0],R=E[1],L=E[2],B=i[I],T=B[B.length-2],Y=B[B.length-1];if(F!=f||R!=u)continue;let X=Ye.winding(g,p,b,y,T,Y),re=Ye.winding(T,Y,w,x,C,v);X==S&&re==S&&(B.length=0,E.length=0,a.push(T),a.push(Y),o.push(L),g=b,p=y,b=T,y=Y,I=0)}}for(let l=i.length-1;l>=0;l--)a=i[l],a.length==0&&(i.splice(l,1),this.polygonPool.free(a),o=r[l],r.splice(l,1),this.polygonIndicesPool.free(o));return i}static isConcave(e,t,s,i){let r=i[(t+e-1)%t]<<1,o=i[e]<<1,a=i[(e+1)%t]<<1;return!this.positiveArea(s[r],s[r+1],s[o],s[o+1],s[a],s[a+1])}static positiveArea(e,t,s,i,r,o){return e*(o-i)+s*(t-o)+r*(i-t)>=0}static winding(e,t,s,i,r,o){let a=s-e,c=i-t;return r*c-o*a+a*t-e*c>=0?1:-1}}class Dt{constructor(){d(this,"triangulator",new Ye);d(this,"clippingPolygon",new Array);d(this,"clipOutput",new Array);d(this,"clippedVertices",new Array);d(this,"clippedUVs",new Array);d(this,"clippedTriangles",new Array);d(this,"scratch",new Array);d(this,"clipAttachment",null);d(this,"clippingPolygons",null)}clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,i=O.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,i,0,2);let r=this.clippingPolygon;Dt.makeClockwise(r);let o=this.clippingPolygons=this.triangulator.decompose(r,this.triangulator.triangulate(r));for(let a=0,c=o.length;a<c;a++){let n=o[a];Dt.makeClockwise(n),n.push(n[0]),n.push(n[1])}return o.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,i,r,o,a,c){let n,l,h,f,u,m;typeof t=="number"?(n=s,l=i,h=r,f=o,u=a,m=c):(n=t,l=s,h=i,f=r,u=o,m=a),h&&f&&u&&typeof m=="boolean"?this.clipTrianglesRender(e,n,l,h,f,u,m):this.clipTrianglesNoRender(e,n,l)}clipTrianglesNoRender(e,t,s){let i=this.clipOutput,r=this.clippedVertices,o=this.clippedTriangles,a=this.clippingPolygons,c=a.length,n=0;r.length=0,o.length=0;for(let l=0;l<s;l+=3){let h=t[l]<<1,f=e[h],u=e[h+1];h=t[l+1]<<1;let m=e[h],g=e[h+1];h=t[l+2]<<1;let p=e[h],b=e[h+1];for(let y=0;y<c;y++){let w=r.length;if(this.clip(f,u,m,g,p,b,a[y],i)){let x=i.length;if(x==0)continue;let C=x>>1,v=this.clipOutput,S=O.setArraySize(r,w+C*2);for(let E=0;E<x;E+=2,w+=2){let F=v[E],R=v[E+1];S[w]=F,S[w+1]=R}w=o.length;
2let I=O.setArraySize(o,w+3*(C-2));C--;for(let E=1;E<C;E++,w+=3)I[w]=n,I[w+1]=n+E,I[w+2]=n+E+1;n+=C+1}else{let x=O.setArraySize(r,w+6);x[w]=f,x[w+1]=u,x[w+2]=m,x[w+3]=g,x[w+4]=p,x[w+5]=b,w=o.length;let C=O.setArraySize(o,w+3);C[w]=n,C[w+1]=n+1,C[w+2]=n+2,n+=3;break}}}}clipTrianglesRender(e,t,s,i,r,o,a){let c=this.clipOutput,n=this.clippedVertices,l=this.clippedTriangles,h=this.clippingPolygons,f=h.length,u=a?12:8,m=0;n.length=0,l.length=0;for(let g=0;g<s;g+=3){let p=t[g]<<1,b=e[p],y=e[p+1],w=i[p],x=i[p+1];p=t[g+1]<<1;let C=e[p],v=e[p+1],S=i[p],I=i[p+1];p=t[g+2]<<1;let E=e[p],F=e[p+1],R=i[p],L=i[p+1];for(let B=0;B<f;B++){let T=n.length;if(this.clip(b,y,C,v,E,F,h[B],c)){let Y=c.length;if(Y==0)continue;let X=v-F,re=E-C,ne=b-E,ee=F-y,ce=1/(X*ne+re*(y-F)),me=Y>>1,ge=this.clipOutput,D=O.setArraySize(n,T+me*u);for(let oe=0;oe<Y;oe+=2,T+=u){let Pe=ge[oe],Fe=ge[oe+1];D[T]=Pe,D[T+1]=Fe,D[T+2]=r.r,D[T+3]=r.g,D[T+4]=r.b,D[T+5]=r.a;let we=Pe-E,Ae=Fe-F,Se=(X*we+re*Ae)*ce,_e=(ee*we+ne*Ae)*ce,vt=1-Se-_e;D[T+6]=w*Se+S*_e+R*vt,D[T+7]=x*Se+I*_e+L*vt,a&&(D[T+8]=o.r,D[T+9]=o.g,D[T+10]=o.b,D[T+11]=o.a)}T=l.length;let le=O.setArraySize(l,T+3*(me-2));me--;for(let oe=1;oe<me;oe++,T+=3)le[T]=m,le[T+1]=m+oe,le[T+2]=m+oe+1;m+=me+1}else{let Y=O.setArraySize(n,T+3*u);Y[T]=b,Y[T+1]=y,Y[T+2]=r.r,Y[T+3]=r.g,Y[T+4]=r.b,Y[T+5]=r.a,a?(Y[T+6]=w,Y[T+7]=x,Y[T+8]=o.r,Y[T+9]=o.g,Y[T+10]=o.b,Y[T+11]=o.a,Y[T+12]=C,Y[T+13]=v,Y[T+14]=r.r,Y[T+15]=r.g,Y[T+16]=r.b,Y[T+1
27]=r.a,Y[T+18]=S,Y[T+19]=I,Y[T+20]=o.r,Y[T+21]=o.g,Y[T+22]=o.b,Y[T+23]=o.a,Y[T+24]=E,Y[T+25]=F,Y[T+26]=r.r,Y[T+27]=r.g,Y[T+28]=r.b,Y[T+29]=r.a,Y[T+30]=R,Y[T+31]=L,Y[T+32]=o.r,Y[T+33]=o.g,Y[T+34]=o.b,Y[T+35]=o.a):(Y[T+6]=w,Y[T+7]=x,Y[T+8]=C,Y[T+9]=v,Y[T+10]=r.r,Y[T+11]=r.g,Y[T+12]=r.b,Y[T+13]=r.a,Y[T+14]=S,Y[T+15]=I,Y[T+16]=E,Y[T+17]=F,Y[T+18]=r.r,Y[T+19]=r.g,Y[T+20]=r.b,Y[T+21]=r.a,Y[T+22]=R,Y[T+23]=L),T=l.length;let X=O.setArraySize(l,T+3);X[T]=m,X[T+1]=m+1,X[T+2]=m+2,m+=3;break}}}}clipTrianglesUnpacked(e,t,s,i){let r=this.clipOutput,o=this.clippedVertices,a=this.clippedUVs,c=this.clippedTriangles,n=this.clippingPolygons,l=n.length,h=0;o.length=0,a.length=0,c.length=0;for(let f=0;f<s;f+=3){let u=t[f]<<1,m=e[u],g=e[u+1],p=i[u],b=i[u+1];u=t[f+1]<<1;let y=e[u],w=e[u+1],x=i[u],C=i[u+1];u=t[f+2]<<1;let v=e[u],S=e[u+1],I=i[u],E=i[u+1];for(let F=0;F<l;F++){let R=o.length;if(this.clip(m,g,y,w,v,S,n[F],r)){let L=r.length;if(L==0)continue;let B=w-S,T=v-y,Y=m-v,X=S-g,re=1/(B*Y+T*(g-S)),ne=L>>1,ee=this.clipOutput,ce=O.setArraySize(o,R+ne*2),me=O.setArraySize(a,R+ne*2);for(let D=0;D<L;D+=2,R+=2){let le=ee[D],oe=ee[D+1];ce[R]=le,ce[R+1]=oe;let Pe=le-v,Fe=oe-S,we=(B*Pe+T*Fe)*re,Ae=(X*Pe+Y*Fe)*re,Se=1-we-Ae;me[R]=p*we+x*Ae+I*Se,me[R+1]=b*we+C*Ae+E*Se}R=c.length;let ge=O.setArraySize(c,R+3*(ne-2));ne--;for(let D=1;D<ne;D++,R+=3)ge[R]=h,ge[R+1]=h+D,ge[R+2]=h+D+1;h+=ne+1}else{let L=O.setArraySize(o,R+6);L[R]=m,L[R+1]=g,L[R+2]=y,L[R+3]=w,L[R+4]=v,L[R+5]=S;let B=O.setArraySize(a,R+3*2);B[R]=p,B[R+1]=b,B[R+2]=x,B[R+3]=C,B[R+4]=I,B[R+5]=E,R=c.length;let T=O.setArraySize(c,R+3);T[R]=h,T[R+1]=h+1,T[R+2]=h+2,h+=3;break}}}}clip(e,t,s,i,r,o,a,c){let n=c,l=!1,h;a.length%4>=2?(h=c,c=this.scratch):h=this.scratch,h.length=0,h.push(e),h.push(t),h.push(s),h.push(i),h.push(r),h.push(o),h.push(e),h.push(t),c.length=0;let f=a.length-4,u=a;for(let m=0;;m+=2){let g=u[m],p=u[m+1],b=g-u[m+2],y=p-u[m+3],w=c.length,x=h;for(let v=0,S=h.length-2;v<S;){let I=x[v],E=x[v+1];v+=2;let F=x[v],R=x[v+1],L=y*(g-F)>b*(p-R),B=y*(g-I)-b*(p-E);if(B>0){if(L){c.push(F),c.push(R);continue}let T=F-I,Y=R-E,X=B/(T*y-Y*b);if(X>=0&&X<=1)c.push(I+T*X),c.push(E+Y*X);else{c.push(F),c.push(R);continue}}else if(L){let T=F-I,Y=R-E,X=B/(T*y-Y*b);if(X>=0&&X<=1)c.push(I+T*X),c.push(E+Y*X),c.push(F),c.push(R);else{c.push(F),c.push(R);continue}}l=!0}if(w==c.length)return n.length=0,!0;if(c.push(c[0]),c.push(c[1]),m==f)break;let C=c;c=h,c.length=0,h=C}if(n!=c){n.length=0;for(let m=0,g=c.length-2;m<g;m++)n[m]=c[m]}else n.length=n.length-2;return l}static makeClockwise(e){let t=e,s=e.length,i=t[s-2]*t[1]-t[0]*t[s-1],r=0,o=0,a=0,c=0;for(let n=0,l=s-3;n<l;n+=2)r=t[n],o=t[n+1],a=t[n+2],c=t[n+3],i+=r*c-a*o;if(!(i<0))for(let n=0,l=s-2,h=s>>1;n<h;n+=2){let f=t[n],u=t[n+1],m=l-n;t[n]=t[m],t[n+1]=t[m+1],t[m]=f,t[m+1]=u}}}class Mr{constructor(e){d(this,"attachmentLoader");d(this,"scale",1);d(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new Ai,i=typeof e=="string"?JSON.parse(e):e,r=i.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=M(r,"referenceScale",100)*t,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),i.bones)for(let o=0;o<i.bones.length;o++){let a=i.bones[o],c=null,n=M(a,"parent",null);n&&(c=s.findBone(n));let l=new pi(s.bones.length,a.name,c);l.length=M(a,"length",0)*t,l.x=M(a,"x",0)*t,l.y=M(a,"y",0)*t,l.rotation=M(a,"rotation",0),l.scaleX=M(a,"scaleX",1),l.scaleY=M(a,"scaleY",1),l.shearX=M(a,"shearX",0),l.shearY=M(a,"shearY",0),l.inherit=O.enumValue(xe,M(a,"inherit","Normal")),l.skinRequired=M(a,"skin",!1);let h=M(a,"color",null);h&&l.color.setFromString(h),s.bones.push(l)}if(i.slots)for(let o=0;o<i.slots.length;o++){let a=i.slots[o],c=a.name,n=s.findBone(a.bone);if(!n)throw new Error(`Couldn't find bone ${a.bone} for slot ${c}`);let l=new Si(s.slots.length,c,n),h=M(a,"color",null);h&&l.color.setFromString(h);let f=M(a,"dark",null);f&&(l.darkColor=N.fromString(f)),l.attachmentName=M(a,"attachment",null),l.blendMode=O.enumValue(Et,M(a,"blend","normal")),l.visible=M(a,"visible",!0),s.slots.push(l)}if(i.ik)for(let o=0;o<i.ik.length;o++){let a=i.ik[o],c=new yi(a.name);c.order=M(a,"order",0),c.skinRequired=M(a,"skin",!1);for(let l=0;l<a.bones.length;l++){let h=s.findBone(a.bones[l]);if(!h)throw new Error(`Couldn't find bone ${a.bones[l]} for IK constraint ${a.name}.`);c.bones.push(h)}let n=s.findBone(a.target);if(!n)throw new Error(`Couldn't find target bone ${a.target} for IK constraint ${a.name}.`);c.target=n,c.mix=M(a,"mix",1),c.softness=M(a,"softness",0)*t,c.bendDirection=M(a,"bendPositive",!0)?1:-1,c.compress=M(a,"compress",!1),c.stretch=M(a,"stretch",!1),c.uniform=M(a,"uniform",!1),s.ikConstraints.push(c)}if(i.transform)for(let o=0;o<i.transform.length;
2o++){let a=i.transform[o],c=new Ii(a.name);c.order=M(a,"order",0),c.skinRequired=M(a,"skin",!1);for(let h=0;h<a.bones.length;h++){let f=a.bones[h],u=s.findBone(f);if(!u)throw new Error(`Couldn't find bone ${f} for transform constraint ${a.name}.`);c.bones.push(u)}let n=a.target,l=s.findBone(n);if(!l)throw new Error(`Couldn't find target bone ${n} for transform constraint ${a.name}.`);c.target=l,c.local=M(a,"local",!1),c.relative=M(a,"relative",!1),c.offsetRotation=M(a,"rotation",0),c.offsetX=M(a,"x",0)*t,c.offsetY=M(a,"y",0)*t,c.offsetScaleX=M(a,"scaleX",0),c.offsetScaleY=M(a,"scaleY",0),c.offsetShearY=M(a,"shearY",0),c.mixRotate=M(a,"mixRotate",1),c.mixX=M(a,"mixX",1),c.mixY=M(a,"mixY",c.mixX),c.mixScaleX=M(a,"mixScaleX",1),c.mixScaleY=M(a,"mixScaleY",c.mixScaleX),c.mixShearY=M(a,"mixShearY",1),s.transformConstraints.push(c)}if(i.path)for(let o=0;o<i.path.length;o++){let a=i.path[o],c=new vi(a.name);c.order=M(a,"order",0),c.skinRequired=M(a,"skin",!1);for(let h=0;h<a.bones.length;h++){let f=a.bones[h],u=s.findBone(f);if(!u)throw new Error(`Couldn't find bone ${f} for path constraint ${a.name}.`);c.bones.push(u)}let n=a.target,l=s.findSlot(n);if(!l)throw new Error(`Couldn't find target slot ${n} for path constraint ${a.name}.`);c.target=l,c.positionMode=O.enumValue(je,M(a,"positionMode","Percent")),c.spacingMode=O.enumValue(ve,M(a,"spacingMode","Length")),c.rotateMode=O.enumValue(rt,M(a,"rotateMode","Tangent")),c.offsetRotation=M(a,"rotation",0),c.position=M(a,"position",0),c.positionMode==je.Fixed&&(c.position*=t),c.spacing=M(a,"spacing",0),(c.spacingMode==ve.Length||c.spacingMode==ve.Fixed)&&(c.spacing*=t),c.mixRotate=M(a,"mixRotate",1),c.mixX=M(a,"mixX",1),c.mixY=M(a,"mixY",c.mixX),s.pathConstraints.push(c)}if(i.physics)for(let o=0;o<i.physics.length;o++){const a=i.physics[o],c=new Ci(a.name);c.order=M(a,"order",0),c.skinRequired=M(a,"skin",!1);const n=a.bone,l=s.findBone(n);if(l==null)throw new Error("Physics bone not found: "+n);c.bone=l,c.x=M(a,"x",0),c.y=M(a,"y",0),c.rotate=M(a,"rotate",0),c.scaleX=M(a,"scaleX",0),c.shearX=M(a,"shearX",0),c.limit=M(a,"limit",5e3)*t,c.step=1/M(a,"fps",60),c.inertia=M(a,"inertia",1),c.strength=M(a,"strength",100),c.damping=M(a,"damping",1),c.massInverse=1/M(a,"mass",1),c.wind=M(a,"wind",0),c.gravity=M(a,"gravity",0),c.mix=M(a,"mix",1),c.inertiaGlobal=M(a,"inertiaGlobal",!1),c.strengthGlobal=M(a,"strengthGlobal",!1),c.dampingGlobal=M(a,"dampingGlobal",!1),c.massGlobal=M(a,"massGlobal",!1),c.windGlobal=M(a,"windGlobal",!1),c.gravityGlobal=M(a,"gravityGlobal",!1),c.mixGlobal=M(a,"mixGlobal",!1),s.physicsConstraints.push(c)}if(i.skins)for(let o=0;o<i.skins.length;o++){let a=i.skins[o],c=new ls(a.name);if(a.bones)for(let n=0;n<a.bones.length;n++){let l=a.bones[n],h=s.findBone(l);if(!h)throw new Error(`Couldn't find bone ${l} for skin ${a.name}.`);c.bones.push(h)}if(a.ik)for(let n=0;n<a.ik.length;n++){let l=a.ik[n],h=s.findIkConstraint(l);if(!h)throw new Error(`Couldn't find IK constraint ${l} for skin ${a.name}.`);c.constraints.push(h)}if(a.transform)for(let n=0;n<a.transform.length;n++){let l=a.transform[n],h=s.findTransformConstraint(l);if(!h)throw new Error(`Couldn't find transform constraint ${l} for skin ${a.name}.`);c.constraints.push(h)}if(a.path)for(let n=0;n<a.path.length;n++){let l=a.path[n],h=s.findPathConstraint(l);if(!h)throw new Error(`Couldn't find path constraint ${l} for skin ${a.name}.`);c.constraints.push(h)}if(a.physics)for(let n=0;n<a.physics.length;n++){let l=a.physics[n],h=s.findPhysicsConstraint(l);if(!h)throw new Error(`Couldn't find physics constraint ${l} for skin ${a.name}.`);c.constraints.push(h)}for(let n in a.attachments){let l=s.findSlot(n);if(!l)throw new Error(`Couldn't find slot ${n} for skin ${a.name}.`);let h=a.attachments[n];for(let f in h){let u=this.readAttachment(h[f],c,l.index,f,s);u&&c.setAttachment(l.index,f,u)}}s.skins.push(c),c.name=="default"&&(s.defaultSkin=c)}for(let o=0,a=this.linkedMeshes.length;o<a;o++){let c=this.linkedMeshes[o],n=c.skin?s.findSkin(c.skin):s.defaultSkin;if(!n)throw new Error(`Skin not found: ${c.skin}`);let l=n.getAttachment(c.slotIndex,c.parent);if(!l)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?l:c.mesh,c.mesh.setParentMesh(l),c.mesh.region!=null&&c.mesh.updateRegion()}if(this.linkedMeshes.length=0,i.events)for(let o in i.events){let a=i.events[o],c=new bi(o);c.intValue=M(a,"int",0),c.floatValue=M(a,"float",0),c.stringValue=M(a,"string",""),c.audioPath=M(a,"audio",null),c.audioPath&&(c.volume=M(a,"volume",1),c.balance=M(a,"balance",0)),s.events.push(c)}if(i.animations)for(let o in i.animations){let a=i.animations[o];this.readAnimation(a,o,s)}return s}readAttachment(e,t,s,i,r){let o=this.scale;switch(i=M(e,"name",i),M(e,"type","region")){case"region":{let a=M(e,"path",i),c=this.readSequence(M(e,"sequence",null)),n=this.attachmentLoader.newRegionAttachment(t,i,a,c);if(!n)return null;n.path=a,n.x=M(e,"x",0)*o,n.y=M(e,"y",0)*o,n.scaleX=M(e,"scaleX",1),n.scaleY=M(e,"scaleY",1),n.rotation=M(e,"rotation",0),n.width=e.width*o,n.height=e.height*o,n.sequence=c;let l=M(e,"color",null);return l&&n.color.setFromString(l),n.region!=null&&n.updateRegion(),n}
2case"boundingbox":{let a=this.attachmentLoader.newBoundingBoxAttachment(t,i);if(!a)return null;this.readVertices(e,a,e.vertexCount<<1);let c=M(e,"color",null);return c&&a.color.setFromString(c),a}case"mesh":case"linkedmesh":{let a=M(e,"path",i),c=this.readSequence(M(e,"sequence",null)),n=this.attachmentLoader.newMeshAttachment(t,i,a,c);if(!n)return null;n.path=a;let l=M(e,"color",null);l&&n.color.setFromString(l),n.width=M(e,"width",0)*o,n.height=M(e,"height",0)*o,n.sequence=c;let h=M(e,"parent",null);if(h)return this.linkedMeshes.push(new Fr(n,M(e,"skin",null),s,h,M(e,"timelines",!0))),n;let f=e.uvs;return this.readVertices(e,n,f.length),n.triangles=e.triangles,n.regionUVs=f,n.region!=null&&n.updateRegion(),n.edges=M(e,"edges",null),n.hullLength=M(e,"hull",0)*2,n}case"path":{let a=this.attachmentLoader.newPathAttachment(t,i);if(!a)return null;a.closed=M(e,"closed",!1),a.constantSpeed=M(e,"constantSpeed",!0);let c=e.vertexCount;this.readVertices(e,a,c<<1);let n=O.newArray(c/3,0);for(let h=0;h<e.lengths.length;h++)n[h]=e.lengths[h]*o;a.lengths=n;let l=M(e,"color",null);return l&&a.color.setFromString(l),a}case"point":{let a=this.attachmentLoader.newPointAttachment(t,i);if(!a)return null;a.x=M(e,"x",0)*o,a.y=M(e,"y",0)*o,a.rotation=M(e,"rotation",0);let c=M(e,"color",null);return c&&a.color.setFromString(c),a}case"clipping":{let a=this.attachmentLoader.newClippingAttachment(t,i);if(!a)return null;let c=M(e,"end",null);c&&(a.endSlot=r.findSlot(c));let n=e.vertexCount;this.readVertices(e,a,n<<1);let l=M(e,"color",null);return l&&a.color.setFromString(l),a}}return null}readSequence(e){if(e==null)return null;let t=new Pt(M(e,"count",0));return t.start=M(e,"start",1),t.digits=M(e,"digits",0),t.setupIndex=M(e,"setup",0),t}readVertices(e,t,s){let i=this.scale;t.worldVerticesLength=s;let r=e.vertices;if(s==r.length){let c=O.toFloatArray(r);if(i!=1)for(let n=0,l=r.length;n<l;n++)c[n]*=i;t.vertices=c;return}let o=new Array,a=new Array;for(let c=0,n=r.length;c<n;){let l=r[c++];a.push(l);for(let h=c+l*4;c<h;c+=4)a.push(r[c]),o.push(r[c+1]*i),o.push(r[c+2]*i),o.push(r[c+3])}t.bones=a,t.vertices=O.toFloatArray(o)}readAnimation(e,t,s){let i=this.scale,r=new Array;if(e.slots)for(let a in e.slots){let c=e.slots[a],n=s.findSlot(a);if(!n)throw new Error("Slot not found: "+a);let l=n.index;for(let h in c){let f=c[h];if(!f)continue;let u=f.length;if(h=="attachment"){let m=new ct(u,l);for(let g=0;g<u;g++){let p=f[g];m.setFrame(g,M(p,"time",0),M(p,"name",null))}r.push(m)}else if(h=="rgba"){let m=new Js(u,u<<2,l),g=f[0],p=M(g,"time",0),b=N.fromString(g.color);for(let y=0,w=0;;y++){m.setFrame(y,p,b.r,b.g,b.b,b.a);let x=f[y+1];if(!x){m.shrink(w);break}let C=M(x,"time",0),v=N.fromString(x.color),S=g.curve;S&&(w=fe(S,m,w,y,0,p,C,b.r,v.r,1),w=fe(S,m,w,y,1,p,C,b.g,v.g,1),w=fe(S,m,w,y,2,p,C,b.b,v.b,1),w=fe(S,m,w,y,3,p,C,b.a,v.a,1)),p=C,b=v,g=x}r.push(m)}else if(h=="rgb"){let m=new Qs(u,u*3,l),g=f[0],p=M(g,"time",0),b=N.fromString(g.color);for(let y=0,w=0;;y++){m.setFrame(y,p,b.r,b.g,b.b);let x=f[y+1];if(!x){m.shrink(w);break}let C=M(x,"time",0),v=N.fromString(x.color),S=g.curve;S&&(w=fe(S,m,w,y,0,p,C,b.r,v.r,1),w=fe(S,m,w,y,1,p,C,b.g,v.g,1),w=fe(S,m,w,y,2,p,C,b.b,v.b,1)),p=C,b=v,g=x}r.push(m)}else if(h=="alpha")r.push(Ne(f,new _s(u,u,l),0,1));else if(h=="rgba2"){let m=new $s(u,u*7,l),g=f[0],p=M(g,"time",0),b=N.fromString(g.light),y=N.fromString(g.dark);for(let w=0,x=0;;w++){m.setFrame(w,p,b.r,b.g,b.b,b.a,y.r,y.g,y.b);let C=f[w+1];if(!C){m.shrink(x);break}let v=M(C,"time",0),S=N.fromString(C.light),I=N.fromString(C.dark),E=g.curve;E&&(x=fe(E,m,x,w,0,p,v,b.r,S.r,1),x=fe(E,m,x,w,1,p,v,b.g,S.g,1),x=fe(E,m,x,w,2,p,v,b.b,S.b,1),x=fe(E,m,x,w,3,p,v,b.a,S.a,1),x=fe(E,m,x,w,4,p,v,y.r,I.r,1),x=fe(E,m,x,w,5,p,v,y.g,I.g,1),x=fe(E,m,x,w,6,p,v,y.b,I.b,1)),p=v,b=S,y=I,g=C}r.push(m)}else if(h=="rgb2"){let m=new ei(u,u*6,l),g=f[0],p=M(g,"time",0),b=N.fromString(g.light),y=N.fromString(g.dark);for(let w=0,x=0;;w++){m.setFrame(w,p,b.r,b.g,b.b,y.r,y.g,y.b);let C=f[w+1];if(!C){m.shrink(x);break}let v=M(C,"time",0),S=N.fromString(C.light),I=N.fromString(C.dark),E=g.curve;E&&(x=fe(E,m,x,w,0,p,v,b.r,S.r,1),x=fe(E,m,x,w,1,p,v,b.g,S.g,1),x=fe(E,m,x,w,2,p,v,b.b,S.b,1),x=fe(E,m,x,w,3,p,v,y.r,I.r,1),x=fe(E,m,x,w,4,p,v,y.g,I.g,1),x=fe(E,m,x,w,5,p,v,y.b,I.b,1)),p=v,b=S,y=I,g=C}r.push(m)}}}
2if(e.bones)for(let a in e.bones){let c=e.bones[a],n=s.findBone(a);if(!n)throw new Error("Bone not found: "+a);let l=n.index;for(let h in c){let f=c[h],u=f.length;if(u!=0){if(h==="rotate")r.push(Ne(f,new Vt(u,u,l),0,1));else if(h==="translate"){let m=new Ds(u,u<<1,l);r.push(ss(f,m,"x","y",0,i))}else if(h==="translatex"){let m=new Us(u,u,l);r.push(Ne(f,m,0,i))}else if(h==="translatey"){let m=new zs(u,u,l);r.push(Ne(f,m,0,i))}else if(h==="scale"){let m=new Ws(u,u<<1,l);r.push(ss(f,m,"x","y",1,1))}else if(h==="scalex"){let m=new qs(u,u,l);r.push(Ne(f,m,1,1))}else if(h==="scaley"){let m=new Gs(u,u,l);r.push(Ne(f,m,1,1))}else if(h==="shear"){let m=new Hs(u,u<<1,l);r.push(ss(f,m,"x","y",0,1))}else if(h==="shearx"){let m=new js(u,u,l);r.push(Ne(f,m,0,1))}else if(h==="sheary"){let m=new Zs(u,u,l);r.push(Ne(f,m,0,1))}else if(h==="inherit"){let m=new Ks(u,n.index);for(let g=0;g<f.length;g++){let p=f[g];m.setFrame(g,M(p,"time",0),O.enumValue(xe,M(p,"inherit","Normal")))}r.push(m)}}}}if(e.ik)for(let a in e.ik){let c=e.ik[a],n=c[0];if(!n)continue;let l=s.findIkConstraint(a);if(!l)throw new Error("IK Constraint not found: "+a);let h=s.ikConstraints.indexOf(l),f=new si(c.length,c.length<<1,h),u=M(n,"time",0),m=M(n,"mix",1),g=M(n,"softness",0)*i;for(let p=0,b=0;;p++){f.setFrame(p,u,m,g,M(n,"bendPositive",!0)?1:-1,M(n,"compress",!1),M(n,"stretch",!1));let y=c[p+1];if(!y){f.shrink(b);break}let w=M(y,"time",0),x=M(y,"mix",1),C=M(y,"softness",0)*i,v=n.curve;v&&(b=fe(v,f,b,p,0,u,w,m,x,1),b=fe(v,f,b,p,1,u,w,g,C,i)),u=w,m=x,g=C,n=y}r.push(f)}if(e.transform)for(let a in e.transform){let c=e.transform[a],n=c[0];if(!n)continue;let l=s.findTransformConstraint(a);if(!l)throw new Error("Transform constraint not found: "+a);let h=s.transformConstraints.indexOf(l),f=new ii(c.length,c.length*6,h),u=M(n,"time",0),m=M(n,"mixRotate",1),g=M(n,"mixX",1),p=M(n,"mixY",g),b=M(n,"mixScaleX",1),y=M(n,"mixScaleY",b),w=M(n,"mixShearY",1);for(let x=0,C=0;;x++){f.setFrame(x,u,m,g,p,b,y,w);let v=c[x+1];if(!v){f.shrink(C);break}let S=M(v,"time",0),I=M(v,"mixRotate",1),E=M(v,"mixX",1),F=M(v,"mixY",E),R=M(v,"mixScaleX",1),L=M(v,"mixScaleY",R),B=M(v,"mixShearY",1),T=n.curve;T&&(C=fe(T,f,C,x,0,u,S,m,I,1),C=fe(T,f,C,x,1,u,S,g,E,1),C=fe(T,f,C,x,2,u,S,p,F,1),C=fe(T,f,C,x,3,u,S,b,R,1),C=fe(T,f,C,x,4,u,S,y,L,1),C=fe(T,f,C,x,5,u,S,w,B,1)),u=S,m=I,g=E,p=F,b=R,y=L,b=R,n=v}r.push(f)}if(e.path)for(let a in e.path){let c=e.path[a],n=s.findPathConstraint(a);if(!n)throw new Error("Path constraint not found: "+a);let l=s.pathConstraints.indexOf(n);for(let h in c){let f=c[h],u=f[0];if(!u)continue;let m=f.length;if(h==="position"){let g=new ri(m,m,l);r.push(Ne(f,g,0,n.positionMode==je.Fixed?i:1))}else if(h==="spacing"){let g=new ni(m,m,l);r.push(Ne(f,g,0,n.spacingMode==ve.Length||n.spacingMode==ve.Fixed?i:1))}else if(h==="mix"){let g=new ai(m,m*3,l),p=M(u,"time",0),b=M(u,"mixRotate",1),y=M(u,"mixX",1),w=M(u,"mixY",y);for(let x=0,C=0;;x++){g.setFrame(x,p,b,y,w);let v=f[x+1];if(!v){g.shrink(C);break}let S=M(v,"time",0),I=M(v,"mixRotate",1),E=M(v,"mixX",1),F=M(v,"mixY",E),R=u.curve;R&&(C=fe(R,g,C,x,0,p,S,b,I,1),C=fe(R,g,C,x,1,p,S,y,E,1),C=fe(R,g,C,x,2,p,S,w,F,1)),p=S,b=I,y=E,w=F,u=v}r.push(g)}}}if(e.physics)for(let a in e.physics){let c=e.physics[a],n=-1;if(a.length>0){let l=s.findPhysicsConstraint(a);if(!l)throw new Error("Physics constraint not found: "+a);n=s.physicsConstraints.indexOf(l)}for(let l in c){let h=c[l],f=h[0];if(!f)continue;let u=h.length;if(l=="reset"){const g=new Ot(u,n);for(let p=0;f!=null;f=h[p+1],p++)g.setFrame(p,M(f,"time",0));r.push(g);continue}let m;if(l=="inertia")m=new li(u,u,n);else if(l=="strength")m=new oi(u,u,n);else if(l=="damping")m=new hi(u,u,n);else if(l=="mass")m=new ci(u,u,n);else if(l=="wind")m=new di(u,u,n);else if(l=="gravity")m=new ui(u,u,n);
2else if(l=="mix")m=new fi(u,u,n);else continue;r.push(Ne(h,m,0,1))}}if(e.attachments)for(let a in e.attachments){let c=e.attachments[a],n=s.findSkin(a);if(!n)throw new Error("Skin not found: "+a);for(let l in c){let h=c[l],f=s.findSlot(l);if(!f)throw new Error("Slot not found: "+l);let u=f.index;for(let m in h){let g=h[m],p=n.getAttachment(u,m);for(let b in g){let y=g[b],w=y[0];if(w){if(b=="deform"){let x=p.bones,C=p.vertices,v=x?C.length/3*2:C.length,S=new ti(y.length,y.length,u,p),I=M(w,"time",0);for(let E=0,F=0;;E++){let R,L=M(w,"vertices",null);if(!L)R=x?O.newFloatArray(v):C;else{R=O.newFloatArray(v);let X=M(w,"offset",0);if(O.arrayCopy(L,0,R,X,L.length),i!=1)for(let re=X,ne=re+L.length;re<ne;re++)R[re]*=i;if(!x)for(let re=0;re<v;re++)R[re]+=C[re]}S.setFrame(E,I,R);let B=y[E+1];if(!B){S.shrink(F);break}let T=M(B,"time",0),Y=w.curve;Y&&(F=fe(Y,S,F,E,0,I,T,0,1,1)),I=T,w=B}r.push(S)}else if(b=="sequence"){let x=new Nt(y.length,u,p),C=0;for(let v=0;v<y.length;v++){let S=M(w,"delay",C),I=M(w,"time",0),E=Ce[M(w,"mode","hold")],F=M(w,"index",0);
2x.setFrame(v,I,E,F,S),C=S,w=y[v+1]}r.push(x)}}}}}}if(e.drawOrder){let a=new it(e.drawOrder.length),c=s.slots.length,n=0;for(let l=0;l<e.drawOrder.length;l++,n++){let h=e.drawOrder[l],f=null,u=M(h,"offsets",null);if(u){f=O.newArray(c,-1);let m=O.newArray(c-u.length,0),g=0,p=0;for(let b=0;b<u.length;b++){let y=u[b],w=s.findSlot(y.slot);if(!w)throw new Error("Slot not found: "+w);let x=w.index;for(;g!=x;)m[p++]=g++;f[g+y.offset]=g++}for(;g<c;)m[p++]=g++;for(let b=c-1;b>=0;b--)f[b]==-1&&(f[b]=m[--p])}a.setFrame(n,M(h,"time",0),f)}r.push(a)}if(e.events){let a=new St(e.events.length),c=0;for(let n=0;n<e.events.length;n++,c++){let l=e.events[n],h=s.findEvent(l.name);if(!h)throw new Error("Event not found: "+l.name);let f=new wi(O.toSinglePrecision(M(l,"time",0)),h);f.intValue=M(l,"int",h.intValue),f.floatValue=M(l,"float",h.floatValue),f.stringValue=M(l,"string",h.stringValue),f.data.audioPath&&(f.volume=M(l,"volume",1),f.balance=M(l,"balance",0)),a.setFrame(c,f)}r.push(a)}let o=0;for(let a=0,c=r.length;a<c;a++)o=Math.max(o,r[a].getDuration());s.animations.push(new fs(t,r,o))}}class Fr{constructor(e,t,s,i,r){d(this,"parent");d(this,"skin");d(this,"slotIndex");d(this,"mesh");d(this,"inheritTimeline");this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=i,this.inheritTimeline=r}}function Ne(A,e,t,s){let i=A[0],r=M(i,"time",0),o=M(i,"value",t)*s,a=0;for(let c=0;;c++){e.setFrame(c,r,o);let n=A[c+1];if(!n)return e.shrink(a),e;let l=M(n,"time",0),h=M(n,"value",t)*s;i.curve&&(a=fe(i.curve,e,a,c,0,r,l,o,h,s)),r=l,o=h,i=n}}function ss(A,e,t,s,i,r){let o=A[0],a=M(o,"time",0),c=M(o,t,i)*r,n=M(o,s,i)*r,l=0;for(let h=0;;h++){e.setFrame(h,a,c,n);let f=A[h+1];if(!f)return e.shrink(l),e;let u=M(f,"time",0),m=M(f,t,i)*r,g=M(f,s,i)*r,p=o.curve;p&&(l=fe(p,e,l,h,0,a,u,c,m,r),l=fe(p,e,l,h,1,a,u,n,g,r)),a=u,c=m,n=g,o=f}}function fe(A,e,t,s,i,r,o,a,c,n){if(A=="stepped")return e.setStepped(s),t;let l=i<<2,h=A[l],f=A[l+1]*n,u=A[l+2],m=A[l+3]*n;return e.setBezier(t,s,i,r,a,h,f,u,m,o,c),t+1}function M(A,e,t){return A[e]!==void 0?A[e]:t}typeof Math.fround>"u"&&(Math.fround=function(A){return function(e){return A[0]=e,A[0]}}(new Float32Array(1)));class Te{constructor(e,t={alpha:"true"}){d(this,"canvas");d(this,"gl");d(this,"restorables",new Array);if(e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext)this.gl=e,this.canvas=this.gl.canvas;else{let s=e;this.gl=s.getContext("webgl2",t)||s.getContext("webgl",t),this.canvas=s,s.addEventListener("webglcontextlost",i=>{i&&i.preventDefault()}),s.addEventListener("webglcontextrestored",i=>{for(let r=0,o=this.restorables.length;r<o;r++)this.restorables[r].restore()})}}addRestorable(e){this.restorables.push(e)}removeRestorable(e){let t=this.restorables.indexOf(e);t>-1&&this.restorables.splice(t,1)}}const gt=class gt extends mi{constructor(t,s,i=!1){super(s);d(this,"context");d(this,"texture",null);d(this,"boundUnit",0);d(this,"useMipMaps",!1);this.context=t instanceof Te?t:new Te(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,gt.validateMagFilter(s)),this.useMipMaps=gt.usesMipMaps(t),this.useMipMaps&&i.generateMipmap(i.TEXTURE_2D)}static validateMagFilter(t){switch(t){case be.MipMapLinearLinear:case be.MipMapLinearNearest:case be.MipMapNearestLinear:case be.MipMapNearestNearest:return be.Linear;default:return t}}static usesMipMaps(t){switch(t){case be.MipMapLinearLinear:case be.MipMapLinearNearest:case be.MipMapNearestLinear:case be.MipMapNearestNearest: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(),gt.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)}};d(gt,"DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL",!1);let kt=gt;class Ei extends Wi{constructor(e,t="",s=new xi){super(i=>new kt(e,i),t,s)}}class Be{constructor(e=0,t=0,s=0){d(this,"x",0);d(this,"y",0);d(this,"z",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}
2sub(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[U]+this.y*t[j]+this.z*t[Z]+t[z],this.x*t[K]+this.y*t[W]+this.z*t[J]+t[q],this.x*t[Q]+this.y*t[_]+this.z*t[G]+t[H])}project(e){let t=e.values,s=1/(this.x*t[te]+this.y*t[se]+this.z*t[ie]+t[$]);return this.set((this.x*t[U]+this.y*t[j]+this.z*t[Z]+t[z])*s,(this.x*t[K]+this.y*t[W]+this.z*t[J]+t[q])*s,(this.x*t[Q]+this.y*t[_]+this.z*t[G]+t[H])*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)}}const U=0,j=4,Z=8,z=12,K=1,W=5,J=9,q=13,Q=2,_=6,G=10,H=14,te=3,se=7,ie=11,$=15,Ee=class Ee{constructor(){d(this,"temp",new Float32Array(16));d(this,"values",new Float32Array(16));let e=this.values;e[U]=1,e[W]=1,e[G]=1,e[$]=1}set(e){return this.values.set(e),this}transpose(){let e=this.temp,t=this.values;return e[U]=t[U],e[j]=t[K],e[Z]=t[Q],e[z]=t[te],e[K]=t[j],e[W]=t[W],e[J]=t[_],e[q]=t[se],e[Q]=t[Z],e[_]=t[J],e[G]=t[G],e[H]=t[ie],e[te]=t[z],e[se]=t[q],e[ie]=t[H],e[$]=t[$],this.set(e)}identity(){let e=this.values;return e[U]=1,e[j]=0,e[Z]=0,e[z]=0,e[K]=0,e[W]=1,e[J]=0,e[q]=0,e[Q]=0,e[_]=0,e[G]=1,e[H]=0,e[te]=0,e[se]=0,e[ie]=0,e[$]=1,this}invert(){let e=this.values,t=this.temp,s=e[te]*e[_]*e[J]*e[z]-e[Q]*e[se]*e[J]*e[z]-e[te]*e[W]*e[G]*e[z]+e[K]*e[se]*e[G]*e[z]+e[Q]*e[W]*e[ie]*e[z]-e[K]*e[_]*e[ie]*e[z]-e[te]*e[_]*e[Z]*e[q]+e[Q]*e[se]*e[Z]*e[q]+e[te]*e[j]*e[G]*e[q]-e[U]*e[se]*e[G]*e[q]-e[Q]*e[j]*e[ie]*e[q]+e[U]*e[_]*e[ie]*e[q]+e[te]*e[W]*e[Z]*e[H]-e[K]*e[se]*e[Z]*e[H]-e[te]*e[j]*e[J]*e[H]+e[U]*e[se]*e[J]*e[H]+e[K]*e[j]*e[ie]*e[H]-e[U]*e[W]*e[ie]*e[H]-e[Q]*e[W]*e[Z]*e[$]+e[K]*e[_]*e[Z]*e[$]+e[Q]*e[j]*e[J]*e[$]-e[U]*e[_]*e[J]*e[$]-e[K]*e[j]*e[G]*e[$]+e[U]*e[W]*e[G]*e[$];if(s==0)throw new Error("non-invertible matrix");let i=1/s;return t[U]=e[J]*e[H]*e[se]-e[q]*e[G]*e[se]+e[q]*e[_]*e[ie]-e[W]*e[H]*e[ie]-e[J]*e[_]*e[$]+e[W]*e[G]*e[$],t[j]=e[z]*e[G]*e[se]-e[Z]*e[H]*e[se]-e[z]*e[_]*e[ie]+e[j]*e[H]*e[ie]+e[Z]*e[_]*e[$]-e[j]*e[G]*e[$],t[Z]=e[Z]*e[q]*e[se]-e[z]*e[J]*e[se]+e[z]*e[W]*e[ie]-e[j]*e[q]*e[ie]-e[Z]*e[W]*e[$]+e[j]*e[J]*e[$],t[z]=e[z]*e[J]*e[_]-e[Z]*e[q]*e[_]-e[z]*e[W]*e[G]+e[j]*e[q]*e[G]+e[Z]*e[W]*e[H]-e[j]*e[J]*e[H],t[K]=e[q]*e[G]*e[te]-e[J]*e[H]*e[te]-e[q]*e[Q]*e[ie]+e[K]*e[H]*e[ie]+e[J]*e[Q]*e[$]-e[K]*e[G]*e[$],t[W]=e[Z]*e[H]*e[te]-e[z]*e[G]*e[te]+e[z]*e[Q]*e[ie]-e[U]*e[H]*e[ie]-e[Z]*e[Q]*e[$]+e[U]*e[G]*e[$],t[J]=e[z]*e[J]*e[te]-e[Z]*e[q]*e[te]-e[z]*e[K]*e[ie]+e[U]*e[q]*e[ie]+e[Z]*e[K]*e[$]-e[U]*e[J]*e[$],t[q]=e[Z]*e[q]*e[Q]-e[z]*e[J]*e[Q]+e[z]*e[K]*e[G]-e[U]*e[q]*e[G]-e[Z]*e[K]*e[H]+e[U]*e[J]*e[H],t[Q]=e[W]*e[H]*e[te]-e[q]*e[_]*e[te]+e[q]*e[Q]*e[se]-e[K]*e[H]*e[se]-e[W]*e[Q]*e[$]+e[K]*e[_]*e[$],t[_]=e[z]*e[_]*e[te]-e[j]*e[H]*e[te]-e[z]*e[Q]*e[se]+e[U]*e[H]*e[se]+e[j]*e[Q]*e[$]-e[U]*e[_]*e[$],t[G]=e[j]*e[q]*e[te]-e[z]*e[W]*e[te]+e[z]*e[K]*e[se]-e[U]*e[q]*e[se]-e[j]*e[K]*e[$]+e[U]*e[W]*e[$],t[H]=e[z]*e[W]*e[Q]-e[j]*e[q]*e[Q]-e[z]*e[K]*e[_]+e[U]*e[q]*e[_]+e[j]*e[K]*e[H]-e[U]*e[W]*e[H],t[te]=e[J]*e[_]*e[te]-e[W]*e[G]*e[te]-e[J]*e[Q]*e[se]+e[K]*e[G]*e[se]+e[W]*e[Q]*e[ie]-e[K]*e[_]*e[ie],t[se]=e[j]*e[G]*e[te]-e[Z]*e[_]*e[te]+e[Z]*e[Q]*e[se]-e[U]*e[G]*e[se]-e[j]*e[Q]*e[ie]+e[U]*e[_]*e[ie],t[ie]=e[Z]*e[W]*e[te]-e[j]*e[J]*e[te]-e[Z]*e[K]*e[se]+e[U]*e[J]*e[se]+e[j]*e[K]*e[ie]-e[U]*e[W]*e[ie],t[$]=e[j]*e[J]*e[Q]-e[Z]*e[W]*e[Q]+e[Z]*e[K]*e[_]-e[U]*e[J]*e[_]-e[j]*e[K]*e[G]+e[U]*e[W]*e[G],e[U]=t[U]*i,e[j]=t[j]*i,e[Z]=t[Z]*i,e[z]=t[z]*i,e[K]=t[K]*i,e[W]=t[W]*i,e[J]=t[J]*i,e[q]=t[q]*i,e[Q]=t[Q]*i,e[_]=t[_]*i,e[G]=t[G]*i,e[H]=t[H]*i,e[te]=t[te]*i,e[se]=t[se]*i,e[ie]=t[ie]*i,e[$]=t[$]*i,this}determinant(){let e=this.values;return e[te]*e[_]*e[J]*e[z]-e[Q]*e[se]*e[J]*e[z]-e[te]*e[W]*e[G]*e[z]+e[K]*e[se]*e[G]*e[z]+e[Q]*e[W]*e[ie]*e[z]-e[K]*e[_]*e[ie]*e[z]-e[te]*e[_]*e[Z]*e[q]+e[Q]*e[se]*e[Z]*e[q]+e[te]*e[j]*e[G]*e[q]-e[U]*e[se]*e[G]*e[q]-e[Q]*e[j]*e[ie]*e[q]+e[U]*e[_]*e[ie]*e[q]+e[te]*e[W]*e[Z]*e[H]-e[K]*e[se]*e[Z]*e[H]-e[te]*e[j]*e[J]*e[H]+e[U]*e[se]*e[J]*e[H]+e[K]*e[j]*e[ie]*e[H]-e[U]*e[W]*e[ie]*e[H]-e[Q]*e[W]*e[Z]*e[$]+e[K]*e[_]*e[Z]*e[$]+e[Q]*e[j]*e[J]*e[$]-e[U]*e[_]*e[J]*e[$]-e[K]*e[j]*e[G]*e[$]+e[U]*e[W]*e[G]*e[$]}
2translate(e,t,s){let i=this.values;return i[z]+=e,i[q]+=t,i[H]+=s,this}copy(){return new Ee().set(this.values)}projection(e,t,s,i){this.identity();let r=1/Math.tan(s*(Math.PI/180)/2),o=(t+e)/(e-t),a=2*t*e/(e-t),c=this.values;return c[U]=r/i,c[K]=0,c[Q]=0,c[te]=0,c[j]=0,c[W]=r,c[_]=0,c[se]=0,c[Z]=0,c[J]=0,c[G]=o,c[ie]=-1,c[z]=0,c[q]=0,c[H]=a,c[$]=0,this}ortho2d(e,t,s,i){return this.ortho(e,e+s,t,t+i,0,1)}ortho(e,t,s,i,r,o){this.identity();let a=2/(t-e),c=2/(i-s),n=-2/(o-r),l=-(t+e)/(t-e),h=-(i+s)/(i-s),f=-(o+r)/(o-r),u=this.values;return u[U]=a,u[K]=0,u[Q]=0,u[te]=0,u[j]=0,u[W]=c,u[_]=0,u[se]=0,u[Z]=0,u[J]=0,u[G]=n,u[ie]=0,u[z]=l,u[q]=h,u[H]=f,u[$]=1,this}multiply(e){let t=this.temp,s=this.values,i=e.values;return t[U]=s[U]*i[U]+s[j]*i[K]+s[Z]*i[Q]+s[z]*i[te],t[j]=s[U]*i[j]+s[j]*i[W]+s[Z]*i[_]+s[z]*i[se],t[Z]=s[U]*i[Z]+s[j]*i[J]+s[Z]*i[G]+s[z]*i[ie],t[z]=s[U]*i[z]+s[j]*i[q]+s[Z]*i[H]+s[z]*i[$],t[K]=s[K]*i[U]+s[W]*i[K]+s[J]*i[Q]+s[q]*i[te],t[W]=s[K]*i[j]+s[W]*i[W]+s[J]*i[_]+s[q]*i[se],t[J]=s[K]*i[Z]+s[W]*i[J]+s[J]*i[G]+s[q]*i[ie],t[q]=s[K]*i[z]+s[W]*i[q]+s[J]*i[H]+s[q]*i[$],t[Q]=s[Q]*i[U]+s[_]*i[K]+s[G]*i[Q]+s[H]*i[te],t[_]=s[Q]*i[j]+s[_]*i[W]+s[G]*i[_]+s[H]*i[se],t[G]=s[Q]*i[Z]+s[_]*i[J]+s[G]*i[G]+s[H]*i[ie],t[H]=s[Q]*i[z]+s[_]*i[q]+s[G]*i[H]+s[H]*i[$],t[te]=s[te]*i[U]+s[se]*i[K]+s[ie]*i[Q]+s[$]*i[te],t[se]=s[te]*i[j]+s[se]*i[W]+s[ie]*i[_]+s[$]*i[se],t[ie]=s[te]*i[Z]+s[se]*i[J]+s[ie]*i[G]+s[$]*i[ie],t[$]=s[te]*i[z]+s[se]*i[q]+s[ie]*i[H]+s[$]*i[$],this.set(this.temp)}multiplyLeft(e){let t=this.temp,s=this.values,i=e.values;return t[U]=i[U]*s[U]+i[j]*s[K]+i[Z]*s[Q]+i[z]*s[te],t[j]=i[U]*s[j]+i[j]*s[W]+i[Z]*s[_]+i[z]*s[se],t[Z]=i[U]*s[Z]+i[j]*s[J]+i[Z]*s[G]+i[z]*s[ie],t[z]=i[U]*s[z]+i[j]*s[q]+i[Z]*s[H]+i[z]*s[$],t[K]=i[K]*s[U]+i[W]*s[K]+i[J]*s[Q]+i[q]*s[te],t[W]=i[K]*s[j]+i[W]*s[W]+i[J]*s[_]+i[q]*s[se],t[J]=i[K]*s[Z]+i[W]*s[J]+i[J]*s[G]+i[q]*s[ie],t[q]=i[K]*s[z]+i[W]*s[q]+i[J]*s[H]+i[q]*s[$],t[Q]=i[Q]*s[U]+i[_]*s[K]+i[G]*s[Q]+i[H]*s[te],t[_]=i[Q]*s[j]+i[_]*s[W]+i[G]*s[_]+i[H]*s[se],t[G]=i[Q]*s[Z]+i[_]*s[J]+i[G]*s[G]+i[H]*s[ie],t[H]=i[Q]*s[z]+i[_]*s[q]+i[G]*s[H]+i[H]*s[$],t[te]=i[te]*s[U]+i[se]*s[K]+i[ie]*s[Q]+i[$]*s[te],t[se]=i[te]*s[j]+i[se]*s[W]+i[ie]*s[_]+i[$]*s[se],t[ie]=i[te]*s[Z]+i[se]*s[J]+i[ie]*s[G]+i[$]*s[ie],t[$]=i[te]*s[z]+i[se]*s[q]+i[ie]*s[H]+i[$]*s[$],this.set(this.temp)}lookAt(e,t,s){let i=Ee.xAxis,r=Ee.yAxis,o=Ee.zAxis;o.setFrom(t).normalize(),i.setFrom(t).normalize(),i.cross(s).normalize(),r.setFrom(i).cross(o).normalize(),this.identity();let a=this.values;return a[U]=i.x,a[j]=i.y,a[Z]=i.z,a[K]=r.x,a[W]=r.y,a[J]=r.z,a[Q]=-o.x,a[_]=-o.y,a[G]=-o.z,Ee.tmpMatrix.identity(),Ee.tmpMatrix.values[z]=-e.x,Ee.tmpMatrix.values[q]=-e.y,Ee.tmpMatrix.values[H]=-e.z,this.multiply(Ee.tmpMatrix),this}};d(Ee,"xAxis",new Be),d(Ee,"yAxis",new Be),d(Ee,"zAxis",new Be),d(Ee,"tmpMatrix",new Ee);let dt=Ee;class Rr{constructor(e,t){d(this,"position",new Be(0,0,0));d(this,"direction",new Be(0,0,-1));d(this,"up",new Be(0,1,0));d(this,"near",0);d(this,"far",100);d(this,"zoom",1);d(this,"viewportWidth",0);d(this,"viewportHeight",0);d(this,"projectionView",new dt);d(this,"inverseProjectionView",new dt);d(this,"projection",new dt);d(this,"view",new dt);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,o=this.viewportWidth,a=this.viewportHeight;e.ortho(r*(-o/2),r*(o/2),r*(-a/2),r*(a/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}}class Jt{constructor(e){d(this,"element");d(this,"mouseX",0);d(this,"mouseY",0);d(this,"buttonDown",!1);d(this,"touch0",null);d(this,"touch1",null);d(this,"initialPinchDistance",0);d(this,"listeners",new Array);d(this,"eventListeners",[]);this.element=e,this.setupCallbacks(e)}setupCallbacks(e){let t=a=>{if(a instanceof MouseEvent){let c=e.getBoundingClientRect();this.mouseX=a.clientX-c.left,this.mouseY=a.clientY-c.top,this.buttonDown=!0,this.listeners.map(n=>{n.down&&n.down(this.mouseX,this.mouseY)}),document.addEventListener("mousemove",s),document.addEventListener("mouseup",i)}},s=a=>
2{if(a instanceof MouseEvent){let c=e.getBoundingClientRect();this.mouseX=a.clientX-c.left,this.mouseY=a.clientY-c.top,this.listeners.map(n=>{this.buttonDown?n.dragged&&n.dragged(this.mouseX,this.mouseY):n.moved&&n.moved(this.mouseX,this.mouseY)})}},i=a=>{if(a instanceof MouseEvent){let c=e.getBoundingClientRect();this.mouseX=a.clientX-c.left,this.mouseY=a.clientY-c.top,this.buttonDown=!1,this.listeners.map(n=>{n.up&&n.up(this.mouseX,this.mouseY)}),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",i)}},r=a=>{a.preventDefault(),a.deltaY,a.deltaMode==WheelEvent.DOM_DELTA_LINE,a.deltaMode==WheelEvent.DOM_DELTA_PAGE,this.listeners.map(c=>{c.wheel&&c.wheel(a.deltaY)})};e.addEventListener("mousedown",t,!0),e.addEventListener("mousemove",s,!0),e.addEventListener("mouseup",i,!0),e.addEventListener("wheel",r,!0),e.addEventListener("touchstart",a=>{if(!this.touch0||!this.touch1){var c=a.changedTouches;let n=c.item(0);if(!n)return;let l=e.getBoundingClientRect(),h=n.clientX-l.left,f=n.clientY-l.top,u=new Yr(n.identifier,h,f);if(this.mouseX=h,this.mouseY=f,this.buttonDown=!0,!this.touch0)this.touch0=u,this.listeners.map(m=>{m.down&&m.down(u.x,u.y)});else if(!this.touch1){this.touch1=u;let m=this.touch1.x-this.touch0.x,g=this.touch1.x-this.touch0.x;this.initialPinchDistance=Math.sqrt(m*m+g*g),this.listeners.map(p=>{p.zoom&&p.zoom(this.initialPinchDistance,this.initialPinchDistance)})}}a.preventDefault()},!1),e.addEventListener("touchmove",a=>{if(this.touch0){var c=a.changedTouches;let h=e.getBoundingClientRect();for(var n=0;n<c.length;n++){var l=c[n];let f=l.clientX-h.left,u=l.clientY-h.top;this.touch0.identifier===l.identifier&&(this.touch0.x=this.mouseX=f,this.touch0.y=this.mouseY=u,this.listeners.map(m=>{m.dragged&&m.dragged(f,u)})),this.touch1&&this.touch1.identifier===l.identifier&&(this.touch1.x=this.mouseX=f,this.touch1.y=this.mouseY=u)}if(this.touch0&&this.touch1){let f=this.touch1.x-this.touch0.x,u=this.touch1.x-this.touch0.x,m=Math.sqrt(f*f+u*u);this.listeners.map(g=>{g.zoom&&g.zoom(this.initialPinchDistance,m)})}}a.preventDefault()},!1);let o=a=>{if(this.touch0){var c=a.changedTouches;let h=e.getBoundingClientRect();for(var n=0;n<c.length;n++){var l=c[n];let f=l.clientX-h.left,u=l.clientY-h.top;if(this.touch0.identifier===l.identifier)if(this.touch0=null,this.mouseX=f,this.mouseY=u,this.listeners.map(m=>{m.up&&m.up(f,u)}),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(m=>{m.down&&m.down(this.touch0.x,this.touch0.y)});else{this.buttonDown=!1;break}this.touch1&&this.touch1.identifier&&(this.touch1=null)}}a.preventDefault()};e.addEventListener("touchend",o,!1),e.addEventListener("touchcancel",o)}addListener(e){this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}}class Yr{constructor(e,t,s){d(this,"identifier");d(this,"x");d(this,"y");this.identifier=e,this.x=t,this.y=s}}class tn{constructor(e,t){d(this,"canvas");d(this,"camera");this.canvas=e,this.camera=t;let s=0,i=0,r=0,o=0,a=0,c=0,n=0;new Jt(e).addListener({down:(l,h)=>{s=t.position.x,i=t.position.y,r=a=l,o=c=h,n=t.zoom},dragged:(l,h)=>{let f=l-r,u=h-o,m=t.screenToWorld(new Be(0,0),e.clientWidth,e.clientHeight),g=t.screenToWorld(new Be(f,u),e.clientWidth,e.clientHeight).sub(m);t.position.set(s-g.x,i-g.y,0),t.update(),a=l,c=h},wheel:l=>{let h=l/200*t.zoom,f=t.zoom+h;if(f>0){let u=0,m=0;if(l<0)u=a,m=c;else{let b=new Be(e.clientWidth/2+15,e.clientHeight/2),y=a-b.x,w=e.clientHeight-1-c-b.y;u=b.x-y,m=e.clientHeight-1-b.y+w}let g=t.screenToWorld(new Be(u,m),e.clientWidth,e.clientHeight);t.zoom=f,t.update();let p=t.screenToWorld(new Be(u,m),e.clientWidth,e.clientHeight);t.position.add(g.sub(p)),t.update()}},zoom:(l,h)=>{let f=l/h;t.zoom=n*f},up:(l,h)=>{a=l,c=h},moved:(l,h)=>{a=l,c=h}})}}const ue=class ue{constructor(e,t,s){d(this,"vertexShader");d(this,"fragmentShader");d(this,"context");d(this,"vs",null);d(this,"vsSource");d(this,"fs",null);d(this,"fsSource");d(this,"program",null);d(this,"tmp2x2",new Float32Array(2*2));d(this,"tmp3x3",new Float32Array(3*3));d(this,"tmp4x4",new Float32Array(4*4));this.vertexShader=t,this.fragmentShader=s,this.vsSource=t,this.fsSource=s,this.context=e instanceof Te?e:new Te(e),this.context.addRestorable(this),this.compile()}getProgram(){return this.program}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}getVertexShaderSource(){return this.vsSource}getFragmentSource(){return this.fsSource}compile(){let e=this.context.gl;try{if(this.vs=this.compileShader(e.VERTEX_SHADER,this.vertexShader),!this.vs)throw new Error("Couldn't compile vertex shader.");if(this.fs=this.compileShader(e.FRAGMENT_SHADER,this.fragmentShader),!this.fs)throw new Error("Couldn#t compile fragment shader.");this.program=this.compileProgram(this.vs,this.fs)}catch(t){throw this.dispose(),t}}
2compileShader(e,t){let s=this.context.gl,i=s.createShader(e);if(!i)throw new Error("Couldn't create shader.");if(s.shaderSource(i,t),s.compileShader(i),!s.getShaderParameter(i,s.COMPILE_STATUS)){let r="Couldn't compile shader: "+s.getShaderInfoLog(i);if(s.deleteShader(i),!s.isContextLost())throw new Error(r)}return i}compileProgram(e,t){let s=this.context.gl,i=s.createProgram();if(!i)throw new Error("Couldn't compile program.");if(s.attachShader(i,e),s.attachShader(i,t),s.linkProgram(i),!s.getProgramParameter(i,s.LINK_STATUS)){let r="Couldn't compile shader program: "+s.getProgramInfoLog(i);if(s.deleteProgram(i),!s.isContextLost())throw new Error(r)}return i}restore(){this.compile()}bind(){this.context.gl.useProgram(this.program)}unbind(){this.context.gl.useProgram(null)}setUniformi(e,t){this.context.gl.uniform1i(this.getUniformLocation(e),t)}setUniformf(e,t){this.context.gl.uniform1f(this.getUniformLocation(e),t)}setUniform2f(e,t,s){this.context.gl.uniform2f(this.getUniformLocation(e),t,s)}setUniform3f(e,t,s,i){this.context.gl.uniform3f(this.getUniformLocation(e),t,s,i)}setUniform4f(e,t,s,i,r){this.context.gl.uniform4f(this.getUniformLocation(e),t,s,i,r)}setUniform2x2f(e,t){let s=this.context.gl;this.tmp2x2.set(t),s.uniformMatrix2fv(this.getUniformLocation(e),!1,this.tmp2x2)}setUniform3x3f(e,t){let s=this.context.gl;this.tmp3x3.set(t),s.uniformMatrix3fv(this.getUniformLocation(e),!1,this.tmp3x3)}setUniform4x4f(e,t){let s=this.context.gl;this.tmp4x4.set(t),s.uniformMatrix4fv(this.getUniformLocation(e),!1,this.tmp4x4)}getUniformLocation(e){let t=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let s=t.getUniformLocation(this.program,e);if(!s&&!t.isContextLost())throw new Error(`Couldn't find location for uniform ${e}`);return s}getAttributeLocation(e){let t=this.context.gl;if(!this.program)throw new Error("Shader not compiled.");let s=t.getAttribLocation(this.program,e);if(s==-1&&!t.isContextLost())throw new Error(`Couldn't find location for attribute ${e}`);return s}dispose(){this.context.removeRestorable(this);let e=this.context.gl;this.vs&&(e.deleteShader(this.vs),this.vs=null),this.fs&&(e.deleteShader(this.fs),this.fs=null),this.program&&(e.deleteProgram(this.program),this.program=null)}static newColoredTextured(e){let t=` 3attribute vec4 ${ue.POSITION}; 4attribute vec4 ${ue.COLOR}; 5attribute vec2 ${ue.TEXCOORDS}; 6uniform mat4 ${ue.MVP_MATRIX}; 7varying vec4 v_color; 8varying vec2 v_texCoords; 9 10void main () { 11 v_color = ${ue.COLOR}; 12 v_texCoords = ${ue.TEXCOORDS}; 13 gl_Position = ${ue.MVP_MATRIX} * ${ue.POSITION}; 14} 15`,s=` 16#ifdef GL_ES 17 #define LOWP lowp 18 precision mediump float; 19#else 20 #define LOWP 21#endif 22varying LOWP vec4 v_color; 23varying vec2 v_texCoords; 24uniform sampler2D u_texture; 25 26void main () { 27 gl_FragColor = v_color * texture2D(u_texture, v_texCoords); 28} 29`;return new ue(e,t,s)}static newTwoColoredTextured(e){let t=` 30attribute vec4 ${ue.POSITION}; 31attribute vec4 ${ue.COLOR}; 32attribute vec4 ${ue.COLOR2}; 33attribute vec2 ${ue.TEXCOORDS}; 34uniform mat4 ${ue.MVP_MATRIX}; 35varying vec4 v_light; 36varying vec4 v_dark; 37varying vec2 v_texCoords; 38 39void main () { 40 v_light = ${ue.COLOR}; 41 v_dark = ${ue.COLOR2}; 42 v_texCoords = ${ue.TEXCOORDS}; 43 gl_Position = ${ue.MVP_MATRIX} * ${ue.POSITION}; 44} 45`,s=` 46#ifdef GL_ES 47 #define LOWP lowp 48 precision mediump float; 49#else 50 #define LOWP 51#endif 52varying LOWP vec4 v_light; 53varying LOWP vec4 v_dark; 54varying vec2 v_texCoords; 55uniform sampler2D u_texture; 56 57void main () { 58 vec4 texColor = texture2D(u_texture, v_texCoords); 59 gl_FragColor.a = texColor.a * v_light.a; 60 gl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb; 61} 62`;return new ue(e,t,s)}static newColored(e){let t=` 63attribute vec4 ${ue.POSITION}; 64attribute vec4 ${ue.COLOR}; 65uniform mat4 ${ue.MVP_MATRIX}; 66varying vec4 v_color; 67 68void main () { 69 v_color = ${ue.COLOR}; 70 gl_Position = ${ue.MVP_MATRIX} * ${ue.POSITION}; 71} 72`,s=` 73#ifdef GL_ES 74 #define LOWP lowp 75 precision mediump float; 76#else 77 #define LOWP 78#endif 79varying LOWP vec4 v_color; 80 81void main () { 82 gl_FragColor = v_color; 83} 84`;
84return new ue(e,t,s)}};d(ue,"MVP_MATRIX","u_projTrans"),d(ue,"POSITION","a_position"),d(ue,"COLOR","a_color"),d(ue,"COLOR2","a_color2"),d(ue,"TEXCOORDS","a_texCoords"),d(ue,"SAMPLER","u_texture");let Oe=ue;class ki{constructor(e,t,s,i){d(this,"attributes");d(this,"context");d(this,"vertices");d(this,"verticesBuffer",null);d(this,"verticesLength",0);d(this,"dirtyVertices",!1);d(this,"indices");d(this,"indicesBuffer",null);d(this,"indicesLength",0);d(this,"dirtyIndices",!1);d(this,"elementsPerVertex",0);this.attributes=t,this.context=e instanceof Te?e:new Te(e),this.elementsPerVertex=0;for(let r=0;r<t.length;r++)this.elementsPerVertex+=t[r].numElements;this.vertices=new Float32Array(s*this.elementsPerVertex),this.indices=new Uint16Array(i),this.context.addRestorable(this)}getAttributes(){return this.attributes}maxVertices(){return this.vertices.length/this.elementsPerVertex}numVertices(){return this.verticesLength/this.elementsPerVertex}setVerticesLength(e){this.dirtyVertices=!0,this.verticesLength=e}getVertices(){return this.vertices}maxIndices(){return this.indices.length}numIndices(){return this.indicesLength}setIndicesLength(e){this.dirtyIndices=!0,this.indicesLength=e}getIndices(){return this.indices}getVertexSizeInFloats(){let e=0;for(var t=0;t<this.attributes.length;t++){let s=this.attributes[t];e+=s.numElements}return e}setVertices(e){if(this.dirtyVertices=!0,e.length>this.vertices.length)throw Error("Mesh can't store more than "+this.maxVertices()+" vertices");this.vertices.set(e,0),this.verticesLength=e.length}setIndices(e){if(this.dirtyIndices=!0,e.length>this.indices.length)throw Error("Mesh can't store more than "+this.maxIndices()+" indices");this.indices.set(e,0),this.indicesLength=e.length}draw(e,t){this.drawWithOffset(e,t,0,this.indicesLength>0?this.indicesLength:this.verticesLength/this.elementsPerVertex)}drawWithOffset(e,t,s,i){let r=this.context.gl;(this.dirtyVertices||this.dirtyIndices)&&this.update(),this.bind(e),this.indicesLength>0?r.drawElements(t,i,r.UNSIGNED_SHORT,s*2):r.drawArrays(t,s,i),this.unbind(e)}bind(e){let t=this.context.gl;t.bindBuffer(t.ARRAY_BUFFER,this.verticesBuffer);let s=0;for(let i=0;i<this.attributes.length;i++){let r=this.attributes[i],o=e.getAttributeLocation(r.name);t.enableVertexAttribArray(o),t.vertexAttribPointer(o,r.numElements,t.FLOAT,!1,this.elementsPerVertex*4,s*4),s+=r.numElements}this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indicesBuffer)}unbind(e){let t=this.context.gl;for(let s=0;s<this.attributes.length;s++){let i=this.attributes[s],r=e.getAttributeLocation(i.name);t.disableVertexAttribArray(r)}t.bindBuffer(t.ARRAY_BUFFER,null),this.indicesLength>0&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}update(){let e=this.context.gl;this.dirtyVertices&&(this.verticesBuffer||(this.verticesBuffer=e.createBuffer()),e.bindBuffer(e.ARRAY_BUFFER,this.verticesBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices.subarray(0,this.verticesLength),e.DYNAMIC_DRAW),this.dirtyVertices=!1),this.dirtyIndices&&(this.indicesBuffer||(this.indicesBuffer=e.createBuffer()),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices.subarray(0,this.indicesLength),e.DYNAMIC_DRAW),this.dirtyIndices=!1)}restore(){this.verticesBuffer=null,this.indicesBuffer=null,this.update()}dispose(){this.context.removeRestorable(this);let e=this.context.gl;e.deleteBuffer(this.verticesBuffer),e.deleteBuffer(this.indicesBuffer)}}class Tt{constructor(e,t,s){d(this,"name");d(this,"type");d(this,"numElements");this.name=e,this.type=t,this.numElements=s}}class os extends Tt{constructor(){super(Oe.POSITION,at.Float,2)}}class sn extends Tt{constructor(){super(Oe.POSITION,at.Float,3)}}class Es extends Tt{constructor(e=0){super(Oe.TEXCOORDS+(e==0?"":e),at.Float,2)}}class hs extends Tt{constructor(){super(Oe.COLOR,at.Float,4)}}class Lr extends Tt{constructor(){super(Oe.COLOR2,at.Float,4)}}var at;(function(A){A[A.Float=0]="Float"})(at||(at={}));const Ke=1,Xr=769,ks=770,Ts=771,Ms=774,De=class De{constructor(e,t=!0,s=10920){d(this,"context");d(this,"drawCalls",0);d(this,"isDrawing",!1);d(this,"mesh");d(this,"shader",null);d(this,"lastTexture",null);d(this,"verticesLength",0);d(this,"indicesLength",0);d(this,"srcColorBlend");d(this,"srcAlphaBlend");d(this,"dstBlend");d(this,"cullWasEnabled",!1);if(s>10920)throw new Error("Can't have more than 10920 triangles per batch: "+s);this.context=e instanceof Te?e:new Te(e);let i=t?[new os,new hs,new Es,new Lr]:[new os,new hs,new Es];this.mesh=new ki(e,i,s,s*3);let r=this.context.gl;this.srcColorBlend=r.SRC_ALPHA,this.srcAlphaBlend=r.ONE,this.dstBlend=r.ONE_MINUS_SRC_ALPHA}begin(e){if(this.isDrawing)throw new Error("PolygonBatch is already drawing. Call PolygonBatch.end() before calling PolygonBatch.begin()");this.drawCalls=0,this.shader=e,this.lastTexture=null,this.isDrawing=!0;let t=this.context.gl;t.enable(t.BLEND),t.blendFuncSeparate(this.srcColorBlend,this.dstBlend,this.srcAlphaBlend,this.dstBlend),De.disableCulling&&(this.cullWasEnabled=t.isEnabled(t.CULL_FACE),this.cullWasEnabled&&t.disable(t.CULL_FACE))}setBlendMode(e,t){const s=De.blendModesGL[e],i=t?s.srcRgbPma:s.srcRgb,r=s.srcAlpha,o=s.dstRgb;if(this.srcColorBlend==i&&this.srcAlphaBlend==r&&this.dstBlend==o)return;this.srcColorBlend=i,this.srcAlphaBlend=r,this.dstBlend=o,this.isDrawing&&this.flush(),this.context.gl.blendFuncSeparate(i,o,r,o)}draw(e,t,s){e!=this.lastTexture?(this.flush(),this.lastTexture=e):(this.verticesLength+t.length>this.mesh.getVertices().length||this.indicesLength+s.length>this.mesh.getIndices().length)&&this.flush();
84let i=this.mesh.numVertices();this.mesh.getVertices().set(t,this.verticesLength),this.verticesLength+=t.length,this.mesh.setVerticesLength(this.verticesLength);let r=this.mesh.getIndices();for(let o=this.indicesLength,a=0;a<s.length;o++,a++)r[o]=s[a]+i;this.indicesLength+=s.length,this.mesh.setIndicesLength(this.indicesLength)}flush(){if(this.verticesLength!=0){if(!this.lastTexture)throw new Error("No texture set.");if(!this.shader)throw new Error("No shader set.");this.lastTexture.bind(),this.mesh.draw(this.shader,this.context.gl.TRIANGLES),this.verticesLength=0,this.indicesLength=0,this.mesh.setVerticesLength(0),this.mesh.setIndicesLength(0),this.drawCalls++,De.globalDrawCalls++}}end(){if(!this.isDrawing)throw new Error("PolygonBatch is not drawing. Call PolygonBatch.begin() before calling PolygonBatch.end()");(this.verticesLength>0||this.indicesLength>0)&&this.flush(),this.shader=null,this.lastTexture=null,this.isDrawing=!1;let e=this.context.gl;e.disable(e.BLEND),De.disableCulling&&this.cullWasEnabled&&e.enable(e.CULL_FACE)}getDrawCalls(){return this.drawCalls}static getAndResetGlobalDrawCalls(){let e=De.globalDrawCalls;return De.globalDrawCalls=0,e}dispose(){this.mesh.dispose()}};d(De,"disableCulling",!1),d(De,"globalDrawCalls",0),d(De,"blendModesGL",[{srcRgb:ks,srcRgbPma:Ke,dstRgb:Ts,srcAlpha:Ke},{srcRgb:ks,srcRgbPma:Ke,dstRgb:Ke,srcAlpha:Ke},{srcRgb:Ms,srcRgbPma:Ms,dstRgb:Ts,srcAlpha:Ke},{srcRgb:Ke,srcRgbPma:Ke,dstRgb:Xr,srcAlpha:Ke}]);let Ut=De;class Fs{constructor(e,t=10920){d(this,"context");d(this,"isDrawing",!1);d(this,"mesh");d(this,"shapeType",Me.Filled);d(this,"color",new N(1,1,1,1));d(this,"shader",null);d(this,"vertexIndex",0);d(this,"tmp",new He);d(this,"srcColorBlend");d(this,"srcAlphaBlend");d(this,"dstBlend");if(t>10920)throw new Error("Can't have more than 10920 triangles per batch: "+t);this.context=e instanceof Te?e:new Te(e),this.mesh=new ki(e,[new os,new hs],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(Me.Point,1),s||(s=this.color),this.vertex(e,t,s)}line(e,t,s,i,r){this.check(Me.Line,2),this.mesh.getVertices(),this.vertexIndex,r||(r=this.color),this.vertex(e,t,r),this.vertex(s,i,r)}triangle(e,t,s,i,r,o,a,c,n,l){this.check(e?Me.Filled:Me.Line,3),this.mesh.getVertices(),this.vertexIndex,c||(c=this.color),n||(n=this.color),l||(l=this.color),e?(this.vertex(t,s,c),this.vertex(i,r,n),this.vertex(o,a,l)):(this.vertex(t,s,c),this.vertex(i,r,n),this.vertex(i,r,c),this.vertex(o,a,n),this.vertex(o,a,c),this.vertex(t,s,n))}quad(e,t,s,i,r,o,a,c,n,l,h,f,u){this.check(e?Me.Filled:Me.Line,3),this.mesh.getVertices(),this.vertexIndex,l||(l=this.color),h||(h=this.color),f||(f=this.color),u||(u=this.color),e?(this.vertex(t,s,l),this.vertex(i,r,h),this.vertex(o,a,f),this.vertex(o,a,f),this.vertex(c,n,u),this.vertex(t,s,l)):(this.vertex(t,s,l),this.vertex(i,r,h),this.vertex(i,r,h),this.vertex(o,a,f),this.vertex(o,a,f),this.vertex(c,n,u),this.vertex(c,n,u),this.vertex(t,s,l))}rect(e,t,s,i,r,o){this.quad(e,t,s,t+i,s,t+i,s+r,t,s+r,o,o,o,o)}rectLine(e,t,s,i,r,o,a){this.check(e?Me.Filled:Me.Line,8),a||(a=this.color);let c=this.tmp.set(r-s,t-i);c.normalize(),o*=.5;let n=c.x*o,l=c.y*o;e?(this.vertex(t+n,s+l,a),this.vertex(t-n,s-l,a),this.vertex(i+n,r+l,a),this.vertex(i-n,r-l,a),this.vertex(i+n,r+l,a),this.vertex(t-n,s-l,a)):(this.vertex(t+n,s+l,a),this.vertex(t-n,s-l,a),this.vertex(i+n,r+l,a),this.vertex(i-n,r-l,a),this.vertex(i+n,r+l,a),this.vertex(t+n,s+l,a),this.vertex(i-n,r-l,a),this.vertex(t-n,s-l,a))}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(Me.Line,s*2),i||(i=this.color),this.mesh.getVertices(),this.vertexIndex,t<<=1,s<<=1;let r=e[t],o=e[t+1],a=t+s;for(let c=t,n=t+s-2;c<n;c+=2){let l=e[c],h=e[c+1],f=0,u=0;c+2>=a?(f=r,u=o):(f=e[c+2],u=e[c+3]),this.vertex(l,h,i),this.vertex(f,u,i)}}circle(e,t,s,i,r,o=0){if(o==0&&(o=Math.max(1,6*V.cbrt(i)|0)),o<=0)throw new Error("segments must be > 0.");r||(r=this.color);let a=2*V.PI/o,c=Math.cos(a),n=Math.sin(a),l=i,h=0;if(e){this.check(Me.Filled,o*3+3),o--;for(let f=0;f<o;f++){this.vertex(t,s,r),this.vertex(t+l,s+h,r);let u=l;l=c*l-n*h,h=n*u+c*h,this.vertex(t+l,s+h,r)}this.vertex(t,s,r),this.vertex(t+l,s+h,r)}else{this.check(Me.Line,o*2+2);for(let f=0;f<o;f++){this.vertex(t+l,s+h,r);let u=l;l=c*l-n*h,h=n*u+c*h,this.vertex(t+l,s+h,r)}this.vertex(t+l,s+h,r)}l=i,h=0,this.vertex(t+l,s+h,r)}curve(e,t,s,i,r,o,a,c,n,l){this.check(Me.Line,n*2+2),l||(l=this.color);let h=1/n,f=h*h,u=h*h*h,m=3*h,g=3*f,p=6*f,b=6*u,y=e-s*2+r,w=t-i*2+o,x=(s-r)*3-e+a,C=(i-o)*3-t+c,v=e,S=t,I=(s-e)*m+y*g+x*u,E=(i-t)*m+w*g+C*u,F=y*p+x*b,R=w*p+C*b,L=x*b,B=C*b;for(;n-- >0;)this.vertex(v,S,l),v+=I,S+=E,I+=F,E+=R,F+=L,R+=B,this.vertex(v,S,l);this.vertex(v,S,l),this.vertex(a,c,l)}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");
84if(this.shapeType==e)if(this.mesh.maxVertices()-this.mesh.numVertices()<t)this.flush();else return;else this.flush(),this.shapeType=e}dispose(){this.mesh.dispose()}}var Me;(function(A){A[A.Point=0]="Point",A[A.Line=1]="Line",A[A.Filled=4]="Filled"})(Me||(Me={}));const pt=class pt{constructor(e){d(this,"boneLineColor",new N(1,0,0,1));d(this,"boneOriginColor",new N(0,1,0,1));d(this,"attachmentLineColor",new N(0,0,1,.5));d(this,"triangleLineColor",new N(1,.64,0,.5));d(this,"pathColor",new N().setFromString("FF7F00"));d(this,"clipColor",new N(.8,0,0,2));d(this,"aabbColor",new N(0,1,0,.5));d(this,"drawBones",!0);d(this,"drawRegionAttachments",!0);d(this,"drawBoundingBoxes",!0);d(this,"drawMeshHull",!0);d(this,"drawMeshTriangles",!0);d(this,"drawPaths",!0);d(this,"drawSkeletonXY",!1);d(this,"drawClipping",!0);d(this,"premultipliedAlpha",!1);d(this,"scale",1);d(this,"boneWidth",2);d(this,"context");d(this,"bounds",new Tr);d(this,"temp",new Array);d(this,"vertices",O.newFloatArray(2*1024));this.context=e instanceof Te?e:new Te(e)}draw(e,t,s){let i=t.x,r=t.y,o=this.context.gl,a=this.premultipliedAlpha?o.ONE:o.SRC_ALPHA;e.setBlendMode(a,o.ONE,o.ONE_MINUS_SRC_ALPHA);let c=t.bones;if(this.drawBones){e.setColor(this.boneLineColor);for(let n=0,l=c.length;n<l;n++){let h=c[n];if(s&&s.indexOf(h.data.name)>-1||!h.parent)continue;let f=h.data.length*h.a+h.worldX,u=h.data.length*h.c+h.worldY;e.rectLine(!0,h.worldX,h.worldY,f,u,this.boneWidth*this.scale)}this.drawSkeletonXY&&e.x(i,r,4*this.scale)}if(this.drawRegionAttachments){e.setColor(this.attachmentLineColor);let n=t.slots;for(let l=0,h=n.length;l<h;l++){let f=n[l],u=f.getAttachment();if(u instanceof wt){let m=u,g=this.vertices;m.computeWorldVertices(f,g,0,2),e.line(g[0],g[1],g[2],g[3]),e.line(g[2],g[3],g[4],g[5]),e.line(g[4],g[5],g[6],g[7]),e.line(g[6],g[7],g[0],g[1])}}}if(this.drawMeshHull||this.drawMeshTriangles){let n=t.slots;for(let l=0,h=n.length;l<h;l++){let f=n[l];if(!f.bone.active)continue;let u=f.getAttachment();if(!(u instanceof tt))continue;let m=u,g=this.vertices;m.computeWorldVertices(f,0,m.worldVerticesLength,g,0,2);let p=m.triangles,b=m.hullLength;if(this.drawMeshTriangles){e.setColor(this.triangleLineColor);for(let y=0,w=p.length;y<w;y+=3){let x=p[y]*2,C=p[y+1]*2,v=p[y+2]*2;e.triangle(!1,g[x],g[x+1],g[C],g[C+1],g[v],g[v+1])}}if(this.drawMeshHull&&b>0){e.setColor(this.attachmentLineColor),b=(b>>1)*2;let y=g[b-2],w=g[b-1];for(let x=0,C=b;x<C;x+=2){let v=g[x],S=g[x+1];e.line(v,S,y,w),y=v,w=S}}}}if(this.drawBoundingBoxes){let n=this.bounds;n.update(t,!0),e.setColor(this.aabbColor),e.rect(!1,n.minX,n.minY,n.getWidth(),n.getHeight());let l=n.polygons,h=n.boundingBoxes;for(let f=0,u=l.length;f<u;f++){let m=l[f];e.setColor(h[f].color),e.polygon(m,0,m.length)}}if(this.drawPaths){let n=t.slots;for(let l=0,h=n.length;l<h;l++){let f=n[l];if(!f.bone.active)continue;let u=f.getAttachment();if(!(u instanceof nt))continue;let m=u,g=m.worldVerticesLength,p=this.temp=O.setArraySize(this.temp,g,0);m.computeWorldVertices(f,0,g,p,0,2);let b=this.pathColor,y=p[2],w=p[3],x=0,C=0;if(m.closed){e.setColor(b);let v=p[0],S=p[1],I=p[g-2],E=p[g-1];x=p[g-4],C=p[g-3],e.curve(y,w,v,S,I,E,x,C,32),e.setColor(pt.LIGHT_GRAY),e.line(y,w,v,S),e.line(x,C,I,E)}g-=4;for(let v=4;v<g;v+=6){let S=p[v],I=p[v+1],E=p[v+2],F=p[v+3];x=p[v+4],C=p[v+5],e.setColor(b),e.curve(y,w,S,I,E,F,x,C,32),e.setColor(pt.LIGHT_GRAY),e.line(y,w,S,I),e.line(x,C,E,F),y=x,w=C}}}if(this.drawBones){e.setColor(this.boneOriginColor);for(let n=0,l=c.length;n<l;n++){let h=c[n];s&&s.indexOf(h.data.name)>-1||e.circle(!0,h.worldX,h.worldY,3*this.scale,this.boneOriginColor,8)}}if(this.drawClipping){let n=t.slots;e.setColor(this.clipColor);for(let l=0,h=n.length;l<h;l++){let f=n[l];if(!f.bone.active)continue;let u=f.getAttachment();if(!(u instanceof yt))continue;let m=u,g=m.worldVerticesLength,p=this.temp=O.setArraySize(this.temp,g,0);m.computeWorldVertices(f,0,g,p,0,2);for(let b=0,y=p.length;b<y;b+=2){let w=p[b],x=p[b+1],C=p[(b+2)%p.length],v=p[(b+3)%p.length];e.line(w,x,C,v)}}}}dispose(){}};d(pt,"LIGHT_GRAY",new N(192/255,192/255,192/255,1)),d(pt,"GREEN",new N(0,1,0,1));let cs=pt;class Br{constructor(e,t,s){d(this,"vertices");d(this,"numVertices");d(this,"numFloats");this.vertices=e,this.numVertices=t,this.numFloats=s}}const Ht=class Ht{constructor(e,t=!0){d(this,"premultipliedAlpha",!1);
84d(this,"tempColor",new N);d(this,"tempColor2",new N);d(this,"vertices");d(this,"vertexSize",8);d(this,"twoColorTint",!1);d(this,"renderable",new Br([],0,0));d(this,"clipper",new Dt);d(this,"temp",new He);d(this,"temp2",new He);d(this,"temp3",new N);d(this,"temp4",new N);this.twoColorTint=t,t&&(this.vertexSize+=4),this.vertices=O.newFloatArray(this.vertexSize*1024)}draw(e,t,s=-1,i=-1,r=null){let o=this.clipper,a=this.premultipliedAlpha,c=this.twoColorTint,n=null,l=this.renderable,h,f,u=t.drawOrder,m,g=t.color,p=c?12:8,b=!1;s==-1&&(b=!0);for(let y=0,w=u.length;y<w;y++){let x=o.isClipping()?2:p,C=u[y];if(!C.bone.active){o.clipEndWithSlot(C);continue}if(s>=0&&s==C.data.index&&(b=!0),!b){o.clipEndWithSlot(C);continue}i>=0&&i==C.data.index&&(b=!1);let v=C.getAttachment(),S;if(v instanceof wt){let I=v;l.vertices=this.vertices,l.numVertices=4,l.numFloats=x<<2,I.computeWorldVertices(C,l.vertices,0,x),f=Ht.QUAD_TRIANGLES,h=I.uvs,S=I.region.texture,m=I.color}else if(v instanceof tt){let I=v;l.vertices=this.vertices,l.numVertices=I.worldVerticesLength>>1,l.numFloats=l.numVertices*x,l.numFloats>l.vertices.length&&(l.vertices=this.vertices=O.newFloatArray(l.numFloats)),I.computeWorldVertices(C,0,I.worldVerticesLength,l.vertices,0,x),f=I.triangles,S=I.region.texture,h=I.uvs,m=I.color}else if(v instanceof yt){let I=v;o.clipStart(C,I);continue}else{o.clipEndWithSlot(C);continue}if(S){let I=C.color,E=this.tempColor;E.r=g.r*I.r*m.r,E.g=g.g*I.g*m.g,E.b=g.b*I.b*m.b,E.a=g.a*I.a*m.a,a&&(E.r*=E.a,E.g*=E.a,E.b*=E.a);let F=this.tempColor2;C.darkColor?(a?(F.r=C.darkColor.r*E.a,F.g=C.darkColor.g*E.a,F.b=C.darkColor.b*E.a):F.setFromColor(C.darkColor),F.a=a?1:0):F.set(0,0,0,1);let R=C.data.blendMode;if(R!=n&&(n=R,e.setBlendMode(n,a)),o.isClipping()){o.clipTriangles(l.vertices,f,f.length,h,E,F,c);let L=new Float32Array(o.clippedVertices),B=o.clippedTriangles;r&&r(L,L.length,p),e.draw(S,L,B)}else{let L=l.vertices;if(c)for(let T=2,Y=0,X=l.numFloats;T<X;T+=p,Y+=2)L[T]=E.r,L[T+1]=E.g,L[T+2]=E.b,L[T+3]=E.a,L[T+4]=h[Y],L[T+5]=h[Y+1],L[T+6]=F.r,L[T+7]=F.g,L[T+8]=F.b,L[T+9]=F.a;else for(let T=2,Y=0,X=l.numFloats;T<X;T+=p,Y+=2)L[T]=E.r,L[T+1]=E.g,L[T+2]=E.b,L[T+3]=E.a,L[T+4]=h[Y],L[T+5]=h[Y+1];let B=l.vertices.subarray(0,l.numFloats);r&&r(l.vertices,l.numFloats,p),e.draw(S,B,f)}}o.clipEndWithSlot(C)}o.clipEnd()}getSkeletonClipping(){return this.clipper}};d(Ht,"QUAD_TRIANGLES",[0,1,2,2,3,0]);let ds=Ht;const k=[0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0],Yt=[0,1,2,2,3,0],Lt=new N(1,1,1,1);class Ti{constructor(e,t,s=!0){d(this,"context");d(this,"canvas");d(this,"camera");d(this,"batcher");d(this,"twoColorTint",!1);d(this,"batcherShader");d(this,"shapes");d(this,"shapesShader");d(this,"activeRenderer",null);d(this,"skeletonRenderer");d(this,"skeletonDebugRenderer");this.canvas=e,this.context=t instanceof Te?t:new Te(t),this.twoColorTint=s,this.camera=new Rr(e.width,e.height),this.batcherShader=s?Oe.newTwoColoredTextured(this.context):Oe.newColoredTextured(this.context),this.batcher=new Ut(this.context,s),this.shapesShader=Oe.newColored(this.context),this.shapes=new Fs(this.context),this.skeletonRenderer=new ds(this.context,s),this.skeletonDebugRenderer=new cs(this.context)}dispose(){this.batcher.dispose(),this.batcherShader.dispose(),this.shapes.dispose(),this.shapesShader.dispose(),this.skeletonDebugRenderer.dispose()}begin(){this.camera.update(),this.enableRenderer(this.batcher)}drawSkeleton(e,t=!1,s=-1,i=-1,r=null){this.enableRenderer(this.batcher),this.skeletonRenderer.premultipliedAlpha=t,this.skeletonRenderer.draw(this.batcher,e,s,i,r)}drawSkeletonDebug(e,t=!1,s){this.enableRenderer(this.shapes),this.skeletonDebugRenderer.premultipliedAlpha=t,this.skeletonDebugRenderer.draw(this.shapes,e,s)}drawTexture(e,t,s,i,r,o){this.enableRenderer(this.batcher),o||(o=Lt);var a=0;k[a++]=t,k[a++]=s,k[a++]=o.r,k[a++]=o.g,k[a++]=o.b,k[a++]=o.a,k[a++]=0,k[a++]=1,this.twoColorTint&&(k[a++]=0,k[a++]=0,k[a++]=0,k[a++]=0),k[a++]=t+i,k[a++]=s,k[a++]=o.r,k[a++]=o.g,k[a++]=o.b,k[a++]=o.a,k[a++]=1,k[a++]=1,this.twoColorTint&&(k[a++]=0,k[a++]=0,k[a++]=0,k[a++]=0),k[a++]=t+i,k[a++]=s+r,k[a++]=o.r,k[a++]=o.g,k[a++]=o.b,k[a++]=o.a,k[a++]=1,k[a++]=0,this.twoColorTint&&(k[a++]=0,k[a++]=0,k[a++]=0,k[a++]=0),k[a++]=t,k[a++]=s+r,k[a++]=o.r,k[a++]=o.g,k[a++]=o.b,k[a++]=o.a,k[a++]=0,k[a++]=0,this.twoColorTint&&(k[a++]=0,k[a++]=0,k[a++]=0,k[a]=0),this.batcher.draw(e,k,Yt)}drawTextureUV(e,t,s,i,r,o,a,c,n,l){this.enableRenderer(this.batcher),l||(l=Lt);var h=0;k[h++]=t,k[h++]=s,k[h++]=l.r,k[h++]=l.g,k[h++]=l.b,k[h++]=l.a,k[h++]=o,k[h++]=a,this.twoColorTint&&(k[h++]=0,k[h++]=0,k[h++]=0,k[h++]=0),k[h++]=t+i,k[h++]=s,k[h++]=l.r,k[h++]=l.g,k[h++]=l.b,k[h++]=l.a,k[h++]=c,k[h++]=a,this.twoColorTint&&(k[h++]=0,k[h++]=0,k[h++]=0,k[h++]=0),k[h++]=t+i,k[h++]=s+r,k[h++]=l.r,k[h++]=l.g,k[h++]=l.b,k[h++]=l.a,k[h++]=c,k[h++]=n,this.twoColorTint&&(k[h++]=0,k[h++]=0,k[h++]=0,k[h++]=0),k[h++]=t,k[h++]=s+r,k[h++]=l.r,k[h++]=l.g,k[h++]=l.b,k[h++]=l.a,k[h++]=o,k[h++]=n,this.twoColorTint&&(k[h++]=0,k[h++]=0,k[h++]=0,k[h]=0),this.batcher.draw(e,k,Yt)}drawTextureRotated(e,t,s,i,r,o,a,c,n){this.enableRenderer(this.batcher),n||(n=Lt);let l=t+o,h=s+a,f=-o,u=-a,m=i-o,g=r-a,p=f,b=u,y=f,w=g,x=m,C=g,v=m,S=u,I=0,E=0,F=0,R=0,L=0,B=0,T=0,Y=0;
84if(c!=0){let re=V.cosDeg(c),ne=V.sinDeg(c);I=re*p-ne*b,E=ne*p+re*b,T=re*y-ne*w,Y=ne*y+re*w,L=re*x-ne*C,B=ne*x+re*C,F=L+(I-T),R=B+(E-Y)}else I=p,E=b,T=y,Y=w,L=x,B=C,F=v,R=S;I+=l,E+=h,F+=l,R+=h,L+=l,B+=h,T+=l,Y+=h;var X=0;k[X++]=I,k[X++]=E,k[X++]=n.r,k[X++]=n.g,k[X++]=n.b,k[X++]=n.a,k[X++]=0,k[X++]=1,this.twoColorTint&&(k[X++]=0,k[X++]=0,k[X++]=0,k[X++]=0),k[X++]=F,k[X++]=R,k[X++]=n.r,k[X++]=n.g,k[X++]=n.b,k[X++]=n.a,k[X++]=1,k[X++]=1,this.twoColorTint&&(k[X++]=0,k[X++]=0,k[X++]=0,k[X++]=0),k[X++]=L,k[X++]=B,k[X++]=n.r,k[X++]=n.g,k[X++]=n.b,k[X++]=n.a,k[X++]=1,k[X++]=0,this.twoColorTint&&(k[X++]=0,k[X++]=0,k[X++]=0,k[X++]=0),k[X++]=T,k[X++]=Y,k[X++]=n.r,k[X++]=n.g,k[X++]=n.b,k[X++]=n.a,k[X++]=0,k[X++]=0,this.twoColorTint&&(k[X++]=0,k[X++]=0,k[X++]=0,k[X]=0),this.batcher.draw(e,k,Yt)}drawRegion(e,t,s,i,r,o){this.enableRenderer(this.batcher),o||(o=Lt);var a=0;k[a++]=t,k[a++]=s,k[a++]=o.r,k[a++]=o.g,k[a++]=o.b,k[a++]=o.a,k[a++]=e.u,k[a++]=e.v2,this.twoColorTint&&(k[a++]=0,k[a++]=0,k[a++]=0,k[a++]=0),k[a++]=t+i,k[a++]=s,k[a++]=o.r,k[a++]=o.g,k[a++]=o.b,k[a++]=o.a,k[a++]=e.u2,k[a++]=e.v2,this.twoColorTint&&(k[a++]=0,k[a++]=0,k[a++]=0,k[a++]=0),k[a++]=t+i,k[a++]=s+r,k[a++]=o.r,k[a++]=o.g,k[a++]=o.b,k[a++]=o.a,k[a++]=e.u2,k[a++]=e.v,this.twoColorTint&&(k[a++]=0,k[a++]=0,k[a++]=0,k[a++]=0),k[a++]=t,k[a++]=s+r,k[a++]=o.r,k[a++]=o.g,k[a++]=o.b,k[a++]=o.a,k[a++]=e.u,k[a++]=e.v,this.twoColorTint&&(k[a++]=0,k[a++]=0,k[a++]=0,k[a]=0),this.batcher.draw(e.page.texture,k,Yt)}line(e,t,s,i,r,o){this.enableRenderer(this.shapes),this.shapes.line(e,t,s,i,r)}triangle(e,t,s,i,r,o,a,c,n,l){this.enableRenderer(this.shapes),this.shapes.triangle(e,t,s,i,r,o,a,c,n,l)}quad(e,t,s,i,r,o,a,c,n,l,h,f,u){this.enableRenderer(this.shapes),this.shapes.quad(e,t,s,i,r,o,a,c,n,l,h,f,u)}rect(e,t,s,i,r,o){this.enableRenderer(this.shapes),this.shapes.rect(e,t,s,i,r,o)}rectLine(e,t,s,i,r,o,a){this.enableRenderer(this.shapes),this.shapes.rectLine(e,t,s,i,r,o,a)}polygon(e,t,s,i){this.enableRenderer(this.shapes),this.shapes.polygon(e,t,s,i)}circle(e,t,s,i,r,o=0){this.enableRenderer(this.shapes),this.shapes.circle(e,t,s,i,r,o)}curve(e,t,s,i,r,o,a,c,n,l){this.enableRenderer(this.shapes),this.shapes.curve(e,t,s,i,r,o,a,c,n,l)}end(){this.activeRenderer===this.batcher?this.batcher.end():this.activeRenderer===this.shapes&&this.shapes.end(),this.activeRenderer=null}resize(e){let t=this.canvas;var s=window.devicePixelRatio||1,i=Math.round(t.clientWidth*s),r=Math.round(t.clientHeight*s);if((t.width!=i||t.height!=r)&&(t.width=i,t.height=r),this.context.gl.viewport(0,0,t.width,t.height),e===bt.Expand)this.camera.setViewport(i,r);else if(e===bt.Fit){let o=t.width,a=t.height,c=this.camera.viewportWidth,n=this.camera.viewportHeight,l=n/c,h=a/o,f=l<h?c/o:n/a;this.camera.setViewport(o*f,a*f)}this.camera.update()}enableRenderer(e){this.activeRenderer!==e&&(this.end(),e instanceof Ut?(this.batcherShader.bind(),this.batcherShader.setUniform4x4f(Oe.MVP_MATRIX,this.camera.projectionView.values),this.batcherShader.setUniformi("u_texture",0),this.batcher.begin(this.batcherShader),this.activeRenderer=this.batcher):e instanceof Fs?(this.shapesShader.bind(),this.shapesShader.setUniform4x4f(Oe.MVP_MATRIX,this.camera.projectionView.values),this.shapes.begin(this.shapesShader),this.activeRenderer=this.shapes):this.activeRenderer=this.skeletonDebugRenderer)}}var bt;(function(A){A[A.Stretch=0]="Stretch",A[A.Expand=1]="Expand",A[A.Fit=2]="Fit"})(bt||(bt={}));let At,ht,Rs=0;const Pr=1,is=1,Ys=165,Ls=108,st=163;class Vr{constructor(e){d(this,"renderer");d(this,"logo",null);d(this,"spinner",null);d(this,"angle",0);d(this,"fadeOut",0);d(this,"fadeIn",0);d(this,"timeKeeper",new us);d(this,"backgroundColor",new N(.135,.135,.135,1));d(this,"tempColor",new N);if(this.renderer=e,this.timeKeeper.maxDelta=9,!ht){let t=navigator.userAgent.indexOf("Safari")>-1,s=()=>Rs++;ht=new Image,ht.src=Nr,t||(ht.crossOrigin="anonymous"),ht.onload=s,At=new Image,At.src=Or,t||(At.crossOrigin="anonymous"),At.onload=s}}dispose(){var e,t;(e=this.logo)==null||e.dispose(),(t=this.spinner)==null||t.dispose()}draw(e=!1){if(Rs<2||e&&this.fadeOut>is)return;
84this.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,o=i.context.gl;if(i.resize(bt.Expand),i.camera.position.set(r.width/2,r.height/2,0),i.batcher.setBlendMode(Et.Normal,!0),e){if(this.fadeOut+=this.timeKeeper.delta*(this.timeKeeper.totalTime<1?2:1),this.fadeOut>is)return;s.setFromColor(this.backgroundColor),t=1-this.fadeOut/is,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&&(o.clearColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),o.clear(o.COLOR_BUFFER_BIT)),t=1;t*=Math.min(this.fadeIn/Pr,1),s.set(t,t,t,t),this.logo||(this.logo=new kt(i.context,ht),this.spinner=new kt(i.context,At)),i.camera.zoom=Math.max(1,st/r.height),i.begin(),i.drawTexture(this.logo,(r.width-Ys)/2,(r.height-Ls)/2,Ys,Ls,s),this.spinner&&i.drawTextureRotated(this.spinner,(r.width-st)/2,(r.height-st)/2,st,st,st/2,st/2,this.angle,s),i.end()}}let Or="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKMAAACjCAYAAADmbK6AAAALKElEQVR42u2de2iW5R/GPzuqcwfnnKfNmafl5tTNHWzqNi3DEMQykcAoJSsySkspjSIk0iD/07Kf4R+FnVBDUTshZGpWUEJaaiWFgZlUFmXmIe3HNXthyebeZ77P9H13ffBG8Y8H7ut7vff93N/7fu4vGGPiFZiez/Qtw9lytJajfzfw9z/j+efPOv7cV8W+lUNY2a8T/ayTCRsWFLJA5rtUO1LLkV5p9LJeJizQiHeqnlOtmVFtdTGrrZkJCxYXsTgaI6r9MY4/UpNItW4mFDaXsTlaM6qVZlBq3UwofFrJp0HMWJ9DvXUzobCznJ1BzFjWlTLrZkJh/TDWBzFjTgo51s2EgnKI0Rrx+FiOWzNzVaym91Syx5qZsGBWb2ZFa0ZN6dbMhAWTcpkUrRmXD2K5NTNhgVbH0Zpxbl/mWjMTFvRIo0e0ZpzcncnWzISKtvmiMWNRJ4qslwmVXRXsas2Ix8ZwzFqZsGFREYtaM+Oaa1ljrUzYkJ9G/ok6TlzKjJWZVFor0y7c1Zu7WjLiqiGsskamXdHopyT4vALmzS9k/t19uHtKHlOSIMn6xAtARjIZ1sFcUSZ0Y4La+G6M18hS2IlCn4a+WoC0JNL0d/dUupdnUj40g6EJ2VEdMnhrOG/p5f/jUXz8SgmvaGU6KpNRNsLVQV0OdXf24s63h/P2gWoOrBjMCr2GJFQnnxnIM3q5P1PPmaYv+4ev4/C6UtbpV2gzXCkgL5W8Bwt48OIc6ul6Tp+s4+SyASxLiI4+PYCn1bHzDZxvaQW6vZzto7MYnQIpNkf7kp5EuozYUroqEjcNKHHd0Tl9mBPN1pk+hFeieGBnBtog7UXjsj9pWg+m6duecw2cay1OC/uxMC47KmP9OIYfoz1YoC20J/rzRG4quTZK2EAyJGs20qwUbYw0aNRmUxtvfUW/uEtNzc1NB1/X8LVyd15hh82F43AvD+VlXcsSJEZa1CQ3ejleAO7oxR3RDP0XN91X4+NXYb8nkv7UNTwV7e0YTdu7I3g33t7tuaEbNwSZpps2fSyvs4M2Tjhot+jb0Xzbltj8r5j/xVt/6Z1Ob93U1ZYO691EhhzchcHeXosVjcNZysyezLw4xRZt05R+fTeuj8vOj+zKyG0j2aZcVVs6v+QalnjrMFZASQYl2nBoSyz06e3j/Xk8rgWYmMvEICu2pm1HOTuc7okV8FgRj0XukwzanhvCc/F+72TjoQjdObN1OFuDLmh0xP+WHtxiI10ukJlCprb4guiv1fP+avZrS1C7NAkliHZjDtZwMMgqbukAltpMlwuMy2FcEBPqvfLLar5Uqi0hBdEwryy+Mv5n6zkbjTBa+dlMlwvUZFETZKGiFM7tvbhdJ3gSVRO0wzIjnxmvl/J6a6JsGMYGrahtpssFeqbR841S3mhN80OjOaSDEdqd6SjaMKgzgzRK7q1ib3PT9sYyNo7JZoyNFNvRcVMZmy7WOvIuryv/Zvdmdt90+nY0bRp3AvROohFwdwW7dTG7RFlbwlqdrbOBYg005NAQmZU0HWt1rXMBH1Xw0dQ8pmqzoaPmdhun7bHZjNVe9qP9eFQfO1VkUmHjhAVUZ1GtnKFSbjrkrPfy4i4UW5t/6ZxM54J0CqxFe81KpGsQyE4h23oYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjLna+bdOy+IiFquIpGq16Pb79cNYv3IIK/X/ugx+Ui6TVKvYVU9Nc8gX8od8Ir/IN/KPfCQ/yVfyl/6/pfJvLChkQdD6wyqntquCXYuKWJSfRr6D0dEAxV3xlw/khyD+kd/ku/88cHo+09tS3LBpO1HHCVUqcIA6CqB4K+6X6x35L/JM2loXurlWmUmlA5XogOIcK8/If5HncrSWo7F6cKIWPjT/RXGOlWfkv8hzaWsN4uaaysE6WIkOKM6x8oz8F3kusXqo2vxC5jtYiQ4ozrH0TeS5qIZcrB7qkrwdA8U5Vp6R/yLPZV8V+2L14Cl5THGwEh1QnGPlGfkv8lyUlIzFQ1cNYVVHrcjZ0VCcFe9Y+Eb+izy3ceclUl43aFN52DXXssYpnY6a4qFS8ZcP2uIf+e7inRh6pdFrdTGrm8uiHx/L8T2V7NGWzvJBLJ/bl7mTuzO5qBNFDoiJID/IF/KHfCK/yDfyT3O7d/KbfNfS80hNIrU0g9L6HOq1x5iTQo6FNpeLfCQ/yVfyl3xmXYwxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHNk9z4JwJ0SqKTdQkbyEwhU393T6V7zzR6pieR3tE1ITeVXImhe6BXDGZFdRbVeank2TBhcaEMr0rwbixj49IBLL2/L/ffmMuNHfqO9tFZjJYBd1ewO3Lx+IcVfKhqna5nHZYR6XFPH+5R3eeI5t9fx/fvjeC9Jdew5OKZKqFR/RDVKL6vL/f9PJafmyvHsL+a/ff24V6NmjZQbGchVbY6UM2BluqHv1rCqzVZ1KQlkZboepCdQvacPsz5bjTfXao+yMEaDt7Wk9tSIMVGig3TejCtJSM2bSpkPjWPqd1S6Zao+lORSYWmgkOjORRNwZqd5ezMSiHLRooNr5XwWjS6/1XHX9vL2T67N7M1iyXa9JCrYjVrS1gbpJyw6hBfsmiNCYT0P9/A+Wj1/6qGr5YNYFlJBiWJogEzezLz/ZG8/9s4fgtSyuvNYbyp1IONFBtu7sHNv4/j9yAxUHWrdaWsG9+N8XHd+YxkMpSy+aySz841cC5oXbmHCnnI74yxAgZ3YbDeB4PEQCOpBpFNZWwa2ZWRcdnxLsl00crtRB0n2lLg8JNRfDKoM4NsolgBSmw/UMADba1+qpmqfyf6x1u/0a/og3I+aEunP6/i86osqmygcGarF4p54dex/Bo0LqfqOfVwIQ/HW5/RSkwV1oN2WLlHTc82TljAwM4M1O5LWwYKZTjibYXNS0N5KcjKTe10PadfLObFuJwK4ozp+UzXDBTUjL+M5ZcBnRkQV53dMIwNQTu6bSTbVEzbi5awuVByd2E/FgaN0Tc1fKOzBHHV2aAdVSdv6s5NNkp7cSH/++xAng2yyHx+CM/H21YhfdPp+0U1X0TbSZnXx8faG9Aop0MS0cToh1p+iLcpOkLj9t/JOk5eqoPHxnDsyf486an5yqCDK7XZ1O4oZ4dWyy3FSXHUAYq47uyYbMZoGmhpG3DlEFb6uNiVBhpyaHhnBO8oJmfqOROJjzIiP43hJ8UxITqqX56S2Hur2KsOnq3nrE6PPNKPRwrSKbAZrjTQN
84ZmuE7oxYXMZmxWbw9dxWFu4W4ezVedOE6qzI7oyYkY+M7TPeWsPbk2UX1qioSN+E3OZqOR2cReKE+qQRFN0Pi7y73g/UawU1KzezJpXwLz5hczX1ueUPKYkNb6GJQZ+j7/aAfRZREsv+quGsMoamXZBW2Gt5eU0alorEzYsKmJRa/m4NdeyxlqZsCGa84DKnVorEzboC7podis69DfIJmwufHMc7famvvmxZiYsKOtKWbRm1OcW1syEBboSJFozLh/EcmtmwgIluaM14/phrLdmJixYXMTiaM24p5I91syEBTphFOR7Y2tmwgJNvUFOr+tov3UzoaAv44KYUatv62ZCoemdhtG0+hzqrZsJBR08DWLG0gxKrZu50qvpxos3U5NItW4mFPp1ot+lPlpq2lYXs9qamVBZUMiC1ox4pJYjvlfStAu6GmTLcLboMtPIV4/6im5fFfuUi9QIap2MiWP+D96R1vPmsD/fAAAAAElFTkSuQmCC",Nr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKUAAABsCAYAAAALzHKmAAAQ7klEQVR42u3da4xdVRUA4D0zd2Y6nZY59DVtZ1puS9+lzC0YAi2UQ8AAQczFpPgA9VIeIQbirRqJ0cBUBVGjDr/QCKSNRSMmpuODxAdxqhgwxkhFjf6Sxh/+UUNVNGJCzR7uTvas7LXX2q9zzp3em6y0gTN3Zu75utZe5+yztxC9V+/Ve5X9En1Vjd7J6SFbLNF7naPw+l2jh7YHMBWssqMHtlsRdim4qsLtIawaPiHEQOLoNrA9iIkQDnRrVA1qD2LZ8ISoxYqKo13sQAtBWBayQWZUAXGRQM9JjCngDVY0UqJNDbQrMcaGmArdUKpIjbYiQLsCZCyIMQBy8QwnilR4Q5AuCpxFYvRFmBLbEiwKwpsSaWycVQGZBKMrwBjA9BhxDe57u2L2hOoKNCbOrgAZitEVYUxoKSMErQvSxYIzCkguRg5EF4AUhqUlhy/YUKSxcRaKsioYOQhD4I0yYxkR3PcJBcuFysmgsXAWBTMJyBCMIQh9kGGxXIXvexCQXbHGAMrBWTbM2CCpMSMLIxehC77lSJwXGth7M0FzoVJIXXDWQnGmhOkL0ic7YhhtWdGGkAuPAjUWGoF4faCmwBkbZmyUqUCyMqMLRA4+E6IsdTjidUHKBYrh9CnpRcH0ypKxsyOGEYNIIeTCOz91OIJ1QYoB5eAMyZo+MFNnyVTZ0YiRC9EGEMOyAgshxErHsL2XK1gOUgwohtM1a5YNM7Rsu4K0ZkcbRm4mpPBRwFZ5hg9eCqkrUB+csWGGogzNkqEgrdnRhpGLkINudaLgwvVB6oqzCjCTZElb2Y4B0gUjBtEG0ARnDRLjjoG9DwcshtQGlIPTljVjwUySLWNkyRCQVHa0ZUUTRAwgF91a33BEy0VKAcVwwqwZC2bqbOlUurllOxQkJzNyINoAYqjWhYYjWg5SCiiG05Q1U8FMjTIoS8YE6YORi1BHtJ4KIcQEEtTXUWAxpK44YVlPBdO1jCdFWTZIE8bVGEYMIRPcZGBw4HKQcoBiOE1ZMzbMgVQwU6JMAdKEEcuIJogUvg1YCCE2gsCO42DlIIVAKZwpYJaSLVNnSU6XjYHUmxhTmXaFaMO3EYkLqMC+FsLlIoVAKZzMrEnBhJeLfLNlKMrYWRIDCbOkFSSVHbHM6AKRC6/ODUewNqQ+OLlZkxpjUmV8MBbMUJSxyzY3Q1IgTRgxiBRCHdem0KDAUkBh9sRwwjEnAXMMgTnKhFlUtiwkS5rGka4g9SaGgxFmRC7AzTCEEBcyA36dDSsXqAtOLkysjGMwY5XxVChjZ0kuSCo7YlkRQsQQYtDEFsegsLoCxUp7Kpgps2UslFGzJGccSYHUmxhOZqwzEZqAbfUMCisHKIZzgsCpl3MTzMwTpi1bYp2477gyFKUxS7qWbdjY2EBS2dGE0QQRA7gNCyHEdhjE8RhUDlBT9tzgmjWZMFNlSy+Urk1OzCyJlW0XkK4YOQh1cDtcgwBrQmoDWkdgboBZE8mYsJSHlnFbJ+5bwmOPJ7lZkirbC8aRsMvmgtTHjBhGE0QbwJ2egUE1ITVlUC5OmDVdYNrKuN70xM6WoShjlW4464dbtiFIWK6x7GjESEHUUe0iYncnbMdQSE0Z1ITTNOb0hRmjjLtmS9dmJ2rp1jtuKktyyrb6YLEMCUHq2dGG0QQRQ7f72kzc+cJecerne8Wvv7JNPHPvenEkz8Sh3UtFc92QyGt9Yko/HgOLAIUZlItTz5ouMF3KuE+2jFLCQ1D6lm6fLMkBacuOJowYRBUXyfjuHjF3NhdnsfjvAfH6E9vFt9XxKgikEKgJZyyYalzOLeMu2bLbULI6bh+QGwmQ+rgRlumdGEQAao+K56bEL2woVUwOiev0r8OAUjiJrMmFCbvykGxZRAmPitK1dHM7bohyMsuyi/I8f0+e57fJYIKEZXpXo9E4mOf5XTKyLLvCBLETF8uY2SKepkC+dpX4T02Ivepr4HvZcOZ5fmee54fyPL+DmTUhzAs6n4n8bN5dr9f3YdkSg8nsxG0lPBVKVpNjG0/aGhzfLDmRZdnumZmZp8+c+cdZPV555fSr7Xb7s0jJ3i5Pcue4MxKkPPkvvXTqz/B92u32l0wYOzG1fkhcd/py8Rcbyq/vFM/KY1WA95h/3zzP71bfU6JsNpsfgj+P/FlbrdaDGExYyuXvLz8H+DudODH700ajcSM3W6Yu4alQ1spCOTd38jcKocTZbh9+9NixY99XJ8AEUkcpo9W64yH197m5k7+bnZ19QT+J09NHntQhwji/Jg58qi6++ofLxJ8gSFneVw2Ka4QQDfh1Ok4dZavVmtZ/nrm5k7/Vf55O1tRhboUw5+ZOvqyOl5+R/FyOHj32PYVU/tloNG5IXcKrhJIzngwp3fNjomazea/64BuNxts646f50lWv169utw9/DmtqdJQyZFaSJVuV6nq9fqMEof5/vV6/CYBqgJDlee+yAbF/+4i4ZWqZeNfaIfHWzn+Hx0KcEuU9+s8jv3ej0bhVlXOZydX/k0iRMeb8P0D5e6tj8zy/Xb9UJIc56h/yqVOnXul8lmuZ2bJslKmbHG7XrbpCmCXFRLvdfqQD6jTS3Jiy5I4OykM6ADV+1Eu1DmV6evopBORexzDi1L+X/HnGxsb2w3Hm9PSRJ9QxWPOTZdmlKht2hi+w6dkox5bqffI8fye3hDteGqKaHVsHXihKl0tB+h0cY+lute54AGRKDCW89LNTRynHb7ChUWVVjetOnJh9EYBUyPZeNCoOtsbFQwdXi4/esELcd+tq8cCHJ8UXp+viy9efLz7AgamjlKXc1AA1m83DoIRDlFubzeb96hhZLVTlgJ24gttutx+ONa50bHZKRenaeTs1OfpAfnr6yOOdE7EZdNwmlKocntXLNkA5JTGq47Ds+Lf94lWsyfnXleLfnIwJUN4DOnNYwuUxh2A3Ln9XULrfK8t3J27Tu3BVwiOjXJqoAy8UZej1yclGo3GTLN+gu3w+z/P3YaWbQqk3Ne12e4ZC+c8rxWsYytcPiP9RpZxCqWDKnxOiBNlyAUpOnGsoh4tA2Rm8X9xqtT6md5wyZmYe+0YRKL+1S/wYQ3n8zctBl5SBUv5djivfjMOPduIzcizeiYfr9foVvUwZG+XCuzibZKnSceZ5/v4QlKp8y7ElhnJlTeTP7BI/kllRYfzrfvHqFy4UX1vaL/aVlSmROzwbwdS29T2UcEwZF+V8ozM2lu1VY812u/15akypGh3TmFJesJbHHD167IdUxz3YJy5bNySuX1mbvy55CbMLtzU6tjGlsdFptVqfUMc0Go23F4wy1l2dSnbfvpMwVPe9WWVLDsrOJaF9MFu2Wq1PqmNkGce67xiXhTjdNwdlvV6/BgxfbPfBfVCetxi6b9/rlCup65QzM48dl2OjLMv26CibzeZ96sTIzEFdpwQXz9U1yrtVlpR/Zll2Fec65Y6l4pbbx8XHH9kknvzJlPjlHy8Tp29eKT5ou0aJoIT3w3dBlLDzVpfAJEZ1XOdaJZxnOSlvPMjPzxFljIvng914RwebsjYO7uhMyHu46sOfnf3Oz2TXDW6vvYxdFoIXz3Wc8J5zs9n8iOn2IrxTc2BM3Glqdp7dI553uaOjxrhwcob+MyuUpjs6WZZdon8OcigjPx8V+u+GTWFTSWEx3WYcdJ225jNDSE4q0GHCzlueHOyujn6bUWYgeb9ZZUaQPe+GzQ+Gc8+oOGhC+c1d4gfI16n3XDAhQ7+9qE9l01E2Go132GYKyXE1NiFDTcpoNpv3LOYJGWXNErJNW9sEp63p2RKiVPMn1bS1DgxsyhoGdGpmizj+xtXiDYnx7/vFmce3iWdW1cTVGEY4hQ2ZW0nNq8Qm/M6XbXm3S100lwGedFybuvNOibLI+ZS2ceU4eAxiEuvCkfmU8ycToDxETe6FgCBQHeqyAbFvfEhcO7BwDuXFCEbTZF840XeHK0jYcbs2OIGle0mVJ/mmnClEPQqxyTY5I8/zFhif7fSZee4bnrPOU4AssnRX
84HaVTCTd14dRDY3UbTIiSeFhsN/aMjgnqthFx880rxX3yATL5p3y4LPXzOaBkUyBjZMlYpbtQlIOBD475ZEusjMNSvkXe6VEoJVDkeZ2dzIfIFsRzU+JF2OyM9M9fTC/6SUYOyFQPjQ2nWiUjxnPfw5EeHqMWIqAeIFsAU847lJM2JM6xsewt1OIDLs99P7ZFHNdB/upS8XtPiD7PfLuCXJNolYyyFiNI/Zit65ItrOVafFbHcFohY7hPTN21Tjz4uc3iqfsnxKdX1MTl1OoYRFaMsToGB6Trw2JFP/OdZC2hJZ7ZkrMoAbbSGmelDJ91hFKuJeS7jlBMkJnrAqqJlgMUZS/dArPlGHNdSg5M3xXXtvquuEatvIYtDRhpxbUJuIgqsU5lGWtUploK0KuEU9mSW8YpmFQ556xNuYW7NiW13B+FkMiKHIy+C6eGgBxJvMR0oSv5hi6+z4HJyZoU0M2RVvDlrOQbcxVfX5AhZbuqy0v7ZstYMLHlAVlLTF9ALLbvu9Y5Zylpn/XOsd0ibIvxr2KCLHpp6SCUIdnSZSF+WzfOhem6GD+1KwR3Z4jNjrtDpNoZwmWd8yrupZN6Hx3fbMmFSe0Swdq2ZIPjxk1112Duo8OBGLrBkw/IoncdK2XHsdC9dHz204m50xh3tzFq1zFqtzHXrfCw7OgDsqyNnZLszVijsmXgrmNcmGtS78lIoMX2aJz03fKO2sDJddPQSCDPiQ1DfWBycY6XtXstc2PQKuxgG2McmXTPb9/9vmuJYXKyJrWjbeg+3xPM4O73nWqvbyw7xgZZSJbEUBa157cNJjdr2vb+5iA1YV3HxYscj30PDCEHIgcjtfm8K8hSsmRotkwFk5s1TTghUAopB6xrjHMBBkI0YYTZ0dZlxwLpkiWDULpmy5gwqayZgZNkA7oKQQCxctByYg0XIIEQQuRitGVHblMTA2ShKGPDpC6wu+DEgJqg2rDGDBtAF4Q6RAojp1xXGmSMbImVcR+YWNY04eQCtUG1ofUJ2/uvcETIgUhhdAE5GAlkKShjwHTNmhhODKgJqQ2sC14uOgyfD0IbRF+MlQaZAiZWyn2yJsTJATqGnHQO2Jhh+xlsACFCG0QbRtdyzQFZCZSxYPpmTS7Q5cjJHYNBYIkZpu99HoUQ/o4QIYSIZUZfjJ4ZMjZI32wZBDMU5yhy8pZTULl4XYP5fagMyEVoy4oupTpGduwnkloSlKEwY+AcQU4MhRTD6ovXBRwFzwWgCSEF0QVjJUGmgEllTS5OLlCIlIN1mS9mx/cZ5eLDALpCTI2RAhkTZQqYoTgpoCPECbaBHQ2ETL3PUl98ECAXYijG0OyYAmQoTG7W5ODkAF1CnVgm2JQx4okPA+gCMTbGskBGgRmaOblAh5GTORIrfKFx4VH4EIAxIXIxlg2SBbMvECY3e7oApbDaIgQu5/2HmeEKEINYiwSRi7EQkLFgumZOCuggctKGI4ULZN/vMeSLj0AYMytWEqMLzFg4fYDaoKaC6wvOFR4FkIPQFaILxrJAOsHsc/zlfYDWXE8qF22s8Pz5KHxcgEVALBtjJXBSSEOwFhk1Zgy4hitCT4hVw+gFs8/zwxqIBbUgyK7fcyA0PD9XX4iVxhiC0xdof6STWCsoBmKF7+cVCWFXQYyBMxRpf+STX1b0x45AhN0OMSrOGEirhrY/dfQAdjvS7oy+WCF6r1RIFxXWvlTRg1YVqFWBmxZbD99ig9pt0YPQw9rD1nstVri9V+/Ve3XrS/wfim4P5fIFxLoAAAAASUVORK5CYII=";class rn{constructor(e,t){d(this,"config");d(this,"context");d(this,"time",new us);d(this,"htmlCanvas");d(this,"gl");d(this,"renderer");d(this,"assetManager");d(this,"input");d(this,"disposed",!1);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 Te(e,t.webglConfig),this.renderer=new Ti(e,this.context),this.gl=this.context.gl,this.assetManager=new Ei(this.context,t.pathPrefix),this.input=new Jt(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)}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}}class nn{constructor(e,t){d(this,"config");d(this,"parent");d(this,"dom");d(this,"canvas",null);d(this,"context",null);d(this,"sceneRenderer",null);d(this,"loadingScreen",null);d(this,"assetManager",null);d(this,"bg",new N);d(this,"bgFullscreen",new N);d(this,"playerControls",null);d(this,"timelineSlider",null);d(this,"playButton",null);d(this,"skinButton",null);d(this,"animationButton",null);d(this,"playTime",0);d(this,"selectedBones",[]);d(this,"cancelId",0);d(this,"popup",null);d(this,"error",!1);d(this,"skeleton",null);d(this,"animationState",null);d(this,"paused",!0);d(this,"speed",1);d(this,"time",new us);d(this,"stopRequestAnimationFrame",!1);d(this,"disposed",!1);d(this,"viewport",{});d(this,"currentViewport",{});d(this,"previousViewport",{});d(this,"viewportTransitionStart",0);d(this,"eventListeners",[]);this.config=t;let s=typeof e=="string"?document.getElementById(e):e;if(s==null)throw new Error("SpinePlayer parent not found: "+e);this.parent=s,t.showControls===void 0&&(t.showControls=!0);let i=t.showControls?` 85<div class="spine-player-controls spine-player-popup-parent spine-player-control
85s-hidden"> 86<div class="spine-player-timeline"></div> 87<div class="spine-player-buttons"> 88<button class="spine-player-button spine-player-button-icon-pause"></button> 89<div class="spine-player-button-spacer"></div> 90<button class="spine-player-button spine-player-button-icon-speed"></button> 91<button class="spine-player-button spine-player-button-icon-animations"></button> 92<button class="spine-player-button spine-player-button-icon-skins"></button> 93<button class="spine-player-button spine-player-button-icon-settings"></button> 94<button class="spine-player-button spine-player-button-icon-fullscreen"></button> 95<img class="spine-player-button-icon-spine-logo" src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20104%2031.16%22%3E%3Cpath%20d%3D%22M104%2012.68a1.31%201.31%200%200%201-.37%201%201.28%201.28%200%200%201-.85.31H91.57a10.51%2010.51%200%200%200%20.29%202.55%204.92%204.92%200%200%200%201%202%204.27%204.27%200%200%200%201.64%201.26%206.89%206.89%200%200%200%202.6.44%2010.66%2010.66%200%200%200%202.17-.2%2012.81%2012.81%200%200%200%201.64-.44q.69-.25%201.14-.44a1.87%201.87%200%200%201%20.68-.2.44.44%200%200%201%20.27.04.43.43%200%200%201%20.16.2%201.38%201.38%200%200%201%20.09.37%204.89%204.89%200%200%201%200%20.58%204.14%204.14%200%200%201%200%20.43v.32a.83.83%200%200%201-.09.26%201.1%201.1%200%200%201-.17.22%202.77%202.77%200%200%201-.61.34%208.94%208.94%200%200%201-1.32.46%2018.54%2018.54%200%200%201-1.88.41%2013.78%2013.78%200%200%201-2.28.18%2010.55%2010.55%200%200%201-3.68-.59%206.82%206.82%200%200%201-2.66-1.74%207.44%207.44%200%200%201-1.63-2.89%2013.48%2013.48%200%200%201-.55-4%2012.76%2012.76%200%200%201%20.57-3.94%208.35%208.35%200%200%201%201.64-3%207.15%207.15%200%200%201%202.58-1.87%208.47%208.47%200%200%201%203.39-.65%208.19%208.19%200%200%201%203.41.64%206.46%206.46%200%200%201%202.32%201.73%207%207%200%200%201%201.3%202.54%2011.17%2011.17%200%200%201%20.43%203.13zm-3.14-.93a5.69%205.69%200%200%200-1.09-3.86%204.17%204.17%200%200%200-3.42-1.4%204.52%204.52%200%200%200-2%20.44%204.41%204.41%200%200%200-1.47%201.15A5.29%205.29%200%200%200%2092%209.75a7%207%200%200%200-.36%202zM80.68%2021.94a.42.42%200%200%201-.08.26.59.59%200%200%201-.25.18%201.74%201.74%200%200%201-.47.11%206.31%206.31%200%200%201-.76%200%206.5%206.5%200%200%201-.78%200%201.74%201.74%200%200%201-.47-.11.59.59%200%200%201-.25-.18.42.42%200%200%201-.08-.26V12a9.8%209.8%200%200%200-.23-2.35%204.86%204.86%200%200%200-.66-1.53%202.88%202.88%200%200%200-1.13-1%203.57%203.57%200%200%200-1.6-.34%204%204%200%200%200-2.35.83A12.71%2012.71%200%200%200%2069.11%2010v11.9a.42.42%200%200%201-.08.26.59.59%200%200%201-.25.18%201.74%201.74%200%200%201-.47.11%206.51%206.51%200%200%201-.78%200%206.31%206.31%200%200%201-.76%200%201.88%201.88%200%200%201-.48-.11.52.52%200%200%201-.25-.18.46.46%200%200%201-.07-.26v-17a.53.53%200%200%201%20.03-.21.5.5%200%200%201%20.23-.19%201.28%201.28%200%200%201%20.44-.11%208.53%208.53%200%200%201%201.39%200%201.12%201.12%200%200%201%20.43.11.6.6%200%200%201%20.22.19.47.47%200%200%201%20.07.26V7.2a10.46%2010.46%200%200%201%202.87-2.36%206.17%206.17%200%200%201%202.88-.75%206.41%206.41%200%200%201%202.87.58%205.16%205.16%200%200%201%201.88%201.54%206.15%206.15%200%200%201%201%202.26%2013.46%2013.46%200%200%201%20.31%203.11z%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M43.35%202.86c.09%202.6%201.89%204%205.48%204.61%203%20.48%205.79.24%206.69-2.37%201.75-5.09-2.4-3.82-6-4.39s-6.31-2.03-6.17%202.15zm1.08%2010.69c.33%201.94%202.14%203.06%204.91%203s4.84-1.16%205.13-3.25c.53-3.88-2.53-2.38-5.3-2.3s-5.4-1.26-4.74%202.55zM48%2022.44c.55%201.45%202.06%202.06%204.1%201.63s3.45-1.11%203.33-2.76c-.21-3.06-2.22-2.1-4.26-1.66S47%2019.6%2048%2022.44zm1.78%206.78c.16%201.22%201.22%202%202.88%201.93s2.92-.67%203.13-2c.4-2.43-1.46-1.53-3.12-1.51s-3.17-.82-2.89%201.58z%22%20fill%3D%22%23ff4000%22%2F%3E%3Cpath%20d%3D%22M35.28%2013.16a15.33%2015.33%200%200%201-.48%204%208.75%208.75%200%200%201-1.42%203%206.35%206.35%200%200%201-2.32%201.91%207.14%207.14%200%200%201-3.16.67%206.1%206.1%200%200%201-1.4-.15%205.34%205.34%200%200%201-1.26-.47%207.29%207.29%200%200%201-1.24-.81q-.61-.49-1.29-1.15v8.51a.47.47%200%200%201-.08.26.56.56%200%200%201-.25.19%201.74%201.74%200%200%201-.47.11%206.47%206.47%200%200%201-.78%200%206.26%206.26%200%200%201-.76%200%201.89%201.89%200%200%201-.48-.11.49.49%2
9500%200%201-.25-.19.51.51%200%200%201-.07-.26V4.91a.57.57%200%200%201%20.06-.27.46.46%200%200%201%20.23-.18%201.47%201.47%200%200%201%20.44-.1%207.41%207.41%200%200%201%201.3%200%201.45%201.45%200%200%201%20.43.1.52.52%200%200%201%20.24.18.51.51%200%200%201%20.07.27V7.2a18.06%2018.06%200%200%201%201.49-1.38%209%209%200%200%201%201.45-1%206.82%206.82%200%200%201%201.49-.59%207.09%207.09%200%200%201%204.78.52%206%206%200%200%201%202.13%202%208.79%208.79%200%200%201%201.2%202.9%2015.72%2015.72%200%200%201%20.4%203.51zm-3.28.36a15.64%2015.64%200%200%200-.2-2.53%207.32%207.32%200%200%200-.69-2.17%204.06%204.06%200%200%200-1.3-1.51%203.49%203.49%200%200%200-2-.57%204.1%204.1%200%200%200-1.2.18%204.92%204.92%200%200%200-1.2.57%208.54%208.54%200%200%200-1.28%201A15.77%2015.77%200%200%200%2022.76%2010v6.77a13.53%2013.53%200%200%200%202.46%202.4%204.12%204.12%200%200%200%202.44.83%203.56%203.56%200%200%200%202-.57A4.28%204.28%200%200%200%2031%2018a7.58%207.58%200%200%200%20.77-2.12%2011.43%2011.43%200%200%200%20.23-2.36zM12%2017.3a5.39%205.39%200%200%201-.48%202.33%204.73%204.73%200%200%201-1.37%201.72%206.19%206.19%200%200%201-2.12%201.06%209.62%209.62%200%200%201-2.71.36%2010.38%2010.38%200%200%201-3.21-.5A7.63%207.63%200%200%201%201%2021.82a3.25%203.25%200%200%201-.66-.43%201.09%201.09%200%200%201-.3-.53%203.59%203.59%200%200%201-.04-.93%204.06%204.06%200%200%201%200-.61%202%202%200%200%201%20.09-.4.42.42%200%200%201%20.16-.22.43.43%200%200%201%20.24-.07%201.35%201.35%200%200%201%20.61.26q.41.26%201%20.56a9.22%209.22%200%200%200%201.41.55%206.25%206.25%200%200%200%201.87.26%205.62%205.62%200%200%200%201.44-.17%203.48%203.48%200%200%200%201.12-.5%202.23%202.23%200%200%200%20.73-.84%202.68%202.68%200%200%200%20.26-1.21%202%202%200%200%200-.37-1.21%203.55%203.55%200%200%200-1-.87%208.09%208.09%200%200%200-1.36-.66l-1.56-.61a16%2016%200%200%201-1.57-.73%206%206%200%200%201-1.37-1%204.52%204.52%200%200%201-1-1.4%204.69%204.69%200%200%201-.37-2%204.88%204.88%200%200%201%20.39-1.87%204.46%204.46%200%200%201%201.16-1.61%205.83%205.83%200%200%201%201.94-1.11A8.06%208.06%200%200%201%206.53%204a8.28%208.28%200%200%201%201.36.11%209.36%209.36%200%200%201%201.23.28%205.92%205.92%200%200%201%20.94.37%204.09%204.09%200%200%201%20.59.35%201%201%200%200%201%20.26.26.83.83%200%200%201%20.09.26%201.32%201.32%200%200%200%20.06.35%203.87%203.87%200%200%201%200%20.51%204.76%204.76%200%200%201%200%20.56%201.39%201.39%200%200%201-.09.39.5.5%200%200%201-.16.22.35.35%200%200%201-.21.07%201%201%200%200%201-.49-.21%207%207%200%200%200-.83-.44%209.26%209.26%200%200%200-1.2-.44%205.49%205.49%200%200%200-1.58-.16%204.93%204.93%200%200%200-1.4.18%202.69%202.69%200%200%200-1%20.51%202.16%202.16%200%200%200-.59.83%202.43%202.43%200%200%200-.2%201%202%202%200%200%200%20.38%201.24%203.6%203.6%200%200%200%201%20.88%208.25%208.25%200%200%200%201.38.68l1.58.62q.8.32%201.59.72a6%206%200%200%201%201.39%201%204.37%204.37%200%200%201%201%201.36%204.46%204.46%200%200%201%20.37%201.8z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E"> 96</div></div>`:"";this.parent.appendChild(this.dom=et(`<div class="spine-player" style="position:relative;height:100%"><canvas class="spine-player-canvas" style="display:block;width:100%;height:100%"></canvas>${i}</div>`));try{this.validateConfig(t)}catch(r){this.showError(r.message,r)}this.initialize(),this.addEventListener(window,"resize",()=>this.drawFrame(!1)),requestAnimationFrame(()=>this.drawFrame())}dispose(){var s,i,r;(s=this.sceneRenderer)==null||s.dispose(),(i=this.loadingScreen)==null||i.dispose(),(r=this.assetManager)==null||r.dispose();for(var e=0;e<this.eventListeners.length;e++){var t=this.eventListeners[e];t.target.removeEventListener(t.event,t.func)}this.parent.removeChild(this.dom),this.disposed=!0}addEventListener(e,t,s){this.eventListeners.push({target:e,event:t,func:s}),e.addEventListener(t,s)}validateConfig(e){if(!e)throw new Error("A configuration object must be passed to to
96new SpinePlayer().");if(e.skelUrl&&(e.skeleton=e.skelUrl),!e.skeleton&&!e.jsonUrl&&!e.binaryUrl)throw new Error("A URL must be specified for the skeleton JSON or binary file.");if(e.scale||(e.scale=1),!e.atlas&&!e.atlasUrl)throw new Error("A URL must be specified for the atlas file.");if(e.jsonUrl&&!e.skeleton&&(e.skeleton=e.jsonUrl),e.binaryUrl&&!e.skeleton&&(e.skeleton=e.binaryUrl),e.atlasUrl&&!e.atlas&&(e.atlas=e.atlasUrl),e.backgroundColor||(e.backgroundColor=e.alpha?"00000000":"000000"),e.fullScreenBackgroundColor||(e.fullScreenBackgroundColor=e.backgroundColor),e.backgroundImage&&!e.backgroundImage.url&&(e.backgroundImage=void 0),e.premultipliedAlpha===void 0&&(e.premultipliedAlpha=!0),e.preserveDrawingBuffer===void 0&&(e.preserveDrawingBuffer=!1),e.mipmaps===void 0&&(e.mipmaps=!0),e.debug||(e.debug={bones:!1,clipping:!1,bounds:!1,hulls:!1,meshes:!1,paths:!1,points:!1,regions:!1}),e.animations&&e.animation&&e.animations.indexOf(e.animation)<0)throw new Error("Animation '"+e.animation+"' is not in the config animation list: "+rs(e.animations));if(e.skins&&e.skin&&e.skins.indexOf(e.skin)<0)throw new Error("Default skin '"+e.skin+"' is not in the config skins list: "+rs(e.skins));e.viewport||(e.viewport={}),e.viewport.animations||(e.viewport.animations={}),e.viewport.debugRender===void 0&&(e.viewport.debugRender=!1),e.viewport.transitionTime===void 0&&(e.viewport.transitionTime=.25),e.controlBones||(e.controlBones=[]),e.showLoading===void 0&&(e.showLoading=!0),e.defaultMix===void 0&&(e.defaultMix=.25)}initialize(){let e=this.config,t=this.dom;if(!e.alpha){let s=e.backgroundColor;this.dom.style.backgroundColor=(s.charAt(0)=="#"?s:"#"+s).substr(0,7)}try{this.canvas=Je(t,"spine-player-canvas"),this.context=new Te(this.canvas,{alpha:e.alpha,preserveDrawingBuffer:e.preserveDrawingBuffer}),this.sceneRenderer=new Ti(this.canvas,this.context,!0),e.showLoading&&(this.loadingScreen=new Vr(this.sceneRenderer))}catch(s){return this.showError(`Sorry, your browser does not support WebG, or you have disabled WebGL in your browser settings. 97Please use the latest version of Firefox, Chrome, Edge, or Safari.`,s),null}if(this.assetManager=new Ei(this.context,"",e.downloader),e.rawDataURIs)for(let s in e.rawDataURIs)this.assetManager.setRawDataURI(s,e.rawDataURIs[s]);if(e.skeleton.endsWith(".json")?this.assetManager.loadJson(e.skeleton):this.assetManager.loadBinary(e.skeleton),this.assetManager.loadTextureAtlas(e.atlas),e.backgroundImage&&this.assetManager.loadTexture(e.backgroundImage.url),this.bg.setFromString(e.backgroundColor),this.bgFullscreen.setFromString(e.fullScreenBackgroundColor),e.showControls){this.playerControls=t.children[1];let s=this.playerControls.children,i=s[0],r=s[1].children;this.playButton=r[0];let o=r[2];this.animationButton=r[3],this.skinButton=r[4];let a=r[5],c=r[6],n=r[7];this.timelineSlider=new Xs,i.appendChild(this.timelineSlider.create()),this.timelineSlider.change=g=>{this.pause();let b=this.animationState.getCurrent(0).animation.duration*g;this.animationState.update(b-this.playTime),this.animationState.apply(this.skeleton),this.skeleton.update(b-this.playTime),this.skeleton.updateWorldTransform(Ue.update),this.playTime=b},this.playButton.onclick=()=>this.paused?this.play():this.pause(),o.onclick=()=>this.showSpeedDialog(o),this.animationButton.onclick=()=>this.showAnimationsDialog(this.animationButton),this.skinButton.onclick=()=>this.showSkinsDialog(this.skinButton),a.onclick=()=>this.showSettingsDialog(a);let l=this.canvas.clientWidth,h=this.canvas.clientHeight,f=this.canvas.style.width,u=this.canvas.style.height,m=!1;c.onclick=()=>{let g=()=>{m=!m,m||(this.canvas.style.width=l+"px",this.canvas.style.height=h+"px",this.drawFrame(!1),requestAnimationFrame(()=>{this.canvas.style.width=f,this.canvas.style.height=u}))},p=t;p.onfullscreenchange=g,p.onwebkitfullscreenchange=g;let b=document;b.fullscreenElement||b.webkitFullscreenElement||b.mozFullScreenElement||b.msFullscreenElement?b.exitFullscreen?b.exitFullscreen():b.mozCancelFullScreen?b.mozCancelFullScreen():b.webkitExitFullscreen?b.webkitExitFullscreen():b.msExitFullscreen&&b.msExitFullscreen():(l=this.canvas.clientWidth,h=this.canvas.clientHeight,f=this.canvas.style.width,u=this.canvas.style.height,p.requestFullscreen?p.requestFullscreen():p.webkitRequestFullScreen?p.webkitRequestFullScreen():p.mozRequestFullScreen?p.mozRequestFullScreen():p.msRequestFullscreen&&p.msRequestFullscreen())},n.onclick=()=>window.open("http://esotericsoftware.com")}return t}loadSkeleton(){if(this.error)return;this.assetManager.hasErrors()&&this.showError(`Error: Assets could not be loaded. 98`+rs(this.assetManager.getErrors()));let e=this.config,t=this.assetManager.require(e.atlas),s=this.context.gl,i=s.getExtension("EXT_texture_filter_anisotropic"),r=s.getParameter(s.VERSION).indexOf("WebGL 1.0")!=-1;for(let h of t.pages){let f=h.minFilter;var o=e.mipmaps,a=V.isPowerOfTwo(h.width)&&V.isPowerOfTwo(h.height);r&&!a&&(o=!1),o&&(i?(s.texParameterf(s.TEXTURE_2D,i.TEXTURE_MAX_ANISOTROPY_EXT,8),f=be.MipMapLinearLinear):f=be.Linear,h.texture.setFilters(f,be.Nearest)),f!=be.Nearest&&f!=be.Linear&&h.texture.update(!0)}let c;try{let h,f,u=new zi(t);if(e.skeleton.endsWith(".json")){if(f=this.assetManager.remove(e.skeleton),!f)throw new Error("Empty JSON data.");
98if(e.jsonField&&(f=f[e.jsonField],!f))throw new Error("JSON field does not exist: "+e.jsonField);h=new Mr(u)}else f=this.assetManager.remove(e.skeleton),h=new Zi(u);h.scale=e.scale,c=h.readSkeletonData(f)}catch(h){this.showError(`Error: Could not load skeleton data. 99${h.message}`,h);return}this.skeleton=new It(c);let n=new Vi(c);n.defaultMix=e.defaultMix,this.animationState=new ns(n),e.controlBones.forEach(h=>{c.findBone(h)||this.showError(`Error: Control bone does not exist in skeleton: ${h}`)}),!e.skin&&c.skins.length&&(e.skin=c.skins[0].name),e.skins&&e.skin.length&&e.skins.forEach(h=>{this.skeleton.data.findSkin(h)||this.showError(`Error: Skin in config list does not exist in skeleton: ${h}`)}),e.skin&&(this.skeleton.data.findSkin(e.skin)||this.showError(`Error: Skin does not exist in skeleton: ${e.skin}`),this.skeleton.setSkinByName(e.skin),this.skeleton.setSlotsToSetupPose()),Object.getOwnPropertyNames(e.viewport.animations).forEach(h=>{c.findAnimation(h)||this.showError(`Error: Animation for which a viewport was specified does not exist in skeleton: ${h}`)}),e.animations&&e.animations.length&&(e.animations.forEach(h=>{this.skeleton.data.findAnimation(h)||this.showError(`Error: Animation in config list does not exist in skeleton: ${h}`)}),e.animation||(e.animation=e.animations[0])),e.animation&&!c.findAnimation(e.animation)&&this.showError(`Error: Animation does not exist in skeleton: ${e.animation}`),this.setupInput(),e.showControls&&((c.skins.length==1||e.skins&&e.skins.length==1)&&this.skinButton.classList.add("spine-player-hidden"),(c.animations.length==1||e.animations&&e.animations.length==1)&&this.animationButton.classList.add("spine-player-hidden")),e.success&&e.success(this);let l=this.animationState.getCurrent(0);l?this.currentViewport||(this.setViewport(l.animation),this.play()):e.animation?(l=this.setAnimation(e.animation),this.play()):(l=this.animationState.setEmptyAnimation(0),l.trackEnd=1e8,this.skeleton.updateWorldTransform(Ue.update),this.setViewport(l.animation),this.pause())}setupInput(){let e=this.config,t=e.controlBones;if(!t.length&&!e.showControls)return;let s=this.selectedBones=new Array(t.length),i=this.canvas,r=null,o=new He,a=new Be,c=new Be,n=new He,l=this.skeleton,h=this.sceneRenderer,f=function(u,m){c.set(u,i.clientHeight-m,0),o.x=o.y=0;let g=24,p=0,b=null;for(let y=0;y<t.length;y++){s[y]=null;let w=l.findBone(t[y]);if(!w)continue;let x=h.camera.worldToScreen(a.set(w.worldX,w.worldY,0),i.clientWidth,i.clientHeight).distance(c);x<g&&(g=x,b=w,p=y,o.x=a.x-c.x,o.y=a.y-c.y)}return b&&(s[p]=b),b};if(new Jt(i).addListener({down:(u,m)=>{r=f(u,m)},up:()=>{r?r=null:e.showControls&&(this.paused?this.play():this.pause())},dragged:(u,m)=>{r&&(u=V.clamp(u+o.x,0,i.clientWidth),m=V.clamp(m-o.y,0,i.clientHeight),h.camera.screenToWorld(a.set(u,m,0),i.clientWidth,i.clientHeight),r.parent?(r.parent.worldToLocal(n.set(a.x-l.x,a.y-l.y)),r.x=n.x,r.y=n.y):(r.x=a.x-l.x,r.y=a.y-l.y))},moved:(u,m)=>f(u,m)}),e.showControls){this.addEventListener(document,"mousemove",b=>{b instanceof MouseEvent&&p(b.clientX,b.clientY)}),this.addEventListener(document,"touchmove",b=>{if(b instanceof TouchEvent){let y=b.changedTouches;if(y.length){let w=y[0];p(w.clientX,w.clientY)}}});let u=(b,y,w)=>{let x=b-w.left,C=y-w.top;return x>=0&&x<=w.width&&C>=0&&C<=w.height},m=!0,g=!1,p=(b,y)=>{let w=Je(this.dom,"spine-player-popup");m=u(b,y,this.playerControls.getBoundingClientRect()),g=u(b,y,i.getBoundingClientRect()),clearTimeout(this.cancelId),!w&&!m&&!g&&!this.paused?this.playerControls.classList.add("spine-player-controls-hidden"):this.playerControls.classList.remove("spine-player-controls-hidden"),!m&&!w&&!this.paused&&(this.cancelId=setTimeout(()=>{this.paused||this.playerControls.classList.add("spine-player-controls-hidden")},1e3))}}}play(){this.paused=!1;let e=this.config;e.showControls&&(this.cancelId=setTimeout(()=>{this.paused||this.playerControls.classList.add("spine-player-controls-hidden")},1e3),this.playButton.classList.remove("spine-player-button-icon-play"),this.playButton.classList.add("spine-player-button-icon-pause"),e.animation||(e.animations&&e.animations.length?e.animation=e.animations[0]:this.skeleton.data.animations.length&&(e.animation=this.skeleton.data.animations[0].name),e.animation&&this.setAnimation(e.animation)))}pause(){this.paused=!0,this.config.showControls&&(this.playerControls.classList.remove("spine-player-control
99s-hidden"),clearTimeout(this.cancelId),this.playButton.classList.remove("spine-player-button-icon-pause"),this.playButton.classList.add("spine-player-button-icon-play"))}setAnimation(e,t=!0){return e=this.setViewport(e),this.animationState.setAnimationWith(0,e,t)}addAnimation(e,t=!0,s=0){return e=this.setViewport(e),this.animationState.addAnimationWith(0,e,t,s)}setViewport(e){if(typeof e=="string"){let r=this.skeleton.data.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);e=r}this.previousViewport=this.currentViewport;let t=this.config.viewport,s=this.currentViewport={padLeft:t.padLeft!==void 0?t.padLeft:"10%",padRight:t.padRight!==void 0?t.padRight:"10%",padTop:t.padTop!==void 0?t.padTop:"10%",padBottom:t.padBottom!==void 0?t.padBottom:"10%"};t.x!==void 0&&t.y!==void 0&&t.width&&t.height?(s.x=t.x,s.y=t.y,s.width=t.width,s.height=t.height):this.calculateAnimationViewport(e,s);let i=this.config.viewport.animations[e.name];return i&&(i.x!==void 0&&i.y!==void 0&&i.width&&i.height&&(s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height),i.padLeft!==void 0&&(s.padLeft=i.padLeft),i.padRight!==void 0&&(s.padRight=i.padRight),i.padTop!==void 0&&(s.padTop=i.padTop),i.padBottom!==void 0&&(s.padBottom=i.padBottom)),s.padLeft=this.percentageToWorldUnit(s.width,s.padLeft),s.padRight=this.percentageToWorldUnit(s.width,s.padRight),s.padBottom=this.percentageToWorldUnit(s.height,s.padBottom),s.padTop=this.percentageToWorldUnit(s.height,s.padTop),this.viewportTransitionStart=performance.now(),e}percentageToWorldUnit(e,t){return typeof t=="string"?e*parseFloat(t.substr(0,t.length-1))/100:t}calculateAnimationViewport(e,t){this.skeleton.setToSetupPose();let s=100,i=e.duration?e.duration/s:0,r=0,o=1e8,a=-1e8,c=1e8,n=-1e8,l=new He,h=new He;const f=new Array(2);for(let u=0;u<s;u++,r+=i)e.apply(this.skeleton,r,r,!1,[],1,P.setup,ke.mixIn),this.skeleton.updateWorldTransform(Ue.update),this.skeleton.getBounds(l,h,f,this.sceneRenderer.skeletonRenderer.getSkeletonClipping()),!isNaN(l.x)&&!isNaN(l.y)&&!isNaN(h.x)&&!isNaN(h.y)?(o=Math.min(l.x,o),a=Math.max(l.x+h.x,a),c=Math.min(l.y,c),n=Math.max(l.y+h.y,n)):this.showError("Animation bounds are invalid: "+e.name);t.x=o,t.y=c,t.width=a-o,t.height=n-c}drawFrame(e=!0){try{if(this.error||this.disposed)return;e&&!this.stopRequestAnimationFrame&&requestAnimationFrame(()=>this.drawFrame());let t=document,i=t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement?this.bgFullscreen:this.bg;this.time.update();let r=this.time.delta,o=!this.assetManager.isLoadingComplete();!this.skeleton&&!o&&this.loadSkeleton();let a=this.skeleton,c=this.config;if(a){let n=this.sceneRenderer;n.resize(bt.Expand);let l=this.paused?0:r*this.speed;if(c.frame&&c.frame(this,l),!this.paused&&(a.update(l),this.animationState.update(l),this.animationState.apply(a),c.updateWorldTransform?c.updateWorldTransform(this,l):a.updateWorldTransform(Ue.update),c.showControls)){this.playTime+=l;let g=this.animationState.getCurrent(0);if(g){let p=g.animation.duration;for(;this.playTime>=p&&p!=0;)this.playTime-=p;this.playTime=Math.max(0,Math.min(this.playTime,p)),this.timelineSlider.setValue(this.playTime/p)}}let h=this.viewport;if(h.x=this.currentViewport.x-this.currentViewport.padLeft,h.y=this.currentViewport.y-this.currentViewport.padBottom,h.width=this.currentViewport.width+this.currentViewport.padLeft+this.currentViewport.padRight,h.height=this.currentViewport.height+this.currentViewport.padBottom+this.currentViewport.padTop,this.previousViewport){let g=(performance.now()-this.viewportTransitionStart)/1e3/c.viewport.transitionTime;if(g<1){let p=this.previousViewport.x-this.previousViewport.padLeft,b=this.previousViewport.y-this.previousViewport.padBottom,y=this.previousViewport.width+this.previousViewport.padLeft+this.previousViewport.padRight,w=this.previousViewport.height+this.previousViewport.padBottom+this.previousViewport.padTop;h.x=p+(h.x-p)*g,h.y=b+(h.y-b)*g,h.width=y+(h.width-y)*g,h.height=w+(h.height-w)*g}}n.camera.zoom=this.canvas.height/this.canvas.width>h.height/h.width?h.width/this.canvas.width:h.height/this.canvas.height,n.camera.position.x=h.x+h.width/2,n.camera.position.y=h.y+h.height/2;let f=this.context.gl;f.clearColor(i.r,i.g,i.b,i.a),f.clear(f.COLOR_BUFFER_BIT),c.update&&c.update(this,l),n.begin();let u=c.backgroundImage;if(u){let g=this.assetManager.require(u.url);u.x!==void 0&&u.y!==void 0&&u.width&&u.height?n.drawTexture(g,u.x,u.y,u.width,u.height):n.drawTexture(g,h.x,h.y,h.width,h.height)}n.drawSkeleton(a,c.premultipliedAlpha),Number(n.skeletonDebugRenderer.drawBones=c.debug.bone
99s??!1)+Number(n.skeletonDebugRenderer.drawBoundingBoxes=c.debug.bounds??!1)+Number(n.skeletonDebugRenderer.drawClipping=c.debug.clipping??!1)+Number(n.skeletonDebugRenderer.drawMeshHull=c.debug.hulls??!1)+Number(n.skeletonDebugRenderer.drawPaths=c.debug.paths??!1)+Number(n.skeletonDebugRenderer.drawRegionAttachments=c.debug.regions??!1)+Number(n.skeletonDebugRenderer.drawMeshTriangles=c.debug.meshes??!1)>0&&n.drawSkeletonDebug(a,c.premultipliedAlpha);let m=c.controlBones;if(m.length){let g=this.selectedBones;f.lineWidth(2);for(let p=0;p<m.length;p++){let b=a.findBone(m[p]);if(!b)continue;let y=g[p]?Ur:Wr,w=g[p]?zr:qr;n.circle(!0,a.x+b.worldX,a.y+b.worldY,20,y),n.circle(!1,a.x+b.worldX,a.y+b.worldY,20,w)}}c.viewport.debugRender&&(f.lineWidth(1),n.rect(!1,this.currentViewport.x,this.currentViewport.y,this.currentViewport.width,this.currentViewport.height,N.GREEN),n.rect(!1,h.x,h.y,h.width,h.height,N.RED)),n.end(),c.draw&&c.draw(this,l)}c.showLoading&&(this.loadingScreen.backgroundColor.setFromColor(i),this.loadingScreen.draw(!o)),o&&c.loading&&c.loading(this,r)}catch(t){this.showError(`Error: Unable to render skeleton. 100${t.message}`,t)}}startRendering(){this.stopRequestAnimationFrame=!1,requestAnimationFrame(()=>this.drawFrame())}stopRendering(){this.stopRequestAnimationFrame=!0}hidePopup(e){return this.popup!=null&&this.popup.hide(e)}showSpeedDialog(e){let t="speed";if(this.hidePopup(t))return;let s=new Xt(t,e,this,this.playerControls,` 101<div class="spine-player-popup-title">Speed</div> 102<hr> 103<div class="spine-player-row" style="align-items:center;padding:8px"> 104<div class="spine-player-column"> 105 <div class="spine-player-speed-slider" style="margin-bottom:4px"></div> 106 <div class="spine-player-row" style="justify-content:space-between"><div>0.1x</div><div>1x</div><div>2x</div></div> 107</div> 108</div>`),i=new Xs(2,.1,!0);Je(s.dom,"spine-player-speed-slider").appendChild(i.create()),i.setValue(this.speed/2),i.change=r=>this.speed=r*2,s.show()}showAnimationsDialog(e){let t="animations";if(this.hidePopup(t)||!this.skeleton||!this.skeleton.data.animations.length)return;let s=new Xt(t,e,this,this.playerControls,'<div class="spine-player-popup-title">Animations</div><hr><ul class="spine-player-list"></ul>'),i=Je(s.dom,"spine-player-list");this.skeleton.data.animations.forEach(r=>{if(this.config.animations&&this.config.animations.indexOf(r.name)<0)return;let o=et('<li class="spine-player-list-item selectable"><div class="selectable-circle"></div><div class="selectable-text"></div></li>');r.name==this.config.animation&&o.classList.add("selected"),Je(o,"selectable-text").innerText=r.name,i.appendChild(o),o.onclick=()=>{Bs(i.children,"selected"),o.classList.add("selected"),this.config.animation=r.name,this.playTime=0,this.setAnimation(r.name),this.play()}}),s.show()}showSkinsDialog(e){let t="skins";if(this.hidePopup(t)||!this.skeleton||!this.skeleton.data.animations.length)return;let s=new Xt(t,e,this,this.playerControls,'<div class="spine-player-popup-title">Skins</div><hr><ul class="spine-player-list"></ul>'),i=Je(s.dom,"spine-player-list");this.skeleton.data.skins.forEach(r=>{if(this.config.skins&&this.config.skins.indexOf(r.name)<0)return;let o=et('<li class="spine-player-list-item selectable"><div class="selectable-circle"></div><div class="selectable-text"></div></li>');r.name==this.config.skin&&o.classList.add("selected"),Je(o,"selectable-text").innerText=r.name,i.appendChild(o),o.onclick=()=>{Bs(i.children,"selected"),o.classList.add("selected"),this.config.skin=r.name,this.skeleton.setSkinByName(this.config.skin),this.skeleton.setSlotsToSetupPose()}}),s.show()}showSettingsDialog(e){let t="settings";if(this.hidePopup(t)||!this.skeleton||!this.skeleton.data.animations.length)return;let s=new Xt(t,e,this,this.playerControls,'<div class="spine-player-popup-title">Debug</div><hr><ul class="spine-player-list"></li>'),i=Je(s.dom,"spine-player-list"),r=(o,a)=>{let c=et('<li class="spine-player-list-item"></li>'),n=new Dr(o);c.appendChild(n.create());let l=this.config.debug;n.setEnabled(l[a]),n.change=h=>l[a]=h,i.appendChild(c)};r("Bones","bones"),r("Regions","regions"),r("Meshes","meshes"),r("Bounds","bounds"),r("Paths","paths"),r("Clipping","clipping"),r("Points","points"),r("Hulls","hulls"),s.show()}showError(e,t){if(this.error){if(t)throw t}else throw this.error=!0,this.dom.appendChild(et('<div class="spine-player-error" style="background:#000;color:#fff;position:absolute;top:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;overflow:auto;z-index:999">'+e.replace(` 109`,"<br><br>")+"</div>")),this.config.error&&this.config.error(this,e),t||new Error(e)}}class Xt{constructor(e,t,s,i,r){d(this,"id");d(this,"button");d(this,"player");d(this,"dom");d(this,"className");d(this,"windowClickListener");this.id=e,this.button=t,this.player=s,this.dom=et('<div class="spine-player-popup spine-player-hidden"></div>'),this.dom.innerHTML=r,i.appendChild(this.dom),this.className="spine-player-button-icon-"
109+e+"-selected"}dispose(){}hide(e){return this.dom.remove(),this.button.classList.remove(this.className),this.id==e?(this.player.popup=null,!0):!1}show(){this.player.popup=this,this.button.classList.add(this.className),this.dom.classList.remove("spine-player-hidden");let e=!1,t=()=>{e||requestAnimationFrame(t);let r=this.player.dom,o=Math.abs(r.getBoundingClientRect().bottom-r.getBoundingClientRect().bottom),a=Math.abs(r.getBoundingClientRect().right-r.getBoundingClientRect().right);this.dom.style.maxHeight=r.clientHeight-o-a+"px"};requestAnimationFrame(t);let s=!0,i=r=>{if(s||this.player.popup!=this){s=!1;return}this.dom.contains(r.target)||(this.dom.remove(),window.removeEventListener("click",i),this.button.classList.remove(this.className),this.player.popup=null,e=!0)};this.player.addEventListener(window,"click",i)}}class Dr{constructor(e){d(this,"text");d(this,"switch",null);d(this,"enabled",!1);d(this,"change",()=>{});this.text=e}create(){return this.switch=et(` 110<div class="spine-player-switch"> 111 <span class="spine-player-switch-text">${this.text}</span> 112 <div class="spine-player-switch-knob-area"> 113 <div class="spine-player-switch-knob"></div> 114 </div> 115</div>`),this.switch.addEventListener("click",()=>{this.setEnabled(!this.enabled),this.change&&this.change(this.enabled)}),this.switch}setEnabled(e){var t,s;e?(t=this.switch)==null||t.classList.add("active"):(s=this.switch)==null||s.classList.remove("active"),this.enabled=e}isEnabled(){return this.enabled}}class Xs{constructor(e=0,t=.1,s=!1){d(this,"snaps");d(this,"snapPercentage");d(this,"big");d(this,"slider",null);d(this,"value",null);d(this,"knob",null);d(this,"change",()=>{});this.snaps=e,this.snapPercentage=t,this.big=s}create(){this.slider=et(` 116<div class="spine-player-slider ${this.big?"big":""}"> 117 <div class="spine-player-slider-value"></div> 118 <!--<div class="spine-player-slider-knob"></div>--> 119</div>`),this.value=Je(this.slider,"spine-player-slider-value"),this.setValue(0);let e=!1;return new Jt(this.slider).addListener({down:(t,s)=>{var i;e=!0,(i=this.value)==null||i.classList.add("hovering")},up:(t,s)=>{var i;e=!1,this.change&&this.change(this.setValue(t/this.slider.clientWidth)),(i=this.value)==null||i.classList.remove("hovering")},moved:(t,s)=>{e&&this.change&&this.change(this.setValue(t/this.slider.clientWidth))},dragged:(t,s)=>{this.change&&this.change(this.setValue(t/this.slider.clientWidth))}}),this.slider}setValue(e){if(e=Math.max(0,Math.min(1,e)),this.snaps){let t=1/this.snaps,s=e%t;s<t*this.snapPercentage?e=e-s:s>t-t*this.snapPercentage&&(e=e-s+t),e=Math.max(0,Math.min(1,e))}return this.value.style.width=""+e*100+"%",e}}function Je(A,e){return A.getElementsByClassName(e)[0]}function et(A){let e=document.createElement("div");return e.innerHTML=A,e.children[0]}function Bs(A,e){for(let t=0;t<A.length;t++)A[t].classList.remove(e)}function rs(A){return JSON.stringify(A).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const Ur=new N(.478,0,0,.25),zr=new N(1,1,1,1),Wr=new N(.478,0,0,.5),qr=new N(1,0,0,.8);function Gr(A){return new Promise((e,t)=>{const s=document.createElement("script");s.src=A,s.onload=()=>e(),s.onerror=()=>t(new Error(`Script load error for ${A}`)),document.head.appendChild(s)})}function Hr(A){return new Promise((e,t)=>{const s=document.createElement("link");s.href=A,s.rel="stylesheet",s.onload=()=>e(),s.onerror=()=>t(new Error(`CSS load error for ${A}`)),document.head.appendChild(s)})}const jt=class jt{constructor(e){d(this,"parent");d(this,"prefix",`<html> 120<head> 121<style> 122body { margin: 0px; } 123</style> 124</head> 125<body>`.trim());d(this,"postfix","</body>");d(this,"code");d(this,"player");d(this,"timerId",0);this.parent=e,this.load()}async load(){await Promise.all([Gr("https://www.unpkg.com/[email protected]/lib/codemirror.js"),Hr("https://www.unpkg.com/[email protected]/lib/codemirror.css")]),this.render(this.parent)}render(e){let t=` 126 <div style="display: flex; flex-direction: column; width: 100%; height: 100%;"> 127 <div style="width: 100%; height: 50%"></div> 128 <iframe style="width: 100%; height: 50%; outline: none; border: none;"></iframe>
129 </div> 130 `;e.innerHTML=t;let s=e.children[0].children[0];this.player=e.children[0].children[1],requestAnimationFrame(()=>{this.code=CodeMirror(s,{lineNumbers:!0,tabSize:3,indentUnit:3,indentWithTabs:!0,scrollBarStyle:"native",mode:"htmlmixed",theme:"monokai"}),this.code.on("change",()=>{this.startPlayer()}),s.children[0].style.height="100%",this.setCode(jt.DEFAULT_CODE)})}setPreAndPostfix(e,t){this.prefix=e,this.postfix=t,this.startPlayer()}setCode(e){this.code.setValue(e),this.startPlayer()}startPlayer(){clearTimeout(this.timerId),this.timerId=setTimeout(()=>{let e=this.code.getDoc().getValue();e=this.prefix+e+this.postfix,e=window.btoa(e),this.player.src="",this.player.src="data:text/html;base64,"+e},500)}};d(jt,"DEFAULT_CODE",` 131<script src="https://esotericsoftware.com/files/spine-player/4.1/spine-player.js"><\/script> 132<link rel="stylesheet" href="https://esotericsoftware.com/files/spine-player/4.1/spine-player.css"> 133 134<div id="player-container" style="width: 100vw; height: 100vh;"></div> 135 136<script> 137new spine.SpinePlayer("player-container", { 138 jsonUrl: "https://esotericsoftware.com/files/examples/4.1/spineboy/export/spineboy-pro.json", 139 atlasUrl: "https://esotericsoftware.com/files/examples/4.1/spineboy/export/spineboy-pma.atlas" 140}); 141<\/script> 142 `.trim());let Ps=jt;export{_s as AlphaTimeline,fs as Animation,ns as AnimationState,_r as AnimationStateAdapter,Vi as AnimationStateData,Ei as AssetManager,Wi as AssetManagerBase,zi as AtlasAttachmentLoader,Os as Attachment,ct as AttachmentTimeline,Ki as BinaryInput,Et as BlendMode,Ss as Bone,pi as BoneData,Zt as BoundingBoxAttachment,Pi as CURRENT,tn as CameraController,yt as ClippingAttachment,N as Color,Lr as Color2Attribute,hs as ColorAttribute,Kt as ConstraintData,Ze as CurveTimeline,We as CurveTimeline1,ms as CurveTimeline2,Jr as DebugUtils,ti as DeformTimeline,xi as Downloader,it as DrawOrderTimeline,wi as Event,bi as EventData,Xi as EventQueue,St as EventTimeline,Re as EventType,vs as FIRST,$r as FakeTexture,kt as GLTexture,es as HOLD_FIRST,Bi as HOLD_MIX,Cs as HOLD_SUBSEQUENT,qi as IkConstraint,yi as IkConstraintData,si as IkConstraintTimeline,xe as Inherit,Ks as InheritTimeline,Jt as Input,Zr as IntSet,Ri as Interpolation,Vr as LoadingScreen,U as M00,j as M01,Z as M02,z as M03,K as M10,W as M11,J as M12,q as M13,Q as M20,_ as M21,G as M22,H as M23,te as M30,se as M31,ie as M32,$ as M33,Te as ManagedWebGLRenderingContext,V as MathUtils,dt as Matrix4,ki as Mesh,tt as MeshAttachment,P as MixBlend,ke as MixDirection,Rr as OrthoCamera,nt as PathAttachment,as as PathConstraint,vi as PathConstraintData,ai as PathConstraintMixTimeline,ri as PathConstraintPositionTimeline,ni as PathConstraintSpacingTimeline,Ue as Physics,hi as PhysicsConstraintDampingTimeline,ui as PhysicsConstraintGravityTimeline,li as PhysicsConstraintInertiaTimeline,ci as PhysicsConstraintMassTimeline,fi as PhysicsConstraintMixTimeline,Ot as PhysicsConstraintResetTimeline,oi as PhysicsConstraintStrengthTimeline,lt as PhysicsConstraintTimeline,di as PhysicsConstraintWindTimeline,gs as PointAttachment,Ut as PolygonBatcher,Bt as Pool,os as Position2Attribute,sn as Position3Attribute,je as PositionMode,Yi as Pow,Kr as PowOut,ei as RGB2Timeline,$s as RGBA2Timeline,Js as RGBATimeline,Qs as RGBTimeline,wt as RegionAttachment,bt as ResizeMode,rt as RotateMode,Vt as RotateTimeline,As as SETUP,$t as SUBSEQUENT,Ws as ScaleTimeline,qs as ScaleXTimeline,Gs as ScaleYTimeline,Ti as SceneRenderer,Nt as SequenceTimeline,Oe as Shader,Fs as ShapeRenderer,Me as ShapeType,Hs as ShearTimeline,js as ShearXTimeline,Zs as ShearYTimeline,It as Skeleton,Zi as SkeletonBinary,Tr as SkeletonBounds,Dt as SkeletonClipping,Ai as SkeletonData,cs as SkeletonDebugRenderer,Mr as SkeletonJson,ds as SkeletonRenderer,ls as Skin,Is as SkinEntry,Hi as Slot,Si as SlotData,ve as SpacingMode,rn as SpineCanvas,nn as SpinePlayer,Ps as SpinePlayerEditor,Vs as StringSet,Es as TexCoordAttribute,mi as Texture,Ni as TextureAtlas,Ui as TextureAtlasPage,gi as TextureAtlasRegion,be as TextureFilter,Oi as TextureRegion,xt as TextureWrap,us as TimeKeeper,pe as Timeline,Yr as Touch,Li as TrackEntry,ji as TransformConstraint,Ii as TransformConstraintData,ii as TransformConstraintTimeline,Ds as TranslateTimeline,
142Us as TranslateXTimeline,zs as TranslateYTimeline,Ye as Triangulator,O as Utils,He as Vector2,Be as Vector3,ze as VertexAttachment,Tt as VertexAttribute,at as VertexAttributeType,Qr as WindowedMean};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.