@esotericsoftware/spine-pixi-v8
Version:
The official Spine Runtimes for PixiJS v8.
1 lines • 226 kB
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/")||t.startsWith("pixi.js"))return window.PIXI}}var li=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}},je=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}},q=class qt{r;g;b;a;static WHITE=new qt(1,1,1,1);static RED=new qt(1,0,0,1);static GREEN=new qt(0,1,0,1);static BLUE=new qt(0,0,1,1);static MAGENTA=new qt(1,0,1,1);constructor(t=0,s=0,n=0,i=0){this.r=t,this.g=s,this.b=n,this.a=i}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 qt){return s.setFromString(t)}},L=class xt{static epsilon=1e-5;static epsilon2=xt.epsilon*xt.epsilon;static PI=3.1415927;static PI2=xt.PI*2;static invPI2=1/xt.PI2;static radiansToDegrees=180/xt.PI;static radDeg=xt.radiansToDegrees;static degreesToRadians=xt.PI/180;static degRad=xt.degreesToRadians;static clamp(t,s,n){return t<s?s:t>n?n:t}static cosDeg(t){return Math.cos(t*xt.degRad)}static sinDeg(t){return Math.sin(t*xt.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*xt.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 xt.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}},ie=class ee{static linear=new class extends ee{applyInternal(t){return t}};static smooth=new class extends ee{applyInternal(t){return t*t*(3-2*t)}};static slowFast=new class extends ee{applyInternal(t){return t*t}};static fastSlow=new class extends ee{applyInternal(t){return(t-1)*(t-1)*-1+1}};static circle=new class extends ee{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)}},hn=class extends ie{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}},ci=class extends hn{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}},X=class se{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,n,i,r){for(let c=s,l=i;c<s+r;c++,l++)n[l]=t[c]}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:se.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(se.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(se.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 se.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return se.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)]}},hi=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}`)}}},Gt=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}},we=class{x;y;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}},di=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)}},fi=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}},Je=class{_image;constructor(e){this._image=e}getImage(){return this._image}},rt;(function(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"})(rt||(rt={}));var At;(function(e){e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat"})(At||(At={}));var dn=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},ui=class extends Je{setFilters(e,t){}setWraps(e,t){}dispose(){}},ye=class{pages=[];regions=[];constructor(e){const t=new mi(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=X.enumValue(rt,s[1]),o.magFilter=X.enumValue(rt,s[2])},n.repeat=o=>{s[1].indexOf("x")!==-1&&(o.uWrap=At.Repeat),s[1].indexOf("y")!==-1&&(o.vWrap=At.Repeat)},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 c=null,l=null,a=null;for(;r!==null;)if(r.trim().length===0)c=null,r=t.readLine();else if(c){const o=new Ke(c,r);for(;;){const h=t.readEntry(s,r=t.readLine());if(h===0)break;const d=i[s[0]];if(d)d(o);else{l||(l=[]),a||(a=[]),l.push(s[0]);const f=[];for(let u=0;u<h;u++)f.push(parseInt(s[u+1]));a.push(f)}}o.originalWidth===0&&o.originalHeight===0&&(o.originalWidth=o.width,o.originalHeight=o.height),l&&l.length>0&&a&&a.length>0&&(o.names=l,o.values=a,l=null,a=null),o.u=o.x/c.width,o.v=o.y/c.height,o.degrees===90?(o.u2=(o.x+o.height)/c.width,o.v2=(o.y+o.width)/c.height):(o.u2=(o.x+o.width)/c.width,o.v2=(o.y+o.height)/c.height),this.regions.push(o)}else{for(c=new fn(r.trim());t.readEntry(s,r=t.readLine())!==0;){const o=n[s[0]];o&&o(c)}this.pages.push(c)}}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()}},mi=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}}},fn=class{name;minFilter=rt.Nearest;magFilter=rt.Nearest;uWrap=At.ClampToEdge;vWrap=At.ClampToEdge;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}},Ke=class extends dn{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)}},Qe=class Wn{static empty=[];name;timelineAttachment;timelineSlots=Wn.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,c=this.timelineSlots.length;r<c;r++){if(i=t[this.timelineSlots[r]],!i.bone.isActive())continue;const l=(n?i.getAppliedPose():i.getPose()).getAttachment();if(l!=null&&l.timelineAttachment===this)return!0}return!1}},Lt=class Gn extends Qe{static nextID=0;id=Gn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(t){super(t)}computeWorldVertices(t,s,n,i,r,c,l){i=c+(i>>1)*l;const a=s.appliedPose.deform;let o=this.vertices;const h=this.bones;if(!h){a.length>0&&(o=a);const m=s.bone.appliedPose,p=m.worldX,g=m.worldY,x=m.a,b=m.b,w=m.c,T=m.d;for(let y=n,v=c;v<i;y+=2,v+=l){const C=o[y],S=o[y+1];r[v]=C*x+S*b+p,r[v+1]=C*w+S*T+g}return}let d=0,f=0;for(let m=0;m<n;m+=2){const p=h[d];d+=p+1,f+=p}const u=t.bones;if(a.length===0)for(let m=c,p=f*3;m<i;m+=l){let g=0,x=0,b=h[d++];for(b+=d;d<b;d++,p+=3){const w=u[h[d]].appliedPose,T=o[p],y=o[p+1],v=o[p+2];g+=(T*w.a+y*w.b+w.worldX)*v,x+=(T*w.c+y*w.d+w.worldY)*v}r[m]=g,r[m+1]=x}else{const m=a;for(let p=c,g=f*3,x=f<<1;p<i;p+=l){let b=0,w=0,T=h[d++];for(T+=d;d<T;d++,g+=3,x+=2){const y=u[h[d]].appliedPose,v=o[g]+m[x],C=o[g+1]+m[x+1],S=o[g+2];b+=(v*y.a+C*y.b+y.worldX)*S,w+=(v*y.c+C*y.d+y.worldY)*S}r[p]=b,r[p+1]=w}}}copyTo(t){this.bones?(t.bones=[],X.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=X.newFloatArray(this.vertices.length),X.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}},mt=class rn extends Lt{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new q(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new q(0,0,0,0);constructor(t,s){super(t),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new rn(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],X.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],X.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],X.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 rn(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,c=t.v,l=0,a=0;if(t instanceof Ke){const o=t.page,h=o.width,d=o.height;switch(t.degrees){case 90:r-=(t.originalHeight-t.offsetY-t.height)/h,c-=(t.originalWidth-t.offsetX-t.width)/d,l=t.originalHeight/h,a=t.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+s[f+1]*l,n[f+1]=c+(1-s[f])*a;return;case 180:r-=(t.originalWidth-t.offsetX-t.width)/h,c-=t.offsetY/d,l=t.originalWidth/h,a=t.originalHeight/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f])*l,n[f+1]=c+(1-s[f+1])*a;return;case 270:r-=t.offsetY/h,c-=t.offsetX/d,l=t.originalHeight/h,a=t.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f+1])*l,n[f+1]=c+s[f]*a;return;default:r-=t.offsetX/h,c-=(t.originalHeight-t.offsetY-t.height)/d,l=t.originalWidth/h,a=t.originalHeight/d}}else t?(l=t.u2-r,a=t.v2-c):(r=c=0,l=a=1);for(let o=0;o<i;o+=2)n[o]=r+s[o]*l,n[o+1]=c+s[o+1]*a}},H=class Hn extends Qe{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new q(1,1,1,1);tempColor=new q(1,1,1,1);constructor(t,s){super(t),this.sequence=s}copy(){const t=new Hn(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 c=t.bone.appliedPose,l=c.worldX,a=c.worldY,o=c.a,h=c.b,d=c.c,f=c.d;let u=s[0],m=s[1];n[i]=u*o+m*h+l,n[i+1]=u*d+m*f+a,i+=r,u=s[2],m=s[3],n[i]=u*o+m*h+l,n[i+1]=u*d+m*f+a,i+=r,u=s[4],m=s[5],n[i]=u*o+m*h+l,n[i+1]=u*d+m*f+a,i+=r,u=s[6],m=s[7],n[i]=u*o+m*h+l,n[i+1]=u*d+m*f+a}getOffsets(t){return this.sequence.offsets[this.sequence.resolveIndex(t)]}updateSequence(){this.sequence.update(this)}static computeUVs(t,s,n,i,r,c,l,a,o,h){if(!t)throw new Error("Region not set.");const d=l/t.originalWidth*i,f=a/t.originalHeight*r,u=-l/2*i+t.offsetX*d,m=-a/2*r+t.offsetY*f,p=u+t.width*d,g=m+t.height*f,x=c*L.degRad,b=Math.cos(x),w=Math.sin(x),T=u*b+s,y=u*w,v=m*b+n,C=m*w,S=p*b+s,A=p*w,I=g*b+n,P=g*w;o[0]=T-C,o[1]=v+y,o[2]=T-P,o[3]=I+y,o[4]=S-P,o[5]=I+A,o[6]=S-C,o[7]=v+A,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},re=class ze{static _nextID=0;id=ze.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 ze(t,this.pathSuffix);if(X.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]=X.newFloatArray(n),X.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]=[],X.arrayCopy(this.offsets[n],0,s.offsets[n],0,8)}return s}update(t){const s=this.regions.length;if(t instanceof H){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=X.newFloatArray(8),this.offsets[n]=[],H.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 mt){const n=t.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=X.newFloatArray(n.length),mt.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 ze._nextID++}},lt;(function(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"})(lt||(lt={}));var Ze=[lt.hold,lt.once,lt.loop,lt.pingpong,lt.onceReverse,lt.loopReverse,lt.pingpongReverse],ve=class{name;timelines=[];timelineIds;bones;color=new q(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 je,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,c,l,a,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,f=h.length;d<f;d++)h[d].apply(e,t,s,i,r,c,l,a,o)}},W;(function(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.ikConstraint=15]="ikConstraint",e[e.transformConstraint=16]="transformConstraint",e[e.pathConstraintPosition=17]="pathConstraintPosition",e[e.pathConstraintSpacing=18]="pathConstraintSpacing",e[e.pathConstraintMix=19]="pathConstraintMix",e[e.physicsConstraintInertia=20]="physicsConstraintInertia",e[e.physicsConstraintStrength=21]="physicsConstraintStrength",e[e.physicsConstraintDamping=22]="physicsConstraintDamping",e[e.physicsConstraintMass=23]="physicsConstraintMass",e[e.physicsConstraintWind=24]="physicsConstraintWind",e[e.physicsConstraintGravity=25]="physicsConstraintGravity",e[e.physicsConstraintMix=26]="physicsConstraintMix",e[e.physicsConstraintReset=27]="physicsConstraintReset",e[e.sequence=28]="sequence",e[e.sliderTime=29]="sliderTime",e[e.sliderMix=30]="sliderMix"})(W||(W={}));var tt=class{propertyIds;frames;additive=!1;instant=!1;constructor(e,...t){this.propertyIds=t,this.frames=X.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 un(e){return typeof e=="object"&&e!==null&&typeof e.slotIndex=="number"}var Xt=class extends tt{curves;constructor(e,t,...s){super(e,...s),this.curves=X.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=X.newFloatArray(t);X.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,n,i,r,c,l,a,o,h){const d=this.curves;let f=this.getFrameCount()+e*18;s===0&&(d[t]=2+f);const u=(n-r*2+l)*.03,m=(i-c*2+a)*.03,p=((r-l)*3-n+o)*.006,g=((c-a)*3-i+h)*.006;let x=u*2+p,b=m*2+g,w=(r-n)*.3+u+p*.16666667,T=(c-i)*.3+m+g*.16666667,y=n+w,v=i+T;for(let C=f+18;f<C;f+=2)d[f]=y,d[f+1]=v,w+=x,T+=b,x+=p,b+=g,y+=w,v+=T}getBezierValue(e,t,s,n){const i=this.curves;if(i[n]>e){const a=this.frames[t],o=this.frames[t+s];return o+(e-a)/(i[n]-a)*(i[n+1]-o)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=e){const a=i[n-2],o=i[n-1];return o+(e-a)/(i[n]-a)*(i[n+1]-o)}t+=this.getFrameEntries();const c=i[r-2],l=i[r-1];return l+(e-c)/(this.frames[t]-c)*(this.frames[t+s]-l)}},oe=class extends Xt{constructor(e,t,s){super(e,t,s)}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){const t=this.frames;let s=t.length-2;for(let i=2;i<=s;i+=2)if(t[i]>e){s=i-2;break}const n=this.curves[s>>1];switch(n){case 0:{const i=t[s],r=t[s+1];return r+(e-i)/(t[s+2]-i)*(t[s+2+1]-r)}case 1:return t[s+1]}return this.getBezierValue(e,s,1,n-2)}getRelativeValue(e,t,s,n,i,r){if(e<this.frames[0])return s?r:i;const c=this.getCurveValue(e);return s?r+c*t:i+(n?c:c+r-i)*t}getAbsoluteValue(e,t,s,n,i,r,c){return c===void 0?this.getAbsoluteValue1(e,t,s,n,i,r):this.getAbsoluteValue2(e,t,s,n,i,r,c)}getAbsoluteValue1(e,t,s,n,i,r){if(e<this.frames[0])return s?r:i;const c=this.getCurveValue(e);return s?r+(n?c:c-r)*t:i+(n?c:c-i)*t}getAbsoluteValue2(e,t,s,n,i,r,c){return e<this.frames[0]?s?r:i:s?r+(n?c:c-r)*t:i+(n?c:c-i)*t}getScaleValue(e,t,s,n,i,r,c){if(e<this.frames[0])return s?c:r;const l=this.getCurveValue(e)*c;if(t===1&&!n)return l;let a=s?c:r;return n?a+(l-c)*t:i?a+(Math.abs(l)*Math.sign(a)-a)*t:(a=Math.abs(a)*Math.sign(l),a+(l-a)*t)}};function mn(e){return typeof e=="object"&&e!==null&&typeof e.boneIndex=="number"}var Vt=class extends oe{boneIndex;constructor(e,t,s,n){super(e,t,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(e,t,s,n,i,r,c,l,a){const o=e.bones[this.boneIndex];o.active&&this.apply1(a?o.appliedPose:o.pose,o.data.setupPose,s,i,r,c,l)}},Te=class extends Xt{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,c,l,a){const o=e.bones[this.boneIndex];o.active&&this.apply1(a?o.appliedPose:o.pose,o.data.setupPose,s,i,r,c,l)}},ae=class extends Vt{constructor(e,t,s){super(e,t,s,W.rotate)}apply1(e,t,s,n,i,r,c){e.rotation=this.getRelativeValue(s,n,i,r,e.rotation,t.rotation)}},ts=class extends Te{constructor(e,t,s){super(e,t,s,W.x,W.y)}apply1(e,t,s,n,i,r,c){const l=this.frames;if(s<l[0]){i&&(e.x=t.x,e.y=t.y);return}let a=0,o=0;const h=tt.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const f=l[h];a=l[h+1],o=l[h+2];const u=(s-f)/(l[h+3]-f);a+=(l[h+3+1]-a)*u,o+=(l[h+3+2]-o)*u;break}case 1:a=l[h+1],o=l[h+2];break;default:a=this.getBezierValue(s,h,1,d-2),o=this.getBezierValue(s,h,2,d+18-2)}i?(e.x=t.x+a*n,e.y=t.y+o*n):r?(e.x+=a*n,e.y+=o*n):(e.x+=(t.x+a-e.x)*n,e.y+=(t.y+o-e.y)*n)}},es=class extends Vt{constructor(e,t,s){super(e,t,s,W.x)}apply1(e,t,s,n,i,r,c){e.x=this.getRelativeValue(s,n,i,r,e.x,t.x)}},ss=class extends Vt{constructor(e,t,s){super(e,t,s,W.y)}apply1(e,t,s,n,i,r,c){e.y=this.getRelativeValue(s,n,i,r,e.y,t.y)}},ns=class extends Te{constructor(e,t,s){super(e,t,s,W.scaleX,W.scaleY)}apply1(e,t,s,n,i,r,c){const l=this.frames;if(s<l[0]){i&&(e.scaleX=t.scaleX,e.scaleY=t.scaleY);return}let a,o;const h=tt.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const f=l[h];a=l[h+1],o=l[h+2];const u=(s-f)/(l[h+3]-f);a+=(l[h+3+1]-a)*u,o+=(l[h+3+2]-o)*u;break}case 1:a=l[h+1],o=l[h+2];break;default:a=this.getBezierValue(s,h,1,d-2),o=this.getBezierValue(s,h,2,d+18-2)}if(a*=t.scaleX,o*=t.scaleY,n===1&&!r)e.scaleX=a,e.scaleY=o;else{let f=0,u=0;i?(f=t.scaleX,u=t.scaleY):(f=e.scaleX,u=e.scaleY),r?(e.scaleX=f+(a-t.scaleX)*n,e.scaleY=u+(o-t.scaleY)*n):c?(e.scaleX=f+(Math.abs(a)*Math.sign(f)-f)*n,e.scaleY=u+(Math.abs(o)*Math.sign(u)-u)*n):(f=Math.abs(f)*Math.sign(a),u=Math.abs(u)*Math.sign(o),e.scaleX=f+(a-f)*n,e.scaleY=u+(o-u)*n)}}},is=class extends Vt{constructor(e,t,s){super(e,t,s,W.scaleX)}apply1(e,t,s,n,i,r,c){e.scaleX=this.getScaleValue(s,n,i,r,c,e.scaleX,t.scaleX)}},rs=class extends Vt{constructor(e,t,s){super(e,t,s,W.scaleY)}apply1(e,t,s,n,i,r,c){e.scaleY=this.getScaleValue(s,n,i,r,c,e.scaleY,t.scaleY)}},os=class extends Te{constructor(e,t,s){super(e,t,s,W.shearX,W.shearY)}apply1(e,t,s,n,i,r,c){const l=this.frames;if(s<l[0]){i&&(e.shearX=t.shearX,e.shearY=t.shearY);return}let a=0,o=0;const h=tt.search(l,s,3),d=this.curves[h/3];switch(d){case 0:{const f=l[h];a=l[h+1],o=l[h+2];const u=(s-f)/(l[h+3]-f);a+=(l[h+3+1]-a)*u,o+=(l[h+3+2]-o)*u;break}case 1:a=l[h+1],o=l[h+2];break;default:a=this.getBezierValue(s,h,1,d-2),o=this.getBezierValue(s,h,2,d+18-2)}i?(e.shearX=t.shearX+a*n,e.shearY=t.shearY+o*n):r?(e.shearX+=a*n,e.shearY+=o*n):(e.shearX+=(t.shearX+a-e.shearX)*n,e.shearY+=(t.shearY+o-e.shearY)*n)}},as=class extends Vt{constructor(e,t,s){super(e,t,s,W.shearX)}apply1(e,t,s,n,i,r,c){e.shearX=this.getRelativeValue(s,n,i,r,e.shearX,t.shearX)}},ls=class extends Vt{constructor(e,t,s){super(e,t,s,W.shearY)}apply1(e,t,s,n,i,r,c){e.shearY=this.getRelativeValue(s,n,i,r,e.shearY,t.shearY)}},cs=class extends tt{boneIndex;constructor(e,t){super(e,`${W.inherit}|${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,c,l,a){const o=e.bones[this.boneIndex];if(!o.active)return;const h=a?o.appliedPose:o.pose;if(l)r&&(h.inherit=o.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r&&(h.inherit=o.data.setupPose.inherit):h.inherit=this.frames[tt.search(d,s,2)+1]}}},le=class extends Xt{slotIndex;constructor(e,t,s,...n){super(e,t,...n),this.slotIndex=s}apply(e,t,s,n,i,r,c,l,a){const o=e.slots[this.slotIndex];o.bone.active&&this.apply1(o,a?o.appliedPose:o.pose,s,i,r,c)}},hs=class extends le{constructor(e,t,s){super(e,t,s,`${W.rgb}|${s}`,`${W.alpha}|${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 c=t.color,l=this.frames;if(s<l[0]){i&&c.setFromColor(e.data.setupPose.color);return}let a=0,o=0,h=0,d=0;const f=tt.search(l,s,5),u=this.curves[f/5];switch(u){case 0:{const m=l[f];a=l[f+1],o=l[f+2],h=l[f+3],d=l[f+4];const p=(s-m)/(l[f+5]-m);a+=(l[f+5+1]-a)*p,o+=(l[f+5+2]-o)*p,h+=(l[f+5+3]-h)*p,d+=(l[f+5+4]-d)*p;break}case 1:a=l[f+1],o=l[f+2],h=l[f+3],d=l[f+4];break;default:a=this.getBezierValue(s,f,1,u-2),o=this.getBezierValue(s,f,2,u+18-2),h=this.getBezierValue(s,f,3,u+18*2-2),d=this.getBezierValue(s,f,4,u+18*3-2)}if(n===1)c.set(a,o,h,d);else if(i){const m=e.data.setupPose.color;c.set(m.r+(a-m.r)*n,m.g+(o-m.g)*n,m.b+(h-m.b)*n,m.a+(d-m.a)*n)}else c.add((a-c.r)*n,(o-c.g)*n,(h-c.b)*n,(d-c.a)*n)}},ds=class extends le{constructor(e,t,s){super(e,t,s,`${W.rgb}|${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 c=t.color;let l=0,a=0,o=0;const h=this.frames;if(s<h[0]){if(i){const u=e.data.setupPose.color;c.r=u.r,c.g=u.g,c.b=u.b}return}const d=tt.search(h,s,4),f=this.curves[d>>2];switch(f){case 0:{const u=h[d];l=h[d+1],a=h[d+2],o=h[d+3];const m=(s-u)/(h[d+4]-u);l+=(h[d+4+1]-l)*m,a+=(h[d+4+2]-a)*m,o+=(h[d+4+3]-o)*m;break}case 1:l=h[d+1],a=h[d+2],o=h[d+3];break;default:l=this.getBezierValue(s,d,1,f-2),a=this.getBezierValue(s,d,2,f+18-2),o=this.getBezierValue(s,d,3,f+18*2-2)}if(n!==1)if(i){const u=e.data.setupPose.color;l=u.r+(l-u.r)*n,a=u.g+(a-u.g)*n,o=u.b+(o-u.b)*n}else l=c.r+(l-c.r)*n,a=c.g+(a-c.g)*n,o=c.b+(o-c.b)*n;c.r=l<0?0:l>1?1:l,c.g=a<0?0:a>1?1:a,c.b=o<0?0:o>1?1:o}},fs=class extends oe{slotIndex=0;constructor(e,t,s){super(e,t,`${W.alpha}|${s}`),this.slotIndex=s}apply(e,t,s,n,i,r,c,l,a){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const h=(a?o.appliedPose:o.pose).color;let d=0;const f=this.frames;if(s<f[0]){r&&(h.a=o.data.setupPose.color.a);return}if(d=this.getCurveValue(s),i!==1)if(r){const u=o.data.setupPose.color;d=u.a+(d-u.a)*i}else d=h.a+(d-h.a)*i;h.a=d<0?0:d>1?1:d}},us=class extends le{constructor(e,t,s){super(e,t,s,`${W.rgb}|${s}`,`${W.alpha}|${s}`,`${W.rgb2}|${s}`)}getFrameEntries(){return 8}setFrame(e,t,s,n,i,r,c,l,a){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]=c,this.frames[e+6]=l,this.frames[e+7]=a}apply1(e,t,s,n,i,r){const c=t.color,l=t.darkColor;let a=0,o=0,h=0;const d=this.frames;if(s<d[0]){if(i){const b=e.data.setupPose;c.setFromColor(b.color);const w=b.darkColor;l.r=w.r,l.g=w.g,l.b=w.b}return}let f=0,u=0,m=0,p=0;const g=tt.search(d,s,8),x=this.curves[g>>3];switch(x){case 0:{const b=d[g];f=d[g+1],u=d[g+2],m=d[g+3],p=d[g+4],a=d[g+5],o=d[g+6],h=d[g+7];const w=(s-b)/(d[g+8]-b);f+=(d[g+8+1]-f)*w,u+=(d[g+8+2]-u)*w,m+=(d[g+8+3]-m)*w,p+=(d[g+8+4]-p)*w,a+=(d[g+8+5]-a)*w,o+=(d[g+8+6]-o)*w,h+=(d[g+8+7]-h)*w;break}case 1:f=d[g+1],u=d[g+2],m=d[g+3],p=d[g+4],a=d[g+5],o=d[g+6],h=d[g+7];break;default:f=this.getBezierValue(s,g,1,x-2),u=this.getBezierValue(s,g,2,x+18-2),m=this.getBezierValue(s,g,3,x+18*2-2),p=this.getBezierValue(s,g,4,x+18*3-2),a=this.getBezierValue(s,g,5,x+18*4-2),o=this.getBezierValue(s,g,6,x+18*5-2),h=this.getBezierValue(s,g,7,x+18*6-2)}if(n===1)c.set(f,u,m,p);else if(i){const b=e.data.setupPose;let w=b.color;c.set(w.r+(f-w.r)*n,w.g+(u-w.g)*n,w.b+(m-w.b)*n,w.a+(p-w.a)*n),w=b.darkColor,a=w.r+(a-w.r)*n,o=w.g+(o-w.g)*n,h=w.b+(h-w.b)*n}else c.add((f-c.r)*n,(u-c.g)*n,(m-c.b)*n,(p-c.a)*n),a=l.r+(a-l.r)*n,o=l.g+(o-l.g)*n,h=l.b+(h-l.b)*n;l.r=a<0?0:a>1?1:a,l.g=o<0?0:o>1?1:o,l.b=h<0?0:h>1?1:h}},ms=class extends le{constructor(e,t,s){super(e,t,s,`${W.rgb}|${s}`,`${W.rgb2}|${s}`)}getFrameEntries(){return 7}setFrame(e,t,s,n,i,r,c,l){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]=c,this.frames[e+6]=l}apply1(e,t,s,n,i,r){const c=t.color,l=t.darkColor;let a=0,o=0,h=0,d=0,f=0,u=0;const m=this.frames;if(s<m[0]){if(i){const x=e.data.setupPose,b=x.color,w=x.darkColor;c.r=b.r,c.g=b.g,c.b=b.b,l.r=w.r,l.g=w.g,l.b=w.b}return}const p=tt.search(m,s,7),g=this.curves[p/7];switch(g){case 0:{const x=m[p];a=m[p+1],o=m[p+2],h=m[p+3],d=m[p+4],f=m[p+5],u=m[p+6];const b=(s-x)/(m[p+7]-x);a+=(m[p+7+1]-a)*b,o+=(m[p+7+2]-o)*b,h+=(m[p+7+3]-h)*b,d+=(m[p+7+4]-d)*b,f+=(m[p+7+5]-f)*b,u+=(m[p+7+6]-u)*b;break}case 1:a=m[p+1],o=m[p+2],h=m[p+3],d=m[p+4],f=m[p+5],u=m[p+6];break;default:a=this.getBezierValue(s,p,1,g-2),o=this.getBezierValue(s,p,2,g+18-2),h=this.getBezierValue(s,p,3,g+18*2-2),d=this.getBezierValue(s,p,4,g+18*3-2),f=this.getBezierValue(s,p,5,g+18*4-2),u=this.getBezierValue(s,p,6,g+18*5-2)}if(n!==1)if(i){const x=e.data.setupPose;let b=x.color;a=b.r+(a-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,f=b.g+(f-b.g)*n,u=b.b+(u-b.b)*n}else a=c.r+(a-c.r)*n,o=c.g+(o-c.g)*n,h=c.b+(h-c.b)*n,d=l.r+(d-l.r)*n,f=l.g+(f-l.g)*n,u=l.b+(u-l.b)*n;c.r=a<0?0:a>1?1:a,c.g=o<0?0:o>1?1:o,c.b=h<0?0:h>1?1:h,l.r=d<0?0:d>1?1:d,l.g=f<0?0:f>1?1:f,l.b=u<0?0:u>1?1:u}},Ht=class extends tt{slotIndex=0;attachmentNames;constructor(e,t){super(e,`${W.attachment}|${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,c,l,a){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const h=a?o.appliedPose:o.pose;l||s<this.frames[0]?r&&this.setAttachment(e,h,o.data.attachmentName):this.setAttachment(e,h,this.attachmentNames[tt.search(this.frames,s)])}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},gs=class extends Xt{slotIndex;attachment;vertices;constructor(e,t,s,n){super(e,t,`${W.deform}|${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,c,l,a,o,h){const d=this.curves;let f=this.getFrameCount()+e*18;s===0&&(d[t]=2+f);const u=(n-r*2+l)*.03,m=a*.03-c*.06,p=((r-l)*3-n+o)*.006,g=(c-a+.33333333)*.018;let x=u*2+p,b=m*2+g,w=(r-n)*.3+u+p*.16666667,T=c*.3+m+g*.16666667,y=n+w,v=T;for(let C=f+18;f<C;f+=2)d[f]=y,d[f+1]=v,w+=x,T+=b,x+=p,b+=g,y+=w,v+=T}getCurvePercent(e,t){const s=this.curves;let n=s[t];switch(n){case 0:{const l=this.frames[t];return(e-l)/(this.frames[t+this.getFrameEntries()]-l)}case 1:return 0}if(n-=2,s[n]>e){const l=this.frames[t];return s[n+1]*(e-l)/(s[n]-l)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=e){const l=s[n-2],a=s[n-1];return a+(e-l)/(s[n]-l)*(s[n+1]-a)}const r=s[i-2],c=s[i-1];return c+(1-c)*(e-r)/(this.frames[t+this.getFrameEntries()]-r)}apply(e,t,s,n,i,r,c,l,a){const o=e.slots;if(!this.attachment.isTimelineActive(o,this.slotIndex,a))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(o[this.slotIndex],a,r);for(const g of h)this.applyBeforeFirst(o[g],a,r);return}let f,u,m;if(s>=d[d.length-1])m=0,f=this.vertices[d.length-1],u=null;else{const g=tt.search(d,s);m=this.getCurvePercent(s,g),f=this.vertices[g],u=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(o[this.slotIndex],a,f,u,m,p,i,r,c);for(const g of h)this.applyToSlot(o[g],a,f,u,m,p,i,r,c)}applyToSlot(e,t,s,n,i,r,c,l,a){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;if(d.length===0&&(l=!0),d.length=r,n===null)if(c===1)if(a&&!l)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 X.arrayCopy(s,0,d,0,r);else if(l)if(h.bones)for(let f=0;f<r;f++)d[f]=s[f]*c;else{const f=h.vertices;for(let u=0;u<r;u++){const m=f[u];d[u]=m+(s[u]-m)*c}}else if(a)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f]*c;else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=(s[u]-f[u])*c}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*c;else if(c===1)if(a&&!l)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 m=s[u];d[u]+=m+(n[u]-m)*i-f[u]}}else if(i===0)X.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(l)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]=(u+(n[f]-u)*i)*c}else{const f=h.vertices;for(let u=0;u<r;u++){const m=s[u],p=f[u];d[u]=p+(m+(n[u]-m)*i-p)*c}}else if(a)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i)*c}else{const f=h.vertices;for(let u=0;u<r;u++){const m=s[u];d[u]+=(m+(n[u]-m)*i-f[u])*c}}else for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i-d[f])*c}}applyBeforeFirst(e,t,s){if(!e.bone.active)return;const n=t?e.appliedPose:e.pose;n.attachment==null||n.attachment.timelineAttachment!==this.attachment||(n.deform.length===0&&(s=!0),s&&(n.deform.length=0))}},ps=class Dt extends tt{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,n){super(t,`${W.sequence}|${s}|${n.sequence.id}`),this.slotIndex=s,this.attachment=n,this.instant=!0}getFrameEntries(){return Dt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,n,i,r){const c=this.frames;t*=Dt.ENTRIES,c[t]=s,c[t+Dt.MODE]=n|i<<4,c[t+Dt.DELAY]=r}apply(t,s,n,i,r,c,l,a,o){const h=t.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,o))return;const d=this.attachment.timelineSlots,f=this.frames;if(a||n<f[0]){if(c){this.setupPose(h[this.slotIndex],o);for(const x of d)this.setupPose(h[x],o)}return}const u=tt.search(f,n,Dt.ENTRIES),m=f[u],p=f[u+Dt.MODE],g=f[u+Dt.DELAY];this.applyToSlot(h[this.slotIndex],o,n,m,p,g);for(const x of d)this.applyToSlot(h[x],o,n,m,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,c){if(!t.bone.active)return;const l=s?t.appliedPose:t.pose;if(l.attachment===null||l.attachment.timelineAttachment!==this.attachment)return;let a=r>>4,o=l.attachment.sequence.regions.length;const h=Ze[r&15];if(h!==lt.hold)switch(a+=(n-i)/c+1e-5|0,h){case lt.once:a=Math.min(o-1,a);break;case lt.loop:a%=o;break;case lt.pingpong:{const d=(o<<1)-2;a=d===0?0:a%d,a>=o&&(a=d-a);break}case lt.onceReverse:a=Math.max(o-1-a,0);break;case lt.loopReverse:a=o-1-a%o;break;case lt.pingpongReverse:{const d=(o<<1)-2;a=d===0?0:(a+o-1)%d,a>=o&&(a=d-a)}}l.sequenceIndex=a}},Ce=class jn extends tt{static propertyIds=[`${W.event}`];events;constructor(t){super(t,...jn.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,c,l,a,o){if(!i)return;const h=this.frames,d=this.frames.length;if(s>n)this.apply(null,s,Number.MAX_VALUE,i,0,!1,!1,!1,!1),s=-1;else if(s>=h[d-1])return;if(n<h[0])return;let f=0;if(s<h[0])f=0;else{f=tt.search(h,s)+1;const u=h[f];for(;f>0&&h[f-1]===u;)f--}for(;f<d&&n>=h[f];f++)i.push(this.events[f])}},_t=class on extends tt{static propertyID=`${W.drawOrder}`;static propertyIds=[on.propertyID];drawOrders;constructor(t){super(t,...on.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,c,l,a,o){const h=o?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(a||n<this.frames[0]){c&&X.arrayCopy(d,0,h,0,t.slots.length);return}const f=this.drawOrders[tt.search(this.frames,n)];if(!f)X.arrayCopy(d,0,h,0,t.slots.length);else for(let u=0,m=f.length;u<m;u++)h[u]=d[f[u]]}},ce=class Jn extends tt{slots;inFolder;drawOrders;constructor(t,s,n){super(t,...Jn.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]=`d${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,c,l,a,o){const h=o?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(a||n<this.frames[0])c&&this.setup(h,d);else{const f=this.drawOrders[tt.search(this.frames,n)];if(!f)this.setup(h,d);else{const u=this.inFolder,m=this.slots;for(let p=0,g=0,x=m.length;!(u[h[p].data.index]&&(h[p]=d[m[f[g]]],++g===x));p++);}}}setup(t,s){const{inFolder:n,slots:i}=this;for(let r=0,c=0,l=i.length;!(n[t[r].data.index]&&(t[r]=s[i[c]],++c===l));r++);}};function gn(e){return typeof e=="object"&&e!==null&&typeof e.constraintIndex=="number"}var xs=class extends Xt{constraintIndex=0;constructor(e,t,s){super(e,t,`${W.ikConstraint}|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,n,i,r,c){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]=c?1:0}apply(e,t,s,n,i,r,c,l,a){const o=e.constraints[this.constraintIndex];if(!o.active)return;const h=a?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){if(r){const x=o.data.setupPose;h.mix=x.mix,h.softness=x.softness,h.bendDirection=x.bendDirection,h.compress=x.compress,h.stretch=x.stretch}return}let f=0,u=0;const m=tt.search(d,s,6),p=this.curves[m/6];switch(p){case 0:{const x=d[m];f=d[m+1],u=d[m+2];const b=(s-x)/(d[m+6]-x);f+=(d[m+6+1]-f)*b,u+=(d[m+6+2]-u)*b;break}case 1:f=d[m+1],u=d[m+2];break;default:f=this.getBezierValue(s,m,1,p-2),u=this.getBezierValue(s,m,2,p+18-2)}const g=r?o.data.setupPose:h;h.mix=g.mix+(f-g.mix)*i,h.softness=g.softness+(u-g.softness)*i,l?r&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[m+3],h.compress=d[m+4]!==0,h.stretch=d[m+5]!==0)}},bs=class extends Xt{constraintIndex=0;constructor(e,t,s){super(e,t,`${W.transformConstraint}|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(e,t,s,n,i,r,c,l){const a=this.frames;e*=7,a[e]=t,a[e+1]=s,a[e+2]=n,a[e+3]=i,a[e+4]=r,a[e+5]=c,a[e+6]=l}apply(e,t,s,n,i,r,c,l,a){const o=e.constraints[this.constraintIndex];if(!o.active)return;const h=a?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){if(r){const y=o.data.setupPose;h.mixRotate=y.mixRotate,h.mixX=y.mixX,h.mixY=y.mixY,h.mixScaleX=y.mixScaleX,h.mixScaleY=y.mixScaleY,h.mixShearY=y.mixShearY}return}let f,u,m,p,g,x;const b=tt.search(d,s,7),w=this.curves[b/7];switch(w){case 0:{const y=d[b];f=d[b+1],u=d[b+2],m=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];const v=(s-y)/(d[b+7]-y);f+=(d[b+7+1]-f)*v,u+=(d[b+7+2]-u)*v,m+=(d[b+7+3]-m)*v,p+=(d[b+7+4]-p)*v,g+=(d[b+7+5]-g)*v,x+=(d[b+7+6]-x)*v;break}case 1:f=d[b+1],u=d[b+2],m=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];break;default:f=this.getBezierValue(s,b,1,w-2),u=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+18*2-2),p=this.getBezierValue(s,b,4,w+18*3-2),g=this.getBezierValue(s,b,5,w+18*4-2),x=this.getBezierValue(s,b,6,w+18*5-2)}const T=r?o.data.setupPose:h;c?(h.mixRotate=T.mixRotate+f*i,h.mixX=T.mixX+u*i,h.mixY=T.mixY+m*i,h.mixScaleX=T.mixScaleX+p*i,h.mixScaleY=T.mixScaleY+g*i,h.mixShearY=T.mixShearY+x*i):(h.mixRotate=T.mixRotate+(f-T.mixRotate)*i,h.mixX=T.mixX+(u-T.mixX)*i,h.mixY=T.mixY+(m-T.mixY)*i,h.mixScaleX=T.mixScaleX+(p-T.mixScaleX)*i,h.mixScaleY=T.mixScaleY+(g-T.mixScaleY)*i,h.mixShearY=T.mixShearY+(x-T.mixShearY)*i)}},jt=class extends oe{constraintIndex;constructor(e,t,s,n){super(e,t,`${n}|${s}`),this.constraintIndex=s}},ws=class extends jt{constructor(e,t,s){super(e,t,s,W.pathConstraintPosition),this.additive=!0}apply(e,t,s,n,i,r,c,l,a){const o=e.constraints[this.constraintIndex];if(o.active){const h=a?o.appliedPose:o.pose;h.position=this.getAbsoluteValue(s,i,r,c,h.position,o.data.setupPose.position)}}},ys=class extends jt{constructor(e,t,s){super(e,t,s,W.pathConstraintSpacing)}apply(e,t,s,n,i,r,c,l,a){const o=e.constraints[this.constraintIndex];if(o.active){const h=a?o.appliedPose:o.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,o.data.setupPose.spacing)}}},vs=class extends Xt{constraintIndex;constructor(e,t,s){super(e,t,`${W.pathConstraintMix}|${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,c,l,a){const o=e.constraints[this.constraintIndex];if(!o.active)return;const h=a?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){if(r){const b=o.data.setupPose;h.mixRotate=b.mixRotate,h.mixX=b.mixX,h.mixY=b.mixY}return}let f,u,m;const p=tt.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const b=d[p];f=d[p+1],u=d[p+2],m=d[p+3];const w=(s-b)/(d[p+4]-b);f+=(d[p+4+1]-f)*w,u+=(d[p+4+2]-u)*w,m+=(d[p+4+3]-m)*w;break}case 1:f=d[p+1],u=d[p+2],m=d[p+3];break;default:f=this.getBezierValue(s,p,1,g-2),u=this.getBezierValue(s,p,2,g+18-2),m=this.getBezierValue(s,p,3,g+18*2-2)}const x=r?o.data.setupPose:h;c?(h.mixRotate=x.mixRotate+f*i,h.mixX=x.mixX+u*i,h.mixY=x.mixY+m*i):(h.mixRotate=x.mixRotate+(f-x.mixRotate)*i,h.mixX=x.mixX+(u-x.mixX)*i,h.mixY=x.mixY+(m-x.mixY)*i)}},Ft=class extends jt{constructor(e,t,s,n){super(e,t,s,n)}apply(e,t,s,n,i,r,c,l,a){if(c&&!this.additive&&(c=!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 f=a?d.appliedPose:d.pose;this.set(f,this.getAbsoluteValue(s,i,r,c,this.get(f),this.get(d.data.setupPose),o))}}else{const o=e.constraints[this.constraintIndex];if(o.active){const h=a?o.appliedPose:o.pose;this.set(h,this.getAbsoluteValue(s,i,r,c,this.get(h),this.get(o.data.setupPose)))}}}},Ts=class extends Ft{constructor(e,t,s){super(e,t,s,W.physicsConstraintInertia)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Cs=class extends Ft{constructor(e,t,s){super(e,t,s,W.physicsConstraintStrength)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Ss=class extends Ft{constructor(e,t,s){super(e,t,s,W.physicsConstraintDamping)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},As=class extends Ft{constructor(e,t,s){super(e,t,s,W.physicsConstraintMass)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Is=class extends Ft{constructor(e,t,s){super(e,t,s,W.physicsConstraintWind),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},ks=class extends Ft{constructor(e,t,s){super(e,t,s,W.physicsConstraintGravity),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Ps=class extends Ft{constructor(e,t,s){super(e,t,s,W.physicsConstraintMix)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},Ms=class Kn extends tt{static propertyIds=[W.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,...Kn.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,c,l,a,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,!1,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(n<d[0])&&(s<d[0]||n>=d[tt.search(d,s)+1]))if(h!=null)h.reset(t);else for(const f of t.physics)f.active&&f.reset(t)}},Fs=class extends jt{constructor(e,t,s){super(e,t,s,W.sliderTime)}apply(e,t,s,n,i,r,c,l,a){const o=e.constraints[this.constraintIndex];if(o.active){const h=a?o.appliedPose:o.pose;h.time=this.getAbsoluteValue(s,i,r,c,h.time,o.data.setupPose.time)}}},Ys=class extends jt{constructor(e,t,s){super(e,t,s,W.sliderMix),this.additive=!0}apply(e,t,s,n,i,r,c,l,a){const o=e.constraints[this.constraintIndex];if(o.active){const h=a?o.appliedPose:o.pose;h.mix=this.getAbsoluteValue(s,i,r,c,h.mix,o.data.setupPose.mix)}}},Es=class an{static emptyAnimation=new ve("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new xn(this);propertyIds=new je;animationsChanged=!1;trackEntryPool=new Gt(()=>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 c=t*r.timeScale;if(r.delay>0){if(r.delay-=c,r.delay>0)continue;c=-r.delay,r.delay=0}let l=r.next;if(l){const a=r.trackLast-l.delay;if(a>=0){for(l.delay=0,l.trackTime+=r.timeScale===0?0:(a/r.timeScale+t)*l.timeScale,r.trackTime+=c,this.setTrack(n,l,!0);l.mixingFrom;)l.mixTime+=t,l=l.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 a=r.mixingFrom;for(r.mixingFrom=null,a&&(a.mixingTo=null);a;)this.queue.end(a),a=a.mixingFrom}r.trackTime+=c}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 l=0,a=n.length;l<a;l++){const o=n[l];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,f=o.getAnimationTime(),u=f,m=s;o.reverse&&(u=o.animation.duration-u,m=null);const p=o.animation.timelines,g=p.length;if(l===0&&h===1)for(let x=0;x<g;x++){X.webkit602BugfixHelper(h);const b=p[x];b instanceof Ht?this.applyAttachmentTimeline(b,t,u,!0,!0):b.apply(t,d,u,m,h,!0,!1,!1,!1)}else{const x=o.timelineMode,b=h>=o.alphaAttachmentThreshold,w=o.additive,T=w||o.shortestRotation,y=!T&&o.timelinesRotation.length!==g<<1;y&&(o.timelinesRotation.length=g<<1);for(let v=0;v<g;v++){const C=p[v],S=(x[v]&he)!==0;!T&&C instanceof ae?this.applyRotateTimeline(C,t,u,h,S,o.timelinesRotation,v<<1,y):C instanceof Ht?this.applyAttachmentTimeline(C,t,u,S,b):(X.webkit602BugfixHelper(h),C.apply(t,d,u,m,h,S,w,!1,!1))}}o.reverse&&this.eventsReverse(o,d,f),this.queueEvents(o,f),s.length=0,o.nextAnimationLast=f,o.nextTrackLast=o.trackTime}const r=this.unkeyedState+Rs,c=t.slots;for(let l=0,a=t.slots.length;l<a;l++){const o=c[l];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(),c=n.alpha*i,l=1-r*t.alpha,a=c*(1-r),o=l>0?a/l:c,h=n.animation.timelines,d=h.length,f=n.timelineMode,u=n.timelineHoldMix,m=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 T=n.animationLast,y=n.getAnimationTime(),v=y,C=null;n.reverse?v=n.animation.duration-v:r<n.eventThreshold&&(C=this.events),n.t