@esotericsoftware/spine-core 4.3.3 → 4.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnimationState.d.ts +1 -1
- package/dist/AnimationState.js +4 -4
- package/dist/PhysicsConstraintData.d.ts +1 -1
- package/dist/PhysicsConstraintData.js +2 -2
- package/dist/SkeletonBinary.js +8 -3
- package/dist/SkeletonClipping.js +4 -1
- package/dist/SkeletonJson.js +6 -4
- package/dist/SliderData.d.ts +2 -0
- package/dist/SliderData.js +4 -1
- package/dist/TransformConstraintData.js +4 -4
- package/dist/esm/spine-core.min.mjs +2 -2
- package/dist/esm/spine-core.mjs +25 -12
- package/dist/esm/spine-core.mjs.map +2 -2
- package/dist/iife/spine-core.js +25 -12
- package/dist/iife/spine-core.js.map +2 -2
- package/dist/iife/spine-core.min.js +2 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var spine=(()=>{var Ie=Object.defineProperty,Fn=Object.getOwnPropertyDescriptor,kn=Object.getOwnPropertyNames,En=Object.prototype.hasOwnProperty,Xn=(t,e)=>{for(var s in e)Ie(t,s,{get:e[s],enumerable:!0})},Vn=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of kn(e))!En.call(t,i)&&i!==s&&Ie(t,i,{get:()=>e[i],enumerable:!(n=Fn(e,i))||n.enumerable});return t},Rn=t=>Vn(Ie({},"__esModule",{value:!0}),t),Bs={};Xn(Bs,{AlphaTimeline:()=>ze,Animation:()=>Kt,AnimationState:()=>qn,AnimationStateAdapter:()=>_n,AnimationStateData:()=>zn,AssetCache:()=>Ks,AssetManagerBase:()=>Wn,AtlasAttachmentLoader:()=>Hn,Attachment:()=>Fe,AttachmentTimeline:()=>Ft,BinaryInput:()=>cn,BlendMode:()=>Is,Bone:()=>re,BoneData:()=>ms,BonePose:()=>ie,BoneTimeline1:()=>wt,BoneTimeline2:()=>Qt,BoundingBoxAttachment:()=>us,ClippingAttachment:()=>zt,Color:()=>z,Constraint:()=>Et,ConstraintData:()=>Xt,ConstraintTimeline1:()=>kt,CurveTimeline:()=>bt,CurveTimeline1:()=>Nt,DebugUtils:()=>On,DeformTimeline:()=>Ge,Downloader:()=>Qs,DrawOrder:()=>tn,DrawOrderFolderTimeline:()=>$t,DrawOrderTimeline:()=>St,Event:()=>oe,EventData:()=>xs,EventQueue:()=>Gs,EventTimeline:()=>Zt,EventType:()=>js,FIRST:()=>qt,FakeTexture:()=>Un,FromProperty:()=>At,FromRotate:()=>ge,FromScaleX:()=>be,FromScaleY:()=>we,FromShearY:()=>ye,FromX:()=>pe,FromY:()=>xe,HOLD:()=>_t,HOLD_FIRST:()=>Js,IkConstraint:()=>en,IkConstraintData:()=>Wt,IkConstraintPose:()=>le,IkConstraintTimeline:()=>Je,Inherit:()=>ne,InheritTimeline:()=>$e,IntSet:()=>Ln,Interpolation:()=>Lt,MathUtils:()=>R,MeshAttachment:()=>Tt,PathAttachment:()=>ee,PathConstraint:()=>sn,PathConstraintData:()=>Ht,PathConstraintMixTimeline:()=>ts,PathConstraintPose:()=>ce,PathConstraintPositionTimeline:()=>Qe,PathConstraintSpacingTimeline:()=>Ze,Physics:()=>nn,PhysicsConstraint:()=>vs,PhysicsConstraintDampingTimeline:()=>ns,PhysicsConstraintData:()=>Gt,PhysicsConstraintGravityTimeline:()=>as,PhysicsConstraintInertiaTimeline:()=>es,PhysicsConstraintMassTimeline:()=>is,PhysicsConstraintMixTimeline:()=>os,PhysicsConstraintPose:()=>he,PhysicsConstraintResetTimeline:()=>ls,PhysicsConstraintStrengthTimeline:()=>ss,PhysicsConstraintTimeline:()=>gt,PhysicsConstraintWindTimeline:()=>rs,PointAttachment:()=>Zs,Pool:()=>Bt,Posed:()=>gs,PosedActive:()=>ps,PosedData:()=>se,PositionMode:()=>bs,Pow:()=>Os,PowOut:()=>Bn,Property:()=>qs,RETAIN:()=>fs,RGB2Timeline:()=>He,RGBA2Timeline:()=>We,RGBATimeline:()=>qe,RGBTimeline:()=>_e,RegionAttachment:()=>Pt,RotateMode:()=>ys,RotateTimeline:()=>Dt,SETUP:()=>ds,SUBSEQUENT:()=>te,ScaleTimeline:()=>Le,ScaleXTimeline:()=>Be,ScaleYMode:()=>ae,ScaleYTimeline:()=>Oe,Sequence:()=>Ot,SequenceMode:()=>ke,SequenceModeValues:()=>Ee,SequenceTimeline:()=>je,ShearTimeline:()=>Ne,ShearXTimeline:()=>De,ShearYTimeline:()=>Ue,Skeleton:()=>an,SkeletonBinary:()=>Gn,SkeletonBounds:()=>Ri,SkeletonClipping:()=>un,SkeletonData:()=>Ts,SkeletonJson:()=>Li,SkeletonRendererCore:()=>Oi,Skin:()=>ue,SkinEntry:()=>Ss,Slider:()=>on,SliderData:()=>yt,SliderMixTimeline:()=>hs,SliderPose:()=>fe,SliderTimeline:()=>cs,Slot:()=>rn,SlotCurveTimeline:()=>Ut,SlotData:()=>As,SlotPose:()=>de,SpacingMode:()=>ws,StringSet:()=>Ce,Texture:()=>Ns,TextureAtlas:()=>Ye,TextureAtlasPage:()=>$s,TextureAtlasRegion:()=>Pe,TextureFilter:()=>Jt,TextureRegion:()=>Us,TextureWrap:()=>Ds,TimeKeeper:()=>Nn,Timeline:()=>Q,ToProperty:()=>It,ToRotate:()=>Cs,ToScaleX:()=>Ps,ToScaleY:()=>Fs,ToShearY:()=>ks,ToX:()=>Ms,ToY:()=>Ys,TrackEntry:()=>Hs,TransformConstraint:()=>ln,TransformConstraintData:()=>j,TransformConstraintPose:()=>me,TransformConstraintTimeline:()=>Ke,TranslateTimeline:()=>Xe,TranslateXTimeline:()=>Ve,TranslateYTimeline:()=>Re,Triangulator:()=>fn,Utils:()=>B,Vector2:()=>Me,VertexAttachment:()=>xt,WindowedMean:()=>Dn,isBoneTimeline:()=>zs,isConstraintTimeline:()=>Ws,isSlotTimeline:()=>_s});var Ln=class{array=[];add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!==void 0}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},Ce=class{entries={};size=0;add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,n=t.length;s<n;s++)this.add(t[s]);return e!==this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},z=class Ct{constructor(e=0,s=0,n=0,i=0){this.r=e,this.g=s,this.b=n,this.a=i}static WHITE=new Ct(1,1,1,1);static RED=new Ct(1,0,0,1);static GREEN=new Ct(0,1,0,1);static BLUE=new Ct(0,0,1,1);static MAGENTA=new Ct(1,0,1,1);set(e,s,n,i){return this.r=e,this.g=s,this.b=n,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)==="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!==8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,n,i){return this.r+=e,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(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>`0${(s*255).toString(16)}`.slice(-2);return+`0x${e(this.r)}${e(this.g)}${e(this.b)}`}static fromString(e,s=new Ct){return s.setFromString(e)}},R=class lt{static epsilon=1e-5;static epsilon2=lt.epsilon*lt.epsilon;static PI=3.1415927;static PI2=lt.PI*2;static invPI2=1/lt.PI2;static radiansToDegrees=180/lt.PI;static radDeg=lt.radiansToDegrees;static degreesToRadians=lt.PI/180;static degRad=lt.degreesToRadians;static clamp(e,s,n){return e<s?s:e>n?n:e}static cosDeg(e){return Math.cos(e*lt.degRad)}static sinDeg(e){return Math.sin(e*lt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*lt.radDeg}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){const s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return lt.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,n){const i=Math.random(),r=s-e;return i<=(n-e)/r?e+Math.sqrt(i*r*(n-e)):s-Math.sqrt((1-i)*r*(s-n))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Lt=class Vt{static linear=new class extends Vt{applyInternal(e){return e}};static smooth=new class extends Vt{applyInternal(e){return e*e*(3-2*e)}};static slowFast=new class extends Vt{applyInternal(e){return e*e}};static fastSlow=new class extends Vt{applyInternal(e){return(e-1)*(e-1)*-1+1}};static circle=new class extends Vt{applyInternal(e){return e<=.5?(e*=2,(1-Math.sqrt(1-e*e))/2):(e--,e*=2,(Math.sqrt(1-e*e)+1)/2)}};apply(e,s,n){return s===void 0||n===void 0?this.applyInternal(e):e+(s-e)*this.applyInternal(n)}},Os=class extends Lt{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2===0?-2:2)+1}},Bn=class extends Os{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2===0?-1:1)+1}},B=class Rt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,n,i,r){for(let l=s,c=i;l<s+r;l++,c++)n[c]=e[l]}static arrayFill(e,s,n,i){for(let r=s;r<n;r++)e[r]=i}static setArraySize(e,s,n=0){const i=e.length;if(i===s)return e;if(e.length=s,i<s)for(let r=i;r<s;r++)e[r]=n;return e}static ensureArrayCapacity(e,s,n=0){return e.length>=s?e:Rt.setArraySize(e,s,n)}static newArray(e,s){const n=[];for(let i=0;i<e;i++)n[i]=s;return n}static newFloatArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static newShortArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static toFloatArray(e){return Rt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Rt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e){}static contains(e,s,n=!0){for(let i=0;i<e.length;i++)if(e[i]===s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},On=class{static logBones(t){for(let e=0;e<t.bones.length;e++){const s=t.bones[e].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},Bt=class{items=[];instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset?.(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Me=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!==0&&(this.x/=t,this.y/=t),this}},Nn=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Dn=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},Ns=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Jt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(Jt||{}),Ds=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(Ds||{}),Us=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Un=class extends Ns{setFilters(t,e){}setWraps(t,e){}dispose(){}},Ye=class{pages=[];regions=[];constructor(t){const e=new $n(t),s=new Array(4),n={};n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.format=()=>{},n.filter=a=>{a.minFilter=B.enumValue(Jt,s[1]),a.magFilter=B.enumValue(Jt,s[2])},n.repeat=a=>{s[1].indexOf("x")!==-1&&(a.uWrap=10497),s[1].indexOf("y")!==-1&&(a.vWrap=10497)},n.pma=a=>{a.pma=s[1]==="true"};var i={};i.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},i.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},i.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},i.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},i.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},i.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},i.rotate=a=>{const h=s[1];h==="true"?a.degrees=90:h!=="false"&&(a.degrees=parseInt(h))},i.index=a=>{a.index=parseInt(s[1])};let r=e.readLine();for(;r&&r.trim().length===0;)r=e.readLine();for(;!(!r||r.trim().length===0||e.readEntry(s,r)===0);)r=e.readLine();let l=null,c=null,o=null;for(;r!==null;)if(r.trim().length===0)l=null,r=e.readLine();else if(l){const a=new Pe(l,r);for(;;){const h=e.readEntry(s,r=e.readLine());if(h===0)break;const d=i[s[0]];if(d)d(a);else{c||(c=[]),o||(o=[]),c.push(s[0]);const f=[];for(let u=0;u<h;u++)f.push(parseInt(s[u+1]));o.push(f)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),c&&c.length>0&&o&&o.length>0&&(a.names=c,a.values=o,c=null,o=null),a.u=a.x/l.width,a.v=a.y/l.height,a.degrees===90?(a.u2=(a.x+a.height)/l.width,a.v2=(a.y+a.width)/l.height):(a.u2=(a.x+a.width)/l.width,a.v2=(a.y+a.height)/l.height),this.regions.push(a)}else{for(l=new $s(r.trim());e.readEntry(s,r=e.readLine())!==0;){const a=n[s[0]];a&&a(l)}this.pages.push(l)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name===t)return this.regions[e];return null}setTextures(t,e=""){for(const s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},$n=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length===0))return 0;const s=e.indexOf(":");if(s===-1)return 0;t[0]=e.substr(0,s).trim();for(let n=1,i=s+1;;n++){const r=e.indexOf(",",i);if(r===-1)return t[n]=e.substr(i).trim(),n;if(t[n]=e.substr(i,r-i).trim(),i=r+1,n===4)return 4}}},$s=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(const e of this.regions)e.texture=t}},Pe=class extends Us{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},Fe=class gn{static empty=[];name;timelineAttachment;timelineSlots=gn.empty;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e,this.timelineAttachment=this}isTimelineActive(e,s,n){let i=e[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,l=this.timelineSlots.length;r<l;r++){if(i=e[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}},xt=class pn extends Fe{static nextID=0;id=pn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(e){super(e)}computeWorldVertices(e,s,n,i,r,l,c){i=l+(i>>1)*c;const o=s.appliedPose.deform;let a=this.vertices;const h=this.bones;if(!h){o.length>0&&(a=o);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=l;v<i;y+=2,v+=c){const S=a[y],A=a[y+1];r[v]=S*x+A*b+p,r[v+1]=S*w+A*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=e.bones;if(o.length===0)for(let m=l,p=f*3;m<i;m+=c){let g=0,x=0,b=h[d++];for(b+=d;d<b;d++,p+=3){const w=u[h[d]].appliedPose,T=a[p],y=a[p+1],v=a[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=o;for(let p=l,g=f*3,x=f<<1;p<i;p+=c){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=a[g]+m[x],S=a[g+1]+m[x+1],A=a[g+2];b+=(v*y.a+S*y.b+y.worldX)*A,w+=(v*y.c+S*y.d+y.worldY)*A}r[p]=b,r[p+1]=w}}}copyTo(e){this.bones?(e.bones=[],B.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment,e.timelineSlots=this.timelineSlots}},Tt=class Xs extends xt{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(e,s){super(e),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const e=new Xs(this.name,this.sequence.copy());return e.path=this.path,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=[],B.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.triangles=[],B.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,this.edges&&(e.edges=[],B.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(e){this.sourceMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength,this.edges=e.edges,this.width=e.width,this.height=e.height)}newLinkedMesh(){const e=new Xs(this.name,this.sequence.copy());return e.timelineAttachment=this.timelineAttachment,e.path=this.path,e.color.setFromColor(this.color),e.setSourceMesh(this.sourceMesh?this.sourceMesh:this),e.updateSequence(),e}static computeUVs(e,s,n){if(!e)throw new Error("Region not set.");const i=n.length;let r=e.u,l=e.v,c=0,o=0;if(e instanceof Pe){const a=e.page,h=a.width,d=a.height;switch(e.degrees){case 90:r-=(e.originalHeight-e.offsetY-e.height)/h,l-=(e.originalWidth-e.offsetX-e.width)/d,c=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+s[f+1]*c,n[f+1]=l+(1-s[f])*o;return;case 180:r-=(e.originalWidth-e.offsetX-e.width)/h,l-=e.offsetY/d,c=e.originalWidth/h,o=e.originalHeight/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f])*c,n[f+1]=l+(1-s[f+1])*o;return;case 270:r-=e.offsetY/h,l-=e.offsetX/d,c=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f+1])*c,n[f+1]=l+s[f]*o;return;default:r-=e.offsetX/h,l-=(e.originalHeight-e.offsetY-e.height)/d,c=e.originalWidth/h,o=e.originalHeight/d}}else e?(c=e.u2-r,o=e.v2-l):(r=l=0,c=o=1);for(let a=0;a<i;a+=2)n[a]=r+s[a]*c,n[a+1]=l+s[a+1]*o}},Pt=class xn extends Fe{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(e,s){super(e),this.sequence=s}copy(){const e=new xn(this.name,this.sequence.copy());return e.path=this.path,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,e.color.setFromColor(this.color),e}computeWorldVertices(e,s,n,i,r){const l=e.bone.appliedPose,c=l.worldX,o=l.worldY,a=l.a,h=l.b,d=l.c,f=l.d;let u=s[0],m=s[1];n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[2],m=s[3],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[4],m=s[5],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[6],m=s[7],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o}getOffsets(e){return this.sequence.offsets[this.sequence.resolveIndex(e)]}updateSequence(){this.sequence.update(this)}static computeUVs(e,s,n,i,r,l,c,o,a,h){if(!e)throw new Error("Region not set.");const d=c/e.originalWidth*i,f=o/e.originalHeight*r,u=-c/2*i+e.offsetX*d,m=-o/2*r+e.offsetY*f,p=u+e.width*d,g=m+e.height*f,x=l*R.degRad,b=Math.cos(x),w=Math.sin(x),T=u*b+s,y=u*w,v=m*b+n,S=m*w,A=p*b+s,I=p*w,M=g*b+n,Y=g*w;a[0]=T-S,a[1]=v+y,a[2]=T-Y,a[3]=M+y,a[4]=A-Y,a[5]=M+I,a[6]=A-S,a[7]=v+I,e==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]=e.v2,h[2]=e.u,h[5]=e.v,h[6]=e.u2,e.degrees===90?(h[0]=e.u2,h[3]=e.v2,h[4]=e.u,h[7]=e.v):(h[0]=e.u,h[3]=e.v,h[4]=e.u2,h[7]=e.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},Ot=class Te{static _nextID=0;id=Te.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(e,s){this.regions=new Array(e),this.pathSuffix=s}copy(){const e=this.regions.length,s=new Te(e,this.pathSuffix);if(B.arrayCopy(this.regions,0,s.regions,0,e),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<e;i++)s.uvs[i]=B.newFloatArray(n),B.arrayCopy(this.uvs[i],0,s.uvs[i],0,n)}if(this.offsets!=null){s.offsets=[];for(let n=0;n<e;n++)s.offsets[n]=[],B.arrayCopy(this.offsets[n],0,s.offsets[n],0,8)}return s}update(e){const s=this.regions.length;if(e instanceof Pt){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=B.newFloatArray(8),this.offsets[n]=[],Pt.computeUVs(this.regions[n],e.x,e.y,e.scaleX,e.scaleY,e.rotation,e.width,e.height,this.offsets[n],this.uvs[n])}else if(e instanceof Tt){const n=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=B.newFloatArray(n.length),Tt.computeUVs(this.regions[i],n,this.uvs[i])}}resolveIndex(e){let s=e.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(e){return this.uvs[e]}hasPathSuffix(){return this.pathSuffix}getPath(e,s){if(!this.pathSuffix)return e;let n=e;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 Te._nextID++}},ke=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(ke||{}),Ee=[0,1,2,3,4,5,6],Kt=class{name;timelines=[];timelineIds;bones;color=new z(1,1,1,1);duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.duration=s,this.timelineIds=new Ce,this.bones=[],this.setTimelines(e)}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t;const e=t.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,n=t;for(let i=0;i<e;i++){const r=n[i];this.timelineIds.addAll(r.propertyIds),zs(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,n,i,r,l,c,o,a){if(!t)throw new Error("skeleton cannot be null.");n&&this.duration!==0&&(s%=this.duration,e>0&&(e%=this.duration));const h=this.timelines;for(let d=0,f=h.length;d<f;d++)h[d].apply(t,e,s,i,r,l,c,o,a)}},qs=(t=>(t[t.rotate=0]="rotate",t[t.x=1]="x",t[t.y=2]="y",t[t.scaleX=3]="scaleX",t[t.scaleY=4]="scaleY",t[t.shearX=5]="shearX",t[t.shearY=6]="shearY",t[t.inherit=7]="inherit",t[t.rgb=8]="rgb",t[t.alpha=9]="alpha",t[t.rgb2=10]="rgb2",t[t.attachment=11]="attachment",t[t.deform=12]="deform",t[t.event=13]="event",t[t.drawOrder=14]="drawOrder",t[t.ikConstraint=15]="ikConstraint",t[t.transformConstraint=16]="transformConstraint",t[t.pathConstraintPosition=17]="pathConstraintPosition",t[t.pathConstraintSpacing=18]="pathConstraintSpacing",t[t.pathConstraintMix=19]="pathConstraintMix",t[t.physicsConstraintInertia=20]="physicsConstraintInertia",t[t.physicsConstraintStrength=21]="physicsConstraintStrength",t[t.physicsConstraintDamping=22]="physicsConstraintDamping",t[t.physicsConstraintMass=23]="physicsConstraintMass",t[t.physicsConstraintWind=24]="physicsConstraintWind",t[t.physicsConstraintGravity=25]="physicsConstraintGravity",t[t.physicsConstraintMix=26]="physicsConstraintMix",t[t.physicsConstraintReset=27]="physicsConstraintReset",t[t.sequence=28]="sequence",t[t.sliderTime=29]="sliderTime",t[t.sliderMix=30]="sliderMix",t))(qs||{}),Q=class{propertyIds;frames;additive=!1;instant=!1;constructor(t,...e){this.propertyIds=e,this.frames=B.newFloatArray(t*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(t,e,s=1){const n=t.length;for(let i=s;i<n;i+=s)if(t[i]>e)return i-s;return n-s}};function _s(t){return typeof t=="object"&&t!==null&&typeof t.slotIndex=="number"}var bt=class extends Q{curves;constructor(t,e,...s){super(t,...s),this.curves=B.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=B.newFloatArray(e);B.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,n,i,r,l,c,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const u=(n-r*2+c)*.03,m=(i-l*2+o)*.03,p=((r-c)*3-n+a)*.006,g=((l-o)*3-i+h)*.006;let x=u*2+p,b=m*2+g,w=(r-n)*.3+u+p*.16666667,T=(l-i)*.3+m+g*.16666667,y=n+w,v=i+T;for(let S=f+18;f<S;f+=2)d[f]=y,d[f+1]=v,w+=x,T+=b,x+=p,b+=g,y+=w,v+=T}getBezierValue(t,e,s,n){const i=this.curves;if(i[n]>t){const o=this.frames[e],a=this.frames[e+s];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=t){const o=i[n-2],a=i[n-1];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}e+=this.getFrameEntries();const l=i[r-2],c=i[r-1];return c+(t-l)/(this.frames[e]-l)*(this.frames[e+s]-c)}},Nt=class extends bt{constructor(t,e,s){super(t,e,s)}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}const n=this.curves[s>>1];switch(n){case 0:{const i=e[s],r=e[s+1];return r+(t-i)/(e[s+2]-i)*(e[s+2+1]-r)}case 1:return e[s+1]}return this.getBezierValue(t,s,1,n-2)}getRelativeValue(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const l=this.getCurveValue(t);return s?r+l*e:i+(n?l:l+r-i)*e}getAbsoluteValue(t,e,s,n,i,r,l){return l===void 0?this.getAbsoluteValue1(t,e,s,n,i,r):this.getAbsoluteValue2(t,e,s,n,i,r,l)}getAbsoluteValue1(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const l=this.getCurveValue(t);return s?r+(n?l:l-r)*e:i+(n?l:l-i)*e}getAbsoluteValue2(t,e,s,n,i,r,l){return t<this.frames[0]?s?r:i:s?r+(n?l:l-r)*e:i+(n?l:l-i)*e}getScaleValue(t,e,s,n,i,r,l){if(t<this.frames[0])return s?l:r;const c=this.getCurveValue(t)*l;if(e===1&&!n)return c;let o=s?l:r;return n?o+(c-l)*e:i?o+(Math.abs(c)*Math.sign(o)-o)*e:(o=Math.abs(o)*Math.sign(c),o+(c-o)*e)}};function zs(t){return typeof t=="object"&&t!==null&&typeof t.boneIndex=="number"}var wt=class extends Nt{boneIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,l,c)}},Qt=class extends bt{boneIndex;constructor(t,e,s,n,i){super(t,e,`${n}|${s}`,`${i}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(t,e,s,n){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,l,c)}},Dt=class extends wt{constructor(t,e,s){super(t,e,s,0)}apply1(t,e,s,n,i,r,l){t.rotation=this.getRelativeValue(s,n,i,r,t.rotation,e.rotation)}},Xe=class extends Qt{constructor(t,e,s){super(t,e,s,1,2)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.x=e.x,t.y=e.y);return}let o=0,a=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.x=e.x+o*n,t.y=e.y+a*n):r?(t.x+=o*n,t.y+=a*n):(t.x+=(e.x+o-t.x)*n,t.y+=(e.y+a-t.y)*n)}},Ve=class extends wt{constructor(t,e,s){super(t,e,s,1)}apply1(t,e,s,n,i,r,l){t.x=this.getRelativeValue(s,n,i,r,t.x,e.x)}},Re=class extends wt{constructor(t,e,s){super(t,e,s,2)}apply1(t,e,s,n,i,r,l){t.y=this.getRelativeValue(s,n,i,r,t.y,e.y)}},Le=class extends Qt{constructor(t,e,s){super(t,e,s,3,4)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.scaleX=e.scaleX,t.scaleY=e.scaleY);return}let o,a;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}if(o*=e.scaleX,a*=e.scaleY,n===1&&!r)t.scaleX=o,t.scaleY=a;else{let f=0,u=0;i?(f=e.scaleX,u=e.scaleY):(f=t.scaleX,u=t.scaleY),r?(t.scaleX=f+(o-e.scaleX)*n,t.scaleY=u+(a-e.scaleY)*n):l?(t.scaleX=f+(Math.abs(o)*Math.sign(f)-f)*n,t.scaleY=u+(Math.abs(a)*Math.sign(u)-u)*n):(f=Math.abs(f)*Math.sign(o),u=Math.abs(u)*Math.sign(a),t.scaleX=f+(o-f)*n,t.scaleY=u+(a-u)*n)}}},Be=class extends wt{constructor(t,e,s){super(t,e,s,3)}apply1(t,e,s,n,i,r,l){t.scaleX=this.getScaleValue(s,n,i,r,l,t.scaleX,e.scaleX)}},Oe=class extends wt{constructor(t,e,s){super(t,e,s,4)}apply1(t,e,s,n,i,r,l){t.scaleY=this.getScaleValue(s,n,i,r,l,t.scaleY,e.scaleY)}},Ne=class extends Qt{constructor(t,e,s){super(t,e,s,5,6)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.shearX=e.shearX,t.shearY=e.shearY);return}let o=0,a=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.shearX=e.shearX+o*n,t.shearY=e.shearY+a*n):r?(t.shearX+=o*n,t.shearY+=a*n):(t.shearX+=(e.shearX+o-t.shearX)*n,t.shearY+=(e.shearY+a-t.shearY)*n)}},De=class extends wt{constructor(t,e,s){super(t,e,s,5)}apply1(t,e,s,n,i,r,l){t.shearX=this.getRelativeValue(s,n,i,r,t.shearX,e.shearX)}},Ue=class extends wt{constructor(t,e,s){super(t,e,s,6)}apply1(t,e,s,n,i,r,l){t.shearY=this.getRelativeValue(s,n,i,r,t.shearY,e.shearY)}},$e=class extends Q{boneIndex;constructor(t,e){super(t,`7|${e}`),this.boneIndex=e,this.instant=!0}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose;if(c)r&&(h.inherit=a.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r&&(h.inherit=a.data.setupPose.inherit):h.inherit=this.frames[Q.search(d,s,2)+1]}}},Ut=class extends bt{slotIndex;constructor(t,e,s,...n){super(t,e,...n),this.slotIndex=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];a.bone.active&&this.apply1(a,o?a.appliedPose:a.pose,s,i,r,l)}},qe=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(t,e,s,n,i,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r}apply1(t,e,s,n,i,r){const l=e.color,c=this.frames;if(s<c[0]){i&&l.setFromColor(t.data.setupPose.color);return}let o=0,a=0,h=0,d=0;const f=Q.search(c,s,5),u=this.curves[f/5];switch(u){case 0:{const m=c[f];o=c[f+1],a=c[f+2],h=c[f+3],d=c[f+4];const p=(s-m)/(c[f+5]-m);o+=(c[f+5+1]-o)*p,a+=(c[f+5+2]-a)*p,h+=(c[f+5+3]-h)*p,d+=(c[f+5+4]-d)*p;break}case 1:o=c[f+1],a=c[f+2],h=c[f+3],d=c[f+4];break;default:o=this.getBezierValue(s,f,1,u-2),a=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)l.set(o,a,h,d);else if(i){const m=t.data.setupPose.color;l.set(m.r+(o-m.r)*n,m.g+(a-m.g)*n,m.b+(h-m.b)*n,m.a+(d-m.a)*n)}else l.add((o-l.r)*n,(a-l.g)*n,(h-l.b)*n,(d-l.a)*n)}},_e=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`)}getFrameEntries(){return 4}setFrame(t,e,s,n,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i}apply1(t,e,s,n,i,r){const l=e.color;let c=0,o=0,a=0;const h=this.frames;if(s<h[0]){if(i){const u=t.data.setupPose.color;l.r=u.r,l.g=u.g,l.b=u.b}return}const d=Q.search(h,s,4),f=this.curves[d>>2];switch(f){case 0:{const u=h[d];c=h[d+1],o=h[d+2],a=h[d+3];const m=(s-u)/(h[d+4]-u);c+=(h[d+4+1]-c)*m,o+=(h[d+4+2]-o)*m,a+=(h[d+4+3]-a)*m;break}case 1:c=h[d+1],o=h[d+2],a=h[d+3];break;default:c=this.getBezierValue(s,d,1,f-2),o=this.getBezierValue(s,d,2,f+18-2),a=this.getBezierValue(s,d,3,f+18*2-2)}if(n!==1)if(i){const u=t.data.setupPose.color;c=u.r+(c-u.r)*n,o=u.g+(o-u.g)*n,a=u.b+(a-u.b)*n}else c=l.r+(c-l.r)*n,o=l.g+(o-l.g)*n,a=l.b+(a-l.b)*n;l.r=c<0?0:c>1?1:c,l.g=o<0?0:o>1?1:o,l.b=a<0?0:a>1?1:a}},ze=class extends Nt{slotIndex=0;constructor(t,e,s){super(t,e,`9|${s}`),this.slotIndex=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=(o?a.appliedPose:a.pose).color;let d=0;const f=this.frames;if(s<f[0]){r&&(h.a=a.data.setupPose.color.a);return}if(d=this.getCurveValue(s),i!==1)if(r){const u=a.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}},We=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(t,e,s,n,i,r,l,c,o){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r,this.frames[t+5]=l,this.frames[t+6]=c,this.frames[t+7]=o}apply1(t,e,s,n,i,r){const l=e.color,c=e.darkColor;let o=0,a=0,h=0;const d=this.frames;if(s<d[0]){if(i){const b=t.data.setupPose;l.setFromColor(b.color);const w=b.darkColor;c.r=w.r,c.g=w.g,c.b=w.b}return}let f=0,u=0,m=0,p=0;const g=Q.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],o=d[g+5],a=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,o+=(d[g+8+5]-o)*w,a+=(d[g+8+6]-a)*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],o=d[g+5],a=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),o=this.getBezierValue(s,g,5,x+18*4-2),a=this.getBezierValue(s,g,6,x+18*5-2),h=this.getBezierValue(s,g,7,x+18*6-2)}if(n===1)l.set(f,u,m,p);else if(i){const b=t.data.setupPose;let w=b.color;l.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,o=w.r+(o-w.r)*n,a=w.g+(a-w.g)*n,h=w.b+(h-w.b)*n}else l.add((f-l.r)*n,(u-l.g)*n,(m-l.b)*n,(p-l.a)*n),o=c.r+(o-c.r)*n,a=c.g+(a-c.g)*n,h=c.b+(h-c.b)*n;c.r=o<0?0:o>1?1:o,c.g=a<0?0:a>1?1:a,c.b=h<0?0:h>1?1:h}},He=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,l,c){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r,this.frames[t+5]=l,this.frames[t+6]=c}apply1(t,e,s,n,i,r){const l=e.color,c=e.darkColor;let o=0,a=0,h=0,d=0,f=0,u=0;const m=this.frames;if(s<m[0]){if(i){const x=t.data.setupPose,b=x.color,w=x.darkColor;l.r=b.r,l.g=b.g,l.b=b.b,c.r=w.r,c.g=w.g,c.b=w.b}return}const p=Q.search(m,s,7),g=this.curves[p/7];switch(g){case 0:{const x=m[p];o=m[p+1],a=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);o+=(m[p+7+1]-o)*b,a+=(m[p+7+2]-a)*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:o=m[p+1],a=m[p+2],h=m[p+3],d=m[p+4],f=m[p+5],u=m[p+6];break;default:o=this.getBezierValue(s,p,1,g-2),a=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=t.data.setupPose;let b=x.color;o=b.r+(o-b.r)*n,a=b.g+(a-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 o=l.r+(o-l.r)*n,a=l.g+(a-l.g)*n,h=l.b+(h-l.b)*n,d=c.r+(d-c.r)*n,f=c.g+(f-c.g)*n,u=c.b+(u-c.b)*n;l.r=o<0?0:o>1?1:o,l.g=a<0?0:a>1?1:a,l.b=h<0?0:h>1?1:h,c.r=d<0?0:d>1?1:d,c.g=f<0?0:f>1?1:f,c.b=u<0?0:u>1?1:u}},Ft=class extends Q{slotIndex=0;attachmentNames;constructor(t,e){super(t,`11|${e}`),this.slotIndex=e,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=o?a.appliedPose:a.pose;c||s<this.frames[0]?r&&this.setAttachment(t,h,a.data.attachmentName):this.setAttachment(t,h,this.attachmentNames[Q.search(this.frames,s)])}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},Ge=class extends bt{slotIndex;attachment;vertices;constructor(t,e,s,n){super(t,e,`12|${s}|${n.id}`),this.slotIndex=s,this.attachment=n,this.vertices=new Array(t),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,n,i,r,l,c,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const u=(n-r*2+c)*.03,m=o*.03-l*.06,p=((r-c)*3-n+a)*.006,g=(l-o+.33333333)*.018;let x=u*2+p,b=m*2+g,w=(r-n)*.3+u+p*.16666667,T=l*.3+m+g*.16666667,y=n+w,v=T;for(let S=f+18;f<S;f+=2)d[f]=y,d[f+1]=v,w+=x,T+=b,x+=p,b+=g,y+=w,v+=T}getCurvePercent(t,e){const s=this.curves;let n=s[e];switch(n){case 0:{const c=this.frames[e];return(t-c)/(this.frames[e+this.getFrameEntries()]-c)}case 1:return 0}if(n-=2,s[n]>t){const c=this.frames[e];return s[n+1]*(t-c)/(s[n]-c)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=t){const c=s[n-2],o=s[n-1];return o+(t-c)/(s[n]-c)*(s[n+1]-o)}const r=s[i-2],l=s[i-1];return l+(1-l)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,n,i,r,l,c,o){const a=t.slots;if(!this.attachment.isTimelineActive(a,this.slotIndex,o))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(a[this.slotIndex],o,r);for(const g of h)this.applyBeforeFirst(a[g],o,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=Q.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(a[this.slotIndex],o,f,u,m,p,i,r,l);for(const g of h)this.applyToSlot(a[g],o,f,u,m,p,i,r,l)}applyToSlot(t,e,s,n,i,r,l,c,o){if(!t.bone.active)return;const a=e?t.appliedPose:t.pose;if(a.attachment===null||a.attachment.timelineAttachment!==this.attachment)return;const h=a.attachment,d=a.deform;if(d.length===0&&(c=!0),d.length=r,n===null)if(l===1)if(o&&!c)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 B.arrayCopy(s,0,d,0,r);else if(c)if(h.bones)for(let f=0;f<r;f++)d[f]=s[f]*l;else{const f=h.vertices;for(let u=0;u<r;u++){const m=f[u];d[u]=m+(s[u]-m)*l}}else if(o)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f]*l;else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=(s[u]-f[u])*l}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*l;else if(l===1)if(o&&!c)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)B.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(c)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]=(u+(n[f]-u)*i)*l}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)*l}}else if(o)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i)*l}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])*l}}else for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i-d[f])*l}}applyBeforeFirst(t,e,s){if(!t.bone.active)return;const n=e?t.appliedPose:t.pose;n.attachment==null||n.attachment.timelineAttachment!==this.attachment||(n.deform.length===0&&(s=!0),s&&(n.deform.length=0))}},je=class vt extends Q{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,n){super(e,`28|${s}|${n.sequence.id}`),this.slotIndex=s,this.attachment=n,this.instant=!0}getFrameEntries(){return vt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,n,i,r){const l=this.frames;e*=vt.ENTRIES,l[e]=s,l[e+vt.MODE]=n|i<<4,l[e+vt.DELAY]=r}apply(e,s,n,i,r,l,c,o,a){const h=e.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,a))return;const d=this.attachment.timelineSlots,f=this.frames;if(o||n<f[0]){if(l){this.setupPose(h[this.slotIndex],a);for(const x of d)this.setupPose(h[x],a)}return}const u=Q.search(f,n,vt.ENTRIES),m=f[u],p=f[u+vt.MODE],g=f[u+vt.DELAY];this.applyToSlot(h[this.slotIndex],a,n,m,p,g);for(const x of d)this.applyToSlot(h[x],a,n,m,p,g)}setupPose(e,s){if(!e.bone.active)return;const n=s?e.appliedPose:e.pose;n.attachment===null||n.attachment.timelineAttachment!==this.attachment||(n.sequenceIndex=-1)}applyToSlot(e,s,n,i,r,l){if(!e.bone.active)return;const c=s?e.appliedPose:e.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;let o=r>>4,a=c.attachment.sequence.regions.length;const h=Ee[r&15];if(h!==0)switch(o+=(n-i)/l+1e-5|0,h){case 1:o=Math.min(a-1,o);break;case 2:o%=a;break;case 3:{const d=(a<<1)-2;o=d===0?0:o%d,o>=a&&(o=d-o);break}case 4:o=Math.max(a-1-o,0);break;case 5:o=a-1-o%a;break;case 6:{const d=(a<<1)-2;o=d===0?0:(o+a-1)%d,o>=a&&(o=d-o)}}c.sequenceIndex=o}},Zt=class bn extends Q{static propertyIds=["13"];events;constructor(e){super(e,...bn.propertyIds),this.events=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,n,i,r,l,c,o,a){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=Q.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])}},St=class Vs extends Q{static propertyID="14";static propertyIds=[Vs.propertyID];drawOrders;constructor(e){super(e,...Vs.propertyIds),this.drawOrders=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,l,c,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0]){l&&B.arrayCopy(d,0,h,0,e.slots.length);return}const f=this.drawOrders[Q.search(this.frames,n)];if(!f)B.arrayCopy(d,0,h,0,e.slots.length);else for(let u=0,m=f.length;u<m;u++)h[u]=d[f[u]]}},$t=class wn extends Q{slots;inFolder;drawOrders;constructor(e,s,n){super(e,...wn.propertyIds(s)),this.slots=s,this.drawOrders=new Array(e),this.inFolder=new Array(n);for(const i of s)this.inFolder[i]=!0;this.instant=!0}static propertyIds(e){const s=e.length,n=new Array(s);for(let i=0;i<s;i++)n[i]=`d${e[i]}`;return n}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,l,c,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0])l&&this.setup(h,d);else{const f=this.drawOrders[Q.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(e,s){const{inFolder:n,slots:i}=this;for(let r=0,l=0,c=i.length;!(n[e[r].data.index]&&(e[r]=s[i[l]],++l===c));r++);}};function Ws(t){return typeof t=="object"&&t!==null&&typeof t.constraintIndex=="number"}var Je=class extends bt{constraintIndex=0;constructor(t,e,s){super(t,e,`15|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,i,r,l){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r?1:0,this.frames[t+5]=l?1:0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const x=a.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=Q.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?a.data.setupPose:h;h.mix=g.mix+(f-g.mix)*i,h.softness=g.softness+(u-g.softness)*i,c?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)}},Ke=class extends bt{constraintIndex=0;constructor(t,e,s){super(t,e,`16|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,l,c){const o=this.frames;t*=7,o[t]=e,o[t+1]=s,o[t+2]=n,o[t+3]=i,o[t+4]=r,o[t+5]=l,o[t+6]=c}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const y=a.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=Q.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?a.data.setupPose:h;l?(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)}},kt=class extends Nt{constraintIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.constraintIndex=s}},Qe=class extends kt{constructor(t,e,s){super(t,e,s,17),this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.position=this.getAbsoluteValue(s,i,r,l,h.position,a.data.setupPose.position)}}},Ze=class extends kt{constructor(t,e,s){super(t,e,s,18)}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,a.data.setupPose.spacing)}}},ts=class extends bt{constraintIndex;constructor(t,e,s){super(t,e,`19|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,n,i){const r=this.frames;t<<=2,r[t]=e,r[t+1]=s,r[t+2]=n,r[t+3]=i}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const b=a.data.setupPose;h.mixRotate=b.mixRotate,h.mixX=b.mixX,h.mixY=b.mixY}return}let f,u,m;const p=Q.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?a.data.setupPose:h;l?(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)}},gt=class extends kt{constructor(t,e,s,n){super(t,e,s,n)}apply(t,e,s,n,i,r,l,c,o){if(l&&!this.additive&&(l=!1),this.constraintIndex===-1){const a=s>=this.frames[0]?this.getCurveValue(s):0,h=t.physics;for(const d of h)if(d.active&&this.global(d.data)){const f=o?d.appliedPose:d.pose;this.set(f,this.getAbsoluteValue(s,i,r,l,this.get(f),this.get(d.data.setupPose),a))}}else{const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;this.set(h,this.getAbsoluteValue(s,i,r,l,this.get(h),this.get(a.data.setupPose)))}}}},es=class extends gt{constructor(t,e,s){super(t,e,s,20)}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ss=class extends gt{constructor(t,e,s){super(t,e,s,21)}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},ns=class extends gt{constructor(t,e,s){super(t,e,s,22)}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},is=class extends gt{constructor(t,e,s){super(t,e,s,23)}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},rs=class extends gt{constructor(t,e,s){super(t,e,s,24),this.additive=!0}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},as=class extends gt{constructor(t,e,s){super(t,e,s,25),this.additive=!0}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},os=class extends gt{constructor(t,e,s){super(t,e,s,26)}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},ls=class yn extends Q{static propertyIds=["27"];constraintIndex;constructor(e,s){super(e,...yn.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,n,i,r,l,c,o,a){let h;if(this.constraintIndex!==-1&&(h=e.constraints[this.constraintIndex],!h.active))return;const d=this.frames;if(s>n)this.apply(e,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[Q.search(d,s)+1]))if(h!=null)h.reset(e);else for(const f of e.physics)f.active&&f.reset(e)}},cs=class extends kt{constructor(t,e,s){super(t,e,s,29)}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.time=this.getAbsoluteValue(s,i,r,l,h.time,a.data.setupPose.time)}}},hs=class extends kt{constructor(t,e,s){super(t,e,s,30),this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.mix=this.getAbsoluteValue(s,i,r,l,h.mix,a.data.setupPose.mix)}}},qn=class Rs{static emptyAnimation=new Kt("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Gs(this);propertyIds=new Ce;animationsChanged=!1;trackEntryPool=new Bt(()=>new Hs);constructor(e){this.data=e}update(e){e*=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 l=e*r.timeScale;if(r.delay>0){if(r.delay-=l,r.delay>0)continue;l=-r.delay,r.delay=0}let c=r.next;if(c){const o=r.trackLast-c.delay;if(o>=0){for(c.delay=0,c.trackTime+=r.timeScale===0?0:(o/r.timeScale+e)*c.timeScale,r.trackTime+=l,this.setTrack(n,c,!0);c.mixingFrom;)c.mixTime+=e,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,e)){let o=r.mixingFrom;for(r.mixingFrom=null,o&&(o.mixingTo=null);o;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=l}this.queue.drain()}updateMixingFrom(e,s){const n=e.mixingFrom;if(!n)return!0;const i=this.updateMixingFrom(n,s);if(n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,e.nextTrackLast!==-1&&e.mixTime>=e.mixDuration){if(n.totalAlpha===0||e.mixDuration===0){if(e.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=e),n.totalAlpha===0)for(let r=e;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(n)}return i}return n.trackTime+=s*n.timeScale,e.mixTime+=s,!1}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,n=this.tracks;let i=!1;for(let c=0,o=n.length;c<o;c++){const a=n[c];if(!a||a.delay>0)continue;i=!0;let h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,e):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let d=a.animationLast,f=a.getAnimationTime(),u=f,m=s;a.reverse&&(u=a.animation.duration-u,m=null);const p=a.animation.timelines,g=p.length;if(c===0&&h===1)for(let x=0;x<g;x++){B.webkit602BugfixHelper(h);const b=p[x];b instanceof Ft?this.applyAttachmentTimeline(b,e,u,!0,!0):b.apply(e,d,u,m,h,!0,!1,!1,!1)}else{const x=a.timelineMode,b=h>=a.alphaAttachmentThreshold,w=a.additive,T=w||a.shortestRotation,y=!T&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let v=0;v<g;v++){const S=p[v],A=(x[v]&qt)!==0;!T&&S instanceof Dt?this.applyRotateTimeline(S,e,u,h,A,a.timelinesRotation,v<<1,y):S instanceof Ft?this.applyAttachmentTimeline(S,e,u,A,b):(B.webkit602BugfixHelper(h),S.apply(e,d,u,m,h,A,w,!1,!1))}}a.reverse&&this.eventsReverse(a,d,f),this.queueEvents(a,f),s.length=0,a.nextAnimationLast=f,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+ds,l=e.slots;for(let c=0,o=e.slots.length;c<o;c++){const a=l[c];if(a.attachmentState===r){const h=a.data.attachmentName;a.pose.setAttachment(h?e.getAttachment(a.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,s){const n=e.mixingFrom,i=n.mixingFrom!==null?this.applyMixingFrom(n,s):1,r=e.mix(),l=n.alpha*i,c=1-r*e.alpha,o=l*(1-r),a=c>0?o/c:l,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,S=null;n.reverse?v=n.animation.duration-v:r<n.eventThreshold&&(S=this.events),n.totalAlpha=0;for(let A=0;A<d;A++){const I=h[A],M=f[A];let Y=0;if((M&_t)!==0){const E=u[A];Y=E==null?a:a*(1-E.mix())}else{if(!p&&I instanceof St)continue;Y=o}n.totalAlpha+=Y;const k=(M&qt)!==0;if(!x&&I instanceof Dt)this.applyRotateTimeline(I,s,v,Y,k,w,A<<1,b);else if(I instanceof Ft)this.applyAttachmentTimeline(I,s,v,k,m&&Y>=n.alphaAttachmentThreshold);else{const E=!p||!(I instanceof St)||!k;I.apply(s,T,v,S,Y,k,g,E,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,T,y),e.mixDuration>0&&this.queueEvents(n,y),this.events.length=0,n.nextAnimationLast=y,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,s,n,i,r){const l=s.slots[e.slotIndex];if(!l.bone.active||!r&&l.attachmentState===this.unkeyedState+fs)return;let c=n<e.frames[0],o=null;if(c||(o=e.attachmentNames[Q.search(e.frames,n)],c=!r&&o==null),c){if(!i)return;o=l.data.attachmentName}l.pose.setAttachment(o==null?null:s.getAttachment(l.data.index,o)),r?l.attachmentState=this.unkeyedState+fs:c||(l.attachmentState=this.unkeyedState+ds)}applyRotateTimeline(e,s,n,i,r,l,c,o){if(o&&(l[c]=0),i===1){e.apply(s,0,n,null,1,r,!1,!1,!1);return}const a=s.bones[e.boneIndex];if(!a.active)return;const h=a.pose,d=a.data.setupPose,f=e.frames;if(n<f[0]){r&&(h.rotation=d.rotation);return}const u=r?d.rotation:h.rotation,m=d.rotation+e.getCurveValue(n);let p=0,g=m-u;if(g-=Math.ceil(g/360-.5)*360,g===0)p=l[c];else{let x=0,b=0;o?(x=0,b=g):(x=l[c],b=l[c+1]);const w=x-x%360;p=g+w;let T=g>=0,y=x>=0;Math.abs(b)<=90&&R.signum(b)!==R.signum(g)&&(Math.abs(x-w)>180?(p+=360*R.signum(x),y=T):w!==0?p-=360*R.signum(x):y=T),y!==T&&(p+=360*R.signum(x)),l[c]=p}l[c+1]=g,h.rotation=u+p*i}queueEvents(e,s){const n=e.animationStart,i=e.animationEnd,r=i-n,l=e.reverse;let c=e.trackLast%r;l&&(c=r-c);const o=this.events;let a=0,h=o.length;for(;a<h;a++){const f=o[a];if(f.time<c!==l)break;f.time>=n&&f.time<=i&&this.queue.event(e,f)}let d=!1;if(e.loop)if(r===0)d=!0;else{const f=Math.floor(e.trackTime/r);d=f>0&&f>Math.floor(e.trackLast/r)}else d=s>=i&&e.animationLast<i;for(d&&this.queue.complete(e);a<h;a++){const f=o[a];f.time>=n&&f.time<=i&&this.queue.event(e,f)}}eventsReverse(e,s,n){const i=e.animation.duration,r=i-s,l=i-n,c=e.animation.timelines;for(let o=0,a=e.animation.timelines.length;o<a;o++){const h=c[o];if(!(h instanceof Zt))continue;const d=h.events,f=h.frames,u=f.length;if(r>=l){for(let m=0;m<u;m++)if(!(f[m]<l)){if(f[m]>=r)break;this.events.push(d[m])}}else{for(let p=0;p<u&&!(f[p]>=r);p++)this.events.push(d[p]);let m=0;for(;m<u&&!(f[m]>=l);m++);for(;m<u;m++)this.events.push(d[m])}}}clearTracks(){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");if(e>=this.tracks.length)return;const s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let n=s;for(;;){const i=n.mixingFrom;if(!i)break;this.queue.end(i),n.mixingFrom=null,n.mixingTo=null,n=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(e,s,n){const i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(i.next=null,n&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,n=!1){return typeof s=="string"?this.setAnimation1(e,s,n):this.setAnimation2(e,s,n)}setAnimation1(e,s,n=!1){const i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(e,i,n)}setAnimation2(e,s,n=!1){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const l=this.trackEntry(e,s,n,r);return this.setTrack(e,l,i),this.queue.drain(),l}addAnimation(e,s,n=!1,i=0){return typeof s=="string"?this.addAnimation1(e,s,n,i):this.addAnimation2(e,s,n,i)}addAnimation1(e,s,n=!1,i=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(e,r,n,i)}addAnimation2(e,s,n=!1,i=0){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;const l=this.trackEntry(e,s,n,r);return r?(r.next=l,l.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-l.mixDuration,0))):(this.setTrack(e,l,!0),this.queue.drain(),i<0&&(i=0)),l.delay=i,l}setEmptyAnimation(e,s=0){const n=this.setAnimation(e,Rs.emptyAnimation,!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(e,s=0,n=0){const i=this.addAnimation(e,Rs.emptyAnimation,!1,n);return n<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,i=this.tracks.length;n<i;n++){const r=this.tracks[n];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(B.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,n,i){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=s,r.loop=n,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=i?this.data.getMix(i.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1;const e=this.tracks;for(let s=0,n=e.length;s<n;s++){let i=e[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do this.computeHold(i),i=i.mixingTo;while(i)}}this.propertyIds.clear()}computeHold(e){const s=e.animation.timelines,n=e.animation.timelines.length,i=e.timelineMode;i.length=n;const r=e.timelineHoldMix;r.length=0;const l=this.propertyIds,c=e.additive,o=e.keepHold,a=e.mixingTo;t:for(let h=0;h<n;h++){const d=s[h],f=d.propertyIds,u=l.addAll(f)&&!(d instanceof $t&&l.contains(St.propertyID));if(c&&d.additive){i[h]=u?qt:te;continue}for(let p=e.mixingFrom;p!=null;p=p.mixingFrom)if(p.animation.hasTimeline(f)){i[h]=te;continue t}let m;if(a===null||d.instant||a.additive&&d.additive||!a.animation?.hasTimeline(f))m=u?qt:te;else{m=u?Js:_t;for(let p=a.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(f)){p.mixDuration>0&&(r[h]=p);break}}o&&(m=m&~_t|i[h]&_t),i[h]=m}}getTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){const s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Hs=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;mixDuration=0;totalAlpha=0;mixInterpolation=Lt.linear;setMixDuration(t,e){this.mixDuration=t,e!==void 0&&(e<=0&&(e=this.previous==null?0:Math.max(e+this.previous.getTrackComplete()-t,0)),this.delay=e)}setMixInterpolation(t){if(!t)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=t}mix(){if(this.mixDuration===0)return 1;let t=this.mixTime/this.mixDuration;return t>=1?1:this.mixInterpolation===Lt.linear?t:(t=this.mixInterpolation.apply(t),t<0?0:t>1?1:t)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=Lt.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const t=this.animationEnd-this.animationStart;return t===0?this.animationStart:this.trackTime%t+this.animationStart}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const t=this.animationEnd-this.animationStart;if(t!==0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Gs=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let t=0;t<this.objects.length;t+=2){const e=this.objects,s=e[t],n=e[t+1],i=this.animState.listeners.slice();switch(s){case 0:n.listener?.start&&n.listener.start(n);for(let r=0;r<i.length;r++){const l=i[r];l.start&&l.start(n)}break;case 1:n.listener?.interrupt&&n.listener.interrupt(n);for(let r=0;r<i.length;r++){const l=i[r];l.interrupt&&l.interrupt(n)}break;case 2:n.listener?.end&&n.listener.end(n);for(let r=0;r<i.length;r++){const l=i[r];l.end&&l.end(n)}case 3:n.listener?.dispose&&n.listener.dispose(n);for(let r=0;r<i.length;r++){const l=i[r];l.dispose&&l.dispose(n)}this.animState.trackEntryPool.free(n);break;case 4:n.listener?.complete&&n.listener.complete(n);for(let r=0;r<i.length;r++){const l=i[r];l.complete&&l.complete(n)}break;case 5:{const r=e[t+++2];n.listener?.event&&n.listener.event(n,r);for(let l=0;l<i.length;l++){const c=i[l];c.event&&c.event(n,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},js=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(js||{}),_n=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},te=0,qt=1,_t=2,Js=3,ds=1,fs=2,zn=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){return typeof t=="string"?this.setMix1(t,e,s):this.setMix2(t,e,s)}setMix1(t,e,s){const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);const i=this.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);this.setMix2(n,i,s)}setMix2(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const n=`${t.name}.${e.name}`;this.animationToMixTime[n]=s}getMix(t,e){const s=`${t.name}.${e.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}},Wn=class{constructor(t,e="",s=new Qs,n=new Ks){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=n}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{const n=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(n)};requestAnimationFrame(n)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadBinary(t,r=>{this.success(e,t,r),n(r)},(r,l)=>{const c=`Couldn't load binary ${t}: status ${r}, ${l}`;this.error(s,t,c),i(c)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,n=>{this.success(e,t,n)},(n,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${n}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadJson(t,r=>{this.success(e,t,r),n(r)},(r,l)=>{const c=`Couldn't load JSON ${t}: status ${r}, ${l}`;this.error(s,t,c),i(c)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const n=this.cache.getAsset(t),i=n!==void 0;return i&&(this.cache.assetsLoaded[t]=n.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(e,t,r),r)).catch(r=>{this.error(s,t,r)})),i}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),this.reuseAssets(t,e,s))return;const n=this.texturePmaInfo[t];this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(o=>{if(o.ok)return o.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(o=>o?createImageBitmap(o,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(o=>{if(o){const a=this.createTexture(t,n,o);this.success(e,t,a),i(a)}});else{const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{const a=this.createTexture(t,n,o);this.success(e,t,a),i(a)},o.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),o.src=t}})}loadTextureAtlas(t,e=()=>{},s=()=>{},n){const i=t.lastIndexOf("/"),r=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((l,c)=>{this.downloader.downloadText(t,o=>{try{const a=this.createTextureAtlas(o,r,t,n);let h=a.pages.length,d=!1;if(h===0){this.success(e,t,a),l(a);return}for(const f of a.pages)this.loadTexture(this.texturePath(r,f.name,n),(u,m)=>{d||(f.setTexture(m),--h===0&&(this.success(e,t,a),l(a)))},(u,m)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${u}`;this.error(s,t,p),c(p)}d=!0})}catch(a){const h=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,h),c(h)}},(o,a)=>{const h=`Couldn't load texture atlas ${t}: status ${o}, ${a}`;this.error(s,t,h),c(h)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{}){const n=t.lastIndexOf("/"),i=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,l)=>{this.downloader.downloadText(t,c=>{try{const o=this.createTextureAtlas(c,i,t);this.success(e,t,o),r(o)}catch(o){const a=`Couldn't parse texture atlas ${t}: ${o.message}`;this.error(s,t,a),l(a)}},(c,o)=>{const a=`Couldn't load texture atlas ${t}: status ${c}, ${o}`;this.error(s,t,a),l(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(n,i)=>e(i),(n,i)=>s(i))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;const e=this.cache.assets[t];if(e)return e;const s=this.errors[t];throw Error(`Asset not found: ${t}${s?`
|
|
2
|
-
${s}`:""}`)}remove(t){t=this.pathPrefix+t;const e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(const t in this.cache.assets){const e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof Ye){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e,s,n){const i=new Ye(t);i.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of i.pages)r.texture?.dispose()}};for(const r of i.pages){const l=this.texturePath(e,r.name,n);this.texturePmaInfo[this.pathPrefix+l]=r.pma}return i}createTexture(t,e,s){const n=this.textureLoader(s,e),i=n.dispose.bind(n);return n.dispose=()=>{this.disposeAssetInternal(t)&&i()},n}texturePath(t,e,s){return s?s[e]:t+e}},Ks=class Se{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Se.AVAILABLE_CACHES.get(e);if(s)return s;const n=new Se;return Se.AVAILABLE_CACHES.set(e,n),n}async addAsset(e,s){return this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=s,s}getAsset(e){return this.assetsLoaded[e]}},Qs=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!==-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){var e=window.atob(t),s=e.length,n=new Uint8Array(s);for(let i=0;i<s;i++)n[i]=e.charCodeAt(i);return n}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e===-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToString(n))}catch(l){this.finish(t,400,JSON.stringify(l))}return}const i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",n||t,!0);const r=()=>{this.finish(t,i.status,i.responseText)};i.onload=r,i.onerror=r,i.send()}downloadJson(t,e,s){this.downloadText(t,n=>{e(JSON.parse(n))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(n))}catch(l){this.finish(t,400,JSON.stringify(l))}return}const i=new XMLHttpRequest;i.open("GET",n||t,!0),i.responseType="arraybuffer";const r=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status===200||i.status===0?this.finish(t,200,new Uint8Array(i.response)):r()},i.onerror=r,i.send()}start(t,e,s){let n=this.callbacks[t];try{if(n)return!0;this.callbacks[t]=n=[]}finally{n.push(e,s)}}finish(t,e,s){const n=this.callbacks[t];if(delete this.callbacks[t],e===200||e===0)for(let i=0,r=n.length;i<r;i+=2)n[i](s);else for(let i=1,r=n.length;i<r;i+=2)n[i](e,s)}},us=class vn extends xt{color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new vn(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},zt=class Tn extends xt{endSlot=null;convex=!1;inverse=!1;color=new z(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){const e=new Tn(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.convex=this.convex,e.inverse=this.inverse,e.color.setFromColor(this.color),e}},ee=class Sn extends xt{lengths=[];closed=!1;constantSpeed=!1;color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new Sn(this.name);return this.copyTo(e),e.lengths=[],B.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=this.closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Zs=class An extends xt{x=0;y=0;rotation=0;color=new z(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*R.degRad,n=Math.cos(s),i=Math.sin(s),r=n*e.a+i*e.b,l=n*e.c+i*e.d;return R.atan2Deg(l,r)}copy(){const e=new An(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Hn=class{atlas;allowMissingRegions;constructor(t,e=!1){this.atlas=t,this.allowMissingRegions=e}findRegions(t,e,s){const n=s.regions;for(let i=0,r=n.length;i<r;i++)n[i]=this.findRegion(t,s.getPath(e,i))}findRegion(t,e){const s=this.atlas.findRegion(e);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${e} (attachment: ${t})`);return s}newRegionAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new Pt(s,i)}newMeshAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new Tt(s,i)}newBoundingBoxAttachment(t,e,s){return new us(s)}newPathAttachment(t,e,s){return new ee(s)}newPointAttachment(t,e,s){return new Zs(s)}newClippingAttachment(t,e,s){return new zt(s)}},se=class{name;setupPose;skinRequired=!1;constructor(t,e){if(t==null)throw new Error("name cannot be null.");this.name=t,this.setupPose=e}},ms=class In extends se{index=0;parent=null;length=0;color=new z;icon;iconSize=1;iconRotation=0;visible=!1;constructor(e,s,n){if(super(s,new ie),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=e,this.parent=n}copy(e){const s=new In(this.index,this.name,e);return s.length=this.length,s.setupPose.set(this.setupPose),s}},ne=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(ne||{}),ie=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(t){if(t==null)throw new Error("pose cannot be null.");this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}setPosition(t,e){this.x=t,this.y=e}setScale(t,e){this.scaleX=t,this.scaleY=e===void 0?t:e}getInherit(){return this.inherit}setInherit(t){if(t==null)throw new Error("inherit cannot be null.");this.inherit=t}update(t,e){this.world!==t._update&&this.updateWorldTransform(t)}updateWorldTransform(t){this.local===t._update?this.updateLocalTransform(t):this.world=t._update;const e=this.rotation,s=this.scaleX,n=this.scaleY,i=this.shearX,r=this.shearY;if(!this.bone.parent){const d=t.scaleX,f=t.scaleY,u=(e+i)*R.degRad,m=(e+90+r)*R.degRad;this.a=Math.cos(u)*s*d,this.b=Math.cos(m)*n*d,this.c=Math.sin(u)*s*f,this.d=Math.sin(m)*n*f,this.worldX=this.x*d+t.x,this.worldY=this.y*f+t.y;return}const l=this.bone.parent.appliedPose;let c=l.a,o=l.b,a=l.c,h=l.d;switch(this.worldX=c*this.x+o*this.y+l.worldX,this.worldY=a*this.x+h*this.y+l.worldY,this.inherit){case 0:{const d=(e+i)*R.degRad,f=(e+90+r)*R.degRad,u=Math.cos(d)*s,m=Math.cos(f)*n,p=Math.sin(d)*s,g=Math.sin(f)*n;this.a=c*u+o*p,this.b=c*m+o*g,this.c=a*u+h*p,this.d=a*m+h*g;return}case 1:{const d=t.scaleX,f=t.scaleY,u=(e+i)*R.degRad,m=(e+90+r)*R.degRad;this.a=Math.cos(u)*s*d,this.b=Math.cos(m)*n*d,this.c=Math.sin(u)*s*f,this.d=Math.sin(m)*n*f;break}case 2:{const d=t.scaleX,f=t.scaleY,u=1/d,m=1/f;c*=u,a*=m;let p=c*c+a*a,g=0;p>R.epsilon2?(p=Math.abs(c*h*m-o*u*a)/p,o=a*p,h=c*p,g=e-R.atan2Deg(a,c)):(c=0,a=0,g=e-90+R.atan2Deg(h,o));const x=(g+i)*R.degRad,b=(g+r+90)*R.degRad,w=Math.cos(x)*s,T=Math.cos(b)*n,y=Math.sin(x)*s,v=Math.sin(b)*n;this.a=(c*w-o*y)*d,this.b=(c*T-o*v)*d,this.c=(a*w+h*y)*f,this.d=(a*T+h*v)*f;break}case 3:case 4:{const d=t.scaleX,f=t.scaleY,u=1/d,m=1/f,p=e*R.degRad,g=Math.cos(p),x=Math.sin(p);let b=(c*g+o*x)*u,w=(a*g+h*x)*m;const T=1/Math.sqrt(b*b+w*w);b*=T,w*=T;let y=-w,v=b;this.inherit===3&&c*h-o*a<0!=(d<0!=f<0)&&(y=-y,v=-v);const S=i*R.degRad,A=(90+r)*R.degRad,I=Math.cos(S)*s,M=Math.cos(A)*n,Y=Math.sin(S)*s,k=Math.sin(A)*n;this.a=(b*I+y*Y)*d,this.b=(b*M+y*k)*d,this.c=(w*I+v*Y)*f,this.d=(w*M+v*k)*f;break}}}updateLocalTransform(t){this.local=0,this.world=t._update;const e=t.scaleX,s=t.scaleY;if(!this.bone.parent){const g=1/e,x=1/s;this.x=(this.worldX-t.x)*g,this.y=(this.worldY-t.y)*x,this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);return}const n=this.bone.parent.appliedPose;let i=n.a,r=n.b,l=n.c,c=n.d;const o=i*c-r*l,a=1/(i*c-r*l),h=c*a,d=r*a,f=l*a,u=i*a,m=this.worldX-n.worldX,p=this.worldY-n.worldY;switch(this.x=m*h-p*d,this.y=p*u-m*f,this.inherit){case 0:this.set5(h*this.a-d*this.c,h*this.b-d*this.d,u*this.c-f*this.a,u*this.d-f*this.b,0);break;case 1:{const g=1/e,x=1/s;this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);break}case 2:{const g=1/e,x=1/s;i*=g,l*=x;const b=this.a*g,w=this.b*g,T=this.c*x,y=this.d*x,v=1/(i*i+l*l),S=1/Math.abs(o*g*x);this.set5((i*b+l*T)*v,(i*w+l*y)*v,(i*T-l*b)*S,(i*y-l*w)*S,R.atan2Deg(l,i));break}case 3:case 4:{const g=1/e,x=1/s,b=this.a*g,w=this.b*g,T=this.c*x,y=this.d*x;let v=c*this.a-r*this.c,S=i*this.c-l*this.a;o<0&&(v=-v,S=-S);let A=R.atan2Deg(S,v);this.rotation=A,A*=R.degRad;const I=Math.cos(A),M=Math.sin(A);let Y=(i*I+r*M)*g,k=(l*I+c*M)*x;const E=1/Math.sqrt(Y*Y+k*k);Y*=E,k*=E;const X=this.inherit===3&&o<0!=(e<0!=s<0)?-1:1;this.set4(Y*b+k*T,Y*w+k*y,(Y*T-k*b)*X,(Y*y-k*w)*X)}}}set4(t,e,s,n){const i=t*t+s*s,r=e*e+n*n;i>R.epsilon2?(this.shearX=R.atan2Deg(s,t),this.scaleX=Math.sqrt(i)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(r),r>R.epsilon2?(this.shearY=R.atan2Deg(n,e),t*n-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(t,e,s,n,i){this.shearX=0;const r=t*t+s*s,l=e*e+n*n;if(r>R.epsilon2){const c=R.atan2Deg(s,t);this.rotation=c+i,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(l),l>R.epsilon2?(this.shearY=R.atan2Deg(n,e),t*n-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-c):this.shearY-=90+c,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(l),this.shearY=0,this.rotation=l>R.epsilon2?R.atan2Deg(n,e)-90+i:i}validateLocalTransform(t){this.local===t._update&&this.updateLocalTransform(t)}modifyLocal(t){this.local===t._update&&this.updateLocalTransform(t),this.world=0,this.resetWorld(t._update)}modifyWorld(t){this.local=t,this.world=t,this.resetWorld(t)}resetWorld(t){const e=this.bone.children;for(let s=0,n=e.length;s<n;s++){const i=e[s].appliedPose;i.world===t&&(i.world=0,i.local=0,i.resetWorld(t))}}getWorldRotationX(){return R.atan2Deg(this.c,this.a)}getWorldRotationY(){return R.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){if(t==null)throw new Error("world cannot be null.");const e=this.a*this.d-this.b*this.c,s=t.x-this.worldX,n=t.y-this.worldY;return t.x=(s*this.d-n*this.b)/e,t.y=(n*this.a-s*this.c)/e,t}localToWorld(t){if(t==null)throw new Error("local cannot be null.");const e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.localToWorld(t)}worldToLocalRotation(t){t*=R.degRad;const e=Math.sin(t),s=Math.cos(t);return R.atan2Deg(this.a*e-this.c*s,this.d*s-this.b*e)+this.rotation-this.shearX}localToWorldRotation(t){t=(t-this.rotation-this.shearX)*R.degRad;const e=Math.sin(t),s=Math.cos(t);return R.atan2Deg(s*this.c+e*this.d,s*this.a+e*this.b)}rotateWorld(t){t*=R.degRad;const e=Math.sin(t),s=Math.cos(t),n=this.a,i=this.b;this.a=s*n-e*this.c,this.b=s*i-e*this.d,this.c=e*n+s*this.c,this.d=e*i+s*this.d}},gs=class{data;pose;constrainedPose;appliedPose;constructor(t,e,s){if(t==null)throw new Error("data cannot be null.");this.data=t,this.pose=e,this.constrainedPose=s,this.appliedPose=e}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},ps=class extends gs{active=!1;constructor(t,e,s){super(t,e,s),this.setupPose()}isActive(){return this.active}},re=class Cn extends ps{parent=null;children=[];sorted=!1;constructor(e,s){super(e,new ie,new ie),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(e){const s=new Cn(this.data,e);return s.pose.set(this.pose),s}},Et=class extends ps{constructor(t,e,s){super(t,e,s)}isSourceActive(){return!0}},tn=class{_setupPose;pose;constrainedPose;appliedPose;constructor(t){this._setupPose=t,this.pose=[...t],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,B.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,B.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},Xt=class extends se{constructor(t,e){super(t,e)}},ae=(t=>(t[t.None=0]="None",t[t.Uniform=1]="Uniform",t[t.Volume=2]="Volume",t))(ae||{}),oe=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},xs=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(t){if(t==null)throw new Error("audioPath cannot be null.");this._audioPath=t}setupPose=new oe(-1,this);constructor(t){this.name=t}},le=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(t){this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}},en=class Mt extends Et{bones;target;constructor(e,s){if(super(e,new le,new le),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of e.bones)this.bones.push(s.bones[n.index].constrainedPose);this.target=s.bones[e.target.index]}copy(e){var s=new Mt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:Mt.apply(e,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Mt.apply(e,r[0],r[1],i.worldX,i.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(e){e.sortBone(this.target);const s=this.bones[0].bone;e.sortBone(s),e._updateCache.push(this),s.sorted=!1,e.sortReset(s.children),e.constrained(s),this.bones.length>1&&e.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(e,s,n,i,r,l,c,o,a,h){typeof n=="number"?Mt.apply1(e,s,n,i,r,l,c,o):Mt.apply2(e,s,n,i,r,l,c,o,a,h)}static apply1(e,s,n,i,r,l,c,o){s.modifyLocal(e);const a=s.bone.parent.appliedPose;let h=a.a,d=a.b,f=a.c,u=a.d,m=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*R.signum(e.scaleX),g=(i-s.worldY)*R.signum(e.scaleY);break;case 2:{const x=Math.abs(h*u-d*f)/Math.max(R.epsilon,h*h+f*f),b=h/e.scaleX,w=f/e.scaleY;d=-w*x*e.scaleX,u=b*x*e.scaleY,m+=R.atan2Deg(w,b)}default:{const x=n-a.worldX,b=i-a.worldY,w=h*u-d*f;Math.abs(w)<=R.epsilon?(p=0,g=0):(p=(x*u-b*d)/w-s.x,g=(b*h-x*f)/w-s.y)}}if(m+=R.atan2Deg(g,p),s.scaleX<0&&(m+=180),m>180?m-=360:m<=-180&&(m+=360),s.rotation+=m*o,r||l){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const x=s.bone.data.length*s.scaleX;if(x>R.epsilon){const b=p*p+g*g;if(r&&b<x*x||l&&b>x*x){const w=(Math.sqrt(b)/x-1)*o+1;switch(s.scaleX*=w,c){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(e,s,n,i,r,l,c,o,a,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(e),n.modifyLocal(e);let d=s.x,f=s.y,u=s.scaleX,m=s.scaleY,p=n.scaleX,g=0,x=0,b=0;u<0?(u=-u,g=180,b=-1):(g=0,b=1),m<0&&(m=-m,b=-b),p<0?(p=-p,x=180):x=0;let w=0,T=0,y=s.a,v=s.b,S=s.c,A=s.d;const I=Math.abs(u-m)<=R.epsilon;!I||c?(n.y=0,w=y*n.x+s.worldX,T=S*n.x+s.worldY):(w=y*n.x+v*n.y+s.worldX,T=S*n.x+A*n.y+s.worldY);const M=s.bone.parent.appliedPose;y=M.a,v=M.b,S=M.c,A=M.d;let Y=y*A-v*S,k=w-M.worldX,E=T-M.worldY;Y=Math.abs(Y)<=R.epsilon?0:1/Y;const X=(k*A-E*v)*Y-d,V=(E*y-k*S)*Y-f;let N=Math.sqrt(X*X+V*V),q=n.bone.data.length*p,O,F;if(N<R.epsilon){Mt.apply(e,s,i,r,!1,c,0,h),n.rotation=0;return}k=i-M.worldX,E=r-M.worldY;let P=(k*A-E*v)*Y-d,U=(E*y-k*S)*Y-f,D=P*P+U*U;if(a!==0){a*=u*(p+1)*.5;const L=Math.sqrt(D),_=L-N-q*u+a;if(_>0){let $=Math.min(1,_/(a*2))-1;$=(_-a*(1-$*$))/L,P-=$*P,U-=$*U,D=P*P+U*U}}t:if(I){q*=u;let L=(D-N*N-q*q)/(2*N*q);if(L<-1)L=-1,F=Math.PI*l;else if(L>1){if(L=1,F=0,c)switch(y=(Math.sqrt(D)/(N+q)-1)*h+1,s.scaleX*=y,o){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y<.7?.25+.642857*y:y}}else F=Math.acos(L)*l;y=N+q*L,v=q*Math.sin(F),O=Math.atan2(U*y-P*v,P*y+U*v)}else{y=u*q,v=m*q;const L=y*y,_=v*v,$=Math.atan2(U,P);S=_*N*N+L*D-L*_;const J=-2*_*N,tt=_-L;if(A=J*J-4*tt*S,A>=0){let mt=Math.sqrt(A);J<0&&(mt=-mt),mt=-(J+mt)*.5;let pt=mt/tt,jt=S/mt;const ve=Math.abs(pt)<Math.abs(jt)?pt:jt;if(pt=D-ve*ve,pt>=0){E=Math.sqrt(pt)*l,O=$-Math.atan2(E,ve),F=Math.atan2(E/m,(ve-N)/u);break t}}let K=R.PI,et=N-y,nt=et*et,st=0,ht=0,it=N+y,rt=it*it,dt=0;S=-y*N/(L-_),S>=-1&&S<=1&&(S=Math.acos(S),k=y*Math.cos(S)+N,E=v*Math.sin(S),A=k*k+E*E,A<nt&&(K=S,nt=A,et=k,st=E),A>rt&&(ht=S,rt=A,it=k,dt=E)),D<=(nt+rt)*.5?(O=$-Math.atan2(st*l,et),F=K*l):(O=$-Math.atan2(dt*l,it),F=ht*l)}const W=Math.atan2(n.y,n.x)*b;O=(O-W)*R.radDeg+g-s.rotation,O>180?O-=360:O<=-180&&(O+=360),s.rotation+=O*h,F=((F+W)*R.radDeg-n.shearX)*b+x-n.rotation,F>180?F-=360:F<=-180&&(F+=360),n.rotation+=F*h}},Wt=class extends Xt{bones=[];_target=null;set target(t){this._target=t}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(t){this._scaleYMode=t}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(t){super(t,new le)}create(t){return new en(this,t)}},ce=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(t){this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}},Ht=class extends Xt{bones=[];set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(t){super(t,new ce)}create(t){return new sn(this,t)}},bs=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(bs||{}),ws=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(ws||{}),ys=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(ys||{}),sn=class Yt extends Et{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(e,s){if(super(e,new ce,new ce),!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=[];for(const n of this.data.bones)this.bones.push(s.bones[n.index].constrainedPose);this.slot=s.slots[e.slot.index]}copy(e){var s=new Yt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.slot.appliedPose.attachment;if(!(n instanceof ee))return;const i=this.appliedPose,r=i.mixRotate,l=i.mixX,c=i.mixY;if(r===0&&l===0&&c===0)return;const o=this.data,a=o.rotateMode===0,h=o.rotateMode===2,d=this.bones,f=d.length,u=a?f:f+1,m=B.setArraySize(this.spaces,u),p=h?this.lengths=B.setArraySize(this.lengths,f):[],g=i.spacing;switch(o.spacingMode){case 2:if(h)for(let v=0,S=u-1;v<S;v++){const A=d[v],I=A.bone.data.length,M=I*A.a,Y=I*A.c;p[v]=Math.sqrt(M*M+Y*Y)}B.arrayFill(m,1,u,g);break;case 3:{let v=0;for(let S=0,A=u-1;S<A;){const I=d[S],M=I.bone.data.length;if(M<R.epsilon)h&&(p[S]=0),m[++S]=g;else{const Y=M*I.a,k=M*I.c,E=Math.sqrt(Y*Y+k*k);h&&(p[S]=E),m[++S]=E,v+=E}}if(v>0){v=u/v*g;for(let S=1;S<u;S++)m[S]*=v}break}default:{const v=o.spacingMode===0;for(let S=0,A=u-1;S<A;){const I=d[S],M=I.bone.data.length;if(M<R.epsilon)h&&(p[S]=0),m[++S]=g;else{const Y=M*I.a,k=M*I.c,E=Math.sqrt(Y*Y+k*k);h&&(p[S]=E),m[++S]=(v?Math.max(0,M+g):g)*E/M}}}}const x=this.computeWorldPositions(e,n,u,a);let b=x[0],w=x[1],T=o.offsetRotation,y=!1;if(T===0)y=o.rotateMode===1;else{y=!1;const v=this.slot.bone.appliedPose;T*=v.a*v.d-v.b*v.c>0?R.degRad:-R.degRad}for(let v=0,S=3,A=e._update;v<f;v++,S+=3){const I=d[v];I.worldX+=(b-I.worldX)*l,I.worldY+=(w-I.worldY)*c;const M=x[S],Y=x[S+1],k=M-b,E=Y-w;if(h){const X=p[v];if(X!==0){const V=(Math.sqrt(k*k+E*E)/X-1)*r+1;I.a*=V,I.c*=V}}if(b=M,w=Y,r>0){let X=I.a,V=I.b,N=I.c,q=I.d,O=0,F=0,P=0;if(a?O=x[S-1]:m[v+1]===0?O=x[S+2]:O=Math.atan2(E,k),O-=Math.atan2(N,X),y){F=Math.cos(O),P=Math.sin(O);const U=I.bone.data.length;b+=(U*(F*X-P*N)-k)*r,w+=(U*(P*X+F*N)-E)*r}else O+=T;O>R.PI?O-=R.PI2:O<-R.PI&&(O+=R.PI2),O*=r,F=Math.cos(O),P=Math.sin(O),I.a=F*X-P*N,I.b=F*V-P*q,I.c=P*X+F*N,I.d=P*V+F*q}I.modifyWorld(A)}}computeWorldPositions(e,s,n,i){const r=this.slot;let l=this.appliedPose.position,c=this.spaces,o=B.setArraySize(this.positions,n*3+2),a=this.world;const h=s.closed;let d=s.worldVerticesLength,f=d/6,u=Yt.NONE;if(!s.constantSpeed){const F=s.lengths;f-=h?1:2;const P=F[f];this.data.positionMode===1&&(l*=P);let U;switch(this.data.spacingMode){case 2:U=P;break;case 3:U=P/n;break;default:U=1}a=B.setArraySize(this.world,8);for(let D=0,W=0,L=0;D<n;D++,W+=3){const _=c[D]*U;l+=_;let $=l;if(h)$%=P,$<0&&($+=P),L=0;else if($<0){u!==Yt.BEFORE&&(u=Yt.BEFORE,s.computeWorldVertices(e,r,2,4,a,0,2)),this.addBeforePosition($,a,0,o,W);continue}else if($>P){u!==Yt.AFTER&&(u=Yt.AFTER,s.computeWorldVertices(e,r,d-6,4,a,0,2)),this.addAfterPosition($-P,a,0,o,W);continue}for(;;L++){const J=F[L];if(!($>J)){if(L===0)$/=J;else{const tt=F[L-1];$=($-tt)/(J-tt)}break}}L!==u&&(u=L,h&&L===f?(s.computeWorldVertices(e,r,d-4,4,a,0,2),s.computeWorldVertices(e,r,0,4,a,4,2)):s.computeWorldVertices(e,r,L*6+2,8,a,0,2)),this.addCurvePosition($,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],o,W,i||D>0&&_===0)}return o}h?(d+=2,a=B.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d-4,a,0,2),s.computeWorldVertices(e,r,0,2,a,d-4,2),a[d-2]=a[0],a[d-1]=a[1]):(f--,d-=4,a=B.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d,a,0,2));const m=B.setArraySize(this.curves,f);let p=0,g=a[0],x=a[1],b=0,w=0,T=0,y=0,v=0,S=0,A=0,I=0,M=0,Y=0,k=0,E=0,X=0,V=0;for(let F=0,P=2;F<f;F++,P+=6)b=a[P],w=a[P+1],T=a[P+2],y=a[P+3],v=a[P+4],S=a[P+5],A=(g-b*2+T)*.1875,I=(x-w*2+y)*.1875,M=((b-T)*3-g+v)*.09375,Y=((w-y)*3-x+S)*.09375,k=A*2+M,E=I*2+Y,X=(b-g)*.75+A+M*.16666667,V=(w-x)*.75+I+Y*.16666667,p+=Math.sqrt(X*X+V*V),X+=k,V+=E,k+=M,E+=Y,p+=Math.sqrt(X*X+V*V),X+=k,V+=E,p+=Math.sqrt(X*X+V*V),X+=k+M,V+=E+Y,p+=Math.sqrt(X*X+V*V),m[F]=p,g=v,x=S;this.data.positionMode===1&&(l*=p);let N;switch(this.data.spacingMode){case 2:N=p;break;case 3:N=p/n;break;default:N=1}const q=this.segments;let O=0;for(let F=0,P=0,U=0,D=0;F<n;F++,P+=3){const W=c[F]*N;l+=W;let L=l;if(h)L%=p,L<0&&(L+=p),U=0,D=0;else if(L<0){this.addBeforePosition(L,a,0,o,P);continue}else if(L>p){this.addAfterPosition(L-p,a,d-4,o,P);continue}for(;;U++){const _=m[U];if(!(L>_)){if(U===0)L/=_;else{const $=m[U-1];L=(L-$)/(_-$)}break}}if(U!==u){u=U;let _=U*6;for(g=a[_],x=a[_+1],b=a[_+2],w=a[_+3],T=a[_+4],y=a[_+5],v=a[_+6],S=a[_+7],A=(g-b*2+T)*.03,I=(x-w*2+y)*.03,M=((b-T)*3-g+v)*.006,Y=((w-y)*3-x+S)*.006,k=A*2+M,E=I*2+Y,X=(b-g)*.3+A+M*.16666667,V=(w-x)*.3+I+Y*.16666667,O=Math.sqrt(X*X+V*V),q[0]=O,_=1;_<8;_++)X+=k,V+=E,k+=M,E+=Y,O+=Math.sqrt(X*X+V*V),q[_]=O;X+=k,V+=E,O+=Math.sqrt(X*X+V*V),q[8]=O,X+=k+M,V+=E+Y,O+=Math.sqrt(X*X+V*V),q[9]=O,D=0}for(L*=O;;D++){const _=q[D];if(!(L>_)){if(D===0)L/=_;else{const $=q[D-1];L=D+(L-$)/(_-$)}break}}this.addCurvePosition(L*.1,g,x,b,w,T,y,v,S,o,P,i||F>0&&W===0)}return o}addBeforePosition(e,s,n,i,r){const l=s[n],c=s[n+1],o=s[n+2]-l,a=s[n+3]-c,h=Math.atan2(a,o);i[r]=l+e*Math.cos(h),i[r+1]=c+e*Math.sin(h),i[r+2]=h}addAfterPosition(e,s,n,i,r){const l=s[n+2],c=s[n+3],o=l-s[n],a=c-s[n+1],h=Math.atan2(a,o);i[r]=l+e*Math.cos(h),i[r+1]=c+e*Math.sin(h),i[r+2]=h}addCurvePosition(e,s,n,i,r,l,c,o,a,h,d,f){if(e===0||Number.isNaN(e)){h[d]=s,h[d+1]=n,h[d+2]=Math.atan2(r-n,i-s);return}const u=e*e,m=u*e,p=1-e,g=p*p,x=g*p,b=p*e,w=b*3,T=p*w,y=w*e,v=s*x+i*T+l*y+o*m,S=n*x+r*T+c*y+a*m;h[d]=v,h[d+1]=S,f&&(e<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(S-(n*g+r*b*2+c*u),v-(s*g+i*b*2+l*u)))}sort(e){const s=this.slot.data.index,n=this.slot.bone;e.skin!=null&&this.sortPathSlot(e,e.skin,s,n),e.data.defaultSkin!=null&&e.data.defaultSkin!==e.skin&&this.sortPathSlot(e,e.data.defaultSkin,s,n),this.sortPath(e,this.slot.pose.attachment,n);const i=this.bones,r=this.bones.length;for(let l=0;l<r;l++){const c=i[l].bone;e.sortBone(c),e.constrained(c)}e._updateCache.push(this);for(let l=0;l<r;l++)e.sortReset(i[l].bone.children);for(let l=0;l<r;l++)i[l].bone.sorted=!0}sortPathSlot(e,s,n,i){const r=s.getAttachments();for(let l=0,c=r.length;l<c;l++){const o=r[l];o.slotIndex===n&&this.sortPath(e,o.attachment,i)}}sortPath(e,s,n){if(!(s instanceof ee))return;const i=s.bones;if(i==null)e.sortBone(n);else{const r=e.bones;for(let l=0,c=i.length;l<c;){let o=i[l++];for(o+=l;l<o;)e.sortBone(r[i[l++]])}}}isSourceActive(){return this.slot.bone.active}},nn=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(nn||{}),he=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(t){this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}},de=class{color=new z(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(t){if(t==null)throw new Error("pose cannot be null.");this.color.setFromColor(t.color),this.darkColor!=null&&t.darkColor!=null&&this.darkColor.setFromColor(t.darkColor),this.attachment=t.attachment,this.sequenceIndex=t.sequenceIndex,this.deform.length=0,this.deform.push(...t.deform)}getAttachment(){return this.attachment}setAttachment(t){this.attachment!==t&&((!(t instanceof xt)||!(this.attachment instanceof xt)||t.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}},rn=class Mn extends gs{skeleton;bone;attachmentState=0;constructor(e,s){if(super(e,new de,new de),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[e.boneData.index],e.setupPose.darkColor!=null&&(this.pose.darkColor=new z,this.constrainedPose.darkColor=new z),this.setupPose()}copy(e,s,n){const i=new Mn(e.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new z,i.constrainedPose.darkColor=new z),i.pose.set(e.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},an=class Ae{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Ae.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Ae.yDir}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=[];for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i;if(!n.parent)i=new re(n,null);else{const r=this.bones[n.parent.index];i=new re(n,r),r.children.push(i)}this.bones.push(i)}this.slots=[];for(const s of this.data.slots)this.slots.push(new rn(s,this));this.drawOrder=new tn(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const n=s.create(this);n instanceof vs&&this.physics.push(n),this.constraints.push(n)}this.color=new z(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const e=this.slots;for(let l=0,c=e.length;l<c;l++)e[l].unconstrained();const s=this.bones,n=s.length;for(let l=0,c=n;l<c;l++){const o=s[l];o.sorted=o.data.skinRequired,o.active=!o.sorted,o.unconstrained()}if(this.skin){const l=this.skin.bones;for(let c=0,o=this.skin.bones.length;c<o;c++){let a=this.bones[l[c].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}const i=this.constraints;let r=this.constraints.length;for(let l=0;l<r;l++)i[l].unconstrained();for(let l=0;l<r;l++){const c=i[l];c.active=c.isSourceActive()&&(!c.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(c.data)),c.active&&c.sort(this)}for(let l=0;l<n;l++)this.sortBone(s[l]);r=this._updateCache.length;for(let l=0;l<r;l++){const c=this._updateCache[l];c instanceof re&&(this._updateCache[l]=c.appliedPose)}}constrained(e){e.pose===e.appliedPose&&(e.constrained(),this.resetCache.push(e))}sortBone(e){if(e.sorted||!e.active)return;const s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,n=e.length;s<n;s++){const i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let i=0,r=this.resetCache.length;i<r;i++)s[i].resetConstrained();const n=this._updateCache;for(let i=0,r=this._updateCache.length;i<r;i++)n[i].update(this,e)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const e=this.bones;for(let n=0,i=e.length;n<i;n++)e[n].setupPose();const s=this.constraints;for(let n=0,i=s.length;n<i;n++)s[n].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const e=this.slots;for(let s=0,n=e.length;s<n;s++)e[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");const s=this.bones;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const s=this.slots;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}setSkin(e){typeof e=="string"?this.setSkinByName(e):this.setSkinBySkin(e)}setSkinByName(e){const s=this.data.findSkin(e);if(!s)throw new Error(`Skin not found: ${e}`);this.setSkin(s)}setSkinBySkin(e){if(e!==this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{const s=this.slots;for(let n=0,i=s.length;n<i;n++){const r=s[n],l=r.data.attachmentName;if(l){const c=e.getAttachment(n,l);c&&r.pose.setAttachment(c)}}}this.skin=e,this.updateCache()}}getAttachment(e,s){return typeof e=="string"?this.getAttachmentByName(e,s):this.getAttachmentByIndex(e,s)}getAttachmentByName(e,s){const n=this.data.findSlot(e);if(!n)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(n.index,s)}getAttachmentByIndex(e,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const n=this.skin.getAttachment(e,s);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");const n=this.findSlot(e);if(!n)throw new Error(`Slot not found: ${e}`);let i=null;if(s&&(i=this.getAttachment(n.data.index,s),!i))throw new Error(`Attachment not found: ${s}, for slot: ${e}`);n.pose.setAttachment(i)}findConstraint(e,s){if(e==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const n=this.constraints;for(let i=0,r=n.length;i<r;i++){const l=n[i];if(l instanceof s&&l.data.name===e)return l}return null}getBoundsRect(e){const s=new Me,n=new Me;return this.getBounds(s,n,void 0,e),{x:s.x,y:s.y,width:n.x,height:n.y}}getBounds(e,s,n=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,l=r;let c=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let d=0,f=r.length;d<f;d++){const u=l[d];if(!u.bone.active)continue;let m=0,p=null,g=null;const x=u.appliedPose.attachment;if(x){if(x instanceof Pt)m=8,p=B.setArraySize(n,m,0),x.computeWorldVertices(u,x.getOffsets(u.appliedPose),p,0,2),g=Ae.quadTriangles;else if(x instanceof Tt)m=x.worldVerticesLength,p=B.setArraySize(n,m,0),x.computeWorldVertices(this,u,0,m,p,0,2),g=x.triangles;else if(x instanceof zt&&i){i.clipEnd(u),i.clipStart(this,u,x);continue}if(p&&g){i?.isClipping()&&i.clipTriangles(p,g,g.length)&&(p=i.clippedVertices,m=i.clippedVertices.length);for(let b=0,w=p.length;b<w;b+=2){const T=p[b],y=p[b+1];c=Math.min(c,T),o=Math.min(o,y),a=Math.max(a,T),h=Math.max(h,y)}}}i&&i.clipEnd(u)}i&&i.clipEnd(),e.set(c,o),s.set(a-c,h-o)}setScale(e,s){this.scaleX=e,this.scaleY=s}setPosition(e,s){this.x=e,this.y=s}update(e){this.time+=e}physicsTranslate(e,s){const n=this.physics;for(let i=0,r=n.length;i<r;i++)n[i].translate(e,s)}physicsRotate(e,s,n){const i=this.physics;for(let r=0,l=i.length;r<l;r++)i[r].rotate(e,s,n)}},vs=class Yn extends Et{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(e,s){if(super(e,new he,new he),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[e.bone.index].constrainedPose}copy(e){var s=new Yn(this.data,e);return s.pose.set(this.pose),s}reset(e){this.remaining=0,this.lastTime=e.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(e,s){this.ux-=e,this.uy-=s,this.cx-=e,this.cy-=s}rotate(e,s,n){const i=n*R.degRad,r=Math.cos(i),l=Math.sin(i),c=this.cx-e,o=this.cy-s;this.translate(c*r-o*l-c,c*l+o*r-o)}update(e,s){const n=this.appliedPose,i=n.mix;if(i===0)return;const r=this.data.x>0,l=this.data.y>0,c=this.data.rotate>0||this.data.shearX>0,o=this.data.scaleX>0,a=this.bone;let h=a.bone.data.length,d=this.data.step,f=0;switch(s){case 0:return;case 1:this.reset(e);case 2:{const u=Math.max(e.time-this.lastTime,0),m=this.remaining;this.remaining+=u,this.lastTime=e.time;const p=a.worldX,g=a.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let x=this.remaining,b=n.inertia,w=e.data.referenceScale,T=-1,y=0,v=0,S=this.data.limit*u,A=S*Math.abs(e.scaleY);if(S*=Math.abs(e.scaleX),r||l){if(r){const I=(this.ux-p)*b;this.xOffset+=I>S?S:I<-S?-S:I,this.ux=p}if(l){const I=(this.uy-g)*b;this.yOffset+=I>A?A:I<-A?-A:I,this.uy=g}if(x>=d){const I=this.xOffset,M=this.yOffset;T=n.damping**(60*d),y=d*n.massInverse,v=n.strength;const Y=w*n.wind,k=w*n.gravity,E=(Y*e.windX+k*e.gravityX)*e.scaleX,X=(Y*e.windY+k*e.gravityY)*e.scaleY;do r&&(this.xVelocity+=(E-this.xOffset*v)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=T),l&&(this.yVelocity-=(X+this.yOffset*v)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=T),x-=d;while(x>=d);this.xLag=this.xOffset-I,this.yLag=this.yOffset-M}f=Math.max(0,1-x/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),l&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(c||o){let I=Math.atan2(a.c,a.a),M=0,Y=0,k=0,E=this.cx-a.worldX,X=this.cy-a.worldY;if(E>S?E=S:E<-S&&(E=-S),X>A?X=A:X<-A&&(X=-A),x=this.remaining,c){k=(this.data.rotate+this.data.shearX)*i,f=this.rotateLag*Math.max(0,1-m/d);let V=Math.atan2(X+this.ty,E+this.tx)-I-(this.rotateOffset-f)*k;this.rotateOffset+=(V-Math.ceil(V*R.invPI2-.5)*R.PI2)*b,V=(this.rotateOffset-f)*k+I,M=Math.cos(V),Y=Math.sin(V),o&&(V=h*a.getWorldScaleX(),V>0&&(this.scaleOffset+=(E*M+X*Y)*b/V))}else{M=Math.cos(I),Y=Math.sin(I);const V=h*a.getWorldScaleX()-this.scaleLag*Math.max(0,1-m/d);V>0&&(this.scaleOffset+=(E*M+X*Y)*b/V)}if(x>=d){T===-1&&(T=n.damping**(60*d),y=d*n.massInverse,v=n.strength);const V=n.wind*e.windX+n.gravity*e.gravityX,N=(n.wind*e.windY+n.gravity*e.gravityY)*an.yDir,q=this.rotateOffset,O=this.scaleOffset,F=h/w;for(;;)if(x-=d,o&&(this.scaleVelocity+=(V*M-N*Y-this.scaleOffset*v)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=T),c){if(this.rotateVelocity-=((V*Y+N*M)*F+this.rotateOffset*v)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=T,x<d)break;const P=this.rotateOffset*k+I;M=Math.cos(P),Y=Math.sin(P)}else if(x<d)break;this.rotateLag=this.rotateOffset-q,this.scaleLag=this.scaleOffset-O}f=Math.max(0,1-x/d)}this.remaining=x}this.cx=a.worldX,this.cy=a.worldY;break}case 3:f=Math.max(0,1-this.remaining/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),l&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(c){let u=(this.rotateOffset-this.rotateLag*f)*i,m=0,p=0,g=0;if(this.data.shearX>0){let x=0;this.data.rotate>0&&(x=u*this.data.rotate,m=Math.sin(x),p=Math.cos(x),g=a.b,a.b=p*g-m*a.d,a.d=m*g+p*a.d),x+=u*this.data.shearX,m=Math.sin(x),p=Math.cos(x),g=a.a,a.a=p*g-m*a.c,a.c=m*g+p*a.c}else u*=this.data.rotate,m=Math.sin(u),p=Math.cos(u),g=a.a,a.a=p*g-m*a.c,a.c=m*g+p*a.c,g=a.b,a.b=p*g-m*a.d,a.d=m*g+p*a.d}if(o){let u=1+(this.scaleOffset-this.scaleLag*f)*i*this.data.scaleX;switch(a.a*=u,a.c*=u,this.data.scaleYMode){case 1:a.b*=u,a.d*=u;break;case 2:u=Math.abs(u),u=u>=.7?1/u:4-3.67347*u,a.b*=u,a.d*=u}}s!==3&&(this.tx=h*a.a,this.ty=h*a.c),a.modifyWorld(e._update)}sort(e){const s=this.bone.bone;e.sortBone(s),e._updateCache.push(this),e.sortReset(s.children),e.constrained(s)}isSourceActive(){return this.bone.bone.active}},Gt=class extends Xt{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;_scaleYMode=0;get scaleYMode(){return this._scaleYMode}set scaleYMode(t){if(t==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=t}constructor(t){super(t,new he)}create(t){return new vs(this,t)}};typeof Math.fround>"u"&&(Math.fround=(t=>e=>(t[0]=e,t[0]))(new Float32Array(1)));var fe=class{time=0;mix=0;set(t){this.time=t.time,this.mix=t.mix}},on=class Ls extends Et{static offsets=[0,0,0,0,0,0];bone=null;constructor(e,s){if(super(e,new fe,new fe),!s)throw new Error("skeleton cannot be null.");e.bone!=null&&(this.bone=s.bones[e.bone.index])}copy(e){var s=new Ls(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.data,r=i.animation,l=this.bone;if(l!==null){if(!l.active)return;i.local&&l.appliedPose.validateLocalTransform(e),n.time=i.offset+(i.property.value(e,l.appliedPose,i.local,Ls.offsets)-i.property.offset)*i.scale,i.loop?n.time=r.duration+n.time%r.duration:n.time=Math.max(0,n.time)}const c=e.bones,o=r.bones;for(let a=0,h=r.bones.length;a<h;a++)c[o[a]].appliedPose.modifyLocal(e);r.apply(e,n.time,n.time,i.loop,null,n.mix,!1,i.additive,!1,!0)}sort(e){const s=this.bone,n=this.data;s&&!n.local&&e.sortBone(s),e._updateCache.push(this);const i=e.bones,r=n.animation.bones;for(let d=0,f=n.animation.bones.length;d<f;d++){const u=i[r[d]];u.sorted=!1,e.sortReset(u.children),e.constrained(u)}const l=n.animation.timelines,c=e.slots,o=e.constraints,a=e.physics,h=e.physics.length;for(let d=0,f=n.animation.timelines.length;d<f;d++){const u=l[d];if(_s(u))e.constrained(c[u.slotIndex]);else if(u instanceof St||u instanceof $t)e.drawOrder.constrained();else if(u instanceof gt)if(u.constraintIndex===-1)for(let m=0;m<h;m++)e.constrained(a[m]);else e.constrained(o[u.constraintIndex]);else if(Ws(u)){const m=u.constraintIndex;m!==-1&&e.constrained(o[m])}}}},yt=class extends Xt{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;constructor(t){super(t,new fe)}create(t){return new on(this,t)}},Ts=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSliderAnimations(t){const e=this.constraints;for(let s=0,n=this.constraints.length;s<n;s++){const i=e[s];i instanceof yt&&i.animation!=null&&t.push(i.animation)}return t}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findConstraint(t,e){if(!t)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");const s=this.constraints;for(let n=0,i=this.constraints.length;n<i;n++){const r=s[n];if(r instanceof e&&r.name===t)return r}return null}},Ss=class{slotIndex=0;placeholder;attachment;constructor(t=0,e,s){this.slotIndex=t,this.placeholder=e,this.attachment=s}},ue=class{name;attachments=[];bones=[];constraints=[];color=new z(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];n.attachment&&(n.attachment instanceof Tt?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=[];for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const n in s){const i=s[n];i&&t.push(new Ss(e,n,i))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const n in s){const i=s[n];i&&e.push(new Ss(t,n,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let n=0;n<t.slots.length;n++){const i=t.slots[n],r=i.pose.getAttachment();if(r&&s<e.attachments.length){const l=e.attachments[s];for(const c in l){const o=l[c];if(r===o){const a=this.getAttachment(s,c);a&&i.pose.setAttachment(a);break}}}s++}}},As=class extends se{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(super(e,new de),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.boneData=s}},Is=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Is||{}),me=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(t){this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}},ln=class Pn extends Et{bones;source;constructor(e,s){if(super(e,new me,new me),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of e.bones)this.bones.push(s.bones[i.index].constrainedPose);const n=s.bones[e.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(e){var s=new Pn(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const i=this.data,r=i.localSource,l=i.localTarget,c=i.additive,o=i.clamp,a=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(e);const d=i.properties,f=i.properties.length,u=e._update,m=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const x=m[p];l?x.modifyLocal(e):x.modifyWorld(u);for(let b=0;b<f;b++){const w=d[b],T=w.value(e,h,r,a)-w.offset,y=w.to;for(let v=0,S=w.to.length;v<S;v++){const A=y[v];if(A.mix(n)!==0){let I=A.offset+T*A.scale;o&&(A.offset<A.max?I=R.clamp(I,A.offset,A.max):I=R.clamp(I,A.max,A.offset)),A.apply(e,n,x,I,l,c)}}}}}sort(e){this.data.localSource||e.sortBone(this.source);const s=this.bones,n=this.bones.length,i=!this.data.localTarget;if(i)for(let r=0;r<n;r++)e.sortBone(s[r].bone);e._updateCache.push(this);for(let r=0;r<n;r++){const l=s[r].bone;e.sortReset(l.children),e.constrained(l)}for(let r=0;r<n;r++)s[r].bone.sorted=i}isSourceActive(){return this.source.active}},j=class ct extends Xt{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(e){this._source=e}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(e){super(e,new me)}create(e){return new ln(this,e)}getOffsetRotation(){return this.offsets[ct.ROTATION]}setOffsetRotation(e){this.offsets[ct.ROTATION]=e}getOffsetX(){return this.offsets[ct.X]}setOffsetX(e){this.offsets[ct.X]=e}getOffsetY(){return this.offsets[ct.Y]}setOffsetY(e){this.offsets[ct.Y]=e}getOffsetScaleX(){return this.offsets[ct.SCALEX]}setOffsetScaleX(e){this.offsets[ct.SCALEX]=e}getOffsetScaleY(){return this.offsets[ct.SCALEY]}setOffsetScaleY(e){this.offsets[ct.SCALEY]=e}getOffsetShearY(){return this.offsets[ct.SHEARY]}setOffsetShearY(e){this.offsets[ct.SHEARY]=e}},At=class{offset=0;to=[]},It=class{offset=0;max=0;scale=0},ge=class extends At{value(t,e,s,n){if(s)return e.rotation+n[j.ROTATION];const i=t.scaleX,r=t.scaleY;let l=Math.atan2(e.c/r,e.a/i)*R.radDeg+((e.a*e.d-e.b*e.c)*i*r>0?n[j.ROTATION]:-n[j.ROTATION]);return l<0&&(l+=360),l}},Cs=class extends It{mix(t){return t.mixRotate}apply(t,e,s,n,i,r){if(i)s.rotation+=(r?n:n-s.rotation)*e.mixRotate;else{const l=t.scaleX,c=t.scaleY,o=1/l,a=1/c,h=s.a*o,d=s.b*o,f=s.c*a,u=s.d*a;n*=R.degRad,r||(n-=Math.atan2(f,h)),n>R.PI?n-=R.PI2:n<-R.PI&&(n+=R.PI2),n*=e.mixRotate;const m=Math.cos(n),p=Math.sin(n);s.a=(m*h-p*f)*l,s.b=(m*d-p*u)*l,s.c=(p*h+m*f)*c,s.d=(p*d+m*u)*c}}},pe=class extends At{value(t,e,s,n){return s?e.x+n[j.X]:(n[j.X]*e.a+n[j.Y]*e.b+e.worldX)/t.scaleX}},Ms=class extends It{mix(t){return t.mixX}apply(t,e,s,n,i,r){i?s.x+=(r?n:n-s.x)*e.mixX:(r||(n-=s.worldX/t.scaleX),s.worldX+=n*e.mixX*t.scaleX)}},xe=class extends At{value(t,e,s,n){return s?e.y+n[j.Y]:(n[j.X]*e.c+n[j.Y]*e.d+e.worldY)/t.scaleY}},Ys=class extends It{mix(t){return t.mixY}apply(t,e,s,n,i,r){i?s.y+=(r?n:n-s.y)*e.mixY:(r||(n-=s.worldY/t.scaleY),s.worldY+=n*e.mixY*t.scaleY)}},be=class extends At{value(t,e,s,n){if(s)return e.scaleX+n[j.SCALEX];const i=e.a/t.scaleX,r=e.c/t.scaleY;return Math.sqrt(i*i+r*r)+n[j.SCALEX]}},Ps=class extends It{mix(t){return t.mixScaleX}apply(t,e,s,n,i,r){if(i)r?s.scaleX*=1+(n-1)*e.mixScaleX:s.scaleX!==0&&(s.scaleX+=(n-s.scaleX)*e.mixScaleX);else if(r){const l=1+(n-1)*e.mixScaleX;s.a*=l,s.c*=l}else{let l=s.a/t.scaleX,c=s.c/t.scaleY,o=Math.sqrt(l*l+c*c);o!==0&&(o=1+(n-o)*e.mixScaleX/o,s.a*=o,s.c*=o)}}},we=class extends At{value(t,e,s,n){if(s)return e.scaleY+n[j.SCALEY];const i=e.b/t.scaleX,r=e.d/t.scaleY;return Math.sqrt(i*i+r*r)+n[j.SCALEY]}},Fs=class extends It{mix(t){return t.mixScaleY}apply(t,e,s,n,i,r){if(i)r?s.scaleY*=1+(n-1)*e.mixScaleY:s.scaleY!==0&&(s.scaleY+=(n-s.scaleY)*e.mixScaleY);else if(r){const l=1+(n-1)*e.mixScaleY;s.b*=l,s.d*=l}else{let l=s.b/t.scaleX,c=s.d/t.scaleY,o=Math.sqrt(l*l+c*c);o!==0&&(o=1+(n-o)*e.mixScaleY/o,s.b*=o,s.d*=o)}}},ye=class extends At{value(t,e,s,n){if(s)return e.shearY+n[j.SHEARY];const i=1/t.scaleX,r=1/t.scaleY;return(Math.atan2(e.d*r,e.b*i)-Math.atan2(e.c*r,e.a*i))*R.radDeg-90+n[j.SHEARY]}},ks=class extends It{mix(t){return t.mixShearY}apply(t,e,s,n,i,r){if(i)r||(n-=s.shearY),s.shearY+=n*e.mixShearY;else{const l=t.scaleX,c=t.scaleY,o=s.b/l,a=s.d/c,h=Math.atan2(a,o);n=(n+90)*R.degRad,r?n-=R.PI/2:(n-=h-Math.atan2(s.c/l,s.a/c),n>R.PI?n-=R.PI2:n<-R.PI&&(n+=R.PI2)),n=h+n*e.mixShearY;const d=Math.sqrt(o*o+a*a);s.b=Math.cos(n)*d*c,s.d=Math.sin(n)*d*l}}},Gn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Ts;s.name="";const n=new cn(t),i=n.readInt32(),r=n.readInt32();s.hash=r===0&&i===0?null:r.toString(16)+i.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*e;const l=n.readBoolean();l&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let c=0;c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("String in string table must not be null.");n.strings.push(m)}const o=s.bones;c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Bone name must not be null.");const p=u===0?null:o[n.readInt(!0)],g=new ms(u,m,p),x=g.setupPose;x.rotation=n.readFloat(),x.x=n.readFloat()*e,x.y=n.readFloat()*e,x.scaleX=n.readFloat(),x.scaleY=n.readFloat(),x.shearX=n.readFloat(),x.shearY=n.readFloat(),x.inherit=n.readByte(),g.length=n.readFloat()*e,g.skinRequired=n.readBoolean(),l&&(z.rgba8888ToColor(g.color,n.readInt32()),g.icon=n.readString()??void 0,g.iconSize=n.readFloat(),g.iconRotation=n.readFloat(),g.visible=n.readBoolean()),o.push(g)}c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Slot name must not be null.");const p=o[n.readInt(!0)],g=new As(u,m,p);z.rgba8888ToColor(g.setupPose.color,n.readInt32());const x=n.readInt32();x!==-1&&z.rgb888ToColor(g.setupPose.darkColor=new z,x),g.attachmentName=n.readStringRef(),g.blendMode=n.readInt(!0),l&&(g.visible=n.readBoolean()),s.slots.push(g)}const a=s.constraints,h=n.readInt(!0);for(let u=0;u<h;u++){const m=n.readString();if(!m)throw new Error("Constraint data name must not be null.");let p;switch(n.readByte()){case gi:{const g=new Wt(m);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.target=o[n.readInt(!0)];const x=n.readByte();g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.scaleYMode=n.readUnsignedByte());const b=g.setupPose;b.bendDirection=(x&4)!==0?-1:1,b.compress=(x&8)!==0,b.stretch=(x&16)!==0,(x&32)!==0&&(b.mix=(x&64)!==0?n.readFloat():1),(x&128)!==0&&(b.softness=n.readFloat()*e),a.push(g);break}case xi:{const g=new j(m);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.source=o[n.readInt(!0)];let x=n.readUnsignedByte();g.skinRequired=(x&1)!==0,g.localSource=(x&2)!==0,g.localTarget=(x&4)!==0,g.additive=(x&8)!==0,g.clamp=(x&16)!==0,p=x>>5;for(let w=0,T;w<p;w++){let y=1,v;switch(n.readByte()){case 0:v=new ge;break;case 1:{y=e,v=new pe;break}case 2:{y=e,v=new xe;break}case 3:v=new be;break;case 4:v=new we;break;case 5:v=new ye;break;default:v=null}if(v){v.offset=n.readFloat()*y,T=n.readByte();for(let S=0;S<T;S++){let A=1,I;switch(n.readByte()){case 0:I=new Cs;break;case 1:{A=e,I=new Ms;break}case 2:{A=e,I=new Ys;break}case 3:I=new Ps;break;case 4:I=new Fs;break;case 5:I=new ks;break;default:I=null}I&&(I.offset=n.readFloat()*A,I.max=n.readFloat()*A,I.scale=n.readFloat()*A/y,v.to[S]=I)}g.properties[w]=v}}x=n.readByte(),(x&1)!==0&&(g.offsets[j.ROTATION]=n.readFloat()),(x&2)!==0&&(g.offsets[j.X]=n.readFloat()*e),(x&4)!==0&&(g.offsets[j.Y]=n.readFloat()*e),(x&8)!==0&&(g.offsets[j.SCALEX]=n.readFloat()),(x&16)!==0&&(g.offsets[j.SCALEY]=n.readFloat()),(x&32)!==0&&(g.offsets[j.SHEARY]=n.readFloat()),x=n.readByte();const b=g.setupPose;(x&1)!==0&&(b.mixRotate=n.readFloat()),(x&2)!==0&&(b.mixX=n.readFloat()),(x&4)!==0&&(b.mixY=n.readFloat()),(x&8)!==0&&(b.mixScaleX=n.readFloat()),(x&16)!==0&&(b.mixScaleY=n.readFloat()),(x&32)!==0&&(b.mixShearY=n.readFloat()),a.push(g);break}case pi:{const g=new Ht(m);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.slot=s.slots[n.readInt(!0)];const x=n.readByte();g.skinRequired=(x&1)!==0,g.positionMode=x>>1&1,g.spacingMode=x>>2&3,g.rotateMode=x>>4&3,(x&128)!==0&&(g.offsetRotation=n.readFloat());const b=g.setupPose;b.position=n.readFloat(),g.positionMode===0&&(b.position*=e),b.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(b.spacing*=e),b.mixRotate=n.readFloat(),b.mixX=n.readFloat(),b.mixY=n.readFloat(),a.push(g);break}case bi:{const g=new Gt(m);g.bone=o[n.readInt(!0)];let x=n.readByte();if(g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.x=n.readFloat()),(x&4)!==0&&(g.y=n.readFloat()),(x&8)!==0&&(g.rotate=n.readFloat()),(x&16)!==0){let w=n.readFloat();w<-2?(g.scaleYMode=2,w=-2-w):w<0&&(g.scaleYMode=1,w=-1-w),g.scaleX=w}(x&32)!==0&&(g.shearX=n.readFloat()),g.limit=((x&64)!==0?n.readFloat():5e3)*e,g.step=1/n.readUnsignedByte();const b=g.setupPose;b.inertia=n.readFloat(),b.strength=n.readFloat(),b.damping=n.readFloat(),b.massInverse=(x&128)!==0?n.readFloat():1,b.wind=n.readFloat(),b.gravity=n.readFloat(),x=n.readByte(),(x&1)!==0&&(g.inertiaGlobal=!0),(x&2)!==0&&(g.strengthGlobal=!0),(x&4)!==0&&(g.dampingGlobal=!0),(x&8)!==0&&(g.massGlobal=!0),(x&16)!==0&&(g.windGlobal=!0),(x&32)!==0&&(g.gravityGlobal=!0),(x&64)!==0&&(g.mixGlobal=!0),b.mix=(x&128)!==0?n.readFloat():1,a.push(g);break}case wi:{const g=new yt(m),x=n.readByte();if(g.skinRequired=(x&1)!==0,g.loop=(x&2)!==0,g.additive=(x&4)!==0,(x&8)!==0&&(g.setupPose.time=n.readFloat()),(x&16)!==0&&(g.setupPose.mix=(x&32)!==0?n.readFloat():1),(x&64)!==0){g.local=(x&128)!==0,g.bone=o[n.readInt(!0)];const b=n.readFloat();let w=1;switch(n.readByte()){case 0:g.property=new ge;break;case 1:{w=e,g.property=new pe;break}case 2:{w=e,g.property=new xe;break}case 3:g.property=new be;break;case 4:g.property=new we;break;case 5:g.property=new ye;break;default:continue}g.property.offset=b*w,g.offset=n.readFloat(),g.scale=n.readFloat()/w}a.push(g);break}}}const d=this.readSkin(n,s,!0,l);d&&(s.defaultSkin=d,s.skins.push(d));{let u=s.skins.length;for(B.setArraySize(s.skins,c=u+n.readInt(!0));u<c;u++){const m=this.readSkin(n,s,!1,l);if(!m)throw new Error("readSkin() should not have returned null.");s.skins[u]=m}}c=this.linkedMeshes.length;for(let u=0;u<c;u++){const m=this.linkedMeshes[u],p=s.skins[m.skinIndex];if(!m.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(m.sourceIndex,m.source);if(!g)throw new Error(`Source mesh not found: ${m.source}`);m.mesh.timelineAttachment=m.inheritTimelines?g:m.mesh,m.mesh.setSourceMesh(g),m.mesh.updateSequence()}this.linkedMeshes.length=0,c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Event data name must not be null");const p=new xs(m),g=p.setupPose;g.intValue=n.readInt(!1),g.floatValue=n.readFloat(),g.stringValue=n.readString(),p._audioPath=n.readString(),p.audioPath&&(g.volume=n.readFloat(),g.balance=n.readFloat()),s.events.push(p)}const f=s.animations;c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Animation name must not be null.");f.push(this.readAnimation(n,m,s,l))}for(let u=0;u<h;u++){const m=a[u];m instanceof yt&&(m.animation=f[n.readInt(!0)])}return s}readSkin(t,e,s,n){let i=null,r=0;if(s){if(r=t.readInt(!0),r===0)return null;i=new ue("default")}else{const l=t.readString();if(!l)throw new Error("Skin name must not be null.");i=new ue(l),n&&z.rgba8888ToColor(i.color,t.readInt32());let c=t.readInt(!0),o=e.bones,a=i.bones;for(let h=0;h<c;h++)a[h]=o[t.readInt(!0)];c=t.readInt(!0),o=e.constraints,a=i.constraints;for(let h=0;h<c;h++)a[h]=o[t.readInt(!0)];r=t.readInt(!0)}for(let l=0;l<r;l++){const c=t.readInt(!0);for(let o=0,a=t.readInt(!0);o<a;o++){const h=t.readStringRef();if(!h)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,i,c,h,n);d&&i.setAttachment(c,h,d)}}return i}readAttachment(t,e,s,n,i,r){const l=this.scale,c=t.readByte(),o=(c&8)!==0?t.readStringRef():i;if(!o)throw new Error("Attachment name must not be null");switch(c&7){case 0:{let a=(c&16)!==0?t.readStringRef():null;const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=(c&128)!==0?t.readFloat():0,u=t.readFloat(),m=t.readFloat(),p=t.readFloat(),g=t.readFloat(),x=t.readFloat(),b=t.readFloat();a||(a=o);const w=this.attachmentLoader.newRegionAttachment(s,i,o,a,d);return w?(w.path=a,w.x=u*l,w.y=m*l,w.scaleX=p,w.scaleY=g,w.rotation=f,w.width=x*l,w.height=b*l,z.rgba8888ToColor(w.color,h),w.updateSequence(),w):null}case 1:{const a=this.readVertices(t,(c&16)!==0),h=r?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,i,o);return d?(d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,r&&z.rgba8888ToColor(d.color,h),d):null}case 2:{let a=(c&16)!==0?t.readStringRef():o;const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=t.readInt(!0),u=this.readVertices(t,(c&128)!==0),m=this.readFloatArray(t,u.length,1),p=this.readShortArray(t,(u.length-f-2)*3),g=t.readInt(!0);let x=null;if(g>0){x=[];for(let v=0;v<g;v++)x[v]=t.readInt(!0)}let b=[],w=0,T=0;r&&(b=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),T=t.readFloat()),a||(a=o);const y=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return y?(y.path=a,z.rgba8888ToColor(y.color,h),y.hullLength=f<<1,y.bones=u.bones,y.vertices=u.vertices,y.worldVerticesLength=u.length,y.regionUVs=m,y.triangles=p,x&&(y.timelineSlots=x),r&&(y.edges=b,y.width=w*l,y.height=T*l),y.updateSequence(),y):null}case 3:{const a=(c&16)!==0?t.readStringRef():o;if(a==null)throw new Error("Path of linked mesh must not be null");const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=(c&128)!==0,u=t.readInt(!0),m=t.readInt(!0),p=t.readStringRef();let g=0,x=0;r&&(g=t.readFloat(),x=t.readFloat());const b=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return b?(b.path=a,z.rgba8888ToColor(b.color,h),r&&(b.width=g*l,b.height=x*l),this.linkedMeshes.push(new jn(b,m,n,u,p,f)),b):null}case 4:{const a=(c&16)!==0,h=(c&32)!==0,d=this.readVertices(t,(c&64)!==0),f=this.readFloatArray(t,d.length/6,l),u=r?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,i,o);return m?(m.closed=a,m.constantSpeed=h,m.worldVerticesLength=d.length,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,r&&z.rgba8888ToColor(m.color,u),m):null}case 5:{const a=t.readFloat(),h=t.readFloat(),d=t.readFloat(),f=r?t.readInt32():0,u=this.attachmentLoader.newPointAttachment(s,i,o);return u?(u.x=h*l,u.y=d*l,u.rotation=a,r&&z.rgba8888ToColor(u.color,f),u):null}case 6:{const a=t.readInt(!0),h=this.readVertices(t,(c&16)!==0),d=r?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,i,o);return f?(f.endSlot=e.slots[a],f.convex=(c&32)!==0,f.inverse=(c&64)!==0,f.worldVerticesLength=h.length,f.vertices=h.vertices,f.bones=h.bones,r&&z.rgba8888ToColor(f.color,d),f):null}}}readSequence(t,e){if(!e)return new Ot(1,!1);const s=new Ot(t.readInt(!0),!0);return s.start=t.readInt(!0),s.digits=t.readInt(!0),s.setupIndex=t.readInt(!0),s}readVertices(t,e){const s=this.scale,i=t.readInt(!0)<<1;if(!e)return new hn(null,this.readFloatArray(t,i,s),i);const r=t.readInt(!0),l=[],c=[];for(let o=0,a=0;o<r;){const h=t.readInt(!0);l[o++]=h;for(let d=0;d<h;d++,a+=3)l[o++]=t.readInt(!0),c[a]=t.readFloat()*s,c[a+1]=t.readFloat()*s,c[a+2]=t.readFloat()}return new hn(l,B.toFloatArray(c),i)}readFloatArray(t,e,s){const n=[];if(s===1)for(let i=0;i<e;i++)n[i]=t.readFloat();else for(let i=0;i<e;i++)n[i]=t.readFloat()*s;return n}readShortArray(t,e){const s=[];for(let n=0;n<e;n++)s[n]=t.readInt(!0);return s}readAnimation(t,e,s,n){t.readInt(!0);const i=[],r=this.scale;for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0),w=b-1;switch(x){case ci:{const T=new Ft(b,m);for(let y=0;y<b;y++)T.setFrame(y,t.readFloat(),t.readStringRef());i.push(T);break}case hi:{const T=t.readInt(!0),y=new qe(b,T,m);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;for(let Y=0,k=0;y.setFrame(Y,v,S,A,I,M),Y!==w;Y++){const E=t.readFloat(),X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(Y);break;case ut:H(t,y,k++,Y,0,v,E,S,X,1),H(t,y,k++,Y,1,v,E,A,V,1),H(t,y,k++,Y,2,v,E,I,N,1),H(t,y,k++,Y,3,v,E,M,q,1)}v=E,S=X,A=V,I=N,M=q}i.push(y);break}case di:{const T=t.readInt(!0),y=new _e(b,T,m);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,Y=0;y.setFrame(M,v,S,A,I),M!==w;M++){const k=t.readFloat(),E=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(M);break;case ut:H(t,y,Y++,M,0,v,k,S,E,1),H(t,y,Y++,M,1,v,k,A,X,1),H(t,y,Y++,M,2,v,k,I,V,1)}v=k,S=E,A=X,I=V}i.push(y);break}case fi:{const T=t.readInt(!0),y=new We(b,T,m);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let X=0,V=0;y.setFrame(X,v,S,A,I,M,Y,k,E),X!==w;X++){const N=t.readFloat(),q=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(X);break;case ut:H(t,y,V++,X,0,v,N,S,q,1),H(t,y,V++,X,1,v,N,A,O,1),H(t,y,V++,X,2,v,N,I,F,1),H(t,y,V++,X,3,v,N,M,P,1),H(t,y,V++,X,4,v,N,Y,U,1),H(t,y,V++,X,5,v,N,k,D,1),H(t,y,V++,X,6,v,N,E,W,1)}v=N,S=q,A=O,I=F,M=P,Y=U,k=D,E=W}i.push(y);break}case ui:{const T=t.readInt(!0),y=new He(b,T,m);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let E=0,X=0;y.setFrame(E,v,S,A,I,M,Y,k),E!==w;E++){const V=t.readFloat(),N=t.readUnsignedByte()/255,q=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(E);break;case ut:H(t,y,X++,E,0,v,V,S,N,1),H(t,y,X++,E,1,v,V,A,q,1),H(t,y,X++,E,2,v,V,I,O,1),H(t,y,X++,E,3,v,V,M,F,1),H(t,y,X++,E,4,v,V,Y,P,1),H(t,y,X++,E,5,v,V,k,U,1)}v=V,S=N,A=q,I=O,M=F,Y=P,k=U}i.push(y);break}case mi:{const T=new ze(b,t.readInt(!0),m);let y=t.readFloat(),v=t.readUnsignedByte()/255;for(let S=0,A=0;T.setFrame(S,y,v),S!==w;S++){const I=t.readFloat(),M=t.readUnsignedByte()/255;switch(t.readByte()){case ft:T.setStepped(S);break;case ut:H(t,T,A++,S,0,y,I,v,M,1)}y=I,v=M}i.push(T)}}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0);if(x===li){const T=new $e(b,m);for(let y=0;y<b;y++)T.setFrame(y,t.readFloat(),t.readByte());i.push(T);continue}const w=t.readInt(!0);switch(x){case Qn:Z(t,i,new Dt(b,w,m),1);break;case Zn:Z(t,i,new Xe(b,w,m),r);break;case ti:Z(t,i,new Ve(b,w,m),r);break;case ei:Z(t,i,new Re(b,w,m),r);break;case si:Z(t,i,new Le(b,w,m),1);break;case ni:Z(t,i,new Be(b,w,m),1);break;case ii:Z(t,i,new Oe(b,w,m),1);break;case ri:Z(t,i,new Ne(b,w,m),1);break;case ai:Z(t,i,new De(b,w,m),1);break;case oi:Z(t,i,new Ue(b,w,m),1);break}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0),p=t.readInt(!0),g=p-1,x=new Je(p,t.readInt(!0),m);let b=t.readByte(),w=t.readFloat(),T=(b&1)!==0?(b&2)!==0?t.readFloat():1:0,y=(b&4)!==0?t.readFloat()*r:0;for(let v=0,S=0;x.setFrame(v,w,T,y,(b&8)!==0?1:-1,(b&16)!==0,(b&32)!==0),v!==g;v++){b=t.readByte();const A=t.readFloat(),I=(b&1)!==0?(b&2)!==0?t.readFloat():1:0,M=(b&4)!==0?t.readFloat()*r:0;(b&64)!==0?x.setStepped(v):(b&128)!==0&&(H(t,x,S++,v,0,w,A,T,I,1),H(t,x,S++,v,1,w,A,y,M,r)),w=A,T=I,y=M}i.push(x)}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0),p=t.readInt(!0),g=p-1,x=new Ke(p,t.readInt(!0),m);let b=t.readFloat(),w=t.readFloat(),T=t.readFloat(),y=t.readFloat(),v=t.readFloat(),S=t.readFloat(),A=t.readFloat();for(let I=0,M=0;x.setFrame(I,b,w,T,y,v,S,A),I!==g;I++){const Y=t.readFloat(),k=t.readFloat(),E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),N=t.readFloat(),q=t.readFloat();switch(t.readByte()){case ft:x.setStepped(I);break;case ut:H(t,x,M++,I,0,b,Y,w,k,1),H(t,x,M++,I,1,b,Y,T,E,1),H(t,x,M++,I,2,b,Y,y,X,1),H(t,x,M++,I,3,b,Y,v,V,1),H(t,x,M++,I,4,b,Y,S,N,1),H(t,x,M++,I,5,b,Y,A,q,1)}b=Y,w=k,T=E,y=X,v=V,S=N,A=q}i.push(x)}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0),p=s.constraints[m];for(let g=0,x=t.readInt(!0);g<x;g++){const b=t.readByte(),w=t.readInt(!0),T=t.readInt(!0);switch(b){case Ti:Z(t,i,new Qe(w,T,m),p.positionMode===0?r:1);break;case Si:Z(t,i,new Ze(w,T,m),p.spacingMode===0||p.spacingMode===1?r:1);break;case Ai:{const y=new ts(w,T,m);let v=t.readFloat(),S=t.readFloat(),A=t.readFloat(),I=t.readFloat();for(let M=0,Y=0,k=y.getFrameCount()-1;y.setFrame(M,v,S,A,I),M!==k;M++){const E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),N=t.readFloat();switch(t.readByte()){case ft:y.setStepped(M);break;case ut:H(t,y,Y++,M,0,v,E,S,X,1),H(t,y,Y++,M,1,v,E,A,V,1),H(t,y,Y++,M,2,v,E,I,N,1)}v=E,S=X,A=V,I=N}i.push(y)}}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0)-1;for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0);if(x===Ei){const T=new ls(b,m);for(let y=0;y<b;y++)T.setFrame(y,t.readFloat());i.push(T);continue}const w=t.readInt(!0);switch(x){case Ii:Z(t,i,new es(b,w,m),1);break;case Ci:Z(t,i,new ss(b,w,m),1);break;case Mi:Z(t,i,new ns(b,w,m),1);break;case Yi:Z(t,i,new is(b,w,m),1);break;case Pi:Z(t,i,new rs(b,w,m),1);break;case Fi:Z(t,i,new as(b,w,m),1);break;case ki:Z(t,i,new os(b,w,m),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0),w=t.readInt(!0);switch(x){case Xi:Z(t,i,new cs(b,w,m),1);break;case Vi:Z(t,i,new hs(b,w,m),1);break;default:throw new Error(`Uknown slider type: ${x}`)}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=s.skins[t.readInt(!0)];for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readInt(!0);for(let b=0,w=t.readInt(!0);b<w;b++){const T=t.readStringRef();if(!T)throw new Error("attachmentName must not be null.");const y=m.getAttachment(x,T),v=t.readByte(),S=t.readInt(!0),A=S-1;switch(v){case yi:{const I=y,M=I.bones,Y=I.vertices,k=M?Y.length/3*2:Y.length,E=t.readInt(!0),X=new Ge(S,E,x,I);let V=t.readFloat();for(let N=0,q=0;;N++){let O,F=t.readInt(!0);if(F===0)O=M?B.newFloatArray(k):Y;else{O=B.newFloatArray(k);const U=t.readInt(!0);if(F+=U,r===1)for(let D=U;D<F;D++)O[D]=t.readFloat();else for(let D=U;D<F;D++)O[D]=t.readFloat()*r;if(!M)for(let D=0,W=O.length;D<W;D++)O[D]+=Y[D]}if(X.setFrame(N,V,O),N===A)break;const P=t.readFloat();switch(t.readByte()){case ft:X.setStepped(N);break;case ut:H(t,X,q++,N,0,V,P,0,1,1)}V=P}i.push(X);break}case vi:{const I=new je(S,x,y);for(let M=0;M<S;M++){const Y=t.readFloat(),k=t.readInt32();I.setFrame(M,Y,Ee[k&15],k>>4,t.readFloat())}i.push(I);break}}}}}const l=s.slots.length,c=t.readInt(!0);if(c>0){const f=new St(c);for(let u=0;u<c;u++)f.setFrame(u,t.readFloat(),dn(t,l));i.push(f)}const o=t.readInt(!0);for(let f=0;f<o;f++){const u=t.readInt(!0),m=new Array(u);for(let x=0;x<u;x++)m[x]=t.readInt(!0);const p=t.readInt(!0),g=new $t(p,m,l);for(let x=0;x<p;x++)g.setFrame(x,t.readFloat(),dn(t,u));i.push(g)}const a=t.readInt(!0);if(a>0){const f=new Zt(a);for(let u=0;u<a;u++){const m=t.readFloat(),p=s.events[t.readInt(!0)],g=new oe(m,p);g.intValue=t.readInt(!1),g.floatValue=t.readFloat(),g.stringValue=t.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=t.readFloat(),g.balance=t.readFloat()),f.setFrame(u,g)}i.push(f)}let h=0;for(let f=0,u=i.length;f<u;f++)h=Math.max(h,i[f].getDuration());const d=new Kt(e,i,h);return n&&z.rgba8888ToColor(d.color,t.readInt32()),d}},cn=class{constructor(t,e=[],s=0,n=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t===0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const n=this.readUnsignedByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(n),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!==0}},jn=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}},hn=class{constructor(t=null,e,s=0){this.bones=t,this.vertices=e,this.length=s}};function Z(t,e,s,n){s instanceof Nt?Jn(t,e,s,n):Kn(t,e,s,n)}function Jn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n;for(let l=0,c=0,o=s.getFrameCount()-1;s.setFrame(l,i,r),l!==o;l++){const a=t.readFloat(),h=t.readFloat()*n;switch(t.readByte()){case ft:s.setStepped(l);break;case ut:H(t,s,c++,l,0,i,a,r,h,n)}i=a,r=h}e.push(s)}function Kn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n,l=t.readFloat()*n;for(let c=0,o=0,a=s.getFrameCount()-1;s.setFrame(c,i,r,l),c!==a;c++){const h=t.readFloat(),d=t.readFloat()*n,f=t.readFloat()*n;switch(t.readByte()){case ft:s.setStepped(c);break;case ut:H(t,s,o++,c,0,i,h,r,d,n),H(t,s,o++,c,1,i,h,l,f,n)}i=h,r=d,l=f}e.push(s)}function dn(t,e){const s=t.readInt(!0);if(s===0)return null;const n=new Array(e).fill(-1),i=new Array(e-s);let r=0,l=0;for(let c=0;c<s;c++){const o=t.readInt(!0);for(;r!==o;)i[l++]=r++;n[r+t.readInt(!0)]=r++}for(;r<e;)i[l++]=r++;for(let c=e-1;c>=0;c--)n[c]===-1&&(n[c]=i[--l]);return n}function H(t,e,s,n,i,r,l,c,o,a){e.setBezier(s,n,i,r,c,t.readFloat(),t.readFloat()*a,t.readFloat(),t.readFloat()*a,l,o)}var Qn=0,Zn=1,ti=2,ei=3,si=4,ni=5,ii=6,ri=7,ai=8,oi=9,li=10,ci=0,hi=1,di=2,fi=3,ui=4,mi=5,gi=0,pi=1,xi=2,bi=3,wi=4,yi=0,vi=1,Ti=0,Si=1,Ai=2,Ii=0,Ci=1,Mi=2,Yi=4,Pi=5,Fi=6,ki=7,Ei=8,Xi=0,Vi=1,ft=1,ut=2,Ri=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new Bt(()=>B.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,r=t.slots,l=r.length;s.length=0,i.freeAll(n),n.length=0;for(let c=0;c<l;c++){const o=r[c];if(!o.bone.active)continue;const a=o.appliedPose.attachment;if(a instanceof us){s.push(a);let h=i.obtain();h.length!==a.worldVerticesLength&&(h=B.newFloatArray(a.worldVerticesLength)),n.push(h),a.computeWorldVertices(t,o,0,a.worldVerticesLength,h,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;const i=this.polygons;for(let r=0,l=i.length;r<l;r++){const c=i[r],o=c;for(let a=0,h=c.length;a<h;a+=2){const d=o[a],f=o[a+1];t=Math.min(t,d),e=Math.min(e,f),s=Math.max(s,d),n=Math.max(n,f)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=n}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,n){const i=this.minX,r=this.minY,l=this.maxX,c=this.maxY;if(t<=i&&s<=i||e<=r&&n<=r||t>=l&&s>=l||e>=c&&n>=c)return!1;const o=(n-e)/(s-t);let a=o*(i-t)+e;if(a>r&&a<c||(a=o*(l-t)+e,a>r&&a<c))return!0;let h=(r-e)/o+t;return h>i&&h<l||(h=(c-e)/o+t,h>i&&h<l)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){const s=this.polygons;for(let n=0,i=s.length;n<i;n++)if(this.containsPointPolygon(s[n],t,e))return this.boundingBoxes[n];return null}containsPointPolygon(t,e,s){const n=t,i=t.length;let r=i-2,l=!1;for(let c=0;c<i;c+=2){const o=n[c+1],a=n[r+1];if(o<s&&a>=s||a<s&&o>=s){const h=n[c];h+(s-o)/(a-o)*(n[r]-h)<e&&(l=!l)}r=c}return l}intersectsSegment(t,e,s,n){const i=this.polygons;for(let r=0,l=i.length;r<l;r++)if(this.intersectsSegmentPolygon(i[r],t,e,s,n))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,n,i){const r=t,l=t.length,c=e-n,o=s-i,a=e*i-s*n;let h=r[l-2],d=r[l-1];for(let f=0;f<l;f+=2){const u=r[f],m=r[f+1],p=h*m-d*u,g=h-u,x=d-m,b=c*x-o*g,w=(a*g-c*p)/b;if((w>=h&&w<=u||w>=u&&w<=h)&&(w>=e&&w<=n||w>=n&&w<=e)){const T=(a*x-o*p)/b;if((T>=d&&T<=m||T>=m&&T<=d)&&(T>=s&&T<=i||T>=i&&T<=s))return!0}h=u,d=m}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return e===-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},fn=class at{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new Bt(()=>[]);polygonIndicesPool=new Bt(()=>[]);triangulate(e){const s=e;let n=e.length>>1;const i=this.indicesArray;i.length=0;for(let c=0;c<n;c++)i[c]=c;const r=this.isConcaveArray;r.length=0;for(let c=0;c<n;c++)r[c]=at.isConcave(c,n,s,i);const l=this.triangles;for(l.length=0;n>3;){let c=n-1,o=0,a=1;for(;;){t:if(!r[o]){const f=i[c]<<1,u=i[o]<<1,m=i[a]<<1,p=s[f],g=s[f+1],x=s[u],b=s[u+1],w=s[m],T=s[m+1];for(let y=a+1<n?a+1:0;y!==c;){if(r[y]){const v=i[y]<<1,S=s[v],A=s[v+1];if(at.positiveArea(w,T,p,g,S,A)&&at.positiveArea(p,g,x,b,S,A)&&at.positiveArea(x,b,w,T,S,A))break t}++y===n&&(y=0)}break}if(a===0){do{if(!r[o])break;o--}while(o>0);c=o>0?o-1:n-1,a=o+1<n?o+1:0;break}c=o,o=a,++a===n&&(a=0)}l.push(i[c],i[o],i[a]),i.splice(o,1),r.splice(o,1),n--;const h=o>0?o-1:n-1,d=o<n?o:0;r[h]=at.isConcave(h,n,s,i),r[d]=at.isConcave(d,n,s,i)}return n===3&&l.push(i[2],i[0],i[1]),l}decompose(e,s){const n=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let l=this.polygonIndicesPool.obtain();l.length=0;let c=this.polygonPool.obtain();c.length=0;let o=-1,a=0;for(let h=0,d=s.length;h<d;h+=3){const f=s[h]<<1,u=s[h+1]<<1,m=s[h+2]<<1,p=n[f],g=n[f+1],x=n[u],b=n[u+1],w=n[m],T=n[m+1];if(o===f){const y=c.length-4;if(at.winding(c[y],c[y+1],c[y+2],c[y+3],w,T)===a&&at.winding(w,T,c[0],c[1],c[2],c[3])===a){c.push(w,T),l.push(m);continue}}c.length>0&&(i.push(c),r.push(l),c=this.polygonPool.obtain(),l=this.polygonIndicesPool.obtain()),c.length=0,c.push(p,g,x,b),c.push(w,T),l.length=0,l.push(f,u,m),a=at.winding(p,g,x,b,w,T),o=f}c.length>0&&(i.push(c),r.push(l));for(let h=0,d=i.length;h<d;h++){if(l=r[h],l.length===0)continue;const f=l[0];let u=l[l.length-1];c=i[h];const m=c.length-4;let p=c[m],g=c[m+1],x=c[m+2],b=c[m+3];const w=c[0],T=c[1],y=c[2],v=c[3],S=at.winding(p,g,x,b,w,T);for(let A=0;A<d;A++){if(A===h)continue;const I=r[A];if(I.length!==3)continue;const M=I[0],Y=I[1],k=I[2],E=i[A],X=E[E.length-2],V=E[E.length-1];M!==f||Y!==u||at.winding(p,g,x,b,X,V)===S&&at.winding(X,V,w,T,y,v)===S&&(E.length=0,I.length=0,c.push(X,V),l.push(k),u=k,p=x,g=b,x=X,b=V,A=-1)}}for(let h=i.length-1;h>=0;h--)c=i[h],c.length===0?(i.splice(h,1),this.polygonPool.free(c),l=r[h],r.splice(h,1),this.polygonIndicesPool.free(l)):c.push(c[0],c[1]);return i}static isConcave(e,s,n,i){const r=i[e>0?e-1:s-1]<<1,l=i[e]<<1,c=i[e+1<s?e+1:0]<<1;return!at.positiveArea(n[r],n[r+1],n[l],n[l+1],n[c],n[c+1])}static positiveArea(e,s,n,i,r,l){return e*(l-i)+n*(s-l)+r*(i-s)>=0}static winding(e,s,n,i,r,l){return e*(l-i)+n*(s-l)+r*(i-s)>=0?1:-1}},un=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(t,e,s){if(this.clipAttachment)return;const n=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const i=B.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(t,e,0,n,i,0,2);const r=this.clippingPolygon,l=this.makeClockwise(r);l||this.inverse||s.convex?(l||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new fn),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(t){this.clipAttachment&&(t&&this.clipAttachment.endSlot!==t.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(t,e,s,n,i,r,l,c){return n&&i&&r&&typeof l=="boolean"&&typeof c=="number"?this.clipTrianglesRender(t,e,s,n,i,r,l,c):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){const n=this.clippedVertices;n.length=0;const i=this.clippedTriangles;i.length=0;let r=0;if(this.inverse){const h=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let f=e[d]<<1;const u=t[f],m=t[f+1];f=e[d+1]<<1;const p=t[f],g=t[f+1];f=e[d+2]<<1;const x=t[f],b=t[f+1];this.clipInverse(u,m,p,g,x,b,h);const w=this.inverseVertices;for(let T=0,y=this.inverseVertices.length;T<y;){const v=w[T++];let S=v>>1,A=n.length;const I=B.setArraySize(n,A+v);B.arrayCopy(w,T,I,A,v),A=i.length;const M=B.setArraySize(i,A+3*(S-2));for(let Y=1;Y<S-1;Y++,A+=3)M[A]=r,M[A+1]=r+Y,M[A+2]=r+Y+1;r+=S,T+=v}}return!0}const l=this.clipOutput,c=this.clippingPolygons,o=c.length;let a=null;for(let h=0;h<s;h+=3){let d=e[h]<<1;const f=t[d],u=t[d+1];d=e[h+1]<<1;const m=t[d],p=t[d+1];d=e[h+2]<<1;const g=t[d],x=t[d+1];for(let b=0;b<o;b++){let w=n.length;if(this.clip(f,u,m,p,g,x,c[b])){a=this.clipOutput;const T=l.length;if(T===0)continue;let y=T>>1;const v=B.setArraySize(n,w+T);B.arrayCopy(a,0,v,w,T),w=i.length;const S=B.setArraySize(i,w+3*(y-2));y--;for(let A=1;A<y;A++,w+=3)S[w]=r,S[w+1]=r+A,S[w+2]=r+A+1;r+=y}else{const T=B.setArraySize(n,w+6);T[w]=f,T[w+1]=u,T[w+2]=m,T[w+3]=p,T[w+4]=g,T[w+5]=x,w=i.length;const y=B.setArraySize(i,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return a!=null}clipTrianglesRender(t,e,s,n,i,r,l,c){const o=this.clippedVertices;o.length=0;const a=this.clippedTriangles;a.length=0;let h=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let x=e[g],b=e[g+1],w=e[g+2];const T=t[x*c],y=t[x*c+1],v=t[b*c],S=t[b*c+1],A=t[w*c],I=t[w*c+1];this.clipInverse(T,y,v,S,A,I,p);const M=this.inverseVertices.length;if(M===0)continue;const Y=n[x<<=1],k=n[x+1],E=n[b<<=1],X=n[b+1],V=n[w<<=1],N=n[w+1],q=S-I,O=A-v,F=T-A,P=I-y,U=1/(q*F+O*(y-I)),D=this.inverseVertices;for(let W=0;W<M;){const L=D[W++],_=L>>1;let $=o.length;const J=B.setArraySize(o,$+_*c);for(let K=0;K<L;K+=2,$+=c){const et=D[W+K],nt=D[W+K+1];J[$]=et,J[$+1]=nt,J[$+2]=i.r,J[$+3]=i.g,J[$+4]=i.b,J[$+5]=i.a;const st=et-A,ht=nt-I,it=(q*st+O*ht)*U,rt=(P*st+F*ht)*U,dt=1-it-rt;J[$+6]=Y*it+E*rt+V*dt,J[$+7]=k*it+X*rt+N*dt,l&&(J[$+8]=r.r,J[$+9]=r.g,J[$+10]=r.b,J[$+11]=r.a)}$=a.length;const tt=B.setArraySize(a,$+3*(_-2));for(let K=1;K<_-1;K++,$+=3)tt[$]=h,tt[$+1]=h+K,tt[$+2]=h+K+1;h+=_,W+=L}}return!0}const d=this.clipOutput,f=this.clippingPolygons,u=this.clippingPolygons.length;let m=null;for(let p=0;p<s;p+=3){let g=e[p];const x=t[g*c],b=t[g*c+1],w=n[g<<1],T=n[(g<<1)+1];g=e[p+1];const y=t[g*c],v=t[g*c+1],S=n[g<<1],A=n[(g<<1)+1];g=e[p+2];const I=t[g*c],M=t[g*c+1],Y=n[g<<1],k=n[(g<<1)+1],E=v-M,X=I-y,V=x-I,N=M-b,q=1/(E*V+X*(b-M));for(let O=0;O<u;O++){let F=o.length;if(this.clip(x,b,y,v,I,M,f[O])){m=this.clipOutput;const P=d.length;if(P===0)continue;let U=P>>1;const D=B.setArraySize(o,F+U*c);for(let L=0;L<P;L+=2,F+=c){const _=m[L],$=m[L+1];D[F]=_,D[F+1]=$,D[F+2]=i.r,D[F+3]=i.g,D[F+4]=i.b,D[F+5]=i.a;const J=_-I,tt=$-M,K=(E*J+X*tt)*q,et=(N*J+V*tt)*q,nt=1-K-et;D[F+6]=w*K+S*et+Y*nt,D[F+7]=T*K+A*et+k*nt,l&&(D[F+8]=r.r,D[F+9]=r.g,D[F+10]=r.b,D[F+11]=r.a)}F=a.length;const W=B.setArraySize(a,F+3*(U-2));U--;for(let L=1;L<U;L++,F+=3)W[F]=h,W[F+1]=h+L,W[F+2]=h+L+1;h+=U+1}else{const P=B.setArraySize(o,F+3*c);P[F]=x,P[F+1]=b,P[F+2]=i.r,P[F+3]=i.g,P[F+4]=i.b,P[F+5]=i.a,l?(P[F+6]=w,P[F+7]=T,P[F+8]=r.r,P[F+9]=r.g,P[F+10]=r.b,P[F+11]=r.a,P[F+12]=y,P[F+13]=v,P[F+14]=i.r,P[F+15]=i.g,P[F+16]=i.b,P[F+17]=i.a,P[F+18]=S,P[F+19]=A,P[F+20]=r.r,P[F+21]=r.g,P[F+22]=r.b,P[F+23]=r.a,P[F+24]=I,P[F+25]=M,P[F+26]=i.r,P[F+27]=i.g,P[F+28]=i.b,P[F+29]=i.a,P[F+30]=Y,P[F+31]=k,P[F+32]=r.r,P[F+33]=r.g,P[F+34]=r.b,P[F+35]=r.a):(P[F+6]=w,P[F+7]=T,P[F+8]=y,P[F+9]=v,P[F+10]=i.r,P[F+11]=i.g,P[F+12]=i.b,P[F+13]=i.a,P[F+14]=S,P[F+15]=A,P[F+16]=I,P[F+17]=M,P[F+18]=i.r,P[F+19]=i.g,P[F+20]=i.b,P[F+21]=i.a,P[F+22]=Y,P[F+23]=k),F=a.length;const U=B.setArraySize(a,F+3);U[F]=h,U[F+1]=h+1,U[F+2]=h+2,h+=3;break}}}return m!=null}clipTrianglesUnpacked(t,e,s,n,i,r=2){let l=this._clippedVerticesTyped,c=this._clippedUVsTyped,o=this._clippedTrianglesTyped,a=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const m=this.clippingPolygons[0];for(let p=0;p<n;p+=3){let g=s[p]*r;const x=t[e+g],b=t[e+g+1];let w=s[p]<<1;const T=i[w],y=i[w+1];g=s[p+1]*r;const v=t[e+g],S=t[e+g+1];w=s[p+1]<<1;const A=i[w],I=i[w+1];g=s[p+2]*r;const M=t[e+g],Y=t[e+g+1];w=s[p+2]<<1;const k=i[w],E=i[w+1];this.clipInverse(x,b,v,S,M,Y,m);const X=this.inverseVertices.length;if(X===0)continue;const V=S-Y,N=M-v,q=x-M,O=Y-b,F=1/(V*q+N*(b-Y)),P=this.inverseVertices;for(let U=0;U<X;){const D=P[U++],W=D>>1;let L=this.clippedVerticesLength;const _=L+W*r,$=this.clippedUVsLength+W*2;l.length<_&&(this._clippedVerticesTyped=new Float32Array(_*2),this._clippedVerticesTyped.set(l.subarray(0,L)),l=this._clippedVerticesTyped),c.length<$&&(this._clippedUVsTyped=new Float32Array($*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped),this.clippedVerticesLength=_,this.clippedUVsLength=$;const J=this._clippedVerticesTyped,tt=this._clippedUVsTyped;let K=$-W*2;for(let st=0;st<D;st+=2,L+=r,K+=2){const ht=P[U+st],it=P[U+st+1];J[L]=ht,J[L+1]=it;const rt=ht-M,dt=it-Y,mt=(V*rt+N*dt)*F,pt=(O*rt+q*dt)*F,jt=1-mt-pt;tt[K]=T*mt+A*pt+k*jt,tt[K+1]=y*mt+I*pt+E*jt}L=this.clippedTrianglesLength;const et=L+3*(W-2);o.length<et&&(this._clippedTrianglesTyped=new Uint16Array(et*2),this._clippedTrianglesTyped.set(o.subarray(0,L)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=et;const nt=o;for(let st=1;st<W-1;st++,L+=3)nt[L]=a,nt[L+1]=a+st,nt[L+2]=a+st+1;a+=W,U+=D}}return!0}const h=this.clipOutput,d=this.clippingPolygons,f=this.clippingPolygons.length;let u=null;for(let m=0;m<n;m+=3){let p=s[m],g=p*r;const x=t[e+g],b=t[e+g+1];let w=p<<1;const T=i[w],y=i[w+1];p=s[m+1],g=p*r;const v=t[e+g],S=t[e+g+1];w=p<<1;const A=i[w],I=i[w+1];p=s[m+2],g=p*r;const M=t[e+g],Y=t[e+g+1];w=p<<1;const k=i[w],E=i[w+1],X=S-Y,V=M-v,N=x-M,q=Y-b,O=1/(X*N+V*(b-Y));for(let F=0;F<f;F++){let P=this.clippedVerticesLength;if(this.clip(x,b,v,S,M,Y,d[F])){u=h;const U=h.length;if(U===0)continue;let D=U>>1;const W=P+D*r;l.length<W&&(this._clippedVerticesTyped=new Float32Array(W*2),this._clippedVerticesTyped.set(l.subarray(0,P)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+D*2)*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),l=this._clippedVerticesTyped,c=this._clippedUVsTyped);const L=l,_=c;this.clippedVerticesLength=W;let $=this.clippedUVsLength;this.clippedUVsLength=$+D*2;for(let K=0;K<U;K+=2,P+=r,$+=2){const et=u[K],nt=u[K+1];L[P]=et,L[P+1]=nt;const st=et-M,ht=nt-Y,it=(X*st+V*ht)*O,rt=(q*st+N*ht)*O,dt=1-it-rt;_[$]=T*it+A*rt+k*dt,_[$+1]=y*it+I*rt+E*dt}P=this.clippedTrianglesLength;const J=P+3*(D-2);o.length<J&&(this._clippedTrianglesTyped=new Uint16Array(J*2),this._clippedTrianglesTyped.set(o.subarray(0,P)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=J;const tt=o;D--;for(let K=1;K<D;K++,P+=3)tt[P]=a,tt[P+1]=a+K,tt[P+2]=a+K+1;a+=D+1}else{let U=P+3*r;l.length<U&&(this._clippedVerticesTyped=new Float32Array(U*2),this._clippedVerticesTyped.set(l.subarray(0,P)),l=this._clippedVerticesTyped),l[P]=x,l[P+1]=b,l[P+r]=v,l[P+r+1]=S,l[P+r*2]=M,l[P+r*2+1]=Y;const D=this.clippedUVsLength+3*2;c.length<D&&(this._clippedUVsTyped=new Float32Array(D*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped);const W=this.clippedUVsLength;c[W]=T,c[W+1]=y,c[W+2]=A,c[W+3]=I,c[W+4]=k,c[W+5]=E,this.clippedVerticesLength=U,this.clippedUVsLength=D,P=this.clippedTrianglesLength,U=P+3,o.length<U&&(this._clippedTrianglesTyped=new Uint16Array(U*2),this._clippedTrianglesTyped.set(o.subarray(0,P)),o=this._clippedTrianglesTyped);const L=o;L[P]=a,L[P+1]=a+1,L[P+2]=a+2,a+=3,this.clippedTrianglesLength=U;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),u!==null}clip(t,e,s,n,i,r,l){const c=this.clipOutput;let o=!1,a,h;l.length%4>=2?(a=this.clipOutput,h=this.scratch):(a=this.scratch,h=this.clipOutput);const d=l;a.length=8;const f=a;f[0]=t,f[1]=e,f[2]=s,f[3]=n,f[4]=i,f[5]=r,f[6]=t,f[7]=e,h.length=0;const u=l.length-4;for(let m=0;;m+=2){const p=d[m],g=d[m+1],x=p-d[m+2],b=g-d[m+3],w=h.length,T=a;for(let v=0,S=a.length-2;v<S;){t=T[v],e=T[v+1],v+=2,s=T[v],n=T[v+1];const A=b*(p-s)>x*(g-n),I=b*(p-t)-x*(g-e);if(I>0)if(A)h.push(s,n);else{const M=s-t,Y=n-e,k=I/(M*b-Y*x);k>=0&&k<=1?(h.push(t+M*k,e+Y*k),o=!0):h.push(s,n)}else if(A){const M=s-t,Y=n-e,k=I/(M*b-Y*x);k>=0&&k<=1?(h.push(t+M*k,e+Y*k,s,n),o=!0):h.push(s,n)}else o=!0}if(w===h.length)return c.length=0,!0;if(h.push(h[0],h[1]),m===u)break;const y=h;h=a,h.length=0,a=y}if(c!==h){c.length=0;for(let m=0,p=h.length-2;m<p;m++)c[m]=h[m]}else c.length=c.length-2;return o}clipInverse(t,e,s,n,i,r,l){this.inverseVertices.length=0;const c=l.length-4;let o,a;l.length%4>=2?(o=this.clipOutput,a=this.scratch):(o=this.scratch,a=this.clipOutput),o.length=8;let h=l,d=o;d[0]=t,d[1]=e,d[2]=s,d[3]=n,d[4]=i,d[5]=r,d[6]=t,d[7]=e,a.length=0;for(let f=0;;f+=2){const u=h[f],m=h[f+1],p=u-h[f+2],g=m-h[f+3],x=a.length,b=this.inverseVertices.length;this.inverseVertices.push(0),d=o;for(let y=0,v=o.length-2;y<v;){t=d[y],e=d[y+1],y+=2,s=d[y],n=d[y+1];const S=g*(u-s)>p*(m-n),A=g*(u-t)-p*(m-e);if(A>0)if(S)a.push(s,n);else{const I=s-t,M=n-e,Y=A/(I*g-M*p);if(Y>=0&&Y<=1){const k=t+I*Y,E=e+M*Y;a.push(k,E),this.inverseVertices.push(k,E,s,n)}else a.push(s,n)}else if(S){const I=s-t,M=n-e,Y=A/(I*g-M*p);if(Y>=0&&Y<=1){const k=t+I*Y,E=e+M*Y;this.inverseVertices.push(k,E),a.push(k,E,s,n)}else a.push(s,n)}else this.inverseVertices.push(s,n)}const w=this.inverseVertices.length-b-1;if(w>=6?this.inverseVertices[b]=w:this.inverseVertices.length=b,x===a.length||(a.push(a[0],a[1]),f===c))break;const T=a;a=o,a.length=0,o=T}}makeClockwise(t){const e=t,s=t.length;let n=!0,i=!0,r=0,l=e[s-2],c=e[s-1],o=e[0],a=e[1];for(let d=2;d<s;d+=2){const f=e[d],u=e[d+1];r+=o*u-f*a;const m=(o-l)*(u-a)-(a-c)*(f-o);i=i&&m<=0,n=n&&m>=0,l=o,c=a,o=f,a=u}r+=o*e[1]-e[0]*a;const h=(o-l)*(e[1]-a)-(a-c)*(e[0]-o);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,f=s-2,u=s>>1;d<u;d+=2){const m=e[d],p=e[d+1],g=f-d;e[d]=e[g],e[d+1]=e[g+1],e[g]=m,e[g+1]=p}return n}return i}makeConvex(t){const e=t.length,s=t;this.clipOutput.length=e;const n=this.clipOutput;n[0]=s[0],n[1]=s[1];for(let l=2;l<e;l+=2){const c=s[l],o=s[l+1];let a=l-2;for(;a>=0&&(n[a]>c||n[a]===c&&n[a+1]>o);a-=2)n[a+2]=n[a],n[a+3]=n[a+1];n[a+2]=c,n[a+3]=o}s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];let i=4;for(let l=4;l<e;l+=2,i+=2){const c=n[l],o=n[l+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==2););s[i]=c,s[i+1]=o}s[i]=n[e-4],s[i+1]=n[e-3];const r=i;i+=2;for(let l=e-6;l>=0;l-=2,i+=2){const c=n[l],o=n[l+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==r););s[i]=c,s[i+1]=o}t.length=i-2}},Li=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Ts,n=typeof t=="string"?JSON.parse(t):t,i=n.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=C(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),n.bones)for(let r=0;r<n.bones.length;r++){const l=n.bones[r];let c=null;const o=C(l,"parent",null);o&&(c=s.findBone(o));const a=new ms(s.bones.length,l.name,c);a.length=C(l,"length",0)*e;const h=a.setupPose;h.x=C(l,"x",0)*e,h.y=C(l,"y",0)*e,h.rotation=C(l,"rotation",0),h.scaleX=C(l,"scaleX",1),h.scaleY=C(l,"scaleY",1),h.shearX=C(l,"shearX",0),h.shearY=C(l,"shearY",0),h.inherit=B.enumValue(ne,C(l,"inherit","Normal")),a.skinRequired=C(l,"skin",!1);const d=C(l,"color",null);d&&a.color.setFromString(d),a.icon=C(l,"icon",void 0),a.iconSize=C(l,"iconSize",1),a.iconRotation=C(l,"iconRotation",0),s.bones.push(a)}if(n.slots)for(let r=0;r<n.slots.length;r++){const l=n.slots[r],c=l.name,o=s.findBone(l.bone);if(!o)throw new Error(`Couldn't find bone ${l.bone} for slot ${c}`);const a=new As(s.slots.length,c,o),h=C(l,"color",null);h&&a.setupPose.color.setFromString(h);const d=C(l,"dark",null);d&&(a.setupPose.darkColor=z.fromString(d)),a.attachmentName=C(l,"attachment",null),a.blendMode=B.enumValue(Is,C(l,"blend","normal")),a.visible=C(l,"visible",!0),s.slots.push(a)}if(n.constraints)for(const r of n.constraints){const l=r.name,c=C(r,"skin",!1);switch(C(r,"type",!1)){case"ik":{const o=new Wt(l);o.skinRequired=c;for(let u=0;u<r.bones.length;u++){const m=s.findBone(r.bones[u]);if(!m)throw new Error(`Couldn't find bone ${r.bones[u]} for IK constraint ${l}.`);o.bones.push(m)}const a=r.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for IK constraint ${l}.`);o.target=h;const d=C(r,"scaleY",null);d!=null&&(o.scaleYMode=B.enumValue(ae,d));const f=o.setupPose;f.mix=C(r,"mix",1),f.softness=C(r,"softness",0)*e,f.bendDirection=C(r,"bendPositive",!0)?1:-1,f.compress=C(r,"compress",!1),f.stretch=C(r,"stretch",!1),s.constraints.push(o);break}case"transform":{const o=new j(l);o.skinRequired=c;for(let w=0;w<r.bones.length;w++){const T=r.bones[w],y=s.findBone(T);if(!y)throw new Error(`Couldn't find bone ${T} for transform constraint ${r.name}.`);o.bones.push(y)}const a=r.source,h=s.findBone(a);if(!h)throw new Error(`Couldn't find source bone ${a} for transform constraint ${r.name}.`);o.source=h,o.localSource=C(r,"localSource",!1),o.localTarget=C(r,"localTarget",!1),o.additive=C(r,"additive",!1),o.clamp=C(r,"clamp",!1);let d=!1,f=!1,u=!1,m=!1,p=!1,g=!1;const x=Object.entries(C(r,"properties",{}));for(const[w,T]of x){const y=this.fromProperty(w),v=this.propertyScale(w,e);y.offset=C(T,"offset",0)*v;const S=Object.entries(C(T,"to",{}));for(const[A,I]of S){let M=1,Y;switch(A){case"rotate":{d=!0,Y=new Cs;break}case"x":{f=!0,Y=new Ms,M=e;break}case"y":{u=!0,Y=new Ys,M=e;break}case"scaleX":{m=!0,Y=new Ps;break}case"scaleY":{p=!0,Y=new Fs;break}case"shearY":{g=!0,Y=new ks;break}default:throw new Error(`Invalid transform constraint to property: ${A}`)}Y.offset=C(I,"offset",0)*M,Y.max=C(I,"max",1)*M,Y.scale=C(I,"scale",1)*M/v,y.to.push(Y)}y.to.length>0&&o.properties.push(y)}o.offsets[j.ROTATION]=C(r,"rotation",0),o.offsets[j.X]=C(r,"x",0)*e,o.offsets[j.Y]=C(r,"y",0)*e,o.offsets[j.SCALEX]=C(r,"scaleX",0),o.offsets[j.SCALEY]=C(r,"scaleY",0),o.offsets[j.SHEARY]=C(r,"shearY",0);const b=o.setupPose;d&&(b.mixRotate=C(r,"mixRotate",1)),f&&(b.mixX=C(r,"mixX",1)),u&&(b.mixY=C(r,"mixY",b.mixX)),m&&(b.mixScaleX=C(r,"mixScaleX",1)),p&&(b.mixScaleY=C(r,"mixScaleY",b.mixScaleX)),g&&(b.mixShearY=C(r,"mixShearY",1)),s.constraints.push(o);break}case"path":{const o=new Ht(l);o.skinRequired=c;for(let f=0;f<r.bones.length;f++){const u=r.bones[f],m=s.findBone(u);if(!m)throw new Error(`Couldn't find bone ${u} for path constraint ${r.name}.`);o.bones.push(m)}const a=r.slot,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for path constraint ${r.name}.`);o.slot=h,o.positionMode=B.enumValue(bs,C(r,"positionMode","Percent")),o.spacingMode=B.enumValue(ws,C(r,"spacingMode","Length")),o.rotateMode=B.enumValue(ys,C(r,"rotateMode","Tangent")),o.offsetRotation=C(r,"rotation",0);const d=o.setupPose;d.position=C(r,"position",0),o.positionMode===0&&(d.position*=e),d.spacing=C(r,"spacing",0),(o.spacingMode===0||o.spacingMode===1)&&(d.spacing*=e),d.mixRotate=C(r,"mixRotate",1),d.mixX=C(r,"mixX",1),d.mixY=C(r,"mixY",d.mixX),s.constraints.push(o);break}case"physics":{const o=new Gt(l);o.skinRequired=c;const a=r.bone,h=s.findBone(a);if(h==null)throw new Error(`Physics bone not found: ${a}`);o.bone=h,o.x=C(r,"x",0),o.y=C(r,"y",0),o.rotate=C(r,"rotate",0),o.scaleX=C(r,"scaleX",0);const d=C(r,"scaleY",null);d!=null&&(o.scaleYMode=B.enumValue(ae,d)),o.shearX=C(r,"shearX",0),o.limit=C(r,"limit",5e3)*e,o.step=1/C(r,"fps",60);const f=o.setupPose;f.inertia=C(r,"inertia",.5),f.strength=C(r,"strength",100),f.damping=C(r,"damping",.85),f.massInverse=1/C(r,"mass",1),f.wind=C(r,"wind",0),f.gravity=C(r,"gravity",0),f.mix=C(r,"mix",1),o.inertiaGlobal=C(r,"inertiaGlobal",!1),o.strengthGlobal=C(r,"strengthGlobal",!1),o.dampingGlobal=C(r,"dampingGlobal",!1),o.massGlobal=C(r,"massGlobal",!1),o.windGlobal=C(r,"windGlobal",!1),o.gravityGlobal=C(r,"gravityGlobal",!1),o.mixGlobal=C(r,"mixGlobal",!1),s.constraints.push(o);break}case"slider":{const o=new yt(l);o.skinRequired=c,o.additive=C(r,"additive",!1),o.loop=C(r,"loop",!1),o.setupPose.time=C(r,"time",0),o.setupPose.mix=C(r,"mix",1);const a=r.bone;if(a){if(o.bone=s.findBone(a),!o.bone)throw new Error(`Slider bone not found: ${a}`);const h=r.property;o.property=this.fromProperty(h);const d=this.propertyScale(h,e);o.property.offset=C(r,"from",0)*d,o.offset=C(r,"to",0),o.scale=C(r,"scale",1)/d,o.local=C(r,"local",!1)}s.constraints.push(o);break}}}if(n.skins)for(let r=0;r<n.skins.length;r++){const l=n.skins[r],c=new ue(l.name);if(l.bones)for(let o=0;o<l.bones.length;o++){const a=l.bones[o],h=s.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${l.name}.`);c.bones.push(h)}if(l.ik)for(let o=0;o<l.ik.length;o++){const a=l.ik[o],h=s.findConstraint(a,Wt);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.transform)for(let o=0;o<l.transform.length;o++){const a=l.transform[o],h=s.findConstraint(a,j);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.path)for(let o=0;o<l.path.length;o++){const a=l.path[o],h=s.findConstraint(a,Ht);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.physics)for(let o=0;o<l.physics.length;o++){const a=l.physics[o],h=s.findConstraint(a,Gt);if(!h)throw new Error(`Couldn't find physics constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.slider)for(let o=0;o<l.slider.length;o++){const a=l.slider[o],h=s.findConstraint(a,yt);if(!h)throw new Error(`Couldn't find slider constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}for(const o in l.attachments){const a=s.findSlot(o);if(!a)throw new Error(`Couldn't find skin slot ${o} for skin ${l.name}.`);const h=l.attachments[o];for(const d in h){const f=this.readAttachment(h[d],c,a.index,d,s);f&&c.setAttachment(a.index,d,f)}}s.skins.push(c),c.name==="default"&&(s.defaultSkin=c)}for(let r=0,l=this.linkedMeshes.length;r<l;r++){const c=this.linkedMeshes[r],o=c.skin?s.findSkin(c.skin):s.defaultSkin;if(!o)throw new Error(`Skin not found: ${c.skin}`);const a=o.getAttachment(c.sourceIndex,c.source);if(!a)throw new Error(`Source mesh not found: ${c.source}`);c.mesh.timelineAttachment=c.inheritTimelines?a:c.mesh,c.mesh.setSourceMesh(a),c.mesh.updateSequence();t:if(c.inheritTimelines&&c.slotIndex!==c.sourceIndex){const h=a.timelineSlots;for(const f of h)if(f===c.slotIndex)break t;const d=[...h];d[h.length]=c.slotIndex,a.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const r in n.events){const l=n.events[r],c=new xs(r),o=c.setupPose;o.intValue=C(l,"int",0),o.floatValue=C(l,"float",0),o.stringValue=C(l,"string",""),c._audioPath=C(l,"audio",null),c.audioPath&&(o.volume=C(l,"volume",o.volume),o.balance=C(l,"balance",o.balance)),s.events.push(c)}if(n.animations)for(const r in n.animations){const l=n.animations[r];this.readAnimation(l,r,s)}if(n.constraints)for(const r in n.constraints){const l=n.constraints[r];if(l.type==="slider"){const c=s.findConstraint(l.name,yt),o=l.animation,a=s.findAnimation(o);if(!a)throw new Error(`Slider animation not found: ${o}`);c.animation=a}}return s}fromProperty(t){let e;switch(t){case"rotate":e=new ge;break;case"x":e=new pe;break;case"y":e=new xe;break;case"scaleX":e=new be;break;case"scaleY":e=new we;break;case"shearY":e=new ye;break;default:throw new Error(`Invalid transform constraint from property: ${t}`)}return e}propertyScale(t,e){switch(t){case"x":case"y":return e;default:return 1}}readAttachment(t,e,s,n,i){const r=this.scale,l=C(t,"name",n);switch(C(t,"type","region")){case"region":{const c=C(t,"path",l),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,n,l,c,o);if(!a)return null;a.path=c,a.x=C(t,"x",0)*r,a.y=C(t,"y",0)*r,a.scaleX=C(t,"scaleX",1),a.scaleY=C(t,"scaleY",1),a.rotation=C(t,"rotation",0),a.width=t.width*r,a.height=t.height*r;const h=C(t,"color",null);return h&&a.color.setFromString(h),a.updateSequence(),a}case"boundingbox":{const c=this.attachmentLoader.newBoundingBoxAttachment(e,n,l);if(!c)return null;this.readVertices(t,c,t.vertexCount<<1);const o=C(t,"color",null);return o&&c.color.setFromString(o),c}case"mesh":case"linkedmesh":{const c=C(t,"path",l),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,n,l,c,o);if(!a)return null;a.path=c;const h=C(t,"color",null);h&&a.color.setFromString(h),a.width=C(t,"width",0)*r,a.height=C(t,"height",0)*r;const d=C(t,"source",null);if(d){let u=s;const m=C(t,"slot",null);if(m){const p=i.findSlot(m);if(!p)throw new Error(`Source mesh slot not found: ${m}`);u=p.index}return this.linkedMeshes.push(new Bi(a,C(t,"skin",null),s,u,d,C(t,"timelines",!0))),a}const f=t.uvs;return this.readVertices(t,a,f.length),a.triangles=t.triangles,a.regionUVs=f,a.edges=C(t,"edges",null),a.hullLength=C(t,"hull",0)*2,a.updateSequence(),a}case"path":{const c=this.attachmentLoader.newPathAttachment(e,n,l);if(!c)return null;c.closed=C(t,"closed",!1),c.constantSpeed=C(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,c,o<<1);const a=B.newArray(o/3,0);for(let d=0;d<t.lengths.length;d++)a[d]=t.lengths[d]*r;c.lengths=a;const h=C(t,"color",null);return h&&c.color.setFromString(h),c}case"point":{const c=this.attachmentLoader.newPointAttachment(e,n,l);if(!c)return null;c.x=C(t,"x",0)*r,c.y=C(t,"y",0)*r,c.rotation=C(t,"rotation",0);const o=C(t,"color",null);return o&&c.color.setFromString(o),c}case"clipping":{const c=this.attachmentLoader.newClippingAttachment(e,n,l);if(!c)return null;const o=C(t,"end",null);o&&(c.endSlot=i.findSlot(o)),c.convex=C(t,"convex",!1),c.inverse=C(t,"inverse",!1);const a=t.vertexCount;this.readVertices(t,c,a<<1);const h=C(t,"color",null);return h&&c.color.setFromString(h),c}}return null}readSequence(t){if(t==null)return new Ot(1,!1);const e=new Ot(C(t,"count",0),!0);return e.start=C(t,"start",1),e.digits=C(t,"digits",0),e.setupIndex=C(t,"setup",0),e}readVertices(t,e,s){const n=this.scale;e.worldVerticesLength=s;const i=t.vertices;if(s===i.length){const c=B.toFloatArray(i);if(n!==1)for(let o=0,a=i.length;o<a;o++)c[o]*=n;e.vertices=c;return}const r=[],l=[];for(let c=0,o=i.length;c<o;){const a=i[c++];l.push(a);for(let h=c+a*4;c<h;c+=4)l.push(i[c]),r.push(i[c+1]*n),r.push(i[c+2]*n),r.push(i[c+3])}e.bones=l,e.vertices=B.toFloatArray(r)}readAnimation(t,e,s){const n=this.scale,i=[];if(t.slots)for(const o in t.slots){const a=t.slots[o],h=s.findSlot(o);if(!h)throw new Error(`Slot not found: ${o}`);const d=h.index;for(const f in a){const u=a[f];if(!u)continue;const m=u.length;switch(f){case"attachment":{const p=new Ft(m,d);for(let g=0;g<m;g++){const x=u[g];p.setFrame(g,C(x,"time",0),C(x,"name",null))}i.push(p);break}case"rgba":{const p=new qe(m,m<<2,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.color);for(let w=0,T=0;;w++){p.setFrame(w,x,b.r,b.g,b.b,b.a);const y=u[w+1];if(!y){p.shrink(T);break}const v=C(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(T=G(A,p,T,w,0,x,v,b.r,S.r,1),T=G(A,p,T,w,1,x,v,b.g,S.g,1),T=G(A,p,T,w,2,x,v,b.b,S.b,1),T=G(A,p,T,w,3,x,v,b.a,S.a,1)),x=v,b=S,g=y}i.push(p);break}case"rgb":{const p=new _e(m,m*3,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.color);for(let w=0,T=0;;w++){p.setFrame(w,x,b.r,b.g,b.b);const y=u[w+1];if(!y){p.shrink(T);break}const v=C(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(T=G(A,p,T,w,0,x,v,b.r,S.r,1),T=G(A,p,T,w,1,x,v,b.g,S.g,1),T=G(A,p,T,w,2,x,v,b.b,S.b,1)),x=v,b=S,g=y}i.push(p);break}case"alpha":{ot(i,u,new ze(m,m,d),0,1);break}case"rgba2":{const p=new We(m,m*7,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.light),w=z.fromString(g.dark);for(let T=0,y=0;;T++){p.setFrame(T,x,b.r,b.g,b.b,b.a,w.r,w.g,w.b);const v=u[T+1];if(!v){p.shrink(y);break}const S=C(v,"time",0),A=z.fromString(v.light),I=z.fromString(v.dark),M=g.curve;M&&(y=G(M,p,y,T,0,x,S,b.r,A.r,1),y=G(M,p,y,T,1,x,S,b.g,A.g,1),y=G(M,p,y,T,2,x,S,b.b,A.b,1),y=G(M,p,y,T,3,x,S,b.a,A.a,1),y=G(M,p,y,T,4,x,S,w.r,I.r,1),y=G(M,p,y,T,5,x,S,w.g,I.g,1),y=G(M,p,y,T,6,x,S,w.b,I.b,1)),x=S,b=A,w=I,g=v}i.push(p);break}case"rgb2":{const p=new He(m,m*6,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.light),w=z.fromString(g.dark);for(let T=0,y=0;;T++){p.setFrame(T,x,b.r,b.g,b.b,w.r,w.g,w.b);const v=u[T+1];if(!v){p.shrink(y);break}const S=C(v,"time",0),A=z.fromString(v.light),I=z.fromString(v.dark),M=g.curve;M&&(y=G(M,p,y,T,0,x,S,b.r,A.r,1),y=G(M,p,y,T,1,x,S,b.g,A.g,1),y=G(M,p,y,T,2,x,S,b.b,A.b,1),y=G(M,p,y,T,3,x,S,w.r,I.r,1),y=G(M,p,y,T,4,x,S,w.g,I.g,1),y=G(M,p,y,T,5,x,S,w.b,I.b,1)),x=S,b=A,w=I,g=v}i.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${u.name} (${a.name})`)}}}if(t.bones)for(const o in t.bones){const a=t.bones[o],h=s.findBone(o);if(!h)throw new Error(`Bone not found: ${o}`);const d=h.index;for(const f in a){const u=a[f],m=u.length;if(m!==0)switch(f){case"rotate":ot(i,u,new Dt(m,m,d),0,1);break;case"translate":Es(i,u,new Xe(m,m<<1,d),"x","y",0,n);break;case"translatex":ot(i,u,new Ve(m,m,d),0,n);break;case"translatey":ot(i,u,new Re(m,m,d),0,n);break;case"scale":Es(i,u,new Le(m,m<<1,d),"x","y",1,1);break;case"scalex":ot(i,u,new Be(m,m,d),1,1);break;case"scaley":ot(i,u,new Oe(m,m,d),1,1);break;case"shear":Es(i,u,new Ne(m,m<<1,d),"x","y",0,1);break;case"shearx":ot(i,u,new De(m,m,d),0,1);break;case"sheary":ot(i,u,new Ue(m,m,d),0,1);break;case"inherit":{const p=new $e(m,h.index);for(let g=0;g<u.length;g++){const x=u[g];p.setFrame(g,C(x,"time",0),B.enumValue(ne,C(x,"inherit","Normal")))}i.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${u.name} (${a.name})`)}}}if(t.ik)for(const o in t.ik){const a=t.ik[o];let h=a[0];if(!h)continue;const d=s.findConstraint(o,Wt);if(!d)throw new Error(`IK Constraint not found: ${o}`);const f=new Je(a.length,a.length<<1,s.constraints.indexOf(d));let u=C(h,"time",0),m=C(h,"mix",1),p=C(h,"softness",0)*n;for(let g=0,x=0;;g++){f.setFrame(g,u,m,p,C(h,"bendPositive",!0)?1:-1,C(h,"compress",!1),C(h,"stretch",!1));const b=a[g+1];if(!b){f.shrink(x);break}const w=C(b,"time",0),T=C(b,"mix",1),y=C(b,"softness",0)*n,v=h.curve;v&&(x=G(v,f,x,g,0,u,w,m,T,1),x=G(v,f,x,g,1,u,w,p,y,n)),u=w,m=T,p=y,h=b}i.push(f)}if(t.transform)for(const o in t.transform){const a=t.transform[o];let h=a[0];if(!h)continue;const d=s.findConstraint(o,j);if(!d)throw new Error(`Transform constraint not found: ${o}`);const f=new Ke(a.length,a.length*6,s.constraints.indexOf(d));let u=C(h,"time",0),m=C(h,"mixRotate",1),p=C(h,"mixX",1),g=C(h,"mixY",p),x=C(h,"mixScaleX",1),b=C(h,"mixScaleY",1);const w=C(h,"mixShearY",1);for(let T=0,y=0;;T++){f.setFrame(T,u,m,p,g,x,b,w);const v=a[T+1];if(!v){f.shrink(y);break}const S=C(v,"time",0),A=C(v,"mixRotate",1),I=C(v,"mixX",1),M=C(v,"mixY",I),Y=C(v,"mixScaleX",1),k=C(v,"mixScaleY",1),E=C(v,"mixShearY",1),X=h.curve;X&&(y=G(X,f,y,T,0,u,S,m,A,1),y=G(X,f,y,T,1,u,S,p,I,1),y=G(X,f,y,T,2,u,S,g,M,1),y=G(X,f,y,T,3,u,S,x,Y,1),y=G(X,f,y,T,4,u,S,b,k,1),y=G(X,f,y,T,5,u,S,w,E,1)),u=S,m=A,p=I,g=M,x=Y,b=k,x=Y,h=v}i.push(f)}if(t.path)for(const o in t.path){const a=t.path[o],h=s.findConstraint(o,Ht);if(!h)throw new Error(`Path constraint not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const u=a[f];let m=u[0];if(!m)continue;const p=u.length;switch(f){case"position":{const g=new Qe(p,p,d);ot(i,u,g,0,h.positionMode===0?n:1);break}case"spacing":{const g=new Ze(p,p,d);ot(i,u,g,0,h.spacingMode===0||h.spacingMode===1?n:1);break}case"mix":{const g=new ts(p,p*3,d);let x=C(m,"time",0),b=C(m,"mixRotate",1),w=C(m,"mixX",1),T=C(m,"mixY",w);for(let y=0,v=0;;y++){g.setFrame(y,x,b,w,T);const S=u[y+1];if(!S){g.shrink(v);break}const A=C(S,"time",0),I=C(S,"mixRotate",1),M=C(S,"mixX",1),Y=C(S,"mixY",M),k=m.curve;k&&(v=G(k,g,v,y,0,x,A,b,I,1),v=G(k,g,v,y,1,x,A,w,M,1),v=G(k,g,v,y,2,x,A,T,Y,1)),x=A,b=I,w=M,T=Y,m=S}i.push(g);break}}}}if(t.physics)for(const o in t.physics){const a=t.physics[o];let h=-1;if(o.length>0){const d=s.findConstraint(o,Gt);if(!d)throw new Error(`Physics constraint not found: ${o}`);h=s.constraints.indexOf(d)}for(const d in a){const f=a[d];let u=f[0];if(!u)continue;const m=f.length;let p,g=0;if(d==="reset"){const x=new ls(m,h);for(let b=0;u!=null;u=f[b+1],b++)x.setFrame(b,C(u,"time",0));i.push(x);continue}switch(d){case"inertia":p=new es(m,m,h);break;case"strength":p=new ss(m,m,h);break;case"damping":p=new ns(m,m,h);break;case"mass":p=new is(m,m,h);break;case"wind":p=new rs(m,m,h);break;case"gravity":p=new as(m,m,h);break;case"mix":{g=1,p=new os(m,m,h);break}default:continue}ot(i,f,p,g,1)}}if(t.slider)for(const o in t.slider){const a=t.slider[o],h=s.findConstraint(o,yt);if(!h)throw new Error(`Slider not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const u=a[f];if(!u[0])continue;const p=u.length;switch(f){case"time":ot(i,u,new cs(p,p,d),1,1);break;case"mix":ot(i,u,new hs(p,p,d),1,1);break}}}if(t.attachments)for(const o in t.attachments){const a=t.attachments[o],h=s.findSkin(o);if(!h)throw new Error(`Skin not found: ${o}`);for(const d in a){const f=a[d],u=s.findSlot(d);if(!u)throw new Error(`Attachment slot not found: ${d}`);const m=u.index;for(const p in f){const g=f[p],x=h.getAttachment(m,p);if(!x)throw new Error(`Timeline attachment not found: ${p}`);for(const b in g){const w=g[b];let T=w[0];if(T){if(b==="deform"){const y=x.bones,v=x.vertices,S=y?v.length/3*2:v.length,A=new Ge(w.length,w.length,m,x);let I=C(T,"time",0);for(let M=0,Y=0;;M++){let k;const E=C(T,"vertices",null);if(!E)k=y?B.newFloatArray(S):v;else{k=B.newFloatArray(S);const q=C(T,"offset",0);if(B.arrayCopy(E,0,k,q,E.length),n!==1)for(let O=q,F=O+E.length;O<F;O++)k[O]*=n;if(!y)for(let O=0;O<S;O++)k[O]+=v[O]}A.setFrame(M,I,k);const X=w[M+1];if(!X){A.shrink(Y);break}const V=C(X,"time",0),N=T.curve;N&&(Y=G(N,A,Y,M,0,I,V,0,1,1)),I=V,T=X}i.push(A)}else if(b==="sequence"){const y=new je(w.length,m,x);let v=0;for(let S=0;S<w.length;S++){const A=C(T,"delay",v),I=C(T,"time",0),M=ke[C(T,"mode","hold")],Y=C(T,"index",0);y.setFrame(S,I,M,Y,A),v=A,T=w[S+1]}i.push(y)}}}}}}if(t.drawOrder){const o=new St(t.drawOrder.length),a=s.slots.length;let h=0;for(const d of t.drawOrder)o.setFrame(h++,C(d,"time",0),mn(s,d,a,null));i.push(o)}if(t.drawOrderFolder)for(const o of t.drawOrderFolder){const a=C(o,"slots",[]),h=new Array(a.length);let d=0;for(const p of a){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);h[d++]=g.index}const f=C(o,"keys",[]),u=new $t(f.length,h,s.slots.length);let m=0;for(const p of f)u.setFrame(m++,C(p,"time",0),mn(s,p,h.length,h));i.push(u)}if(t.events){const o=new Zt(t.events.length);let a=0;for(let h=0;h<t.events.length;h++,a++){const d=t.events[h],f=s.findEvent(d.name);if(!f)throw new Error(`Event not found: ${d.name}`);const u=f.setupPose,m=new oe(B.toSinglePrecision(C(d,"time",0)),f);m.intValue=C(d,"int",u.intValue),m.floatValue=C(d,"float",u.floatValue),m.stringValue=C(d,"string",u.stringValue),m.data.audioPath&&(m.volume=C(d,"volume",u.volume),m.balance=C(d,"balance",u.volume)),o.setFrame(a,m)}i.push(o)}let r=0;for(let o=0,a=i.length;o<a;o++)r=Math.max(r,i[o].getDuration());const l=new Kt(e,i,r),c=C(t,"color",null);c!==null&&l.color.setFromString(c),s.animations.push(l)}},Bi=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}};function ot(t,e,s,n,i){let r=e[0],l=r.time??0,c=(r.value??n)*i,o=0;for(let a=0;;a++){s.setFrame(a,l,c);const h=e[a+1];if(!h){s.shrink(o),t.push(s);return}const d=h.time??0,f=(h.value??n)*i;r.curve&&(o=G(r.curve,s,o,a,0,l,d,c,f,i)),l=d,c=f,r=h}}function Es(t,e,s,n,i,r,l){let c=e[0],o=c.time??0,a=(c[n]??r)*l,h=(c[i]??r)*l,d=0;for(let f=0;;f++){s.setFrame(f,o,a,h);const u=e[f+1];if(!u){s.shrink(d),t.push(s);return}const m=u.time??0,p=(u[n]??r)*l,g=(u[i]??r)*l,x=c.curve;x&&(d=G(x,s,d,f,0,o,m,a,p,l),d=G(x,s,d,f,1,o,m,h,g,l)),o=m,a=p,h=g,c=u}}function mn(t,e,s,n){const i=e.offsets;if(!i)return null;const r=new Array(s).fill(-1),l=new Array(s-i.length);let c=0,o=0;for(const a of i){const h=t.findSlot(a.slot);if(h==null)throw new Error(`Draw order slot not found: ${a.slot}`);let d=0;if(!n)d=h.index;else{d=-1;for(let f=0;f<s;f++)if(n[f]===h.index){d=f;break}if(d===-1)throw new Error(`Slot not in folder: ${a.slot}`)}for(;c!==d;)l[o++]=c++;r[c+a.offset]=c++}for(;c<s;)l[o++]=c++;for(let a=s-1;a>=0;a--)r[a]===-1&&(r[a]=l[--o]);return r}function G(t,e,s,n,i,r,l,c,o,a){if(t==="stepped")return e.setStepped(n),s;const h=i<<2,d=t[h],f=t[h+1]*a,u=t[h+2],m=t[h+3]*a;return e.setBezier(s,n,i,r,c,d,f,u,m,l,o),s+1}function C(t,e,s){return t[e]!==void 0?t[e]:s}var Oi=class{commandPool=new Ni;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new un;renderCommands=[];render(t,e=!1,s,n=2){this.commandPool.reset(),this.renderCommands.length=0;const i=this.clipping,r=t.drawOrder.appliedPose;for(let l=0;l<t.slots.length;l++){const c=r[l],o=c.appliedPose.attachment;if(!o){i.clipEnd(c);continue}const a=c.appliedPose,h=a.color;if((h.a===0||!c.bone.active)&&!(o instanceof zt)){i.clipEnd(c);continue}let f,u,m,p,g,x,b;if(o instanceof Pt){if(x=o.color,x.a===0){i.clipEnd(c);continue}const S=o.sequence,A=S.resolveIndex(a);o.computeWorldVertices(c,o.getOffsets(a),this.worldVertices,0,n),f=this.worldVertices,u=4,m=S.getUVs(A),p=this.quadIndices,g=6,b=S.regions[A]?.texture}else if(o instanceof Tt){if(x=o.color,x.a===0){i.clipEnd(c);continue}this.worldVertices.length<o.worldVerticesLength&&(this.worldVertices=new Float32Array(o.worldVerticesLength)),o.computeWorldVertices(t,c,0,o.worldVerticesLength,this.worldVertices,0,n),f=this.worldVertices,u=o.worldVerticesLength>>1;const S=o.sequence,A=S.resolveIndex(a);m=S.getUVs(A),p=o.triangles,g=p.length,b=S.regions[A]?.texture}else if(o instanceof zt){i.clipStart(t,c,o);continue}else continue;const w=t.color;let T,y;if(e){let S;if(s){S=Math.floor(s[3]*w.a*h.a*x.a*255);const A=Math.floor(S*s[0]*w.r*h.r*x.r),I=Math.floor(S*s[1]*w.g*h.g*x.g),M=Math.floor(S*s[2]*w.b*h.b*x.b);T=S<<24|A<<16|I<<8|M}else{S=Math.floor(w.a*h.a*x.a*255);const A=Math.floor(S*w.r*h.r*x.r),I=Math.floor(S*w.g*h.g*x.g),M=Math.floor(S*w.b*h.b*x.b);T=S<<24|A<<16|I<<8|M}if(y=4278190080,a.darkColor){const{r:A,g:I,b:M}=a.darkColor;y=4278190080|Math.floor(A*S)<<16|Math.floor(I*S)<<8|Math.floor(M*S)}}else{if(s){const S=Math.floor(s[3]*w.a*h.a*x.a*255),A=Math.floor(s[0]*w.r*h.r*x.r*255),I=Math.floor(s[1]*w.g*h.g*x.g*255),M=Math.floor(s[2]*w.b*h.b*x.b*255);T=S<<24|A<<16|I<<8|M}else{const S=Math.floor(w.a*h.a*x.a*255),A=Math.floor(w.r*h.r*x.r*255),I=Math.floor(w.g*h.g*x.g*255),M=Math.floor(w.b*h.b*x.b*255);T=S<<24|A<<16|I<<8|M}if(y=0,a.darkColor){const{r:S,g:A,b:I}=a.darkColor;y=Math.floor(S*255)<<16|Math.floor(A*255)<<8|Math.floor(I*255)}}i.isClipping()&&(i.clipTrianglesUnpacked(f,0,p,g,m,n),f=i.clippedVerticesTyped,u=i.clippedVerticesLength/n,m=i.clippedUVsTyped,p=i.clippedTrianglesTyped,g=i.clippedTrianglesLength);const v=this.commandPool.getCommand(u,g,n);v.blendMode=c.data.blendMode,v.texture=b,v.positions.set(f.subarray(0,u*n)),v.uvs.set(m.subarray(0,u<<1));for(let S=0;S<u;S++)v.colors[S]=T,v.darkColors[S]=y;p instanceof Uint16Array?v.indices.set(p.subarray(0,g)):v.indices.set(p.slice(0,g)),this.renderCommands.push(v),i.clipEnd(c)}return i.clipEnd(),this.batchCommands(n)}batchSubCommands(t,e,s,n,i,r){const l=t[e],c=this.commandPool.getCommand(n,i,r);c.blendMode=l.blendMode,c.texture=l.texture;let o=0,a=0,h=0,d=0,f=0;for(let u=e;u<=s;u++){const m=t[u];c.positions.set(m.positions,o),o+=m.numVertices*r,c.uvs.set(m.uvs,a),a+=m.numVertices<<1,c.colors.set(m.colors,h),c.darkColors.set(m.darkColors,h),h+=m.numVertices;for(let p=0;p<m.numIndices;p++)c.indices[d+p]=m.indices[p]+f;d+=m.numIndices,f+=m.numVertices}return c}batchCommands(t){if(this.renderCommands.length===0)return;let e,s,n=this.renderCommands[0],i=0,r=1,l=n.numVertices,c=n.numIndices;for(;r<=this.renderCommands.length;){const o=r<this.renderCommands.length?this.renderCommands[r]:null;if(o&&o.numVertices===0&&o.numIndices===0){r++;continue}if(o!==null&&o.texture===n.texture&&o.blendMode===n.blendMode&&o.colors[0]===n.colors[0]&&o.darkColors[0]===n.darkColors[0]&&c+o.numIndices<65535)l+=o.numVertices,c+=o.numIndices;else{const h=this.batchSubCommands(this.renderCommands,i,r-1,l,c,t);if(s?(s.next=h,s=h):e=s=h,r===this.renderCommands.length)break;n=this.renderCommands[r],i=r,l=n.numVertices,c=n.numIndices}r++}return e}},Ni=class{pool=[];inUse=[];getCommand(t,e,s){let n;for(const i of this.pool)if(i._positions.length>=t*s&&i._indices.length>=e){n=i;break}if(n)this.pool.splice(this.pool.indexOf(n),1),n.next=void 0,n.numVertices=t,n.numIndices=e,n.positions=n._positions.subarray(0,t*s),n.uvs=n._uvs.subarray(0,t<<1),n.colors=n._colors.subarray(0,t),n.darkColors=n._darkColors.subarray(0,t),n.indices=n._indices.subarray(0,e);else{const i=new Float32Array(t*s),r=new Float32Array(t<<1),l=new Uint32Array(t),c=new Uint32Array(t),o=new Uint16Array(e);n={positions:i,uvs:r,colors:l,darkColors:c,indices:o,_positions:i,_uvs:r,_colors:l,_darkColors:c,_indices:o,numVertices:t,numIndices:e,blendMode:0,texture:null}}return this.inUse.push(n),n}reset(){this.pool.push(...this.inUse),this.inUse.length=0}};return Rn(Bs)})();
|
|
1
|
+
"use strict";var spine=(()=>{var Ie=Object.defineProperty,Fn=Object.getOwnPropertyDescriptor,kn=Object.getOwnPropertyNames,En=Object.prototype.hasOwnProperty,Xn=(t,e)=>{for(var s in e)Ie(t,s,{get:e[s],enumerable:!0})},Vn=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of kn(e))!En.call(t,i)&&i!==s&&Ie(t,i,{get:()=>e[i],enumerable:!(n=Fn(e,i))||n.enumerable});return t},Rn=t=>Vn(Ie({},"__esModule",{value:!0}),t),Bs={};Xn(Bs,{AlphaTimeline:()=>ze,Animation:()=>Kt,AnimationState:()=>_n,AnimationStateAdapter:()=>qn,AnimationStateData:()=>zn,AssetCache:()=>Ks,AssetManagerBase:()=>Wn,AtlasAttachmentLoader:()=>Hn,Attachment:()=>Fe,AttachmentTimeline:()=>Ft,BinaryInput:()=>cn,BlendMode:()=>Is,Bone:()=>re,BoneData:()=>ms,BonePose:()=>ie,BoneTimeline1:()=>wt,BoneTimeline2:()=>Qt,BoundingBoxAttachment:()=>us,ClippingAttachment:()=>zt,Color:()=>z,Constraint:()=>Et,ConstraintData:()=>Xt,ConstraintTimeline1:()=>kt,CurveTimeline:()=>bt,CurveTimeline1:()=>Nt,DebugUtils:()=>On,DeformTimeline:()=>Ge,Downloader:()=>Qs,DrawOrder:()=>tn,DrawOrderFolderTimeline:()=>$t,DrawOrderTimeline:()=>St,Event:()=>oe,EventData:()=>xs,EventQueue:()=>Gs,EventTimeline:()=>Zt,EventType:()=>js,FIRST:()=>_t,FakeTexture:()=>Un,FromProperty:()=>At,FromRotate:()=>ge,FromScaleX:()=>be,FromScaleY:()=>we,FromShearY:()=>ye,FromX:()=>pe,FromY:()=>xe,HOLD:()=>qt,HOLD_FIRST:()=>Js,IkConstraint:()=>en,IkConstraintData:()=>Wt,IkConstraintPose:()=>le,IkConstraintTimeline:()=>Je,Inherit:()=>ne,InheritTimeline:()=>$e,IntSet:()=>Ln,Interpolation:()=>Lt,MathUtils:()=>R,MeshAttachment:()=>Tt,PathAttachment:()=>ee,PathConstraint:()=>sn,PathConstraintData:()=>Ht,PathConstraintMixTimeline:()=>ts,PathConstraintPose:()=>ce,PathConstraintPositionTimeline:()=>Qe,PathConstraintSpacingTimeline:()=>Ze,Physics:()=>nn,PhysicsConstraint:()=>vs,PhysicsConstraintDampingTimeline:()=>ns,PhysicsConstraintData:()=>Gt,PhysicsConstraintGravityTimeline:()=>as,PhysicsConstraintInertiaTimeline:()=>es,PhysicsConstraintMassTimeline:()=>is,PhysicsConstraintMixTimeline:()=>os,PhysicsConstraintPose:()=>he,PhysicsConstraintResetTimeline:()=>ls,PhysicsConstraintStrengthTimeline:()=>ss,PhysicsConstraintTimeline:()=>gt,PhysicsConstraintWindTimeline:()=>rs,PointAttachment:()=>Zs,Pool:()=>Bt,Posed:()=>gs,PosedActive:()=>ps,PosedData:()=>se,PositionMode:()=>bs,Pow:()=>Os,PowOut:()=>Bn,Property:()=>_s,RETAIN:()=>fs,RGB2Timeline:()=>He,RGBA2Timeline:()=>We,RGBATimeline:()=>_e,RGBTimeline:()=>qe,RegionAttachment:()=>Pt,RotateMode:()=>ys,RotateTimeline:()=>Dt,SETUP:()=>ds,SUBSEQUENT:()=>te,ScaleTimeline:()=>Le,ScaleXTimeline:()=>Be,ScaleYMode:()=>ae,ScaleYTimeline:()=>Oe,Sequence:()=>Ot,SequenceMode:()=>ke,SequenceModeValues:()=>Ee,SequenceTimeline:()=>je,ShearTimeline:()=>Ne,ShearXTimeline:()=>De,ShearYTimeline:()=>Ue,Skeleton:()=>an,SkeletonBinary:()=>Gn,SkeletonBounds:()=>Ri,SkeletonClipping:()=>un,SkeletonData:()=>Ts,SkeletonJson:()=>Li,SkeletonRendererCore:()=>Oi,Skin:()=>ue,SkinEntry:()=>Ss,Slider:()=>on,SliderData:()=>yt,SliderMixTimeline:()=>hs,SliderPose:()=>fe,SliderTimeline:()=>cs,Slot:()=>rn,SlotCurveTimeline:()=>Ut,SlotData:()=>As,SlotPose:()=>de,SpacingMode:()=>ws,StringSet:()=>Ce,Texture:()=>Ns,TextureAtlas:()=>Ye,TextureAtlasPage:()=>$s,TextureAtlasRegion:()=>Pe,TextureFilter:()=>Jt,TextureRegion:()=>Us,TextureWrap:()=>Ds,TimeKeeper:()=>Nn,Timeline:()=>Q,ToProperty:()=>It,ToRotate:()=>Cs,ToScaleX:()=>Ps,ToScaleY:()=>Fs,ToShearY:()=>ks,ToX:()=>Ms,ToY:()=>Ys,TrackEntry:()=>Hs,TransformConstraint:()=>ln,TransformConstraintData:()=>j,TransformConstraintPose:()=>me,TransformConstraintTimeline:()=>Ke,TranslateTimeline:()=>Xe,TranslateXTimeline:()=>Ve,TranslateYTimeline:()=>Re,Triangulator:()=>fn,Utils:()=>B,Vector2:()=>Me,VertexAttachment:()=>xt,WindowedMean:()=>Dn,isBoneTimeline:()=>zs,isConstraintTimeline:()=>Ws,isSlotTimeline:()=>qs});var Ln=class{array=[];add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!==void 0}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}},Ce=class{entries={};size=0;add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,n=t.length;s<n;s++)this.add(t[s]);return e!==this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},z=class Ct{constructor(e=0,s=0,n=0,i=0){this.r=e,this.g=s,this.b=n,this.a=i}static WHITE=new Ct(1,1,1,1);static RED=new Ct(1,0,0,1);static GREEN=new Ct(0,1,0,1);static BLUE=new Ct(0,0,1,1);static MAGENTA=new Ct(1,0,1,1);set(e,s,n,i){return this.r=e,this.g=s,this.b=n,this.a=i,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)==="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!==8?1:parseInt(e.substr(6,2),16)/255,this}add(e,s,n,i){return this.r+=e,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(e,s){e.r=((s&4278190080)>>>24)/255,e.g=((s&16711680)>>>16)/255,e.b=((s&65280)>>>8)/255,e.a=(s&255)/255}static rgb888ToColor(e,s){e.r=((s&16711680)>>>16)/255,e.g=((s&65280)>>>8)/255,e.b=(s&255)/255}toRgb888(){const e=s=>`0${(s*255).toString(16)}`.slice(-2);return+`0x${e(this.r)}${e(this.g)}${e(this.b)}`}static fromString(e,s=new Ct){return s.setFromString(e)}},R=class lt{static epsilon=1e-5;static epsilon2=lt.epsilon*lt.epsilon;static PI=3.1415927;static PI2=lt.PI*2;static invPI2=1/lt.PI2;static radiansToDegrees=180/lt.PI;static radDeg=lt.radiansToDegrees;static degreesToRadians=lt.PI/180;static degRad=lt.degreesToRadians;static clamp(e,s,n){return e<s?s:e>n?n:e}static cosDeg(e){return Math.cos(e*lt.degRad)}static sinDeg(e){return Math.sin(e*lt.degRad)}static atan2Deg(e,s){return Math.atan2(e,s)*lt.radDeg}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){const s=Math.pow(Math.abs(e),.3333333333333333);return e<0?-s:s}static randomTriangular(e,s){return lt.randomTriangularWith(e,s,(e+s)*.5)}static randomTriangularWith(e,s,n){const i=Math.random(),r=s-e;return i<=(n-e)/r?e+Math.sqrt(i*r*(n-e)):s-Math.sqrt((1-i)*r*(s-n))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},Lt=class Vt{static linear=new class extends Vt{applyInternal(e){return e}};static smooth=new class extends Vt{applyInternal(e){return e*e*(3-2*e)}};static slowFast=new class extends Vt{applyInternal(e){return e*e}};static fastSlow=new class extends Vt{applyInternal(e){return(e-1)*(e-1)*-1+1}};static circle=new class extends Vt{applyInternal(e){return e<=.5?(e*=2,(1-Math.sqrt(1-e*e))/2):(e--,e*=2,(Math.sqrt(1-e*e)+1)/2)}};apply(e,s,n){return s===void 0||n===void 0?this.applyInternal(e):e+(s-e)*this.applyInternal(n)}},Os=class extends Lt{power=2;constructor(t){super(),this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2===0?-2:2)+1}},Bn=class extends Os{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2===0?-1:1)+1}},B=class Rt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(e,s,n,i,r){for(let l=s,c=i;l<s+r;l++,c++)n[c]=e[l]}static arrayFill(e,s,n,i){for(let r=s;r<n;r++)e[r]=i}static setArraySize(e,s,n=0){const i=e.length;if(i===s)return e;if(e.length=s,i<s)for(let r=i;r<s;r++)e[r]=n;return e}static ensureArrayCapacity(e,s,n=0){return e.length>=s?e:Rt.setArraySize(e,s,n)}static newArray(e,s){const n=[];for(let i=0;i<e;i++)n[i]=s;return n}static newFloatArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static newShortArray(e){if(Rt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static toFloatArray(e){return Rt.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Rt.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e){}static contains(e,s,n=!0){for(let i=0;i<e.length;i++)if(e[i]===s)return!0;return!1}static enumValue(e,s){return e[s[0].toUpperCase()+s.slice(1)]}},On=class{static logBones(t){for(let e=0;e<t.bones.length;e++){const s=t.bones[e].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},Bt=class{items=[];instantiator;constructor(t){this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset?.(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},Me=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!==0&&(this.x/=t,this.y/=t),this}},Nn=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Dn=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(t=32){this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}},Ns=class{_image;constructor(t){this._image=t}getImage(){return this._image}},Jt=(t=>(t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear",t))(Jt||{}),Ds=(t=>(t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat",t))(Ds||{}),Us=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},Un=class extends Ns{setFilters(t,e){}setWraps(t,e){}dispose(){}},Ye=class{pages=[];regions=[];constructor(t){const e=new $n(t),s=new Array(4),n={};n.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},n.format=()=>{},n.filter=a=>{a.minFilter=B.enumValue(Jt,s[1]),a.magFilter=B.enumValue(Jt,s[2])},n.repeat=a=>{s[1].indexOf("x")!==-1&&(a.uWrap=10497),s[1].indexOf("y")!==-1&&(a.vWrap=10497)},n.pma=a=>{a.pma=s[1]==="true"};var i={};i.xy=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2])},i.size=a=>{a.width=parseInt(s[1]),a.height=parseInt(s[2])},i.bounds=a=>{a.x=parseInt(s[1]),a.y=parseInt(s[2]),a.width=parseInt(s[3]),a.height=parseInt(s[4])},i.offset=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2])},i.orig=a=>{a.originalWidth=parseInt(s[1]),a.originalHeight=parseInt(s[2])},i.offsets=a=>{a.offsetX=parseInt(s[1]),a.offsetY=parseInt(s[2]),a.originalWidth=parseInt(s[3]),a.originalHeight=parseInt(s[4])},i.rotate=a=>{const h=s[1];h==="true"?a.degrees=90:h!=="false"&&(a.degrees=parseInt(h))},i.index=a=>{a.index=parseInt(s[1])};let r=e.readLine();for(;r&&r.trim().length===0;)r=e.readLine();for(;!(!r||r.trim().length===0||e.readEntry(s,r)===0);)r=e.readLine();let l=null,c=null,o=null;for(;r!==null;)if(r.trim().length===0)l=null,r=e.readLine();else if(l){const a=new Pe(l,r);for(;;){const h=e.readEntry(s,r=e.readLine());if(h===0)break;const d=i[s[0]];if(d)d(a);else{c||(c=[]),o||(o=[]),c.push(s[0]);const f=[];for(let u=0;u<h;u++)f.push(parseInt(s[u+1]));o.push(f)}}a.originalWidth===0&&a.originalHeight===0&&(a.originalWidth=a.width,a.originalHeight=a.height),c&&c.length>0&&o&&o.length>0&&(a.names=c,a.values=o,c=null,o=null),a.u=a.x/l.width,a.v=a.y/l.height,a.degrees===90?(a.u2=(a.x+a.height)/l.width,a.v2=(a.y+a.width)/l.height):(a.u2=(a.x+a.width)/l.width,a.v2=(a.y+a.height)/l.height),this.regions.push(a)}else{for(l=new $s(r.trim());e.readEntry(s,r=e.readLine())!==0;){const a=n[s[0]];a&&a(l)}this.pages.push(l)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name===t)return this.regions[e];return null}setTextures(t,e=""){for(const s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].texture?.dispose()}},$n=class{lines;index=0;constructor(t){this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e||(e=e.trim(),e.length===0))return 0;const s=e.indexOf(":");if(s===-1)return 0;t[0]=e.substr(0,s).trim();for(let n=1,i=s+1;;n++){const r=e.indexOf(",",i);if(r===-1)return t[n]=e.substr(i).trim(),n;if(t[n]=e.substr(i,r-i).trim(),i=r+1,n===4)return 4}}},$s=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(t){this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(const e of this.regions)e.texture=t}},Pe=class extends Us{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(t,e){super(),this.page=t,this.name=e,t.regions.push(this)}},Fe=class gn{static empty=[];name;timelineAttachment;timelineSlots=gn.empty;constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e,this.timelineAttachment=this}isTimelineActive(e,s,n){let i=e[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,l=this.timelineSlots.length;r<l;r++){if(i=e[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}},xt=class pn extends Fe{static nextID=0;id=pn.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(e){super(e)}computeWorldVertices(e,s,n,i,r,l,c){i=l+(i>>1)*c;const o=s.appliedPose.deform;let a=this.vertices;const h=this.bones;if(!h){o.length>0&&(a=o);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=l;v<i;y+=2,v+=c){const S=a[y],A=a[y+1];r[v]=S*x+A*b+p,r[v+1]=S*w+A*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=e.bones;if(o.length===0)for(let m=l,p=f*3;m<i;m+=c){let g=0,x=0,b=h[d++];for(b+=d;d<b;d++,p+=3){const w=u[h[d]].appliedPose,T=a[p],y=a[p+1],v=a[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=o;for(let p=l,g=f*3,x=f<<1;p<i;p+=c){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=a[g]+m[x],S=a[g+1]+m[x+1],A=a[g+2];b+=(v*y.a+S*y.b+y.worldX)*A,w+=(v*y.c+S*y.d+y.worldY)*A}r[p]=b,r[p+1]=w}}}copyTo(e){this.bones?(e.bones=[],B.arrayCopy(this.bones,0,e.bones,0,this.bones.length)):e.bones=null,this.vertices&&(e.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,e.vertices,0,this.vertices.length)),e.worldVerticesLength=this.worldVerticesLength,e.timelineAttachment=this.timelineAttachment,e.timelineSlots=this.timelineSlots}},Tt=class Xs extends xt{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(e,s){super(e),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const e=new Xs(this.name,this.sequence.copy());return e.path=this.path,e.color.setFromColor(this.color),this.copyTo(e),e.regionUVs=[],B.arrayCopy(this.regionUVs,0,e.regionUVs,0,this.regionUVs.length),e.triangles=[],B.arrayCopy(this.triangles,0,e.triangles,0,this.triangles.length),e.hullLength=this.hullLength,this.edges&&(e.edges=[],B.arrayCopy(this.edges,0,e.edges,0,this.edges.length)),e.width=this.width,e.height=this.height,e}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(e){this.sourceMesh=e,e&&(this.bones=e.bones,this.vertices=e.vertices,this.worldVerticesLength=e.worldVerticesLength,this.regionUVs=e.regionUVs,this.triangles=e.triangles,this.hullLength=e.hullLength,this.worldVerticesLength=e.worldVerticesLength,this.edges=e.edges,this.width=e.width,this.height=e.height)}newLinkedMesh(){const e=new Xs(this.name,this.sequence.copy());return e.timelineAttachment=this.timelineAttachment,e.path=this.path,e.color.setFromColor(this.color),e.setSourceMesh(this.sourceMesh?this.sourceMesh:this),e.updateSequence(),e}static computeUVs(e,s,n){if(!e)throw new Error("Region not set.");const i=n.length;let r=e.u,l=e.v,c=0,o=0;if(e instanceof Pe){const a=e.page,h=a.width,d=a.height;switch(e.degrees){case 90:r-=(e.originalHeight-e.offsetY-e.height)/h,l-=(e.originalWidth-e.offsetX-e.width)/d,c=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+s[f+1]*c,n[f+1]=l+(1-s[f])*o;return;case 180:r-=(e.originalWidth-e.offsetX-e.width)/h,l-=e.offsetY/d,c=e.originalWidth/h,o=e.originalHeight/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f])*c,n[f+1]=l+(1-s[f+1])*o;return;case 270:r-=e.offsetY/h,l-=e.offsetX/d,c=e.originalHeight/h,o=e.originalWidth/d;for(let f=0;f<i;f+=2)n[f]=r+(1-s[f+1])*c,n[f+1]=l+s[f]*o;return;default:r-=e.offsetX/h,l-=(e.originalHeight-e.offsetY-e.height)/d,c=e.originalWidth/h,o=e.originalHeight/d}}else e?(c=e.u2-r,o=e.v2-l):(r=l=0,c=o=1);for(let a=0;a<i;a+=2)n[a]=r+s[a]*c,n[a+1]=l+s[a+1]*o}},Pt=class xn extends Fe{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(e,s){super(e),this.sequence=s}copy(){const e=new xn(this.name,this.sequence.copy());return e.path=this.path,e.x=this.x,e.y=this.y,e.scaleX=this.scaleX,e.scaleY=this.scaleY,e.rotation=this.rotation,e.width=this.width,e.height=this.height,e.color.setFromColor(this.color),e}computeWorldVertices(e,s,n,i,r){const l=e.bone.appliedPose,c=l.worldX,o=l.worldY,a=l.a,h=l.b,d=l.c,f=l.d;let u=s[0],m=s[1];n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[2],m=s[3],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[4],m=s[5],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o,i+=r,u=s[6],m=s[7],n[i]=u*a+m*h+c,n[i+1]=u*d+m*f+o}getOffsets(e){return this.sequence.offsets[this.sequence.resolveIndex(e)]}updateSequence(){this.sequence.update(this)}static computeUVs(e,s,n,i,r,l,c,o,a,h){if(!e)throw new Error("Region not set.");const d=c/e.originalWidth*i,f=o/e.originalHeight*r,u=-c/2*i+e.offsetX*d,m=-o/2*r+e.offsetY*f,p=u+e.width*d,g=m+e.height*f,x=l*R.degRad,b=Math.cos(x),w=Math.sin(x),T=u*b+s,y=u*w,v=m*b+n,S=m*w,A=p*b+s,I=p*w,M=g*b+n,Y=g*w;a[0]=T-S,a[1]=v+y,a[2]=T-Y,a[3]=M+y,a[4]=A-Y,a[5]=M+I,a[6]=A-S,a[7]=v+I,e==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]=e.v2,h[2]=e.u,h[5]=e.v,h[6]=e.u2,e.degrees===90?(h[0]=e.u2,h[3]=e.v2,h[4]=e.u,h[7]=e.v):(h[0]=e.u,h[3]=e.v,h[4]=e.u2,h[7]=e.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},Ot=class Te{static _nextID=0;id=Te.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(e,s){this.regions=new Array(e),this.pathSuffix=s}copy(){const e=this.regions.length,s=new Te(e,this.pathSuffix);if(B.arrayCopy(this.regions,0,s.regions,0,e),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<e;i++)s.uvs[i]=B.newFloatArray(n),B.arrayCopy(this.uvs[i],0,s.uvs[i],0,n)}if(this.offsets!=null){s.offsets=[];for(let n=0;n<e;n++)s.offsets[n]=[],B.arrayCopy(this.offsets[n],0,s.offsets[n],0,8)}return s}update(e){const s=this.regions.length;if(e instanceof Pt){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=B.newFloatArray(8),this.offsets[n]=[],Pt.computeUVs(this.regions[n],e.x,e.y,e.scaleX,e.scaleY,e.rotation,e.width,e.height,this.offsets[n],this.uvs[n])}else if(e instanceof Tt){const n=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=B.newFloatArray(n.length),Tt.computeUVs(this.regions[i],n,this.uvs[i])}}resolveIndex(e){let s=e.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(e){return this.uvs[e]}hasPathSuffix(){return this.pathSuffix}getPath(e,s){if(!this.pathSuffix)return e;let n=e;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 Te._nextID++}},ke=(t=>(t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse",t))(ke||{}),Ee=[0,1,2,3,4,5,6],Kt=class{name;timelines=[];timelineIds;bones;color=new z(1,1,1,1);duration;constructor(t,e,s){if(!t)throw new Error("name cannot be null.");this.name=t,this.duration=s,this.timelineIds=new Ce,this.bones=[],this.setTimelines(e)}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t;const e=t.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,n=t;for(let i=0;i<e;i++){const r=n[i];this.timelineIds.addAll(r.propertyIds),zs(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,n,i,r,l,c,o,a){if(!t)throw new Error("skeleton cannot be null.");n&&this.duration!==0&&(s%=this.duration,e>0&&(e%=this.duration));const h=this.timelines;for(let d=0,f=h.length;d<f;d++)h[d].apply(t,e,s,i,r,l,c,o,a)}},_s=(t=>(t[t.rotate=0]="rotate",t[t.x=1]="x",t[t.y=2]="y",t[t.scaleX=3]="scaleX",t[t.scaleY=4]="scaleY",t[t.shearX=5]="shearX",t[t.shearY=6]="shearY",t[t.inherit=7]="inherit",t[t.rgb=8]="rgb",t[t.alpha=9]="alpha",t[t.rgb2=10]="rgb2",t[t.attachment=11]="attachment",t[t.deform=12]="deform",t[t.event=13]="event",t[t.drawOrder=14]="drawOrder",t[t.ikConstraint=15]="ikConstraint",t[t.transformConstraint=16]="transformConstraint",t[t.pathConstraintPosition=17]="pathConstraintPosition",t[t.pathConstraintSpacing=18]="pathConstraintSpacing",t[t.pathConstraintMix=19]="pathConstraintMix",t[t.physicsConstraintInertia=20]="physicsConstraintInertia",t[t.physicsConstraintStrength=21]="physicsConstraintStrength",t[t.physicsConstraintDamping=22]="physicsConstraintDamping",t[t.physicsConstraintMass=23]="physicsConstraintMass",t[t.physicsConstraintWind=24]="physicsConstraintWind",t[t.physicsConstraintGravity=25]="physicsConstraintGravity",t[t.physicsConstraintMix=26]="physicsConstraintMix",t[t.physicsConstraintReset=27]="physicsConstraintReset",t[t.sequence=28]="sequence",t[t.sliderTime=29]="sliderTime",t[t.sliderMix=30]="sliderMix",t))(_s||{}),Q=class{propertyIds;frames;additive=!1;instant=!1;constructor(t,...e){this.propertyIds=e,this.frames=B.newFloatArray(t*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(t,e,s=1){const n=t.length;for(let i=s;i<n;i+=s)if(t[i]>e)return i-s;return n-s}};function qs(t){return typeof t=="object"&&t!==null&&typeof t.slotIndex=="number"}var bt=class extends Q{curves;constructor(t,e,...s){super(t,...s),this.curves=B.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=B.newFloatArray(e);B.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,n,i,r,l,c,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const u=(n-r*2+c)*.03,m=(i-l*2+o)*.03,p=((r-c)*3-n+a)*.006,g=((l-o)*3-i+h)*.006;let x=u*2+p,b=m*2+g,w=(r-n)*.3+u+p*.16666667,T=(l-i)*.3+m+g*.16666667,y=n+w,v=i+T;for(let S=f+18;f<S;f+=2)d[f]=y,d[f+1]=v,w+=x,T+=b,x+=p,b+=g,y+=w,v+=T}getBezierValue(t,e,s,n){const i=this.curves;if(i[n]>t){const o=this.frames[e],a=this.frames[e+s];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=t){const o=i[n-2],a=i[n-1];return a+(t-o)/(i[n]-o)*(i[n+1]-a)}e+=this.getFrameEntries();const l=i[r-2],c=i[r-1];return c+(t-l)/(this.frames[e]-l)*(this.frames[e+s]-c)}},Nt=class extends bt{constructor(t,e,s){super(t,e,s)}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}const n=this.curves[s>>1];switch(n){case 0:{const i=e[s],r=e[s+1];return r+(t-i)/(e[s+2]-i)*(e[s+2+1]-r)}case 1:return e[s+1]}return this.getBezierValue(t,s,1,n-2)}getRelativeValue(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const l=this.getCurveValue(t);return s?r+l*e:i+(n?l:l+r-i)*e}getAbsoluteValue(t,e,s,n,i,r,l){return l===void 0?this.getAbsoluteValue1(t,e,s,n,i,r):this.getAbsoluteValue2(t,e,s,n,i,r,l)}getAbsoluteValue1(t,e,s,n,i,r){if(t<this.frames[0])return s?r:i;const l=this.getCurveValue(t);return s?r+(n?l:l-r)*e:i+(n?l:l-i)*e}getAbsoluteValue2(t,e,s,n,i,r,l){return t<this.frames[0]?s?r:i:s?r+(n?l:l-r)*e:i+(n?l:l-i)*e}getScaleValue(t,e,s,n,i,r,l){if(t<this.frames[0])return s?l:r;const c=this.getCurveValue(t)*l;if(e===1&&!n)return c;let o=s?l:r;return n?o+(c-l)*e:i?o+(Math.abs(c)*Math.sign(o)-o)*e:(o=Math.abs(o)*Math.sign(c),o+(c-o)*e)}};function zs(t){return typeof t=="object"&&t!==null&&typeof t.boneIndex=="number"}var wt=class extends Nt{boneIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,l,c)}},Qt=class extends bt{boneIndex;constructor(t,e,s,n,i){super(t,e,`${n}|${s}`,`${i}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(t,e,s,n){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];a.active&&this.apply1(o?a.appliedPose:a.pose,a.data.setupPose,s,i,r,l,c)}},Dt=class extends wt{constructor(t,e,s){super(t,e,s,0)}apply1(t,e,s,n,i,r,l){t.rotation=this.getRelativeValue(s,n,i,r,t.rotation,e.rotation)}},Xe=class extends Qt{constructor(t,e,s){super(t,e,s,1,2)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.x=e.x,t.y=e.y);return}let o=0,a=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.x=e.x+o*n,t.y=e.y+a*n):r?(t.x+=o*n,t.y+=a*n):(t.x+=(e.x+o-t.x)*n,t.y+=(e.y+a-t.y)*n)}},Ve=class extends wt{constructor(t,e,s){super(t,e,s,1)}apply1(t,e,s,n,i,r,l){t.x=this.getRelativeValue(s,n,i,r,t.x,e.x)}},Re=class extends wt{constructor(t,e,s){super(t,e,s,2)}apply1(t,e,s,n,i,r,l){t.y=this.getRelativeValue(s,n,i,r,t.y,e.y)}},Le=class extends Qt{constructor(t,e,s){super(t,e,s,3,4)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.scaleX=e.scaleX,t.scaleY=e.scaleY);return}let o,a;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}if(o*=e.scaleX,a*=e.scaleY,n===1&&!r)t.scaleX=o,t.scaleY=a;else{let f=0,u=0;i?(f=e.scaleX,u=e.scaleY):(f=t.scaleX,u=t.scaleY),r?(t.scaleX=f+(o-e.scaleX)*n,t.scaleY=u+(a-e.scaleY)*n):l?(t.scaleX=f+(Math.abs(o)*Math.sign(f)-f)*n,t.scaleY=u+(Math.abs(a)*Math.sign(u)-u)*n):(f=Math.abs(f)*Math.sign(o),u=Math.abs(u)*Math.sign(a),t.scaleX=f+(o-f)*n,t.scaleY=u+(a-u)*n)}}},Be=class extends wt{constructor(t,e,s){super(t,e,s,3)}apply1(t,e,s,n,i,r,l){t.scaleX=this.getScaleValue(s,n,i,r,l,t.scaleX,e.scaleX)}},Oe=class extends wt{constructor(t,e,s){super(t,e,s,4)}apply1(t,e,s,n,i,r,l){t.scaleY=this.getScaleValue(s,n,i,r,l,t.scaleY,e.scaleY)}},Ne=class extends Qt{constructor(t,e,s){super(t,e,s,5,6)}apply1(t,e,s,n,i,r,l){const c=this.frames;if(s<c[0]){i&&(t.shearX=e.shearX,t.shearY=e.shearY);return}let o=0,a=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const f=c[h];o=c[h+1],a=c[h+2];const u=(s-f)/(c[h+3]-f);o+=(c[h+3+1]-o)*u,a+=(c[h+3+2]-a)*u;break}case 1:o=c[h+1],a=c[h+2];break;default:o=this.getBezierValue(s,h,1,d-2),a=this.getBezierValue(s,h,2,d+18-2)}i?(t.shearX=e.shearX+o*n,t.shearY=e.shearY+a*n):r?(t.shearX+=o*n,t.shearY+=a*n):(t.shearX+=(e.shearX+o-t.shearX)*n,t.shearY+=(e.shearY+a-t.shearY)*n)}},De=class extends wt{constructor(t,e,s){super(t,e,s,5)}apply1(t,e,s,n,i,r,l){t.shearX=this.getRelativeValue(s,n,i,r,t.shearX,e.shearX)}},Ue=class extends wt{constructor(t,e,s){super(t,e,s,6)}apply1(t,e,s,n,i,r,l){t.shearY=this.getRelativeValue(s,n,i,r,t.shearY,e.shearY)}},$e=class extends Q{boneIndex;constructor(t,e){super(t,`7|${e}`),this.boneIndex=e,this.instant=!0}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,n,i,r,l,c,o){const a=t.bones[this.boneIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose;if(c)r&&(h.inherit=a.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r&&(h.inherit=a.data.setupPose.inherit):h.inherit=this.frames[Q.search(d,s,2)+1]}}},Ut=class extends bt{slotIndex;constructor(t,e,s,...n){super(t,e,...n),this.slotIndex=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];a.bone.active&&this.apply1(a,o?a.appliedPose:a.pose,s,i,r,l)}},_e=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(t,e,s,n,i,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r}apply1(t,e,s,n,i,r){const l=e.color,c=this.frames;if(s<c[0]){i&&l.setFromColor(t.data.setupPose.color);return}let o=0,a=0,h=0,d=0;const f=Q.search(c,s,5),u=this.curves[f/5];switch(u){case 0:{const m=c[f];o=c[f+1],a=c[f+2],h=c[f+3],d=c[f+4];const p=(s-m)/(c[f+5]-m);o+=(c[f+5+1]-o)*p,a+=(c[f+5+2]-a)*p,h+=(c[f+5+3]-h)*p,d+=(c[f+5+4]-d)*p;break}case 1:o=c[f+1],a=c[f+2],h=c[f+3],d=c[f+4];break;default:o=this.getBezierValue(s,f,1,u-2),a=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)l.set(o,a,h,d);else if(i){const m=t.data.setupPose.color;l.set(m.r+(o-m.r)*n,m.g+(a-m.g)*n,m.b+(h-m.b)*n,m.a+(d-m.a)*n)}else l.add((o-l.r)*n,(a-l.g)*n,(h-l.b)*n,(d-l.a)*n)}},qe=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`)}getFrameEntries(){return 4}setFrame(t,e,s,n,i){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i}apply1(t,e,s,n,i,r){const l=e.color;let c=0,o=0,a=0;const h=this.frames;if(s<h[0]){if(i){const u=t.data.setupPose.color;l.r=u.r,l.g=u.g,l.b=u.b}return}const d=Q.search(h,s,4),f=this.curves[d>>2];switch(f){case 0:{const u=h[d];c=h[d+1],o=h[d+2],a=h[d+3];const m=(s-u)/(h[d+4]-u);c+=(h[d+4+1]-c)*m,o+=(h[d+4+2]-o)*m,a+=(h[d+4+3]-a)*m;break}case 1:c=h[d+1],o=h[d+2],a=h[d+3];break;default:c=this.getBezierValue(s,d,1,f-2),o=this.getBezierValue(s,d,2,f+18-2),a=this.getBezierValue(s,d,3,f+18*2-2)}if(n!==1)if(i){const u=t.data.setupPose.color;c=u.r+(c-u.r)*n,o=u.g+(o-u.g)*n,a=u.b+(a-u.b)*n}else c=l.r+(c-l.r)*n,o=l.g+(o-l.g)*n,a=l.b+(a-l.b)*n;l.r=c<0?0:c>1?1:c,l.g=o<0?0:o>1?1:o,l.b=a<0?0:a>1?1:a}},ze=class extends Nt{slotIndex=0;constructor(t,e,s){super(t,e,`9|${s}`),this.slotIndex=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=(o?a.appliedPose:a.pose).color;let d=0;const f=this.frames;if(s<f[0]){r&&(h.a=a.data.setupPose.color.a);return}if(d=this.getCurveValue(s),i!==1)if(r){const u=a.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}},We=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(t,e,s,n,i,r,l,c,o){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r,this.frames[t+5]=l,this.frames[t+6]=c,this.frames[t+7]=o}apply1(t,e,s,n,i,r){const l=e.color,c=e.darkColor;let o=0,a=0,h=0;const d=this.frames;if(s<d[0]){if(i){const b=t.data.setupPose;l.setFromColor(b.color);const w=b.darkColor;c.r=w.r,c.g=w.g,c.b=w.b}return}let f=0,u=0,m=0,p=0;const g=Q.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],o=d[g+5],a=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,o+=(d[g+8+5]-o)*w,a+=(d[g+8+6]-a)*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],o=d[g+5],a=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),o=this.getBezierValue(s,g,5,x+18*4-2),a=this.getBezierValue(s,g,6,x+18*5-2),h=this.getBezierValue(s,g,7,x+18*6-2)}if(n===1)l.set(f,u,m,p);else if(i){const b=t.data.setupPose;let w=b.color;l.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,o=w.r+(o-w.r)*n,a=w.g+(a-w.g)*n,h=w.b+(h-w.b)*n}else l.add((f-l.r)*n,(u-l.g)*n,(m-l.b)*n,(p-l.a)*n),o=c.r+(o-c.r)*n,a=c.g+(a-c.g)*n,h=c.b+(h-c.b)*n;c.r=o<0?0:o>1?1:o,c.g=a<0?0:a>1?1:a,c.b=h<0?0:h>1?1:h}},He=class extends Ut{constructor(t,e,s){super(t,e,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,l,c){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r,this.frames[t+5]=l,this.frames[t+6]=c}apply1(t,e,s,n,i,r){const l=e.color,c=e.darkColor;let o=0,a=0,h=0,d=0,f=0,u=0;const m=this.frames;if(s<m[0]){if(i){const x=t.data.setupPose,b=x.color,w=x.darkColor;l.r=b.r,l.g=b.g,l.b=b.b,c.r=w.r,c.g=w.g,c.b=w.b}return}const p=Q.search(m,s,7),g=this.curves[p/7];switch(g){case 0:{const x=m[p];o=m[p+1],a=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);o+=(m[p+7+1]-o)*b,a+=(m[p+7+2]-a)*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:o=m[p+1],a=m[p+2],h=m[p+3],d=m[p+4],f=m[p+5],u=m[p+6];break;default:o=this.getBezierValue(s,p,1,g-2),a=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=t.data.setupPose;let b=x.color;o=b.r+(o-b.r)*n,a=b.g+(a-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 o=l.r+(o-l.r)*n,a=l.g+(a-l.g)*n,h=l.b+(h-l.b)*n,d=c.r+(d-c.r)*n,f=c.g+(f-c.g)*n,u=c.b+(u-c.b)*n;l.r=o<0?0:o>1?1:o,l.g=a<0?0:a>1?1:a,l.b=h<0?0:h>1?1:h,c.r=d<0?0:d>1?1:d,c.g=f<0?0:f>1?1:f,c.b=u<0?0:u>1?1:u}},Ft=class extends Q{slotIndex=0;attachmentNames;constructor(t,e){super(t,`11|${e}`),this.slotIndex=e,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,n,i,r,l,c,o){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const h=o?a.appliedPose:a.pose;c||s<this.frames[0]?r&&this.setAttachment(t,h,a.data.attachmentName):this.setAttachment(t,h,this.attachmentNames[Q.search(this.frames,s)])}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},Ge=class extends bt{slotIndex;attachment;vertices;constructor(t,e,s,n){super(t,e,`12|${s}|${n.id}`),this.slotIndex=s,this.attachment=n,this.vertices=new Array(t),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,n,i,r,l,c,o,a,h){const d=this.curves;let f=this.getFrameCount()+t*18;s===0&&(d[e]=2+f);const u=(n-r*2+c)*.03,m=o*.03-l*.06,p=((r-c)*3-n+a)*.006,g=(l-o+.33333333)*.018;let x=u*2+p,b=m*2+g,w=(r-n)*.3+u+p*.16666667,T=l*.3+m+g*.16666667,y=n+w,v=T;for(let S=f+18;f<S;f+=2)d[f]=y,d[f+1]=v,w+=x,T+=b,x+=p,b+=g,y+=w,v+=T}getCurvePercent(t,e){const s=this.curves;let n=s[e];switch(n){case 0:{const c=this.frames[e];return(t-c)/(this.frames[e+this.getFrameEntries()]-c)}case 1:return 0}if(n-=2,s[n]>t){const c=this.frames[e];return s[n+1]*(t-c)/(s[n]-c)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=t){const c=s[n-2],o=s[n-1];return o+(t-c)/(s[n]-c)*(s[n+1]-o)}const r=s[i-2],l=s[i-1];return l+(1-l)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,n,i,r,l,c,o){const a=t.slots;if(!this.attachment.isTimelineActive(a,this.slotIndex,o))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(a[this.slotIndex],o,r);for(const g of h)this.applyBeforeFirst(a[g],o,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=Q.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(a[this.slotIndex],o,f,u,m,p,i,r,l);for(const g of h)this.applyToSlot(a[g],o,f,u,m,p,i,r,l)}applyToSlot(t,e,s,n,i,r,l,c,o){if(!t.bone.active)return;const a=e?t.appliedPose:t.pose;if(a.attachment===null||a.attachment.timelineAttachment!==this.attachment)return;const h=a.attachment,d=a.deform;if(d.length===0&&(c=!0),d.length=r,n===null)if(l===1)if(o&&!c)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 B.arrayCopy(s,0,d,0,r);else if(c)if(h.bones)for(let f=0;f<r;f++)d[f]=s[f]*l;else{const f=h.vertices;for(let u=0;u<r;u++){const m=f[u];d[u]=m+(s[u]-m)*l}}else if(o)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f]*l;else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=(s[u]-f[u])*l}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*l;else if(l===1)if(o&&!c)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)B.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(c)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]=(u+(n[f]-u)*i)*l}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)*l}}else if(o)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i)*l}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])*l}}else for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i-d[f])*l}}applyBeforeFirst(t,e,s){if(!t.bone.active)return;const n=e?t.appliedPose:t.pose;n.attachment==null||n.attachment.timelineAttachment!==this.attachment||(n.deform.length===0&&(s=!0),s&&(n.deform.length=0))}},je=class vt extends Q{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(e,s,n){super(e,`28|${s}|${n.sequence.id}`),this.slotIndex=s,this.attachment=n,this.instant=!0}getFrameEntries(){return vt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(e,s,n,i,r){const l=this.frames;e*=vt.ENTRIES,l[e]=s,l[e+vt.MODE]=n|i<<4,l[e+vt.DELAY]=r}apply(e,s,n,i,r,l,c,o,a){const h=e.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,a))return;const d=this.attachment.timelineSlots,f=this.frames;if(o||n<f[0]){if(l){this.setupPose(h[this.slotIndex],a);for(const x of d)this.setupPose(h[x],a)}return}const u=Q.search(f,n,vt.ENTRIES),m=f[u],p=f[u+vt.MODE],g=f[u+vt.DELAY];this.applyToSlot(h[this.slotIndex],a,n,m,p,g);for(const x of d)this.applyToSlot(h[x],a,n,m,p,g)}setupPose(e,s){if(!e.bone.active)return;const n=s?e.appliedPose:e.pose;n.attachment===null||n.attachment.timelineAttachment!==this.attachment||(n.sequenceIndex=-1)}applyToSlot(e,s,n,i,r,l){if(!e.bone.active)return;const c=s?e.appliedPose:e.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;let o=r>>4,a=c.attachment.sequence.regions.length;const h=Ee[r&15];if(h!==0)switch(o+=(n-i)/l+1e-5|0,h){case 1:o=Math.min(a-1,o);break;case 2:o%=a;break;case 3:{const d=(a<<1)-2;o=d===0?0:o%d,o>=a&&(o=d-o);break}case 4:o=Math.max(a-1-o,0);break;case 5:o=a-1-o%a;break;case 6:{const d=(a<<1)-2;o=d===0?0:(o+a-1)%d,o>=a&&(o=d-o)}}c.sequenceIndex=o}},Zt=class bn extends Q{static propertyIds=["13"];events;constructor(e){super(e,...bn.propertyIds),this.events=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s.time,this.events[e]=s}apply(e,s,n,i,r,l,c,o,a){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=Q.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])}},St=class Vs extends Q{static propertyID="14";static propertyIds=[Vs.propertyID];drawOrders;constructor(e){super(e,...Vs.propertyIds),this.drawOrders=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,l,c,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0]){l&&B.arrayCopy(d,0,h,0,e.slots.length);return}const f=this.drawOrders[Q.search(this.frames,n)];if(!f)B.arrayCopy(d,0,h,0,e.slots.length);else for(let u=0,m=f.length;u<m;u++)h[u]=d[f[u]]}},$t=class wn extends Q{slots;inFolder;drawOrders;constructor(e,s,n){super(e,...wn.propertyIds(s)),this.slots=s,this.drawOrders=new Array(e),this.inFolder=new Array(n);for(const i of s)this.inFolder[i]=!0;this.instant=!0}static propertyIds(e){const s=e.length,n=new Array(s);for(let i=0;i<s;i++)n[i]=`d${e[i]}`;return n}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(e,s,n){this.frames[e]=s,this.drawOrders[e]=n}apply(e,s,n,i,r,l,c,o,a){const h=a?e.drawOrder.appliedPose:e.drawOrder.pose,d=e.slots;if(o||n<this.frames[0])l&&this.setup(h,d);else{const f=this.drawOrders[Q.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(e,s){const{inFolder:n,slots:i}=this;for(let r=0,l=0,c=i.length;!(n[e[r].data.index]&&(e[r]=s[i[l]],++l===c));r++);}};function Ws(t){return typeof t=="object"&&t!==null&&typeof t.constraintIndex=="number"}var Je=class extends bt{constraintIndex=0;constructor(t,e,s){super(t,e,`15|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,n,i,r,l){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=n,this.frames[t+3]=i,this.frames[t+4]=r?1:0,this.frames[t+5]=l?1:0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const x=a.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=Q.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?a.data.setupPose:h;h.mix=g.mix+(f-g.mix)*i,h.softness=g.softness+(u-g.softness)*i,c?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)}},Ke=class extends bt{constraintIndex=0;constructor(t,e,s){super(t,e,`16|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(t,e,s,n,i,r,l,c){const o=this.frames;t*=7,o[t]=e,o[t+1]=s,o[t+2]=n,o[t+3]=i,o[t+4]=r,o[t+5]=l,o[t+6]=c}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const y=a.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=Q.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?a.data.setupPose:h;l?(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)}},kt=class extends Nt{constraintIndex;constructor(t,e,s,n){super(t,e,`${n}|${s}`),this.constraintIndex=s}},Qe=class extends kt{constructor(t,e,s){super(t,e,s,17),this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.position=this.getAbsoluteValue(s,i,r,l,h.position,a.data.setupPose.position)}}},Ze=class extends kt{constructor(t,e,s){super(t,e,s,18)}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,a.data.setupPose.spacing)}}},ts=class extends bt{constraintIndex;constructor(t,e,s){super(t,e,`19|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,n,i){const r=this.frames;t<<=2,r[t]=e,r[t+1]=s,r[t+2]=n,r[t+3]=i}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(!a.active)return;const h=o?a.appliedPose:a.pose,d=this.frames;if(s<d[0]){if(r){const b=a.data.setupPose;h.mixRotate=b.mixRotate,h.mixX=b.mixX,h.mixY=b.mixY}return}let f,u,m;const p=Q.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?a.data.setupPose:h;l?(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)}},gt=class extends kt{constructor(t,e,s,n){super(t,e,s,n)}apply(t,e,s,n,i,r,l,c,o){if(l&&!this.additive&&(l=!1),this.constraintIndex===-1){const a=s>=this.frames[0]?this.getCurveValue(s):0,h=t.physics;for(const d of h)if(d.active&&this.global(d.data)){const f=o?d.appliedPose:d.pose;this.set(f,this.getAbsoluteValue(s,i,r,l,this.get(f),this.get(d.data.setupPose),a))}}else{const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;this.set(h,this.getAbsoluteValue(s,i,r,l,this.get(h),this.get(a.data.setupPose)))}}}},es=class extends gt{constructor(t,e,s){super(t,e,s,20)}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},ss=class extends gt{constructor(t,e,s){super(t,e,s,21)}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},ns=class extends gt{constructor(t,e,s){super(t,e,s,22)}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},is=class extends gt{constructor(t,e,s){super(t,e,s,23)}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},rs=class extends gt{constructor(t,e,s){super(t,e,s,24),this.additive=!0}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},as=class extends gt{constructor(t,e,s){super(t,e,s,25),this.additive=!0}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},os=class extends gt{constructor(t,e,s){super(t,e,s,26)}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},ls=class yn extends Q{static propertyIds=["27"];constraintIndex;constructor(e,s){super(e,...yn.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,s){this.frames[e]=s}apply(e,s,n,i,r,l,c,o,a){let h;if(this.constraintIndex!==-1&&(h=e.constraints[this.constraintIndex],!h.active))return;const d=this.frames;if(s>n)this.apply(e,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[Q.search(d,s)+1]))if(h!=null)h.reset(e);else for(const f of e.physics)f.active&&f.reset(e)}},cs=class extends kt{constructor(t,e,s){super(t,e,s,29)}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.time=this.getAbsoluteValue(s,i,r,l,h.time,a.data.setupPose.time)}}},hs=class extends kt{constructor(t,e,s){super(t,e,s,30),this.additive=!0}apply(t,e,s,n,i,r,l,c,o){const a=t.constraints[this.constraintIndex];if(a.active){const h=o?a.appliedPose:a.pose;h.mix=this.getAbsoluteValue(s,i,r,l,h.mix,a.data.setupPose.mix)}}},_n=class Rs{static emptyAnimation=new Kt("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Gs(this);propertyIds=new Ce;animationsChanged=!1;trackEntryPool=new Bt(()=>new Hs);constructor(e){this.data=e}update(e){e*=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 l=e*r.timeScale;if(r.delay>0){if(r.delay-=l,r.delay>0)continue;l=-r.delay,r.delay=0}let c=r.next;if(c){const o=r.trackLast-c.delay;if(o>=0){for(c.delay=0,c.trackTime+=r.timeScale===0?0:(o/r.timeScale+e)*c.timeScale,r.trackTime+=l,this.setTrack(n,c,!0);c.mixingFrom;)c.mixTime+=e,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,e)){let o=r.mixingFrom;for(r.mixingFrom=null,o&&(o.mixingTo=null);o;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=l}this.queue.drain()}updateMixingFrom(e,s){const n=e.mixingFrom;if(!n)return!0;const i=this.updateMixingFrom(n,s);if(n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,e.nextTrackLast!==-1&&e.mixTime>=e.mixDuration){if(n.totalAlpha===0||e.mixDuration===0){if(e.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=e),n.totalAlpha===0)for(let r=e;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(n)}return i}return n.trackTime+=s*n.timeScale,e.mixTime+=s,!1}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,n=this.tracks;let i=!1;for(let c=0,o=n.length;c<o;c++){const a=n[c];if(!a||a.delay>0)continue;i=!0;let h=a.alpha;a.mixingFrom?h*=this.applyMixingFrom(a,e):a.trackTime>=a.trackEnd&&!a.next&&(h=0);let d=a.animationLast,f=a.getAnimationTime(),u=f,m=s;a.reverse&&(u=a.animation.duration-u,m=null);const p=a.animation.timelines,g=p.length;if(c===0&&h===1)for(let x=0;x<g;x++){B.webkit602BugfixHelper(h);const b=p[x];b instanceof Ft?this.applyAttachmentTimeline(b,e,u,!0,!0):b.apply(e,d,u,m,h,!0,!1,!1,!1)}else{const x=a.timelineMode,b=h>=a.alphaAttachmentThreshold,w=a.additive,T=w||a.shortestRotation,y=!T&&a.timelinesRotation.length!==g<<1;y&&(a.timelinesRotation.length=g<<1);for(let v=0;v<g;v++){const S=p[v],A=(x[v]&_t)!==0;!T&&S instanceof Dt?this.applyRotateTimeline(S,e,u,h,A,a.timelinesRotation,v<<1,y):S instanceof Ft?this.applyAttachmentTimeline(S,e,u,A,b):(B.webkit602BugfixHelper(h),S.apply(e,d,u,m,h,A,w,!1,!1))}}a.reverse&&this.eventsReverse(a,d,f),this.queueEvents(a,f),s.length=0,a.nextAnimationLast=f,a.nextTrackLast=a.trackTime}const r=this.unkeyedState+ds,l=e.slots;for(let c=0,o=e.slots.length;c<o;c++){const a=l[c];if(a.attachmentState===r){const h=a.data.attachmentName;a.pose.setAttachment(h?e.getAttachment(a.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(e,s){const n=e.mixingFrom,i=n.mixingFrom!==null?this.applyMixingFrom(n,s):1,r=e.mix(),l=n.alpha*i,c=1-r*e.alpha,o=l*(1-r),a=c>0?o/c:l,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,S=null;n.reverse?v=n.animation.duration-v:r<n.eventThreshold&&(S=this.events),n.totalAlpha=0;for(let A=0;A<d;A++){const I=h[A],M=f[A],Y=(M&_t)!==0;let k=0;if((M&qt)!==0){const E=u[A];k=E==null?a:a*(1-E.mix())}else{if(!p&&I instanceof St&&!Y)continue;k=o}if(n.totalAlpha+=k,!x&&I instanceof Dt)this.applyRotateTimeline(I,s,v,k,Y,w,A<<1,b);else if(I instanceof Ft)this.applyAttachmentTimeline(I,s,v,Y,m&&k>=n.alphaAttachmentThreshold);else{const E=!p||!(I instanceof St)||!Y;I.apply(s,T,v,S,k,Y,g,E,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,T,y),e.mixDuration>0&&this.queueEvents(n,y),this.events.length=0,n.nextAnimationLast=y,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,s,n,i,r){const l=s.slots[e.slotIndex];if(!l.bone.active||!r&&l.attachmentState===this.unkeyedState+fs)return;let c=n<e.frames[0],o=null;if(c||(o=e.attachmentNames[Q.search(e.frames,n)],c=!r&&o==null),c){if(!i)return;o=l.data.attachmentName}l.pose.setAttachment(o==null?null:s.getAttachment(l.data.index,o)),r?l.attachmentState=this.unkeyedState+fs:c||(l.attachmentState=this.unkeyedState+ds)}applyRotateTimeline(e,s,n,i,r,l,c,o){if(o&&(l[c]=0),i===1){e.apply(s,0,n,null,1,r,!1,!1,!1);return}const a=s.bones[e.boneIndex];if(!a.active)return;const h=a.pose,d=a.data.setupPose,f=e.frames;if(n<f[0]){r&&(h.rotation=d.rotation);return}const u=r?d.rotation:h.rotation,m=d.rotation+e.getCurveValue(n);let p=0,g=m-u;if(g-=Math.ceil(g/360-.5)*360,g===0)p=l[c];else{let x=0,b=0;o?(x=0,b=g):(x=l[c],b=l[c+1]);const w=x-x%360;p=g+w;let T=g>=0,y=x>=0;Math.abs(b)<=90&&R.signum(b)!==R.signum(g)&&(Math.abs(x-w)>180?(p+=360*R.signum(x),y=T):w!==0?p-=360*R.signum(x):y=T),y!==T&&(p+=360*R.signum(x)),l[c]=p}l[c+1]=g,h.rotation=u+p*i}queueEvents(e,s){const n=e.animationStart,i=e.animationEnd,r=i-n,l=e.reverse;let c=e.trackLast%r;l&&(c=r-c);const o=this.events;let a=0,h=o.length;for(;a<h;a++){const f=o[a];if(f.time<c!==l)break;f.time>=n&&f.time<=i&&this.queue.event(e,f)}let d=!1;if(e.loop)if(r===0)d=!0;else{const f=Math.floor(e.trackTime/r);d=f>0&&f>Math.floor(e.trackLast/r)}else d=s>=i&&e.animationLast<i;for(d&&this.queue.complete(e);a<h;a++){const f=o[a];f.time>=n&&f.time<=i&&this.queue.event(e,f)}}eventsReverse(e,s,n){const i=e.animation.duration,r=i-s,l=i-n,c=e.animation.timelines;for(let o=0,a=e.animation.timelines.length;o<a;o++){const h=c[o];if(!(h instanceof Zt))continue;const d=h.events,f=h.frames,u=f.length;if(r>=l){for(let m=0;m<u;m++)if(!(f[m]<l)){if(f[m]>=r)break;this.events.push(d[m])}}else{for(let p=0;p<u&&!(f[p]>=r);p++)this.events.push(d[p]);let m=0;for(;m<u&&!(f[m]>=l);m++);for(;m<u;m++)this.events.push(d[m])}}}clearTracks(){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");if(e>=this.tracks.length)return;const s=this.tracks[e];if(!s)return;this.queue.end(s),this.clearNext(s);let n=s;for(;;){const i=n.mixingFrom;if(!i)break;this.queue.end(i),n.mixingFrom=null,n.mixingTo=null,n=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(e,s,n){const i=this.expandToIndex(e);this.tracks[e]=s,s.previous=null,i&&(i.next=null,n&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(e,s,n=!1){return typeof s=="string"?this.setAnimation1(e,s,n):this.setAnimation2(e,s,n)}setAnimation1(e,s,n=!1){const i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(e,i,n)}setAnimation2(e,s,n=!1){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const l=this.trackEntry(e,s,n,r);return this.setTrack(e,l,i),this.queue.drain(),l}addAnimation(e,s,n=!1,i=0){return typeof s=="string"?this.addAnimation1(e,s,n,i):this.addAnimation2(e,s,n,i)}addAnimation1(e,s,n=!1,i=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(e,r,n,i)}addAnimation2(e,s,n=!1,i=0){if(e<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;const l=this.trackEntry(e,s,n,r);return r?(r.next=l,l.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-l.mixDuration,0))):(this.setTrack(e,l,!0),this.queue.drain(),i<0&&(i=0)),l.delay=i,l}setEmptyAnimation(e,s=0){const n=this.setAnimation(e,Rs.emptyAnimation,!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(e,s=0,n=0){const i=this.addAnimation(e,Rs.emptyAnimation,!1,n);return n<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(e=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,i=this.tracks.length;n<i;n++){const r=this.tracks[n];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(B.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,s,n,i){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=s,r.loop=n,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=i?this.data.getMix(i.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(e){let s=e.next;for(;s;)this.queue.dispose(s),s=s.next;e.next=null}_animationsChanged(){this.animationsChanged=!1;const e=this.tracks;for(let s=0,n=e.length;s<n;s++){let i=e[s];if(i){for(;i.mixingFrom;)i=i.mixingFrom;do this.computeHold(i),i=i.mixingTo;while(i)}}this.propertyIds.clear()}computeHold(e){const s=e.animation.timelines,n=e.animation.timelines.length,i=e.timelineMode;i.length=n;const r=e.timelineHoldMix;r.length=0;const l=this.propertyIds,c=e.additive,o=e.keepHold,a=e.mixingTo;t:for(let h=0;h<n;h++){const d=s[h],f=d.propertyIds,u=l.addAll(f)&&!(d instanceof $t&&l.contains(St.propertyID));if(c&&d.additive){i[h]=u?_t:te;continue}for(let p=e.mixingFrom;p!=null;p=p.mixingFrom)if(p.animation.hasTimeline(f)){i[h]=te;continue t}let m;if(a===null||d.instant||a.additive&&d.additive||!a.animation?.hasTimeline(f))m=u?_t:te;else{m=u?Js:qt;for(let p=a.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(f)){p.mixDuration>0&&(r[h]=p);break}}o&&(m=m&~qt|i[h]&qt),i[h]=m}}getTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){const s=this.listeners.indexOf(e);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Hs=class{animation=null;previous=null;next=null;mixingFrom=null;mixingTo=null;listener=null;trackIndex=0;loop=!1;additive=!1;reverse=!1;shortestRotation=!1;keepHold=!1;eventThreshold=0;mixAttachmentThreshold=0;alphaAttachmentThreshold=0;mixDrawOrderThreshold=0;animationStart=0;animationEnd=0;animationLast=0;nextAnimationLast=0;delay=0;trackTime=0;trackLast=0;nextTrackLast=0;trackEnd=0;timeScale=0;alpha=0;mixTime=0;mixDuration=0;totalAlpha=0;mixInterpolation=Lt.linear;setMixDuration(t,e){this.mixDuration=t,e!==void 0&&(e<=0&&(e=this.previous==null?0:Math.max(e+this.previous.getTrackComplete()-t,0)),this.delay=e)}setMixInterpolation(t){if(!t)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=t}mix(){if(this.mixDuration===0)return 1;let t=this.mixTime/this.mixDuration;return t>=1?1:this.mixInterpolation===Lt.linear?t:(t=this.mixInterpolation.apply(t),t<0?0:t>1?1:t)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=Lt.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const t=this.animationEnd-this.animationStart;return t===0?this.animationStart:this.trackTime%t+this.animationStart}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const t=this.animationEnd-this.animationStart;if(t!==0){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Gs=class{objects=[];drainDisabled=!1;animState;constructor(t){this.animState=t}start(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(1),this.objects.push(t)}end(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(3),this.objects.push(t)}complete(t){this.objects.push(4),this.objects.push(t)}event(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let t=0;t<this.objects.length;t+=2){const e=this.objects,s=e[t],n=e[t+1],i=this.animState.listeners.slice();switch(s){case 0:n.listener?.start&&n.listener.start(n);for(let r=0;r<i.length;r++){const l=i[r];l.start&&l.start(n)}break;case 1:n.listener?.interrupt&&n.listener.interrupt(n);for(let r=0;r<i.length;r++){const l=i[r];l.interrupt&&l.interrupt(n)}break;case 2:n.listener?.end&&n.listener.end(n);for(let r=0;r<i.length;r++){const l=i[r];l.end&&l.end(n)}case 3:n.listener?.dispose&&n.listener.dispose(n);for(let r=0;r<i.length;r++){const l=i[r];l.dispose&&l.dispose(n)}this.animState.trackEntryPool.free(n);break;case 4:n.listener?.complete&&n.listener.complete(n);for(let r=0;r<i.length;r++){const l=i[r];l.complete&&l.complete(n)}break;case 5:{const r=e[t+++2];n.listener?.event&&n.listener.event(n,r);for(let l=0;l<i.length;l++){const c=i[l];c.event&&c.event(n,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},js=(t=>(t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event",t))(js||{}),qn=class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},te=0,_t=1,qt=2,Js=3,ds=1,fs=2,zn=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(t){if(!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){return typeof t=="string"?this.setMix1(t,e,s):this.setMix2(t,e,s)}setMix1(t,e,s){const n=this.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);const i=this.skeletonData.findAnimation(e);if(!i)throw new Error(`Animation not found: ${e}`);this.setMix2(n,i,s)}setMix2(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");const n=`${t.name}.${e.name}`;this.animationToMixTime[n]=s}getMix(t,e){const s=`${t.name}.${e.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}},Wn=class{constructor(t,e="",s=new Qs,n=new Ks){this.textureLoader=t,this.pathPrefix=e,this.downloader=s,this.cache=n}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.cache.assets[e]=s,this.cache.assetsRefCount[e]=(this.cache.assetsRefCount[e]||0)+1,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise((e,s)=>{const n=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):e(this);return}requestAnimationFrame(n)};requestAnimationFrame(n)})}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadBinary(t,r=>{this.success(e,t,r),n(r)},(r,l)=>{const c=`Couldn't load binary ${t}: status ${r}, ${l}`;this.error(s,t,c),i(c)})}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,n=>{this.success(e,t,n)},(n,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${n}, ${i}`)})}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((n,i)=>{this.downloader.downloadJson(t,r=>{this.success(e,t,r),n(r)},(r,l)=>{const c=`Couldn't load JSON ${t}: status ${r}, ${l}`;this.error(s,t,c),i(c)})}))}reuseAssets(t,e=()=>{},s=()=>{}){const n=this.cache.getAsset(t),i=n!==void 0;return i&&(this.cache.assetsLoaded[t]=n.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(e,t,r),r)).catch(r=>{this.error(s,t,r)})),i}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),this.reuseAssets(t,e,s))return;const n=this.texturePmaInfo[t];this.cache.assetsLoaded[t]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(t,{mode:"cors"}).then(o=>{if(o.ok)return o.blob();const a=`Couldn't load image: ${t}`;this.error(s,t,`Couldn't load image: ${t}`),r(a)}).then(o=>o?createImageBitmap(o,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(o=>{if(o){const a=this.createTexture(t,n,o);this.success(e,t,a),i(a)}});else{const o=new Image;o.crossOrigin="anonymous",o.onload=()=>{const a=this.createTexture(t,n,o);this.success(e,t,a),i(a)},o.onerror=()=>{const a=`Couldn't load image: ${t}`;this.error(s,t,a),r(a)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),o.src=t}})}loadTextureAtlas(t,e=()=>{},s=()=>{},n){const i=t.lastIndexOf("/"),r=i>=0?t.substring(0,i+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((l,c)=>{this.downloader.downloadText(t,o=>{try{const a=this.createTextureAtlas(o,r,t,n);let h=a.pages.length,d=!1;if(h===0){this.success(e,t,a),l(a);return}for(const f of a.pages)this.loadTexture(this.texturePath(r,f.name,n),(u,m)=>{d||(f.setTexture(m),--h===0&&(this.success(e,t,a),l(a)))},(u,m)=>{if(!d){const p=`Couldn't load texture ${t} page image: ${u}`;this.error(s,t,p),c(p)}d=!0})}catch(a){const h=`Couldn't parse texture atlas ${t}: ${a.message}`;this.error(s,t,h),c(h)}},(o,a)=>{const h=`Couldn't load texture atlas ${t}: status ${o}, ${a}`;this.error(s,t,h),c(h)})}))}loadTextureAtlasButNoTextures(t,e=()=>{},s=()=>{}){const n=t.lastIndexOf("/"),i=n>=0?t.substring(0,n+1):"";t=this.start(t),!this.reuseAssets(t,e,s)&&(this.cache.assetsLoaded[t]=new Promise((r,l)=>{this.downloader.downloadText(t,c=>{try{const o=this.createTextureAtlas(c,i,t);this.success(e,t,o),r(o)}catch(o){const a=`Couldn't parse texture atlas ${t}: ${o.message}`;this.error(s,t,a),l(a)}},(c,o)=>{const a=`Couldn't load texture atlas ${t}: status ${c}, ${o}`;this.error(s,t,a),l(a)})}))}async loadBinaryAsync(t){return new Promise((e,s)=>{this.loadBinary(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadJsonAsync(t){return new Promise((e,s)=>{this.loadJson(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAsync(t){return new Promise((e,s)=>{this.loadTexture(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasAsync(t){return new Promise((e,s)=>{this.loadTextureAtlas(t,(n,i)=>e(i),(n,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(t){return new Promise((e,s)=>{this.loadTextureAtlasButNoTextures(t,(n,i)=>e(i),(n,i)=>s(i))})}setCache(t){this.cache=t}get(t){return this.cache.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;const e=this.cache.assets[t];if(e)return e;const s=this.errors[t];throw Error(`Asset not found: ${t}${s?`
|
|
2
|
+
${s}`:""}`)}remove(t){t=this.pathPrefix+t;const e=this.cache.assets[t];return e.dispose&&e.dispose(),delete this.cache.assets[t],delete this.cache.assetsRefCount[t],delete this.cache.assetsLoaded[t],e}removeAll(){for(const t in this.cache.assets){const e=this.cache.assets[t];e.dispose&&e.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(t){const e=this.cache.assets[t];if(e instanceof Ye){e.dispose();return}this.disposeAssetInternal(t)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(t){if(this.cache.assetsRefCount[t]>0&&--this.cache.assetsRefCount[t]===0)return this.remove(t)}createTextureAtlas(t,e,s,n){const i=new Ye(t);i.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of i.pages)r.texture?.dispose()}};for(const r of i.pages){const l=this.texturePath(e,r.name,n);this.texturePmaInfo[this.pathPrefix+l]=r.pma}return i}createTexture(t,e,s){const n=this.textureLoader(s,e),i=n.dispose.bind(n);return n.dispose=()=>{this.disposeAssetInternal(t)&&i()},n}texturePath(t,e,s){return s?s[e]:t+e}},Ks=class Se{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(e){const s=Se.AVAILABLE_CACHES.get(e);if(s)return s;const n=new Se;return Se.AVAILABLE_CACHES.set(e,n),n}async addAsset(e,s){return this.assetsLoaded[e]=Promise.resolve(s),this.assets[e]=s,s}getAsset(e){return this.assetsLoaded[e]}},Qs=class{callbacks={};rawDataUris={};dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return e!==-1?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){var e=window.atob(t),s=e.length,n=new Uint8Array(s);for(let i=0;i<s;i++)n[i]=e.charCodeAt(i);return n}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(e===-1)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToString(n))}catch(l){this.finish(t,400,JSON.stringify(l))}return}const i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",n||t,!0);const r=()=>{this.finish(t,i.status,i.responseText)};i.onload=r,i.onerror=r,i.send()}downloadJson(t,e,s){this.downloadText(t,n=>{e(JSON.parse(n))},s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;const n=this.rawDataUris[t];if(n&&!n.includes(".")){try{this.finish(t,200,this.dataUriToUint8Array(n))}catch(l){this.finish(t,400,JSON.stringify(l))}return}const i=new XMLHttpRequest;i.open("GET",n||t,!0),i.responseType="arraybuffer";const r=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{i.status===200||i.status===0?this.finish(t,200,new Uint8Array(i.response)):r()},i.onerror=r,i.send()}start(t,e,s){let n=this.callbacks[t];try{if(n)return!0;this.callbacks[t]=n=[]}finally{n.push(e,s)}}finish(t,e,s){const n=this.callbacks[t];if(delete this.callbacks[t],e===200||e===0)for(let i=0,r=n.length;i<r;i+=2)n[i](s);else for(let i=1,r=n.length;i<r;i+=2)n[i](e,s)}},us=class vn extends xt{color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new vn(this.name);return this.copyTo(e),e.color.setFromColor(this.color),e}},zt=class Tn extends xt{endSlot=null;convex=!1;inverse=!1;color=new z(.2275,.2275,.8078,1);constructor(e){super(e)}copy(){const e=new Tn(this.name);return this.copyTo(e),e.endSlot=this.endSlot,e.convex=this.convex,e.inverse=this.inverse,e.color.setFromColor(this.color),e}},ee=class Sn extends xt{lengths=[];closed=!1;constantSpeed=!1;color=new z(1,1,1,1);constructor(e){super(e)}copy(){const e=new Sn(this.name);return this.copyTo(e),e.lengths=[],B.arrayCopy(this.lengths,0,e.lengths,0,this.lengths.length),e.closed=this.closed,e.constantSpeed=this.constantSpeed,e.color.setFromColor(this.color),e}},Zs=class An extends xt{x=0;y=0;rotation=0;color=new z(.38,.94,0,1);constructor(e){super(e)}computeWorldPosition(e,s){return s.x=this.x*e.a+this.y*e.b+e.worldX,s.y=this.x*e.c+this.y*e.d+e.worldY,s}computeWorldRotation(e){const s=this.rotation*R.degRad,n=Math.cos(s),i=Math.sin(s),r=n*e.a+i*e.b,l=n*e.c+i*e.d;return R.atan2Deg(l,r)}copy(){const e=new An(this.name);return e.x=this.x,e.y=this.y,e.rotation=this.rotation,e.color.setFromColor(this.color),e}},Hn=class{atlas;allowMissingRegions;constructor(t,e=!1){this.atlas=t,this.allowMissingRegions=e}findRegions(t,e,s){const n=s.regions;for(let i=0,r=n.length;i<r;i++)n[i]=this.findRegion(t,s.getPath(e,i))}findRegion(t,e){const s=this.atlas.findRegion(e);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${e} (attachment: ${t})`);return s}newRegionAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new Pt(s,i)}newMeshAttachment(t,e,s,n,i){return this.findRegions(s,n,i),new Tt(s,i)}newBoundingBoxAttachment(t,e,s){return new us(s)}newPathAttachment(t,e,s){return new ee(s)}newPointAttachment(t,e,s){return new Zs(s)}newClippingAttachment(t,e,s){return new zt(s)}},se=class{name;setupPose;skinRequired=!1;constructor(t,e){if(t==null)throw new Error("name cannot be null.");this.name=t,this.setupPose=e}},ms=class In extends se{index=0;parent=null;length=0;color=new z;icon;iconSize=1;iconRotation=0;visible=!1;constructor(e,s,n){if(super(s,new ie),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=e,this.parent=n}copy(e){const s=new In(this.index,this.name,e);return s.length=this.length,s.setupPose.set(this.setupPose),s}},ne=(t=>(t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection",t))(ne||{}),ie=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(t){if(t==null)throw new Error("pose cannot be null.");this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}setPosition(t,e){this.x=t,this.y=e}setScale(t,e){this.scaleX=t,this.scaleY=e===void 0?t:e}getInherit(){return this.inherit}setInherit(t){if(t==null)throw new Error("inherit cannot be null.");this.inherit=t}update(t,e){this.world!==t._update&&this.updateWorldTransform(t)}updateWorldTransform(t){this.local===t._update?this.updateLocalTransform(t):this.world=t._update;const e=this.rotation,s=this.scaleX,n=this.scaleY,i=this.shearX,r=this.shearY;if(!this.bone.parent){const d=t.scaleX,f=t.scaleY,u=(e+i)*R.degRad,m=(e+90+r)*R.degRad;this.a=Math.cos(u)*s*d,this.b=Math.cos(m)*n*d,this.c=Math.sin(u)*s*f,this.d=Math.sin(m)*n*f,this.worldX=this.x*d+t.x,this.worldY=this.y*f+t.y;return}const l=this.bone.parent.appliedPose;let c=l.a,o=l.b,a=l.c,h=l.d;switch(this.worldX=c*this.x+o*this.y+l.worldX,this.worldY=a*this.x+h*this.y+l.worldY,this.inherit){case 0:{const d=(e+i)*R.degRad,f=(e+90+r)*R.degRad,u=Math.cos(d)*s,m=Math.cos(f)*n,p=Math.sin(d)*s,g=Math.sin(f)*n;this.a=c*u+o*p,this.b=c*m+o*g,this.c=a*u+h*p,this.d=a*m+h*g;return}case 1:{const d=t.scaleX,f=t.scaleY,u=(e+i)*R.degRad,m=(e+90+r)*R.degRad;this.a=Math.cos(u)*s*d,this.b=Math.cos(m)*n*d,this.c=Math.sin(u)*s*f,this.d=Math.sin(m)*n*f;break}case 2:{const d=t.scaleX,f=t.scaleY,u=1/d,m=1/f;c*=u,a*=m;let p=c*c+a*a,g=0;p>R.epsilon2?(p=Math.abs(c*h*m-o*u*a)/p,o=a*p,h=c*p,g=e-R.atan2Deg(a,c)):(c=0,a=0,g=e-90+R.atan2Deg(h,o));const x=(g+i)*R.degRad,b=(g+r+90)*R.degRad,w=Math.cos(x)*s,T=Math.cos(b)*n,y=Math.sin(x)*s,v=Math.sin(b)*n;this.a=(c*w-o*y)*d,this.b=(c*T-o*v)*d,this.c=(a*w+h*y)*f,this.d=(a*T+h*v)*f;break}case 3:case 4:{const d=t.scaleX,f=t.scaleY,u=1/d,m=1/f,p=e*R.degRad,g=Math.cos(p),x=Math.sin(p);let b=(c*g+o*x)*u,w=(a*g+h*x)*m;const T=1/Math.sqrt(b*b+w*w);b*=T,w*=T;let y=-w,v=b;this.inherit===3&&c*h-o*a<0!=(d<0!=f<0)&&(y=-y,v=-v);const S=i*R.degRad,A=(90+r)*R.degRad,I=Math.cos(S)*s,M=Math.cos(A)*n,Y=Math.sin(S)*s,k=Math.sin(A)*n;this.a=(b*I+y*Y)*d,this.b=(b*M+y*k)*d,this.c=(w*I+v*Y)*f,this.d=(w*M+v*k)*f;break}}}updateLocalTransform(t){this.local=0,this.world=t._update;const e=t.scaleX,s=t.scaleY;if(!this.bone.parent){const g=1/e,x=1/s;this.x=(this.worldX-t.x)*g,this.y=(this.worldY-t.y)*x,this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);return}const n=this.bone.parent.appliedPose;let i=n.a,r=n.b,l=n.c,c=n.d;const o=i*c-r*l,a=1/(i*c-r*l),h=c*a,d=r*a,f=l*a,u=i*a,m=this.worldX-n.worldX,p=this.worldY-n.worldY;switch(this.x=m*h-p*d,this.y=p*u-m*f,this.inherit){case 0:this.set5(h*this.a-d*this.c,h*this.b-d*this.d,u*this.c-f*this.a,u*this.d-f*this.b,0);break;case 1:{const g=1/e,x=1/s;this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);break}case 2:{const g=1/e,x=1/s;i*=g,l*=x;const b=this.a*g,w=this.b*g,T=this.c*x,y=this.d*x,v=1/(i*i+l*l),S=1/Math.abs(o*g*x);this.set5((i*b+l*T)*v,(i*w+l*y)*v,(i*T-l*b)*S,(i*y-l*w)*S,R.atan2Deg(l,i));break}case 3:case 4:{const g=1/e,x=1/s,b=this.a*g,w=this.b*g,T=this.c*x,y=this.d*x;let v=c*this.a-r*this.c,S=i*this.c-l*this.a;o<0&&(v=-v,S=-S);let A=R.atan2Deg(S,v);this.rotation=A,A*=R.degRad;const I=Math.cos(A),M=Math.sin(A);let Y=(i*I+r*M)*g,k=(l*I+c*M)*x;const E=1/Math.sqrt(Y*Y+k*k);Y*=E,k*=E;const X=this.inherit===3&&o<0!=(e<0!=s<0)?-1:1;this.set4(Y*b+k*T,Y*w+k*y,(Y*T-k*b)*X,(Y*y-k*w)*X)}}}set4(t,e,s,n){const i=t*t+s*s,r=e*e+n*n;i>R.epsilon2?(this.shearX=R.atan2Deg(s,t),this.scaleX=Math.sqrt(i)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(r),r>R.epsilon2?(this.shearY=R.atan2Deg(n,e),t*n-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(t,e,s,n,i){this.shearX=0;const r=t*t+s*s,l=e*e+n*n;if(r>R.epsilon2){const c=R.atan2Deg(s,t);this.rotation=c+i,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(l),l>R.epsilon2?(this.shearY=R.atan2Deg(n,e),t*n-e*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-c):this.shearY-=90+c,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(l),this.shearY=0,this.rotation=l>R.epsilon2?R.atan2Deg(n,e)-90+i:i}validateLocalTransform(t){this.local===t._update&&this.updateLocalTransform(t)}modifyLocal(t){this.local===t._update&&this.updateLocalTransform(t),this.world=0,this.resetWorld(t._update)}modifyWorld(t){this.local=t,this.world=t,this.resetWorld(t)}resetWorld(t){const e=this.bone.children;for(let s=0,n=e.length;s<n;s++){const i=e[s].appliedPose;i.world===t&&(i.world=0,i.local=0,i.resetWorld(t))}}getWorldRotationX(){return R.atan2Deg(this.c,this.a)}getWorldRotationY(){return R.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){if(t==null)throw new Error("world cannot be null.");const e=this.a*this.d-this.b*this.c,s=t.x-this.worldX,n=t.y-this.worldY;return t.x=(s*this.d-n*this.b)/e,t.y=(n*this.a-s*this.c)/e,t}localToWorld(t){if(t==null)throw new Error("local cannot be null.");const e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.worldToLocal(t)}parentToWorld(t){if(t==null)throw new Error("world cannot be null.");return this.bone.parent==null?t:this.bone.parent.appliedPose.localToWorld(t)}worldToLocalRotation(t){t*=R.degRad;const e=Math.sin(t),s=Math.cos(t);return R.atan2Deg(this.a*e-this.c*s,this.d*s-this.b*e)+this.rotation-this.shearX}localToWorldRotation(t){t=(t-this.rotation-this.shearX)*R.degRad;const e=Math.sin(t),s=Math.cos(t);return R.atan2Deg(s*this.c+e*this.d,s*this.a+e*this.b)}rotateWorld(t){t*=R.degRad;const e=Math.sin(t),s=Math.cos(t),n=this.a,i=this.b;this.a=s*n-e*this.c,this.b=s*i-e*this.d,this.c=e*n+s*this.c,this.d=e*i+s*this.d}},gs=class{data;pose;constrainedPose;appliedPose;constructor(t,e,s){if(t==null)throw new Error("data cannot be null.");this.data=t,this.pose=e,this.constrainedPose=s,this.appliedPose=e}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},ps=class extends gs{active=!1;constructor(t,e,s){super(t,e,s),this.setupPose()}isActive(){return this.active}},re=class Cn extends ps{parent=null;children=[];sorted=!1;constructor(e,s){super(e,new ie,new ie),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(e){const s=new Cn(this.data,e);return s.pose.set(this.pose),s}},Et=class extends ps{constructor(t,e,s){super(t,e,s)}isSourceActive(){return!0}},tn=class{_setupPose;pose;constrainedPose;appliedPose;constructor(t){this._setupPose=t,this.pose=[...t],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,B.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,B.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},Xt=class extends se{constructor(t,e){super(t,e)}},ae=(t=>(t[t.None=0]="None",t[t.Uniform=1]="Uniform",t[t.Volume=2]="Volume",t))(ae||{}),oe=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(t,e){if(!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},xs=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(t){if(t==null)throw new Error("audioPath cannot be null.");this._audioPath=t}setupPose=new oe(-1,this);constructor(t){this.name=t}},le=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(t){this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}},en=class Mt extends Et{bones;target;constructor(e,s){if(super(e,new le,new le),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of e.bones)this.bones.push(s.bones[n.index].constrainedPose);this.target=s.bones[e.target.index]}copy(e){var s=new Mt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:Mt.apply(e,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Mt.apply(e,r[0],r[1],i.worldX,i.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(e){e.sortBone(this.target);const s=this.bones[0].bone;e.sortBone(s),e._updateCache.push(this),s.sorted=!1,e.sortReset(s.children),e.constrained(s),this.bones.length>1&&e.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(e,s,n,i,r,l,c,o,a,h){typeof n=="number"?Mt.apply1(e,s,n,i,r,l,c,o):Mt.apply2(e,s,n,i,r,l,c,o,a,h)}static apply1(e,s,n,i,r,l,c,o){s.modifyLocal(e);const a=s.bone.parent.appliedPose;let h=a.a,d=a.b,f=a.c,u=a.d,m=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*R.signum(e.scaleX),g=(i-s.worldY)*R.signum(e.scaleY);break;case 2:{const x=Math.abs(h*u-d*f)/Math.max(R.epsilon,h*h+f*f),b=h/e.scaleX,w=f/e.scaleY;d=-w*x*e.scaleX,u=b*x*e.scaleY,m+=R.atan2Deg(w,b)}default:{const x=n-a.worldX,b=i-a.worldY,w=h*u-d*f;Math.abs(w)<=R.epsilon?(p=0,g=0):(p=(x*u-b*d)/w-s.x,g=(b*h-x*f)/w-s.y)}}if(m+=R.atan2Deg(g,p),s.scaleX<0&&(m+=180),m>180?m-=360:m<=-180&&(m+=360),s.rotation+=m*o,r||l){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const x=s.bone.data.length*s.scaleX;if(x>R.epsilon){const b=p*p+g*g;if(r&&b<x*x||l&&b>x*x){const w=(Math.sqrt(b)/x-1)*o+1;switch(s.scaleX*=w,c){case 1:s.scaleY*=w;break;case 2:s.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(e,s,n,i,r,l,c,o,a,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(e),n.modifyLocal(e);let d=s.x,f=s.y,u=s.scaleX,m=s.scaleY,p=n.scaleX,g=0,x=0,b=0;u<0?(u=-u,g=180,b=-1):(g=0,b=1),m<0&&(m=-m,b=-b),p<0?(p=-p,x=180):x=0;let w=0,T=0,y=s.a,v=s.b,S=s.c,A=s.d;const I=Math.abs(u-m)<=R.epsilon;!I||c?(n.y=0,w=y*n.x+s.worldX,T=S*n.x+s.worldY):(w=y*n.x+v*n.y+s.worldX,T=S*n.x+A*n.y+s.worldY);const M=s.bone.parent.appliedPose;y=M.a,v=M.b,S=M.c,A=M.d;let Y=y*A-v*S,k=w-M.worldX,E=T-M.worldY;Y=Math.abs(Y)<=R.epsilon?0:1/Y;const X=(k*A-E*v)*Y-d,V=(E*y-k*S)*Y-f;let N=Math.sqrt(X*X+V*V),_=n.bone.data.length*p,O,F;if(N<R.epsilon){Mt.apply(e,s,i,r,!1,c,0,h),n.rotation=0;return}k=i-M.worldX,E=r-M.worldY;let P=(k*A-E*v)*Y-d,U=(E*y-k*S)*Y-f,D=P*P+U*U;if(a!==0){a*=u*(p+1)*.5;const L=Math.sqrt(D),q=L-N-_*u+a;if(q>0){let $=Math.min(1,q/(a*2))-1;$=(q-a*(1-$*$))/L,P-=$*P,U-=$*U,D=P*P+U*U}}t:if(I){_*=u;let L=(D-N*N-_*_)/(2*N*_);if(L<-1)L=-1,F=Math.PI*l;else if(L>1){if(L=1,F=0,c)switch(y=(Math.sqrt(D)/(N+_)-1)*h+1,s.scaleX*=y,o){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y<.7?.25+.642857*y:y}}else F=Math.acos(L)*l;y=N+_*L,v=_*Math.sin(F),O=Math.atan2(U*y-P*v,P*y+U*v)}else{y=u*_,v=m*_;const L=y*y,q=v*v,$=Math.atan2(U,P);S=q*N*N+L*D-L*q;const J=-2*q*N,tt=q-L;if(A=J*J-4*tt*S,A>=0){let mt=Math.sqrt(A);J<0&&(mt=-mt),mt=-(J+mt)*.5;let pt=mt/tt,jt=S/mt;const ve=Math.abs(pt)<Math.abs(jt)?pt:jt;if(pt=D-ve*ve,pt>=0){E=Math.sqrt(pt)*l,O=$-Math.atan2(E,ve),F=Math.atan2(E/m,(ve-N)/u);break t}}let K=R.PI,et=N-y,nt=et*et,st=0,ht=0,it=N+y,rt=it*it,dt=0;S=-y*N/(L-q),S>=-1&&S<=1&&(S=Math.acos(S),k=y*Math.cos(S)+N,E=v*Math.sin(S),A=k*k+E*E,A<nt&&(K=S,nt=A,et=k,st=E),A>rt&&(ht=S,rt=A,it=k,dt=E)),D<=(nt+rt)*.5?(O=$-Math.atan2(st*l,et),F=K*l):(O=$-Math.atan2(dt*l,it),F=ht*l)}const W=Math.atan2(n.y,n.x)*b;O=(O-W)*R.radDeg+g-s.rotation,O>180?O-=360:O<=-180&&(O+=360),s.rotation+=O*h,F=((F+W)*R.radDeg-n.shearX)*b+x-n.rotation,F>180?F-=360:F<=-180&&(F+=360),n.rotation+=F*h}},Wt=class extends Xt{bones=[];_target=null;set target(t){this._target=t}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(t){this._scaleYMode=t}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(t){super(t,new le)}create(t){return new en(this,t)}},ce=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(t){this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}},Ht=class extends Xt{bones=[];set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(t){super(t,new ce)}create(t){return new sn(this,t)}},bs=(t=>(t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent",t))(bs||{}),ws=(t=>(t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional",t))(ws||{}),ys=(t=>(t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale",t))(ys||{}),sn=class Yt extends Et{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(e,s){if(super(e,new ce,new ce),!s)throw new Error("skeleton cannot be null.");this.data=e,this.bones=[];for(const n of this.data.bones)this.bones.push(s.bones[n.index].constrainedPose);this.slot=s.slots[e.slot.index]}copy(e){var s=new Yt(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.slot.appliedPose.attachment;if(!(n instanceof ee))return;const i=this.appliedPose,r=i.mixRotate,l=i.mixX,c=i.mixY;if(r===0&&l===0&&c===0)return;const o=this.data,a=o.rotateMode===0,h=o.rotateMode===2,d=this.bones,f=d.length,u=a?f:f+1,m=B.setArraySize(this.spaces,u),p=h?this.lengths=B.setArraySize(this.lengths,f):[],g=i.spacing;switch(o.spacingMode){case 2:if(h)for(let v=0,S=u-1;v<S;v++){const A=d[v],I=A.bone.data.length,M=I*A.a,Y=I*A.c;p[v]=Math.sqrt(M*M+Y*Y)}B.arrayFill(m,1,u,g);break;case 3:{let v=0;for(let S=0,A=u-1;S<A;){const I=d[S],M=I.bone.data.length;if(M<R.epsilon)h&&(p[S]=0),m[++S]=g;else{const Y=M*I.a,k=M*I.c,E=Math.sqrt(Y*Y+k*k);h&&(p[S]=E),m[++S]=E,v+=E}}if(v>0){v=u/v*g;for(let S=1;S<u;S++)m[S]*=v}break}default:{const v=o.spacingMode===0;for(let S=0,A=u-1;S<A;){const I=d[S],M=I.bone.data.length;if(M<R.epsilon)h&&(p[S]=0),m[++S]=g;else{const Y=M*I.a,k=M*I.c,E=Math.sqrt(Y*Y+k*k);h&&(p[S]=E),m[++S]=(v?Math.max(0,M+g):g)*E/M}}}}const x=this.computeWorldPositions(e,n,u,a);let b=x[0],w=x[1],T=o.offsetRotation,y=!1;if(T===0)y=o.rotateMode===1;else{y=!1;const v=this.slot.bone.appliedPose;T*=v.a*v.d-v.b*v.c>0?R.degRad:-R.degRad}for(let v=0,S=3,A=e._update;v<f;v++,S+=3){const I=d[v];I.worldX+=(b-I.worldX)*l,I.worldY+=(w-I.worldY)*c;const M=x[S],Y=x[S+1],k=M-b,E=Y-w;if(h){const X=p[v];if(X!==0){const V=(Math.sqrt(k*k+E*E)/X-1)*r+1;I.a*=V,I.c*=V}}if(b=M,w=Y,r>0){let X=I.a,V=I.b,N=I.c,_=I.d,O=0,F=0,P=0;if(a?O=x[S-1]:m[v+1]===0?O=x[S+2]:O=Math.atan2(E,k),O-=Math.atan2(N,X),y){F=Math.cos(O),P=Math.sin(O);const U=I.bone.data.length;b+=(U*(F*X-P*N)-k)*r,w+=(U*(P*X+F*N)-E)*r}else O+=T;O>R.PI?O-=R.PI2:O<-R.PI&&(O+=R.PI2),O*=r,F=Math.cos(O),P=Math.sin(O),I.a=F*X-P*N,I.b=F*V-P*_,I.c=P*X+F*N,I.d=P*V+F*_}I.modifyWorld(A)}}computeWorldPositions(e,s,n,i){const r=this.slot;let l=this.appliedPose.position,c=this.spaces,o=B.setArraySize(this.positions,n*3+2),a=this.world;const h=s.closed;let d=s.worldVerticesLength,f=d/6,u=Yt.NONE;if(!s.constantSpeed){const F=s.lengths;f-=h?1:2;const P=F[f];this.data.positionMode===1&&(l*=P);let U;switch(this.data.spacingMode){case 2:U=P;break;case 3:U=P/n;break;default:U=1}a=B.setArraySize(this.world,8);for(let D=0,W=0,L=0;D<n;D++,W+=3){const q=c[D]*U;l+=q;let $=l;if(h)$%=P,$<0&&($+=P),L=0;else if($<0){u!==Yt.BEFORE&&(u=Yt.BEFORE,s.computeWorldVertices(e,r,2,4,a,0,2)),this.addBeforePosition($,a,0,o,W);continue}else if($>P){u!==Yt.AFTER&&(u=Yt.AFTER,s.computeWorldVertices(e,r,d-6,4,a,0,2)),this.addAfterPosition($-P,a,0,o,W);continue}for(;;L++){const J=F[L];if(!($>J)){if(L===0)$/=J;else{const tt=F[L-1];$=($-tt)/(J-tt)}break}}L!==u&&(u=L,h&&L===f?(s.computeWorldVertices(e,r,d-4,4,a,0,2),s.computeWorldVertices(e,r,0,4,a,4,2)):s.computeWorldVertices(e,r,L*6+2,8,a,0,2)),this.addCurvePosition($,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],o,W,i||D>0&&q===0)}return o}h?(d+=2,a=B.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d-4,a,0,2),s.computeWorldVertices(e,r,0,2,a,d-4,2),a[d-2]=a[0],a[d-1]=a[1]):(f--,d-=4,a=B.setArraySize(this.world,d),s.computeWorldVertices(e,r,2,d,a,0,2));const m=B.setArraySize(this.curves,f);let p=0,g=a[0],x=a[1],b=0,w=0,T=0,y=0,v=0,S=0,A=0,I=0,M=0,Y=0,k=0,E=0,X=0,V=0;for(let F=0,P=2;F<f;F++,P+=6)b=a[P],w=a[P+1],T=a[P+2],y=a[P+3],v=a[P+4],S=a[P+5],A=(g-b*2+T)*.1875,I=(x-w*2+y)*.1875,M=((b-T)*3-g+v)*.09375,Y=((w-y)*3-x+S)*.09375,k=A*2+M,E=I*2+Y,X=(b-g)*.75+A+M*.16666667,V=(w-x)*.75+I+Y*.16666667,p+=Math.sqrt(X*X+V*V),X+=k,V+=E,k+=M,E+=Y,p+=Math.sqrt(X*X+V*V),X+=k,V+=E,p+=Math.sqrt(X*X+V*V),X+=k+M,V+=E+Y,p+=Math.sqrt(X*X+V*V),m[F]=p,g=v,x=S;this.data.positionMode===1&&(l*=p);let N;switch(this.data.spacingMode){case 2:N=p;break;case 3:N=p/n;break;default:N=1}const _=this.segments;let O=0;for(let F=0,P=0,U=0,D=0;F<n;F++,P+=3){const W=c[F]*N;l+=W;let L=l;if(h)L%=p,L<0&&(L+=p),U=0,D=0;else if(L<0){this.addBeforePosition(L,a,0,o,P);continue}else if(L>p){this.addAfterPosition(L-p,a,d-4,o,P);continue}for(;;U++){const q=m[U];if(!(L>q)){if(U===0)L/=q;else{const $=m[U-1];L=(L-$)/(q-$)}break}}if(U!==u){u=U;let q=U*6;for(g=a[q],x=a[q+1],b=a[q+2],w=a[q+3],T=a[q+4],y=a[q+5],v=a[q+6],S=a[q+7],A=(g-b*2+T)*.03,I=(x-w*2+y)*.03,M=((b-T)*3-g+v)*.006,Y=((w-y)*3-x+S)*.006,k=A*2+M,E=I*2+Y,X=(b-g)*.3+A+M*.16666667,V=(w-x)*.3+I+Y*.16666667,O=Math.sqrt(X*X+V*V),_[0]=O,q=1;q<8;q++)X+=k,V+=E,k+=M,E+=Y,O+=Math.sqrt(X*X+V*V),_[q]=O;X+=k,V+=E,O+=Math.sqrt(X*X+V*V),_[8]=O,X+=k+M,V+=E+Y,O+=Math.sqrt(X*X+V*V),_[9]=O,D=0}for(L*=O;;D++){const q=_[D];if(!(L>q)){if(D===0)L/=q;else{const $=_[D-1];L=D+(L-$)/(q-$)}break}}this.addCurvePosition(L*.1,g,x,b,w,T,y,v,S,o,P,i||F>0&&W===0)}return o}addBeforePosition(e,s,n,i,r){const l=s[n],c=s[n+1],o=s[n+2]-l,a=s[n+3]-c,h=Math.atan2(a,o);i[r]=l+e*Math.cos(h),i[r+1]=c+e*Math.sin(h),i[r+2]=h}addAfterPosition(e,s,n,i,r){const l=s[n+2],c=s[n+3],o=l-s[n],a=c-s[n+1],h=Math.atan2(a,o);i[r]=l+e*Math.cos(h),i[r+1]=c+e*Math.sin(h),i[r+2]=h}addCurvePosition(e,s,n,i,r,l,c,o,a,h,d,f){if(e===0||Number.isNaN(e)){h[d]=s,h[d+1]=n,h[d+2]=Math.atan2(r-n,i-s);return}const u=e*e,m=u*e,p=1-e,g=p*p,x=g*p,b=p*e,w=b*3,T=p*w,y=w*e,v=s*x+i*T+l*y+o*m,S=n*x+r*T+c*y+a*m;h[d]=v,h[d+1]=S,f&&(e<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(S-(n*g+r*b*2+c*u),v-(s*g+i*b*2+l*u)))}sort(e){const s=this.slot.data.index,n=this.slot.bone;e.skin!=null&&this.sortPathSlot(e,e.skin,s,n),e.data.defaultSkin!=null&&e.data.defaultSkin!==e.skin&&this.sortPathSlot(e,e.data.defaultSkin,s,n),this.sortPath(e,this.slot.pose.attachment,n);const i=this.bones,r=this.bones.length;for(let l=0;l<r;l++){const c=i[l].bone;e.sortBone(c),e.constrained(c)}e._updateCache.push(this);for(let l=0;l<r;l++)e.sortReset(i[l].bone.children);for(let l=0;l<r;l++)i[l].bone.sorted=!0}sortPathSlot(e,s,n,i){const r=s.getAttachments();for(let l=0,c=r.length;l<c;l++){const o=r[l];o.slotIndex===n&&this.sortPath(e,o.attachment,i)}}sortPath(e,s,n){if(!(s instanceof ee))return;const i=s.bones;if(i==null)e.sortBone(n);else{const r=e.bones;for(let l=0,c=i.length;l<c;){let o=i[l++];for(o+=l;l<o;)e.sortBone(r[i[l++]])}}}isSourceActive(){return this.slot.bone.active}},nn=(t=>(t[t.none=0]="none",t[t.reset=1]="reset",t[t.update=2]="update",t[t.pose=3]="pose",t))(nn||{}),he=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(t){this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}},de=class{color=new z(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(t){if(t==null)throw new Error("pose cannot be null.");this.color.setFromColor(t.color),this.darkColor!=null&&t.darkColor!=null&&this.darkColor.setFromColor(t.darkColor),this.attachment=t.attachment,this.sequenceIndex=t.sequenceIndex,this.deform.length=0,this.deform.push(...t.deform)}getAttachment(){return this.attachment}setAttachment(t){this.attachment!==t&&((!(t instanceof xt)||!(this.attachment instanceof xt)||t.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}},rn=class Mn extends gs{skeleton;bone;attachmentState=0;constructor(e,s){if(super(e,new de,new de),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[e.boneData.index],e.setupPose.darkColor!=null&&(this.pose.darkColor=new z,this.constrainedPose.darkColor=new z),this.setupPose()}copy(e,s,n){const i=new Mn(e.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new z,i.constrainedPose.darkColor=new z),i.pose.set(e.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},an=class Ae{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Ae.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Ae.yDir}set scaleY(e){this._scaleY=e}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(e){if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=[];for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i;if(!n.parent)i=new re(n,null);else{const r=this.bones[n.parent.index];i=new re(n,r),r.children.push(i)}this.bones.push(i)}this.slots=[];for(const s of this.data.slots)this.slots.push(new rn(s,this));this.drawOrder=new tn(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const n=s.create(this);n instanceof vs&&this.physics.push(n),this.constraints.push(n)}this.color=new z(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const e=this.slots;for(let l=0,c=e.length;l<c;l++)e[l].unconstrained();const s=this.bones,n=s.length;for(let l=0,c=n;l<c;l++){const o=s[l];o.sorted=o.data.skinRequired,o.active=!o.sorted,o.unconstrained()}if(this.skin){const l=this.skin.bones;for(let c=0,o=this.skin.bones.length;c<o;c++){let a=this.bones[l[c].index];do a.sorted=!1,a.active=!0,a=a.parent;while(a)}}const i=this.constraints;let r=this.constraints.length;for(let l=0;l<r;l++)i[l].unconstrained();for(let l=0;l<r;l++){const c=i[l];c.active=c.isSourceActive()&&(!c.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(c.data)),c.active&&c.sort(this)}for(let l=0;l<n;l++)this.sortBone(s[l]);r=this._updateCache.length;for(let l=0;l<r;l++){const c=this._updateCache[l];c instanceof re&&(this._updateCache[l]=c.appliedPose)}}constrained(e){e.pose===e.appliedPose&&(e.constrained(),this.resetCache.push(e))}sortBone(e){if(e.sorted||!e.active)return;const s=e.parent;s&&this.sortBone(s),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let s=0,n=e.length;s<n;s++){const i=e[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(e){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let i=0,r=this.resetCache.length;i<r;i++)s[i].resetConstrained();const n=this._updateCache;for(let i=0,r=this._updateCache.length;i<r;i++)n[i].update(this,e)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const e=this.bones;for(let n=0,i=e.length;n<i;n++)e[n].setupPose();const s=this.constraints;for(let n=0,i=s.length;n<i;n++)s[n].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const e=this.slots;for(let s=0,n=e.length;s<n;s++)e[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");const s=this.bones;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const s=this.slots;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===e)return s[n];return null}setSkin(e){typeof e=="string"?this.setSkinByName(e):this.setSkinBySkin(e)}setSkinByName(e){const s=this.data.findSkin(e);if(!s)throw new Error(`Skin not found: ${e}`);this.setSkin(s)}setSkinBySkin(e){if(e!==this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{const s=this.slots;for(let n=0,i=s.length;n<i;n++){const r=s[n],l=r.data.attachmentName;if(l){const c=e.getAttachment(n,l);c&&r.pose.setAttachment(c)}}}this.skin=e,this.updateCache()}}getAttachment(e,s){return typeof e=="string"?this.getAttachmentByName(e,s):this.getAttachmentByIndex(e,s)}getAttachmentByName(e,s){const n=this.data.findSlot(e);if(!n)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(n.index,s)}getAttachmentByIndex(e,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const n=this.skin.getAttachment(e,s);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,s):null}setAttachment(e,s){if(!e)throw new Error("slotName cannot be null.");const n=this.findSlot(e);if(!n)throw new Error(`Slot not found: ${e}`);let i=null;if(s&&(i=this.getAttachment(n.data.index,s),!i))throw new Error(`Attachment not found: ${s}, for slot: ${e}`);n.pose.setAttachment(i)}findConstraint(e,s){if(e==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const n=this.constraints;for(let i=0,r=n.length;i<r;i++){const l=n[i];if(l instanceof s&&l.data.name===e)return l}return null}getBoundsRect(e){const s=new Me,n=new Me;return this.getBounds(s,n,void 0,e),{x:s.x,y:s.y,width:n.x,height:n.y}}getBounds(e,s,n=new Array(2),i=null){if(!e)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,l=r;let c=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let d=0,f=r.length;d<f;d++){const u=l[d];if(!u.bone.active)continue;let m=0,p=null,g=null;const x=u.appliedPose.attachment;if(x){if(x instanceof Pt)m=8,p=B.setArraySize(n,m,0),x.computeWorldVertices(u,x.getOffsets(u.appliedPose),p,0,2),g=Ae.quadTriangles;else if(x instanceof Tt)m=x.worldVerticesLength,p=B.setArraySize(n,m,0),x.computeWorldVertices(this,u,0,m,p,0,2),g=x.triangles;else if(x instanceof zt&&i){i.clipEnd(u),i.clipStart(this,u,x);continue}if(p&&g){i?.isClipping()&&i.clipTriangles(p,g,g.length)&&(p=i.clippedVertices,m=i.clippedVertices.length);for(let b=0,w=p.length;b<w;b+=2){const T=p[b],y=p[b+1];c=Math.min(c,T),o=Math.min(o,y),a=Math.max(a,T),h=Math.max(h,y)}}}i&&i.clipEnd(u)}i&&i.clipEnd(),e.set(c,o),s.set(a-c,h-o)}setScale(e,s){this.scaleX=e,this.scaleY=s}setPosition(e,s){this.x=e,this.y=s}update(e){this.time+=e}physicsTranslate(e,s){const n=this.physics;for(let i=0,r=n.length;i<r;i++)n[i].translate(e,s)}physicsRotate(e,s,n){const i=this.physics;for(let r=0,l=i.length;r<l;r++)i[r].rotate(e,s,n)}},vs=class Yn extends Et{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(e,s){if(super(e,new he,new he),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[e.bone.index].constrainedPose}copy(e){var s=new Yn(this.data,e);return s.pose.set(this.pose),s}reset(e){this.remaining=0,this.lastTime=e.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(e,s){this.ux-=e,this.uy-=s,this.cx-=e,this.cy-=s}rotate(e,s,n){const i=n*R.degRad,r=Math.cos(i),l=Math.sin(i),c=this.cx-e,o=this.cy-s;this.translate(c*r-o*l-c,c*l+o*r-o)}update(e,s){const n=this.appliedPose,i=n.mix;if(i===0)return;const r=this.data.x>0,l=this.data.y>0,c=this.data.rotate>0||this.data.shearX>0,o=this.data.scaleX>0,a=this.bone;let h=a.bone.data.length,d=this.data.step,f=0;switch(s){case 0:return;case 1:this.reset(e);case 2:{const u=Math.max(e.time-this.lastTime,0),m=this.remaining;this.remaining+=u,this.lastTime=e.time;const p=a.worldX,g=a.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let x=this.remaining,b=n.inertia,w=e.data.referenceScale,T=-1,y=0,v=0,S=this.data.limit*u,A=S*Math.abs(e.scaleY);if(S*=Math.abs(e.scaleX),r||l){if(r){const I=(this.ux-p)*b;this.xOffset+=I>S?S:I<-S?-S:I,this.ux=p}if(l){const I=(this.uy-g)*b;this.yOffset+=I>A?A:I<-A?-A:I,this.uy=g}if(x>=d){const I=this.xOffset,M=this.yOffset;T=n.damping**(60*d),y=d*n.massInverse,v=n.strength;const Y=w*n.wind,k=w*n.gravity,E=(Y*e.windX+k*e.gravityX)*e.scaleX,X=(Y*e.windY+k*e.gravityY)*e.scaleY;do r&&(this.xVelocity+=(E-this.xOffset*v)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=T),l&&(this.yVelocity-=(X+this.yOffset*v)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=T),x-=d;while(x>=d);this.xLag=this.xOffset-I,this.yLag=this.yOffset-M}f=Math.max(0,1-x/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),l&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(c||o){let I=Math.atan2(a.c,a.a),M=0,Y=0,k=0,E=this.cx-a.worldX,X=this.cy-a.worldY;if(E>S?E=S:E<-S&&(E=-S),X>A?X=A:X<-A&&(X=-A),x=this.remaining,c){k=(this.data.rotate+this.data.shearX)*i,f=this.rotateLag*Math.max(0,1-m/d);let V=Math.atan2(X+this.ty,E+this.tx)-I-(this.rotateOffset-f)*k;this.rotateOffset+=(V-Math.ceil(V*R.invPI2-.5)*R.PI2)*b,V=(this.rotateOffset-f)*k+I,M=Math.cos(V),Y=Math.sin(V),o&&(V=h*a.getWorldScaleX(),V>0&&(this.scaleOffset+=(E*M+X*Y)*b/V))}else{M=Math.cos(I),Y=Math.sin(I);const V=h*a.getWorldScaleX()-this.scaleLag*Math.max(0,1-m/d);V>0&&(this.scaleOffset+=(E*M+X*Y)*b/V)}if(x>=d){T===-1&&(T=n.damping**(60*d),y=d*n.massInverse,v=n.strength);const V=n.wind*e.windX+n.gravity*e.gravityX,N=(n.wind*e.windY+n.gravity*e.gravityY)*an.yDir,_=this.rotateOffset,O=this.scaleOffset,F=h/w;for(;;)if(x-=d,o&&(this.scaleVelocity+=(V*M-N*Y-this.scaleOffset*v)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=T),c){if(this.rotateVelocity-=((V*Y+N*M)*F+this.rotateOffset*v)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=T,x<d)break;const P=this.rotateOffset*k+I;M=Math.cos(P),Y=Math.sin(P)}else if(x<d)break;this.rotateLag=this.rotateOffset-_,this.scaleLag=this.scaleOffset-O}f=Math.max(0,1-x/d)}this.remaining=x}this.cx=a.worldX,this.cy=a.worldY;break}case 3:f=Math.max(0,1-this.remaining/d),r&&(a.worldX+=(this.xOffset-this.xLag*f)*i*this.data.x),l&&(a.worldY+=(this.yOffset-this.yLag*f)*i*this.data.y)}if(c){let u=(this.rotateOffset-this.rotateLag*f)*i,m=0,p=0,g=0;if(this.data.shearX>0){let x=0;this.data.rotate>0&&(x=u*this.data.rotate,m=Math.sin(x),p=Math.cos(x),g=a.b,a.b=p*g-m*a.d,a.d=m*g+p*a.d),x+=u*this.data.shearX,m=Math.sin(x),p=Math.cos(x),g=a.a,a.a=p*g-m*a.c,a.c=m*g+p*a.c}else u*=this.data.rotate,m=Math.sin(u),p=Math.cos(u),g=a.a,a.a=p*g-m*a.c,a.c=m*g+p*a.c,g=a.b,a.b=p*g-m*a.d,a.d=m*g+p*a.d}if(o){let u=1+(this.scaleOffset-this.scaleLag*f)*i*this.data.scaleX;switch(a.a*=u,a.c*=u,this.data.scaleYMode){case 1:a.b*=u,a.d*=u;break;case 2:u=Math.abs(u),u=u>=.7?1/u:4-3.67347*u,a.b*=u,a.d*=u}}s!==3&&(this.tx=h*a.a,this.ty=h*a.c),a.modifyWorld(e._update)}sort(e){const s=this.bone.bone;e.sortBone(s),e._updateCache.push(this),e.sortReset(s.children),e.constrained(s)}isSourceActive(){return this.bone.bone.active}},Gt=class extends Xt{set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;_scaleYMode=0;get scaleYMode(){return this._scaleYMode}set scaleYMode(t){if(t==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=t}constructor(t){super(t,new he)}create(t){return new vs(this,t)}};typeof Math.fround>"u"&&(Math.fround=(t=>e=>(t[0]=e,t[0]))(new Float32Array(1)));var fe=class{time=0;mix=0;set(t){this.time=t.time,this.mix=t.mix}},on=class Ls extends Et{static offsets=[0,0,0,0,0,0];bone=null;constructor(e,s){if(super(e,new fe,new fe),!s)throw new Error("skeleton cannot be null.");e.bone!=null&&(this.bone=s.bones[e.bone.index])}copy(e){var s=new Ls(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.data,r=i.animation,l=this.bone;if(l!==null){if(!l.active)return;i.local&&l.appliedPose.validateLocalTransform(e),n.time=i.offset+(i.property.value(e,l.appliedPose,i.local,Ls.offsets)-i.property.offset)*i.scale,i.loop?n.time=r.duration+n.time%r.duration:n.time=Math.max(0,n.time)}const c=e.bones,o=r.bones;for(let a=0,h=r.bones.length;a<h;a++)c[o[a]].appliedPose.modifyLocal(e);r.apply(e,n.time,n.time,i.loop,null,n.mix,!1,i.additive,!1,!0)}sort(e){const s=this.bone,n=this.data;s&&!n.local&&e.sortBone(s),e._updateCache.push(this);const i=e.bones,r=n.animation.bones;for(let d=0,f=n.animation.bones.length;d<f;d++){const u=i[r[d]];u.sorted=!1,e.sortReset(u.children),e.constrained(u)}const l=n.animation.timelines,c=e.slots,o=e.constraints,a=e.physics,h=e.physics.length;for(let d=0,f=n.animation.timelines.length;d<f;d++){const u=l[d];if(qs(u))e.constrained(c[u.slotIndex]);else if(u instanceof St||u instanceof $t)e.drawOrder.constrained();else if(u instanceof gt)if(u.constraintIndex===-1)for(let m=0;m<h;m++)e.constrained(a[m]);else e.constrained(o[u.constraintIndex]);else if(Ws(u)){const m=u.constraintIndex;m!==-1&&e.constrained(o[m])}}}},yt=class extends Xt{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;max=0;constructor(t){super(t,new fe)}create(t){return new on(this,t)}},Ts=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findSliderAnimations(t){const e=this.constraints;for(let s=0,n=this.constraints.length;s<n;s++){const i=e[s];i instanceof yt&&i.animation!=null&&t.push(i.animation)}return t}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,n=e.length;s<n;s++)if(e[s].name===t)return e[s];return null}findConstraint(t,e){if(!t)throw new Error("constraintName cannot be null.");if(e==null)throw new Error("type cannot be null.");const s=this.constraints;for(let n=0,i=this.constraints.length;n<i;n++){const r=s[n];if(r instanceof e&&r.name===t)return r}return null}},Ss=class{slotIndex=0;placeholder;attachment;constructor(t=0,e,s){this.slotIndex=t,this.placeholder=e,this.attachment=s}},ue=class{name;attachments=[];bones=[];constraints=[];color=new z(.99607843,.61960787,.30980393,1);constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<t.constraints.length;s++){const n=t.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const n=e[s];n.attachment&&(n.attachment instanceof Tt?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=[];for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const n in s){const i=s[n];i&&t.push(new Ss(e,n,i))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const n in s){const i=s[n];i&&e.push(new Ss(t,n,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let n=0;n<t.slots.length;n++){const i=t.slots[n],r=i.pose.getAttachment();if(r&&s<e.attachments.length){const l=e.attachments[s];for(const c in l){const o=l[c];if(r===o){const a=this.getAttachment(s,c);a&&i.pose.setAttachment(a);break}}}s++}}},As=class extends se{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(t,e,s){if(super(e,new de),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.boneData=s}},Is=(t=>(t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen",t))(Is||{}),me=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(t){this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}},ln=class Pn extends Et{bones;source;constructor(e,s){if(super(e,new me,new me),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of e.bones)this.bones.push(s.bones[i.index].constrainedPose);const n=s.bones[e.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(e){var s=new Pn(this.data,e);return s.pose.set(this.pose),s}update(e,s){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const i=this.data,r=i.localSource,l=i.localTarget,c=i.additive,o=i.clamp,a=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(e);const d=i.properties,f=i.properties.length,u=e._update,m=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const x=m[p];l?x.modifyLocal(e):x.modifyWorld(u);for(let b=0;b<f;b++){const w=d[b],T=w.value(e,h,r,a)-w.offset,y=w.to;for(let v=0,S=w.to.length;v<S;v++){const A=y[v];if(A.mix(n)!==0){let I=A.offset+T*A.scale;o&&(A.offset<A.max?I=R.clamp(I,A.offset,A.max):I=R.clamp(I,A.max,A.offset)),A.apply(e,n,x,I,l,c)}}}}}sort(e){this.data.localSource||e.sortBone(this.source);const s=this.bones,n=this.bones.length,i=!this.data.localTarget;if(i)for(let r=0;r<n;r++)e.sortBone(s[r].bone);e._updateCache.push(this);for(let r=0;r<n;r++){const l=s[r].bone;e.sortReset(l.children),e.constrained(l)}for(let r=0;r<n;r++)s[r].bone.sorted=i}isSourceActive(){return this.source.active}},j=class ct extends Xt{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(e){this._source=e}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(e){super(e,new me)}create(e){return new ln(this,e)}getOffsetRotation(){return this.offsets[ct.ROTATION]}setOffsetRotation(e){this.offsets[ct.ROTATION]=e}getOffsetX(){return this.offsets[ct.X]}setOffsetX(e){this.offsets[ct.X]=e}getOffsetY(){return this.offsets[ct.Y]}setOffsetY(e){this.offsets[ct.Y]=e}getOffsetScaleX(){return this.offsets[ct.SCALEX]}setOffsetScaleX(e){this.offsets[ct.SCALEX]=e}getOffsetScaleY(){return this.offsets[ct.SCALEY]}setOffsetScaleY(e){this.offsets[ct.SCALEY]=e}getOffsetShearY(){return this.offsets[ct.SHEARY]}setOffsetShearY(e){this.offsets[ct.SHEARY]=e}},At=class{offset=0;to=[]},It=class{offset=0;max=0;scale=0},ge=class extends At{value(t,e,s,n){if(s)return e.rotation+n[j.ROTATION];const i=t.scaleX,r=t.scaleY;let l=Math.atan2(e.c/r,e.a/i)*R.radDeg+((e.a*e.d-e.b*e.c)*i*r>0?n[j.ROTATION]:-n[j.ROTATION]);return l<0&&(l+=360),l}},Cs=class extends It{mix(t){return t.mixRotate}apply(t,e,s,n,i,r){if(i)s.rotation+=(r?n:n-s.rotation)*e.mixRotate;else{const l=t.scaleX,c=t.scaleY,o=1/l,a=1/c,h=s.a*o,d=s.b*o,f=s.c*a,u=s.d*a;n*=R.degRad,r||(n-=Math.atan2(f,h)),n>R.PI?n-=R.PI2:n<-R.PI&&(n+=R.PI2),n*=e.mixRotate;const m=Math.cos(n),p=Math.sin(n);s.a=(m*h-p*f)*l,s.b=(m*d-p*u)*l,s.c=(p*h+m*f)*c,s.d=(p*d+m*u)*c}}},pe=class extends At{value(t,e,s,n){return s?e.x+n[j.X]:(n[j.X]*e.a+n[j.Y]*e.b+e.worldX)/t.scaleX}},Ms=class extends It{mix(t){return t.mixX}apply(t,e,s,n,i,r){i?s.x+=(r?n:n-s.x)*e.mixX:(r||(n-=s.worldX/t.scaleX),s.worldX+=n*e.mixX*t.scaleX)}},xe=class extends At{value(t,e,s,n){return s?e.y+n[j.Y]:(n[j.X]*e.c+n[j.Y]*e.d+e.worldY)/t.scaleY}},Ys=class extends It{mix(t){return t.mixY}apply(t,e,s,n,i,r){i?s.y+=(r?n:n-s.y)*e.mixY:(r||(n-=s.worldY/t.scaleY),s.worldY+=n*e.mixY*t.scaleY)}},be=class extends At{value(t,e,s,n){if(s)return e.scaleX+n[j.SCALEX];const i=e.a/t.scaleX,r=e.c/t.scaleY;return Math.sqrt(i*i+r*r)+n[j.SCALEX]}},Ps=class extends It{mix(t){return t.mixScaleX}apply(t,e,s,n,i,r){if(i)r?s.scaleX*=1+(n-1)*e.mixScaleX:s.scaleX!==0&&(s.scaleX+=(n-s.scaleX)*e.mixScaleX);else if(r){const l=1+(n-1)*e.mixScaleX;s.a*=l,s.c*=l}else{let l=s.a/t.scaleX,c=s.c/t.scaleY,o=Math.sqrt(l*l+c*c);o!==0&&(o=1+(n-o)*e.mixScaleX/o,s.a*=o,s.c*=o)}}},we=class extends At{value(t,e,s,n){if(s)return e.scaleY+n[j.SCALEY];const i=e.b/t.scaleX,r=e.d/t.scaleY;return Math.sqrt(i*i+r*r)+n[j.SCALEY]}},Fs=class extends It{mix(t){return t.mixScaleY}apply(t,e,s,n,i,r){if(i)r?s.scaleY*=1+(n-1)*e.mixScaleY:s.scaleY!==0&&(s.scaleY+=(n-s.scaleY)*e.mixScaleY);else if(r){const l=1+(n-1)*e.mixScaleY;s.b*=l,s.d*=l}else{let l=s.b/t.scaleX,c=s.d/t.scaleY,o=Math.sqrt(l*l+c*c);o!==0&&(o=1+(n-o)*e.mixScaleY/o,s.b*=o,s.d*=o)}}},ye=class extends At{value(t,e,s,n){if(s)return e.shearY+n[j.SHEARY];const i=1/t.scaleX,r=1/t.scaleY;return(Math.atan2(e.d*r,e.b*i)-Math.atan2(e.c*r,e.a*i))*R.radDeg-90+n[j.SHEARY]}},ks=class extends It{mix(t){return t.mixShearY}apply(t,e,s,n,i,r){if(i)r||(n-=s.shearY),s.shearY+=n*e.mixShearY;else{const l=t.scaleX,c=t.scaleY,o=s.b/l,a=s.d/c,h=Math.atan2(a,o);n=(n+90)*R.degRad,r?n-=R.PI/2:(n-=h-Math.atan2(s.c/c,s.a/l),n>R.PI?n-=R.PI2:n<-R.PI&&(n+=R.PI2)),n=h+n*e.mixShearY;const d=Math.sqrt(o*o+a*a);s.b=Math.cos(n)*d*l,s.d=Math.sin(n)*d*c}}},Gn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Ts;s.name="";const n=new cn(t),i=n.readInt32(),r=n.readInt32();s.hash=r===0&&i===0?null:r.toString(16)+i.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*e;const l=n.readBoolean();l&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let c=0;c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("String in string table must not be null.");n.strings.push(m)}const o=s.bones;c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Bone name must not be null.");const p=u===0?null:o[n.readInt(!0)],g=new ms(u,m,p),x=g.setupPose;x.rotation=n.readFloat(),x.x=n.readFloat()*e,x.y=n.readFloat()*e,x.scaleX=n.readFloat(),x.scaleY=n.readFloat(),x.shearX=n.readFloat(),x.shearY=n.readFloat(),x.inherit=n.readByte(),g.length=n.readFloat()*e,g.skinRequired=n.readBoolean(),l&&(z.rgba8888ToColor(g.color,n.readInt32()),g.icon=n.readString()??void 0,g.iconSize=n.readFloat(),g.iconRotation=n.readFloat(),g.visible=n.readBoolean()),o.push(g)}c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Slot name must not be null.");const p=o[n.readInt(!0)],g=new As(u,m,p);z.rgba8888ToColor(g.setupPose.color,n.readInt32());const x=n.readInt32();x!==-1&&z.rgb888ToColor(g.setupPose.darkColor=new z,x),g.attachmentName=n.readStringRef(),g.blendMode=n.readInt(!0),l&&(g.visible=n.readBoolean()),s.slots.push(g)}const a=s.constraints,h=n.readInt(!0);for(let u=0;u<h;u++){const m=n.readString();if(!m)throw new Error("Constraint data name must not be null.");let p;switch(n.readByte()){case gi:{const g=new Wt(m);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.target=o[n.readInt(!0)];const x=n.readByte();g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.scaleYMode=n.readUnsignedByte());const b=g.setupPose;b.bendDirection=(x&4)!==0?-1:1,b.compress=(x&8)!==0,b.stretch=(x&16)!==0,(x&32)!==0&&(b.mix=(x&64)!==0?n.readFloat():1),(x&128)!==0&&(b.softness=n.readFloat()*e),a.push(g);break}case xi:{const g=new j(m);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.source=o[n.readInt(!0)];let x=n.readUnsignedByte();g.skinRequired=(x&1)!==0,g.localSource=(x&2)!==0,g.localTarget=(x&4)!==0,g.additive=(x&8)!==0,g.clamp=(x&16)!==0,p=x>>5;for(let w=0,T;w<p;w++){let y=1,v;switch(n.readByte()){case 0:v=new ge;break;case 1:{y=e,v=new pe;break}case 2:{y=e,v=new xe;break}case 3:v=new be;break;case 4:v=new we;break;case 5:v=new ye;break;default:v=null}if(v){v.offset=n.readFloat()*y,T=n.readByte();for(let S=0;S<T;S++){let A=1,I;switch(n.readByte()){case 0:I=new Cs;break;case 1:{A=e,I=new Ms;break}case 2:{A=e,I=new Ys;break}case 3:I=new Ps;break;case 4:I=new Fs;break;case 5:I=new ks;break;default:I=null}I&&(I.offset=n.readFloat()*A,I.max=n.readFloat()*A,I.scale=n.readFloat()*A/y,v.to[S]=I)}g.properties[w]=v}}x=n.readByte(),(x&1)!==0&&(g.offsets[j.ROTATION]=n.readFloat()),(x&2)!==0&&(g.offsets[j.X]=n.readFloat()*e),(x&4)!==0&&(g.offsets[j.Y]=n.readFloat()*e),(x&8)!==0&&(g.offsets[j.SCALEX]=n.readFloat()),(x&16)!==0&&(g.offsets[j.SCALEY]=n.readFloat()),(x&32)!==0&&(g.offsets[j.SHEARY]=n.readFloat()),x=n.readByte();const b=g.setupPose;(x&1)!==0&&(b.mixRotate=n.readFloat()),(x&2)!==0&&(b.mixX=n.readFloat()),(x&4)!==0&&(b.mixY=n.readFloat()),(x&8)!==0&&(b.mixScaleX=n.readFloat()),(x&16)!==0&&(b.mixScaleY=n.readFloat()),(x&32)!==0&&(b.mixShearY=n.readFloat()),a.push(g);break}case pi:{const g=new Ht(m);p=n.readInt(!0);for(let w=0;w<p;w++)g.bones.push(o[n.readInt(!0)]);g.slot=s.slots[n.readInt(!0)];const x=n.readByte();g.skinRequired=(x&1)!==0,g.positionMode=x>>1&1,g.spacingMode=x>>2&3,g.rotateMode=x>>4&3,(x&128)!==0&&(g.offsetRotation=n.readFloat());const b=g.setupPose;b.position=n.readFloat(),g.positionMode===0&&(b.position*=e),b.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(b.spacing*=e),b.mixRotate=n.readFloat(),b.mixX=n.readFloat(),b.mixY=n.readFloat(),a.push(g);break}case bi:{const g=new Gt(m);g.bone=o[n.readInt(!0)];let x=n.readByte();if(g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.x=n.readFloat()),(x&4)!==0&&(g.y=n.readFloat()),(x&8)!==0&&(g.rotate=n.readFloat()),(x&16)!==0){let w=n.readFloat();w<-2?(g.scaleYMode=2,w=-2-w):w<0&&(g.scaleYMode=1,w=-1-w),g.scaleX=w}(x&32)!==0&&(g.shearX=n.readFloat()),g.limit=((x&64)!==0?n.readFloat():5e3)*e,g.step=1/n.readUnsignedByte();const b=g.setupPose;b.inertia=n.readFloat(),b.strength=n.readFloat(),b.damping=n.readFloat(),b.massInverse=(x&128)!==0?n.readFloat():1,b.wind=n.readFloat(),b.gravity=n.readFloat(),x=n.readByte(),(x&1)!==0&&(g.inertiaGlobal=!0),(x&2)!==0&&(g.strengthGlobal=!0),(x&4)!==0&&(g.dampingGlobal=!0),(x&8)!==0&&(g.massGlobal=!0),(x&16)!==0&&(g.windGlobal=!0),(x&32)!==0&&(g.gravityGlobal=!0),(x&64)!==0&&(g.mixGlobal=!0),b.mix=(x&128)!==0?n.readFloat():1,a.push(g);break}case wi:{const g=new yt(m),x=n.readByte();if(g.skinRequired=(x&1)!==0,g.loop=(x&2)!==0,g.additive=(x&4)!==0,(x&8)!==0){const b=n.readFloat();l&&(x&64)!==0?g.max=b:g.setupPose.time=b}if((x&16)!==0&&(g.setupPose.mix=(x&32)!==0?n.readFloat():1),(x&64)!==0){g.local=(x&128)!==0,g.bone=o[n.readInt(!0)];const b=n.readFloat();let w=1;switch(n.readByte()){case 0:g.property=new ge;break;case 1:{w=e,g.property=new pe;break}case 2:{w=e,g.property=new xe;break}case 3:g.property=new be;break;case 4:g.property=new we;break;case 5:g.property=new ye;break;default:continue}g.property.offset=b*w,g.offset=n.readFloat(),g.scale=n.readFloat()/w}a.push(g);break}}}const d=this.readSkin(n,s,!0,l);d&&(s.defaultSkin=d,s.skins.push(d));{let u=s.skins.length;for(B.setArraySize(s.skins,c=u+n.readInt(!0));u<c;u++){const m=this.readSkin(n,s,!1,l);if(!m)throw new Error("readSkin() should not have returned null.");s.skins[u]=m}}c=this.linkedMeshes.length;for(let u=0;u<c;u++){const m=this.linkedMeshes[u],p=s.skins[m.skinIndex];if(!m.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(m.sourceIndex,m.source);if(!g)throw new Error(`Source mesh not found: ${m.source}`);m.mesh.timelineAttachment=m.inheritTimelines?g:m.mesh,m.mesh.setSourceMesh(g),m.mesh.updateSequence()}this.linkedMeshes.length=0,c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Event data name must not be null");const p=new xs(m),g=p.setupPose;g.intValue=n.readInt(!1),g.floatValue=n.readFloat(),g.stringValue=n.readString(),p._audioPath=n.readString(),p.audioPath&&(g.volume=n.readFloat(),g.balance=n.readFloat()),s.events.push(p)}const f=s.animations;c=n.readInt(!0);for(let u=0;u<c;u++){const m=n.readString();if(!m)throw new Error("Animation name must not be null.");f.push(this.readAnimation(n,m,s,l))}for(let u=0;u<h;u++){const m=a[u];m instanceof yt&&(m.animation=f[n.readInt(!0)])}return s}readSkin(t,e,s,n){let i=null,r=0;if(s){if(r=t.readInt(!0),r===0)return null;i=new ue("default")}else{const l=t.readString();if(!l)throw new Error("Skin name must not be null.");i=new ue(l),n&&z.rgba8888ToColor(i.color,t.readInt32());let c=t.readInt(!0),o=e.bones,a=i.bones;for(let h=0;h<c;h++)a[h]=o[t.readInt(!0)];c=t.readInt(!0),o=e.constraints,a=i.constraints;for(let h=0;h<c;h++)a[h]=o[t.readInt(!0)];r=t.readInt(!0)}for(let l=0;l<r;l++){const c=t.readInt(!0);for(let o=0,a=t.readInt(!0);o<a;o++){const h=t.readStringRef();if(!h)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,i,c,h,n);d&&i.setAttachment(c,h,d)}}return i}readAttachment(t,e,s,n,i,r){const l=this.scale,c=t.readByte(),o=(c&8)!==0?t.readStringRef():i;if(!o)throw new Error("Attachment name must not be null");switch(c&7){case 0:{let a=(c&16)!==0?t.readStringRef():null;const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=(c&128)!==0?t.readFloat():0,u=t.readFloat(),m=t.readFloat(),p=t.readFloat(),g=t.readFloat(),x=t.readFloat(),b=t.readFloat();a||(a=o);const w=this.attachmentLoader.newRegionAttachment(s,i,o,a,d);return w?(w.path=a,w.x=u*l,w.y=m*l,w.scaleX=p,w.scaleY=g,w.rotation=f,w.width=x*l,w.height=b*l,z.rgba8888ToColor(w.color,h),w.updateSequence(),w):null}case 1:{const a=this.readVertices(t,(c&16)!==0),h=r?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,i,o);return d?(d.worldVerticesLength=a.length,d.vertices=a.vertices,d.bones=a.bones,r&&z.rgba8888ToColor(d.color,h),d):null}case 2:{let a=(c&16)!==0?t.readStringRef():o;const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=t.readInt(!0),u=this.readVertices(t,(c&128)!==0),m=this.readFloatArray(t,u.length,1),p=this.readShortArray(t,(u.length-f-2)*3),g=t.readInt(!0);let x=null;if(g>0){x=[];for(let v=0;v<g;v++)x[v]=t.readInt(!0)}let b=[],w=0,T=0;r&&(b=this.readShortArray(t,t.readInt(!0)),w=t.readFloat(),T=t.readFloat()),a||(a=o);const y=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return y?(y.path=a,z.rgba8888ToColor(y.color,h),y.hullLength=f<<1,y.bones=u.bones,y.vertices=u.vertices,y.worldVerticesLength=u.length,y.regionUVs=m,y.triangles=p,x&&(y.timelineSlots=x),r&&(y.edges=b,y.width=w*l,y.height=T*l),y.updateSequence(),y):null}case 3:{const a=(c&16)!==0?t.readStringRef():o;if(a==null)throw new Error("Path of linked mesh must not be null");const h=(c&32)!==0?t.readInt32():4294967295,d=this.readSequence(t,(c&64)!==0),f=(c&128)!==0,u=t.readInt(!0),m=t.readInt(!0),p=t.readStringRef();let g=0,x=0;r&&(g=t.readFloat(),x=t.readFloat());const b=this.attachmentLoader.newMeshAttachment(s,i,o,a,d);return b?(b.path=a,z.rgba8888ToColor(b.color,h),r&&(b.width=g*l,b.height=x*l),this.linkedMeshes.push(new jn(b,m,n,u,p,f)),b):null}case 4:{const a=(c&16)!==0,h=(c&32)!==0,d=this.readVertices(t,(c&64)!==0),f=this.readFloatArray(t,d.length/6,l),u=r?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,i,o);return m?(m.closed=a,m.constantSpeed=h,m.worldVerticesLength=d.length,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,r&&z.rgba8888ToColor(m.color,u),m):null}case 5:{const a=t.readFloat(),h=t.readFloat(),d=t.readFloat(),f=r?t.readInt32():0,u=this.attachmentLoader.newPointAttachment(s,i,o);return u?(u.x=h*l,u.y=d*l,u.rotation=a,r&&z.rgba8888ToColor(u.color,f),u):null}case 6:{const a=t.readInt(!0),h=this.readVertices(t,(c&16)!==0),d=r?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,i,o);return f?(f.endSlot=e.slots[a],f.convex=(c&32)!==0,f.inverse=(c&64)!==0,f.worldVerticesLength=h.length,f.vertices=h.vertices,f.bones=h.bones,r&&z.rgba8888ToColor(f.color,d),f):null}}}readSequence(t,e){if(!e)return new Ot(1,!1);const s=new Ot(t.readInt(!0),!0);return s.start=t.readInt(!0),s.digits=t.readInt(!0),s.setupIndex=t.readInt(!0),s}readVertices(t,e){const s=this.scale,i=t.readInt(!0)<<1;if(!e)return new hn(null,this.readFloatArray(t,i,s),i);const r=t.readInt(!0),l=[],c=[];for(let o=0,a=0;o<r;){const h=t.readInt(!0);l[o++]=h;for(let d=0;d<h;d++,a+=3)l[o++]=t.readInt(!0),c[a]=t.readFloat()*s,c[a+1]=t.readFloat()*s,c[a+2]=t.readFloat()}return new hn(l,B.toFloatArray(c),i)}readFloatArray(t,e,s){const n=[];if(s===1)for(let i=0;i<e;i++)n[i]=t.readFloat();else for(let i=0;i<e;i++)n[i]=t.readFloat()*s;return n}readShortArray(t,e){const s=[];for(let n=0;n<e;n++)s[n]=t.readInt(!0);return s}readAnimation(t,e,s,n){t.readInt(!0);const i=[],r=this.scale;for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0),w=b-1;switch(x){case ci:{const T=new Ft(b,m);for(let y=0;y<b;y++)T.setFrame(y,t.readFloat(),t.readStringRef());i.push(T);break}case hi:{const T=t.readInt(!0),y=new _e(b,T,m);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255;for(let Y=0,k=0;y.setFrame(Y,v,S,A,I,M),Y!==w;Y++){const E=t.readFloat(),X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,N=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(Y);break;case ut:H(t,y,k++,Y,0,v,E,S,X,1),H(t,y,k++,Y,1,v,E,A,V,1),H(t,y,k++,Y,2,v,E,I,N,1),H(t,y,k++,Y,3,v,E,M,_,1)}v=E,S=X,A=V,I=N,M=_}i.push(y);break}case di:{const T=t.readInt(!0),y=new qe(b,T,m);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,Y=0;y.setFrame(M,v,S,A,I),M!==w;M++){const k=t.readFloat(),E=t.readUnsignedByte()/255,X=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(M);break;case ut:H(t,y,Y++,M,0,v,k,S,E,1),H(t,y,Y++,M,1,v,k,A,X,1),H(t,y,Y++,M,2,v,k,I,V,1)}v=k,S=E,A=X,I=V}i.push(y);break}case fi:{const T=t.readInt(!0),y=new We(b,T,m);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let X=0,V=0;y.setFrame(X,v,S,A,I,M,Y,k,E),X!==w;X++){const N=t.readFloat(),_=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,D=t.readUnsignedByte()/255,W=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(X);break;case ut:H(t,y,V++,X,0,v,N,S,_,1),H(t,y,V++,X,1,v,N,A,O,1),H(t,y,V++,X,2,v,N,I,F,1),H(t,y,V++,X,3,v,N,M,P,1),H(t,y,V++,X,4,v,N,Y,U,1),H(t,y,V++,X,5,v,N,k,D,1),H(t,y,V++,X,6,v,N,E,W,1)}v=N,S=_,A=O,I=F,M=P,Y=U,k=D,E=W}i.push(y);break}case ui:{const T=t.readInt(!0),y=new He(b,T,m);let v=t.readFloat(),S=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,Y=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255;for(let E=0,X=0;y.setFrame(E,v,S,A,I,M,Y,k),E!==w;E++){const V=t.readFloat(),N=t.readUnsignedByte()/255,_=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255,F=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255;switch(t.readByte()){case ft:y.setStepped(E);break;case ut:H(t,y,X++,E,0,v,V,S,N,1),H(t,y,X++,E,1,v,V,A,_,1),H(t,y,X++,E,2,v,V,I,O,1),H(t,y,X++,E,3,v,V,M,F,1),H(t,y,X++,E,4,v,V,Y,P,1),H(t,y,X++,E,5,v,V,k,U,1)}v=V,S=N,A=_,I=O,M=F,Y=P,k=U}i.push(y);break}case mi:{const T=new ze(b,t.readInt(!0),m);let y=t.readFloat(),v=t.readUnsignedByte()/255;for(let S=0,A=0;T.setFrame(S,y,v),S!==w;S++){const I=t.readFloat(),M=t.readUnsignedByte()/255;switch(t.readByte()){case ft:T.setStepped(S);break;case ut:H(t,T,A++,S,0,y,I,v,M,1)}y=I,v=M}i.push(T)}}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0);if(x===li){const T=new $e(b,m);for(let y=0;y<b;y++)T.setFrame(y,t.readFloat(),t.readByte());i.push(T);continue}const w=t.readInt(!0);switch(x){case Qn:Z(t,i,new Dt(b,w,m),1);break;case Zn:Z(t,i,new Xe(b,w,m),r);break;case ti:Z(t,i,new Ve(b,w,m),r);break;case ei:Z(t,i,new Re(b,w,m),r);break;case si:Z(t,i,new Le(b,w,m),1);break;case ni:Z(t,i,new Be(b,w,m),1);break;case ii:Z(t,i,new Oe(b,w,m),1);break;case ri:Z(t,i,new Ne(b,w,m),1);break;case ai:Z(t,i,new De(b,w,m),1);break;case oi:Z(t,i,new Ue(b,w,m),1);break}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0),p=t.readInt(!0),g=p-1,x=new Je(p,t.readInt(!0),m);let b=t.readByte(),w=t.readFloat(),T=(b&1)!==0?(b&2)!==0?t.readFloat():1:0,y=(b&4)!==0?t.readFloat()*r:0;for(let v=0,S=0;x.setFrame(v,w,T,y,(b&8)!==0?1:-1,(b&16)!==0,(b&32)!==0),v!==g;v++){b=t.readByte();const A=t.readFloat(),I=(b&1)!==0?(b&2)!==0?t.readFloat():1:0,M=(b&4)!==0?t.readFloat()*r:0;(b&64)!==0?x.setStepped(v):(b&128)!==0&&(H(t,x,S++,v,0,w,A,T,I,1),H(t,x,S++,v,1,w,A,y,M,r)),w=A,T=I,y=M}i.push(x)}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0),p=t.readInt(!0),g=p-1,x=new Ke(p,t.readInt(!0),m);let b=t.readFloat(),w=t.readFloat(),T=t.readFloat(),y=t.readFloat(),v=t.readFloat(),S=t.readFloat(),A=t.readFloat();for(let I=0,M=0;x.setFrame(I,b,w,T,y,v,S,A),I!==g;I++){const Y=t.readFloat(),k=t.readFloat(),E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),N=t.readFloat(),_=t.readFloat();switch(t.readByte()){case ft:x.setStepped(I);break;case ut:H(t,x,M++,I,0,b,Y,w,k,1),H(t,x,M++,I,1,b,Y,T,E,1),H(t,x,M++,I,2,b,Y,y,X,1),H(t,x,M++,I,3,b,Y,v,V,1),H(t,x,M++,I,4,b,Y,S,N,1),H(t,x,M++,I,5,b,Y,A,_,1)}b=Y,w=k,T=E,y=X,v=V,S=N,A=_}i.push(x)}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0),p=s.constraints[m];for(let g=0,x=t.readInt(!0);g<x;g++){const b=t.readByte(),w=t.readInt(!0),T=t.readInt(!0);switch(b){case Ti:Z(t,i,new Qe(w,T,m),p.positionMode===0?r:1);break;case Si:Z(t,i,new Ze(w,T,m),p.spacingMode===0||p.spacingMode===1?r:1);break;case Ai:{const y=new ts(w,T,m);let v=t.readFloat(),S=t.readFloat(),A=t.readFloat(),I=t.readFloat();for(let M=0,Y=0,k=y.getFrameCount()-1;y.setFrame(M,v,S,A,I),M!==k;M++){const E=t.readFloat(),X=t.readFloat(),V=t.readFloat(),N=t.readFloat();switch(t.readByte()){case ft:y.setStepped(M);break;case ut:H(t,y,Y++,M,0,v,E,S,X,1),H(t,y,Y++,M,1,v,E,A,V,1),H(t,y,Y++,M,2,v,E,I,N,1)}v=E,S=X,A=V,I=N}i.push(y)}}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0)-1;for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0);if(x===Ei){const T=new ls(b,m);for(let y=0;y<b;y++)T.setFrame(y,t.readFloat());i.push(T);continue}const w=t.readInt(!0);switch(x){case Ii:Z(t,i,new es(b,w,m),1);break;case Ci:Z(t,i,new ss(b,w,m),1);break;case Mi:Z(t,i,new ns(b,w,m),1);break;case Yi:Z(t,i,new is(b,w,m),1);break;case Pi:Z(t,i,new rs(b,w,m),1);break;case Fi:Z(t,i,new as(b,w,m),1);break;case ki:Z(t,i,new os(b,w,m),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=t.readInt(!0);for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readByte(),b=t.readInt(!0),w=t.readInt(!0);switch(x){case Xi:Z(t,i,new cs(b,w,m),1);break;case Vi:Z(t,i,new hs(b,w,m),1);break;default:throw new Error(`Uknown slider type: ${x}`)}}}for(let f=0,u=t.readInt(!0);f<u;f++){const m=s.skins[t.readInt(!0)];for(let p=0,g=t.readInt(!0);p<g;p++){const x=t.readInt(!0);for(let b=0,w=t.readInt(!0);b<w;b++){const T=t.readStringRef();if(!T)throw new Error("attachmentName must not be null.");const y=m.getAttachment(x,T),v=t.readByte(),S=t.readInt(!0),A=S-1;switch(v){case yi:{const I=y,M=I.bones,Y=I.vertices,k=M?Y.length/3*2:Y.length,E=t.readInt(!0),X=new Ge(S,E,x,I);let V=t.readFloat();for(let N=0,_=0;;N++){let O,F=t.readInt(!0);if(F===0)O=M?B.newFloatArray(k):Y;else{O=B.newFloatArray(k);const U=t.readInt(!0);if(F+=U,r===1)for(let D=U;D<F;D++)O[D]=t.readFloat();else for(let D=U;D<F;D++)O[D]=t.readFloat()*r;if(!M)for(let D=0,W=O.length;D<W;D++)O[D]+=Y[D]}if(X.setFrame(N,V,O),N===A)break;const P=t.readFloat();switch(t.readByte()){case ft:X.setStepped(N);break;case ut:H(t,X,_++,N,0,V,P,0,1,1)}V=P}i.push(X);break}case vi:{const I=new je(S,x,y);for(let M=0;M<S;M++){const Y=t.readFloat(),k=t.readInt32();I.setFrame(M,Y,Ee[k&15],k>>4,t.readFloat())}i.push(I);break}}}}}const l=s.slots.length,c=t.readInt(!0);if(c>0){const f=new St(c);for(let u=0;u<c;u++)f.setFrame(u,t.readFloat(),dn(t,l));i.push(f)}const o=t.readInt(!0);for(let f=0;f<o;f++){const u=t.readInt(!0),m=new Array(u);for(let x=0;x<u;x++)m[x]=t.readInt(!0);const p=t.readInt(!0),g=new $t(p,m,l);for(let x=0;x<p;x++)g.setFrame(x,t.readFloat(),dn(t,u));i.push(g)}const a=t.readInt(!0);if(a>0){const f=new Zt(a);for(let u=0;u<a;u++){const m=t.readFloat(),p=s.events[t.readInt(!0)],g=new oe(m,p);g.intValue=t.readInt(!1),g.floatValue=t.readFloat(),g.stringValue=t.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=t.readFloat(),g.balance=t.readFloat()),f.setFrame(u,g)}i.push(f)}let h=0;for(let f=0,u=i.length;f<u;f++)h=Math.max(h,i[f].getDuration());const d=new Kt(e,i,h);return n&&z.rgba8888ToColor(d.color,t.readInt32()),d}},cn=class{constructor(t,e=[],s=0,n=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<7,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<14,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<21,(e&128)!==0&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t===0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const n=this.readUnsignedByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(n),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!==0}},jn=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}},hn=class{constructor(t=null,e,s=0){this.bones=t,this.vertices=e,this.length=s}};function Z(t,e,s,n){s instanceof Nt?Jn(t,e,s,n):Kn(t,e,s,n)}function Jn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n;for(let l=0,c=0,o=s.getFrameCount()-1;s.setFrame(l,i,r),l!==o;l++){const a=t.readFloat(),h=t.readFloat()*n;switch(t.readByte()){case ft:s.setStepped(l);break;case ut:H(t,s,c++,l,0,i,a,r,h,n)}i=a,r=h}e.push(s)}function Kn(t,e,s,n){let i=t.readFloat(),r=t.readFloat()*n,l=t.readFloat()*n;for(let c=0,o=0,a=s.getFrameCount()-1;s.setFrame(c,i,r,l),c!==a;c++){const h=t.readFloat(),d=t.readFloat()*n,f=t.readFloat()*n;switch(t.readByte()){case ft:s.setStepped(c);break;case ut:H(t,s,o++,c,0,i,h,r,d,n),H(t,s,o++,c,1,i,h,l,f,n)}i=h,r=d,l=f}e.push(s)}function dn(t,e){const s=t.readInt(!0);if(s===0)return null;const n=new Array(e).fill(-1),i=new Array(e-s);let r=0,l=0;for(let c=0;c<s;c++){const o=t.readInt(!0);for(;r!==o;)i[l++]=r++;n[r+t.readInt(!0)]=r++}for(;r<e;)i[l++]=r++;for(let c=e-1;c>=0;c--)n[c]===-1&&(n[c]=i[--l]);return n}function H(t,e,s,n,i,r,l,c,o,a){e.setBezier(s,n,i,r,c,t.readFloat(),t.readFloat()*a,t.readFloat(),t.readFloat()*a,l,o)}var Qn=0,Zn=1,ti=2,ei=3,si=4,ni=5,ii=6,ri=7,ai=8,oi=9,li=10,ci=0,hi=1,di=2,fi=3,ui=4,mi=5,gi=0,pi=1,xi=2,bi=3,wi=4,yi=0,vi=1,Ti=0,Si=1,Ai=2,Ii=0,Ci=1,Mi=2,Yi=4,Pi=5,Fi=6,ki=7,Ei=8,Xi=0,Vi=1,ft=1,ut=2,Ri=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new Bt(()=>B.newFloatArray(16));update(t,e){if(!t)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,r=t.slots,l=r.length;s.length=0,i.freeAll(n),n.length=0;for(let c=0;c<l;c++){const o=r[c];if(!o.bone.active)continue;const a=o.appliedPose.attachment;if(a instanceof us){s.push(a);let h=i.obtain();h.length!==a.worldVerticesLength&&(h=B.newFloatArray(a.worldVerticesLength)),n.push(h),a.computeWorldVertices(t,o,0,a.worldVerticesLength,h,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;const i=this.polygons;for(let r=0,l=i.length;r<l;r++){const c=i[r],o=c;for(let a=0,h=c.length;a<h;a+=2){const d=o[a],f=o[a+1];t=Math.min(t,d),e=Math.min(e,f),s=Math.max(s,d),n=Math.max(n,f)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=n}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,n){const i=this.minX,r=this.minY,l=this.maxX,c=this.maxY;if(t<=i&&s<=i||e<=r&&n<=r||t>=l&&s>=l||e>=c&&n>=c)return!1;const o=(n-e)/(s-t);let a=o*(i-t)+e;if(a>r&&a<c||(a=o*(l-t)+e,a>r&&a<c))return!0;let h=(r-e)/o+t;return h>i&&h<l||(h=(c-e)/o+t,h>i&&h<l)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){const s=this.polygons;for(let n=0,i=s.length;n<i;n++)if(this.containsPointPolygon(s[n],t,e))return this.boundingBoxes[n];return null}containsPointPolygon(t,e,s){const n=t,i=t.length;let r=i-2,l=!1;for(let c=0;c<i;c+=2){const o=n[c+1],a=n[r+1];if(o<s&&a>=s||a<s&&o>=s){const h=n[c];h+(s-o)/(a-o)*(n[r]-h)<e&&(l=!l)}r=c}return l}intersectsSegment(t,e,s,n){const i=this.polygons;for(let r=0,l=i.length;r<l;r++)if(this.intersectsSegmentPolygon(i[r],t,e,s,n))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,n,i){const r=t,l=t.length,c=e-n,o=s-i,a=e*i-s*n;let h=r[l-2],d=r[l-1];for(let f=0;f<l;f+=2){const u=r[f],m=r[f+1],p=h*m-d*u,g=h-u,x=d-m,b=c*x-o*g,w=(a*g-c*p)/b;if((w>=h&&w<=u||w>=u&&w<=h)&&(w>=e&&w<=n||w>=n&&w<=e)){const T=(a*x-o*p)/b;if((T>=d&&T<=m||T>=m&&T<=d)&&(T>=s&&T<=i||T>=i&&T<=s))return!0}h=u,d=m}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");const e=this.boundingBoxes.indexOf(t);return e===-1?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},fn=class at{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new Bt(()=>[]);polygonIndicesPool=new Bt(()=>[]);triangulate(e){const s=e;let n=e.length>>1;const i=this.indicesArray;i.length=0;for(let c=0;c<n;c++)i[c]=c;const r=this.isConcaveArray;r.length=0;for(let c=0;c<n;c++)r[c]=at.isConcave(c,n,s,i);const l=this.triangles;for(l.length=0;n>3;){let c=n-1,o=0,a=1;for(;;){t:if(!r[o]){const f=i[c]<<1,u=i[o]<<1,m=i[a]<<1,p=s[f],g=s[f+1],x=s[u],b=s[u+1],w=s[m],T=s[m+1];for(let y=a+1<n?a+1:0;y!==c;){if(r[y]){const v=i[y]<<1,S=s[v],A=s[v+1];if(at.positiveArea(w,T,p,g,S,A)&&at.positiveArea(p,g,x,b,S,A)&&at.positiveArea(x,b,w,T,S,A))break t}++y===n&&(y=0)}break}if(a===0){do{if(!r[o])break;o--}while(o>0);c=o>0?o-1:n-1,a=o+1<n?o+1:0;break}c=o,o=a,++a===n&&(a=0)}l.push(i[c],i[o],i[a]),i.splice(o,1),r.splice(o,1),n--;const h=o>0?o-1:n-1,d=o<n?o:0;r[h]=at.isConcave(h,n,s,i),r[d]=at.isConcave(d,n,s,i)}return n===3&&l.push(i[2],i[0],i[1]),l}decompose(e,s){const n=e,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let l=this.polygonIndicesPool.obtain();l.length=0;let c=this.polygonPool.obtain();c.length=0;let o=-1,a=0;for(let h=0,d=s.length;h<d;h+=3){const f=s[h]<<1,u=s[h+1]<<1,m=s[h+2]<<1,p=n[f],g=n[f+1],x=n[u],b=n[u+1],w=n[m],T=n[m+1];if(o===f){const y=c.length-4;if(at.winding(c[y],c[y+1],c[y+2],c[y+3],w,T)===a&&at.winding(w,T,c[0],c[1],c[2],c[3])===a){c.push(w,T),l.push(m);continue}}c.length>0&&(i.push(c),r.push(l),c=this.polygonPool.obtain(),l=this.polygonIndicesPool.obtain()),c.length=0,c.push(p,g,x,b),c.push(w,T),l.length=0,l.push(f,u,m),a=at.winding(p,g,x,b,w,T),o=f}c.length>0&&(i.push(c),r.push(l));for(let h=0,d=i.length;h<d;h++){if(l=r[h],l.length===0)continue;const f=l[0];let u=l[l.length-1];c=i[h];const m=c.length-4;let p=c[m],g=c[m+1],x=c[m+2],b=c[m+3];const w=c[0],T=c[1],y=c[2],v=c[3],S=at.winding(p,g,x,b,w,T);for(let A=0;A<d;A++){if(A===h)continue;const I=r[A];if(I.length!==3)continue;const M=I[0],Y=I[1],k=I[2],E=i[A],X=E[E.length-2],V=E[E.length-1];M!==f||Y!==u||at.winding(p,g,x,b,X,V)===S&&at.winding(X,V,w,T,y,v)===S&&(E.length=0,I.length=0,c.push(X,V),l.push(k),u=k,p=x,g=b,x=X,b=V,A=-1)}}for(let h=i.length-1;h>=0;h--)c=i[h],c.length===0?(i.splice(h,1),this.polygonPool.free(c),l=r[h],r.splice(h,1),this.polygonIndicesPool.free(l)):c.push(c[0],c[1]);return i}static isConcave(e,s,n,i){const r=i[e>0?e-1:s-1]<<1,l=i[e]<<1,c=i[e+1<s?e+1:0]<<1;return!at.positiveArea(n[r],n[r+1],n[l],n[l+1],n[c],n[c+1])}static positiveArea(e,s,n,i,r,l){return e*(l-i)+n*(s-l)+r*(i-s)>=0}static winding(e,s,n,i,r,l){return e*(l-i)+n*(s-l)+r*(i-s)>=0?1:-1}},un=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(t,e,s){if(this.clipAttachment)return;const n=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const i=B.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(t,e,0,n,i,0,2);const r=this.clippingPolygon,l=this.makeClockwise(r);l||this.inverse||s.convex?(l||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new fn),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(t){this.clipAttachment&&(t&&this.clipAttachment.endSlot!==t.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(t,e,s,n,i,r,l,c){return n&&i&&r&&typeof l=="boolean"&&typeof c=="number"?this.clipTrianglesRender(t,e,s,n,i,r,l,c):this.clipTrianglesNoRender(t,e,s)}clipTrianglesNoRender(t,e,s){const n=this.clippedVertices;n.length=0;const i=this.clippedTriangles;i.length=0;let r=0;if(this.inverse){const h=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let f=e[d]<<1;const u=t[f],m=t[f+1];f=e[d+1]<<1;const p=t[f],g=t[f+1];f=e[d+2]<<1;const x=t[f],b=t[f+1];this.clipInverse(u,m,p,g,x,b,h);const w=this.inverseVertices;for(let T=0,y=this.inverseVertices.length;T<y;){const v=w[T++];let S=v>>1,A=n.length;const I=B.setArraySize(n,A+v);B.arrayCopy(w,T,I,A,v),A=i.length;const M=B.setArraySize(i,A+3*(S-2));for(let Y=1;Y<S-1;Y++,A+=3)M[A]=r,M[A+1]=r+Y,M[A+2]=r+Y+1;r+=S,T+=v}}return!0}const l=this.clipOutput,c=this.clippingPolygons,o=c.length;let a=null;for(let h=0;h<s;h+=3){let d=e[h]<<1;const f=t[d],u=t[d+1];d=e[h+1]<<1;const m=t[d],p=t[d+1];d=e[h+2]<<1;const g=t[d],x=t[d+1];for(let b=0;b<o;b++){let w=n.length;if(this.clip(f,u,m,p,g,x,c[b])){a=this.clipOutput;const T=l.length;if(T===0)continue;let y=T>>1;const v=B.setArraySize(n,w+T);B.arrayCopy(a,0,v,w,T),w=i.length;const S=B.setArraySize(i,w+3*(y-2));y--;for(let A=1;A<y;A++,w+=3)S[w]=r,S[w+1]=r+A,S[w+2]=r+A+1;r+=y}else{const T=B.setArraySize(n,w+6);T[w]=f,T[w+1]=u,T[w+2]=m,T[w+3]=p,T[w+4]=g,T[w+5]=x,w=i.length;const y=B.setArraySize(i,w+3);y[w]=r,y[w+1]=r+1,y[w+2]=r+2,r+=3;break}}}return a!=null}clipTrianglesRender(t,e,s,n,i,r,l,c){const o=this.clippedVertices;o.length=0;const a=this.clippedTriangles;a.length=0;let h=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let x=e[g],b=e[g+1],w=e[g+2];const T=t[x*c],y=t[x*c+1],v=t[b*c],S=t[b*c+1],A=t[w*c],I=t[w*c+1];this.clipInverse(T,y,v,S,A,I,p);const M=this.inverseVertices.length;if(M===0)continue;const Y=n[x<<=1],k=n[x+1],E=n[b<<=1],X=n[b+1],V=n[w<<=1],N=n[w+1],_=S-I,O=A-v,F=T-A,P=I-y,U=1/(_*F+O*(y-I)),D=this.inverseVertices;for(let W=0;W<M;){const L=D[W++],q=L>>1;let $=o.length;const J=B.setArraySize(o,$+q*c);for(let K=0;K<L;K+=2,$+=c){const et=D[W+K],nt=D[W+K+1];J[$]=et,J[$+1]=nt,J[$+2]=i.r,J[$+3]=i.g,J[$+4]=i.b,J[$+5]=i.a;const st=et-A,ht=nt-I,it=(_*st+O*ht)*U,rt=(P*st+F*ht)*U,dt=1-it-rt;J[$+6]=Y*it+E*rt+V*dt,J[$+7]=k*it+X*rt+N*dt,l&&(J[$+8]=r.r,J[$+9]=r.g,J[$+10]=r.b,J[$+11]=r.a)}$=a.length;const tt=B.setArraySize(a,$+3*(q-2));for(let K=1;K<q-1;K++,$+=3)tt[$]=h,tt[$+1]=h+K,tt[$+2]=h+K+1;h+=q,W+=L}}return!0}const d=this.clipOutput,f=this.clippingPolygons,u=this.clippingPolygons.length;let m=null;for(let p=0;p<s;p+=3){let g=e[p];const x=t[g*c],b=t[g*c+1],w=n[g<<1],T=n[(g<<1)+1];g=e[p+1];const y=t[g*c],v=t[g*c+1],S=n[g<<1],A=n[(g<<1)+1];g=e[p+2];const I=t[g*c],M=t[g*c+1],Y=n[g<<1],k=n[(g<<1)+1],E=v-M,X=I-y,V=x-I,N=M-b,_=1/(E*V+X*(b-M));for(let O=0;O<u;O++){let F=o.length;if(this.clip(x,b,y,v,I,M,f[O])){m=this.clipOutput;const P=d.length;if(P===0)continue;let U=P>>1;const D=B.setArraySize(o,F+U*c);for(let L=0;L<P;L+=2,F+=c){const q=m[L],$=m[L+1];D[F]=q,D[F+1]=$,D[F+2]=i.r,D[F+3]=i.g,D[F+4]=i.b,D[F+5]=i.a;const J=q-I,tt=$-M,K=(E*J+X*tt)*_,et=(N*J+V*tt)*_,nt=1-K-et;D[F+6]=w*K+S*et+Y*nt,D[F+7]=T*K+A*et+k*nt,l&&(D[F+8]=r.r,D[F+9]=r.g,D[F+10]=r.b,D[F+11]=r.a)}F=a.length;const W=B.setArraySize(a,F+3*(U-2));U--;for(let L=1;L<U;L++,F+=3)W[F]=h,W[F+1]=h+L,W[F+2]=h+L+1;h+=U+1}else{const P=B.setArraySize(o,F+3*c);P[F]=x,P[F+1]=b,P[F+2]=i.r,P[F+3]=i.g,P[F+4]=i.b,P[F+5]=i.a,l?(P[F+6]=w,P[F+7]=T,P[F+8]=r.r,P[F+9]=r.g,P[F+10]=r.b,P[F+11]=r.a,P[F+12]=y,P[F+13]=v,P[F+14]=i.r,P[F+15]=i.g,P[F+16]=i.b,P[F+17]=i.a,P[F+18]=S,P[F+19]=A,P[F+20]=r.r,P[F+21]=r.g,P[F+22]=r.b,P[F+23]=r.a,P[F+24]=I,P[F+25]=M,P[F+26]=i.r,P[F+27]=i.g,P[F+28]=i.b,P[F+29]=i.a,P[F+30]=Y,P[F+31]=k,P[F+32]=r.r,P[F+33]=r.g,P[F+34]=r.b,P[F+35]=r.a):(P[F+6]=w,P[F+7]=T,P[F+8]=y,P[F+9]=v,P[F+10]=i.r,P[F+11]=i.g,P[F+12]=i.b,P[F+13]=i.a,P[F+14]=S,P[F+15]=A,P[F+16]=I,P[F+17]=M,P[F+18]=i.r,P[F+19]=i.g,P[F+20]=i.b,P[F+21]=i.a,P[F+22]=Y,P[F+23]=k),F=a.length;const U=B.setArraySize(a,F+3);U[F]=h,U[F+1]=h+1,U[F+2]=h+2,h+=3;break}}}return m!=null}clipTrianglesUnpacked(t,e,s,n,i,r=2){let l=this._clippedVerticesTyped,c=this._clippedUVsTyped,o=this._clippedTrianglesTyped,a=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const m=this.clippingPolygons[0];for(let p=0;p<n;p+=3){let g=s[p]*r;const x=t[e+g],b=t[e+g+1];let w=s[p]<<1;const T=i[w],y=i[w+1];g=s[p+1]*r;const v=t[e+g],S=t[e+g+1];w=s[p+1]<<1;const A=i[w],I=i[w+1];g=s[p+2]*r;const M=t[e+g],Y=t[e+g+1];w=s[p+2]<<1;const k=i[w],E=i[w+1];this.clipInverse(x,b,v,S,M,Y,m);const X=this.inverseVertices.length;if(X===0)continue;const V=S-Y,N=M-v,_=x-M,O=Y-b,F=1/(V*_+N*(b-Y)),P=this.inverseVertices;for(let U=0;U<X;){const D=P[U++],W=D>>1;let L=this.clippedVerticesLength;const q=L+W*r,$=this.clippedUVsLength+W*2;l.length<q&&(this._clippedVerticesTyped=new Float32Array(q*2),this._clippedVerticesTyped.set(l.subarray(0,L)),l=this._clippedVerticesTyped),c.length<$&&(this._clippedUVsTyped=new Float32Array($*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped),this.clippedVerticesLength=q,this.clippedUVsLength=$;const J=this._clippedVerticesTyped,tt=this._clippedUVsTyped;let K=$-W*2;for(let st=0;st<D;st+=2,L+=r,K+=2){const ht=P[U+st],it=P[U+st+1];J[L]=ht,J[L+1]=it;const rt=ht-M,dt=it-Y,mt=(V*rt+N*dt)*F,pt=(O*rt+_*dt)*F,jt=1-mt-pt;tt[K]=T*mt+A*pt+k*jt,tt[K+1]=y*mt+I*pt+E*jt}L=this.clippedTrianglesLength;const et=L+3*(W-2);o.length<et&&(this._clippedTrianglesTyped=new Uint16Array(et*2),this._clippedTrianglesTyped.set(o.subarray(0,L)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=et;const nt=o;for(let st=1;st<W-1;st++,L+=3)nt[L]=a,nt[L+1]=a+st,nt[L+2]=a+st+1;a+=W,U+=D}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),!0}const h=this.clipOutput,d=this.clippingPolygons,f=this.clippingPolygons.length;let u=null;for(let m=0;m<n;m+=3){let p=s[m],g=p*r;const x=t[e+g],b=t[e+g+1];let w=p<<1;const T=i[w],y=i[w+1];p=s[m+1],g=p*r;const v=t[e+g],S=t[e+g+1];w=p<<1;const A=i[w],I=i[w+1];p=s[m+2],g=p*r;const M=t[e+g],Y=t[e+g+1];w=p<<1;const k=i[w],E=i[w+1],X=S-Y,V=M-v,N=x-M,_=Y-b,O=1/(X*N+V*(b-Y));for(let F=0;F<f;F++){let P=this.clippedVerticesLength;if(this.clip(x,b,v,S,M,Y,d[F])){u=h;const U=h.length;if(U===0)continue;let D=U>>1;const W=P+D*r;l.length<W&&(this._clippedVerticesTyped=new Float32Array(W*2),this._clippedVerticesTyped.set(l.subarray(0,P)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+D*2)*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),l=this._clippedVerticesTyped,c=this._clippedUVsTyped);const L=l,q=c;this.clippedVerticesLength=W;let $=this.clippedUVsLength;this.clippedUVsLength=$+D*2;for(let K=0;K<U;K+=2,P+=r,$+=2){const et=u[K],nt=u[K+1];L[P]=et,L[P+1]=nt;const st=et-M,ht=nt-Y,it=(X*st+V*ht)*O,rt=(_*st+N*ht)*O,dt=1-it-rt;q[$]=T*it+A*rt+k*dt,q[$+1]=y*it+I*rt+E*dt}P=this.clippedTrianglesLength;const J=P+3*(D-2);o.length<J&&(this._clippedTrianglesTyped=new Uint16Array(J*2),this._clippedTrianglesTyped.set(o.subarray(0,P)),o=this._clippedTrianglesTyped),this.clippedTrianglesLength=J;const tt=o;D--;for(let K=1;K<D;K++,P+=3)tt[P]=a,tt[P+1]=a+K,tt[P+2]=a+K+1;a+=D+1}else{let U=P+3*r;l.length<U&&(this._clippedVerticesTyped=new Float32Array(U*2),this._clippedVerticesTyped.set(l.subarray(0,P)),l=this._clippedVerticesTyped),l[P]=x,l[P+1]=b,l[P+r]=v,l[P+r+1]=S,l[P+r*2]=M,l[P+r*2+1]=Y;const D=this.clippedUVsLength+3*2;c.length<D&&(this._clippedUVsTyped=new Float32Array(D*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped);const W=this.clippedUVsLength;c[W]=T,c[W+1]=y,c[W+2]=A,c[W+3]=I,c[W+4]=k,c[W+5]=E,this.clippedVerticesLength=U,this.clippedUVsLength=D,P=this.clippedTrianglesLength,U=P+3,o.length<U&&(this._clippedTrianglesTyped=new Uint16Array(U*2),this._clippedTrianglesTyped.set(o.subarray(0,P)),o=this._clippedTrianglesTyped);const L=o;L[P]=a,L[P+1]=a+1,L[P+2]=a+2,a+=3,this.clippedTrianglesLength=U;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),u!==null}clip(t,e,s,n,i,r,l){const c=this.clipOutput;let o=!1,a,h;l.length%4>=2?(a=this.clipOutput,h=this.scratch):(a=this.scratch,h=this.clipOutput);const d=l;a.length=8;const f=a;f[0]=t,f[1]=e,f[2]=s,f[3]=n,f[4]=i,f[5]=r,f[6]=t,f[7]=e,h.length=0;const u=l.length-4;for(let m=0;;m+=2){const p=d[m],g=d[m+1],x=p-d[m+2],b=g-d[m+3],w=h.length,T=a;for(let v=0,S=a.length-2;v<S;){t=T[v],e=T[v+1],v+=2,s=T[v],n=T[v+1];const A=b*(p-s)>x*(g-n),I=b*(p-t)-x*(g-e);if(I>0)if(A)h.push(s,n);else{const M=s-t,Y=n-e,k=I/(M*b-Y*x);k>=0&&k<=1?(h.push(t+M*k,e+Y*k),o=!0):h.push(s,n)}else if(A){const M=s-t,Y=n-e,k=I/(M*b-Y*x);k>=0&&k<=1?(h.push(t+M*k,e+Y*k,s,n),o=!0):h.push(s,n)}else o=!0}if(w===h.length)return c.length=0,!0;if(h.push(h[0],h[1]),m===u)break;const y=h;h=a,h.length=0,a=y}if(c!==h){c.length=0;for(let m=0,p=h.length-2;m<p;m++)c[m]=h[m]}else c.length=c.length-2;return o}clipInverse(t,e,s,n,i,r,l){this.inverseVertices.length=0;const c=l.length-4;let o,a;l.length%4>=2?(o=this.clipOutput,a=this.scratch):(o=this.scratch,a=this.clipOutput),o.length=8;let h=l,d=o;d[0]=t,d[1]=e,d[2]=s,d[3]=n,d[4]=i,d[5]=r,d[6]=t,d[7]=e,a.length=0;for(let f=0;;f+=2){const u=h[f],m=h[f+1],p=u-h[f+2],g=m-h[f+3],x=a.length,b=this.inverseVertices.length;this.inverseVertices.push(0),d=o;for(let y=0,v=o.length-2;y<v;){t=d[y],e=d[y+1],y+=2,s=d[y],n=d[y+1];const S=g*(u-s)>p*(m-n),A=g*(u-t)-p*(m-e);if(A>0)if(S)a.push(s,n);else{const I=s-t,M=n-e,Y=A/(I*g-M*p);if(Y>=0&&Y<=1){const k=t+I*Y,E=e+M*Y;a.push(k,E),this.inverseVertices.push(k,E,s,n)}else a.push(s,n)}else if(S){const I=s-t,M=n-e,Y=A/(I*g-M*p);if(Y>=0&&Y<=1){const k=t+I*Y,E=e+M*Y;this.inverseVertices.push(k,E),a.push(k,E,s,n)}else a.push(s,n)}else this.inverseVertices.push(s,n)}const w=this.inverseVertices.length-b-1;if(w>=6?this.inverseVertices[b]=w:this.inverseVertices.length=b,x===a.length||(a.push(a[0],a[1]),f===c))break;const T=a;a=o,a.length=0,o=T}}makeClockwise(t){const e=t,s=t.length;let n=!0,i=!0,r=0,l=e[s-2],c=e[s-1],o=e[0],a=e[1];for(let d=2;d<s;d+=2){const f=e[d],u=e[d+1];r+=o*u-f*a;const m=(o-l)*(u-a)-(a-c)*(f-o);i=i&&m<=0,n=n&&m>=0,l=o,c=a,o=f,a=u}r+=o*e[1]-e[0]*a;const h=(o-l)*(e[1]-a)-(a-c)*(e[0]-o);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,f=s-2,u=s>>1;d<u;d+=2){const m=e[d],p=e[d+1],g=f-d;e[d]=e[g],e[d+1]=e[g+1],e[g]=m,e[g+1]=p}return n}return i}makeConvex(t){const e=t.length,s=t;this.clipOutput.length=e;const n=this.clipOutput;n[0]=s[0],n[1]=s[1];for(let l=2;l<e;l+=2){const c=s[l],o=s[l+1];let a=l-2;for(;a>=0&&(n[a]>c||n[a]===c&&n[a+1]>o);a-=2)n[a+2]=n[a],n[a+3]=n[a+1];n[a+2]=c,n[a+3]=o}s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];let i=4;for(let l=4;l<e;l+=2,i+=2){const c=n[l],o=n[l+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==2););s[i]=c,s[i+1]=o}s[i]=n[e-4],s[i+1]=n[e-3];const r=i;i+=2;for(let l=e-6;l>=0;l-=2,i+=2){const c=n[l],o=n[l+1];for(;(s[i-2]-s[i-4])*(o-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==r););s[i]=c,s[i+1]=o}t.length=i-2}},Li=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(t){this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new Ts,n=typeof t=="string"?JSON.parse(t):t,i=n.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=C(i,"referenceScale",100)*e,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),n.bones)for(let r=0;r<n.bones.length;r++){const l=n.bones[r];let c=null;const o=C(l,"parent",null);o&&(c=s.findBone(o));const a=new ms(s.bones.length,l.name,c);a.length=C(l,"length",0)*e;const h=a.setupPose;h.x=C(l,"x",0)*e,h.y=C(l,"y",0)*e,h.rotation=C(l,"rotation",0),h.scaleX=C(l,"scaleX",1),h.scaleY=C(l,"scaleY",1),h.shearX=C(l,"shearX",0),h.shearY=C(l,"shearY",0),h.inherit=B.enumValue(ne,C(l,"inherit","Normal")),a.skinRequired=C(l,"skin",!1);const d=C(l,"color",null);d&&a.color.setFromString(d),a.icon=C(l,"icon",void 0),a.iconSize=C(l,"iconSize",1),a.iconRotation=C(l,"iconRotation",0),s.bones.push(a)}if(n.slots)for(let r=0;r<n.slots.length;r++){const l=n.slots[r],c=l.name,o=s.findBone(l.bone);if(!o)throw new Error(`Couldn't find bone ${l.bone} for slot ${c}`);const a=new As(s.slots.length,c,o),h=C(l,"color",null);h&&a.setupPose.color.setFromString(h);const d=C(l,"dark",null);d&&(a.setupPose.darkColor=z.fromString(d)),a.attachmentName=C(l,"attachment",null),a.blendMode=B.enumValue(Is,C(l,"blend","normal")),a.visible=C(l,"visible",!0),s.slots.push(a)}if(n.constraints)for(const r of n.constraints){const l=r.name,c=C(r,"skin",!1);switch(C(r,"type",!1)){case"ik":{const o=new Wt(l);o.skinRequired=c;for(let u=0;u<r.bones.length;u++){const m=s.findBone(r.bones[u]);if(!m)throw new Error(`Couldn't find bone ${r.bones[u]} for IK constraint ${l}.`);o.bones.push(m)}const a=r.target,h=s.findBone(a);if(!h)throw new Error(`Couldn't find target bone ${a} for IK constraint ${l}.`);o.target=h;const d=C(r,"scaleY",null);d!=null&&(o.scaleYMode=B.enumValue(ae,d));const f=o.setupPose;f.mix=C(r,"mix",1),f.softness=C(r,"softness",0)*e,f.bendDirection=C(r,"bendPositive",!0)?1:-1,f.compress=C(r,"compress",!1),f.stretch=C(r,"stretch",!1),s.constraints.push(o);break}case"transform":{const o=new j(l);o.skinRequired=c;for(let w=0;w<r.bones.length;w++){const T=r.bones[w],y=s.findBone(T);if(!y)throw new Error(`Couldn't find bone ${T} for transform constraint ${r.name}.`);o.bones.push(y)}const a=r.source,h=s.findBone(a);if(!h)throw new Error(`Couldn't find source bone ${a} for transform constraint ${r.name}.`);o.source=h,o.localSource=C(r,"localSource",!1),o.localTarget=C(r,"localTarget",!1),o.additive=C(r,"additive",!1),o.clamp=C(r,"clamp",!1);let d=!1,f=!1,u=!1,m=!1,p=!1,g=!1;const x=Object.entries(C(r,"properties",{}));for(const[w,T]of x){const y=this.fromProperty(w),v=this.propertyScale(w,e);y.offset=C(T,"offset",0)*v;const S=Object.entries(C(T,"to",{}));for(const[A,I]of S){let M=1,Y;switch(A){case"rotate":{d=!0,Y=new Cs;break}case"x":{f=!0,Y=new Ms,M=e;break}case"y":{u=!0,Y=new Ys,M=e;break}case"scaleX":{m=!0,Y=new Ps;break}case"scaleY":{p=!0,Y=new Fs;break}case"shearY":{g=!0,Y=new ks;break}default:throw new Error(`Invalid transform constraint to property: ${A}`)}Y.offset=C(I,"offset",0)*M,Y.max=C(I,"max",1)*M,Y.scale=C(I,"scale",1)*M/v,y.to.push(Y)}y.to.length>0&&o.properties.push(y)}o.offsets[j.ROTATION]=C(r,"rotation",0),o.offsets[j.X]=C(r,"x",0)*e,o.offsets[j.Y]=C(r,"y",0)*e,o.offsets[j.SCALEX]=C(r,"scaleX",0),o.offsets[j.SCALEY]=C(r,"scaleY",0),o.offsets[j.SHEARY]=C(r,"shearY",0);const b=o.setupPose;d&&(b.mixRotate=C(r,"mixRotate",1)),f&&(b.mixX=C(r,"mixX",1)),u&&(b.mixY=C(r,"mixY",b.mixX)),m&&(b.mixScaleX=C(r,"mixScaleX",1)),p&&(b.mixScaleY=C(r,"mixScaleY",b.mixScaleX)),g&&(b.mixShearY=C(r,"mixShearY",1)),s.constraints.push(o);break}case"path":{const o=new Ht(l);o.skinRequired=c;for(let f=0;f<r.bones.length;f++){const u=r.bones[f],m=s.findBone(u);if(!m)throw new Error(`Couldn't find bone ${u} for path constraint ${r.name}.`);o.bones.push(m)}const a=r.slot,h=s.findSlot(a);if(!h)throw new Error(`Couldn't find slot ${a} for path constraint ${r.name}.`);o.slot=h,o.positionMode=B.enumValue(bs,C(r,"positionMode","Percent")),o.spacingMode=B.enumValue(ws,C(r,"spacingMode","Length")),o.rotateMode=B.enumValue(ys,C(r,"rotateMode","Tangent")),o.offsetRotation=C(r,"rotation",0);const d=o.setupPose;d.position=C(r,"position",0),o.positionMode===0&&(d.position*=e),d.spacing=C(r,"spacing",0),(o.spacingMode===0||o.spacingMode===1)&&(d.spacing*=e),d.mixRotate=C(r,"mixRotate",1),d.mixX=C(r,"mixX",1),d.mixY=C(r,"mixY",d.mixX),s.constraints.push(o);break}case"physics":{const o=new Gt(l);o.skinRequired=c;const a=r.bone,h=s.findBone(a);if(h==null)throw new Error(`Physics bone not found: ${a}`);o.bone=h,o.x=C(r,"x",0),o.y=C(r,"y",0),o.rotate=C(r,"rotate",0),o.scaleX=C(r,"scaleX",0);const d=C(r,"scaleY",null);d!=null&&(o.scaleYMode=B.enumValue(ae,d)),o.shearX=C(r,"shearX",0),o.limit=C(r,"limit",5e3)*e,o.step=1/C(r,"fps",60);const f=o.setupPose;f.inertia=C(r,"inertia",.5),f.strength=C(r,"strength",100),f.damping=C(r,"damping",.85),f.massInverse=1/C(r,"mass",1),f.wind=C(r,"wind",0),f.gravity=C(r,"gravity",0),f.mix=C(r,"mix",1),o.inertiaGlobal=C(r,"inertiaGlobal",!1),o.strengthGlobal=C(r,"strengthGlobal",!1),o.dampingGlobal=C(r,"dampingGlobal",!1),o.massGlobal=C(r,"massGlobal",!1),o.windGlobal=C(r,"windGlobal",!1),o.gravityGlobal=C(r,"gravityGlobal",!1),o.mixGlobal=C(r,"mixGlobal",!1),s.constraints.push(o);break}case"slider":{const o=new yt(l);o.skinRequired=c,o.additive=C(r,"additive",!1),o.loop=C(r,"loop",!1),o.setupPose.mix=C(r,"mix",1);const a=r.bone;if(a){if(o.bone=s.findBone(a),!o.bone)throw new Error(`Slider bone not found: ${a}`);const h=r.property;o.property=this.fromProperty(h);const d=this.propertyScale(h,e);o.property.offset=C(r,"from",0)*d,o.offset=C(r,"to",0),o.scale=C(r,"scale",1)/d,o.max=C(r,"max",0),o.local=C(r,"local",!1)}else o.setupPose.time=C(r,"time",0);s.constraints.push(o);break}}}if(n.skins)for(let r=0;r<n.skins.length;r++){const l=n.skins[r],c=new ue(l.name);if(l.bones)for(let o=0;o<l.bones.length;o++){const a=l.bones[o],h=s.findBone(a);if(!h)throw new Error(`Couldn't find bone ${a} for skin ${l.name}.`);c.bones.push(h)}if(l.ik)for(let o=0;o<l.ik.length;o++){const a=l.ik[o],h=s.findConstraint(a,Wt);if(!h)throw new Error(`Couldn't find IK constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.transform)for(let o=0;o<l.transform.length;o++){const a=l.transform[o],h=s.findConstraint(a,j);if(!h)throw new Error(`Couldn't find transform constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.path)for(let o=0;o<l.path.length;o++){const a=l.path[o],h=s.findConstraint(a,Ht);if(!h)throw new Error(`Couldn't find path constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.physics)for(let o=0;o<l.physics.length;o++){const a=l.physics[o],h=s.findConstraint(a,Gt);if(!h)throw new Error(`Couldn't find physics constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}if(l.slider)for(let o=0;o<l.slider.length;o++){const a=l.slider[o],h=s.findConstraint(a,yt);if(!h)throw new Error(`Couldn't find slider constraint ${a} for skin ${l.name}.`);c.constraints.push(h)}for(const o in l.attachments){const a=s.findSlot(o);if(!a)throw new Error(`Couldn't find skin slot ${o} for skin ${l.name}.`);const h=l.attachments[o];for(const d in h){const f=this.readAttachment(h[d],c,a.index,d,s);f&&c.setAttachment(a.index,d,f)}}s.skins.push(c),c.name==="default"&&(s.defaultSkin=c)}for(let r=0,l=this.linkedMeshes.length;r<l;r++){const c=this.linkedMeshes[r],o=c.skin?s.findSkin(c.skin):s.defaultSkin;if(!o)throw new Error(`Skin not found: ${c.skin}`);const a=o.getAttachment(c.sourceIndex,c.source);if(!a)throw new Error(`Source mesh not found: ${c.source}`);c.mesh.timelineAttachment=c.inheritTimelines?a:c.mesh,c.mesh.setSourceMesh(a),c.mesh.updateSequence();t:if(c.inheritTimelines&&c.slotIndex!==c.sourceIndex){const h=a.timelineSlots;for(const f of h)if(f===c.slotIndex)break t;const d=[...h];d[h.length]=c.slotIndex,a.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const r in n.events){const l=n.events[r],c=new xs(r),o=c.setupPose;o.intValue=C(l,"int",0),o.floatValue=C(l,"float",0),o.stringValue=C(l,"string",""),c._audioPath=C(l,"audio",null),c.audioPath&&(o.volume=C(l,"volume",o.volume),o.balance=C(l,"balance",o.balance)),s.events.push(c)}if(n.animations)for(const r in n.animations){const l=n.animations[r];this.readAnimation(l,r,s)}if(n.constraints)for(const r in n.constraints){const l=n.constraints[r];if(l.type==="slider"){const c=s.findConstraint(l.name,yt),o=l.animation,a=s.findAnimation(o);if(!a)throw new Error(`Slider animation not found: ${o}`);c.animation=a}}return s}fromProperty(t){let e;switch(t){case"rotate":e=new ge;break;case"x":e=new pe;break;case"y":e=new xe;break;case"scaleX":e=new be;break;case"scaleY":e=new we;break;case"shearY":e=new ye;break;default:throw new Error(`Invalid transform constraint from property: ${t}`)}return e}propertyScale(t,e){switch(t){case"x":case"y":return e;default:return 1}}readAttachment(t,e,s,n,i){const r=this.scale,l=C(t,"name",n);switch(C(t,"type","region")){case"region":{const c=C(t,"path",l),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,n,l,c,o);if(!a)return null;a.path=c,a.x=C(t,"x",0)*r,a.y=C(t,"y",0)*r,a.scaleX=C(t,"scaleX",1),a.scaleY=C(t,"scaleY",1),a.rotation=C(t,"rotation",0),a.width=t.width*r,a.height=t.height*r;const h=C(t,"color",null);return h&&a.color.setFromString(h),a.updateSequence(),a}case"boundingbox":{const c=this.attachmentLoader.newBoundingBoxAttachment(e,n,l);if(!c)return null;this.readVertices(t,c,t.vertexCount<<1);const o=C(t,"color",null);return o&&c.color.setFromString(o),c}case"mesh":case"linkedmesh":{const c=C(t,"path",l),o=this.readSequence(C(t,"sequence",null)),a=this.attachmentLoader.newMeshAttachment(e,n,l,c,o);if(!a)return null;a.path=c;const h=C(t,"color",null);h&&a.color.setFromString(h),a.width=C(t,"width",0)*r,a.height=C(t,"height",0)*r;const d=C(t,"source",null);if(d){let u=s;const m=C(t,"slot",null);if(m){const p=i.findSlot(m);if(!p)throw new Error(`Source mesh slot not found: ${m}`);u=p.index}return this.linkedMeshes.push(new Bi(a,C(t,"skin",null),s,u,d,C(t,"timelines",!0))),a}const f=t.uvs;return this.readVertices(t,a,f.length),a.triangles=t.triangles,a.regionUVs=f,a.edges=C(t,"edges",null),a.hullLength=C(t,"hull",0)*2,a.updateSequence(),a}case"path":{const c=this.attachmentLoader.newPathAttachment(e,n,l);if(!c)return null;c.closed=C(t,"closed",!1),c.constantSpeed=C(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,c,o<<1);const a=B.newArray(o/3,0);for(let d=0;d<t.lengths.length;d++)a[d]=t.lengths[d]*r;c.lengths=a;const h=C(t,"color",null);return h&&c.color.setFromString(h),c}case"point":{const c=this.attachmentLoader.newPointAttachment(e,n,l);if(!c)return null;c.x=C(t,"x",0)*r,c.y=C(t,"y",0)*r,c.rotation=C(t,"rotation",0);const o=C(t,"color",null);return o&&c.color.setFromString(o),c}case"clipping":{const c=this.attachmentLoader.newClippingAttachment(e,n,l);if(!c)return null;const o=C(t,"end",null);o&&(c.endSlot=i.findSlot(o)),c.convex=C(t,"convex",!1),c.inverse=C(t,"inverse",!1);const a=t.vertexCount;this.readVertices(t,c,a<<1);const h=C(t,"color",null);return h&&c.color.setFromString(h),c}}return null}readSequence(t){if(t==null)return new Ot(1,!1);const e=new Ot(C(t,"count",0),!0);return e.start=C(t,"start",1),e.digits=C(t,"digits",0),e.setupIndex=C(t,"setup",0),e}readVertices(t,e,s){const n=this.scale;e.worldVerticesLength=s;const i=t.vertices;if(s===i.length){const c=B.toFloatArray(i);if(n!==1)for(let o=0,a=i.length;o<a;o++)c[o]*=n;e.vertices=c;return}const r=[],l=[];for(let c=0,o=i.length;c<o;){const a=i[c++];l.push(a);for(let h=c+a*4;c<h;c+=4)l.push(i[c]),r.push(i[c+1]*n),r.push(i[c+2]*n),r.push(i[c+3])}e.bones=l,e.vertices=B.toFloatArray(r)}readAnimation(t,e,s){const n=this.scale,i=[];if(t.slots)for(const o in t.slots){const a=t.slots[o],h=s.findSlot(o);if(!h)throw new Error(`Slot not found: ${o}`);const d=h.index;for(const f in a){const u=a[f];if(!u)continue;const m=u.length;switch(f){case"attachment":{const p=new Ft(m,d);for(let g=0;g<m;g++){const x=u[g];p.setFrame(g,C(x,"time",0),C(x,"name",null))}i.push(p);break}case"rgba":{const p=new _e(m,m<<2,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.color);for(let w=0,T=0;;w++){p.setFrame(w,x,b.r,b.g,b.b,b.a);const y=u[w+1];if(!y){p.shrink(T);break}const v=C(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(T=G(A,p,T,w,0,x,v,b.r,S.r,1),T=G(A,p,T,w,1,x,v,b.g,S.g,1),T=G(A,p,T,w,2,x,v,b.b,S.b,1),T=G(A,p,T,w,3,x,v,b.a,S.a,1)),x=v,b=S,g=y}i.push(p);break}case"rgb":{const p=new qe(m,m*3,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.color);for(let w=0,T=0;;w++){p.setFrame(w,x,b.r,b.g,b.b);const y=u[w+1];if(!y){p.shrink(T);break}const v=C(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(T=G(A,p,T,w,0,x,v,b.r,S.r,1),T=G(A,p,T,w,1,x,v,b.g,S.g,1),T=G(A,p,T,w,2,x,v,b.b,S.b,1)),x=v,b=S,g=y}i.push(p);break}case"alpha":{ot(i,u,new ze(m,m,d),0,1);break}case"rgba2":{const p=new We(m,m*7,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.light),w=z.fromString(g.dark);for(let T=0,y=0;;T++){p.setFrame(T,x,b.r,b.g,b.b,b.a,w.r,w.g,w.b);const v=u[T+1];if(!v){p.shrink(y);break}const S=C(v,"time",0),A=z.fromString(v.light),I=z.fromString(v.dark),M=g.curve;M&&(y=G(M,p,y,T,0,x,S,b.r,A.r,1),y=G(M,p,y,T,1,x,S,b.g,A.g,1),y=G(M,p,y,T,2,x,S,b.b,A.b,1),y=G(M,p,y,T,3,x,S,b.a,A.a,1),y=G(M,p,y,T,4,x,S,w.r,I.r,1),y=G(M,p,y,T,5,x,S,w.g,I.g,1),y=G(M,p,y,T,6,x,S,w.b,I.b,1)),x=S,b=A,w=I,g=v}i.push(p);break}case"rgb2":{const p=new He(m,m*6,d);let g=u[0],x=C(g,"time",0),b=z.fromString(g.light),w=z.fromString(g.dark);for(let T=0,y=0;;T++){p.setFrame(T,x,b.r,b.g,b.b,w.r,w.g,w.b);const v=u[T+1];if(!v){p.shrink(y);break}const S=C(v,"time",0),A=z.fromString(v.light),I=z.fromString(v.dark),M=g.curve;M&&(y=G(M,p,y,T,0,x,S,b.r,A.r,1),y=G(M,p,y,T,1,x,S,b.g,A.g,1),y=G(M,p,y,T,2,x,S,b.b,A.b,1),y=G(M,p,y,T,3,x,S,w.r,I.r,1),y=G(M,p,y,T,4,x,S,w.g,I.g,1),y=G(M,p,y,T,5,x,S,w.b,I.b,1)),x=S,b=A,w=I,g=v}i.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${u.name} (${a.name})`)}}}if(t.bones)for(const o in t.bones){const a=t.bones[o],h=s.findBone(o);if(!h)throw new Error(`Bone not found: ${o}`);const d=h.index;for(const f in a){const u=a[f],m=u.length;if(m!==0)switch(f){case"rotate":ot(i,u,new Dt(m,m,d),0,1);break;case"translate":Es(i,u,new Xe(m,m<<1,d),"x","y",0,n);break;case"translatex":ot(i,u,new Ve(m,m,d),0,n);break;case"translatey":ot(i,u,new Re(m,m,d),0,n);break;case"scale":Es(i,u,new Le(m,m<<1,d),"x","y",1,1);break;case"scalex":ot(i,u,new Be(m,m,d),1,1);break;case"scaley":ot(i,u,new Oe(m,m,d),1,1);break;case"shear":Es(i,u,new Ne(m,m<<1,d),"x","y",0,1);break;case"shearx":ot(i,u,new De(m,m,d),0,1);break;case"sheary":ot(i,u,new Ue(m,m,d),0,1);break;case"inherit":{const p=new $e(m,h.index);for(let g=0;g<u.length;g++){const x=u[g];p.setFrame(g,C(x,"time",0),B.enumValue(ne,C(x,"inherit","Normal")))}i.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${u.name} (${a.name})`)}}}if(t.ik)for(const o in t.ik){const a=t.ik[o];let h=a[0];if(!h)continue;const d=s.findConstraint(o,Wt);if(!d)throw new Error(`IK Constraint not found: ${o}`);const f=new Je(a.length,a.length<<1,s.constraints.indexOf(d));let u=C(h,"time",0),m=C(h,"mix",1),p=C(h,"softness",0)*n;for(let g=0,x=0;;g++){f.setFrame(g,u,m,p,C(h,"bendPositive",!0)?1:-1,C(h,"compress",!1),C(h,"stretch",!1));const b=a[g+1];if(!b){f.shrink(x);break}const w=C(b,"time",0),T=C(b,"mix",1),y=C(b,"softness",0)*n,v=h.curve;v&&(x=G(v,f,x,g,0,u,w,m,T,1),x=G(v,f,x,g,1,u,w,p,y,n)),u=w,m=T,p=y,h=b}i.push(f)}if(t.transform)for(const o in t.transform){const a=t.transform[o];let h=a[0];if(!h)continue;const d=s.findConstraint(o,j);if(!d)throw new Error(`Transform constraint not found: ${o}`);const f=new Ke(a.length,a.length*6,s.constraints.indexOf(d));let u=C(h,"time",0),m=C(h,"mixRotate",1),p=C(h,"mixX",1),g=C(h,"mixY",p),x=C(h,"mixScaleX",1),b=C(h,"mixScaleY",1),w=C(h,"mixShearY",1);for(let T=0,y=0;;T++){f.setFrame(T,u,m,p,g,x,b,w);const v=a[T+1];if(!v){f.shrink(y);break}const S=C(v,"time",0),A=C(v,"mixRotate",1),I=C(v,"mixX",1),M=C(v,"mixY",I),Y=C(v,"mixScaleX",1),k=C(v,"mixScaleY",1),E=C(v,"mixShearY",1),X=h.curve;X&&(y=G(X,f,y,T,0,u,S,m,A,1),y=G(X,f,y,T,1,u,S,p,I,1),y=G(X,f,y,T,2,u,S,g,M,1),y=G(X,f,y,T,3,u,S,x,Y,1),y=G(X,f,y,T,4,u,S,b,k,1),y=G(X,f,y,T,5,u,S,w,E,1)),u=S,m=A,p=I,g=M,x=Y,b=k,w=E,h=v}i.push(f)}if(t.path)for(const o in t.path){const a=t.path[o],h=s.findConstraint(o,Ht);if(!h)throw new Error(`Path constraint not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const u=a[f];let m=u[0];if(!m)continue;const p=u.length;switch(f){case"position":{const g=new Qe(p,p,d);ot(i,u,g,0,h.positionMode===0?n:1);break}case"spacing":{const g=new Ze(p,p,d);ot(i,u,g,0,h.spacingMode===0||h.spacingMode===1?n:1);break}case"mix":{const g=new ts(p,p*3,d);let x=C(m,"time",0),b=C(m,"mixRotate",1),w=C(m,"mixX",1),T=C(m,"mixY",w);for(let y=0,v=0;;y++){g.setFrame(y,x,b,w,T);const S=u[y+1];if(!S){g.shrink(v);break}const A=C(S,"time",0),I=C(S,"mixRotate",1),M=C(S,"mixX",1),Y=C(S,"mixY",M),k=m.curve;k&&(v=G(k,g,v,y,0,x,A,b,I,1),v=G(k,g,v,y,1,x,A,w,M,1),v=G(k,g,v,y,2,x,A,T,Y,1)),x=A,b=I,w=M,T=Y,m=S}i.push(g);break}}}}if(t.physics)for(const o in t.physics){const a=t.physics[o];let h=-1;if(o.length>0){const d=s.findConstraint(o,Gt);if(!d)throw new Error(`Physics constraint not found: ${o}`);h=s.constraints.indexOf(d)}for(const d in a){const f=a[d];let u=f[0];if(!u)continue;const m=f.length;let p,g=0;if(d==="reset"){const x=new ls(m,h);for(let b=0;u!=null;u=f[b+1],b++)x.setFrame(b,C(u,"time",0));i.push(x);continue}switch(d){case"inertia":p=new es(m,m,h);break;case"strength":p=new ss(m,m,h);break;case"damping":p=new ns(m,m,h);break;case"mass":p=new is(m,m,h);break;case"wind":p=new rs(m,m,h);break;case"gravity":p=new as(m,m,h);break;case"mix":{g=1,p=new os(m,m,h);break}default:continue}ot(i,f,p,g,1)}}if(t.slider)for(const o in t.slider){const a=t.slider[o],h=s.findConstraint(o,yt);if(!h)throw new Error(`Slider not found: ${o}`);const d=s.constraints.indexOf(h);for(const f in a){const u=a[f];if(!u[0])continue;const p=u.length;switch(f){case"time":ot(i,u,new cs(p,p,d),1,1);break;case"mix":ot(i,u,new hs(p,p,d),1,1);break}}}if(t.attachments)for(const o in t.attachments){const a=t.attachments[o],h=s.findSkin(o);if(!h)throw new Error(`Skin not found: ${o}`);for(const d in a){const f=a[d],u=s.findSlot(d);if(!u)throw new Error(`Attachment slot not found: ${d}`);const m=u.index;for(const p in f){const g=f[p],x=h.getAttachment(m,p);if(!x)throw new Error(`Timeline attachment not found: ${p}`);for(const b in g){const w=g[b];let T=w[0];if(T){if(b==="deform"){const y=x.bones,v=x.vertices,S=y?v.length/3*2:v.length,A=new Ge(w.length,w.length,m,x);let I=C(T,"time",0);for(let M=0,Y=0;;M++){let k;const E=C(T,"vertices",null);if(!E)k=y?B.newFloatArray(S):v;else{k=B.newFloatArray(S);const _=C(T,"offset",0);if(B.arrayCopy(E,0,k,_,E.length),n!==1)for(let O=_,F=O+E.length;O<F;O++)k[O]*=n;if(!y)for(let O=0;O<S;O++)k[O]+=v[O]}A.setFrame(M,I,k);const X=w[M+1];if(!X){A.shrink(Y);break}const V=C(X,"time",0),N=T.curve;N&&(Y=G(N,A,Y,M,0,I,V,0,1,1)),I=V,T=X}i.push(A)}else if(b==="sequence"){const y=new je(w.length,m,x);let v=0;for(let S=0;S<w.length;S++){const A=C(T,"delay",v),I=C(T,"time",0),M=ke[C(T,"mode","hold")],Y=C(T,"index",0);y.setFrame(S,I,M,Y,A),v=A,T=w[S+1]}i.push(y)}}}}}}if(t.drawOrder){const o=new St(t.drawOrder.length),a=s.slots.length;let h=0;for(const d of t.drawOrder)o.setFrame(h++,C(d,"time",0),mn(s,d,a,null));i.push(o)}if(t.drawOrderFolder)for(const o of t.drawOrderFolder){const a=C(o,"slots",[]),h=new Array(a.length);let d=0;for(const p of a){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);h[d++]=g.index}const f=C(o,"keys",[]),u=new $t(f.length,h,s.slots.length);let m=0;for(const p of f)u.setFrame(m++,C(p,"time",0),mn(s,p,h.length,h));i.push(u)}if(t.events){const o=new Zt(t.events.length);let a=0;for(let h=0;h<t.events.length;h++,a++){const d=t.events[h],f=s.findEvent(d.name);if(!f)throw new Error(`Event not found: ${d.name}`);const u=f.setupPose,m=new oe(B.toSinglePrecision(C(d,"time",0)),f);m.intValue=C(d,"int",u.intValue),m.floatValue=C(d,"float",u.floatValue),m.stringValue=C(d,"string",u.stringValue),m.data.audioPath&&(m.volume=C(d,"volume",u.volume),m.balance=C(d,"balance",u.volume)),o.setFrame(a,m)}i.push(o)}let r=0;for(let o=0,a=i.length;o<a;o++)r=Math.max(r,i[o].getDuration());const l=new Kt(e,i,r),c=C(t,"color",null);c!==null&&l.color.setFromString(c),s.animations.push(l)}},Bi=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(t,e,s,n,i,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}};function ot(t,e,s,n,i){let r=e[0],l=r.time??0,c=(r.value??n)*i,o=0;for(let a=0;;a++){s.setFrame(a,l,c);const h=e[a+1];if(!h){s.shrink(o),t.push(s);return}const d=h.time??0,f=(h.value??n)*i;r.curve&&(o=G(r.curve,s,o,a,0,l,d,c,f,i)),l=d,c=f,r=h}}function Es(t,e,s,n,i,r,l){let c=e[0],o=c.time??0,a=(c[n]??r)*l,h=(c[i]??r)*l,d=0;for(let f=0;;f++){s.setFrame(f,o,a,h);const u=e[f+1];if(!u){s.shrink(d),t.push(s);return}const m=u.time??0,p=(u[n]??r)*l,g=(u[i]??r)*l,x=c.curve;x&&(d=G(x,s,d,f,0,o,m,a,p,l),d=G(x,s,d,f,1,o,m,h,g,l)),o=m,a=p,h=g,c=u}}function mn(t,e,s,n){const i=e.offsets;if(!i)return null;const r=new Array(s).fill(-1),l=new Array(s-i.length);let c=0,o=0;for(const a of i){const h=t.findSlot(a.slot);if(h==null)throw new Error(`Draw order slot not found: ${a.slot}`);let d=0;if(!n)d=h.index;else{d=-1;for(let f=0;f<s;f++)if(n[f]===h.index){d=f;break}if(d===-1)throw new Error(`Slot not in folder: ${a.slot}`)}for(;c!==d;)l[o++]=c++;r[c+a.offset]=c++}for(;c<s;)l[o++]=c++;for(let a=s-1;a>=0;a--)r[a]===-1&&(r[a]=l[--o]);return r}function G(t,e,s,n,i,r,l,c,o,a){if(t==="stepped")return e.setStepped(n),s;const h=i<<2,d=t[h],f=t[h+1]*a,u=t[h+2],m=t[h+3]*a;return e.setBezier(s,n,i,r,c,d,f,u,m,l,o),s+1}function C(t,e,s){return t[e]!==void 0?t[e]:s}var Oi=class{commandPool=new Ni;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new un;renderCommands=[];render(t,e=!1,s,n=2){this.commandPool.reset(),this.renderCommands.length=0;const i=this.clipping,r=t.drawOrder.appliedPose;for(let l=0;l<t.slots.length;l++){const c=r[l],o=c.appliedPose.attachment;if(!o){i.clipEnd(c);continue}const a=c.appliedPose,h=a.color;if((h.a===0||!c.bone.active)&&!(o instanceof zt)){i.clipEnd(c);continue}let f,u,m,p,g,x,b;if(o instanceof Pt){if(x=o.color,x.a===0){i.clipEnd(c);continue}const S=o.sequence,A=S.resolveIndex(a);o.computeWorldVertices(c,o.getOffsets(a),this.worldVertices,0,n),f=this.worldVertices,u=4,m=S.getUVs(A),p=this.quadIndices,g=6,b=S.regions[A]?.texture}else if(o instanceof Tt){if(x=o.color,x.a===0){i.clipEnd(c);continue}this.worldVertices.length<o.worldVerticesLength&&(this.worldVertices=new Float32Array(o.worldVerticesLength)),o.computeWorldVertices(t,c,0,o.worldVerticesLength,this.worldVertices,0,n),f=this.worldVertices,u=o.worldVerticesLength>>1;const S=o.sequence,A=S.resolveIndex(a);m=S.getUVs(A),p=o.triangles,g=p.length,b=S.regions[A]?.texture}else if(o instanceof zt){i.clipStart(t,c,o);continue}else continue;const w=t.color;let T,y;if(e){let S;if(s){S=Math.floor(s[3]*w.a*h.a*x.a*255);const A=Math.floor(S*s[0]*w.r*h.r*x.r),I=Math.floor(S*s[1]*w.g*h.g*x.g),M=Math.floor(S*s[2]*w.b*h.b*x.b);T=S<<24|A<<16|I<<8|M}else{S=Math.floor(w.a*h.a*x.a*255);const A=Math.floor(S*w.r*h.r*x.r),I=Math.floor(S*w.g*h.g*x.g),M=Math.floor(S*w.b*h.b*x.b);T=S<<24|A<<16|I<<8|M}if(y=4278190080,a.darkColor){const{r:A,g:I,b:M}=a.darkColor;y=4278190080|Math.floor(A*S)<<16|Math.floor(I*S)<<8|Math.floor(M*S)}}else{if(s){const S=Math.floor(s[3]*w.a*h.a*x.a*255),A=Math.floor(s[0]*w.r*h.r*x.r*255),I=Math.floor(s[1]*w.g*h.g*x.g*255),M=Math.floor(s[2]*w.b*h.b*x.b*255);T=S<<24|A<<16|I<<8|M}else{const S=Math.floor(w.a*h.a*x.a*255),A=Math.floor(w.r*h.r*x.r*255),I=Math.floor(w.g*h.g*x.g*255),M=Math.floor(w.b*h.b*x.b*255);T=S<<24|A<<16|I<<8|M}if(y=0,a.darkColor){const{r:S,g:A,b:I}=a.darkColor;y=Math.floor(S*255)<<16|Math.floor(A*255)<<8|Math.floor(I*255)}}i.isClipping()&&(i.clipTrianglesUnpacked(f,0,p,g,m,n),f=i.clippedVerticesTyped,u=i.clippedVerticesLength/n,m=i.clippedUVsTyped,p=i.clippedTrianglesTyped,g=i.clippedTrianglesLength);const v=this.commandPool.getCommand(u,g,n);v.blendMode=c.data.blendMode,v.texture=b,v.positions.set(f.subarray(0,u*n)),v.uvs.set(m.subarray(0,u<<1));for(let S=0;S<u;S++)v.colors[S]=T,v.darkColors[S]=y;p instanceof Uint16Array?v.indices.set(p.subarray(0,g)):v.indices.set(p.slice(0,g)),this.renderCommands.push(v),i.clipEnd(c)}return i.clipEnd(),this.batchCommands(n)}batchSubCommands(t,e,s,n,i,r){const l=t[e],c=this.commandPool.getCommand(n,i,r);c.blendMode=l.blendMode,c.texture=l.texture;let o=0,a=0,h=0,d=0,f=0;for(let u=e;u<=s;u++){const m=t[u];c.positions.set(m.positions,o),o+=m.numVertices*r,c.uvs.set(m.uvs,a),a+=m.numVertices<<1,c.colors.set(m.colors,h),c.darkColors.set(m.darkColors,h),h+=m.numVertices;for(let p=0;p<m.numIndices;p++)c.indices[d+p]=m.indices[p]+f;d+=m.numIndices,f+=m.numVertices}return c}batchCommands(t){if(this.renderCommands.length===0)return;let e,s,n=this.renderCommands[0],i=0,r=1,l=n.numVertices,c=n.numIndices;for(;r<=this.renderCommands.length;){const o=r<this.renderCommands.length?this.renderCommands[r]:null;if(o&&o.numVertices===0&&o.numIndices===0){r++;continue}if(o!==null&&o.texture===n.texture&&o.blendMode===n.blendMode&&o.colors[0]===n.colors[0]&&o.darkColors[0]===n.darkColors[0]&&c+o.numIndices<65535)l+=o.numVertices,c+=o.numIndices;else{const h=this.batchSubCommands(this.renderCommands,i,r-1,l,c,t);if(s?(s.next=h,s=h):e=s=h,r===this.renderCommands.length)break;n=this.renderCommands[r],i=r,l=n.numVertices,c=n.numIndices}r++}return e}},Ni=class{pool=[];inUse=[];getCommand(t,e,s){let n;for(const i of this.pool)if(i._positions.length>=t*s&&i._indices.length>=e){n=i;break}if(n)this.pool.splice(this.pool.indexOf(n),1),n.next=void 0,n.numVertices=t,n.numIndices=e,n.positions=n._positions.subarray(0,t*s),n.uvs=n._uvs.subarray(0,t<<1),n.colors=n._colors.subarray(0,t),n.darkColors=n._darkColors.subarray(0,t),n.indices=n._indices.subarray(0,e);else{const i=new Float32Array(t*s),r=new Float32Array(t<<1),l=new Uint32Array(t),c=new Uint32Array(t),o=new Uint16Array(e);n={positions:i,uvs:r,colors:l,darkColors:c,indices:o,_positions:i,_uvs:r,_colors:l,_darkColors:c,_indices:o,numVertices:t,numIndices:e,blendMode:0,texture:null}}return this.inUse.push(n),n}reset(){this.pool.push(...this.inUse),this.inUse.length=0}};return Rn(Bs)})();
|