UNPKG

@esotericsoftware/spine-pixi-v8

Version:
1 lines 231 kB
"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 di=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}},un=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 Wt{r;g;b;a;static WHITE=new Wt(1,1,1,1);static RED=new Wt(1,0,0,1);static GREEN=new Wt(0,1,0,1);static BLUE=new Wt(0,0,1,1);static MAGENTA=new Wt(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 Wt){return s.setFromString(t)}},B=class bt{static epsilon=1e-5;static epsilon2=bt.epsilon*bt.epsilon;static PI=3.1415927;static PI2=bt.PI*2;static invPI2=1/bt.PI2;static radiansToDegrees=180/bt.PI;static radDeg=bt.radiansToDegrees;static degreesToRadians=bt.PI/180;static degRad=bt.degreesToRadians;static clamp(t,s,n){return t<s?s:t>n?n:t}static cosDeg(t){return Math.cos(t*bt.degRad)}static sinDeg(t){return Math.sin(t*bt.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*bt.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 bt.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}},ae=class ie{static linear=new class extends ie{applyInternal(t){return t}};static smooth=new class extends ie{applyInternal(t){return t*t*(3-2*t)}};static slowFast=new class extends ie{applyInternal(t){return t*t}};static fastSlow=new class extends ie{applyInternal(t){return(t-1)*(t-1)*-1+1}};static circle=new class extends ie{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)}},mn=class extends ae{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}},fi=class extends mn{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}},L=class re{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:re.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(re.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(re.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 re.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return re.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)]}},ui=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}`)}}},jt=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}},Se=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}},mi=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)}},gi=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}},ot;(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"})(ot||(ot={}));var It;(function(e){e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat"})(It||(It={}));var gn=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},pi=class extends Je{setFilters(e,t){}setWraps(e,t){}dispose(){}},Ce=class{pages=[];regions=[];constructor(e){const t=new xi(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=L.enumValue(ot,s[1]),o.magFilter=L.enumValue(ot,s[2])},n.repeat=o=>{s[1].indexOf("x")!==-1&&(o.uWrap=It.Repeat),s[1].indexOf("y")!==-1&&(o.vWrap=It.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 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 Qe(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 u=0;u<h;u++)m.push(parseInt(s[u+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 pn(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()}},xi=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}}},pn=class{name;minFilter=ot.Nearest;magFilter=ot.Nearest;uWrap=It.ClampToEdge;vWrap=It.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}},Qe=class extends gn{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)}},Ze=class Kn{static empty=[];name;timelineAttachment;timelineSlots=Kn.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}},Lt=class Jn extends Ze{static nextID=0;id=Jn.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 f=s.bone.appliedPose,p=f.worldX,g=f.worldY,x=f.a,b=f.b,w=f.c,v=f.d;for(let y=n,S=a;S<i;y+=2,S+=c){const C=o[y],T=o[y+1];r[S]=C*x+T*b+p,r[S+1]=C*w+T*v+g}return}let d=0,m=0;for(let f=0;f<n;f+=2){const p=h[d];d+=p+1,m+=p}const u=t.bones;if(l.length===0)for(let f=a,p=m*3;f<i;f+=c){let g=0,x=0,b=h[d++];for(b+=d;d<b;d++,p+=3){const w=u[h[d]].appliedPose,v=o[p],y=o[p+1],S=o[p+2];g+=(v*w.a+y*w.b+w.worldX)*S,x+=(v*w.c+y*w.d+w.worldY)*S}r[f]=g,r[f+1]=x}else{const f=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=u[h[d]].appliedPose,S=o[g]+f[x],C=o[g+1]+f[x+1],T=o[g+2];b+=(S*y.a+C*y.b+y.worldX)*T,w+=(S*y.c+C*y.d+y.worldY)*T}r[p]=b,r[p+1]=w}}}copyTo(t){this.bones?(t.bones=[],L.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=L.newFloatArray(this.vertices.length),L.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}},dt=class cn extends Lt{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 cn(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],L.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],L.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],L.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 cn(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 Qe){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}},j=class Qn extends Ze{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 Qn(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 u=s[0],f=s[1];n[i]=u*o+f*h+c,n[i+1]=u*d+f*m+l,i+=r,u=s[2],f=s[3],n[i]=u*o+f*h+c,n[i+1]=u*d+f*m+l,i+=r,u=s[4],f=s[5],n[i]=u*o+f*h+c,n[i+1]=u*d+f*m+l,i+=r,u=s[6],f=s[7],n[i]=u*o+f*h+c,n[i+1]=u*d+f*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,u=-c/2*i+t.offsetX*d,f=-l/2*r+t.offsetY*m,p=u+t.width*d,g=f+t.height*m,x=a*B.degRad,b=Math.cos(x),w=Math.sin(x),v=u*b+s,y=u*w,S=f*b+n,C=f*w,T=p*b+s,A=p*w,k=g*b+n,P=g*w;o[0]=v-C,o[1]=S+y,o[2]=v-P,o[3]=k+y,o[4]=T-P,o[5]=k+A,o[6]=T-C,o[7]=S+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},ce=class Ge{static _nextID=0;id=Ge.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 Ge(t,this.pathSuffix);if(L.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]=L.newFloatArray(n),L.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]=[],L.arrayCopy(this.offsets[n],0,s.offsets[n],0,8)}return s}update(t){const s=this.regions.length;if(t instanceof j){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=L.newFloatArray(8),this.offsets[n]=[],j.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 dt){const n=t.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=L.newFloatArray(n.length),dt.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 Ge._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 ts=[lt.hold,lt.once,lt.loop,lt.pingpong,lt.onceReverse,lt.loopReverse,lt.pingpongReverse],Te=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 un,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),bn(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)}},$;(function(e){e[e.current=0]="current",e[e.setup=1]="setup",e[e.first=2]="first"})($||($={}));var G;(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.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"})(G||(G={}));var et=class{propertyIds;frames;additive=!1;instant=!1;constructor(e,...t){this.propertyIds=t,this.frames=L.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static 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 xn(e){return typeof e=="object"&&e!==null&&typeof e.slotIndex=="number"}var Vt=class extends et{curves;constructor(e,t,...s){super(e,...s),this.curves=L.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){const t=this.getFrameCount()+e*18;if(this.curves.length>t){const s=L.newFloatArray(t);L.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 u=(n-r*2+c)*.03,f=(i-a*2+l)*.03,p=((r-c)*3-n+o)*.006,g=((a-l)*3-i+h)*.006;let x=u*2+p,b=f*2+g,w=(r-n)*.3+u+p*.16666667,v=(a-i)*.3+f+g*.16666667,y=n+w,S=i+v;for(let C=m+18;m<C;m+=2)d[m]=y,d[m+1]=S,w+=x,v+=b,x+=p,b+=g,y+=w,S+=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)}},le=class ye extends Vt{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 ye.beforeFirstKey(n,s,r,a);const c=this.getCurveValue(t);return n===$.setup?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 ye.beforeFirstKey(n,s,r,a);const c=this.getCurveValue(t);return n===$.setup?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]?ye.beforeFirstKey(n,s,r,a):n===$.setup?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 ye.beforeFirstKey(n,s,a,c);const l=this.getCurveValue(t)*c;if(s===1&&!i)return l;let o=n===$.setup?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 $.setup:return i;case $.first:return n+(i-n)*s;case $.current:return n}}};function bn(e){return typeof e=="object"&&e!==null&&typeof e.boneIndex=="number"}var Dt=class extends le{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)}},Ae=class extends Vt{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)}},he=class extends Dt{constructor(e,t,s){super(e,t,s,G.rotate)}apply1(e,t,s,n,i,r,a){e.rotation=this.getRelativeValue(s,n,i,r,e.rotation,t.rotation)}},es=class extends Ae{constructor(e,t,s){super(e,t,s,G.x,G.y)}apply1(e,t,s,n,i,r,a){const c=this.frames;if(s<c[0]){switch(i){case $.setup:e.x=t.x,e.y=t.y;break;case $.first:e.x+=(t.x-e.x)*n,e.y+=(t.y-e.y)*n;break}return}let l=0,o=0;const h=et.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 u=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*u,o+=(c[h+3+2]-o)*u;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===$.setup?(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)}},ss=class extends Dt{constructor(e,t,s){super(e,t,s,G.x)}apply1(e,t,s,n,i,r,a){e.x=this.getRelativeValue(s,n,i,r,e.x,t.x)}},ns=class extends Dt{constructor(e,t,s){super(e,t,s,G.y)}apply1(e,t,s,n,i,r,a){e.y=this.getRelativeValue(s,n,i,r,e.y,t.y)}},is=class extends Ae{constructor(e,t,s){super(e,t,s,G.scaleX,G.scaleY)}apply1(e,t,s,n,i,r,a){const c=this.frames;if(s<c[0]){switch(i){case $.setup:e.scaleX=t.scaleX,e.scaleY=t.scaleY;break;case $.first:e.scaleX+=(t.scaleX-e.scaleX)*n,e.scaleY+=(t.scaleY-e.scaleY)*n;break}return}let l,o;const h=et.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 u=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*u,o+=(c[h+3+2]-o)*u;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,u=0;i===$.setup?(m=t.scaleX,u=t.scaleY):(m=e.scaleX,u=e.scaleY),r?(e.scaleX=m+(l-t.scaleX)*n,e.scaleY=u+(o-t.scaleY)*n):a?(e.scaleX=m+(Math.abs(l)*Math.sign(m)-m)*n,e.scaleY=u+(Math.abs(o)*Math.sign(u)-u)*n):(m=Math.abs(m)*Math.sign(l),u=Math.abs(u)*Math.sign(o),e.scaleX=m+(l-m)*n,e.scaleY=u+(o-u)*n)}}},rs=class extends Dt{constructor(e,t,s){super(e,t,s,G.scaleX)}apply1(e,t,s,n,i,r,a){e.scaleX=this.getScaleValue(s,n,i,r,a,e.scaleX,t.scaleX)}},os=class extends Dt{constructor(e,t,s){super(e,t,s,G.scaleY)}apply1(e,t,s,n,i,r,a){e.scaleY=this.getScaleValue(s,n,i,r,a,e.scaleY,t.scaleY)}},as=class extends Ae{constructor(e,t,s){super(e,t,s,G.shearX,G.shearY)}apply1(e,t,s,n,i,r,a){const c=this.frames;if(s<c[0]){switch(i){case $.setup:e.shearX=t.shearX,e.shearY=t.shearY;break;case $.first:e.shearX+=(t.shearX-e.shearX)*n,e.shearY+=(t.shearY-e.shearY)*n;break}return}let l=0,o=0;const h=et.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 u=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*u,o+=(c[h+3+2]-o)*u;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===$.setup?(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)}},cs=class extends Dt{constructor(e,t,s){super(e,t,s,G.shearX)}apply1(e,t,s,n,i,r,a){e.shearX=this.getRelativeValue(s,n,i,r,e.shearX,t.shearX)}},ls=class extends Dt{constructor(e,t,s){super(e,t,s,G.shearY)}apply1(e,t,s,n,i,r,a){e.shearY=this.getRelativeValue(s,n,i,r,e.shearY,t.shearY)}},hs=class extends et{boneIndex;constructor(e,t){super(e,`${G.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,a,c,l){const o=e.bones[this.boneIndex];if(!o.active)return;const h=l?o.appliedPose:o.pose;if(c)r!==$.current&&(h.inherit=o.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r!==$.current&&(h.inherit=o.data.setupPose.inherit):h.inherit=this.frames[et.search(d,s,2)+1]}}},de=class extends Vt{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)}},ds=class extends de{constructor(e,t,s){super(e,t,s,`${G.rgb}|${s}`,`${G.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 a=t.color,c=this.frames;if(s<c[0]){const f=e.data.setupPose.color;switch(i){case $.setup:a.setFromColor(f);break;case $.first:a.add((f.r-a.r)*n,(f.g-a.g)*n,(f.b-a.b)*n,(f.a-a.a)*n);break}return}let l=0,o=0,h=0,d=0;const m=et.search(c,s,5),u=this.curves[m/5];switch(u){case 0:{const f=c[m];l=c[m+1],o=c[m+2],h=c[m+3],d=c[m+4];const p=(s-f)/(c[m+5]-f);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,u-2),o=this.getBezierValue(s,m,2,u+18-2),h=this.getBezierValue(s,m,3,u+36-2),d=this.getBezierValue(s,m,4,u+54-2)}if(n===1)a.set(l,o,h,d);else if(i===$.setup){const f=e.data.setupPose.color;a.set(f.r+(l-f.r)*n,f.g+(o-f.g)*n,f.b+(h-f.b)*n,f.a+(d-f.a)*n)}else a.add((l-a.r)*n,(o-a.g)*n,(h-a.b)*n,(d-a.a)*n)}},fs=class extends de{constructor(e,t,s){super(e,t,s,`${G.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 a=t.color;let c=0,l=0,o=0;const h=this.frames;if(s<h[0]){const u=e.data.setupPose.color;switch(i){case $.setup:{a.r=u.r,a.g=u.g,a.b=u.b;break}case $.first:{a.r+=(u.r-a.r)*n,a.g+=(u.g-a.g)*n,a.b+=(u.b-a.b)*n;break}}return}const d=et.search(h,s,4),m=this.curves[d>>2];switch(m){case 0:{const u=h[d];c=h[d+1],l=h[d+2],o=h[d+3];const f=(s-u)/(h[d+4]-u);c+=(h[d+4+1]-c)*f,l+=(h[d+4+2]-l)*f,o+=(h[d+4+3]-o)*f;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===$.setup){const u=e.data.setupPose.color;c=u.r+(c-u.r)*n,l=u.g+(l-u.g)*n,o=u.b+(o-u.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}},us=class extends le{slotIndex=0;constructor(e,t,s){super(e,t,`${G.alpha}|${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 u=o.data.setupPose.color.a;switch(r){case $.setup:h.a=u;break;case $.first:h.a+=(u-h.a)*i;break}return}if(d=this.getCurveValue(s),i!==1)if(r===$.setup){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}},ms=class extends de{constructor(e,t,s){super(e,t,s,`${G.rgb}|${s}`,`${G.alpha}|${s}`,`${G.rgb2}|${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 $.setup:{a.setFromColor(w),c.r=v.r,c.g=v.g,c.b=v.b;break}case $.first:{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,u=0,f=0,p=0;const g=et.search(d,s,8),x=this.curves[g>>3];switch(x){case 0:{const b=d[g];m=d[g+1],u=d[g+2],f=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,u+=(d[g+8+2]-u)*w,f+=(d[g+8+3]-f)*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],u=d[g+2],f=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),u=this.getBezierValue(s,g,2,x+18-2),f=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,u,f,p);else if(i===$.setup){const b=e.data.setupPose;let w=b.color;a.set(w.r+(m-w.r)*n,w.g+(u-w.g)*n,w.b+(f-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,(u-a.g)*n,(f-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}},gs=class extends de{constructor(e,t,s){super(e,t,s,`${G.rgb}|${s}`,`${G.rgb2}|${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,u=0;const f=this.frames;if(s<f[0]){const x=e.data.setupPose,b=x.color,w=x.darkColor;switch(i){case $.setup: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 $.first: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=et.search(f,s,7),g=this.curves[p/7];switch(g){case 0:{const x=f[p];l=f[p+1],o=f[p+2],h=f[p+3],d=f[p+4],m=f[p+5],u=f[p+6];const b=(s-x)/(f[p+7]-x);l+=(f[p+7+1]-l)*b,o+=(f[p+7+2]-o)*b,h+=(f[p+7+3]-h)*b,d+=(f[p+7+4]-d)*b,m+=(f[p+7+5]-m)*b,u+=(f[p+7+6]-u)*b;break}case 1:l=f[p+1],o=f[p+2],h=f[p+3],d=f[p+4],m=f[p+5],u=f[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),u=this.getBezierValue(s,p,6,g+90-2)}if(n!==1)if(i===$.setup){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,u=b.b+(u-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,u=c.b+(u-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=u<0?0:u>1?1:u}},Kt=class extends et{slotIndex=0;attachmentNames;constructor(e,t){super(e,`${G.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,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!==$.current&&this.setAttachment(e,h,o.data.attachmentName):this.setAttachment(e,h,this.attachmentNames[et.search(this.frames,s)])}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},ps=class extends Vt{slotIndex;attachment;vertices;constructor(e,t,s,n){super(e,t,`${G.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,a,c,l,o,h){const d=this.curves;let m=this.getFrameCount()+e*18;s===0&&(d[t]=2+m);const u=(n-r*2+c)*.03,f=l*.03-a*.06,p=((r-c)*3-n+o)*.006,g=(a-l+.33333333)*.018;let x=u*2+p,b=f*2+g,w=(r-n)*.3+u+p*.16666667,v=a*.3+f+g*.16666667,y=n+w,S=v;for(let C=m+18;m<C;m+=2)d[m]=y,d[m+1]=S,w+=x,v+=b,x+=p,b+=g,y+=w,S+=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,u,f;if(s>=d[d.length-1])f=0,m=this.vertices[d.length-1],u=null;else{const g=et.search(d,s);f=this.getCurvePercent(s,g),m=this.vertices[g],u=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(o[this.slotIndex],l,m,u,f,p,i,r,a);for(const g of h)this.applyToSlot(o[g],l,m,u,f,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=$.setup),n){case $.setup:r.length=0;break;case $.first:{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=$.setup);const m=c===$.setup;if(d.length=r,n===null)if(a===1)if(l&&!m)if(h.bones)for(let u=0;u<r;u++)d[u]+=s[u];else{const u=h.vertices;for(let f=0;f<r;f++)d[f]+=s[f]-u[f]}else L.arrayCopy(s,0,d,0,r);else if(m)if(h.bones)for(let u=0;u<r;u++)d[u]=s[u]*a;else{const u=h.vertices;for(let f=0;f<r;f++){const p=u[f];d[f]=p+(s[f]-p)*a}}else if(l)if(h.bones)for(let u=0;u<r;u++)d[u]+=s[u]*a;else{const u=h.vertices;for(let f=0;f<r;f++)d[f]+=(s[f]-u[f])*a}else for(let u=0;u<r;u++)d[u]+=(s[u]-d[u])*a;else if(a===1)if(l&&!m)if(h.bones)for(let u=0;u<r;u++){const f=s[u];d[u]+=f+(n[u]-f)*i}else{const u=h.vertices;for(let f=0;f<r;f++){const p=s[f];d[f]+=p+(n[f]-p)*i-u[f]}}else if(i===0)L.arrayCopy(s,0,d,0,r);else for(let u=0;u<r;u++){const f=s[u];d[u]=f+(n[u]-f)*i}else if(m)if(h.bones)for(let u=0;u<r;u++){const f=s[u];d[u]=(f+(n[u]-f)*i)*a}else{const u=h.vertices;for(let f=0;f<r;f++){const p=s[f],g=u[f];d[f]=g+(p+(n[f]-p)*i-g)*a}}else if(l)if(h.bones)for(let u=0;u<r;u++){const f=s[u];d[u]+=(f+(n[u]-f)*i)*a}else{const u=h.vertices;for(let f=0;f<r;f++){const p=s[f];d[f]+=(p+(n[f]-p)*i-u[f])*a}}else for(let u=0;u<r;u++){const f=s[u];d[u]+=(f+(n[u]-f)*i-d[u])*a}}},xs=class _t extends et{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,n){super(t,`${G.sequence}|${s}|${n.sequence.id}`),this.slotIndex=s,this.attachment=n,this.instant=!0}getFrameEntries(){return _t.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,n,i,r){const a=this.frames;t*=_t.ENTRIES,a[t]=s,a[t+_t.MODE]=n|i<<4,a[t+_t.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!==$.current){this.setupPose(h[this.slotIndex],o);for(const x of d)this.setupPose(h[x],o)}return}const u=et.search(m,n,_t.ENTRIES),f=m[u],p=m[u+_t.MODE],g=m[u+_t.DELAY];this.applyToSlot(h[this.slotIndex],o,n,f,p,g);for(const x of d)this.applyToSlot(h[x],o,n,f,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=ts[r&15];if(h!==lt.hold)switch(l+=(n-i)/a+1e-5|0,h){case lt.once:l=Math.min(o-1,l);break;case lt.loop:l%=o;break;case lt.pingpong:{const d=(o<<1)-2;l=d===0?0:l%d,l>=o&&(l=d-l);break}case lt.onceReverse:l=Math.max(o-1-l,0);break;case lt.loopReverse:l=o-1-l%o;break;case lt.pingpongReverse:{const d=(o<<1)-2;l=d===0?0:(l+o-1)%d,l>=o&&(l=d-l)}}c.sequenceIndex=l}},ke=class Zn extends et{static propertyIds=[`${G.event}`];events;constructor(t){super(t,...Zn.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=et.search(h,s)+1;const u=h[m];for(;m>0&&h[m-1]===u;)m--}for(;m<d&&n>=h[m];m++)i.push(this.events[m])}},$t=class ln extends et{static propertyID=`${G.drawOrder}`;static propertyIds=[ln.propertyID];drawOrders;constructor(t){super(t,...ln.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!==$.current&&L.arrayCopy(d,0,h,0,t.slots.length);return}const m=this.drawOrders[et.search(this.frames,n)];if(!m)L.arrayCopy(d,0,h,0,t.slots.length);else for(let u=0,f=m.length;u<f;u++)h[u]=d[m[u]]}},fe=class hn extends et{static propertyID=`${G.drawOrderFolder}`;slots;inFolder;drawOrders;constructor(t,s,n){super(t,...hn.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]=`${hn.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!==$.current&&this.setup(h,d);else{const m=this.drawOrders[et.search(this.frames,n)];if(!m)this.setup(h,d);else{const u=this.inFolder,f=this.slots;for(let p=0,g=0,x=f.length;!(u[h[p].data.index]&&(h[p]=d[f[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 wn(e){return typeof e=="object"&&e!==null&&typeof e.constraintIndex=="number"}var bs=class extends Vt{constraintIndex=0;constructor(e,t,s){super(e,t,`${G.ikConstraint}|${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 $.setup:{h.mix=x.mix,h.softness=x.softness,h.bendDirection=x.bendDirection,h.compress=x.compress,h.stretch=x.stretch;break}case $.first:{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,u=0;const f=et.search(d,s,6),p=this.curves[f/6];switch(p){case 0:{const x=d[f];m=d[f+1],u=d[f+2];const b=(s-x)/(d[f+6]-x);m+=(d[f+6+1]-m)*b,u+=(d[f+6+2]-u)*b;break}case 1:m=d[f+1],u=d[f+2];break;default:m=this.getBezierValue(s,f,1,p-2),u=this.getBezierValue(s,f,2,p+18-2)}const g=r===$.setup?o.data.setupPose:h;h.mix=g.mix+(m-g.mix)*i,h.softness=g.softness+(u-g.softness)*i,c?r===$.setup&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[f+3],h.compress=d[f+4]!==0,h.stretch=d[f+5]!==0)}},ws=class extends Vt{constraintIndex=0;constructor(e,t,s){super(e,t,`${G.transformConstraint}|${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 $.setup:{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 $.first:{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,u,f,p,g,x;const b=et.search(d,s,7),w=this.curves[b/7];switch(w){case 0:{const y=d[b];m=d[b+1],u=d[b+2],f=d[b+3],p=d[b+4],g=d[b+5],x=d[b+6];const S=(s-y)/(d[b+7]-y);m+=(d[b+7+1]-m)*S,u+=(d[b+7+2]-u)*S,f+=(d[b+7+3]-f)*S,p+=(d[b+7+4]-p)*S,g+=(d[b+7+5]-g)*S,x+=(d[b+7+6]-x)*S;break}case 1:m=d[b+1],u=d[b+2],f=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),u=this.getBezierValue(s,b,2,w+18-2),f=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===$.setup?o.data.setupPose:h;a?(h.mixRotate=v.mixRotate+m*i,h.mixX=v.mixX+u*i,h.mixY=v.mixY+f*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+(u-v.mixX)*i,h.mixY=v.mixY+(f-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)}},Jt=class extends le{constraintIndex;constructor(e,t,s,n){super(e,t,`${n}|${s}`),this.constraintIndex=s}},ys=class extends Jt{constructor(e,t,s){super(e,t,s,G.pathConstraintPosition),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)}}},vs=class extends Jt{constructor(e,t,s){super(e,t,s,G.pathConstraintSpacing)}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)}}},Ss=class extends Vt{constraintIndex;constructor(e,t,s){super(e,t,`${G.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,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 $.setup:{h.mixRotate=b.mixRotate,h.mixX=b.mixX,h.mixY=b.mixY;break}case $.first:{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,u,f;const p=et.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const b=d[p];m=d[p+1],u=d[p+2],f=d[p+3];const w=(s-b)/(d[p+4]-b);m+=(d[p+4+1]-m)*w,u+=(d[p+4+2]-u)*w,f+=(d[p+4+3]-f)*w;break}case 1:m=d[p+1],u=d[p+2],f=d[p+3];break;default:m=this.getBezierValue(s,p,1,g-2),u=this.getBezierValue(s,p,2,g+18-2),f=this.getBezierValue(s,p,3,g+36-2)}const x=r===$.setup?o.data.setupPose:h;a?(h.mixRotate=x.mixRotate+m*i,h.mixX=x.mixX+u*i,h.mixY=x.mixY+f*i):(h.mixRotate=x.mixRotate+(m-x.mixRotate)*i,h.mixX=x.mixX+(u-x.mixX)*i,h.mixY=x.mixY+(f-x.mixY)*i)}},Et=class extends Jt{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)))}}}},Cs=class extends Et{constructor(e,t,s){super(e,t,s,G.physicsConstraintInertia)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Ts=class extends Et{constructor(e,t,s){super(e,t,s,G.physicsConstraintStrength)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},As=class extends Et{constructor(e,t,s){super(e,t,s,G.physicsConstraintDamping)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},ks=class extends Et{constructor(e,t,s){super(e,t,s,G.physicsConstraintMass)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},Is=class extends Et{constructor(e,t,s){super(e,t,s,G.physicsConstraintWind),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Ps=class extends Et{constructor(e,t,s){super(e,t,s,G.physicsConstraintGravity),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Ms=class extends Et{constructor(e,t,s){super(e,t,s,G.physicsConstraintMix)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},Fs=class ti extends et{static propertyIds=[G.physicsConstraintReset.toString()];constraintIndex;constructor(t,s){super(t,...ti.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[et.search(d,s)+1]))if(h!=null)h.reset(t);else for(const m of t.physics)m.active&&m.reset(t)}},Ys=class extends Jt{constructor(e,t,s){super(e,t,s,G.sliderTime)}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)}}},Rs=class extends Jt{constructor(e,t,s){super(e,t,s,G.sliderMix),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)}}},Es=class dn{static emptyAnimation=new Te("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new vn(this);propertyIds=new Map;animationsChanged=!1;trackEntryPool=new jt(()=>new yn);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.