Files
SpineParticlesWeb/vendor/spine/spine-pixi-v7-4.3/dist/esm/spine-pixi-v7.min.mjs
T
2026-09-02 13:53:12 +08:00

73 lines
218 KiB
JavaScript

"use strict";if(typeof window<"u"&&window.PIXI){const e=window.require;window.require=t=>{if(e)return e(t);if(t.startsWith("@pixi/"))return window.PIXI}}var vi=class{array=[];add(e){const t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!==void 0}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},on=class{entries={};size=0;add(e){const t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){const t=this.size;for(let s=0,n=e.length;s<n;s++)this.add(e[s]);return t!==this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},z=class Yt{constructor(t=0,s=0,n=0,i=0){this.r=t,this.g=s,this.b=n,this.a=i}static WHITE=new Yt(1,1,1,1);static RED=new Yt(1,0,0,1);static GREEN=new Yt(0,1,0,1);static BLUE=new Yt(0,0,1,1);static MAGENTA=new Yt(1,0,1,1);set(t,s,n,i){return this.r=t,this.g=s,this.b=n,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)==="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!==8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,n,i){return this.r+=t,this.g+=s,this.b+=n,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(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>`0${(s*255).toString(16)}`.slice(-2);return+`0x${t(this.r)}${t(this.g)}${t(this.b)}`}static fromString(t,s=new Yt){return s.setFromString(t)}},L=class ht{static epsilon=1e-5;static epsilon2=ht.epsilon*ht.epsilon;static PI=3.1415927;static PI2=ht.PI*2;static invPI2=1/ht.PI2;static radiansToDegrees=180/ht.PI;static radDeg=ht.radiansToDegrees;static degreesToRadians=ht.PI/180;static degRad=ht.degreesToRadians;static clamp(t,s,n){return t<s?s:t>n?n:t}static cosDeg(t){return Math.cos(t*ht.degRad)}static sinDeg(t){return Math.sin(t*ht.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*ht.radDeg}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){const s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return ht.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,n){const i=Math.random(),r=s-t;return i<=(n-t)/r?t+Math.sqrt(i*r*(n-t)):s-Math.sqrt((1-i)*r*(s-n))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},qt=class _t{static linear=new class extends _t{applyInternal(t){return t}};static smooth=new class extends _t{applyInternal(t){return t*t*(3-2*t)}};static slowFast=new class extends _t{applyInternal(t){return t*t}};static fastSlow=new class extends _t{applyInternal(t){return(t-1)*(t-1)*-1+1}};static circle=new class extends _t{applyInternal(t){return t<=.5?(t*=2,(1-Math.sqrt(1-t*t))/2):(t--,t*=2,(Math.sqrt(1-t*t)+1)/2)}};apply(t,s,n){return s===void 0||n===void 0?this.applyInternal(t):t+(s-t)*this.applyInternal(n)}},an=class extends qt{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2===0?-2:2)+1}},Ti=class extends an{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}},V=class Ut{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,n,i,r){for(let a=s,c=i;a<s+r;a++,c++)n[c]=t[a]}static arrayFill(t,s,n,i){for(let r=s;r<n;r++)t[r]=i}static setArraySize(t,s,n=0){const i=t.length;if(i===s)return t;if(t.length=s,i<s)for(let r=i;r<s;r++)t[r]=n;return t}static ensureArrayCapacity(t,s,n=0){return t.length>=s?t:Ut.setArraySize(t,s,n)}static newArray(t,s){const n=[];for(let i=0;i<t;i++)n[i]=s;return n}static newFloatArray(t){if(Ut.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static newShortArray(t){if(Ut.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static toFloatArray(t){return Ut.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return Ut.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t){}static contains(t,s,n=!0){for(let i=0;i<t.length;i++)if(t[i]===s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},Ci=class{static logBones(e){for(let t=0;t<e.bones.length;t++){const s=e.bones[t].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},zt=class{items=[];instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){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}},le=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){const e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){const e=this.length();return e!==0&&(this.x/=e,this.y/=e),this}},Si=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const 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)}},Ai=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},_e=class{_image;constructor(e){this._image=e}getImage(){return this._image}},ce=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(ce||{}),ln=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(ln||{}),cn=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Ii=class extends _e{setFilters(e,t){}setWraps(e,t){}dispose(){}},he=class{pages=[];regions=[];constructor(e){const t=new ki(e),s=new Array(4),n={};n.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},n.format=()=>{},n.filter=o=>{o.minFilter=V.enumValue(ce,s[1]),o.magFilter=V.enumValue(ce,s[2])},n.repeat=o=>{s[1].indexOf("x")!==-1&&(o.uWrap=10497),s[1].indexOf("y")!==-1&&(o.vWrap=10497)},n.pma=o=>{o.pma=s[1]==="true"};var i={};i.xy=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2])},i.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},i.bounds=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2]),o.width=parseInt(s[3]),o.height=parseInt(s[4])},i.offset=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2])},i.orig=o=>{o.originalWidth=parseInt(s[1]),o.originalHeight=parseInt(s[2])},i.offsets=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2]),o.originalWidth=parseInt(s[3]),o.originalHeight=parseInt(s[4])},i.rotate=o=>{const h=s[1];h==="true"?o.degrees=90:h!=="false"&&(o.degrees=parseInt(h))},i.index=o=>{o.index=parseInt(s[1])};let r=t.readLine();for(;r&&r.trim().length===0;)r=t.readLine();for(;!(!r||r.trim().length===0||t.readEntry(s,r)===0);)r=t.readLine();let a=null,c=null,l=null;for(;r!==null;)if(r.trim().length===0)a=null,r=t.readLine();else if(a){const o=new Ue(a,r);for(;;){const h=t.readEntry(s,r=t.readLine());if(h===0)break;const d=i[s[0]];if(d)d(o);else{c||(c=[]),l||(l=[]),c.push(s[0]);const m=[];for(let f=0;f<h;f++)m.push(parseInt(s[f+1]));l.push(m)}}o.originalWidth===0&&o.originalHeight===0&&(o.originalWidth=o.width,o.originalHeight=o.height),c&&c.length>0&&l&&l.length>0&&(o.names=c,o.values=l,c=null,l=null),o.u=o.x/a.width,o.v=o.y/a.height,o.degrees===90?(o.u2=(o.x+o.height)/a.width,o.v2=(o.y+o.width)/a.height):(o.u2=(o.x+o.width)/a.width,o.v2=(o.y+o.height)/a.height),this.regions.push(o)}else{for(a=new hn(r.trim());t.readEntry(s,r=t.readLine())!==0;){const o=n[s[0]];o&&o(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(const s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},ki=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length===0))return 0;const s=t.indexOf(":");if(s===-1)return 0;e[0]=t.substr(0,s).trim();for(let n=1,i=s+1;;n++){const r=t.indexOf(",",i);if(r===-1)return e[n]=t.substr(i).trim(),n;if(e[n]=t.substr(i,r-i).trim(),i=r+1,n===4)return 4}}},hn=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(const t of this.regions)t.texture=e}},Ue=class extends cn{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},$e=class ai{static empty=[];name;timelineAttachment;timelineSlots=ai.empty;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t,this.timelineAttachment=this}isTimelineActive(t,s,n){let i=t[s];if(i.bone.isActive()){const r=(n?i.getAppliedPose():i.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,a=this.timelineSlots.length;r<a;r++){if(i=t[this.timelineSlots[r]],!i.bone.isActive())continue;const c=(n?i.getAppliedPose():i.getPose()).getAttachment();if(c!=null&&c.timelineAttachment===this)return!0}return!1}},vt=class li extends $e{static nextID=0;id=li.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(t){super(t)}computeWorldVertices(t,s,n,i,r,a,c){i=a+(i>>1)*c;const l=s.appliedPose.deform;let o=this.vertices;const h=this.bones;if(!h){l.length>0&&(o=l);const u=s.bone.appliedPose,p=u.worldX,g=u.worldY,x=u.a,b=u.b,w=u.c,v=u.d;for(let y=n,T=a;T<i;y+=2,T+=c){const C=o[y],A=o[y+1];r[T]=C*x+A*b+p,r[T+1]=C*w+A*v+g}return}let d=0,m=0;for(let u=0;u<n;u+=2){const p=h[d];d+=p+1,m+=p}const f=t.bones;if(l.length===0)for(let u=a,p=m*3;u<i;u+=c){let g=0,x=0,b=h[d++];for(b+=d;d<b;d++,p+=3){const w=f[h[d]].appliedPose,v=o[p],y=o[p+1],T=o[p+2];g+=(v*w.a+y*w.b+w.worldX)*T,x+=(v*w.c+y*w.d+w.worldY)*T}r[u]=g,r[u+1]=x}else{const u=l;for(let p=a,g=m*3,x=m<<1;p<i;p+=c){let b=0,w=0,v=h[d++];for(v+=d;d<v;d++,g+=3,x+=2){const y=f[h[d]].appliedPose,T=o[g]+u[x],C=o[g+1]+u[x+1],A=o[g+2];b+=(T*y.a+C*y.b+y.worldX)*A,w+=(T*y.c+C*y.d+y.worldY)*A}r[p]=b,r[p+1]=w}}}copyTo(t){this.bones?(t.bones=[],V.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=V.newFloatArray(this.vertices.length),V.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}},wt=class tn extends vt{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new z(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new z(0,0,0,0);constructor(t,s){super(t),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new tn(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],V.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],V.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],V.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(t){this.sourceMesh=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,this.edges=t.edges,this.width=t.width,this.height=t.height)}newLinkedMesh(){const t=new tn(this.name,this.sequence.copy());return t.timelineAttachment=this.timelineAttachment,t.path=this.path,t.color.setFromColor(this.color),t.setSourceMesh(this.sourceMesh?this.sourceMesh:this),t.updateSequence(),t}static computeUVs(t,s,n){if(!t)throw new Error("Region not set.");const i=n.length;let r=t.u,a=t.v,c=0,l=0;if(t instanceof Ue){const o=t.page,h=o.width,d=o.height;switch(t.degrees){case 90:r-=(t.originalHeight-t.offsetY-t.height)/h,a-=(t.originalWidth-t.offsetX-t.width)/d,c=t.originalHeight/h,l=t.originalWidth/d;for(let m=0;m<i;m+=2)n[m]=r+s[m+1]*c,n[m+1]=a+(1-s[m])*l;return;case 180:r-=(t.originalWidth-t.offsetX-t.width)/h,a-=t.offsetY/d,c=t.originalWidth/h,l=t.originalHeight/d;for(let m=0;m<i;m+=2)n[m]=r+(1-s[m])*c,n[m+1]=a+(1-s[m+1])*l;return;case 270:r-=t.offsetY/h,a-=t.offsetX/d,c=t.originalHeight/h,l=t.originalWidth/d;for(let m=0;m<i;m+=2)n[m]=r+(1-s[m+1])*c,n[m+1]=a+s[m]*l;return;default:r-=t.offsetX/h,a-=(t.originalHeight-t.offsetY-t.height)/d,c=t.originalWidth/h,l=t.originalHeight/d}}else t?(c=t.u2-r,l=t.v2-a):(r=a=0,c=l=1);for(let o=0;o<i;o+=2)n[o]=r+s[o]*c,n[o+1]=a+s[o+1]*l}},Tt=class ci extends $e{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new z(1,1,1,1);tempColor=new z(1,1,1,1);constructor(t,s){super(t),this.sequence=s}copy(){const t=new ci(this.name,this.sequence.copy());return t.path=this.path,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,t.color.setFromColor(this.color),t}computeWorldVertices(t,s,n,i,r){const a=t.bone.appliedPose,c=a.worldX,l=a.worldY,o=a.a,h=a.b,d=a.c,m=a.d;let f=s[0],u=s[1];n[i]=f*o+u*h+c,n[i+1]=f*d+u*m+l,i+=r,f=s[2],u=s[3],n[i]=f*o+u*h+c,n[i+1]=f*d+u*m+l,i+=r,f=s[4],u=s[5],n[i]=f*o+u*h+c,n[i+1]=f*d+u*m+l,i+=r,f=s[6],u=s[7],n[i]=f*o+u*h+c,n[i+1]=f*d+u*m+l}getOffsets(t){return this.sequence.offsets[this.sequence.resolveIndex(t)]}updateSequence(){this.sequence.update(this)}static computeUVs(t,s,n,i,r,a,c,l,o,h){if(!t)throw new Error("Region not set.");const d=c/t.originalWidth*i,m=l/t.originalHeight*r,f=-c/2*i+t.offsetX*d,u=-l/2*r+t.offsetY*m,p=f+t.width*d,g=u+t.height*m,x=a*L.degRad,b=Math.cos(x),w=Math.sin(x),v=f*b+s,y=f*w,T=u*b+n,C=u*w,A=p*b+s,k=p*w,S=g*b+n,I=g*w;o[0]=v-C,o[1]=T+y,o[2]=v-I,o[3]=S+y,o[4]=A-I,o[5]=S+k,o[6]=A-C,o[7]=T+k,t==null?(h[0]=0,h[1]=0,h[2]=0,h[3]=1,h[4]=1,h[5]=1,h[6]=1,h[7]=0):(h[1]=t.v2,h[2]=t.u,h[5]=t.v,h[6]=t.u2,t.degrees===90?(h[0]=t.u2,h[3]=t.v2,h[4]=t.u,h[7]=t.v):(h[0]=t.u,h[3]=t.v,h[4]=t.u2,h[7]=t.v2))}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Wt=class Ne{static _nextID=0;id=Ne.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(t,s){this.regions=new Array(t),this.pathSuffix=s}copy(){const t=this.regions.length,s=new Ne(t,this.pathSuffix);if(V.arrayCopy(this.regions,0,s.regions,0,t),s.start=this.start,s.digits=this.digits,s.setupIndex=this.setupIndex,this.uvs!=null){const n=this.uvs[0].length;s.uvs=[];for(let i=0;i<t;i++)s.uvs[i]=V.newFloatArray(n),V.arrayCopy(this.uvs[i],0,s.uvs[i],0,n)}if(this.offsets!=null){s.offsets=[];for(let n=0;n<t;n++)s.offsets[n]=[],V.arrayCopy(this.offsets[n],0,s.offsets[n],0,8)}return s}update(t){const s=this.regions.length;if(t instanceof Tt){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=V.newFloatArray(8),this.offsets[n]=[],Tt.computeUVs(this.regions[n],t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.width,t.height,this.offsets[n],this.uvs[n])}else if(t instanceof wt){const n=t.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=V.newFloatArray(n.length),wt.computeUVs(this.regions[i],n,this.uvs[i])}}resolveIndex(t){let s=t.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(t){return this.uvs[t]}hasPathSuffix(){return this.pathSuffix}getPath(t,s){if(!this.pathSuffix)return t;let n=t;const i=(this.start+s).toString();for(let r=this.digits-i.length;r>0;r--)n+="0";return n+=i,n}static nextID(){return Ne._nextID++}},qe=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(qe||{}),ze=[0,1,2,3,4,5,6],de=class{name;timelines=[];timelineIds;bones;color=new z(1,1,1,1);duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.duration=s,this.timelineIds=new on,this.bones=[],this.setTimelines(t)}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e;const t=e.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,n=e;for(let i=0;i<t;i++){const r=n[i];this.timelineIds.addAll(r.propertyIds),mn(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,n,i,r,a,c,l,o){if(!e)throw new Error("skeleton cannot be null.");n&&this.duration!==0&&(s%=this.duration,t>0&&(t%=this.duration));const h=this.timelines;for(let d=0,m=h.length;d<m;d++)h[d].apply(e,t,s,i,r,a,c,l,o)}},dn=(e=>(e[e.current=0]="current",e[e.setup=1]="setup",e[e.first=2]="first",e))(dn||{}),un=(e=>(e[e.rotate=0]="rotate",e[e.x=1]="x",e[e.y=2]="y",e[e.scaleX=3]="scaleX",e[e.scaleY=4]="scaleY",e[e.shearX=5]="shearX",e[e.shearY=6]="shearY",e[e.inherit=7]="inherit",e[e.rgb=8]="rgb",e[e.alpha=9]="alpha",e[e.rgb2=10]="rgb2",e[e.attachment=11]="attachment",e[e.deform=12]="deform",e[e.event=13]="event",e[e.drawOrder=14]="drawOrder",e[e.drawOrderFolder=15]="drawOrderFolder",e[e.ikConstraint=16]="ikConstraint",e[e.transformConstraint=17]="transformConstraint",e[e.pathConstraintPosition=18]="pathConstraintPosition",e[e.pathConstraintSpacing=19]="pathConstraintSpacing",e[e.pathConstraintMix=20]="pathConstraintMix",e[e.physicsConstraintInertia=21]="physicsConstraintInertia",e[e.physicsConstraintStrength=22]="physicsConstraintStrength",e[e.physicsConstraintDamping=23]="physicsConstraintDamping",e[e.physicsConstraintMass=24]="physicsConstraintMass",e[e.physicsConstraintWind=25]="physicsConstraintWind",e[e.physicsConstraintGravity=26]="physicsConstraintGravity",e[e.physicsConstraintMix=27]="physicsConstraintMix",e[e.physicsConstraintReset=28]="physicsConstraintReset",e[e.sequence=29]="sequence",e[e.sliderTime=30]="sliderTime",e[e.sliderMix=31]="sliderMix",e))(un||{}),Q=class{propertyIds;frames;additive=!1;instant=!1;constructor(e,...t){this.propertyIds=t,this.frames=V.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 search(e,t,s=1){const n=e.length;for(let i=s;i<n;i+=s)if(e[i]>t)return i-s;return n-s}};function fn(e){return typeof e=="object"&&e!==null&&typeof e.slotIndex=="number"}var Ct=class extends Q{curves;constructor(e,t,...s){super(e,...s),this.curves=V.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){const t=this.getFrameCount()+e*18;if(this.curves.length>t){const s=V.newFloatArray(t);V.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,n,i,r,a,c,l,o,h){const d=this.curves;let m=this.getFrameCount()+e*18;s===0&&(d[t]=2+m);const f=(n-r*2+c)*.03,u=(i-a*2+l)*.03,p=((r-c)*3-n+o)*.006,g=((a-l)*3-i+h)*.006;let x=f*2+p,b=u*2+g,w=(r-n)*.3+f+p*.16666667,v=(a-i)*.3+u+g*.16666667,y=n+w,T=i+v;for(let C=m+18;m<C;m+=2)d[m]=y,d[m+1]=T,w+=x,v+=b,x+=p,b+=g,y+=w,T+=v}getBezierValue(e,t,s,n){const i=this.curves;if(i[n]>e){const l=this.frames[t],o=this.frames[t+s];return o+(e-l)/(i[n]-l)*(i[n+1]-o)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=e){const l=i[n-2],o=i[n-1];return o+(e-l)/(i[n]-l)*(i[n+1]-o)}t+=this.getFrameEntries();const a=i[r-2],c=i[r-1];return c+(e-a)/(this.frames[t]-a)*(this.frames[t+s]-c)}},Gt=class oe extends Ct{constructor(t,s,n){super(t,s,n)}getFrameEntries(){return 2}setFrame(t,s,n){t<<=1,this.frames[t]=s,this.frames[t+1]=n}getCurveValue(t){const s=this.frames;let n=s.length-2;for(let r=2;r<=n;r+=2)if(s[r]>t){n=r-2;break}const i=this.curves[n>>1];switch(i){case 0:{const r=s[n],a=s[n+1];return a+(t-r)/(s[n+2]-r)*(s[n+2+1]-a)}case 1:return s[n+1]}return this.getBezierValue(t,n,1,i-2)}getRelativeValue(t,s,n,i,r,a){if(t<this.frames[0])return oe.beforeFirstKey(n,s,r,a);const c=this.getCurveValue(t);return n===1?a+c*s:r+(i?c:c+a-r)*s}getAbsoluteValue(t,s,n,i,r,a,c){return c===void 0?this.getAbsoluteValue1(t,s,n,i,r,a):this.getAbsoluteValue2(t,s,n,i,r,a,c)}getAbsoluteValue1(t,s,n,i,r,a){if(t<this.frames[0])return oe.beforeFirstKey(n,s,r,a);const c=this.getCurveValue(t);return n===1?a+(i?c:c-a)*s:r+(i?c:c-r)*s}getAbsoluteValue2(t,s,n,i,r,a,c){return t<this.frames[0]?oe.beforeFirstKey(n,s,r,a):n===1?a+(i?c:c-a)*s:r+(i?c:c-r)*s}getScaleValue(t,s,n,i,r,a,c){if(t<this.frames[0])return oe.beforeFirstKey(n,s,a,c);const l=this.getCurveValue(t)*c;if(s===1&&!i)return l;let o=n===1?c:a;return i?o+(l-c)*s:r?o+(Math.abs(l)*Math.sign(o)-o)*s:(o=Math.abs(o)*Math.sign(l),o+(l-o)*s)}static beforeFirstKey(t,s,n,i){switch(t){case 1:return i;case 2:return n+(i-n)*s;case 0:return n}}};function mn(e){return typeof e=="object"&&e!==null&&typeof e.boneIndex=="number"}var St=class extends Gt{boneIndex;constructor(e,t,s,n){super(e,t,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(e,t,s,n,i,r,a,c,l){const o=e.bones[this.boneIndex];o.active&&this.apply1(l?o.appliedPose:o.pose,o.data.setupPose,s,i,r,a,c)}},ue=class extends Ct{boneIndex;constructor(e,t,s,n,i){super(e,t,`${n}|${s}`,`${i}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(e,t,s,n){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n}apply(e,t,s,n,i,r,a,c,l){const o=e.bones[this.boneIndex];o.active&&this.apply1(l?o.appliedPose:o.pose,o.data.setupPose,s,i,r,a,c)}},Ht=class extends St{constructor(e,t,s){super(e,t,s,0)}apply1(e,t,s,n,i,r,a){e.rotation=this.getRelativeValue(s,n,i,r,e.rotation,t.rotation)}},We=class extends ue{constructor(e,t,s){super(e,t,s,1,2)}apply1(e,t,s,n,i,r,a){const c=this.frames;if(s<c[0]){switch(i){case 1:e.x=t.x,e.y=t.y;break;case 2:e.x+=(t.x-e.x)*n,e.y+=(t.y-e.y)*n;break}return}let l=0,o=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const m=c[h];l=c[h+1],o=c[h+2];const f=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*f,o+=(c[h+3+2]-o)*f;break}case 1:l=c[h+1],o=c[h+2];break;default:l=this.getBezierValue(s,h,1,d-2),o=this.getBezierValue(s,h,2,d+18-2)}i===1?(e.x=t.x+l*n,e.y=t.y+o*n):r?(e.x+=l*n,e.y+=o*n):(e.x+=(t.x+l-e.x)*n,e.y+=(t.y+o-e.y)*n)}},Ge=class extends St{constructor(e,t,s){super(e,t,s,1)}apply1(e,t,s,n,i,r,a){e.x=this.getRelativeValue(s,n,i,r,e.x,t.x)}},He=class extends St{constructor(e,t,s){super(e,t,s,2)}apply1(e,t,s,n,i,r,a){e.y=this.getRelativeValue(s,n,i,r,e.y,t.y)}},Ke=class extends ue{constructor(e,t,s){super(e,t,s,3,4)}apply1(e,t,s,n,i,r,a){const c=this.frames;if(s<c[0]){switch(i){case 1:e.scaleX=t.scaleX,e.scaleY=t.scaleY;break;case 2:e.scaleX+=(t.scaleX-e.scaleX)*n,e.scaleY+=(t.scaleY-e.scaleY)*n;break}return}let l,o;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const m=c[h];l=c[h+1],o=c[h+2];const f=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*f,o+=(c[h+3+2]-o)*f;break}case 1:l=c[h+1],o=c[h+2];break;default:l=this.getBezierValue(s,h,1,d-2),o=this.getBezierValue(s,h,2,d+18-2)}if(l*=t.scaleX,o*=t.scaleY,n===1&&!r)e.scaleX=l,e.scaleY=o;else{let m=0,f=0;i===1?(m=t.scaleX,f=t.scaleY):(m=e.scaleX,f=e.scaleY),r?(e.scaleX=m+(l-t.scaleX)*n,e.scaleY=f+(o-t.scaleY)*n):a?(e.scaleX=m+(Math.abs(l)*Math.sign(m)-m)*n,e.scaleY=f+(Math.abs(o)*Math.sign(f)-f)*n):(m=Math.abs(m)*Math.sign(l),f=Math.abs(f)*Math.sign(o),e.scaleX=m+(l-m)*n,e.scaleY=f+(o-f)*n)}}},Je=class extends St{constructor(e,t,s){super(e,t,s,3)}apply1(e,t,s,n,i,r,a){e.scaleX=this.getScaleValue(s,n,i,r,a,e.scaleX,t.scaleX)}},Ze=class extends St{constructor(e,t,s){super(e,t,s,4)}apply1(e,t,s,n,i,r,a){e.scaleY=this.getScaleValue(s,n,i,r,a,e.scaleY,t.scaleY)}},je=class extends ue{constructor(e,t,s){super(e,t,s,5,6)}apply1(e,t,s,n,i,r,a){const c=this.frames;if(s<c[0]){switch(i){case 1:e.shearX=t.shearX,e.shearY=t.shearY;break;case 2:e.shearX+=(t.shearX-e.shearX)*n,e.shearY+=(t.shearY-e.shearY)*n;break}return}let l=0,o=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const m=c[h];l=c[h+1],o=c[h+2];const f=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*f,o+=(c[h+3+2]-o)*f;break}case 1:l=c[h+1],o=c[h+2];break;default:l=this.getBezierValue(s,h,1,d-2),o=this.getBezierValue(s,h,2,d+18-2)}i===1?(e.shearX=t.shearX+l*n,e.shearY=t.shearY+o*n):r?(e.shearX+=l*n,e.shearY+=o*n):(e.shearX+=(t.shearX+l-e.shearX)*n,e.shearY+=(t.shearY+o-e.shearY)*n)}},Qe=class extends St{constructor(e,t,s){super(e,t,s,5)}apply1(e,t,s,n,i,r,a){e.shearX=this.getRelativeValue(s,n,i,r,e.shearX,t.shearX)}},ts=class extends St{constructor(e,t,s){super(e,t,s,6)}apply1(e,t,s,n,i,r,a){e.shearY=this.getRelativeValue(s,n,i,r,e.shearY,t.shearY)}},es=class extends Q{boneIndex;constructor(e,t){super(e,`7|${t}`),this.boneIndex=t,this.instant=!0}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,n,i,r,a,c,l){const o=e.bones[this.boneIndex];if(!o.active)return;const h=l?o.appliedPose:o.pose;if(c)r!==0&&(h.inherit=o.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r!==0&&(h.inherit=o.data.setupPose.inherit):h.inherit=this.frames[Q.search(d,s,2)+1]}}},Kt=class extends Ct{slotIndex;constructor(e,t,s,...n){super(e,t,...n),this.slotIndex=s}apply(e,t,s,n,i,r,a,c,l){const o=e.slots[this.slotIndex];o.bone.active&&this.apply1(o,l?o.appliedPose:o.pose,s,i,r,a)}},ss=class extends Kt{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(e,t,s,n,i,r){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i,this.frames[e+4]=r}apply1(e,t,s,n,i,r){const a=t.color,c=this.frames;if(s<c[0]){const u=e.data.setupPose.color;switch(i){case 1:a.setFromColor(u);break;case 2:a.add((u.r-a.r)*n,(u.g-a.g)*n,(u.b-a.b)*n,(u.a-a.a)*n);break}return}let l=0,o=0,h=0,d=0;const m=Q.search(c,s,5),f=this.curves[m/5];switch(f){case 0:{const u=c[m];l=c[m+1],o=c[m+2],h=c[m+3],d=c[m+4];const p=(s-u)/(c[m+5]-u);l+=(c[m+5+1]-l)*p,o+=(c[m+5+2]-o)*p,h+=(c[m+5+3]-h)*p,d+=(c[m+5+4]-d)*p;break}case 1:l=c[m+1],o=c[m+2],h=c[m+3],d=c[m+4];break;default:l=this.getBezierValue(s,m,1,f-2),o=this.getBezierValue(s,m,2,f+18-2),h=this.getBezierValue(s,m,3,f+36-2),d=this.getBezierValue(s,m,4,f+54-2)}if(n===1)a.set(l,o,h,d);else if(i===1){const u=e.data.setupPose.color;a.set(u.r+(l-u.r)*n,u.g+(o-u.g)*n,u.b+(h-u.b)*n,u.a+(d-u.a)*n)}else a.add((l-a.r)*n,(o-a.g)*n,(h-a.b)*n,(d-a.a)*n)}},ns=class extends Kt{constructor(e,t,s){super(e,t,s,`8|${s}`)}getFrameEntries(){return 4}setFrame(e,t,s,n,i){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i}apply1(e,t,s,n,i,r){const a=t.color;let c=0,l=0,o=0;const h=this.frames;if(s<h[0]){const f=e.data.setupPose.color;switch(i){case 1:{a.r=f.r,a.g=f.g,a.b=f.b;break}case 2:{a.r+=(f.r-a.r)*n,a.g+=(f.g-a.g)*n,a.b+=(f.b-a.b)*n;break}}return}const d=Q.search(h,s,4),m=this.curves[d>>2];switch(m){case 0:{const f=h[d];c=h[d+1],l=h[d+2],o=h[d+3];const u=(s-f)/(h[d+4]-f);c+=(h[d+4+1]-c)*u,l+=(h[d+4+2]-l)*u,o+=(h[d+4+3]-o)*u;break}case 1:c=h[d+1],l=h[d+2],o=h[d+3];break;default:c=this.getBezierValue(s,d,1,m-2),l=this.getBezierValue(s,d,2,m+18-2),o=this.getBezierValue(s,d,3,m+36-2)}if(n!==1)if(i===1){const f=e.data.setupPose.color;c=f.r+(c-f.r)*n,l=f.g+(l-f.g)*n,o=f.b+(o-f.b)*n}else c=a.r+(c-a.r)*n,l=a.g+(l-a.g)*n,o=a.b+(o-a.b)*n;a.r=c<0?0:c>1?1:c,a.g=l<0?0:l>1?1:l,a.b=o<0?0:o>1?1:o}},is=class extends Gt{slotIndex=0;constructor(e,t,s){super(e,t,`9|${s}`),this.slotIndex=s}apply(e,t,s,n,i,r,a,c,l){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const h=(l?o.appliedPose:o.pose).color;let d=0;const m=this.frames;if(s<m[0]){const f=o.data.setupPose.color.a;switch(r){case 1:h.a=f;break;case 2:h.a+=(f-h.a)*i;break}return}if(d=this.getCurveValue(s),i!==1)if(r===1){const f=o.data.setupPose.color;d=f.a+(d-f.a)*i}else d=h.a+(d-h.a)*i;h.a=d<0?0:d>1?1:d}},rs=class extends Kt{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(e,t,s,n,i,r,a,c,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i,this.frames[e+4]=r,this.frames[e+5]=a,this.frames[e+6]=c,this.frames[e+7]=l}apply1(e,t,s,n,i,r){const a=t.color,c=t.darkColor;let l=0,o=0,h=0;const d=this.frames;if(s<d[0]){const b=e.data.setupPose,w=b.color,v=b.darkColor;switch(i){case 1:{a.setFromColor(w),c.r=v.r,c.g=v.g,c.b=v.b;break}case 2:{a.add((w.r-a.r)*n,(w.g-a.g)*n,(w.b-a.b)*n,(w.a-a.a)*n),c.r+=(v.r-c.r)*n,c.g+=(v.g-c.g)*n,c.b+=(v.b-c.b)*n;break}}return}let m=0,f=0,u=0,p=0;const g=Q.search(d,s,8),x=this.curves[g>>3];switch(x){case 0:{const b=d[g];m=d[g+1],f=d[g+2],u=d[g+3],p=d[g+4],l=d[g+5],o=d[g+6],h=d[g+7];const w=(s-b)/(d[g+8]-b);m+=(d[g+8+1]-m)*w,f+=(d[g+8+2]-f)*w,u+=(d[g+8+3]-u)*w,p+=(d[g+8+4]-p)*w,l+=(d[g+8+5]-l)*w,o+=(d[g+8+6]-o)*w,h+=(d[g+8+7]-h)*w;break}case 1:m=d[g+1],f=d[g+2],u=d[g+3],p=d[g+4],l=d[g+5],o=d[g+6],h=d[g+7];break;default:m=this.getBezierValue(s,g,1,x-2),f=this.getBezierValue(s,g,2,x+18-2),u=this.getBezierValue(s,g,3,x+36-2),p=this.getBezierValue(s,g,4,x+54-2),l=this.getBezierValue(s,g,5,x+72-2),o=this.getBezierValue(s,g,6,x+90-2),h=this.getBezierValue(s,g,7,x+108-2)}if(n===1)a.set(m,f,u,p);else if(i===1){const b=e.data.setupPose;let w=b.color;a.set(w.r+(m-w.r)*n,w.g+(f-w.g)*n,w.b+(u-w.b)*n,w.a+(p-w.a)*n),w=b.darkColor,l=w.r+(l-w.r)*n,o=w.g+(o-w.g)*n,h=w.b+(h-w.b)*n}else a.add((m-a.r)*n,(f-a.g)*n,(u-a.b)*n,(p-a.a)*n),l=c.r+(l-c.r)*n,o=c.g+(o-c.g)*n,h=c.b+(h-c.b)*n;c.r=l<0?0:l>1?1:l,c.g=o<0?0:o>1?1:o,c.b=h<0?0:h>1?1:h}},os=class extends Kt{constructor(e,t,s){super(e,t,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(e,t,s,n,i,r,a,c){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i,this.frames[e+4]=r,this.frames[e+5]=a,this.frames[e+6]=c}apply1(e,t,s,n,i,r){const a=t.color,c=t.darkColor;let l=0,o=0,h=0,d=0,m=0,f=0;const u=this.frames;if(s<u[0]){const x=e.data.setupPose,b=x.color,w=x.darkColor;switch(i){case 1:a.r=b.r,a.g=b.g,a.b=b.b,c.r=w.r,c.g=w.g,c.b=w.b;break;case 2:a.r+=(b.r-a.r)*n,a.g+=(b.g-a.g)*n,a.b+=(b.b-a.b)*n,c.r+=(w.r-c.r)*n,c.g+=(w.g-c.g)*n,c.b+=(w.b-c.b)*n;break}return}const p=Q.search(u,s,7),g=this.curves[p/7];switch(g){case 0:{const x=u[p];l=u[p+1],o=u[p+2],h=u[p+3],d=u[p+4],m=u[p+5],f=u[p+6];const b=(s-x)/(u[p+7]-x);l+=(u[p+7+1]-l)*b,o+=(u[p+7+2]-o)*b,h+=(u[p+7+3]-h)*b,d+=(u[p+7+4]-d)*b,m+=(u[p+7+5]-m)*b,f+=(u[p+7+6]-f)*b;break}case 1:l=u[p+1],o=u[p+2],h=u[p+3],d=u[p+4],m=u[p+5],f=u[p+6];break;default:l=this.getBezierValue(s,p,1,g-2),o=this.getBezierValue(s,p,2,g+18-2),h=this.getBezierValue(s,p,3,g+36-2),d=this.getBezierValue(s,p,4,g+54-2),m=this.getBezierValue(s,p,5,g+72-2),f=this.getBezierValue(s,p,6,g+90-2)}if(n!==1)if(i===1){const x=e.data.setupPose;let b=x.color;l=b.r+(l-b.r)*n,o=b.g+(o-b.g)*n,h=b.b+(h-b.b)*n,b=x.darkColor,d=b.r+(d-b.r)*n,m=b.g+(m-b.g)*n,f=b.b+(f-b.b)*n}else l=a.r+(l-a.r)*n,o=a.g+(o-a.g)*n,h=a.b+(h-a.b)*n,d=c.r+(d-c.r)*n,m=c.g+(m-c.g)*n,f=c.b+(f-c.b)*n;a.r=l<0?0:l>1?1:l,a.g=o<0?0:o>1?1:o,a.b=h<0?0:h>1?1:h,c.r=d<0?0:d>1?1:d,c.g=m<0?0:m>1?1:m,c.b=f<0?0:f>1?1:f}},Rt=class extends Q{slotIndex=0;attachmentNames;constructor(e,t){super(e,`11|${t}`),this.slotIndex=t,this.attachmentNames=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,n,i,r,a,c,l){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const h=l?o.appliedPose:o.pose;c||s<this.frames[0]?r!==0&&this.setAttachment(e,h,o.data.attachmentName):this.setAttachment(e,h,this.attachmentNames[Q.search(this.frames,s)])}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},as=class extends Ct{slotIndex;attachment;vertices;constructor(e,t,s,n){super(e,t,`12|${s}|${n.id}`),this.slotIndex=s,this.attachment=n,this.vertices=new Array(e),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,n,i,r,a,c,l,o,h){const d=this.curves;let m=this.getFrameCount()+e*18;s===0&&(d[t]=2+m);const f=(n-r*2+c)*.03,u=l*.03-a*.06,p=((r-c)*3-n+o)*.006,g=(a-l+.33333333)*.018;let x=f*2+p,b=u*2+g,w=(r-n)*.3+f+p*.16666667,v=a*.3+u+g*.16666667,y=n+w,T=v;for(let C=m+18;m<C;m+=2)d[m]=y,d[m+1]=T,w+=x,v+=b,x+=p,b+=g,y+=w,T+=v}getCurvePercent(e,t){const s=this.curves;let n=s[t];switch(n){case 0:{const c=this.frames[t];return(e-c)/(this.frames[t+this.getFrameEntries()]-c)}case 1:return 0}if(n-=2,s[n]>e){const c=this.frames[t];return s[n+1]*(e-c)/(s[n]-c)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=e){const c=s[n-2],l=s[n-1];return l+(e-c)/(s[n]-c)*(s[n+1]-l)}const r=s[i-2],a=s[i-1];return a+(1-a)*(e-r)/(this.frames[t+this.getFrameEntries()]-r)}apply(e,t,s,n,i,r,a,c,l){const o=e.slots;if(!this.attachment.isTimelineActive(o,this.slotIndex,l))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(o[this.slotIndex],l,i,r);for(const g of h)this.applyBeforeFirst(o[g],l,i,r);return}let m,f,u;if(s>=d[d.length-1])u=0,m=this.vertices[d.length-1],f=null;else{const g=Q.search(d,s);u=this.getCurvePercent(s,g),m=this.vertices[g],f=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(o[this.slotIndex],l,m,f,u,p,i,r,a);for(const g of h)this.applyToSlot(o[g],l,m,f,u,p,i,r,a)}applyBeforeFirst(e,t,s,n){if(!e.bone.active)return;const i=t?e.appliedPose:e.pose;if(i.attachment==null||i.attachment.timelineAttachment!==this.attachment)return;const r=i.deform;switch(r.length===0&&(n=1),n){case 1:r.length=0;break;case 2:{if(s===1){r.length=0;return}const a=this.vertices[0].length;r.length=a;const c=r,l=i.attachment;if(l.bones===null){const o=l.vertices;for(let h=0;h<a;h++)c[h]+=(o[h]-c[h])*s}else{s=1-s;for(let o=0;o<a;o++)c[o]*=s}}}}applyToSlot(e,t,s,n,i,r,a,c,l){if(!e.bone.active)return;const o=t?e.appliedPose:e.pose;if(o.attachment===null||o.attachment.timelineAttachment!==this.attachment)return;const h=o.attachment,d=o.deform;d.length===0&&(c=1);const m=c===1;if(d.length=r,n===null)if(a===1)if(l&&!m)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f];else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=s[u]-f[u]}else V.arrayCopy(s,0,d,0,r);else if(m)if(h.bones)for(let f=0;f<r;f++)d[f]=s[f]*a;else{const f=h.vertices;for(let u=0;u<r;u++){const p=f[u];d[u]=p+(s[u]-p)*a}}else if(l)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f]*a;else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=(s[u]-f[u])*a}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*a;else if(a===1)if(l&&!m)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=u+(n[f]-u)*i}else{const f=h.vertices;for(let u=0;u<r;u++){const p=s[u];d[u]+=p+(n[u]-p)*i-f[u]}}else if(i===0)V.arrayCopy(s,0,d,0,r);else for(let f=0;f<r;f++){const u=s[f];d[f]=u+(n[f]-u)*i}else if(m)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]=(u+(n[f]-u)*i)*a}else{const f=h.vertices;for(let u=0;u<r;u++){const p=s[u],g=f[u];d[u]=g+(p+(n[u]-p)*i-g)*a}}else if(l)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i)*a}else{const f=h.vertices;for(let u=0;u<r;u++){const p=s[u];d[u]+=(p+(n[u]-p)*i-f[u])*a}}else for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i-d[f])*a}}},ls=class It extends Q{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,n){super(t,`29|${s}|${n.sequence.id}`),this.slotIndex=s,this.attachment=n,this.instant=!0}getFrameEntries(){return It.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,n,i,r){const a=this.frames;t*=It.ENTRIES,a[t]=s,a[t+It.MODE]=n|i<<4,a[t+It.DELAY]=r}apply(t,s,n,i,r,a,c,l,o){const h=t.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,o))return;const d=this.attachment.timelineSlots,m=this.frames;if(l||n<m[0]){if(a!==0){this.setupPose(h[this.slotIndex],o);for(const x of d)this.setupPose(h[x],o)}return}const f=Q.search(m,n,It.ENTRIES),u=m[f],p=m[f+It.MODE],g=m[f+It.DELAY];this.applyToSlot(h[this.slotIndex],o,n,u,p,g);for(const x of d)this.applyToSlot(h[x],o,n,u,p,g)}setupPose(t,s){if(!t.bone.active)return;const n=s?t.appliedPose:t.pose;n.attachment===null||n.attachment.timelineAttachment!==this.attachment||(n.sequenceIndex=-1)}applyToSlot(t,s,n,i,r,a){if(!t.bone.active)return;const c=s?t.appliedPose:t.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;let l=r>>4,o=c.attachment.sequence.regions.length;const h=ze[r&15];if(h!==0)switch(l+=(n-i)/a+1e-5|0,h){case 1:l=Math.min(o-1,l);break;case 2:l%=o;break;case 3:{const d=(o<<1)-2;l=d===0?0:l%d,l>=o&&(l=d-l);break}case 4:l=Math.max(o-1-l,0);break;case 5:l=o-1-l%o;break;case 6:{const d=(o<<1)-2;l=d===0?0:(l+o-1)%d,l>=o&&(l=d-l)}}c.sequenceIndex=l}},fe=class hi extends Q{static propertyIds=["13"];events;constructor(t){super(t,...hi.propertyIds),this.events=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,n,i,r,a,c,l,o){if(!i)return;const h=this.frames,d=this.frames.length;if(s>n)this.apply(null,s,Number.MAX_VALUE,i,0,a,!1,!1,!1),s=-1;else if(s>=h[d-1])return;if(n<h[0])return;let m=0;if(s<h[0])m=0;else{m=Q.search(h,s)+1;const f=h[m];for(;m>0&&h[m-1]===f;)m--}for(;m<d&&n>=h[m];m++)i.push(this.events[m])}},kt=class en extends Q{static propertyID="14";static propertyIds=[en.propertyID];drawOrders;constructor(t){super(t,...en.propertyIds),this.drawOrders=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s,n){this.frames[t]=s,this.drawOrders[t]=n}apply(t,s,n,i,r,a,c,l,o){const h=o?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||n<this.frames[0]){a!==0&&V.arrayCopy(d,0,h,0,t.slots.length);return}const m=this.drawOrders[Q.search(this.frames,n)];if(!m)V.arrayCopy(d,0,h,0,t.slots.length);else for(let f=0,u=m.length;f<u;f++)h[f]=d[m[f]]}},Jt=class sn extends Q{static propertyID="15";slots;inFolder;drawOrders;constructor(t,s,n){super(t,...sn.propertyIds(s)),this.slots=s,this.drawOrders=new Array(t),this.inFolder=new Array(n);for(const i of s)this.inFolder[i]=!0;this.instant=!0}static propertyIds(t){const s=t.length,n=new Array(s);for(let i=0;i<s;i++)n[i]=`${sn.propertyID}|${t[i]}`;return n}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(t,s,n){this.frames[t]=s,this.drawOrders[t]=n}apply(t,s,n,i,r,a,c,l,o){const h=o?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||n<this.frames[0])a!==0&&this.setup(h,d);else{const m=this.drawOrders[Q.search(this.frames,n)];if(!m)this.setup(h,d);else{const f=this.inFolder,u=this.slots;for(let p=0,g=0,x=u.length;!(f[h[p].data.index]&&(h[p]=d[u[m[g]]],++g===x));p++);}}}setup(t,s){const{inFolder:n,slots:i}=this;for(let r=0,a=0,c=i.length;!(n[t[r].data.index]&&(t[r]=s[i[a]],++a===c));r++);}};function gn(e){return typeof e=="object"&&e!==null&&typeof e.constraintIndex=="number"}var cs=class extends Ct{constraintIndex=0;constructor(e,t,s){super(e,t,`16|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,n,i,r,a){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i,this.frames[e+4]=r?1:0,this.frames[e+5]=a?1:0}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(!o.active)return;const h=l?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){const x=o.data.setupPose;switch(r){case 1:{h.mix=x.mix,h.softness=x.softness,h.bendDirection=x.bendDirection,h.compress=x.compress,h.stretch=x.stretch;break}case 2:{h.mix+=(x.mix-h.mix)*i,h.softness+=(x.softness-h.softness)*i,h.bendDirection=x.bendDirection,h.compress=x.compress,h.stretch=x.stretch;break}}return}let m=0,f=0;const u=Q.search(d,s,6),p=this.curves[u/6];switch(p){case 0:{const x=d[u];m=d[u+1],f=d[u+2];const b=(s-x)/(d[u+6]-x);m+=(d[u+6+1]-m)*b,f+=(d[u+6+2]-f)*b;break}case 1:m=d[u+1],f=d[u+2];break;default:m=this.getBezierValue(s,u,1,p-2),f=this.getBezierValue(s,u,2,p+18-2)}const g=r===1?o.data.setupPose:h;h.mix=g.mix+(m-g.mix)*i,h.softness=g.softness+(f-g.softness)*i,c?r===1&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[u+3],h.compress=d[u+4]!==0,h.stretch=d[u+5]!==0)}},hs=class extends Ct{constraintIndex=0;constructor(e,t,s){super(e,t,`17|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(e,t,s,n,i,r,a,c){const l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=n,l[e+3]=i,l[e+4]=r,l[e+5]=a,l[e+6]=c}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(!o.active)return;const h=l?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){const y=o.data.setupPose;switch(r){case 1:{h.mixRotate=y.mixRotate,h.mixX=y.mixX,h.mixY=y.mixY,h.mixScaleX=y.mixScaleX,h.mixScaleY=y.mixScaleY,h.mixShearY=y.mixShearY;break}case 2:{h.mixRotate+=(y.mixRotate-h.mixRotate)*i,h.mixX+=(y.mixX-h.mixX)*i,h.mixY+=(y.mixY-h.mixY)*i,h.mixScaleX+=(y.mixScaleX-h.mixScaleX)*i,h.mixScaleY+=(y.mixScaleY-h.mixScaleY)*i,h.mixShearY+=(y.mixShearY-h.mixShearY)*i;break}}return}let m,f,u,p,g,x;const b=Q.search(d,s,7),w=this.curves[b/7];switch(w){case 0:{const y=d[b];m=d[b+1],f=d[b+2],u=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];const T=(s-y)/(d[b+7]-y);m+=(d[b+7+1]-m)*T,f+=(d[b+7+2]-f)*T,u+=(d[b+7+3]-u)*T,p+=(d[b+7+4]-p)*T,g+=(d[b+7+5]-g)*T,x+=(d[b+7+6]-x)*T;break}case 1:m=d[b+1],f=d[b+2],u=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];break;default:m=this.getBezierValue(s,b,1,w-2),f=this.getBezierValue(s,b,2,w+18-2),u=this.getBezierValue(s,b,3,w+36-2),p=this.getBezierValue(s,b,4,w+54-2),g=this.getBezierValue(s,b,5,w+72-2),x=this.getBezierValue(s,b,6,w+90-2)}const v=r===1?o.data.setupPose:h;a?(h.mixRotate=v.mixRotate+m*i,h.mixX=v.mixX+f*i,h.mixY=v.mixY+u*i,h.mixScaleX=v.mixScaleX+p*i,h.mixScaleY=v.mixScaleY+g*i,h.mixShearY=v.mixShearY+x*i):(h.mixRotate=v.mixRotate+(m-v.mixRotate)*i,h.mixX=v.mixX+(f-v.mixX)*i,h.mixY=v.mixY+(u-v.mixY)*i,h.mixScaleX=v.mixScaleX+(p-v.mixScaleX)*i,h.mixScaleY=v.mixScaleY+(g-v.mixScaleY)*i,h.mixShearY=v.mixShearY+(x-v.mixShearY)*i)}},Vt=class extends Gt{constraintIndex;constructor(e,t,s,n){super(e,t,`${n}|${s}`),this.constraintIndex=s}},ds=class extends Vt{constructor(e,t,s){super(e,t,s,18),this.additive=!0}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;h.position=this.getAbsoluteValue(s,i,r,a,h.position,o.data.setupPose.position)}}},us=class extends Vt{constructor(e,t,s){super(e,t,s,19)}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,o.data.setupPose.spacing)}}},fs=class extends Ct{constraintIndex;constructor(e,t,s){super(e,t,`20|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,n,i){const r=this.frames;e<<=2,r[e]=t,r[e+1]=s,r[e+2]=n,r[e+3]=i}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(!o.active)return;const h=l?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){const b=o.data.setupPose;switch(r){case 1:{h.mixRotate=b.mixRotate,h.mixX=b.mixX,h.mixY=b.mixY;break}case 2:{h.mixRotate+=(b.mixRotate-h.mixRotate)*i,h.mixX+=(b.mixX-h.mixX)*i,h.mixY+=(b.mixY-h.mixY)*i;break}}return}let m,f,u;const p=Q.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const b=d[p];m=d[p+1],f=d[p+2],u=d[p+3];const w=(s-b)/(d[p+4]-b);m+=(d[p+4+1]-m)*w,f+=(d[p+4+2]-f)*w,u+=(d[p+4+3]-u)*w;break}case 1:m=d[p+1],f=d[p+2],u=d[p+3];break;default:m=this.getBezierValue(s,p,1,g-2),f=this.getBezierValue(s,p,2,g+18-2),u=this.getBezierValue(s,p,3,g+36-2)}const x=r===1?o.data.setupPose:h;a?(h.mixRotate=x.mixRotate+m*i,h.mixX=x.mixX+f*i,h.mixY=x.mixY+u*i):(h.mixRotate=x.mixRotate+(m-x.mixRotate)*i,h.mixX=x.mixX+(f-x.mixX)*i,h.mixY=x.mixY+(u-x.mixY)*i)}},yt=class extends Vt{constructor(e,t,s,n){super(e,t,s,n)}apply(e,t,s,n,i,r,a,c,l){if(a&&!this.additive&&(a=!1),this.constraintIndex===-1){const o=s>=this.frames[0]?this.getCurveValue(s):0,h=e.physics;for(const d of h)if(d.active&&this.global(d.data)){const m=l?d.appliedPose:d.pose;this.set(m,this.getAbsoluteValue(s,i,r,a,this.get(m),this.get(d.data.setupPose),o))}}else{const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;this.set(h,this.getAbsoluteValue(s,i,r,a,this.get(h),this.get(o.data.setupPose)))}}}},ms=class extends yt{constructor(e,t,s){super(e,t,s,21)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},gs=class extends yt{constructor(e,t,s){super(e,t,s,22)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},ps=class extends yt{constructor(e,t,s){super(e,t,s,23)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},xs=class extends yt{constructor(e,t,s){super(e,t,s,24)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},bs=class extends yt{constructor(e,t,s){super(e,t,s,25),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},ws=class extends yt{constructor(e,t,s){super(e,t,s,26),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},ys=class extends yt{constructor(e,t,s){super(e,t,s,27)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},vs=class di extends Q{static propertyIds=["28"];constraintIndex;constructor(t,s){super(t,...di.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,n,i,r,a,c,l,o){let h;if(this.constraintIndex!==-1&&(h=t.constraints[this.constraintIndex],!h.active))return;const d=this.frames;if(s>n)this.apply(t,s,Number.MAX_VALUE,[],r,a,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(n<d[0])&&(s<d[0]||n>=d[Q.search(d,s)+1]))if(h!=null)h.reset(t);else for(const m of t.physics)m.active&&m.reset(t)}},Ts=class extends Vt{constructor(e,t,s){super(e,t,s,30)}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;h.time=this.getAbsoluteValue(s,i,r,a,h.time,o.data.setupPose.time)}}},Cs=class extends Vt{constructor(e,t,s){super(e,t,s,31),this.additive=!0}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;h.mix=this.getAbsoluteValue(s,i,r,a,h.mix,o.data.setupPose.mix)}}},Ss=class nn{static emptyAnimation=new de("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new xn(this);propertyIds=new Map;animationsChanged=!1;trackEntryPool=new zt(()=>new pn);constructor(t){this.data=t}update(t){t*=this.timeScale;const s=this.tracks;for(let n=0,i=s.length;n<i;n++){const r=s[n];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let a=t*r.timeScale;if(r.delay>0){if(r.delay-=a,r.delay>0)continue;a=-r.delay,r.delay=0}let c=r.next;if(c){const l=r.trackLast-c.delay;if(l>=0){for(c.delay=0,c.trackTime+=r.timeScale===0?0:(l/r.timeScale+t)*c.timeScale,r.trackTime+=a,this.setTrack(n,c,!0);c.mixingFrom;)c.mixTime+=t,c=c.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){s[n]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let l=r.mixingFrom;for(r.mixingFrom=null,l&&(l.mixingTo=null);l;)this.queue.end(l),l=l.mixingFrom}r.trackTime+=a}this.queue.drain()}updateMixingFrom(t,s){const n=t.mixingFrom;if(!n)return!0;const i=this.updateMixingFrom(n,s);if(n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.nextTrackLast!==-1&&t.mixTime>=t.mixDuration){if(n.totalAlpha===0||t.mixDuration===0){if(t.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=t),n.totalAlpha===0)for(let r=t;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(n)}return i}return n.trackTime+=s*n.timeScale,t.mixTime+=s,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,n=this.tracks;let i=!1;for(let c=0,l=n.length;c<l;c++){const o=n[c];if(!o||o.delay>0)continue;i=!0;let h=o.alpha;o.mixingFrom?h*=this.applyMixingFrom(o,t):o.trackTime>=o.trackEnd&&!o.next&&(h=0);let d=o.animationLast,m=o.getAnimationTime(),f=m,u=s;o.reverse&&(f=o.animation.duration-f,u=null);const p=o.animation.timelines,g=p.length;if(c===0&&h===1)for(let x=0;x<g;x++){V.webkit602BugfixHelper(h);const b=p[x];b instanceof Rt?this.applyAttachmentTimeline(b,t,f,1,!0):b.apply(t,d,f,u,h,1,!1,!1,!1)}else{const x=o.timelineMode,b=h>=o.alphaAttachmentThreshold,w=o.additive,v=w||o.shortestRotation,y=!v&&o.timelinesRotation.length!==g<<1;y&&(o.timelinesRotation.length=g<<1);for(let T=0;T<g;T++){const C=p[T],A=x[T]&ks;!v&&C instanceof Ht?this.applyRotateTimeline(C,t,f,h,A,o.timelinesRotation,T<<1,y):C instanceof Rt?this.applyAttachmentTimeline(C,t,f,A,b):(V.webkit602BugfixHelper(h),C.apply(t,d,f,u,h,A,w,!1,!1))}}o.reverse&&this.eventsReverse(o,d,m),this.queueEvents(o,m),s.length=0,o.nextAnimationLast=m,o.nextTrackLast=o.trackTime}const r=this.unkeyedState+Ms,a=t.slots;for(let c=0,l=t.slots.length;c<l;c++){const o=a[c];if(o.attachmentState===r){const h=o.data.attachmentName;o.pose.setAttachment(h?t.getAttachment(o.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,s){const n=t.mixingFrom,i=n.mixingFrom!==null?this.applyMixingFrom(n,s):1,r=t.mix(),a=n.alpha*i,c=1-r*t.alpha,l=a*(1-r),o=c>0?l/c:a,h=n.animation.timelines,d=h.length,m=n.timelineMode,f=n.timelineHoldMix,u=r<n.mixAttachmentThreshold,p=r<n.mixDrawOrderThreshold,g=n.additive,x=g||n.shortestRotation,b=!x&&n.timelinesRotation.length!==d<<1;b&&(n.timelinesRotation.length=d<<1);const w=n.timelinesRotation;let v=n.animationLast,y=n.getAnimationTime(),T=y,C=null;n.reverse?T=n.animation.duration-T:r<n.eventThreshold&&(C=this.events),n.totalAlpha=0;for(let A=0;A<d;A++){const k=h[A],S=m[A],I=S&ks;let P=0;if((S&Zt)!==0){const F=f[A];P=F==null?o:o*(1-F.mix())}else{if(!p&&k instanceof kt&&I===0)continue;P=l}if(n.totalAlpha+=P,!x&&k instanceof Ht)this.applyRotateTimeline(k,s,T,P,I,w,A<<1,b);else if(k instanceof Rt)this.applyAttachmentTimeline(k,s,T,I,u&&P>=n.alphaAttachmentThreshold);else{const F=!p||!(k instanceof kt)||I===0;k.apply(s,v,T,C,P,I,g,F,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,v,y),t.mixDuration>0&&this.queueEvents(n,y),this.events.length=0,n.nextAnimationLast=y,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(t,s,n,i,r){const a=s.slots[t.slotIndex];if(!a.bone.active||!r&&a.attachmentState===this.unkeyedState+Ps)return;let c=n<t.frames[0],l=null;if(c||(l=t.attachmentNames[Q.search(t.frames,n)],c=!r&&l==null),c){if(i===0)return;l=a.data.attachmentName}a.pose.setAttachment(l==null?null:s.getAttachment(a.data.index,l)),r?a.attachmentState=this.unkeyedState+Ps:c||(a.attachmentState=this.unkeyedState+Ms)}applyRotateTimeline(t,s,n,i,r,a,c,l){if(l&&(a[c]=0),i===1){t.apply(s,0,n,null,1,r,!1,!1,!1);return}const o=s.bones[t.boneIndex];if(!o.active)return;const h=o.pose,d=o.data.setupPose,m=t.frames;let f,u;if(n<m[0]){switch(r){case 1:{h.rotation=d.rotation;return}case 0:return}f=h.rotation,u=d.rotation}else f=r===1?d.rotation:h.rotation,u=d.rotation+t.getCurveValue(n);let p=0,g=u-f;if(g-=Math.ceil(g/360-.5)*360,g===0)p=a[c];else{let x=0,b=0;l?(x=0,b=g):(x=a[c],b=a[c+1]);const w=x-x%360;p=g+w;let v=g>=0,y=x>=0;Math.abs(b)<=90&&L.signum(b)!==L.signum(g)&&(Math.abs(x-w)>180?(p+=360*L.signum(x),y=v):w!==0?p-=360*L.signum(x):y=v),y!==v&&(p+=360*L.signum(x)),a[c]=p}a[c+1]=g,h.rotation=f+p*i}queueEvents(t,s){const n=t.animationStart,i=t.animationEnd,r=i-n,a=t.reverse;let c=t.trackLast%r;a&&(c=r-c);const l=this.events;let o=0,h=l.length;for(;o<h;o++){const m=l[o];if(m.time<c!==a)break;m.time>=n&&m.time<=i&&this.queue.event(t,m)}let d=!1;if(t.loop)if(r===0)d=!0;else{const m=Math.floor(t.trackTime/r);d=m>0&&m>Math.floor(t.trackLast/r)}else d=s>=i&&t.animationLast<i;for(d&&this.queue.complete(t);o<h;o++){const m=l[o];m.time>=n&&m.time<=i&&this.queue.event(t,m)}}eventsReverse(t,s,n){const i=t.animation.duration,r=i-s,a=i-n,c=t.animation.timelines;for(let l=0,o=t.animation.timelines.length;l<o;l++){const h=c[l];if(!(h instanceof fe))continue;const d=h.events,m=h.frames,f=m.length;if(r>=a){for(let u=0;u<f;u++)if(!(m[u]<a)){if(m[u]>=r)break;this.events.push(d[u])}}else{for(let p=0;p<f&&!(m[p]>=r);p++)this.events.push(d[p]);let u=0;for(;u<f&&!(m[u]>=a);u++);for(;u<f;u++)this.events.push(d[u])}}}clearTracks(){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");if(t>=this.tracks.length)return;const s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let n=s;for(;;){const i=n.mixingFrom;if(!i)break;this.queue.end(i),n.mixingFrom=null,n.mixingTo=null,n=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(t,s,n){const i=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,i&&(i.next=null,n&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,n=!1){return typeof s=="string"?this.setAnimation1(t,s,n):this.setAnimation2(t,s,n)}setAnimation1(t,s,n=!1){const i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(t,i,n)}setAnimation2(t,s,n=!1){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(t);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const a=this.trackEntry(t,s,n,r);return this.setTrack(t,a,i),this.queue.drain(),a}addAnimation(t,s,n=!1,i=0){return typeof s=="string"?this.addAnimation1(t,s,n,i):this.addAnimation2(t,s,n,i)}addAnimation1(t,s,n=!1,i=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(t,r,n,i)}addAnimation2(t,s,n=!1,i=0){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(t);if(r)for(;r.next;)r=r.next;const a=this.trackEntry(t,s,n,r);return r?(r.next=a,a.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-a.mixDuration,0))):(this.setTrack(t,a,!0),this.queue.drain(),i<0&&(i=0)),a.delay=i,a}setEmptyAnimation(t,s=0){const n=this.setAnimation(t,nn.emptyAnimation,!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(t,s=0,n=0){const i=this.addAnimation(t,nn.emptyAnimation,!1,n);return n<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(t=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,i=this.tracks.length;n<i;n++){const r=this.tracks[n];r&&this.setEmptyAnimation(r.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(V.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,n,i){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=t,r.animation=s,r.loop=n,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.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,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1;const t=this.tracks;for(let s=0,n=t.length;s<n;s++){const i=t[s];if(!i)continue;let r=i;for(;r.mixingFrom;)r=r.mixingFrom;do this.computeHold(r,i),r=r.mixingTo;while(r)}this.propertyIds.clear()}computeHold(t,s){const n=t.animation.timelines,i=t.animation.timelines.length,r=t.timelineMode;r.length=i;const a=t.timelineHoldMix;a.length=0;const c=t.additive,l=t.keepHold,o=t.mixingTo;for(let h=0;h<i;h++){const d=n[h],m=d.propertyIds,f=this.from(s,d,m);if(c&&d.additive){r[h]=f;continue}let u;if(o===null||d.instant||o.additive&&d.additive||!o.animation?.hasTimeline(m))u=f;else{u=f|Zt;for(let p=o.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(m)){p.mixDuration>0&&(a[h]=p);break}}l&&(u=u&~Zt|r[h]&Zt),r[h]=u}}from(t,s,n){const i=this.propertyIds;let r=wn;for(let a=0,c=n.length;a<c;a++){const l=i.get(n[a]);if(l===void 0)i.set(n[a],t);else{if(l!==t){for(;++a<c;)i.has(n[a])||i.set(n[a],t);return As}r=Is}}if(s instanceof Jt){const a=i.get(kt.propertyID);if(a!=null)return a!==t?As:Is}return r}getTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},pn=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;mixDuration=0;totalAlpha=0;mixInterpolation=qt.linear;setMixDuration(e,t){this.mixDuration=e,t!==void 0&&(t<=0&&(t=this.previous==null?0:Math.max(t+this.previous.getTrackComplete()-e,0)),this.delay=t)}setMixInterpolation(e){if(!e)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=e}mix(){if(this.mixDuration===0)return 1;let e=this.mixTime/this.mixDuration;return e>=1?1:this.mixInterpolation===qt.linear?e:(e=this.mixInterpolation.apply(e),e<0?0:e>1?1:e)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=qt.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const e=this.animationEnd-this.animationStart;return e===0?this.animationStart:this.trackTime%e+this.animationStart}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const 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}},xn=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let e=0;e<this.objects.length;e+=2){const t=this.objects,s=t[e],n=t[e+1],i=this.animState.listeners.slice();switch(s){case 0:n.listener?.start&&n.listener.start(n);for(let r=0;r<i.length;r++){const a=i[r];a.start&&a.start(n)}break;case 1:n.listener?.interrupt&&n.listener.interrupt(n);for(let r=0;r<i.length;r++){const a=i[r];a.interrupt&&a.interrupt(n)}break;case 2:n.listener?.end&&n.listener.end(n);for(let r=0;r<i.length;r++){const a=i[r];a.end&&a.end(n)}case 3:n.listener?.dispose&&n.listener.dispose(n);for(let r=0;r<i.length;r++){const a=i[r];a.dispose&&a.dispose(n)}this.animState.trackEntryPool.free(n);break;case 4:n.listener?.complete&&n.listener.complete(n);for(let r=0;r<i.length;r++){const a=i[r];a.complete&&a.complete(n)}break;case 5:{const r=t[e+++2];n.listener?.event&&n.listener.event(n,r);for(let a=0;a<i.length;a++){const c=i[a];c.event&&c.event(n,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},bn=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(bn||{}),Mi=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},As=0,wn=1,Is=2,ks=3,Zt=4,Ms=1,Ps=2,yn=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){return typeof e=="string"?this.setMix1(e,t,s):this.setMix2(e,t,s)}setMix1(e,t,s){const n=this.skeletonData.findAnimation(e);if(!n)throw new Error(`Animation not found: ${e}`);const i=this.skeletonData.findAnimation(t);if(!i)throw new Error(`Animation not found: ${t}`);this.setMix2(n,i,s)}setMix2(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");const n=`${e.name}.${t.name}`;this.animationToMixTime[n]=s}getMix(e,t){const s=`${e.name}.${t.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}},Pi=class{constructor(e,t="",s=new Tn,n=new vn){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=n}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{const n=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(n)};requestAnimationFrame(n)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((n,i)=>{this.downloader.downloadBinary(e,r=>{this.success(t,e,r),n(r)},(r,a)=>{const c=`Couldn't load binary ${e}: status ${r}, ${a}`;this.error(s,e,c),i(c)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,n=>{this.success(t,e,n)},(n,i)=>{this.error(s,e,`Couldn't load text ${e}: status ${n}, ${i}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((n,i)=>{this.downloader.downloadJson(e,r=>{this.success(t,e,r),n(r)},(r,a)=>{const c=`Couldn't load JSON ${e}: status ${r}, ${a}`;this.error(s,e,c),i(c)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const n=this.cache.getAsset(e),i=n!==void 0;return i&&(this.cache.assetsLoaded[e]=n.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(t,e,r),r)).catch(r=>{this.error(s,e,r)})),i}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),this.reuseAssets(e,t,s))return;const n=this.texturePmaInfo[e];this.cache.assetsLoaded[e]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(l=>{if(l.ok)return l.blob();const o=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(o)}).then(l=>l?createImageBitmap(l,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(l=>{if(l){const o=this.createTexture(e,n,l);this.success(t,e,o),i(o)}});else{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>{const o=this.createTexture(e,n,l);this.success(t,e,o),i(o)},l.onerror=()=>{const o=`Couldn't load image: ${e}`;this.error(s,e,o),r(o)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),l.src=e}})}loadTextureAtlas(e,t=()=>{},s=()=>{},n){const i=e.lastIndexOf("/"),r=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((a,c)=>{this.downloader.downloadText(e,l=>{try{const o=this.createTextureAtlas(l,r,e,n);let h=o.pages.length,d=!1;if(h===0){this.success(t,e,o),a(o);return}for(const m of o.pages)this.loadTexture(this.texturePath(r,m.name,n),(f,u)=>{d||(m.setTexture(u),--h===0&&(this.success(t,e,o),a(o)))},(f,u)=>{if(!d){const p=`Couldn't load texture ${e} page image: ${f}`;this.error(s,e,p),c(p)}d=!0})}catch(o){const h=`Couldn't parse texture atlas ${e}: ${o.message}`;this.error(s,e,h),c(h)}},(l,o)=>{const h=`Couldn't load texture atlas ${e}: status ${l}, ${o}`;this.error(s,e,h),c(h)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{}){const n=e.lastIndexOf("/"),i=n>=0?e.substring(0,n+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,a)=>{this.downloader.downloadText(e,c=>{try{const l=this.createTextureAtlas(c,i,e);this.success(t,e,l),r(l)}catch(l){const o=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,o),a(o)}},(c,l)=>{const o=`Couldn't load texture atlas ${e}: status ${c}, ${l}`;this.error(s,e,o),a(o)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(n,i)=>t(i),(n,i)=>s(i))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;const t=this.cache.assets[e];if(t)return t;const s=this.errors[e];throw Error(`Asset not found: ${e}${s?`
${s}`:""}`)}remove(e){e=this.pathPrefix+e;const t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(const e in this.cache.assets){const t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){const t=this.cache.assets[e];if(t instanceof he){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t,s,n){const i=new he(e);i.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of i.pages)r.texture?.dispose()}};for(const r of i.pages){const a=this.texturePath(t,r.name,n);this.texturePmaInfo[this.pathPrefix+a]=r.pma}return i}createTexture(e,t,s){const n=this.textureLoader(s,t),i=n.dispose.bind(n);return n.dispose=()=>{this.disposeAssetInternal(e)&&i()},n}texturePath(e,t,s){return s?s[t]:e+t}},vn=class De{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=De.AVAILABLE_CACHES.get(t);if(s)return s;const n=new De;return De.AVAILABLE_CACHES.set(t,n),n}async addAsset(t,s){return this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=s,s}getAsset(t){return this.assetsLoaded[t]}},Tn=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!==-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){var t=window.atob(e),s=t.length,n=new Uint8Array(s);for(let i=0;i<s;i++)n[i]=t.charCodeAt(i);return n}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t===-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const n=this.rawDataUris[e];if(n&&!n.includes(".")){try{this.finish(e,200,this.dataUriToString(n))}catch(a){this.finish(e,400,JSON.stringify(a))}return}const i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",n||e,!0);const r=()=>{this.finish(e,i.status,i.responseText)};i.onload=r,i.onerror=r,i.send()}downloadJson(e,t,s){this.downloadText(e,n=>{t(JSON.parse(n))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const n=this.rawDataUris[e];if(n&&!n.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(n))}catch(a){this.finish(e,400,JSON.stringify(a))}return}const i=new XMLHttpRequest;i.open("GET",n||e,!0),i.responseType="arraybuffer";const 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 n=this.callbacks[e];try{if(n)return!0;this.callbacks[e]=n=[]}finally{n.push(t,s)}}finish(e,t,s){const n=this.callbacks[e];if(delete this.callbacks[e],t===200||t===0)for(let i=0,r=n.length;i<r;i+=2)n[i](s);else for(let i=1,r=n.length;i<r;i+=2)n[i](t,s)}},Fs=class ui extends vt{color=new z(1,1,1,1);constructor(t){super(t)}copy(){const t=new ui(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Mt=class fi extends vt{endSlot=null;convex=!1;inverse=!1;color=new z(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){const t=new fi(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.convex=this.convex,t.inverse=this.inverse,t.color.setFromColor(this.color),t}},jt=class mi extends vt{lengths=[];closed=!1;constantSpeed=!1;color=new z(1,1,1,1);constructor(t){super(t)}copy(){const t=new mi(this.name);return this.copyTo(t),t.lengths=[],V.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=this.closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},Cn=class gi extends vt{x=0;y=0;rotation=0;color=new z(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*L.degRad,n=Math.cos(s),i=Math.sin(s),r=n*t.a+i*t.b,a=n*t.c+i*t.d;return L.atan2Deg(a,r)}copy(){const t=new gi(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},Sn=class{atlas;allowMissingRegions;constructor(e,t=!1){this.atlas=e,this.allowMissingRegions=t}findRegions(e,t,s){const n=s.regions;for(let i=0,r=n.length;i<r;i++)n[i]=this.findRegion(e,s.getPath(t,i))}findRegion(e,t){const s=this.atlas.findRegion(t);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${t} (attachment: ${e})`);return s}newRegionAttachment(e,t,s,n,i){return this.findRegions(s,n,i),new Tt(s,i)}newMeshAttachment(e,t,s,n,i){return this.findRegions(s,n,i),new wt(s,i)}newBoundingBoxAttachment(e,t,s){return new Fs(s)}newPathAttachment(e,t,s){return new jt(s)}newPointAttachment(e,t,s){return new Cn(s)}newClippingAttachment(e,t,s){return new Mt(s)}},me=class{name;setupPose;skinRequired=!1;constructor(e,t){if(e==null)throw new Error("name cannot be null.");this.name=e,this.setupPose=t}},Ys=class pi extends me{index=0;parent=null;length=0;color=new z;icon;iconSize=1;iconRotation=0;visible=!1;constructor(t,s,n){if(super(s,new pe),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=t,this.parent=n}copy(t){const s=new pi(this.index,this.name,t);return s.length=this.length,s.setupPose.set(this.setupPose),s}},ge=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(ge||{}),pe=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(e){if(e==null)throw new Error("pose cannot be null.");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}setPosition(e,t){this.x=e,this.y=t}setScale(e,t){this.scaleX=e,this.scaleY=t===void 0?e:t}getInherit(){return this.inherit}setInherit(e){if(e==null)throw new Error("inherit cannot be null.");this.inherit=e}update(e,t){this.world!==e._update&&this.updateWorldTransform(e)}updateWorldTransform(e){this.local===e._update?this.updateLocalTransform(e):this.world=e._update;const t=this.rotation,s=this.scaleX,n=this.scaleY,i=this.shearX,r=this.shearY;if(!this.bone.parent){const d=e.scaleX,m=e.scaleY,f=(t+i)*L.degRad,u=(t+90+r)*L.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(u)*n*d,this.c=Math.sin(f)*s*m,this.d=Math.sin(u)*n*m,this.worldX=this.x*d+e.x,this.worldY=this.y*m+e.y;return}const a=this.bone.parent.appliedPose;let c=a.a,l=a.b,o=a.c,h=a.d;switch(this.worldX=c*this.x+l*this.y+a.worldX,this.worldY=o*this.x+h*this.y+a.worldY,this.inherit){case 0:{const d=(t+i)*L.degRad,m=(t+90+r)*L.degRad,f=Math.cos(d)*s,u=Math.cos(m)*n,p=Math.sin(d)*s,g=Math.sin(m)*n;this.a=c*f+l*p,this.b=c*u+l*g,this.c=o*f+h*p,this.d=o*u+h*g;return}case 1:{const d=e.scaleX,m=e.scaleY,f=(t+i)*L.degRad,u=(t+90+r)*L.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(u)*n*d,this.c=Math.sin(f)*s*m,this.d=Math.sin(u)*n*m;break}case 2:{const d=e.scaleX,m=e.scaleY,f=1/d,u=1/m;c*=f,o*=u;let p=c*c+o*o,g=0;p>L.epsilon2?(p=Math.abs(c*h*u-l*f*o)/p,l=o*p,h=c*p,g=t-L.atan2Deg(o,c)):(c=0,o=0,g=t-90+L.atan2Deg(h,l));const x=(g+i)*L.degRad,b=(g+r+90)*L.degRad,w=Math.cos(x)*s,v=Math.cos(b)*n,y=Math.sin(x)*s,T=Math.sin(b)*n;this.a=(c*w-l*y)*d,this.b=(c*v-l*T)*d,this.c=(o*w+h*y)*m,this.d=(o*v+h*T)*m;break}case 3:case 4:{const d=e.scaleX,m=e.scaleY,f=1/d,u=1/m,p=t*L.degRad,g=Math.cos(p),x=Math.sin(p);let b=(c*g+l*x)*f,w=(o*g+h*x)*u;const v=1/Math.sqrt(b*b+w*w);b*=v,w*=v;let y=-w,T=b;this.inherit===3&&c*h-l*o<0!=(d<0!=m<0)&&(y=-y,T=-T);const C=i*L.degRad,A=(90+r)*L.degRad,k=Math.cos(C)*s,S=Math.cos(A)*n,I=Math.sin(C)*s,P=Math.sin(A)*n;this.a=(b*k+y*I)*d,this.b=(b*S+y*P)*d,this.c=(w*k+T*I)*m,this.d=(w*S+T*P)*m;break}}}updateLocalTransform(e){this.local=0,this.world=e._update;const t=e.scaleX,s=e.scaleY;if(!this.bone.parent){const g=1/t,x=1/s;this.x=(this.worldX-e.x)*g,this.y=(this.worldY-e.y)*x,this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);return}const n=this.bone.parent.appliedPose;let i=n.a,r=n.b,a=n.c,c=n.d;const l=i*c-r*a,o=1/(i*c-r*a),h=c*o,d=r*o,m=a*o,f=i*o,u=this.worldX-n.worldX,p=this.worldY-n.worldY;switch(this.x=u*h-p*d,this.y=p*f-u*m,this.inherit){case 0:this.set5(h*this.a-d*this.c,h*this.b-d*this.d,f*this.c-m*this.a,f*this.d-m*this.b,0);break;case 1:{const g=1/t,x=1/s;this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);break}case 2:{const g=1/t,x=1/s;i*=g,a*=x;const b=this.a*g,w=this.b*g,v=this.c*x,y=this.d*x,T=1/(i*i+a*a),C=1/Math.abs(l*g*x);this.set5((i*b+a*v)*T,(i*w+a*y)*T,(i*v-a*b)*C,(i*y-a*w)*C,L.atan2Deg(a,i));break}case 3:case 4:{const g=1/t,x=1/s,b=this.a*g,w=this.b*g,v=this.c*x,y=this.d*x;let T=c*this.a-r*this.c,C=i*this.c-a*this.a;l<0&&(T=-T,C=-C);let A=L.atan2Deg(C,T);this.rotation=A,A*=L.degRad;const k=Math.cos(A),S=Math.sin(A);let I=(i*k+r*S)*g,P=(a*k+c*S)*x;const F=1/Math.sqrt(I*I+P*P);I*=F,P*=F;const B=this.inherit===3&&l<0!=(t<0!=s<0)?-1:1;this.set4(I*b+P*v,I*w+P*y,(I*v-P*b)*B,(I*y-P*w)*B)}}}set4(e,t,s,n){const i=e*e+s*s,r=t*t+n*n;i>L.epsilon2?(this.shearX=L.atan2Deg(s,e),this.scaleX=Math.sqrt(i)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(r),r>L.epsilon2?(this.shearY=L.atan2Deg(n,t),e*n-t*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(e,t,s,n,i){this.shearX=0;const r=e*e+s*s,a=t*t+n*n;if(r>L.epsilon2){const c=L.atan2Deg(s,e);this.rotation=c+i,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(a),a>L.epsilon2?(this.shearY=L.atan2Deg(n,t),e*n-t*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-c):this.shearY-=90+c,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(a),this.shearY=0,this.rotation=a>L.epsilon2?L.atan2Deg(n,t)-90+i:i}validateLocalTransform(e){this.local===e._update&&this.updateLocalTransform(e)}modifyLocal(e){this.local===e._update&&this.updateLocalTransform(e),this.world=0,this.resetWorld(e,e._update)}modifyWorld(e){const t=e._update;this.local=t,this.world=t,this.resetWorld(e,t)}resetWorld(e,t){const s=this.bone.children;for(let n=0,i=s.length;n<i;n++){const r=s[n].appliedPose;r.world===t&&(r.local===t&&r.updateLocalTransform(e),r.world=0,r.resetWorld(e,t))}}getWorldRotationX(){return L.atan2Deg(this.c,this.a)}getWorldRotationY(){return L.atan2Deg(this.d,this.b)}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){if(e==null)throw new Error("world cannot be null.");const t=this.a*this.d-this.b*this.c,s=e.x-this.worldX,n=e.y-this.worldY;return e.x=(s*this.d-n*this.b)/t,e.y=(n*this.a-s*this.c)/t,e}localToWorld(e){if(e==null)throw new Error("local cannot be null.");const 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.bone.parent==null?e:this.bone.parent.appliedPose.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.localToWorld(e)}worldToLocalRotation(e){e*=L.degRad;const t=Math.sin(e),s=Math.cos(e);return L.atan2Deg(this.a*t-this.c*s,this.d*s-this.b*t)+this.rotation-this.shearX}localToWorldRotation(e){e=(e-this.rotation-this.shearX)*L.degRad;const t=Math.sin(e),s=Math.cos(e);return L.atan2Deg(s*this.c+t*this.d,s*this.a+t*this.b)}rotateWorld(e){e*=L.degRad;const t=Math.sin(e),s=Math.cos(e),n=this.a,i=this.b;this.a=s*n-t*this.c,this.b=s*i-t*this.d,this.c=t*n+s*this.c,this.d=t*i+s*this.d}},Es=class{data;pose;constrainedPose;appliedPose;constructor(e,t,s){if(e==null)throw new Error("data cannot be null.");this.data=e,this.pose=t,this.constrainedPose=s,this.appliedPose=t}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},Bs=class extends Es{active=!1;constructor(e,t,s){super(e,t,s),this.setupPose()}isActive(){return this.active}},xe=class xi extends Bs{parent=null;children=[];sorted=!1;constructor(t,s){super(t,new pe,new pe),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(t){const s=new xi(this.data,t);return s.pose.set(this.pose),s}},Nt=class extends Bs{constructor(e,t,s){super(e,t,s)}isSourceActive(){return!0}},An=class{_setupPose;pose;constrainedPose;appliedPose;constructor(e){this._setupPose=e,this.pose=[...e],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,V.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,V.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},Dt=class extends me{constructor(e,t){super(e,t)}},be=(e=>(e[e.None=0]="None",e[e.Uniform=1]="Uniform",e[e.Volume=2]="Volume",e))(be||{}),we=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Xs=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(e){if(e==null)throw new Error("audioPath cannot be null.");this._audioPath=e}setupPose=new we(-1,this);constructor(e){this.name=e}},ye=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(e){this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}},In=class Et extends Nt{bones;target;constructor(t,s){if(super(t,new ye,new ye),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of t.bones)this.bones.push(s.bones[n.index].constrainedPose);this.target=s.bones[t.target.index]}copy(t){var s=new Et(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:Et.apply(t,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Et.apply(t,r[0],r[1],i.worldX,i.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(t){t.sortBone(this.target);const s=this.bones[0].bone;t.sortBone(s),t._updateCache.push(this),s.sorted=!1,t.sortReset(s.children),t.constrained(s),this.bones.length>1&&t.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(t,s,n,i,r,a,c,l,o,h){typeof n=="number"?Et.apply1(t,s,n,i,r,a,c,l):Et.apply2(t,s,n,i,r,a,c,l,o,h)}static apply1(t,s,n,i,r,a,c,l){s.modifyLocal(t);const o=s.bone.parent.appliedPose;let h=o.a,d=o.b,m=o.c,f=o.d,u=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*L.signum(t.scaleX),g=(i-s.worldY)*L.signum(t.scaleY);break;case 2:{const x=Math.abs(h*f-d*m)/Math.max(L.epsilon,h*h+m*m),b=h/t.scaleX,w=m/t.scaleY;d=-w*x*t.scaleX,f=b*x*t.scaleY,u+=L.atan2Deg(w,b)}default:{const x=n-o.worldX,b=i-o.worldY,w=h*f-d*m;Math.abs(w)<=L.epsilon?(p=0,g=0):(p=(x*f-b*d)/w-s.x,g=(b*h-x*m)/w-s.y)}}if(u+=L.atan2Deg(g,p),s.scaleX<0&&(u+=180),u>180?u-=360:u<=-180&&(u+=360),s.rotation+=u*l,r||a){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const x=s.bone.data.length*s.scaleX;if(x>L.epsilon){const b=p*p+g*g;if(r&&b<x*x||a&&b>x*x){const w=(Math.sqrt(b)/x-1)*l+1;switch(s.scaleX*=w,c){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(t,s,n,i,r,a,c,l,o,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(t),n.modifyLocal(t);let d=s.x,m=s.y,f=s.scaleX,u=s.scaleY,p=n.scaleX,g=0,x=0,b=0;f<0?(f=-f,g=180,b=-1):(g=0,b=1),u<0&&(u=-u,b=-b),p<0?(p=-p,x=180):x=0;let w=0,v=0,y=s.a,T=s.b,C=s.c,A=s.d;const k=Math.abs(f-u)<=L.epsilon;!k||c?(n.y=0,w=y*n.x+s.worldX,v=C*n.x+s.worldY):(w=y*n.x+T*n.y+s.worldX,v=C*n.x+A*n.y+s.worldY);const S=s.bone.parent.appliedPose;y=S.a,T=S.b,C=S.c,A=S.d;let I=y*A-T*C,P=w-S.worldX,F=v-S.worldY;I=Math.abs(I)<=L.epsilon?0:1/I;const B=(P*A-F*T)*I-d,X=(F*y-P*C)*I-m;let R=Math.sqrt(B*B+X*X),_=n.bone.data.length*p,D,Y;if(R<L.epsilon){Et.apply(t,s,i,r,!1,c,0,h),n.rotation=0;return}P=i-S.worldX,F=r-S.worldY;let E=(P*A-F*T)*I-d,U=(F*y-P*C)*I-m,O=E*E+U*U;if(o!==0){o*=f*(p+1)*.5;const N=Math.sqrt(O),q=N-R-_*f+o;if(q>0){let $=Math.min(1,q/(o*2))-1;$=(q-o*(1-$*$))/N,E-=$*E,U-=$*U,O=E*E+U*U}}t:if(k){_*=f;let N=(O-R*R-_*_)/(2*R*_);if(N<-1)N=-1,Y=Math.PI*a;else if(N>1){if(N=1,Y=0,c)switch(y=(Math.sqrt(O)/(R+_)-1)*h+1,s.scaleX*=y,l){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y<.7?.25+.642857*y:y}}else Y=Math.acos(N)*a;y=R+_*N,T=_*Math.sin(Y),D=Math.atan2(U*y-E*T,E*y+U*T)}else{y=f*_,T=u*_;const N=y*y,q=T*T,$=Math.atan2(U,E);C=q*R*R+N*O-N*q;const J=-2*q*R,et=q-N;if(A=J*J-4*et*C,A>=0){let gt=Math.sqrt(A);J<0&&(gt=-gt),gt=-(J+gt)*.5;let bt=gt/et,$t=C/gt;const ae=Math.abs(bt)<Math.abs($t)?bt:$t;if(bt=O-ae*ae,bt>=0){F=Math.sqrt(bt)*a,D=$-Math.atan2(F,ae),Y=Math.atan2(F/u,(ae-R)/f);break t}}let Z=L.PI,st=R-y,rt=st*st,nt=0,ut=0,ot=R+y,at=ot*ot,ft=0;C=-y*R/(N-q),C>=-1&&C<=1&&(C=Math.acos(C),P=y*Math.cos(C)+R,F=T*Math.sin(C),A=P*P+F*F,A<rt&&(Z=C,rt=A,st=P,nt=F),A>at&&(ut=C,at=A,ot=P,ft=F)),O<=(rt+at)*.5?(D=$-Math.atan2(nt*a,st),Y=Z*a):(D=$-Math.atan2(ft*a,ot),Y=ut*a)}const W=Math.atan2(n.y,n.x)*b;D=(D-W)*L.radDeg+g-s.rotation,D>180?D-=360:D<=-180&&(D+=360),s.rotation+=D*h,Y=((Y+W)*L.radDeg-n.shearX)*b+x-n.rotation,Y>180?Y-=360:Y<=-180&&(Y+=360),n.rotation+=Y*h}},Qt=class extends Dt{bones=[];_target=null;set target(e){this._target=e}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(e){this._scaleYMode=e}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(e){super(e,new ye)}create(e){return new In(this,e)}},ve=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(e){this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}},te=class extends Dt{bones=[];set slot(e){this._slot=e}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(e){super(e,new ve)}create(e){return new kn(this,e)}},Ls=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Ls||{}),Rs=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))(Rs||{}),Vs=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(Vs||{}),kn=class Bt extends Nt{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(t,s){if(super(t,new ve,new ve),!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const n of this.data.bones)this.bones.push(s.bones[n.index].constrainedPose);this.slot=s.slots[t.slot.index]}copy(t){var s=new Bt(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.slot.appliedPose.attachment;if(!(n instanceof jt))return;const i=this.appliedPose,r=i.mixRotate,a=i.mixX,c=i.mixY;if(r===0&&a===0&&c===0)return;const l=this.data,o=l.rotateMode===0,h=l.rotateMode===2,d=this.bones,m=d.length,f=o?m:m+1,u=V.setArraySize(this.spaces,f),p=h?this.lengths=V.setArraySize(this.lengths,m):[],g=i.spacing;switch(l.spacingMode){case 2:if(h)for(let T=0,C=f-1;T<C;T++){const A=d[T],k=A.bone.data.length,S=k*A.a,I=k*A.c;p[T]=Math.sqrt(S*S+I*I)}V.arrayFill(u,1,f,g);break;case 3:{let T=0;for(let C=0,A=f-1;C<A;){const k=d[C],S=k.bone.data.length;if(S<L.epsilon)h&&(p[C]=0),u[++C]=g;else{const I=S*k.a,P=S*k.c,F=Math.sqrt(I*I+P*P);h&&(p[C]=F),u[++C]=F,T+=F}}if(T>0){T=f/T*g;for(let C=1;C<f;C++)u[C]*=T}break}default:{const T=l.spacingMode===0;for(let C=0,A=f-1;C<A;){const k=d[C],S=k.bone.data.length;if(S<L.epsilon)h&&(p[C]=0),u[++C]=g;else{const I=S*k.a,P=S*k.c,F=Math.sqrt(I*I+P*P);h&&(p[C]=F),u[++C]=(T?Math.max(0,S+g):g)*F/S}}}}const x=this.computeWorldPositions(t,n,f,o);let b=x[0],w=x[1],v=l.offsetRotation,y=!1;if(v===0)y=l.rotateMode===1;else{y=!1;const T=this.slot.bone.appliedPose;v*=T.a*T.d-T.b*T.c>0?L.degRad:-L.degRad}for(let T=0,C=3;T<m;T++,C+=3){const A=d[T];A.modifyWorld(t),A.worldX+=(b-A.worldX)*a,A.worldY+=(w-A.worldY)*c;const k=x[C],S=x[C+1],I=k-b,P=S-w;if(h){const F=p[T];if(F!==0){const B=(Math.sqrt(I*I+P*P)/F-1)*r+1;A.a*=B,A.c*=B}}if(b=k,w=S,r>0){let F=A.a,B=A.b,X=A.c,R=A.d,_=0,D=0,Y=0;if(o?_=x[C-1]:u[T+1]===0?_=x[C+2]:_=Math.atan2(P,I),_-=Math.atan2(X,F),y){D=Math.cos(_),Y=Math.sin(_);const E=A.bone.data.length;b+=(E*(D*F-Y*X)-I)*r,w+=(E*(Y*F+D*X)-P)*r}else _+=v;_>L.PI?_-=L.PI2:_<-L.PI&&(_+=L.PI2),_*=r,D=Math.cos(_),Y=Math.sin(_),A.a=D*F-Y*X,A.b=D*B-Y*R,A.c=Y*F+D*X,A.d=Y*B+D*R}}}computeWorldPositions(t,s,n,i){const r=this.slot;let a=this.appliedPose.position,c=this.spaces,l=V.setArraySize(this.positions,n*3+2),o=this.world;const h=s.closed;let d=s.worldVerticesLength,m=d/6,f=Bt.NONE;if(!s.constantSpeed){const Y=s.lengths;m-=h?1:2;const E=Y[m];this.data.positionMode===1&&(a*=E);let U;switch(this.data.spacingMode){case 2:U=E;break;case 3:U=E/n;break;default:U=1}o=V.setArraySize(this.world,8);for(let O=0,W=0,N=0;O<n;O++,W+=3){const q=c[O]*U;a+=q;let $=a;if(h)$%=E,$<0&&($+=E),N=0;else if($<0){f!==Bt.BEFORE&&(f=Bt.BEFORE,s.computeWorldVertices(t,r,2,4,o,0,2)),this.addBeforePosition($,o,0,l,W);continue}else if($>E){f!==Bt.AFTER&&(f=Bt.AFTER,s.computeWorldVertices(t,r,d-6,4,o,0,2)),this.addAfterPosition($-E,o,0,l,W);continue}for(;;N++){const J=Y[N];if(!($>J)){if(N===0)$/=J;else{const et=Y[N-1];$=($-et)/(J-et)}break}}N!==f&&(f=N,h&&N===m?(s.computeWorldVertices(t,r,d-4,4,o,0,2),s.computeWorldVertices(t,r,0,4,o,4,2)):s.computeWorldVertices(t,r,N*6+2,8,o,0,2)),this.addCurvePosition($,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],l,W,i||O>0&&q===0)}return l}h?(d+=2,o=V.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d-4,o,0,2),s.computeWorldVertices(t,r,0,2,o,d-4,2),o[d-2]=o[0],o[d-1]=o[1]):(m--,d-=4,o=V.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d,o,0,2));const u=V.setArraySize(this.curves,m);let p=0,g=o[0],x=o[1],b=0,w=0,v=0,y=0,T=0,C=0,A=0,k=0,S=0,I=0,P=0,F=0,B=0,X=0;for(let Y=0,E=2;Y<m;Y++,E+=6)b=o[E],w=o[E+1],v=o[E+2],y=o[E+3],T=o[E+4],C=o[E+5],A=(g-b*2+v)*.1875,k=(x-w*2+y)*.1875,S=((b-v)*3-g+T)*.09375,I=((w-y)*3-x+C)*.09375,P=A*2+S,F=k*2+I,B=(b-g)*.75+A+S*.16666667,X=(w-x)*.75+k+I*.16666667,p+=Math.sqrt(B*B+X*X),B+=P,X+=F,P+=S,F+=I,p+=Math.sqrt(B*B+X*X),B+=P,X+=F,p+=Math.sqrt(B*B+X*X),B+=P+S,X+=F+I,p+=Math.sqrt(B*B+X*X),u[Y]=p,g=T,x=C;this.data.positionMode===1&&(a*=p);let R;switch(this.data.spacingMode){case 2:R=p;break;case 3:R=p/n;break;default:R=1}const _=this.segments;let D=0;for(let Y=0,E=0,U=0,O=0;Y<n;Y++,E+=3){const W=c[Y]*R;a+=W;let N=a;if(h)N%=p,N<0&&(N+=p),U=0,O=0;else if(N<0){this.addBeforePosition(N,o,0,l,E);continue}else if(N>p){this.addAfterPosition(N-p,o,d-4,l,E);continue}for(;;U++){const q=u[U];if(!(N>q)){if(U===0)N/=q;else{const $=u[U-1];N=(N-$)/(q-$)}break}}if(U!==f){f=U;let q=U*6;for(g=o[q],x=o[q+1],b=o[q+2],w=o[q+3],v=o[q+4],y=o[q+5],T=o[q+6],C=o[q+7],A=(g-b*2+v)*.03,k=(x-w*2+y)*.03,S=((b-v)*3-g+T)*.006,I=((w-y)*3-x+C)*.006,P=A*2+S,F=k*2+I,B=(b-g)*.3+A+S*.16666667,X=(w-x)*.3+k+I*.16666667,D=Math.sqrt(B*B+X*X),_[0]=D,q=1;q<8;q++)B+=P,X+=F,P+=S,F+=I,D+=Math.sqrt(B*B+X*X),_[q]=D;B+=P,X+=F,D+=Math.sqrt(B*B+X*X),_[8]=D,B+=P+S,X+=F+I,D+=Math.sqrt(B*B+X*X),_[9]=D,O=0}for(N*=D;;O++){const q=_[O];if(!(N>q)){if(O===0)N/=q;else{const $=_[O-1];N=O+(N-$)/(q-$)}break}}this.addCurvePosition(N*.1,g,x,b,w,v,y,T,C,l,E,i||Y>0&&W===0)}return l}addBeforePosition(t,s,n,i,r){const a=s[n],c=s[n+1],l=s[n+2]-a,o=s[n+3]-c,h=Math.atan2(o,l);i[r]=a+t*Math.cos(h),i[r+1]=c+t*Math.sin(h),i[r+2]=h}addAfterPosition(t,s,n,i,r){const a=s[n+2],c=s[n+3],l=a-s[n],o=c-s[n+1],h=Math.atan2(o,l);i[r]=a+t*Math.cos(h),i[r+1]=c+t*Math.sin(h),i[r+2]=h}addCurvePosition(t,s,n,i,r,a,c,l,o,h,d,m){if(t===0||Number.isNaN(t)){h[d]=s,h[d+1]=n,h[d+2]=Math.atan2(r-n,i-s);return}const f=t*t,u=f*t,p=1-t,g=p*p,x=g*p,b=p*t,w=b*3,v=p*w,y=w*t,T=s*x+i*v+a*y+l*u,C=n*x+r*v+c*y+o*u;h[d]=T,h[d+1]=C,m&&(t<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(C-(n*g+r*b*2+c*f),T-(s*g+i*b*2+a*f)))}sort(t){const s=this.slot.data.index,n=this.slot.bone;t.skin!=null&&this.sortPathSlot(t,t.skin,s,n),t.data.defaultSkin!=null&&t.data.defaultSkin!==t.skin&&this.sortPathSlot(t,t.data.defaultSkin,s,n),this.sortPath(t,this.slot.pose.attachment,n);const i=this.bones,r=this.bones.length;for(let a=0;a<r;a++){const c=i[a].bone;t.sortBone(c),t.constrained(c)}t._updateCache.push(this);for(let a=0;a<r;a++)t.sortReset(i[a].bone.children);for(let a=0;a<r;a++)i[a].bone.sorted=!0}sortPathSlot(t,s,n,i){const r=s.getAttachments();for(let a=0,c=r.length;a<c;a++){const l=r[a];l.slotIndex===n&&this.sortPath(t,l.attachment,i)}}sortPath(t,s,n){if(!(s instanceof jt))return;const i=s.bones;if(i==null)t.sortBone(n);else{const r=t.bones;for(let a=0,c=i.length;a<c;){let l=i[a++];for(l+=a;a<l;)t.sortBone(r[i[a++]])}}}isSourceActive(){return this.slot.bone.active}},Mn=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Mn||{}),Te=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(e){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}},Ce=class{color=new z(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(e){if(e==null)throw new Error("pose cannot be null.");this.color.setFromColor(e.color),this.darkColor!=null&&e.darkColor!=null&&this.darkColor.setFromColor(e.darkColor),this.attachment=e.attachment,this.sequenceIndex=e.sequenceIndex,this.deform.length=0,this.deform.push(...e.deform)}getAttachment(){return this.attachment}setAttachment(e){this.attachment!==e&&((!(e instanceof vt)||!(this.attachment instanceof vt)||e.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}},Pn=class bi extends Es{skeleton;bone;attachmentState=0;constructor(t,s){if(super(t,new Ce,new Ce),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[t.boneData.index],t.setupPose.darkColor!=null&&(this.pose.darkColor=new z,this.constrainedPose.darkColor=new z),this.setupPose()}copy(t,s,n){const i=new bi(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new z,i.constrainedPose.darkColor=new z),i.pose.set(t.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},Ot=class Oe{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Oe.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Oe.yDir}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=[];for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i;if(!n.parent)i=new xe(n,null);else{const r=this.bones[n.parent.index];i=new xe(n,r),r.children.push(i)}this.bones.push(i)}this.slots=[];for(const s of this.data.slots)this.slots.push(new Pn(s,this));this.drawOrder=new An(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const n=s.create(this);n instanceof Ns&&this.physics.push(n),this.constraints.push(n)}this.color=new z(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const t=this.slots;for(let a=0,c=t.length;a<c;a++)t[a].unconstrained();const s=this.bones,n=s.length;for(let a=0,c=n;a<c;a++){const l=s[a];l.sorted=l.data.skinRequired,l.active=!l.sorted,l.unconstrained()}if(this.skin){const a=this.skin.bones;for(let c=0,l=this.skin.bones.length;c<l;c++){let o=this.bones[a[c].index];do o.sorted=!1,o.active=!0,o=o.parent;while(o)}}const i=this.constraints;let r=this.constraints.length;for(let a=0;a<r;a++)i[a].unconstrained();for(let a=0;a<r;a++){const c=i[a];c.active=c.isSourceActive()&&(!c.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(c.data)),c.active&&c.sort(this)}for(let a=0;a<n;a++)this.sortBone(s[a]);r=this._updateCache.length;for(let a=0;a<r;a++){const c=this._updateCache[a];c instanceof xe&&(this._updateCache[a]=c.appliedPose)}}constrained(t){t.pose===t.appliedPose&&(t.constrained(),this.resetCache.push(t))}sortBone(t){if(t.sorted||!t.active)return;const s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,n=t.length;s<n;s++){const i=t[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(t){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let i=0,r=this.resetCache.length;i<r;i++)s[i].resetConstrained();const n=this._updateCache;for(let i=0,r=this._updateCache.length;i<r;i++)n[i].update(this,t)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const t=this.bones;for(let n=0,i=t.length;n<i;n++)t[n].setupPose();const s=this.constraints;for(let n=0,i=s.length;n<i;n++)s[n].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const t=this.slots;for(let s=0,n=t.length;s<n;s++)t[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");const s=this.bones;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===t)return s[n];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const s=this.slots;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===t)return s[n];return null}setSkin(t){typeof t=="string"?this.setSkinByName(t):this.setSkinBySkin(t)}setSkinByName(t){const s=this.data.findSkin(t);if(!s)throw new Error(`Skin not found: ${t}`);this.setSkin(s)}setSkinBySkin(t){if(t!==this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{const s=this.slots;for(let n=0,i=s.length;n<i;n++){const r=s[n],a=r.data.attachmentName;if(a){const c=t.getAttachment(n,a);c&&r.pose.setAttachment(c)}}}this.skin=t,this.updateCache()}}getAttachment(t,s){return typeof t=="string"?this.getAttachmentByName(t,s):this.getAttachmentByIndex(t,s)}getAttachmentByName(t,s){const n=this.data.findSlot(t);if(!n)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(n.index,s)}getAttachmentByIndex(t,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const n=this.skin.getAttachment(t,s);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");const n=this.findSlot(t);if(!n)throw new Error(`Slot not found: ${t}`);let i=null;if(s&&(i=this.getAttachment(n.data.index,s),!i))throw new Error(`Attachment not found: ${s}, for slot: ${t}`);n.pose.setAttachment(i)}findConstraint(t,s){if(t==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const n=this.constraints;for(let i=0,r=n.length;i<r;i++){const a=n[i];if(a instanceof s&&a.data.name===t)return a}return null}getBoundsRect(t){const s=new le,n=new le;return this.getBounds(s,n,void 0,t),{x:s.x,y:s.y,width:n.x,height:n.y}}getBounds(t,s,n=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,a=r;let c=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let d=0,m=r.length;d<m;d++){const f=a[d];if(!f.bone.active)continue;let u=0,p=null,g=null;const x=f.appliedPose.attachment;if(x){if(x instanceof Tt)u=8,p=V.setArraySize(n,u,0),x.computeWorldVertices(f,x.getOffsets(f.appliedPose),p,0,2),g=Oe.quadTriangles;else if(x instanceof wt)u=x.worldVerticesLength,p=V.setArraySize(n,u,0),x.computeWorldVertices(this,f,0,u,p,0,2),g=x.triangles;else if(x instanceof Mt&&i){i.clipEnd(f),i.clipStart(this,f,x);continue}if(p&&g){i?.isClipping()&&i.clipTriangles(p,g,g.length)&&(p=i.clippedVertices,u=i.clippedVertices.length);for(let b=0,w=p.length;b<w;b+=2){const v=p[b],y=p[b+1];c=Math.min(c,v),l=Math.min(l,y),o=Math.max(o,v),h=Math.max(h,y)}}}i&&i.clipEnd(f)}i&&i.clipEnd(),t.set(c,l),s.set(o-c,h-l)}setScale(t,s){this.scaleX=t,this.scaleY=s}setPosition(t,s){this.x=t,this.y=s}update(t){this.time+=t}physicsTranslate(t,s){const n=this.physics;for(let i=0,r=n.length;i<r;i++)n[i].translate(t,s)}physicsRotate(t,s,n){const i=this.physics;for(let r=0,a=i.length;r<a;r++)i[r].rotate(t,s,n)}},Ns=class wi extends Nt{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(t,s){if(super(t,new Te,new Te),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[t.bone.index].constrainedPose}copy(t){var s=new wi(this.data,t);return s.pose.set(this.pose),s}reset(t){this.remaining=0,this.lastTime=t.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(t,s){this.ux-=t,this.uy-=s,this.cx-=t,this.cy-=s}rotate(t,s,n){const i=n*L.degRad,r=Math.cos(i),a=Math.sin(i),c=this.cx-t,l=this.cy-s;this.translate(c*r-l*a-c,c*a+l*r-l)}update(t,s){const n=this.appliedPose,i=n.mix;if(i===0)return;const r=this.data.x>0,a=this.data.y>0,c=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone;let h=o.bone.data.length,d=this.data.step,m=0;if(s!==0){switch(o.modifyWorld(t),s){case 1:this.reset(t);case 2:{const f=Math.max(t.time-this.lastTime,0),u=this.remaining;this.remaining+=f,this.lastTime=t.time;const p=o.worldX,g=o.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let x=this.remaining,b=n.inertia,w=t.data.referenceScale,v=-1,y=0,T=0,C=this.data.limit*f,A=C*Math.abs(t.scaleY);if(C*=Math.abs(t.scaleX),r||a){if(r){const k=(this.ux-p)*b;this.xOffset+=k>C?C:k<-C?-C:k,this.ux=p}if(a){const k=(this.uy-g)*b;this.yOffset+=k>A?A:k<-A?-A:k,this.uy=g}if(x>=d){const k=this.xOffset,S=this.yOffset;v=n.damping**(60*d),y=d*n.massInverse,T=n.strength;const I=w*n.wind,P=w*n.gravity,F=(I*t.windX+P*t.gravityX)*t.scaleX,B=(I*t.windY+P*t.gravityY)*t.scaleY;do r&&(this.xVelocity+=(F-this.xOffset*T)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=v),a&&(this.yVelocity-=(B+this.yOffset*T)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=v),x-=d;while(x>=d);this.xLag=this.xOffset-k,this.yLag=this.yOffset-S}m=Math.max(0,1-x/d),r&&(o.worldX+=(this.xOffset-this.xLag*m)*i*this.data.x),a&&(o.worldY+=(this.yOffset-this.yLag*m)*i*this.data.y)}if(c||l){let k=Math.atan2(o.c,o.a),S=0,I=0,P=0,F=this.cx-o.worldX,B=this.cy-o.worldY;if(F>C?F=C:F<-C&&(F=-C),B>A?B=A:B<-A&&(B=-A),x=this.remaining,c){P=(this.data.rotate+this.data.shearX)*i,m=this.rotateLag*Math.max(0,1-u/d);let X=Math.atan2(B+this.ty,F+this.tx)-k-(this.rotateOffset-m)*P;this.rotateOffset+=(X-Math.ceil(X*L.invPI2-.5)*L.PI2)*b,X=(this.rotateOffset-m)*P+k,S=Math.cos(X),I=Math.sin(X),l&&(X=h*o.getWorldScaleX(),X>0&&(this.scaleOffset+=(F*S+B*I)*b/X))}else{S=Math.cos(k),I=Math.sin(k);const X=h*o.getWorldScaleX()-this.scaleLag*Math.max(0,1-u/d);X>0&&(this.scaleOffset+=(F*S+B*I)*b/X)}if(x>=d){v===-1&&(v=n.damping**(60*d),y=d*n.massInverse,T=n.strength);const X=n.wind*t.windX+n.gravity*t.gravityX,R=(n.wind*t.windY+n.gravity*t.gravityY)*Ot.yDir,_=this.rotateOffset,D=this.scaleOffset,Y=h/w;for(;;)if(x-=d,l&&(this.scaleVelocity+=(X*S-R*I-this.scaleOffset*T)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),c){if(this.rotateVelocity-=((X*I+R*S)*Y+this.rotateOffset*T)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,x<d)break;const E=this.rotateOffset*P+k;S=Math.cos(E),I=Math.sin(E)}else if(x<d)break;this.rotateLag=this.rotateOffset-_,this.scaleLag=this.scaleOffset-D}m=Math.max(0,1-x/d)}this.remaining=x}this.cx=o.worldX,this.cy=o.worldY;break}case 3:m=Math.max(0,1-this.remaining/d),r&&(o.worldX+=(this.xOffset-this.xLag*m)*i*this.data.x),a&&(o.worldY+=(this.yOffset-this.yLag*m)*i*this.data.y)}if(c){let f=(this.rotateOffset-this.rotateLag*m)*i,u=0,p=0,g=0;if(this.data.shearX>0){let x=0;this.data.rotate>0&&(x=f*this.data.rotate,u=Math.sin(x),p=Math.cos(x),g=o.b,o.b=p*g-u*o.d,o.d=u*g+p*o.d),x+=f*this.data.shearX,u=Math.sin(x),p=Math.cos(x),g=o.a,o.a=p*g-u*o.c,o.c=u*g+p*o.c}else f*=this.data.rotate,u=Math.sin(f),p=Math.cos(f),g=o.a,o.a=p*g-u*o.c,o.c=u*g+p*o.c,g=o.b,o.b=p*g-u*o.d,o.d=u*g+p*o.d}if(l){let f=1+(this.scaleOffset-this.scaleLag*m)*i*this.data.scaleX;switch(o.a*=f,o.c*=f,this.data.scaleYMode){case 1:o.b*=f,o.d*=f;break;case 2:f=Math.abs(f),f=f>=.7?1/f:4-3.67347*f,o.b*=f,o.d*=f}}s!==3&&(this.tx=h*o.a,this.ty=h*o.c)}}sort(t){const s=this.bone.bone;t.sortBone(s),t._updateCache.push(this),t.sortReset(s.children),t.constrained(s)}isSourceActive(){return this.bone.bone.active}},ee=class extends Dt{set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;_scaleYMode=0;get scaleYMode(){return this._scaleYMode}set scaleYMode(e){if(e==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=e}constructor(e){super(e,new Te)}create(e){return new Ns(this,e)}};typeof Math.fround>"u"&&(Math.fround=(e=>t=>(e[0]=t,e[0]))(new Float32Array(1)));var Se=class{time=0;mix=0;set(e){this.time=e.time,this.mix=e.mix}},Fn=class rn extends Nt{static offsets=[0,0,0,0,0,0];bone=null;constructor(t,s){if(super(t,new Se,new Se),!s)throw new Error("skeleton cannot be null.");t.bone!=null&&(this.bone=s.bones[t.bone.index])}copy(t){var s=new rn(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.data,r=i.animation,a=this.bone;if(a!==null){if(!a.active)return;i.local&&a.appliedPose.validateLocalTransform(t),n.time=i.offset+(i.property.value(t,a.appliedPose,i.local,rn.offsets)-i.property.offset)*i.scale,i.loop?n.time=r.duration+n.time%r.duration:n.time=Math.max(0,n.time)}const c=t.bones,l=r.bones;for(let o=0,h=r.bones.length;o<h;o++)c[l[o]].appliedPose.modifyLocal(t);r.apply(t,n.time,n.time,i.loop,null,n.mix,0,i.additive,!1,!0)}sort(t){const s=this.bone,n=this.data;s&&!n.local&&t.sortBone(s),t._updateCache.push(this);const i=t.bones,r=n.animation.bones;for(let d=0,m=n.animation.bones.length;d<m;d++){const f=i[r[d]];f.sorted=!1,t.sortReset(f.children),t.constrained(f)}const a=n.animation.timelines,c=t.slots,l=t.constraints,o=t.physics,h=t.physics.length;for(let d=0,m=n.animation.timelines.length;d<m;d++){const f=a[d];if(fn(f))t.constrained(c[f.slotIndex]);else if(f instanceof kt||f instanceof Jt)t.drawOrder.constrained();else if(f instanceof yt)if(f.constraintIndex===-1)for(let u=0;u<h;u++)t.constrained(o[u]);else t.constrained(l[f.constraintIndex]);else if(gn(f)){const u=f.constraintIndex;u!==-1&&t.constrained(l[u])}}}},At=class extends Dt{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;max=0;constructor(e){super(e,new Se)}create(e){return new Fn(this,e)}},Ae=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let s=0,n=t.length;s<n;s++)if(t[s].name===e)return t[s];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const t=this.slots;for(let s=0,n=t.length;s<n;s++)if(t[s].name===e)return t[s];return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");const t=this.skins;for(let s=0,n=t.length;s<n;s++)if(t[s].name===e)return t[s];return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");const t=this.events;for(let s=0,n=t.length;s<n;s++)if(t[s].name===e)return t[s];return null}findSliderAnimations(e){const t=this.constraints;for(let s=0,n=this.constraints.length;s<n;s++){const i=t[s];i instanceof At&&i.animation!=null&&e.push(i.animation)}return e}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");const t=this.animations;for(let s=0,n=t.length;s<n;s++)if(t[s].name===e)return t[s];return null}findConstraint(e,t){if(!e)throw new Error("constraintName cannot be null.");if(t==null)throw new Error("type cannot be null.");const s=this.constraints;for(let n=0,i=this.constraints.length;n<i;n++){const r=s[n];if(r instanceof t&&r.name===e)return r}return null}},Ds=class{slotIndex=0;placeholder;attachment;constructor(e=0,t,s){this.slotIndex=e,this.placeholder=t,this.attachment=s}},se=class{name;attachments=[];bones=[];constraints=[];color=new z(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");const n=this.attachments;e>=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=s}addSkin(e){for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){const n=e.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const t=e.getAttachments();for(let s=0;s<t.length;s++){const n=t[s];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(e){for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){const n=e.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const t=e.getAttachments();for(let s=0;s<t.length;s++){const n=t[s];n.attachment&&(n.attachment instanceof wt?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(e,t){const s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){const s=this.attachments[e];s&&delete s[t]}getAttachments(){const e=[];for(let t=0;t<this.attachments.length;t++){const s=this.attachments[t];if(s)for(const n in s){const i=s[n];i&&e.push(new Ds(t,n,i))}}return e}getAttachmentsForSlot(e,t){const s=this.attachments[e];if(s)for(const n in s){const i=s[n];i&&t.push(new Ds(e,n,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let n=0;n<e.slots.length;n++){const i=e.slots[n],r=i.pose.getAttachment();if(r&&s<t.attachments.length){const a=t.attachments[s];for(const c in a){const l=a[c];if(r===l){const o=this.getAttachment(s,c);o&&i.pose.setAttachment(o);break}}}s++}}},Os=class extends me{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(super(t,new Ce),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.boneData=s}},_s=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(_s||{}),Ie=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(e){this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}},Yn=class yi extends Nt{bones;source;constructor(t,s){if(super(t,new Ie,new Ie),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of t.bones)this.bones.push(s.bones[i.index].constrainedPose);const n=s.bones[t.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(t){var s=new yi(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const i=this.data,r=i.localSource,a=i.localTarget,c=i.additive,l=i.clamp,o=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(t);const d=i.properties,m=i.properties.length,f=this.bones;for(let u=0,p=this.bones.length;u<p;u++){const g=f[u];a?g.modifyLocal(t):g.modifyWorld(t);for(let x=0;x<m;x++){const b=d[x],w=b.value(t,h,r,o)-b.offset,v=b.to;for(let y=0,T=b.to.length;y<T;y++){const C=v[y];if(C.mix(n)!==0){let A=C.offset+w*C.scale;l&&(C.offset<C.max?A=L.clamp(A,C.offset,C.max):A=L.clamp(A,C.max,C.offset)),C.apply(t,n,g,A,a,c)}}}}}sort(t){this.data.localSource||t.sortBone(this.source);const s=this.bones,n=this.bones.length,i=!this.data.localTarget;if(i)for(let r=0;r<n;r++)t.sortBone(s[r].bone);t._updateCache.push(this);for(let r=0;r<n;r++){const a=s[r].bone;t.sortReset(a.children),t.constrained(a)}for(let r=0;r<n;r++)s[r].bone.sorted=i}isSourceActive(){return this.source.active}},K=class dt extends Dt{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(t){this._source=t}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(t){super(t,new Ie)}create(t){return new Yn(this,t)}getOffsetRotation(){return this.offsets[dt.ROTATION]}setOffsetRotation(t){this.offsets[dt.ROTATION]=t}getOffsetX(){return this.offsets[dt.X]}setOffsetX(t){this.offsets[dt.X]=t}getOffsetY(){return this.offsets[dt.Y]}setOffsetY(t){this.offsets[dt.Y]=t}getOffsetScaleX(){return this.offsets[dt.SCALEX]}setOffsetScaleX(t){this.offsets[dt.SCALEX]=t}getOffsetScaleY(){return this.offsets[dt.SCALEY]}setOffsetScaleY(t){this.offsets[dt.SCALEY]=t}getOffsetShearY(){return this.offsets[dt.SHEARY]}setOffsetShearY(t){this.offsets[dt.SHEARY]=t}},Pt=class{offset=0;to=[]},Ft=class{offset=0;max=0;scale=0},ke=class extends Pt{value(e,t,s,n){if(s)return t.rotation+n[K.ROTATION];const i=e.scaleX,r=e.scaleY;let a=Math.atan2(t.c/r,t.a/i)*L.radDeg+((t.a*t.d-t.b*t.c)*i*r>0?n[K.ROTATION]:-n[K.ROTATION]);return a<0&&(a+=360),a}},Us=class extends Ft{mix(e){return e.mixRotate}apply(e,t,s,n,i,r){if(i)s.rotation+=(r?n:n-s.rotation)*t.mixRotate;else{const a=e.scaleX,c=e.scaleY,l=1/a,o=1/c,h=s.a*l,d=s.b*l,m=s.c*o,f=s.d*o;n*=L.degRad,r||(n-=Math.atan2(m,h)),n>L.PI?n-=L.PI2:n<-L.PI&&(n+=L.PI2),n*=t.mixRotate;const u=Math.cos(n),p=Math.sin(n);s.a=(u*h-p*m)*a,s.b=(u*d-p*f)*a,s.c=(p*h+u*m)*c,s.d=(p*d+u*f)*c}}},Me=class extends Pt{value(e,t,s,n){return s?t.x+n[K.X]:(n[K.X]*t.a+n[K.Y]*t.b+t.worldX)/e.scaleX}},$s=class extends Ft{mix(e){return e.mixX}apply(e,t,s,n,i,r){i?s.x+=(r?n:n-s.x)*t.mixX:(r||(n-=s.worldX/e.scaleX),s.worldX+=n*t.mixX*e.scaleX)}},Pe=class extends Pt{value(e,t,s,n){return s?t.y+n[K.Y]:(n[K.X]*t.c+n[K.Y]*t.d+t.worldY)/e.scaleY}},qs=class extends Ft{mix(e){return e.mixY}apply(e,t,s,n,i,r){i?s.y+=(r?n:n-s.y)*t.mixY:(r||(n-=s.worldY/e.scaleY),s.worldY+=n*t.mixY*e.scaleY)}},Fe=class extends Pt{value(e,t,s,n){if(s)return t.scaleX+n[K.SCALEX];const i=t.a/e.scaleX,r=t.c/e.scaleY;return Math.sqrt(i*i+r*r)+n[K.SCALEX]}},zs=class extends Ft{mix(e){return e.mixScaleX}apply(e,t,s,n,i,r){if(i)r?s.scaleX*=1+(n-1)*t.mixScaleX:s.scaleX!==0&&(s.scaleX+=(n-s.scaleX)*t.mixScaleX);else if(r){const a=1+(n-1)*t.mixScaleX;s.a*=a,s.c*=a}else{let a=s.a/e.scaleX,c=s.c/e.scaleY,l=Math.sqrt(a*a+c*c);l!==0&&(l=1+(n-l)*t.mixScaleX/l,s.a*=l,s.c*=l)}}},Ye=class extends Pt{value(e,t,s,n){if(s)return t.scaleY+n[K.SCALEY];const i=t.b/e.scaleX,r=t.d/e.scaleY;return Math.sqrt(i*i+r*r)+n[K.SCALEY]}},Ws=class extends Ft{mix(e){return e.mixScaleY}apply(e,t,s,n,i,r){if(i)r?s.scaleY*=1+(n-1)*t.mixScaleY:s.scaleY!==0&&(s.scaleY+=(n-s.scaleY)*t.mixScaleY);else if(r){const a=1+(n-1)*t.mixScaleY;s.b*=a,s.d*=a}else{let a=s.b/e.scaleX,c=s.d/e.scaleY,l=Math.sqrt(a*a+c*c);l!==0&&(l=1+(n-l)*t.mixScaleY/l,s.b*=l,s.d*=l)}}},Ee=class extends Pt{value(e,t,s,n){if(s)return t.shearY+n[K.SHEARY];const i=1/e.scaleX,r=1/e.scaleY;return(Math.atan2(t.d*r,t.b*i)-Math.atan2(t.c*r,t.a*i))*L.radDeg-90+n[K.SHEARY]}},Gs=class extends Ft{mix(e){return e.mixShearY}apply(e,t,s,n,i,r){if(i)r||(n-=s.shearY),s.shearY+=n*t.mixShearY;else{const a=e.scaleX,c=e.scaleY,l=s.b/a,o=s.d/c,h=Math.atan2(o,l);n=(n+90)*L.degRad,r?n-=L.PI/2:(n-=h-Math.atan2(s.c/c,s.a/a),n>L.PI?n-=L.PI2:n<-L.PI&&(n+=L.PI2)),n=h+n*t.mixShearY;const d=Math.sqrt(l*l+o*o);s.b=Math.cos(n)*d*a,s.d=Math.sin(n)*d*c}}},En=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new Ae;s.name="";const n=new Bn(e),i=n.readInt32(),r=n.readInt32();s.hash=r===0&&i===0?null:r.toString(16)+i.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*t;const a=n.readBoolean();a&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let c=0;c=n.readInt(!0);for(let f=0;f<c;f++){const u=n.readString();if(!u)throw new Error("String in string table must not be null.");n.strings.push(u)}const l=s.bones;c=n.readInt(!0);for(let f=0;f<c;f++){const u=n.readString();if(!u)throw new Error("Bone name must not be null.");const p=f===0?null:l[n.readInt(!0)],g=new Ys(f,u,p),x=g.setupPose;x.rotation=n.readFloat(),x.x=n.readFloat()*t,x.y=n.readFloat()*t,x.scaleX=n.readFloat(),x.scaleY=n.readFloat(),x.shearX=n.readFloat(),x.shearY=n.readFloat(),x.inherit=n.readByte(),g.length=n.readFloat()*t,g.skinRequired=n.readBoolean(),a&&(z.rgba8888ToColor(g.color,n.readInt32()),g.icon=n.readString()??void 0,g.iconSize=n.readFloat(),g.iconRotation=n.readFloat(),g.visible=n.readBoolean()),l.push(g)}c=n.readInt(!0);for(let f=0;f<c;f++){const u=n.readString();if(!u)throw new Error("Slot name must not be null.");const p=l[n.readInt(!0)],g=new Os(f,u,p);z.rgba8888ToColor(g.setupPose.color,n.readInt32());const x=n.readInt32();x!==-1&&z.rgb888ToColor(g.setupPose.darkColor=new z,x),g.attachmentName=n.readStringRef(),g.blendMode=n.readInt(!0),a&&(g.visible=n.readBoolean()),s.slots.push(g)}const o=s.constraints,h=n.readInt(!0);for(let f=0;f<h;f++){const u=n.readString();if(!u)throw new Error("Constraint data name must not be null.");let p;switch(n.readByte()){case Ji:{const g=new Qt(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[n.readInt(!0)]);g.target=l[n.readInt(!0)];const x=n.readByte();g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.scaleYMode=n.readUnsignedByte());const b=g.setupPose;b.bendDirection=(x&4)!==0?-1:1,b.compress=(x&8)!==0,b.stretch=(x&16)!==0,(x&32)!==0&&(b.mix=(x&64)!==0?n.readFloat():1),(x&128)!==0&&(b.softness=n.readFloat()*t),o.push(g);break}case ji:{const g=new K(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[n.readInt(!0)]);g.source=l[n.readInt(!0)];let x=n.readUnsignedByte();g.skinRequired=(x&1)!==0,g.localSource=(x&2)!==0,g.localTarget=(x&4)!==0,g.additive=(x&8)!==0,g.clamp=(x&16)!==0,p=x>>5;for(let w=0,v;w<p;w++){let y=1,T;switch(n.readByte()){case 0:T=new ke;break;case 1:{y=t,T=new Me;break}case 2:{y=t,T=new Pe;break}case 3:T=new Fe;break;case 4:T=new Ye;break;case 5:T=new Ee;break;default:T=null}if(T){T.offset=n.readFloat()*y,v=n.readByte();for(let C=0;C<v;C++){let A=1,k;switch(n.readByte()){case 0:k=new Us;break;case 1:{A=t,k=new $s;break}case 2:{A=t,k=new qs;break}case 3:k=new zs;break;case 4:k=new Ws;break;case 5:k=new Gs;break;default:k=null}k&&(k.offset=n.readFloat()*A,k.max=n.readFloat()*A,k.scale=n.readFloat()*A/y,T.to[C]=k)}g.properties[w]=T}}x=n.readByte(),(x&1)!==0&&(g.offsets[K.ROTATION]=n.readFloat()),(x&2)!==0&&(g.offsets[K.X]=n.readFloat()*t),(x&4)!==0&&(g.offsets[K.Y]=n.readFloat()*t),(x&8)!==0&&(g.offsets[K.SCALEX]=n.readFloat()),(x&16)!==0&&(g.offsets[K.SCALEY]=n.readFloat()),(x&32)!==0&&(g.offsets[K.SHEARY]=n.readFloat()),x=n.readByte();const b=g.setupPose;(x&1)!==0&&(b.mixRotate=n.readFloat()),(x&2)!==0&&(b.mixX=n.readFloat()),(x&4)!==0&&(b.mixY=n.readFloat()),(x&8)!==0&&(b.mixScaleX=n.readFloat()),(x&16)!==0&&(b.mixScaleY=n.readFloat()),(x&32)!==0&&(b.mixShearY=n.readFloat()),o.push(g);break}case Zi:{const g=new te(u);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(l[n.readInt(!0)]);g.slot=s.slots[n.readInt(!0)];const x=n.readByte();g.skinRequired=(x&1)!==0,g.positionMode=x>>1&1,g.spacingMode=x>>2&3,g.rotateMode=x>>4&3,(x&128)!==0&&(g.offsetRotation=n.readFloat());const b=g.setupPose;b.position=n.readFloat(),g.positionMode===0&&(b.position*=t),b.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(b.spacing*=t),b.mixRotate=n.readFloat(),b.mixX=n.readFloat(),b.mixY=n.readFloat(),o.push(g);break}case Qi:{const g=new ee(u);g.bone=l[n.readInt(!0)];let x=n.readByte();if(g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.x=n.readFloat()),(x&4)!==0&&(g.y=n.readFloat()),(x&8)!==0&&(g.rotate=n.readFloat()),(x&16)!==0){let w=n.readFloat();w<-2?(g.scaleYMode=2,w=-2-w):w<0&&(g.scaleYMode=1,w=-1-w),g.scaleX=w}(x&32)!==0&&(g.shearX=n.readFloat()),g.limit=((x&64)!==0?n.readFloat():5e3)*t,g.step=1/n.readUnsignedByte();const b=g.setupPose;b.inertia=n.readFloat(),b.strength=n.readFloat(),b.damping=n.readFloat(),b.massInverse=(x&128)!==0?n.readFloat():1,b.wind=n.readFloat(),b.gravity=n.readFloat(),x=n.readByte(),(x&1)!==0&&(g.inertiaGlobal=!0),(x&2)!==0&&(g.strengthGlobal=!0),(x&4)!==0&&(g.dampingGlobal=!0),(x&8)!==0&&(g.massGlobal=!0),(x&16)!==0&&(g.windGlobal=!0),(x&32)!==0&&(g.gravityGlobal=!0),(x&64)!==0&&(g.mixGlobal=!0),b.mix=(x&128)!==0?n.readFloat():1,o.push(g);break}case tr:{const g=new At(u),x=n.readByte();if(g.skinRequired=(x&1)!==0,g.loop=(x&2)!==0,g.additive=(x&4)!==0,(x&8)!==0){const b=n.readFloat();a&&(x&64)!==0?g.max=b:g.setupPose.time=b}if((x&16)!==0&&(g.setupPose.mix=(x&32)!==0?n.readFloat():1),(x&64)!==0){g.local=(x&128)!==0,g.bone=l[n.readInt(!0)];const b=n.readFloat();let w=1;switch(n.readByte()){case 0:g.property=new ke;break;case 1:{w=t,g.property=new Me;break}case 2:{w=t,g.property=new Pe;break}case 3:g.property=new Fe;break;case 4:g.property=new Ye;break;case 5:g.property=new Ee;break;default:continue}g.property.offset=b*w,g.offset=n.readFloat(),g.scale=n.readFloat()/w}o.push(g);break}}}const d=this.readSkin(n,s,!0,a);d&&(s.defaultSkin=d,s.skins.push(d));{let f=s.skins.length;for(V.setArraySize(s.skins,c=f+n.readInt(!0));f<c;f++){const u=this.readSkin(n,s,!1,a);if(!u)throw new Error("readSkin() should not have returned null.");s.skins[f]=u}}c=this.linkedMeshes.length;for(let f=0;f<c;f++){const u=this.linkedMeshes[f],p=s.skins[u.skinIndex];if(!u.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(u.sourceIndex,u.source);if(!g)throw new Error(`Source mesh not found: ${u.source}`);u.mesh.timelineAttachment=u.inheritTimelines?g:u.mesh,u.mesh.setSourceMesh(g),u.mesh.updateSequence()}this.linkedMeshes.length=0,c=n.readInt(!0);for(let f=0;f<c;f++){const u=n.readString();if(!u)throw new Error("Event data name must not be null");const p=new Xs(u),g=p.setupPose;g.intValue=n.readInt(!1),g.floatValue=n.readFloat(),g.stringValue=n.readString(),p._audioPath=n.readString(),p.audioPath&&(g.volume=n.readFloat(),g.balance=n.readFloat()),s.events.push(p)}const m=s.animations;c=n.readInt(!0);for(let f=0;f<c;f++){const u=n.readString();if(!u)throw new Error("Animation name must not be null.");m.push(this.readAnimation(n,u,s,a))}for(let f=0;f<h;f++){const u=o[f];u instanceof At&&(u.animation=m[n.readInt(!0)])}return s}readSkin(e,t,s,n){let i=null,r=0;if(s){if(r=e.readInt(!0),r===0)return null;i=new se("default")}else{const a=e.readString();if(!a)throw new Error("Skin name must not be null.");i=new se(a),n&&z.rgba8888ToColor(i.color,e.readInt32());let c=e.readInt(!0),l=t.bones,o=i.bones;for(let h=0;h<c;h++)o[h]=l[e.readInt(!0)];c=e.readInt(!0),l=t.constraints,o=i.constraints;for(let h=0;h<c;h++)o[h]=l[e.readInt(!0)];r=e.readInt(!0)}for(let a=0;a<r;a++){const c=e.readInt(!0);for(let l=0,o=e.readInt(!0);l<o;l++){const h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");const d=this.readAttachment(e,t,i,c,h,n);d&&i.setAttachment(c,h,d)}}return i}readAttachment(e,t,s,n,i,r){const a=this.scale,c=e.readByte(),l=(c&8)!==0?e.readStringRef():i;if(!l)throw new Error("Attachment name must not be null");switch(c&7){case 0:{let o=(c&16)!==0?e.readStringRef():null;const h=(c&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(c&64)!==0),m=(c&128)!==0?e.readFloat():0,f=e.readFloat(),u=e.readFloat(),p=e.readFloat(),g=e.readFloat(),x=e.readFloat(),b=e.readFloat();o||(o=l);const w=this.attachmentLoader.newRegionAttachment(s,i,l,o,d);return w?(w.path=o,w.x=f*a,w.y=u*a,w.scaleX=p,w.scaleY=g,w.rotation=m,w.width=x*a,w.height=b*a,z.rgba8888ToColor(w.color,h),w.updateSequence(),w):null}case 1:{const o=this.readVertices(e,(c&16)!==0),h=r?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,i,l);return d?(d.worldVerticesLength=o.length,d.vertices=o.vertices,d.bones=o.bones,r&&z.rgba8888ToColor(d.color,h),d):null}case 2:{let o=(c&16)!==0?e.readStringRef():l;const h=(c&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(c&64)!==0),m=e.readInt(!0),f=this.readVertices(e,(c&128)!==0),u=this.readFloatArray(e,f.length,1),p=this.readShortArray(e,(f.length-m-2)*3),g=e.readInt(!0);let x=null;if(g>0){x=[];for(let T=0;T<g;T++)x[T]=e.readInt(!0)}let b=[],w=0,v=0;r&&(b=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),v=e.readFloat()),o||(o=l);const y=this.attachmentLoader.newMeshAttachment(s,i,l,o,d);return y?(y.path=o,z.rgba8888ToColor(y.color,h),y.hullLength=m<<1,y.bones=f.bones,y.vertices=f.vertices,y.worldVerticesLength=f.length,y.regionUVs=u,y.triangles=p,x&&(y.timelineSlots=x),r&&(y.edges=b,y.width=w*a,y.height=v*a),y.updateSequence(),y):null}case 3:{const o=(c&16)!==0?e.readStringRef():l;if(o==null)throw new Error("Path of linked mesh must not be null");const h=(c&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(c&64)!==0),m=(c&128)!==0,f=e.readInt(!0),u=e.readInt(!0),p=e.readStringRef();let g=0,x=0;r&&(g=e.readFloat(),x=e.readFloat());const b=this.attachmentLoader.newMeshAttachment(s,i,l,o,d);return b?(b.path=o,z.rgba8888ToColor(b.color,h),r&&(b.width=g*a,b.height=x*a),this.linkedMeshes.push(new Fi(b,u,n,f,p,m)),b):null}case 4:{const o=(c&16)!==0,h=(c&32)!==0,d=this.readVertices(e,(c&64)!==0),m=this.readFloatArray(e,d.length/6,a),f=r?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,i,l);return u?(u.closed=o,u.constantSpeed=h,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=m,r&&z.rgba8888ToColor(u.color,f),u):null}case 5:{const o=e.readFloat(),h=e.readFloat(),d=e.readFloat(),m=r?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,i,l);return f?(f.x=h*a,f.y=d*a,f.rotation=o,r&&z.rgba8888ToColor(f.color,m),f):null}case 6:{const o=e.readInt(!0),h=this.readVertices(e,(c&16)!==0),d=r?e.readInt32():0,m=this.attachmentLoader.newClippingAttachment(s,i,l);return m?(m.endSlot=t.slots[o],m.convex=(c&32)!==0,m.inverse=(c&64)!==0,m.worldVerticesLength=h.length,m.vertices=h.vertices,m.bones=h.bones,r&&z.rgba8888ToColor(m.color,d),m):null}}}readSequence(e,t){if(!t)return new Wt(1,!1);const s=new Wt(e.readInt(!0),!0);return s.start=e.readInt(!0),s.digits=e.readInt(!0),s.setupIndex=e.readInt(!0),s}readVertices(e,t){const s=this.scale,i=e.readInt(!0)<<1;if(!t)return new Xn(null,this.readFloatArray(e,i,s),i);const r=e.readInt(!0),a=[],c=[];for(let l=0,o=0;l<r;){const h=e.readInt(!0);a[l++]=h;for(let d=0;d<h;d++,o+=3)a[l++]=e.readInt(!0),c[o]=e.readFloat()*s,c[o+1]=e.readFloat()*s,c[o+2]=e.readFloat()}return new Xn(a,V.toFloatArray(c),i)}readFloatArray(e,t,s){const n=[];if(s===1)for(let i=0;i<t;i++)n[i]=e.readFloat();else for(let i=0;i<t;i++)n[i]=e.readFloat()*s;return n}readShortArray(e,t){const s=[];for(let n=0;n<t;n++)s[n]=e.readInt(!0);return s}readAnimation(e,t,s,n){e.readInt(!0);const i=[],r=this.scale;for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0),w=b-1;switch(x){case qi:{const v=new Rt(b,u);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat(),e.readStringRef());i.push(v);break}case zi:{const v=e.readInt(!0),y=new ss(b,v,u);let T=e.readFloat(),C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255;for(let I=0,P=0;y.setFrame(I,T,C,A,k,S),I!==w;I++){const F=e.readFloat(),B=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255;switch(e.readByte()){case pt:y.setStepped(I);break;case xt:G(e,y,P++,I,0,T,F,C,B,1),G(e,y,P++,I,1,T,F,A,X,1),G(e,y,P++,I,2,T,F,k,R,1),G(e,y,P++,I,3,T,F,S,_,1)}T=F,C=B,A=X,k=R,S=_}i.push(y);break}case Wi:{const v=e.readInt(!0),y=new ns(b,v,u);let T=e.readFloat(),C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let S=0,I=0;y.setFrame(S,T,C,A,k),S!==w;S++){const P=e.readFloat(),F=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255;switch(e.readByte()){case pt:y.setStepped(S);break;case xt:G(e,y,I++,S,0,T,P,C,F,1),G(e,y,I++,S,1,T,P,A,B,1),G(e,y,I++,S,2,T,P,k,X,1)}T=P,C=F,A=B,k=X}i.push(y);break}case Gi:{const v=e.readInt(!0),y=new rs(b,v,u);let T=e.readFloat(),C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;for(let B=0,X=0;y.setFrame(B,T,C,A,k,S,I,P,F),B!==w;B++){const R=e.readFloat(),_=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,W=e.readUnsignedByte()/255;switch(e.readByte()){case pt:y.setStepped(B);break;case xt:G(e,y,X++,B,0,T,R,C,_,1),G(e,y,X++,B,1,T,R,A,D,1),G(e,y,X++,B,2,T,R,k,Y,1),G(e,y,X++,B,3,T,R,S,E,1),G(e,y,X++,B,4,T,R,I,U,1),G(e,y,X++,B,5,T,R,P,O,1),G(e,y,X++,B,6,T,R,F,W,1)}T=R,C=_,A=D,k=Y,S=E,I=U,P=O,F=W}i.push(y);break}case Hi:{const v=e.readInt(!0),y=new os(b,v,u);let T=e.readFloat(),C=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,S=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;for(let F=0,B=0;y.setFrame(F,T,C,A,k,S,I,P),F!==w;F++){const X=e.readFloat(),R=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255;switch(e.readByte()){case pt:y.setStepped(F);break;case xt:G(e,y,B++,F,0,T,X,C,R,1),G(e,y,B++,F,1,T,X,A,_,1),G(e,y,B++,F,2,T,X,k,D,1),G(e,y,B++,F,3,T,X,S,Y,1),G(e,y,B++,F,4,T,X,I,E,1),G(e,y,B++,F,5,T,X,P,U,1)}T=X,C=R,A=_,k=D,S=Y,I=E,P=U}i.push(y);break}case Ki:{const v=new is(b,e.readInt(!0),u);let y=e.readFloat(),T=e.readUnsignedByte()/255;for(let C=0,A=0;v.setFrame(C,y,T),C!==w;C++){const k=e.readFloat(),S=e.readUnsignedByte()/255;switch(e.readByte()){case pt:v.setStepped(C);break;case xt:G(e,v,A++,C,0,y,k,T,S,1)}y=k,T=S}i.push(v)}}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0);if(x===$i){const v=new es(b,u);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat(),e.readByte());i.push(v);continue}const w=e.readInt(!0);switch(x){case Bi:tt(e,i,new Ht(b,w,u),1);break;case Xi:tt(e,i,new We(b,w,u),r);break;case Li:tt(e,i,new Ge(b,w,u),r);break;case Ri:tt(e,i,new He(b,w,u),r);break;case Vi:tt(e,i,new Ke(b,w,u),1);break;case Ni:tt(e,i,new Je(b,w,u),1);break;case Di:tt(e,i,new Ze(b,w,u),1);break;case Oi:tt(e,i,new je(b,w,u),1);break;case _i:tt(e,i,new Qe(b,w,u),1);break;case Ui:tt(e,i,new ts(b,w,u),1);break}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0),p=e.readInt(!0),g=p-1,x=new cs(p,e.readInt(!0),u);let b=e.readByte(),w=e.readFloat(),v=(b&1)!==0?(b&2)!==0?e.readFloat():1:0,y=(b&4)!==0?e.readFloat()*r:0;for(let T=0,C=0;x.setFrame(T,w,v,y,(b&8)!==0?1:-1,(b&16)!==0,(b&32)!==0),T!==g;T++){b=e.readByte();const A=e.readFloat(),k=(b&1)!==0?(b&2)!==0?e.readFloat():1:0,S=(b&4)!==0?e.readFloat()*r:0;(b&64)!==0?x.setStepped(T):(b&128)!==0&&(G(e,x,C++,T,0,w,A,v,k,1),G(e,x,C++,T,1,w,A,y,S,r)),w=A,v=k,y=S}i.push(x)}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0),p=e.readInt(!0),g=p-1,x=new hs(p,e.readInt(!0),u);let b=e.readFloat(),w=e.readFloat(),v=e.readFloat(),y=e.readFloat(),T=e.readFloat(),C=e.readFloat(),A=e.readFloat();for(let k=0,S=0;x.setFrame(k,b,w,v,y,T,C,A),k!==g;k++){const I=e.readFloat(),P=e.readFloat(),F=e.readFloat(),B=e.readFloat(),X=e.readFloat(),R=e.readFloat(),_=e.readFloat();switch(e.readByte()){case pt:x.setStepped(k);break;case xt:G(e,x,S++,k,0,b,I,w,P,1),G(e,x,S++,k,1,b,I,v,F,1),G(e,x,S++,k,2,b,I,y,B,1),G(e,x,S++,k,3,b,I,T,X,1),G(e,x,S++,k,4,b,I,C,R,1),G(e,x,S++,k,5,b,I,A,_,1)}b=I,w=P,v=F,y=B,T=X,C=R,A=_}i.push(x)}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0),p=s.constraints[u];for(let g=0,x=e.readInt(!0);g<x;g++){const b=e.readByte(),w=e.readInt(!0),v=e.readInt(!0);switch(b){case nr:tt(e,i,new ds(w,v,u),p.positionMode===0?r:1);break;case ir:tt(e,i,new us(w,v,u),p.spacingMode===0||p.spacingMode===1?r:1);break;case rr:{const y=new fs(w,v,u);let T=e.readFloat(),C=e.readFloat(),A=e.readFloat(),k=e.readFloat();for(let S=0,I=0,P=y.getFrameCount()-1;y.setFrame(S,T,C,A,k),S!==P;S++){const F=e.readFloat(),B=e.readFloat(),X=e.readFloat(),R=e.readFloat();switch(e.readByte()){case pt:y.setStepped(S);break;case xt:G(e,y,I++,S,0,T,F,C,B,1),G(e,y,I++,S,1,T,F,A,X,1),G(e,y,I++,S,2,T,F,k,R,1)}T=F,C=B,A=X,k=R}i.push(y)}}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0)-1;for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0);if(x===fr){const v=new vs(b,u);for(let y=0;y<b;y++)v.setFrame(y,e.readFloat());i.push(v);continue}const w=e.readInt(!0);switch(x){case or:tt(e,i,new ms(b,w,u),1);break;case ar:tt(e,i,new gs(b,w,u),1);break;case lr:tt(e,i,new ps(b,w,u),1);break;case cr:tt(e,i,new xs(b,w,u),1);break;case hr:tt(e,i,new bs(b,w,u),1);break;case dr:tt(e,i,new ws(b,w,u),1);break;case ur:tt(e,i,new ys(b,w,u),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),b=e.readInt(!0),w=e.readInt(!0);switch(x){case mr:tt(e,i,new Ts(b,w,u),1);break;case gr:tt(e,i,new Cs(b,w,u),1);break;default:throw new Error(`Uknown slider type: ${x}`)}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=s.skins[e.readInt(!0)];for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readInt(!0);for(let b=0,w=e.readInt(!0);b<w;b++){const v=e.readStringRef();if(!v)throw new Error("attachmentName must not be null.");const y=u.getAttachment(x,v),T=e.readByte(),C=e.readInt(!0),A=C-1;switch(T){case er:{const k=y,S=k.bones,I=k.vertices,P=S?I.length/3*2:I.length,F=e.readInt(!0),B=new as(C,F,x,k);let X=e.readFloat();for(let R=0,_=0;;R++){let D,Y=e.readInt(!0);if(Y===0)D=S?V.newFloatArray(P):I;else{D=V.newFloatArray(P);const U=e.readInt(!0);if(Y+=U,r===1)for(let O=U;O<Y;O++)D[O]=e.readFloat();else for(let O=U;O<Y;O++)D[O]=e.readFloat()*r;if(!S)for(let O=0,W=D.length;O<W;O++)D[O]+=I[O]}if(B.setFrame(R,X,D),R===A)break;const E=e.readFloat();switch(e.readByte()){case pt:B.setStepped(R);break;case xt:G(e,B,_++,R,0,X,E,0,1,1)}X=E}i.push(B);break}case sr:{const k=new ls(C,x,y);for(let S=0;S<C;S++){const I=e.readFloat(),P=e.readInt32();k.setFrame(S,I,ze[P&15],P>>4,e.readFloat())}i.push(k);break}}}}}const a=s.slots.length,c=e.readInt(!0);if(c>0){const m=new kt(c);for(let f=0;f<c;f++)m.setFrame(f,e.readFloat(),Ln(e,a));i.push(m)}const l=e.readInt(!0);for(let m=0;m<l;m++){const f=e.readInt(!0),u=new Array(f);for(let x=0;x<f;x++)u[x]=e.readInt(!0);const p=e.readInt(!0),g=new Jt(p,u,a);for(let x=0;x<p;x++)g.setFrame(x,e.readFloat(),Ln(e,f));i.push(g)}const o=e.readInt(!0);if(o>0){const m=new fe(o);for(let f=0;f<o;f++){const u=e.readFloat(),p=s.events[e.readInt(!0)],g=new we(u,p);g.intValue=e.readInt(!1),g.floatValue=e.readFloat(),g.stringValue=e.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=e.readFloat(),g.balance=e.readFloat()),m.setFrame(f,g)}i.push(m)}let h=0;for(let m=0,f=i.length;m<f;m++)h=Math.max(h,i[m].getDuration());const d=new de(t,i,h);return n&&z.rgba8888ToColor(d.color,e.readInt32()),d}},Bn=class{constructor(e,t=[],s=0,n=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){const e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){const 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;){const n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(n),s++}}return t}readFloat(){const e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!==0}},Fi=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,n,i,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}},Xn=class{constructor(e=null,t,s=0){this.bones=e,this.vertices=t,this.length=s}};function tt(e,t,s,n){s instanceof Gt?Yi(e,t,s,n):Ei(e,t,s,n)}function Yi(e,t,s,n){let i=e.readFloat(),r=e.readFloat()*n;for(let a=0,c=0,l=s.getFrameCount()-1;s.setFrame(a,i,r),a!==l;a++){const o=e.readFloat(),h=e.readFloat()*n;switch(e.readByte()){case pt:s.setStepped(a);break;case xt:G(e,s,c++,a,0,i,o,r,h,n)}i=o,r=h}t.push(s)}function Ei(e,t,s,n){let i=e.readFloat(),r=e.readFloat()*n,a=e.readFloat()*n;for(let c=0,l=0,o=s.getFrameCount()-1;s.setFrame(c,i,r,a),c!==o;c++){const h=e.readFloat(),d=e.readFloat()*n,m=e.readFloat()*n;switch(e.readByte()){case pt:s.setStepped(c);break;case xt:G(e,s,l++,c,0,i,h,r,d,n),G(e,s,l++,c,1,i,h,a,m,n)}i=h,r=d,a=m}t.push(s)}function Ln(e,t){const s=e.readInt(!0);if(s===0)return null;const n=new Array(t).fill(-1),i=new Array(t-s);let r=0,a=0;for(let c=0;c<s;c++){const l=e.readInt(!0);for(;r!==l;)i[a++]=r++;n[r+e.readInt(!0)]=r++}for(;r<t;)i[a++]=r++;for(let c=t-1;c>=0;c--)n[c]===-1&&(n[c]=i[--a]);return n}function G(e,t,s,n,i,r,a,c,l,o){t.setBezier(s,n,i,r,c,e.readFloat(),e.readFloat()*o,e.readFloat(),e.readFloat()*o,a,l)}var Bi=0,Xi=1,Li=2,Ri=3,Vi=4,Ni=5,Di=6,Oi=7,_i=8,Ui=9,$i=10,qi=0,zi=1,Wi=2,Gi=3,Hi=4,Ki=5,Ji=0,Zi=1,ji=2,Qi=3,tr=4,er=0,sr=1,nr=0,ir=1,rr=2,or=0,ar=1,lr=2,cr=4,hr=5,dr=6,ur=7,fr=8,mr=0,gr=1,pt=1,xt=2,Rn=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new zt(()=>V.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,r=e.slots,a=r.length;s.length=0,i.freeAll(n),n.length=0;for(let c=0;c<a;c++){const l=r[c];if(!l.bone.active)continue;const o=l.appliedPose.attachment;if(o instanceof Fs){s.push(o);let h=i.obtain();h.length!==o.worldVerticesLength&&(h=V.newFloatArray(o.worldVerticesLength)),n.push(h),o.computeWorldVertices(e,l,0,o.worldVerticesLength,h,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,n=Number.NEGATIVE_INFINITY;const i=this.polygons;for(let r=0,a=i.length;r<a;r++){const c=i[r],l=c;for(let o=0,h=c.length;o<h;o+=2){const d=l[o],m=l[o+1];e=Math.min(e,d),t=Math.min(t,m),s=Math.max(s,d),n=Math.max(n,m)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=n}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,n){const i=this.minX,r=this.minY,a=this.maxX,c=this.maxY;if(e<=i&&s<=i||t<=r&&n<=r||e>=a&&s>=a||t>=c&&n>=c)return!1;const l=(n-t)/(s-e);let o=l*(i-e)+t;if(o>r&&o<c||(o=l*(a-e)+t,o>r&&o<c))return!0;let h=(r-t)/l+e;return h>i&&h<a||(h=(c-t)/l+e,h>i&&h<a)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){const s=this.polygons;for(let n=0,i=s.length;n<i;n++)if(this.containsPointPolygon(s[n],e,t))return this.boundingBoxes[n];return null}containsPointPolygon(e,t,s){const n=e,i=e.length;let r=i-2,a=!1;for(let c=0;c<i;c+=2){const l=n[c+1],o=n[r+1];if(l<s&&o>=s||o<s&&l>=s){const h=n[c];h+(s-l)/(o-l)*(n[r]-h)<t&&(a=!a)}r=c}return a}intersectsSegment(e,t,s,n){const i=this.polygons;for(let r=0,a=i.length;r<a;r++)if(this.intersectsSegmentPolygon(i[r],e,t,s,n))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(e,t,s,n,i){const r=e,a=e.length,c=t-n,l=s-i,o=t*i-s*n;let h=r[a-2],d=r[a-1];for(let m=0;m<a;m+=2){const f=r[m],u=r[m+1],p=h*u-d*f,g=h-f,x=d-u,b=c*x-l*g,w=(o*g-c*p)/b;if((w>=h&&w<=f||w>=f&&w<=h)&&(w>=t&&w<=n||w>=n&&w<=t)){const v=(o*x-l*p)/b;if((v>=d&&v<=u||v>=u&&v<=d)&&(v>=s&&v<=i||v>=i&&v<=s))return!0}h=f,d=u}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");const t=this.boundingBoxes.indexOf(e);return t===-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Vn=class lt{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new zt(()=>[]);polygonIndicesPool=new zt(()=>[]);triangulate(t){const s=t;let n=t.length>>1;const i=this.indicesArray;i.length=0;for(let c=0;c<n;c++)i[c]=c;const r=this.isConcaveArray;r.length=0;for(let c=0;c<n;c++)r[c]=lt.isConcave(c,n,s,i);const a=this.triangles;for(a.length=0;n>3;){let c=n-1,l=0,o=1;for(;;){t:if(!r[l]){const m=i[c]<<1,f=i[l]<<1,u=i[o]<<1,p=s[m],g=s[m+1],x=s[f],b=s[f+1],w=s[u],v=s[u+1];for(let y=o+1<n?o+1:0;y!==c;){if(r[y]){const T=i[y]<<1,C=s[T],A=s[T+1];if(lt.positiveArea(w,v,p,g,C,A)&&lt.positiveArea(p,g,x,b,C,A)&&lt.positiveArea(x,b,w,v,C,A))break t}++y===n&&(y=0)}break}if(o===0){do{if(!r[l])break;l--}while(l>0);c=l>0?l-1:n-1,o=l+1<n?l+1:0;break}c=l,l=o,++o===n&&(o=0)}a.push(i[c],i[l],i[o]),i.splice(l,1),r.splice(l,1),n--;const h=l>0?l-1:n-1,d=l<n?l:0;r[h]=lt.isConcave(h,n,s,i),r[d]=lt.isConcave(d,n,s,i)}return n===3&&a.push(i[2],i[0],i[1]),a}decompose(t,s){const n=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let a=this.polygonIndicesPool.obtain();a.length=0;let c=this.polygonPool.obtain();c.length=0;let l=-1,o=0;for(let h=0,d=s.length;h<d;h+=3){const m=s[h]<<1,f=s[h+1]<<1,u=s[h+2]<<1,p=n[m],g=n[m+1],x=n[f],b=n[f+1],w=n[u],v=n[u+1];if(l===m){const y=c.length-4;if(lt.winding(c[y],c[y+1],c[y+2],c[y+3],w,v)===o&&lt.winding(w,v,c[0],c[1],c[2],c[3])===o){c.push(w,v),a.push(u);continue}}c.length>0&&(i.push(c),r.push(a),c=this.polygonPool.obtain(),a=this.polygonIndicesPool.obtain()),c.length=0,c.push(p,g,x,b),c.push(w,v),a.length=0,a.push(m,f,u),o=lt.winding(p,g,x,b,w,v),l=m}c.length>0&&(i.push(c),r.push(a));for(let h=0,d=i.length;h<d;h++){if(a=r[h],a.length===0)continue;const m=a[0];let f=a[a.length-1];c=i[h];const u=c.length-4;let p=c[u],g=c[u+1],x=c[u+2],b=c[u+3];const w=c[0],v=c[1],y=c[2],T=c[3],C=lt.winding(p,g,x,b,w,v);for(let A=0;A<d;A++){if(A===h)continue;const k=r[A];if(k.length!==3)continue;const S=k[0],I=k[1],P=k[2],F=i[A],B=F[F.length-2],X=F[F.length-1];S!==m||I!==f||lt.winding(p,g,x,b,B,X)===C&&lt.winding(B,X,w,v,y,T)===C&&(F.length=0,k.length=0,c.push(B,X),a.push(P),f=P,p=x,g=b,x=B,b=X,A=-1)}}for(let h=i.length-1;h>=0;h--)c=i[h],c.length===0?(i.splice(h,1),this.polygonPool.free(c),a=r[h],r.splice(h,1),this.polygonIndicesPool.free(a)):c.push(c[0],c[1]);return i}static isConcave(t,s,n,i){const r=i[t>0?t-1:s-1]<<1,a=i[t]<<1,c=i[t+1<s?t+1:0]<<1;return!lt.positiveArea(n[r],n[r+1],n[a],n[a+1],n[c],n[c+1])}static positiveArea(t,s,n,i,r,a){return t*(a-i)+n*(s-a)+r*(i-s)>=0}static winding(t,s,n,i,r,a){return t*(a-i)+n*(s-a)+r*(i-s)>=0?1:-1}},ne=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(e,t,s){if(this.clipAttachment)return;const n=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const i=V.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(e,t,0,n,i,0,2);const r=this.clippingPolygon,a=this.makeClockwise(r);a||this.inverse||s.convex?(a||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new Vn),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(e){this.clipAttachment&&(e&&this.clipAttachment.endSlot!==e.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,n,i,r,a,c){return n&&i&&r&&typeof a=="boolean"&&typeof c=="number"?this.clipTrianglesRender(e,t,s,n,i,r,a,c):this.clipTrianglesNoRender(e,t,s)}clipTrianglesNoRender(e,t,s){const n=this.clippedVertices;n.length=0;const i=this.clippedTriangles;i.length=0;let r=0;if(this.inverse){const h=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let m=t[d]<<1;const f=e[m],u=e[m+1];m=t[d+1]<<1;const p=e[m],g=e[m+1];m=t[d+2]<<1;const x=e[m],b=e[m+1];this.clipInverse(f,u,p,g,x,b,h);const w=this.inverseVertices;for(let v=0,y=this.inverseVertices.length;v<y;){const T=w[v++];let C=T>>1,A=n.length;const k=V.setArraySize(n,A+T);V.arrayCopy(w,v,k,A,T),A=i.length;const S=V.setArraySize(i,A+3*(C-2));for(let I=1;I<C-1;I++,A+=3)S[A]=r,S[A+1]=r+I,S[A+2]=r+I+1;r+=C,v+=T}}return!0}const a=this.clipOutput,c=this.clippingPolygons,l=c.length;let o=null;for(let h=0;h<s;h+=3){let d=t[h]<<1;const m=e[d],f=e[d+1];d=t[h+1]<<1;const u=e[d],p=e[d+1];d=t[h+2]<<1;const g=e[d],x=e[d+1];for(let b=0;b<l;b++){let w=n.length;if(this.clip(m,f,u,p,g,x,c[b])){o=this.clipOutput;const v=a.length;if(v===0)continue;let y=v>>1;const T=V.setArraySize(n,w+v);V.arrayCopy(o,0,T,w,v),w=i.length;const C=V.setArraySize(i,w+3*(y-2));y--;for(let A=1;A<y;A++,w+=3)C[w]=r,C[w+1]=r+A,C[w+2]=r+A+1;r+=y}else{const v=V.setArraySize(n,w+6);v[w]=m,v[w+1]=f,v[w+2]=u,v[w+3]=p,v[w+4]=g,v[w+5]=x,w=i.length;const y=V.setArraySize(i,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return o!=null}clipTrianglesRender(e,t,s,n,i,r,a,c){const l=this.clippedVertices;l.length=0;const o=this.clippedTriangles;o.length=0;let h=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let x=t[g],b=t[g+1],w=t[g+2];const v=e[x*c],y=e[x*c+1],T=e[b*c],C=e[b*c+1],A=e[w*c],k=e[w*c+1];this.clipInverse(v,y,T,C,A,k,p);const S=this.inverseVertices.length;if(S===0)continue;const I=n[x<<=1],P=n[x+1],F=n[b<<=1],B=n[b+1],X=n[w<<=1],R=n[w+1],_=C-k,D=A-T,Y=v-A,E=k-y,U=1/(_*Y+D*(y-k)),O=this.inverseVertices;for(let W=0;W<S;){const N=O[W++],q=N>>1;let $=l.length;const J=V.setArraySize(l,$+q*c);for(let Z=0;Z<N;Z+=2,$+=c){const st=O[W+Z],rt=O[W+Z+1];J[$]=st,J[$+1]=rt,J[$+2]=i.r,J[$+3]=i.g,J[$+4]=i.b,J[$+5]=i.a;const nt=st-A,ut=rt-k,ot=(_*nt+D*ut)*U,at=(E*nt+Y*ut)*U,ft=1-ot-at;J[$+6]=I*ot+F*at+X*ft,J[$+7]=P*ot+B*at+R*ft,a&&(J[$+8]=r.r,J[$+9]=r.g,J[$+10]=r.b,J[$+11]=r.a)}$=o.length;const et=V.setArraySize(o,$+3*(q-2));for(let Z=1;Z<q-1;Z++,$+=3)et[$]=h,et[$+1]=h+Z,et[$+2]=h+Z+1;h+=q,W+=N}}return!0}const d=this.clipOutput,m=this.clippingPolygons,f=this.clippingPolygons.length;let u=null;for(let p=0;p<s;p+=3){let g=t[p];const x=e[g*c],b=e[g*c+1],w=n[g<<1],v=n[(g<<1)+1];g=t[p+1];const y=e[g*c],T=e[g*c+1],C=n[g<<1],A=n[(g<<1)+1];g=t[p+2];const k=e[g*c],S=e[g*c+1],I=n[g<<1],P=n[(g<<1)+1];let F=0,B=0,X=0,R=0,_=0;for(let D=0;D<f;D++){let Y=l.length;if(this.clip(x,b,y,T,k,S,m[D])){u=this.clipOutput;const E=d.length;if(E===0)continue;let U=E>>1;_===0&&(F=T-S,B=k-y,X=x-k,R=S-b,_=1/(F*X-B*R));const O=V.setArraySize(l,Y+U*c);for(let N=0;N<E;N+=2,Y+=c){const q=u[N],$=u[N+1];O[Y]=q,O[Y+1]=$,O[Y+2]=i.r,O[Y+3]=i.g,O[Y+4]=i.b,O[Y+5]=i.a;const J=q-k,et=$-S,Z=(F*J+B*et)*_,st=(R*J+X*et)*_,rt=1-Z-st;O[Y+6]=w*Z+C*st+I*rt,O[Y+7]=v*Z+A*st+P*rt,a&&(O[Y+8]=r.r,O[Y+9]=r.g,O[Y+10]=r.b,O[Y+11]=r.a)}Y=o.length;const W=V.setArraySize(o,Y+3*(U-2));U--;for(let N=1;N<U;N++,Y+=3)W[Y]=h,W[Y+1]=h+N,W[Y+2]=h+N+1;h+=U+1}else{const E=V.setArraySize(l,Y+3*c);E[Y]=x,E[Y+1]=b,E[Y+2]=i.r,E[Y+3]=i.g,E[Y+4]=i.b,E[Y+5]=i.a,a?(E[Y+6]=w,E[Y+7]=v,E[Y+8]=r.r,E[Y+9]=r.g,E[Y+10]=r.b,E[Y+11]=r.a,E[Y+12]=y,E[Y+13]=T,E[Y+14]=i.r,E[Y+15]=i.g,E[Y+16]=i.b,E[Y+17]=i.a,E[Y+18]=C,E[Y+19]=A,E[Y+20]=r.r,E[Y+21]=r.g,E[Y+22]=r.b,E[Y+23]=r.a,E[Y+24]=k,E[Y+25]=S,E[Y+26]=i.r,E[Y+27]=i.g,E[Y+28]=i.b,E[Y+29]=i.a,E[Y+30]=I,E[Y+31]=P,E[Y+32]=r.r,E[Y+33]=r.g,E[Y+34]=r.b,E[Y+35]=r.a):(E[Y+6]=w,E[Y+7]=v,E[Y+8]=y,E[Y+9]=T,E[Y+10]=i.r,E[Y+11]=i.g,E[Y+12]=i.b,E[Y+13]=i.a,E[Y+14]=C,E[Y+15]=A,E[Y+16]=k,E[Y+17]=S,E[Y+18]=i.r,E[Y+19]=i.g,E[Y+20]=i.b,E[Y+21]=i.a,E[Y+22]=I,E[Y+23]=P),Y=o.length;const U=V.setArraySize(o,Y+3);U[Y]=h,U[Y+1]=h+1,U[Y+2]=h+2,h+=3;break}}}return u!=null}clipTrianglesUnpacked(e,t,s,n,i,r=2){let a=this._clippedVerticesTyped,c=this._clippedUVsTyped,l=this._clippedTrianglesTyped,o=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const u=this.clippingPolygons[0];for(let p=0;p<n;p+=3){let g=s[p]*r;const x=e[t+g],b=e[t+g+1];let w=s[p]<<1;const v=i[w],y=i[w+1];g=s[p+1]*r;const T=e[t+g],C=e[t+g+1];w=s[p+1]<<1;const A=i[w],k=i[w+1];g=s[p+2]*r;const S=e[t+g],I=e[t+g+1];w=s[p+2]<<1;const P=i[w],F=i[w+1];this.clipInverse(x,b,T,C,S,I,u);const B=this.inverseVertices.length;if(B===0)continue;const X=C-I,R=S-T,_=x-S,D=I-b,Y=1/(X*_+R*(b-I)),E=this.inverseVertices;for(let U=0;U<B;){const O=E[U++],W=O>>1;let N=this.clippedVerticesLength;const q=N+W*r,$=this.clippedUVsLength+W*2;a.length<q&&(this._clippedVerticesTyped=new Float32Array(q*2),this._clippedVerticesTyped.set(a.subarray(0,N)),a=this._clippedVerticesTyped),c.length<$&&(this._clippedUVsTyped=new Float32Array($*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped),this.clippedVerticesLength=q,this.clippedUVsLength=$;const J=this._clippedVerticesTyped,et=this._clippedUVsTyped;let Z=$-W*2;for(let nt=0;nt<O;nt+=2,N+=r,Z+=2){const ut=E[U+nt],ot=E[U+nt+1];J[N]=ut,J[N+1]=ot;const at=ut-S,ft=ot-I,gt=(X*at+R*ft)*Y,bt=(D*at+_*ft)*Y,$t=1-gt-bt;et[Z]=v*gt+A*bt+P*$t,et[Z+1]=y*gt+k*bt+F*$t}N=this.clippedTrianglesLength;const st=N+3*(W-2);l.length<st&&(this._clippedTrianglesTyped=new Uint16Array(st*2),this._clippedTrianglesTyped.set(l.subarray(0,N)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=st;const rt=l;for(let nt=1;nt<W-1;nt++,N+=3)rt[N]=o,rt[N+1]=o+nt,rt[N+2]=o+nt+1;o+=W,U+=O}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),!0}const h=this.clipOutput,d=this.clippingPolygons,m=this.clippingPolygons.length;let f=null;for(let u=0;u<n;u+=3){let p=s[u],g=p*r;const x=e[t+g],b=e[t+g+1];let w=p<<1;const v=i[w],y=i[w+1];p=s[u+1],g=p*r;const T=e[t+g],C=e[t+g+1];w=p<<1;const A=i[w],k=i[w+1];p=s[u+2],g=p*r;const S=e[t+g],I=e[t+g+1];w=p<<1;const P=i[w],F=i[w+1];let B=0,X=0,R=0,_=0,D=0;for(let Y=0;Y<m;Y++){let E=this.clippedVerticesLength;if(this.clip(x,b,T,C,S,I,d[Y])){f=h;const U=h.length;if(U===0)continue;let O=U>>1;D===0&&(B=C-I,X=S-T,R=x-S,_=I-b,D=1/(B*R-X*_));const W=E+O*r;a.length<W&&(this._clippedVerticesTyped=new Float32Array(W*2),this._clippedVerticesTyped.set(a.subarray(0,E)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+O*2)*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),a=this._clippedVerticesTyped,c=this._clippedUVsTyped);const N=a,q=c;this.clippedVerticesLength=W;let $=this.clippedUVsLength;this.clippedUVsLength=$+O*2;for(let Z=0;Z<U;Z+=2,E+=r,$+=2){const st=f[Z],rt=f[Z+1];N[E]=st,N[E+1]=rt;const nt=st-S,ut=rt-I,ot=(B*nt+X*ut)*D,at=(_*nt+R*ut)*D,ft=1-ot-at;q[$]=v*ot+A*at+P*ft,q[$+1]=y*ot+k*at+F*ft}E=this.clippedTrianglesLength;const J=E+3*(O-2);l.length<J&&(this._clippedTrianglesTyped=new Uint16Array(J*2),this._clippedTrianglesTyped.set(l.subarray(0,E)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=J;const et=l;O--;for(let Z=1;Z<O;Z++,E+=3)et[E]=o,et[E+1]=o+Z,et[E+2]=o+Z+1;o+=O+1}else{let U=E+3*r;a.length<U&&(this._clippedVerticesTyped=new Float32Array(U*2),this._clippedVerticesTyped.set(a.subarray(0,E)),a=this._clippedVerticesTyped),a[E]=x,a[E+1]=b,a[E+r]=T,a[E+r+1]=C,a[E+r*2]=S,a[E+r*2+1]=I;const O=this.clippedUVsLength+6;c.length<O&&(this._clippedUVsTyped=new Float32Array(O*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped);const W=this.clippedUVsLength;c[W]=v,c[W+1]=y,c[W+2]=A,c[W+3]=k,c[W+4]=P,c[W+5]=F,this.clippedVerticesLength=U,this.clippedUVsLength=O,E=this.clippedTrianglesLength,U=E+3,l.length<U&&(this._clippedTrianglesTyped=new Uint16Array(U*2),this._clippedTrianglesTyped.set(l.subarray(0,E)),l=this._clippedTrianglesTyped);const N=l;N[E]=o,N[E+1]=o+1,N[E+2]=o+2,o+=3,this.clippedTrianglesLength=U;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),f!==null}clip(e,t,s,n,i,r,a){const c=this.clipOutput;let l=!1,o,h;a.length%4>=2?(o=this.clipOutput,h=this.scratch):(o=this.scratch,h=this.clipOutput);const d=a;o.length=8;const m=o;m[0]=e,m[1]=t,m[2]=s,m[3]=n,m[4]=i,m[5]=r,m[6]=e,m[7]=t,h.length=0;const f=a.length-4;for(let u=0;;u+=2){const p=d[u],g=d[u+1],x=p-d[u+2],b=g-d[u+3],w=h.length,v=o;e=v[0],t=v[1];let y=b*(p-e)-x*(g-t);for(let C=2,A=o.length-2;C<=A;C+=2){s=v[C],n=v[C+1];const k=b*(p-s)-x*(g-n);if(y>0)if(k>0)h.push(s,n);else{const S=s-e,I=n-t,P=y/(S*b-I*x);P>=0&&P<=1?(h.push(e+S*P,t+I*P),l=!0):h.push(s,n)}else if(k>0){const S=s-e,I=n-t,P=y/(S*b-I*x);P>=0&&P<=1?(h.push(e+S*P,t+I*P,s,n),l=!0):h.push(s,n)}else l=!0;e=s,t=n,y=k}if(w===h.length)return c.length=0,!0;if(h.push(h[0],h[1]),u===f)break;const T=h;h=o,h.length=0,o=T}if(c!==h){c.length=0;for(let u=0,p=h.length-2;u<p;u++)c[u]=h[u]}else c.length=c.length-2;return l}clipInverse(e,t,s,n,i,r,a){this.inverseVertices.length=0;const c=a.length-4;let l,o;a.length%4>=2?(l=this.clipOutput,o=this.scratch):(l=this.scratch,o=this.clipOutput),l.length=8;let h=a,d=l;d[0]=e,d[1]=t,d[2]=s,d[3]=n,d[4]=i,d[5]=r,d[6]=e,d[7]=t,o.length=0;for(let m=0;;m+=2){const f=h[m],u=h[m+1],p=f-h[m+2],g=u-h[m+3],x=o.length,b=this.inverseVertices.length;this.inverseVertices.push(0),d=l,e=d[0],t=d[1];let w=g*(f-e)-p*(u-t);for(let T=2,C=l.length-2;T<=C;T+=2){s=d[T],n=d[T+1];const A=g*(f-s)-p*(u-n);if(w>0)if(A>0)o.push(s,n);else{const k=s-e,S=n-t,I=w/(k*g-S*p);if(I>=0&&I<=1){const P=e+k*I,F=t+S*I;o.push(P,F),this.inverseVertices.push(P,F,s,n)}else o.push(s,n)}else if(A>0){const k=s-e,S=n-t,I=w/(k*g-S*p);if(I>=0&&I<=1){const P=e+k*I,F=t+S*I;this.inverseVertices.push(P,F),o.push(P,F,s,n)}else o.push(s,n)}else this.inverseVertices.push(s,n);e=s,t=n,w=A}const v=this.inverseVertices.length-b-1;if(v>=6?this.inverseVertices[b]=v:this.inverseVertices.length=b,x===o.length||(o.push(o[0],o[1]),m===c))break;const y=o;o=l,o.length=0,l=y}}makeClockwise(e){const t=e,s=e.length;let n=!0,i=!0,r=0,a=t[s-2],c=t[s-1],l=t[0],o=t[1];for(let d=2;d<s;d+=2){const m=t[d],f=t[d+1];r+=l*f-m*o;const u=(l-a)*(f-o)-(o-c)*(m-l);i=i&&u<=0,n=n&&u>=0,a=l,c=o,l=m,o=f}r+=l*t[1]-t[0]*o;const h=(l-a)*(t[1]-o)-(o-c)*(t[0]-l);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,m=s-2,f=s>>1;d<f;d+=2){const u=t[d],p=t[d+1],g=m-d;t[d]=t[g],t[d+1]=t[g+1],t[g]=u,t[g+1]=p}return n}return i}makeConvex(e){const t=e.length,s=e;this.clipOutput.length=t;const n=this.clipOutput;n[0]=s[0],n[1]=s[1];for(let a=2;a<t;a+=2){const c=s[a],l=s[a+1];let o=a-2;for(;o>=0&&(n[o]>c||n[o]===c&&n[o+1]>l);o-=2)n[o+2]=n[o],n[o+3]=n[o+1];n[o+2]=c,n[o+3]=l}s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];let i=4;for(let a=4;a<t;a+=2,i+=2){const c=n[a],l=n[a+1];for(;(s[i-2]-s[i-4])*(l-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==2););s[i]=c,s[i+1]=l}s[i]=n[t-4],s[i+1]=n[t-3];const r=i;i+=2;for(let a=t-6;a>=0;a-=2,i+=2){const c=n[a],l=n[a+1];for(;(s[i-2]-s[i-4])*(l-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==r););s[i]=c,s[i+1]=l}e.length=i-2}},Nn=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new Ae,n=typeof e=="string"?JSON.parse(e):e,i=n.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=M(i,"referenceScale",100)*t,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),n.bones)for(let r=0;r<n.bones.length;r++){const a=n.bones[r];let c=null;const l=M(a,"parent",null);l&&(c=s.findBone(l));const o=new Ys(s.bones.length,a.name,c);o.length=M(a,"length",0)*t;const h=o.setupPose;h.x=M(a,"x",0)*t,h.y=M(a,"y",0)*t,h.rotation=M(a,"rotation",0),h.scaleX=M(a,"scaleX",1),h.scaleY=M(a,"scaleY",1),h.shearX=M(a,"shearX",0),h.shearY=M(a,"shearY",0),h.inherit=V.enumValue(ge,M(a,"inherit","Normal")),o.skinRequired=M(a,"skin",!1);const d=M(a,"color",null);d&&o.color.setFromString(d),o.icon=M(a,"icon",void 0),o.iconSize=M(a,"iconSize",1),o.iconRotation=M(a,"iconRotation",0),s.bones.push(o)}if(n.slots)for(let r=0;r<n.slots.length;r++){const a=n.slots[r],c=a.name,l=s.findBone(a.bone);if(!l)throw new Error(`Couldn't find bone ${a.bone} for slot ${c}`);const o=new Os(s.slots.length,c,l),h=M(a,"color",null);h&&o.setupPose.color.setFromString(h);const d=M(a,"dark",null);d&&(o.setupPose.darkColor=z.fromString(d)),o.attachmentName=M(a,"attachment",null),o.blendMode=V.enumValue(_s,M(a,"blend","normal")),o.visible=M(a,"visible",!0),s.slots.push(o)}if(n.constraints)for(const r of n.constraints){const a=r.name,c=M(r,"skin",!1);switch(M(r,"type",!1)){case"ik":{const l=new Qt(a);l.skinRequired=c;for(let f=0;f<r.bones.length;f++){const u=s.findBone(r.bones[f]);if(!u)throw new Error(`Couldn't find bone ${r.bones[f]} for IK constraint ${a}.`);l.bones.push(u)}const o=r.target,h=s.findBone(o);if(!h)throw new Error(`Couldn't find target bone ${o} for IK constraint ${a}.`);l.target=h;const d=M(r,"scaleY",null);d!=null&&(l.scaleYMode=V.enumValue(be,d));const m=l.setupPose;m.mix=M(r,"mix",1),m.softness=M(r,"softness",0)*t,m.bendDirection=M(r,"bendPositive",!0)?1:-1,m.compress=M(r,"compress",!1),m.stretch=M(r,"stretch",!1),s.constraints.push(l);break}case"transform":{const l=new K(a);l.skinRequired=c;for(let w=0;w<r.bones.length;w++){const v=r.bones[w],y=s.findBone(v);if(!y)throw new Error(`Couldn't find bone ${v} for transform constraint ${r.name}.`);l.bones.push(y)}const o=r.source,h=s.findBone(o);if(!h)throw new Error(`Couldn't find source bone ${o} for transform constraint ${r.name}.`);l.source=h,l.localSource=M(r,"localSource",!1),l.localTarget=M(r,"localTarget",!1),l.additive=M(r,"additive",!1),l.clamp=M(r,"clamp",!1);let d=!1,m=!1,f=!1,u=!1,p=!1,g=!1;const x=Object.entries(M(r,"properties",{}));for(const[w,v]of x){const y=this.fromProperty(w),T=this.propertyScale(w,t);y.offset=M(v,"offset",0)*T;const C=Object.entries(M(v,"to",{}));for(const[A,k]of C){let S=1,I;switch(A){case"rotate":{d=!0,I=new Us;break}case"x":{m=!0,I=new $s,S=t;break}case"y":{f=!0,I=new qs,S=t;break}case"scaleX":{u=!0,I=new zs;break}case"scaleY":{p=!0,I=new Ws;break}case"shearY":{g=!0,I=new Gs;break}default:throw new Error(`Invalid transform constraint to property: ${A}`)}I.offset=M(k,"offset",0)*S,I.max=M(k,"max",1)*S,I.scale=M(k,"scale",1)*S/T,y.to.push(I)}y.to.length>0&&l.properties.push(y)}l.offsets[K.ROTATION]=M(r,"rotation",0),l.offsets[K.X]=M(r,"x",0)*t,l.offsets[K.Y]=M(r,"y",0)*t,l.offsets[K.SCALEX]=M(r,"scaleX",0),l.offsets[K.SCALEY]=M(r,"scaleY",0),l.offsets[K.SHEARY]=M(r,"shearY",0);const b=l.setupPose;d&&(b.mixRotate=M(r,"mixRotate",1)),m&&(b.mixX=M(r,"mixX",1)),f&&(b.mixY=M(r,"mixY",b.mixX)),u&&(b.mixScaleX=M(r,"mixScaleX",1)),p&&(b.mixScaleY=M(r,"mixScaleY",b.mixScaleX)),g&&(b.mixShearY=M(r,"mixShearY",1)),s.constraints.push(l);break}case"path":{const l=new te(a);l.skinRequired=c;for(let m=0;m<r.bones.length;m++){const f=r.bones[m],u=s.findBone(f);if(!u)throw new Error(`Couldn't find bone ${f} for path constraint ${r.name}.`);l.bones.push(u)}const o=r.slot,h=s.findSlot(o);if(!h)throw new Error(`Couldn't find slot ${o} for path constraint ${r.name}.`);l.slot=h,l.positionMode=V.enumValue(Ls,M(r,"positionMode","Percent")),l.spacingMode=V.enumValue(Rs,M(r,"spacingMode","Length")),l.rotateMode=V.enumValue(Vs,M(r,"rotateMode","Tangent")),l.offsetRotation=M(r,"rotation",0);const d=l.setupPose;d.position=M(r,"position",0),l.positionMode===0&&(d.position*=t),d.spacing=M(r,"spacing",0),(l.spacingMode===0||l.spacingMode===1)&&(d.spacing*=t),d.mixRotate=M(r,"mixRotate",1),d.mixX=M(r,"mixX",1),d.mixY=M(r,"mixY",d.mixX),s.constraints.push(l);break}case"physics":{const l=new ee(a);l.skinRequired=c;const o=r.bone,h=s.findBone(o);if(h==null)throw new Error(`Physics bone not found: ${o}`);l.bone=h,l.x=M(r,"x",0),l.y=M(r,"y",0),l.rotate=M(r,"rotate",0),l.scaleX=M(r,"scaleX",0);const d=M(r,"scaleY",null);d!=null&&(l.scaleYMode=V.enumValue(be,d)),l.shearX=M(r,"shearX",0),l.limit=M(r,"limit",5e3)*t,l.step=1/M(r,"fps",60);const m=l.setupPose;m.inertia=M(r,"inertia",.5),m.strength=M(r,"strength",100),m.damping=M(r,"damping",.85),m.massInverse=1/M(r,"mass",1),m.wind=M(r,"wind",0),m.gravity=M(r,"gravity",0),m.mix=M(r,"mix",1),l.inertiaGlobal=M(r,"inertiaGlobal",!1),l.strengthGlobal=M(r,"strengthGlobal",!1),l.dampingGlobal=M(r,"dampingGlobal",!1),l.massGlobal=M(r,"massGlobal",!1),l.windGlobal=M(r,"windGlobal",!1),l.gravityGlobal=M(r,"gravityGlobal",!1),l.mixGlobal=M(r,"mixGlobal",!1),s.constraints.push(l);break}case"slider":{const l=new At(a);l.skinRequired=c,l.additive=M(r,"additive",!1),l.loop=M(r,"loop",!1),l.setupPose.mix=M(r,"mix",1);const o=r.bone;if(o){if(l.bone=s.findBone(o),!l.bone)throw new Error(`Slider bone not found: ${o}`);const h=r.property;l.property=this.fromProperty(h);const d=this.propertyScale(h,t);l.property.offset=M(r,"from",0)*d,l.offset=M(r,"to",0),l.scale=M(r,"scale",1)/d,l.max=M(r,"max",0),l.local=M(r,"local",!1)}else l.setupPose.time=M(r,"time",0);s.constraints.push(l);break}}}if(n.skins)for(let r=0;r<n.skins.length;r++){const a=n.skins[r],c=new se(a.name);if(a.bones)for(let l=0;l<a.bones.length;l++){const o=a.bones[l],h=s.findBone(o);if(!h)throw new Error(`Couldn't find bone ${o} for skin ${a.name}.`);c.bones.push(h)}if(a.ik)for(let l=0;l<a.ik.length;l++){const o=a.ik[l],h=s.findConstraint(o,Qt);if(!h)throw new Error(`Couldn't find IK constraint ${o} for skin ${a.name}.`);c.constraints.push(h)}if(a.transform)for(let l=0;l<a.transform.length;l++){const o=a.transform[l],h=s.findConstraint(o,K);if(!h)throw new Error(`Couldn't find transform constraint ${o} for skin ${a.name}.`);c.constraints.push(h)}if(a.path)for(let l=0;l<a.path.length;l++){const o=a.path[l],h=s.findConstraint(o,te);if(!h)throw new Error(`Couldn't find path constraint ${o} for skin ${a.name}.`);c.constraints.push(h)}if(a.physics)for(let l=0;l<a.physics.length;l++){const o=a.physics[l],h=s.findConstraint(o,ee);if(!h)throw new Error(`Couldn't find physics constraint ${o} for skin ${a.name}.`);c.constraints.push(h)}if(a.slider)for(let l=0;l<a.slider.length;l++){const o=a.slider[l],h=s.findConstraint(o,At);if(!h)throw new Error(`Couldn't find slider constraint ${o} for skin ${a.name}.`);c.constraints.push(h)}for(const l in a.attachments){const o=s.findSlot(l);if(!o)throw new Error(`Couldn't find skin slot ${l} for skin ${a.name}.`);const h=a.attachments[l];for(const d in h){const m=this.readAttachment(h[d],c,o.index,d,s);m&&c.setAttachment(o.index,d,m)}}s.skins.push(c),c.name==="default"&&(s.defaultSkin=c)}for(let r=0,a=this.linkedMeshes.length;r<a;r++){const c=this.linkedMeshes[r],l=c.skin?s.findSkin(c.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${c.skin}`);const o=l.getAttachment(c.sourceIndex,c.source);if(!o)throw new Error(`Source mesh not found: ${c.source}`);c.mesh.timelineAttachment=c.inheritTimelines?o:c.mesh,c.mesh.setSourceMesh(o),c.mesh.updateSequence();t:if(c.inheritTimelines&&c.slotIndex!==c.sourceIndex){const h=o.timelineSlots;for(const m of h)if(m===c.slotIndex)break t;const d=[...h];d[h.length]=c.slotIndex,o.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const r in n.events){const a=n.events[r],c=new Xs(r),l=c.setupPose;l.intValue=M(a,"int",0),l.floatValue=M(a,"float",0),l.stringValue=M(a,"string",""),c._audioPath=M(a,"audio",null),c.audioPath&&(l.volume=M(a,"volume",l.volume),l.balance=M(a,"balance",l.balance)),s.events.push(c)}if(n.animations)for(const r in n.animations){const a=n.animations[r];this.readAnimation(a,r,s)}if(n.constraints)for(const r in n.constraints){const a=n.constraints[r];if(a.type==="slider"){const c=s.findConstraint(a.name,At),l=a.animation,o=s.findAnimation(l);if(!o)throw new Error(`Slider animation not found: ${l}`);c.animation=o}}return s}fromProperty(e){let t;switch(e){case"rotate":t=new ke;break;case"x":t=new Me;break;case"y":t=new Pe;break;case"scaleX":t=new Fe;break;case"scaleY":t=new Ye;break;case"shearY":t=new Ee;break;default:throw new Error(`Invalid transform constraint from property: ${e}`)}return t}propertyScale(e,t){switch(e){case"x":case"y":return t;default:return 1}}readAttachment(e,t,s,n,i){const r=this.scale,a=M(e,"name",n);switch(M(e,"type","region")){case"region":{const c=M(e,"path",a),l=this.readSequence(M(e,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(t,n,a,c,l);if(!o)return null;o.path=c,o.x=M(e,"x",0)*r,o.y=M(e,"y",0)*r,o.scaleX=M(e,"scaleX",1),o.scaleY=M(e,"scaleY",1),o.rotation=M(e,"rotation",0),o.width=e.width*r,o.height=e.height*r;const h=M(e,"color",null);return h&&o.color.setFromString(h),o.updateSequence(),o}case"boundingbox":{const c=this.attachmentLoader.newBoundingBoxAttachment(t,n,a);if(!c)return null;this.readVertices(e,c,e.vertexCount<<1);const l=M(e,"color",null);return l&&c.color.setFromString(l),c}case"mesh":case"linkedmesh":{const c=M(e,"path",a),l=this.readSequence(M(e,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(t,n,a,c,l);if(!o)return null;o.path=c;const h=M(e,"color",null);h&&o.color.setFromString(h),o.width=M(e,"width",0)*r,o.height=M(e,"height",0)*r;const d=M(e,"source",null);if(d){let f=s;const u=M(e,"slot",null);if(u){const p=i.findSlot(u);if(!p)throw new Error(`Source mesh slot not found: ${u}`);f=p.index}return this.linkedMeshes.push(new pr(o,M(e,"skin",null),s,f,d,M(e,"timelines",!0))),o}const m=e.uvs;return this.readVertices(e,o,m.length),o.triangles=e.triangles,o.regionUVs=m,o.edges=M(e,"edges",null),o.hullLength=M(e,"hull",0)*2,o.updateSequence(),o}case"path":{const c=this.attachmentLoader.newPathAttachment(t,n,a);if(!c)return null;c.closed=M(e,"closed",!1),c.constantSpeed=M(e,"constantSpeed",!0);const l=e.vertexCount;this.readVertices(e,c,l<<1);const o=V.newArray(l/3,0);for(let d=0;d<e.lengths.length;d++)o[d]=e.lengths[d]*r;c.lengths=o;const h=M(e,"color",null);return h&&c.color.setFromString(h),c}case"point":{const c=this.attachmentLoader.newPointAttachment(t,n,a);if(!c)return null;c.x=M(e,"x",0)*r,c.y=M(e,"y",0)*r,c.rotation=M(e,"rotation",0);const l=M(e,"color",null);return l&&c.color.setFromString(l),c}case"clipping":{const c=this.attachmentLoader.newClippingAttachment(t,n,a);if(!c)return null;const l=M(e,"end",null);l&&(c.endSlot=i.findSlot(l)),c.convex=M(e,"convex",!1),c.inverse=M(e,"inverse",!1);const o=e.vertexCount;this.readVertices(e,c,o<<1);const h=M(e,"color",null);return h&&c.color.setFromString(h),c}}return null}readSequence(e){if(e==null)return new Wt(1,!1);const t=new Wt(M(e,"count",0),!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){const n=this.scale;t.worldVerticesLength=s;const i=e.vertices;if(s===i.length){const c=V.toFloatArray(i);if(n!==1)for(let l=0,o=i.length;l<o;l++)c[l]*=n;t.vertices=c;return}const r=[],a=[];for(let c=0,l=i.length;c<l;){const o=i[c++];a.push(o);for(let h=c+o*4;c<h;c+=4)a.push(i[c]),r.push(i[c+1]*n),r.push(i[c+2]*n),r.push(i[c+3])}t.bones=a,t.vertices=V.toFloatArray(r)}readAnimation(e,t,s){const n=this.scale,i=[];if(e.slots)for(const l in e.slots){const o=e.slots[l],h=s.findSlot(l);if(!h)throw new Error(`Slot not found: ${l}`);const d=h.index;for(const m in o){const f=o[m];if(!f)continue;const u=f.length;switch(m){case"attachment":{const p=new Rt(u,d);for(let g=0;g<u;g++){const x=f[g];p.setFrame(g,M(x,"time",0),M(x,"name",null))}i.push(p);break}case"rgba":{const p=new ss(u,u<<2,d);let g=f[0],x=M(g,"time",0),b=z.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,x,b.r,b.g,b.b,b.a);const y=f[w+1];if(!y){p.shrink(v);break}const T=M(y,"time",0),C=z.fromString(y.color),A=g.curve;A&&(v=H(A,p,v,w,0,x,T,b.r,C.r,1),v=H(A,p,v,w,1,x,T,b.g,C.g,1),v=H(A,p,v,w,2,x,T,b.b,C.b,1),v=H(A,p,v,w,3,x,T,b.a,C.a,1)),x=T,b=C,g=y}i.push(p);break}case"rgb":{const p=new ns(u,u*3,d);let g=f[0],x=M(g,"time",0),b=z.fromString(g.color);for(let w=0,v=0;;w++){p.setFrame(w,x,b.r,b.g,b.b);const y=f[w+1];if(!y){p.shrink(v);break}const T=M(y,"time",0),C=z.fromString(y.color),A=g.curve;A&&(v=H(A,p,v,w,0,x,T,b.r,C.r,1),v=H(A,p,v,w,1,x,T,b.g,C.g,1),v=H(A,p,v,w,2,x,T,b.b,C.b,1)),x=T,b=C,g=y}i.push(p);break}case"alpha":{ct(i,f,new is(u,u,d),0,1);break}case"rgba2":{const p=new rs(u,u*7,d);let g=f[0],x=M(g,"time",0),b=z.fromString(g.light),w=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,x,b.r,b.g,b.b,b.a,w.r,w.g,w.b);const T=f[v+1];if(!T){p.shrink(y);break}const C=M(T,"time",0),A=z.fromString(T.light),k=z.fromString(T.dark),S=g.curve;S&&(y=H(S,p,y,v,0,x,C,b.r,A.r,1),y=H(S,p,y,v,1,x,C,b.g,A.g,1),y=H(S,p,y,v,2,x,C,b.b,A.b,1),y=H(S,p,y,v,3,x,C,b.a,A.a,1),y=H(S,p,y,v,4,x,C,w.r,k.r,1),y=H(S,p,y,v,5,x,C,w.g,k.g,1),y=H(S,p,y,v,6,x,C,w.b,k.b,1)),x=C,b=A,w=k,g=T}i.push(p);break}case"rgb2":{const p=new os(u,u*6,d);let g=f[0],x=M(g,"time",0),b=z.fromString(g.light),w=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,x,b.r,b.g,b.b,w.r,w.g,w.b);const T=f[v+1];if(!T){p.shrink(y);break}const C=M(T,"time",0),A=z.fromString(T.light),k=z.fromString(T.dark),S=g.curve;S&&(y=H(S,p,y,v,0,x,C,b.r,A.r,1),y=H(S,p,y,v,1,x,C,b.g,A.g,1),y=H(S,p,y,v,2,x,C,b.b,A.b,1),y=H(S,p,y,v,3,x,C,w.r,k.r,1),y=H(S,p,y,v,4,x,C,w.g,k.g,1),y=H(S,p,y,v,5,x,C,w.b,k.b,1)),x=C,b=A,w=k,g=T}i.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${f.name} (${o.name})`)}}}if(e.bones)for(const l in e.bones){const o=e.bones[l],h=s.findBone(l);if(!h)throw new Error(`Bone not found: ${l}`);const d=h.index;for(const m in o){const f=o[m],u=f.length;if(u!==0)switch(m){case"rotate":ct(i,f,new Ht(u,u,d),0,1);break;case"translate":Hs(i,f,new We(u,u<<1,d),"x","y",0,n);break;case"translatex":ct(i,f,new Ge(u,u,d),0,n);break;case"translatey":ct(i,f,new He(u,u,d),0,n);break;case"scale":Hs(i,f,new Ke(u,u<<1,d),"x","y",1,1);break;case"scalex":ct(i,f,new Je(u,u,d),1,1);break;case"scaley":ct(i,f,new Ze(u,u,d),1,1);break;case"shear":Hs(i,f,new je(u,u<<1,d),"x","y",0,1);break;case"shearx":ct(i,f,new Qe(u,u,d),0,1);break;case"sheary":ct(i,f,new ts(u,u,d),0,1);break;case"inherit":{const p=new es(u,h.index);for(let g=0;g<f.length;g++){const x=f[g];p.setFrame(g,M(x,"time",0),V.enumValue(ge,M(x,"inherit","Normal")))}i.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${f.name} (${o.name})`)}}}if(e.ik)for(const l in e.ik){const o=e.ik[l];let h=o[0];if(!h)continue;const d=s.findConstraint(l,Qt);if(!d)throw new Error(`IK Constraint not found: ${l}`);const m=new cs(o.length,o.length<<1,s.constraints.indexOf(d));let f=M(h,"time",0),u=M(h,"mix",1),p=M(h,"softness",0)*n;for(let g=0,x=0;;g++){m.setFrame(g,f,u,p,M(h,"bendPositive",!0)?1:-1,M(h,"compress",!1),M(h,"stretch",!1));const b=o[g+1];if(!b){m.shrink(x);break}const w=M(b,"time",0),v=M(b,"mix",1),y=M(b,"softness",0)*n,T=h.curve;T&&(x=H(T,m,x,g,0,f,w,u,v,1),x=H(T,m,x,g,1,f,w,p,y,n)),f=w,u=v,p=y,h=b}i.push(m)}if(e.transform)for(const l in e.transform){const o=e.transform[l];let h=o[0];if(!h)continue;const d=s.findConstraint(l,K);if(!d)throw new Error(`Transform constraint not found: ${l}`);const m=new hs(o.length,o.length*6,s.constraints.indexOf(d));let f=M(h,"time",0),u=M(h,"mixRotate",1),p=M(h,"mixX",1),g=M(h,"mixY",p),x=M(h,"mixScaleX",1),b=M(h,"mixScaleY",1),w=M(h,"mixShearY",1);for(let v=0,y=0;;v++){m.setFrame(v,f,u,p,g,x,b,w);const T=o[v+1];if(!T){m.shrink(y);break}const C=M(T,"time",0),A=M(T,"mixRotate",1),k=M(T,"mixX",1),S=M(T,"mixY",k),I=M(T,"mixScaleX",1),P=M(T,"mixScaleY",1),F=M(T,"mixShearY",1),B=h.curve;B&&(y=H(B,m,y,v,0,f,C,u,A,1),y=H(B,m,y,v,1,f,C,p,k,1),y=H(B,m,y,v,2,f,C,g,S,1),y=H(B,m,y,v,3,f,C,x,I,1),y=H(B,m,y,v,4,f,C,b,P,1),y=H(B,m,y,v,5,f,C,w,F,1)),f=C,u=A,p=k,g=S,x=I,b=P,w=F,h=T}i.push(m)}if(e.path)for(const l in e.path){const o=e.path[l],h=s.findConstraint(l,te);if(!h)throw new Error(`Path constraint not found: ${l}`);const d=s.constraints.indexOf(h);for(const m in o){const f=o[m];let u=f[0];if(!u)continue;const p=f.length;switch(m){case"position":{const g=new ds(p,p,d);ct(i,f,g,0,h.positionMode===0?n:1);break}case"spacing":{const g=new us(p,p,d);ct(i,f,g,0,h.spacingMode===0||h.spacingMode===1?n:1);break}case"mix":{const g=new fs(p,p*3,d);let x=M(u,"time",0),b=M(u,"mixRotate",1),w=M(u,"mixX",1),v=M(u,"mixY",w);for(let y=0,T=0;;y++){g.setFrame(y,x,b,w,v);const C=f[y+1];if(!C){g.shrink(T);break}const A=M(C,"time",0),k=M(C,"mixRotate",1),S=M(C,"mixX",1),I=M(C,"mixY",S),P=u.curve;P&&(T=H(P,g,T,y,0,x,A,b,k,1),T=H(P,g,T,y,1,x,A,w,S,1),T=H(P,g,T,y,2,x,A,v,I,1)),x=A,b=k,w=S,v=I,u=C}i.push(g);break}}}}if(e.physics)for(const l in e.physics){const o=e.physics[l];let h=-1;if(l.length>0){const d=s.findConstraint(l,ee);if(!d)throw new Error(`Physics constraint not found: ${l}`);h=s.constraints.indexOf(d)}for(const d in o){const m=o[d];let f=m[0];if(!f)continue;const u=m.length;let p,g=0;if(d==="reset"){const x=new vs(u,h);for(let b=0;f!=null;f=m[b+1],b++)x.setFrame(b,M(f,"time",0));i.push(x);continue}switch(d){case"inertia":p=new ms(u,u,h);break;case"strength":p=new gs(u,u,h);break;case"damping":p=new ps(u,u,h);break;case"mass":p=new xs(u,u,h);break;case"wind":p=new bs(u,u,h);break;case"gravity":p=new ws(u,u,h);break;case"mix":{g=1,p=new ys(u,u,h);break}default:continue}ct(i,m,p,g,1)}}if(e.slider)for(const l in e.slider){const o=e.slider[l],h=s.findConstraint(l,At);if(!h)throw new Error(`Slider not found: ${l}`);const d=s.constraints.indexOf(h);for(const m in o){const f=o[m];if(!f[0])continue;const p=f.length;switch(m){case"time":ct(i,f,new Ts(p,p,d),1,1);break;case"mix":ct(i,f,new Cs(p,p,d),1,1);break}}}if(e.attachments)for(const l in e.attachments){const o=e.attachments[l],h=s.findSkin(l);if(!h)throw new Error(`Skin not found: ${l}`);for(const d in o){const m=o[d],f=s.findSlot(d);if(!f)throw new Error(`Attachment slot not found: ${d}`);const u=f.index;for(const p in m){const g=m[p],x=h.getAttachment(u,p);if(!x)throw new Error(`Timeline attachment not found: ${p}`);for(const b in g){const w=g[b];let v=w[0];if(v){if(b==="deform"){const y=x.bones,T=x.vertices,C=y?T.length/3*2:T.length,A=new as(w.length,w.length,u,x);let k=M(v,"time",0);for(let S=0,I=0;;S++){let P;const F=M(v,"vertices",null);if(!F)P=y?V.newFloatArray(C):T;else{P=V.newFloatArray(C);const _=M(v,"offset",0);if(V.arrayCopy(F,0,P,_,F.length),n!==1)for(let D=_,Y=D+F.length;D<Y;D++)P[D]*=n;if(!y)for(let D=0;D<C;D++)P[D]+=T[D]}A.setFrame(S,k,P);const B=w[S+1];if(!B){A.shrink(I);break}const X=M(B,"time",0),R=v.curve;R&&(I=H(R,A,I,S,0,k,X,0,1,1)),k=X,v=B}i.push(A)}else if(b==="sequence"){const y=new ls(w.length,u,x);let T=0;for(let C=0;C<w.length;C++){const A=M(v,"delay",T),k=M(v,"time",0),S=qe[M(v,"mode","hold")],I=M(v,"index",0);y.setFrame(C,k,S,I,A),T=A,v=w[C+1]}i.push(y)}}}}}}if(e.drawOrder){const l=new kt(e.drawOrder.length),o=s.slots.length;let h=0;for(const d of e.drawOrder)l.setFrame(h++,M(d,"time",0),Dn(s,d,o,null));i.push(l)}if(e.drawOrderFolder)for(const l of e.drawOrderFolder){const o=M(l,"slots",[]),h=new Array(o.length);let d=0;for(const p of o){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);h[d++]=g.index}const m=M(l,"keys",[]),f=new Jt(m.length,h,s.slots.length);let u=0;for(const p of m)f.setFrame(u++,M(p,"time",0),Dn(s,p,h.length,h));i.push(f)}if(e.events){const l=new fe(e.events.length);let o=0;for(let h=0;h<e.events.length;h++,o++){const d=e.events[h],m=s.findEvent(d.name);if(!m)throw new Error(`Event not found: ${d.name}`);const f=m.setupPose,u=new we(V.toSinglePrecision(M(d,"time",0)),m);u.intValue=M(d,"int",f.intValue),u.floatValue=M(d,"float",f.floatValue),u.stringValue=M(d,"string",f.stringValue),u.data.audioPath&&(u.volume=M(d,"volume",f.volume),u.balance=M(d,"balance",f.volume)),l.setFrame(o,u)}i.push(l)}let r=0;for(let l=0,o=i.length;l<o;l++)r=Math.max(r,i[l].getDuration());const a=new de(t,i,r),c=M(e,"color",null);c!==null&&a.color.setFromString(c),s.animations.push(a)}},pr=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,n,i,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}};function ct(e,t,s,n,i){let r=t[0],a=r.time??0,c=(r.value??n)*i,l=0;for(let o=0;;o++){s.setFrame(o,a,c);const h=t[o+1];if(!h){s.shrink(l),e.push(s);return}const d=h.time??0,m=(h.value??n)*i;r.curve&&(l=H(r.curve,s,l,o,0,a,d,c,m,i)),a=d,c=m,r=h}}function Hs(e,t,s,n,i,r,a){let c=t[0],l=c.time??0,o=(c[n]??r)*a,h=(c[i]??r)*a,d=0;for(let m=0;;m++){s.setFrame(m,l,o,h);const f=t[m+1];if(!f){s.shrink(d),e.push(s);return}const u=f.time??0,p=(f[n]??r)*a,g=(f[i]??r)*a,x=c.curve;x&&(d=H(x,s,d,m,0,l,u,o,p,a),d=H(x,s,d,m,1,l,u,h,g,a)),l=u,o=p,h=g,c=f}}function Dn(e,t,s,n){const i=t.offsets;if(!i)return null;const r=new Array(s).fill(-1),a=new Array(s-i.length);let c=0,l=0;for(const o of i){const h=e.findSlot(o.slot);if(h==null)throw new Error(`Draw order slot not found: ${o.slot}`);let d=0;if(!n)d=h.index;else{d=-1;for(let m=0;m<s;m++)if(n[m]===h.index){d=m;break}if(d===-1)throw new Error(`Slot not in folder: ${o.slot}`)}for(;c!==d;)a[l++]=c++;r[c+o.offset]=c++}for(;c<s;)a[l++]=c++;for(let o=s-1;o>=0;o--)r[o]===-1&&(r[o]=a[--l]);return r}function H(e,t,s,n,i,r,a,c,l,o){if(e==="stepped")return t.setStepped(n),s;const h=i<<2,d=e[h],m=e[h+1]*o,f=e[h+2],u=e[h+3]*o;return t.setBezier(s,n,i,r,c,d,m,f,u,a,l),s+1}function M(e,t,s){return e[t]!==void 0?e[t]:s}var On=class{constructor(e,t,s={}){this.skeleton=e,this.adapter=t,this.positionInheritanceFactorX=s.positionInheritanceX??0,this.positionInheritanceFactorY=s.positionInheritanceY??0,this.rotationInheritanceFactor=s.rotationInheritance??0}positionInheritanceFactorX=0;positionInheritanceFactorY=0;rotationInheritanceFactor=0;hasLastTransform=!1;lastX=0;lastY=0;lastZ=0;lastRotation=0;currentTransform={x:0,y:0,z:0,rotation:0};currentPosition={x:0,y:0,z:0};lastPosition={x:0,y:0,z:0};get positionInheritanceX(){return this.positionInheritanceFactorX}get positionInheritanceY(){return this.positionInheritanceFactorY}setPositionInheritance(e,t){const s=this.positionInheritanceFactorX===0&&this.positionInheritanceFactorY===0,n=e!==0||t!==0;this.positionInheritanceFactorX=e,this.positionInheritanceFactorY=t,s&&n&&this.resetPosition()}get rotationInheritance(){return this.rotationInheritanceFactor}set rotationInheritance(e){const t=this.rotationInheritanceFactor===0;this.rotationInheritanceFactor=e,t&&e!==0&&this.resetRotation()}resetPosition(){const e=this.currentTransform,t=!this.hasLastTransform&&this.rotationInheritanceFactor!==0;this.adapter.readTransform(e,t),this.lastX=e.x,this.lastY=e.y,this.lastZ=e.z,t&&(this.lastRotation=e.rotation),this.hasLastTransform=!0}resetRotation(){const e=this.currentTransform;this.adapter.readTransform(e,!0),this.lastRotation=e.rotation,this.hasLastTransform||(this.lastX=e.x,this.lastY=e.y,this.lastZ=e.z),this.hasLastTransform=!0}resetTransform(){const e=this.currentTransform;this.adapter.readTransform(e,!0),this.setLastTransform(e.x,e.y,e.z,e.rotation)}applyTransformMovement(){const e=this.positionInheritanceFactorX!==0||this.positionInheritanceFactorY!==0,t=this.rotationInheritanceFactor!==0;if(!e&&!t)return;const s=this.currentTransform;this.adapter.readTransform(s,t);const{x:n,y:i,z:r}=s,a=t?s.rotation:this.lastRotation,c=n!==this.lastX||i!==this.lastY||r!==this.lastZ;if(this.hasLastTransform){if(!c&&a===this.lastRotation)return;e&&c&&this.applyPositionMovement(n,i,r),t&&a!==this.lastRotation&&this.applyRotationMovement(a)}this.setLastTransform(n,i,r,a)}applyPositionMovement(e,t,s){const n=this.currentPosition;n.x=e,n.y=t,n.z=s,this.adapter.worldToSkeleton(n);const i=this.lastPosition;i.x=this.lastX,i.y=this.lastY,i.z=this.lastZ,this.adapter.worldToSkeleton(i),this.skeleton.physicsTranslate((n.x-i.x)*this.positionInheritanceFactorX,(n.y-i.y)*this.positionInheritanceFactorY)}applyRotationMovement(e){const t=this.rotationInheritanceFactor;t!==0&&this.skeleton.physicsRotate(0,0,this.getRotationDelta(e,this.lastRotation)*t)}setLastTransform(e,t,s,n){this.lastX=e,this.lastY=t,this.lastZ=s,this.lastRotation=n,this.hasLastTransform=!0}getRotationDelta(e,t){let s=e-t;return s=(s+180)%360-180,s<-180?s+360:s}},xr=class{commandPool=new br;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new ne;renderCommands=[];render(e,t=!1,s,n=2,i=0){this.commandPool.reset(),this.renderCommands.length=0;const r=this.clipping;let a=0;const c=e.drawOrder.appliedPose;for(let l=0,o=c.length;l<o;l++){const h=c[l];if(!h.bone.active){r.clipEnd(h);continue}const d=h.appliedPose,m=d.attachment;if(!m){r.clipEnd(h);continue}const f=d.color;if(f.a===0&&!(m instanceof Mt)){r.clipEnd(h);continue}let p,g,x,b,w,v,y;if(m instanceof Tt){if(v=m.color,v.a===0){r.clipEnd(h);continue}const S=m.sequence,I=S.resolveIndex(d);m.computeWorldVertices(h,m.getOffsets(d),this.worldVertices,0,n),p=this.worldVertices,g=4,x=S.getUVs(I),b=this.quadIndices,w=6,y=S.regions[I]?.texture}else if(m instanceof wt){if(v=m.color,v.a===0){r.clipEnd(h);continue}this.worldVertices.length<m.worldVerticesLength&&(this.worldVertices=new Float32Array(m.worldVerticesLength)),m.computeWorldVertices(e,h,0,m.worldVerticesLength,this.worldVertices,0,n),p=this.worldVertices,g=m.worldVerticesLength>>1;const S=m.sequence,I=S.resolveIndex(d);x=S.getUVs(I),b=m.triangles,w=b.length,y=S.regions[I]?.texture}else if(m instanceof Mt){r.clipEnd(h),r.clipStart(e,h,m);continue}else{r.clipEnd(h);continue}if(!y){r.clipEnd(h);continue}const T=e.color;let C,A;if(t){let S;if(s){S=Math.floor(s[3]*T.a*f.a*v.a*255);const I=Math.floor(S*s[0]*T.r*f.r*v.r),P=Math.floor(S*s[1]*T.g*f.g*v.g),F=Math.floor(S*s[2]*T.b*f.b*v.b);C=S<<24|I<<16|P<<8|F}else{S=Math.floor(T.a*f.a*v.a*255);const I=Math.floor(S*T.r*f.r*v.r),P=Math.floor(S*T.g*f.g*v.g),F=Math.floor(S*T.b*f.b*v.b);C=S<<24|I<<16|P<<8|F}if(A=4278190080,d.darkColor){const{r:I,g:P,b:F}=d.darkColor;A=4278190080|Math.floor(I*S)<<16|Math.floor(P*S)<<8|Math.floor(F*S)}}else{if(s){const S=Math.floor(s[3]*T.a*f.a*v.a*255),I=Math.floor(s[0]*T.r*f.r*v.r*255),P=Math.floor(s[1]*T.g*f.g*v.g*255),F=Math.floor(s[2]*T.b*f.b*v.b*255);C=S<<24|I<<16|P<<8|F}else{const S=Math.floor(T.a*f.a*v.a*255),I=Math.floor(T.r*f.r*v.r*255),P=Math.floor(T.g*f.g*v.g*255),F=Math.floor(T.b*f.b*v.b*255);C=S<<24|I<<16|P<<8|F}if(A=0,d.darkColor){const{r:S,g:I,b:P}=d.darkColor;A=Math.floor(S*255)<<16|Math.floor(I*255)<<8|Math.floor(P*255)}}r.isClipping()&&(r.clipTrianglesUnpacked(p,0,b,w,x,n),p=r.clippedVerticesTyped,g=r.clippedVerticesLength/n,x=r.clippedUVsTyped,b=r.clippedTrianglesTyped,w=r.clippedTrianglesLength);const k=this.commandPool.getCommand(g,w,n);if(k.blendMode=h.data.blendMode,k.texture=y,k.positions.set(p.subarray(0,g*n)),n>=3)for(let S=2,I=g*n;S<I;S+=n)k.positions[S]=a;k.uvs.set(x.subarray(0,g<<1));for(let S=0;S<g;S++)k.colors[S]=C,k.darkColors[S]=A;b instanceof Uint16Array?k.indices.set(b.subarray(0,w)):k.indices.set(b.slice(0,w)),this.renderCommands.push(k),a+=i,r.clipEnd(h)}return r.clipEnd(),this.batchCommands(n)}batchSubCommands(e,t,s,n,i,r){const a=e[t],c=this.commandPool.getCommand(n,i,r);c.blendMode=a.blendMode,c.texture=a.texture;let l=0,o=0,h=0,d=0,m=0;for(let f=t;f<=s;f++){const u=e[f];c.positions.set(u.positions,l),l+=u.numVertices*r,c.uvs.set(u.uvs,o),o+=u.numVertices<<1,c.colors.set(u.colors,h),c.darkColors.set(u.darkColors,h),h+=u.numVertices;for(let p=0;p<u.numIndices;p++)c.indices[d+p]=u.indices[p]+m;d+=u.numIndices,m+=u.numVertices}return c}batchCommands(e){if(this.renderCommands.length===0)return;let t,s,n=this.renderCommands[0],i=0,r=1,a=n.numVertices,c=n.numIndices;for(;r<=this.renderCommands.length;){const l=r<this.renderCommands.length?this.renderCommands[r]:null;if(l&&l.numVertices===0&&l.numIndices===0){r++;continue}if(l!==null&&l.texture===n.texture&&l.blendMode===n.blendMode&&l.colors[0]===n.colors[0]&&l.darkColors[0]===n.darkColors[0]&&c+l.numIndices<65535)a+=l.numVertices,c+=l.numIndices;else{const h=this.batchSubCommands(this.renderCommands,i,r-1,a,c,e);if(s?(s.next=h,s=h):t=s=h,r===this.renderCommands.length)break;n=this.renderCommands[r],i=r,a=n.numVertices,c=n.numIndices}r++}return t}},br=class{pool=[];inUse=[];getCommand(e,t,s){let n;for(const i of this.pool)if(i._positions.length>=e*s&&i._indices.length>=t){n=i;break}if(n)this.pool.splice(this.pool.indexOf(n),1),n.next=void 0,n.numVertices=e,n.numIndices=t,n.positions=n._positions.subarray(0,e*s),n.uvs=n._uvs.subarray(0,e<<1),n.colors=n._colors.subarray(0,e),n.darkColors=n._darkColors.subarray(0,e),n.indices=n._indices.subarray(0,t);else{const i=new Float32Array(e*s),r=new Float32Array(e<<1),a=new Uint32Array(e),c=new Uint32Array(e),l=new Uint16Array(t);n={positions:i,uvs:r,colors:a,darkColors:c,indices:l,_positions:i,_uvs:r,_colors:a,_darkColors:c,_indices:l,numVertices:e,numIndices:t,blendMode:0,texture:null}}return this.inUse.push(n),n}reset(){this.pool.push(...this.inUse),this.inUse.length=0}};import{Assets as _n,checkExtension as Ks,copySearchParams as wr,LoaderParserPriority as yr}from"@pixi/assets";import{ALPHA_MODES as Un,BaseTexture as $n,ExtensionType as qn,extensions as vr,settings as zn,utils as Be}from"@pixi/core";import{BLEND_MODES as Xe,MIPMAP_MODES as Wn,Texture as Tr,SCALE_MODES as Gn,WRAP_MODES as Js}from"@pixi/core";var ie=class Xt extends _e{static textureMap=new Map;static from(t){return Xt.textureMap.has(t)?Xt.textureMap.get(t):new Xt(t)}texture;constructor(t){super(t.resource.source),this.texture=Tr.from(t)}setFilters(t,s){this.texture.baseTexture.scaleMode=Xt.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=Xt.toPixiMipMap(t)}setWraps(t,s){this.texture.baseTexture.wrapMode=Xt.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return Gn.NEAREST;case 9729:case 9987:case 9985:return Gn.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case 9728:case 9729:return Wn.OFF;case 9986:case 9984:case 9987:case 9985:return Wn.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return Js.CLAMP;case 33648:return Js.MIRRORED_REPEAT;case 10497:return Js.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return Xe.NORMAL;case 1:return Xe.ADD;case 2:return Xe.MULTIPLY;case 3:return Xe.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Le="spineTextureAtlasLoader",Cr={extension:qn.Asset,resolver:{test:e=>Ks(e,".atlas"),parse:e=>{const t=e.split(".");return{resolution:parseFloat(zn.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:Le,extension:{type:qn.LoadParser,priority:yr.Normal,name:Le},test(e){return Ks(e,".atlas")},async load(e){const t=await zn.ADAPTER.fetch(e);if(!t.ok)throw new Error(`[${Le}] Failed to fetch ${e}: ${t.status} ${t.statusText}`);return await t.text()},testParse(e,t){const s=Ks(t.src,".atlas"),n=typeof e=="string",i=t.loadParser===Le;return Promise.resolve((s||i)&&n)},unload(e){e.dispose()},async parse(e,t,s){const n=t.data||{};let i=Be.path.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const r=new he(e);if(n.images instanceof $n||typeof n.images=="string"){const l=n.images;n.images={},n.images[r.pages[0].name]=l}const a=[];let c=!0;for(const l of s.parsers)if(l.name==="loadTextures"){c=l.config?.preferCreateImageBitmap;break}_n.setPreferences({preferCreateImageBitmap:!1});for(const l of r.pages){const o=l.name,h=n?.images?n.images[o]:void 0;if(h instanceof $n)l.setTexture(ie.from(h));else{const d=h??Be.path.normalize([...i.split(Be.path.sep),o].join(Be.path.sep)),m={src:wr(d,t.src),data:{...n.imageMetadata,alphaMode:l.pma?Un.PMA:Un.UNPACK}},f=s.load(m).then(u=>{l.setTexture(ie.from(u.baseTexture))});a.push(f)}}return await Promise.all(a),_n.setPreferences({preferCreateImageBitmap:c}),r}}};vr.add(Cr);import{checkExtension as Zs,LoaderParserPriority as Sr}from"@pixi/assets";import{ExtensionType as Hn,extensions as Ar,settings as Ir}from"@pixi/core";var Re="spineSkeletonLoader";function kr(e){return e.hasOwnProperty("bones")}function Mr(e){return e instanceof Uint8Array}var Pr={extension:Hn.Asset,loader:{name:Re,extension:{type:Hn.LoadParser,priority:Sr.Normal,name:Re},test(e){return Zs(e,".skel")},async load(e){const t=await Ir.ADAPTER.fetch(e);if(!t.ok)throw new Error(`[${Re}] Failed to fetch ${e}: ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())},testParse(e,t){const s=Zs(t.src,".json")&&kr(e),n=Zs(t.src,".skel")&&Mr(e),i=t.loadParser===Re;return Promise.resolve(s||n||i)}}};Ar.add(Pr);import{Mesh as Fr}from"@pixi/mesh";import{Buffer as js,Geometry as Yr,TYPES as Kn}from"@pixi/core";var Jn=class extends Yr{constructor(e=!1){super();const t=new js(void 0),s=new js(void 0,!0),n=new js(void 0,!0,!0);this.addAttribute("aVertexPosition",t,2,!1,Kn.FLOAT),this.addAttribute("aTextureCoord",s,2,!1,Kn.FLOAT),this.addIndex(n)}};import{Color as Ve,Matrix as Er,Program as Br,Shader as Xr,Texture as Lr,TextureMatrix as Rr}from"@pixi/core";var Vr=`
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform mat3 uTextureMatrix;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
}
`,Nr=`
varying vec2 vTextureCoord;
uniform vec4 uColor;
uniform vec4 uDarkColor;
uniform sampler2D uSampler;
void main(void)
{
vec4 texColor = texture2D(uSampler, vTextureCoord);
gl_FragColor.a = texColor.a * uColor.a;
gl_FragColor.rgb = ((texColor.a - 1.0) * uDarkColor.a + 1.0 - texColor.rgb) * uDarkColor.rgb + texColor.rgb * uColor.rgb;
}
`,Zn=class extends Xr{uvMatrix;batchable;pluginName;_tintRGB;_darkTintRGB;_colorDirty;_alpha;_tintColor;_darkTintColor;constructor(e){const t={uSampler:e??Lr.EMPTY,alpha:1,uTextureMatrix:Er.IDENTITY,uColor:new Float32Array([1,1,1,1]),uDarkColor:new Float32Array([0,0,0,0])},s={tint:16777215,darkTint:0,alpha:1,pluginName:"darkTintBatch"};super(Br.from(Vr,Nr),t),this._colorDirty=!1,this.uvMatrix=new Rr(t.uSampler),this.batchable=!0,this.pluginName=s.pluginName,this._tintColor=new Ve(s.tint),this._darkTintColor=new Ve(s.darkTint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._alpha=s.alpha,this._colorDirty=!0}get texture(){return this.uniforms.uSampler}set texture(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)}set alpha(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(e){e!==this.tint&&(this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}set darkTint(e){e!==this.darkTint&&(this._darkTintColor.setValue(e),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._colorDirty=!0)}get darkTint(){return this._darkTintColor.value}get tintValue(){return this._tintColor.toNumber()}get darkTintValue(){return this._darkTintColor.toNumber()}update(){this._colorDirty&&(this._colorDirty=!1,Ve.shared.setValue(this._tintColor).premultiply(this._alpha,!0).toArray(this.uniforms.uColor),Ve.shared.setValue(this._darkTintColor).premultiply(this._alpha,!0).premultiply(1,!1).toArray(this.uniforms.uDarkColor)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}},jn=class extends Fr{_darkTintRGB=0;constructor(e){super(new Jn,new Zn(e),void 0,void 0)}get darkTint(){return"darkTint"in this.shader?this.shader.darkTint:null}set darkTint(e){this.shader.darkTint=e}get darkTintValue(){return this.shader.darkTintValue}_renderToBatch(e){const t=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=t.indexBuffer.data,this._tintRGB=s._tintRGB,this._darkTintRGB=s._darkTintRGB,this._texture=s.texture;const n=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[n]),e.plugins[n].render(this)}},Qn=class it extends jn{name="";static auxColor=[0,0,0,0];constructor(){super()}updateFromSpineData(t,s,n,i,r,a,c,l){this.texture=t.texture;const o=r/(l?12:8)*2,h=this.geometry.getBuffer("aTextureCoord");h.data?.length!==o&&(h.data=new Float32Array(o));const d=this.geometry.getBuffer("aVertexPosition");d.data?.length!==o&&(d.data=new Float32Array(o));let m=0;const f=h.data,u=d.data;for(let g=0;g<r;g+=l?12:8){let x=g;u[m]=i[x++],u[m+1]=i[x++],x+=4,f[m]=i[x++],f[m+1]=i[x++],m+=2}l?(it.auxColor[0]=i[8],it.auxColor[1]=i[9],it.auxColor[2]=i[10],it.auxColor[3]=i[11],this.darkTint=it.auxColor,it.auxColor[0]=i[2],it.auxColor[1]=i[3],it.auxColor[2]=i[4],it.auxColor[3]=i[5],this.tint=it.auxColor):(it.auxColor[0]=i[2],it.auxColor[1]=i[3],it.auxColor[2]=i[4],it.auxColor[3]=i[5],this.tint=it.auxColor),this.blendMode=ie.toPixiBlending(s),this.alpha=it.auxColor[3];const p=this.geometry.indexBuffer;if(p.data.length!==a.length)p.data=new Uint32Array(a);else{const g=p.data;for(let x=0;x<c;x++)g[x]=a[x]}this.name=n,h.update(),d.update(),p.update()}};import{Buffer as ti,Geometry as Dr,TYPES as re}from"@pixi/core";var ei=class extends Dr{_buffer;_indexBuffer;constructor(e=!1){super(),this._buffer=new ti(void 0,e,!1),this._indexBuffer=new ti(void 0,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,re.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,re.FLOAT).addAttribute("aColor",this._buffer,4,!0,re.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,re.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,re.FLOAT).addIndex(this._indexBuffer)}};import{BatchRenderer as Or,BatchShaderGenerator as _r,Color as si,ExtensionType as Ur,extensions as $r}from"@pixi/core";var qr=`
precision highp float;
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
attribute vec4 aColor;
attribute vec4 aDarkColor;
attribute float aTextureId;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform vec4 tint;
varying vec2 vTextureCoord;
varying vec4 vColor;
varying vec4 vDarkColor;
varying float vTextureId;
void main(void){
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
vTextureId = aTextureId;
vColor = aColor * tint;
vDarkColor = aDarkColor * tint;
}
`,zr=`
varying vec2 vTextureCoord;
varying vec4 vColor;
varying vec4 vDarkColor;
varying float vTextureId;
uniform sampler2D uSamplers[%count%];
void main(void){
vec4 color;
%forloop%
gl_FragColor.a = color.a * vColor.a;
gl_FragColor.rgb = ((color.a - 1.0) * vDarkColor.a + 1.0 - color.rgb) * vDarkColor.rgb + color.rgb * vColor.rgb;
}
`,ni=class extends Or{static extension={name:"darkTintBatch",type:Ur.RendererPlugin};constructor(e){super(e),this.shaderGenerator=new _r(qr,zr),this.geometryClass=ei,this.vertexSize=7}packInterleavedGeometry(e,t,s,n,i){const{uint32View:r,float32View:a}=t,c=n/this.vertexSize,l=e.uvs,o=e.indices,h=e.vertexData,d=e._texture.baseTexture._batchLocation,m=Math.min(e.worldAlpha,1),f=si.shared.setValue(e._tintRGB).toPremultiplied(m,!0),u=si.shared.setValue(e._darkTintRGB).premultiply(m,!0).toPremultiplied(1,!1);for(let p=0;p<h.length;p+=2)a[n++]=h[p],a[n++]=h[p+1],a[n++]=l[p],a[n++]=l[p+1],r[n++]=f,r[n++]=u,a[n++]=d;for(let p=0;p<o.length;p++)s[i++]=c+o[p]}};$r.add(ni);import{Texture as Wr}from"@pixi/core";import{Mesh as Gr,MeshGeometry as Hr,MeshMaterial as Kr}from"@pixi/mesh";var ii=class Lt extends Gr{name="";static auxColor=[0,0,0,0];warnedTwoTint=!1;constructor(){const t=new Hr;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const s=new Kr(Wr.EMPTY);super(t,s)}updateFromSpineData(t,s,n,i,r,a,c,l){this.texture=t.texture;const o=r/(l?12:8)*2,h=this.geometry.getBuffer("aTextureCoord");h.data?.length!==o&&(h.data=new Float32Array(o));const d=this.geometry.getBuffer("aVertexPosition");d.data?.length!==o&&(d.data=new Float32Array(o));let m=0;const f=h.data,u=d.data;for(let g=0;g<r;g+=l?12:8){let x=g;u[m]=i[x++],u[m+1]=i[x++],x+=4,f[m]=i[x++],f[m+1]=i[x++],m+=2}l&&!this.warnedTwoTint&&(console.warn("DarkTint is not enabled by default. To enable use a DarkSlotMesh factory while creating the Spine object."),this.warnedTwoTint=!0),Lt.auxColor[0]=i[2],Lt.auxColor[1]=i[3],Lt.auxColor[2]=i[4],Lt.auxColor[3]=i[5],this.tint=Lt.auxColor,this.alpha=Lt.auxColor[3],this.blendMode=ie.toPixiBlending(s);const p=this.geometry.indexBuffer;if(p.data.length!==a.length)p.data=new Uint32Array(a);else{const g=p.data;for(let x=0;x<c;x++)g[x]=a[x]}this.name=n,h.update(),d.update(),p.update()}};import{Assets as ri}from"@pixi/assets";import{Point as Jr,Ticker as oi}from"@pixi/core";import{Bounds as Zr,Container as jr}from"@pixi/display";import{Graphics as Qr}from"@pixi/graphics";import"@pixi/events";var to=class{constructor(e,t,s,n){this.x=e,this.y=t,this.width=s,this.height=n}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},eo=class{constructor(e=!1){this.clipping=e}calculateBounds(e){if(!e.skeleton)return{x:0,y:0,width:0,height:0};const t=new Ot(e.skeleton.data);t.setupPose(),t.updateWorldTransform(2);const s=t.getBoundsRect(this.clipping?new ne:void 0);return s.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},so=class{constructor(e,t=[],s=.05,n=!1){this.animation=e,this.skins=t,this.timeStep=s,this.clipping=n}calculateBounds(e){if(!e.skeleton||!e.state)return{x:0,y:0,width:0,height:0};const t=new Ss(e.state.data),s=new Ot(e.skeleton.data),n=this.clipping?new ne:void 0,i=s.data;if(this.skins.length>0){const a=new se("custom-skin");for(const c of this.skins){const l=i.findSkin(c);l!=null&&a.addSkin(l)}s.setSkin(a)}s.setupPose();const r=this.animation!=null?i.findAnimation(this.animation):null;if(r==null){s.updateWorldTransform(2);const a=s.getBoundsRect(n);return a.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:a}else{let a=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;t.clearTracks(),t.setAnimation(0,r,!1);const h=Math.max(r.duration/this.timeStep,1);for(let m=0;m<h;m++){const f=m>0?this.timeStep:0;t.update(f),t.apply(s),s.update(f),s.updateWorldTransform(2);const u=s.getBoundsRect(n);a=Math.min(a,u.x),c=Math.min(c,u.y),l=Math.max(l,u.x+u.width),o=Math.max(o,u.y+u.height)}const d={x:a,y:c,width:l-a,height:o-c};return d.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},no=class j extends jr{skeleton;state;skeletonPhysics;darkTint=!1;hasNeverUpdated=!0;_debug=void 0;get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}slotMeshFactory=()=>new ii;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};_autoUpdate=!1;_ticker=oi.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!t&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=t}get ticker(){return this._ticker}set ticker(t){t=t??oi.shared,this._ticker!==t&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),t.add(this.internalUpdate,this)),this._ticker=t)}meshesCache=new Map;static vectorAux=new le;static clipper=new ne;static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;static DARK_VERTEX_SIZE=12;lightColor=new z;darkColor=new z;clippingVertAux=new Float32Array(6);_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t?(this._boundsSpineID=-1,this._boundsSpineDirty=!0,this.interactiveChildren=!1):(this.interactiveChildren=!0,this.hitArea=null),this.hasNeverUpdated||this.calculateBounds()}_boundsPoint=new Jr;_boundsSpineID=-1;_boundsSpineDirty=!0;constructor(t){super(),t instanceof Ae?t={skeletonData:t}:"skeleton"in t&&(t=new.target.createOptions(t));const{autoUpdate:s=!0,boundsProvider:n,darkTint:i,skeletonData:r,ticker:a}=t;this.skeleton=new Ot(r),this.skeletonPhysics=new On(this.skeleton,{readTransform:(c,l)=>this.readPhysicsTransform(c,l),worldToSkeleton:c=>this.pixiWorldCoordinatesToSkeleton(c)}),this.state=new Ss(new yn(r)),a&&(this._ticker=a),this.autoUpdate=s,this.boundsProvider=n,this.darkTint=i===void 0?this.skeleton.slots.some(c=>!!c.data.setupPose.darkColor):i,this.darkTint&&(this.slotMeshFactory=()=>new Qn)}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this.hasNeverUpdated=!1;const n=s??this._ticker.deltaMS/1e3;this.state.update(n),this.state.apply(this.skeleton),this.skeletonPhysics.applyTransformMovement(),this.beforeUpdateWorldTransforms(this),this.skeleton.update(n),this.skeleton.updateWorldTransform(2),this.afterUpdateWorldTransforms(this)}readPhysicsTransform(t,s){const n=this.worldTransform;if(t.x=n.tx,t.y=n.ty,t.z=0,!s)return;let i=0;for(let r=this;r;r=r.parent)i+=r.rotation+(r.skew.y-r.skew.x)/2;t.rotation=i*180/Math.PI}updateTransform(){this.renderMeshes(),this.sortChildren(),this.debug?.renderDebug(this),super.updateTransform()}destroy(t){this.autoUpdate&&(this.autoUpdate=!1),this._ticker=null;for(const[,s]of this.meshesCache)s?.destroy();this.state.clearListeners(),this.debug=void 0,this.meshesCache.clear(),this.slotsObject.clear();for(const s in this.clippingSlotToPixiMasks)this.clippingSlotToPixiMasks[s].destroy(),delete this.clippingSlotToPixiMasks[s];super.destroy(t)}unloadFromCache(){const t=this.skeleton?.data;if(!t)return!1;const s=j.skeletonDataCacheKeys.get(t);return!s||j.skeletonCache[s]!==t?!1:(delete j.skeletonCache[s],j.skeletonDataCacheKeys.delete(t),!0)}resetMeshes(){for(const[,t]of this.meshesCache)t.zIndex=-1,t.visible=!1}_calculateBounds(){this.hasNeverUpdated&&(this.internalUpdate(0,0),this.renderMeshes())}hasMeshForSlot(t){return this.meshesCache.has(t)}getMeshForSlot(t){let s=this.hasMeshForSlot(t)?this.meshesCache.get(t):null;return s?s.visible=!0:(s=this.slotMeshFactory(),this.addChild(s),this.meshesCache.set(t,s)),s}slotsObject=new Map;getSlotFromRef(t){let s;if(typeof t=="number"?s=this.skeleton.slots[t]:typeof t=="string"?s=this.skeleton.findSlot(t):s=t,!s)throw new Error(`No slot found with the given slot reference: ${t}`);return s}addSlotObject(t,s,n){const i=this.getSlotFromRef(t),r=this.slotsObject.get(i)?.container;if(!(r&&r===s)){for(const[a,{container:c}]of this.slotsObject)if(a!==i&&c===s){this.removeSlotObject(a,s);break}r&&this.removeChild(r),this.slotsObject.set(i,{container:s,followAttachmentTimeline:n?.followAttachmentTimeline||!1,followSlotColor:n?.followSlotColor||!1}),this.addChild(s)}}getSlotObject(t){const s=this.slotsObject.get(this.getSlotFromRef(t));return s?s.container:void 0}removeSlotObject(t,s){const n=this.getSlotFromRef(t),i=this.slotsObject.get(n)?.container;i&&(s&&s!==i||(this.removeChild(i),this.slotsObject.delete(n)))}removeSlotObjects(){for(const[,t]of this.slotsObject)t.container.removeFromParent();this.slotsObject.clear()}verticesCache=V.newFloatArray(1024);clippingSlotToPixiMasks={};pixiMaskCleanup(t){const s=this.clippingSlotToPixiMasks[t.data.name];s&&(delete this.clippingSlotToPixiMasks[t.data.name],s.destroy())}updateSlotObject(t,s,n){const{container:i,followAttachmentTimeline:r}=t,a=s.appliedPose,c=r?!!a.attachment:!0,l=this.skeleton.drawOrder.appliedPose;if(i.visible=l.includes(s)&&c,i.visible){const o=s.bone.appliedPose,h=i.localTransform;h.a=o.a,h.b=o.c,h.c=-o.b,h.d=-o.d,h.tx=o.worldX,h.ty=o.worldY,i.transform.setFromMatrix(h),i.zIndex=n+1,i.alpha=this.skeleton.color.a*a.color.a,t.followSlotColor&&this.setSlotObjectTint(i,255*this.skeleton.color.r*a.color.r<<16|255*this.skeleton.color.g*a.color.g<<8|255*this.skeleton.color.b*a.color.b)}}setSlotObjectTint(t,s){const n=t;"tint"in n&&(n.tint=s);for(const i of n.children??[])this.setSlotObjectTint(i,s)}updateAndSetPixiMask(t,s){if(j.clipper.isClipping()&&t){let n=this.clippingSlotToPixiMasks[t.slot.data.name];if(n||(n=new Qr,this.clippingSlotToPixiMasks[t.slot.data.name]=n,this.addChild(n)),!t.computed){t.computed=!0;const i=t.slot.appliedPose.attachment,r=i.worldVerticesLength;this.clippingVertAux.length<r&&(this.clippingVertAux=new Float32Array(r)),i.computeWorldVertices(this.skeleton,t.slot,0,r,this.clippingVertAux,0,2),n.clear().lineStyle(0).beginFill(0),n.moveTo(this.clippingVertAux[0],this.clippingVertAux[1]);for(let a=2;a<r;a+=2)n.lineTo(this.clippingVertAux[a],this.clippingVertAux[a+1]);n.finishPoly()}s.mask=n}else s.mask&&(s.mask=null)}renderMeshes(){this.resetMeshes();let t=null,s=null,n=null;const i=this.skeleton.drawOrder.appliedPose,r=i;for(let a=0,c=i.length,l=0;a<c;a++){const o=r[a],h=this.slotsObject.get(o),d=a+l;h&&(this.updateSlotObject(h,o,d+1),l++,this.updateAndSetPixiMask(n,h.container));const m=o.appliedPose,f=!!m.darkColor,u=f?j.DARK_VERTEX_SIZE:j.VERTEX_SIZE;if(!o.bone.active){j.clipper.clipEnd(o),this.pixiMaskCleanup(o);continue}const p=m.attachment;let g,x,b=0;const w=this.skeleton;if(p instanceof Tt){g=p.color,b=u*4;const y=p.sequence,T=y.resolveIndex(m);p.computeWorldVertices(o,p.getOffsets(m),this.verticesCache,0,u),t=j.QUAD_TRIANGLES,s=y.getUVs(T),x=y.regions[T]?.texture}else if(p instanceof wt){const v=p;g=v.color,b=(v.worldVerticesLength>>1)*u,b>this.verticesCache.length&&(this.verticesCache=V.newFloatArray(b)),v.computeWorldVertices(w,o,0,v.worldVerticesLength,this.verticesCache,0,u),t=v.triangles;const y=p.sequence,T=y.resolveIndex(m);s=y.getUVs(T),x=y.regions[T]?.texture}else if(p instanceof Mt){j.clipper.clipStart(w,o,p),n={slot:o,computed:!1};continue}else{this.hasMeshForSlot(o)&&(this.getMeshForSlot(o).visible=!1),j.clipper.clipEnd(o),this.pixiMaskCleanup(o);continue}if(x!=null){const v=w.color,y=m.color,T=v.a*y.a*g.a;this.lightColor.set(v.r*y.r*g.r,v.g*y.g*g.g,v.b*y.b*g.b,T),m.darkColor!=null?this.darkColor.set(m.darkColor.r,m.darkColor.g,m.darkColor.b,1):this.darkColor.set(0,0,0,1);let C,A,k,S;if(j.clipper.isClipping()&&j.clipper.clipTriangles(this.verticesCache,t,t.length,s,this.lightColor,this.darkColor,f,u))C=j.clipper.clippedVertices,A=C.length,k=j.clipper.clippedTriangles,S=k.length;else{const P=this.verticesCache;for(let F=2,B=0,X=b;F<X;F+=u,B+=2){let R=F;P[R++]=this.lightColor.r,P[R++]=this.lightColor.g,P[R++]=this.lightColor.b,P[R++]=this.lightColor.a,P[R++]=s[B],P[R++]=s[B+1],f&&(P[R++]=this.darkColor.r,P[R++]=this.darkColor.g,P[R++]=this.darkColor.b,P[R++]=this.darkColor.a)}C=this.verticesCache,A=b,k=t,S=t.length}if(A===0||S===0){j.clipper.clipEnd(o);continue}const I=this.getMeshForSlot(o);I.renderable=!0,I.zIndex=d,I.updateFromSpineData(x,o.data.blendMode,o.data.name,C,A,k,S,f)}j.clipper.clipEnd(o),this.pixiMaskCleanup(o)}j.clipper.clipEnd()}calculateBounds(){if(!this._boundsProvider){super.calculateBounds();return}const t=this.transform;if(this._boundsSpineID===t._worldID)return;this.updateBounds();const s=this._localBounds,n=this._boundsPoint;n.set(s.minX,s.minY),t.worldTransform.apply(n,n),this._bounds.minX=n.x,this._bounds.minY=n.y,n.set(s.maxX,s.maxY),t.worldTransform.apply(n,n),this._bounds.maxX=n.x,this._bounds.maxY=n.y}updateBounds(){if(!this._boundsProvider||!this._boundsSpineDirty)return;this._boundsSpineDirty=!1,this._localBounds||(this._localBounds=new Zr);const t=this._boundsProvider.calculateBounds(this),s=this._localBounds;s.clear(),s.minX=t.x,s.minY=t.y,s.maxX=t.x+t.width,s.maxY=t.y+t.height,this.hitArea=this._localBounds.getRectangle()}setBonePosition(t,s){const n=typeof t=="string"?this.skeleton.findBone(t):t;if(!n)throw Error(`Cannot set bone position, bone ${String(t)} not found`);j.vectorAux.set(s.x,s.y);const i=n.appliedPose;if(n.parent){const r=n.parent.appliedPose.worldToLocal(j.vectorAux);i.x=r.x,i.y=r.y}else i.x=j.vectorAux.x,i.y=j.vectorAux.y}getBonePosition(t,s){const n=typeof t=="string"?this.skeleton.findBone(t):t;return n?(s||(s={x:0,y:0}),s.x=n.appliedPose.worldX,s.y=n.appliedPose.worldY,s):(console.error(`Cannot get bone position! Bone ${String(t)} not found`),s)}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,s){this.pixiWorldCoordinatesToSkeleton(t),s.parent?s.parent.appliedPose.worldToLocal(t):s.appliedPose.worldToLocal(t)}static skeletonCache=Object.create(null);static skeletonDataCacheKeys=new WeakMap;static getSkeletonCacheKey({skeleton:t,atlas:s,scale:n=1}){return`${t}-${s}-${n}`}static createOptions({skeleton:t,atlas:s,scale:n=1,darkTint:i,autoUpdate:r=!0,boundsProvider:a,allowMissingRegions:c,ticker:l}){const o=j.getSkeletonCacheKey({skeleton:t,atlas:s,scale:n});let h=j.skeletonCache[o];if(!h){const d=ri.get(t),m=ri.get(s),f=new Sn(m,c),u=d instanceof Uint8Array?new En(f):new Nn(f);u.scale=n,h=u.readSkeletonData(d),j.skeletonCache[o]=h}return j.skeletonDataCacheKeys.set(h,o),{skeletonData:h,darkTint:i,autoUpdate:r,boundsProvider:a,ticker:l}}static from(t){return new j(j.createOptions(t))}get tint(){return this.skeleton.color.toRgb888()}set tint(t){z.rgb888ToColor(this.skeleton.color,t)}};Ot.yDown=!0;import{Container as Qs}from"@pixi/display";import{Graphics as mt}from"@pixi/graphics";import{Text as io}from"@pixi/text";var ro=class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);return}const t={parentDebugContainer:new Qs,bones:new Qs,skeletonXY:new mt,regionAttachmentsShape:new mt,meshTrianglesLine:new mt,meshHullLine:new mt,clippingPolygon:new mt,boundingBoxesRect:new mt,boundingBoxesCircle:new mt,boundingBoxesPolygon:new mt,pathsCurve:new mt,pathsLine:new mt,eventText:new Qs,eventCallback:{event:(s,n)=>{if(this.drawEvents){const i=Math.abs(e.scale.x||e.scale.y||1),r=new io(n.data.name,{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"});r.scale.x=Math.sign(e.scale.x),r.anchor.set(.5),t.eventText.addChild(r),setTimeout(()=>{r.destroyed||r.destroy()},250)}}}};t.parentDebugContainer.addChild(t.bones),t.parentDebugContainer.addChild(t.skeletonXY),t.parentDebugContainer.addChild(t.regionAttachmentsShape),t.parentDebugContainer.addChild(t.meshTrianglesLine),t.parentDebugContainer.addChild(t.meshHullLine),t.parentDebugContainer.addChild(t.clippingPolygon),t.parentDebugContainer.addChild(t.boundingBoxesRect),t.parentDebugContainer.addChild(t.boundingBoxesCircle),t.parentDebugContainer.addChild(t.boundingBoxesPolygon),t.parentDebugContainer.addChild(t.pathsCurve),t.parentDebugContainer.addChild(t.pathsLine),t.parentDebugContainer.addChild(t.eventText),t.parentDebugContainer.zIndex=9999999,t.parentDebugContainer.accessibleChildren=!1,t.parentDebugContainer.eventMode="none",t.parentDebugContainer.interactiveChildren=!1,e.addChild(t.parentDebugContainer),e.state.addListener(t.eventCallback),this.registeredSpines.set(e,t)}renderDebug(e){this.registeredSpines.has(e)||this.registerSpine(e);const t=this.registeredSpines.get(e);if(!t)return;e.addChild(t.parentDebugContainer),t.skeletonXY.clear(),t.regionAttachmentsShape.clear(),t.meshTrianglesLine.clear(),t.meshHullLine.clear(),t.clippingPolygon.clear(),t.boundingBoxesRect.clear(),t.boundingBoxesCircle.clear(),t.boundingBoxesPolygon.clear(),t.pathsCurve.clear(),t.pathsLine.clear();for(let i=t.bones.children.length;i>0;i--)t.bones.children[i-1].destroy({children:!0,texture:!0,baseTexture:!0});const s=Math.abs(e.scale.x||e.scale.y||1),n=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,n,s),this.drawPaths&&this.drawPathsFunc(e,t,n),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,n),this.drawClipping&&this.drawClippingFunc(e,t,n),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,n),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,n),this.drawEvents)for(const i of t.eventText.children)i.alpha-=.05,i.y-=2}drawBonesFunc(e,t,s,n){const i=e.skeleton,r=i.x,a=i.y,c=i.bones;t.skeletonXY.lineStyle(s,this.skeletonXYColor,1);for(let o=0,h=c.length;o<h;o++){const d=c[o],m=d.data.length,f=d.appliedPose,u=r+f.worldX,p=a+f.worldY,g=r+m*f.a+f.worldX,x=a+m*f.b+f.worldY;if(d.data.name==="root"||d.data.parent===null)continue;const b=Math.abs(u-g),w=Math.abs(p-x),v=Math.pow(b,2),y=w,T=Math.pow(w,2),C=Math.sqrt(v+T),A=Math.pow(C,2),k=Math.PI/180,S=Math.acos((A+T-v)/(2*y*C))||0;if(C===0)continue;const I=new mt;t.bones.addChild(I);const P=C/50/n;I.beginFill(this.bonesColor,1),I.drawPolygon(0,0,0-P,C-P*3,0,C-P,0+P,C-P*3),I.endFill(),I.x=u,I.y=p,I.pivot.y=C;let F=0;u<g&&p<x?F=-S+180*k:u>g&&p<x?F=180*k+S:u>g&&p>x?F=-S:u<g&&p>x?F=S:p===x&&u<g?F=90*k:p===x&&u>g?F=-90*k:u===g&&p<x?F=180*k:u===g&&p>x&&(F=0),I.rotation=F,I.lineStyle(s+P/2.4,this.bonesColor,1),I.beginFill(0,.6),I.drawCircle(0,C,P*1.2),I.endFill()}const l=s*3;t.skeletonXY.moveTo(r-l,a-l),t.skeletonXY.lineTo(r+l,a+l),t.skeletonXY.moveTo(r+l,a-l),t.skeletonXY.lineTo(r-l,a+l)}drawRegionAttachmentsFunc(e,t,s){const i=e.skeleton.slots;t.regionAttachmentsShape.lineStyle(s,this.regionAttachmentsColor,1);for(let r=0,a=i.length;r<a;r++){const c=i[r],l=c.appliedPose.attachment;if(l==null||!(l instanceof Tt))continue;const o=new Float32Array(8);l.computeWorldVertices(c,l.getOffsets(c.appliedPose),o,0,2),t.regionAttachmentsShape.drawPolygon(Array.from(o.slice(0,8)))}}drawMeshHullAndMeshTriangles(e,t,s){const n=e.skeleton,i=n.slots;t.meshHullLine.lineStyle(s,this.meshHullColor,1),t.meshTrianglesLine.lineStyle(s,this.meshTrianglesColor,1);for(let r=0,a=i.length;r<a;r++){const c=i[r];if(!c.bone.active)continue;const l=c.appliedPose.attachment;if(l==null||!(l instanceof wt))continue;const o=l,h=new Float32Array(o.worldVerticesLength),d=o.triangles;let m=o.hullLength;if(o.computeWorldVertices(n,c,0,o.worldVerticesLength,h,0,2),this.drawMeshTriangles)for(let f=0,u=d.length;f<u;f+=3){const p=d[f]*2,g=d[f+1]*2,x=d[f+2]*2;t.meshTrianglesLine.moveTo(h[p],h[p+1]),t.meshTrianglesLine.lineTo(h[g],h[g+1]),t.meshTrianglesLine.lineTo(h[x],h[x+1])}if(this.drawMeshHull&&m>0){m=(m>>1)*2;let f=h[m-2],u=h[m-1];for(let p=0,g=m;p<g;p+=2){const x=h[p],b=h[p+1];t.meshHullLine.moveTo(x,b),t.meshHullLine.lineTo(f,u),f=x,u=b}}}}drawClippingFunc(e,t,s){const n=e.skeleton,i=n.slots;t.clippingPolygon.lineStyle(s,this.clippingPolygonColor,1);for(let r=0,a=i.length;r<a;r++){const c=i[r];if(!c.bone.active)continue;const l=c.appliedPose.attachment;if(l==null||!(l instanceof Mt))continue;const o=l,h=o.worldVerticesLength,d=new Float32Array(h);o.computeWorldVertices(n,c,0,h,d,0,2),t.clippingPolygon.drawPolygon(Array.from(d))}}drawBoundingBoxesFunc(e,t,s){t.boundingBoxesRect.lineStyle(s,this.boundingBoxesRectColor,5);const n=new Rn;n.update(e.skeleton,!0),n.minX!==1/0&&t.boundingBoxesRect.drawRect(n.minX,n.minY,n.getWidth(),n.getHeight());const i=n.polygons,r=(a,c,l)=>{if(t.boundingBoxesPolygon.lineStyle(s,this.boundingBoxesPolygonColor,1),t.boundingBoxesPolygon.beginFill(this.boundingBoxesPolygonColor,.1),l<3)throw new Error("Polygon must contain at least 3 vertices");const o=[],h=s*2;for(let d=0,m=a.length;d<m;d+=2){const f=a[d],u=a[d+1];t.boundingBoxesCircle.lineStyle(0),t.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),t.boundingBoxesCircle.drawCircle(f,u,h),t.boundingBoxesCircle.endFill(),o.push(f,u)}t.boundingBoxesPolygon.drawPolygon(o),t.boundingBoxesPolygon.endFill()};for(let a=0,c=i.length;a<c;a++){const l=i[a];r(l,0,l.length)}}drawPathsFunc(e,t,s){const n=e.skeleton,i=n.slots;t.pathsCurve.lineStyle(s,this.pathsCurveColor,1),t.pathsLine.lineStyle(s,this.pathsLineColor,1);for(let r=0,a=i.length;r<a;r++){const c=i[r];if(!c.bone.active)continue;const l=c.appliedPose.attachment;if(l==null||!(l instanceof jt))continue;const o=l;let h=o.worldVerticesLength;const d=new Float32Array(h);o.computeWorldVertices(n,c,0,h,d,0,2);let m=d[2],f=d[3],u=0,p=0;if(o.closed){const g=d[0],x=d[1],b=d[h-2],w=d[h-1];u=d[h-4],p=d[h-3],t.pathsCurve.moveTo(m,f),t.pathsCurve.bezierCurveTo(g,x,b,w,u,p),t.pathsLine.moveTo(m,f),t.pathsLine.lineTo(g,x),t.pathsLine.moveTo(u,p),t.pathsLine.lineTo(b,w)}h-=4;for(let g=4;g<h;g+=6){const x=d[g],b=d[g+1],w=d[g+2],v=d[g+3];u=d[g+4],p=d[g+5],t.pathsCurve.moveTo(m,f),t.pathsCurve.bezierCurveTo(x,b,w,v,u,p),t.pathsLine.moveTo(m,f),t.pathsLine.lineTo(x,b),t.pathsLine.moveTo(u,p),t.pathsLine.lineTo(w,v),m=u,f=p}}}unregisterSpine(e){this.registeredSpines.has(e)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",e);const t=this.registeredSpines.get(e);t&&(e.state.removeListener(t.eventCallback),t.parentDebugContainer.destroy({baseTexture:!0,children:!0,texture:!0}),this.registeredSpines.delete(e))}};export{to as AABBRectangleBoundsProvider,Ps as ATTACH_RETAIN,Ms as ATTACH_SETUP,is as AlphaTimeline,de as Animation,Ss as AnimationState,Mi as AnimationStateAdapter,yn as AnimationStateData,vn as AssetCache,Pi as AssetManagerBase,Sn as AtlasAttachmentLoader,$e as Attachment,Rt as AttachmentTimeline,Bn as BinaryInput,_s as BlendMode,xe as Bone,Ys as BoneData,pe as BonePose,St as BoneTimeline1,ue as BoneTimeline2,Fs as BoundingBoxAttachment,As as CURRENT,Mt as ClippingAttachment,z as Color,Nt as Constraint,Dt as ConstraintData,Vt as ConstraintTimeline1,Ct as CurveTimeline,Gt as CurveTimeline1,Qn as DarkSlotMesh,ei as DarkTintBatchGeometry,Jn as DarkTintGeometry,Zn as DarkTintMaterial,jn as DarkTintMesh,ni as DarkTintRenderer,Ci as DebugUtils,as as DeformTimeline,Tn as Downloader,An as DrawOrder,Jt as DrawOrderFolderTimeline,kt as DrawOrderTimeline,we as Event,Xs as EventData,xn as EventQueue,fe as EventTimeline,bn as EventType,Is as FIRST,Ii as FakeTexture,Pt as FromProperty,ke as FromRotate,Fe as FromScaleX,Ye as FromScaleY,Ee as FromShearY,Me as FromX,Pe as FromY,Zt as HOLD,In as IkConstraint,Qt as IkConstraintData,ye as IkConstraintPose,cs as IkConstraintTimeline,ge as Inherit,es as InheritTimeline,vi as IntSet,qt as Interpolation,ks as MODE,L as MathUtils,wt as MeshAttachment,dn as MixFrom,jt as PathAttachment,kn as PathConstraint,te as PathConstraintData,fs as PathConstraintMixTimeline,ve as PathConstraintPose,ds as PathConstraintPositionTimeline,us as PathConstraintSpacingTimeline,Mn as Physics,Ns as PhysicsConstraint,ps as PhysicsConstraintDampingTimeline,ee as PhysicsConstraintData,ws as PhysicsConstraintGravityTimeline,ms as PhysicsConstraintInertiaTimeline,xs as PhysicsConstraintMassTimeline,ys as PhysicsConstraintMixTimeline,Te as PhysicsConstraintPose,vs as PhysicsConstraintResetTimeline,gs as PhysicsConstraintStrengthTimeline,yt as PhysicsConstraintTimeline,bs as PhysicsConstraintWindTimeline,Cn as PointAttachment,zt as Pool,Es as Posed,Bs as PosedActive,me as PosedData,Ls as PositionMode,an as Pow,Ti as PowOut,un as Property,os as RGB2Timeline,rs as RGBA2Timeline,ss as RGBATimeline,ns as RGBTimeline,Tt as RegionAttachment,Vs as RotateMode,Ht as RotateTimeline,wn as SETUP,Ke as ScaleTimeline,Je as ScaleXTimeline,be as ScaleYMode,Ze as ScaleYTimeline,Wt as Sequence,qe as SequenceMode,ze as SequenceModeValues,ls as SequenceTimeline,eo as SetupPoseBoundsProvider,je as ShearTimeline,Qe as ShearXTimeline,ts as ShearYTimeline,Ot as Skeleton,En as SkeletonBinary,Rn as SkeletonBounds,ne as SkeletonClipping,Ae as SkeletonData,Nn as SkeletonJson,On as SkeletonPhysicsMovement,xr as SkeletonRendererCore,se as Skin,Ds as SkinEntry,so as SkinsAndAnimationBoundsProvider,Fn as Slider,At as SliderData,Cs as SliderMixTimeline,Se as SliderPose,Ts as SliderTimeline,Pn as Slot,Kt as SlotCurveTimeline,Os as SlotData,ii as SlotMesh,Ce as SlotPose,Rs as SpacingMode,no as Spine,ro as SpineDebugRenderer,ie as SpineTexture,on as StringSet,_e as Texture,he as TextureAtlas,hn as TextureAtlasPage,Ue as TextureAtlasRegion,ce as TextureFilter,cn as TextureRegion,ln as TextureWrap,Si as TimeKeeper,Q as Timeline,Ft as ToProperty,Us as ToRotate,zs as ToScaleX,Ws as ToScaleY,Gs as ToShearY,$s as ToX,qs as ToY,pn as TrackEntry,Yn as TransformConstraint,K as TransformConstraintData,Ie as TransformConstraintPose,hs as TransformConstraintTimeline,We as TranslateTimeline,Ge as TranslateXTimeline,He as TranslateYTimeline,Vn as Triangulator,V as Utils,le as Vector2,vt as VertexAttachment,Ai as WindowedMean,mn as isBoneTimeline,gn as isConstraintTimeline,fn as isSlotTimeline};