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

73 lines
219 KiB
JavaScript

"use strict";var spine=(()=>{var We=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,xi=Object.getOwnPropertyNames,wi=Object.prototype.hasOwnProperty,et=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),bi=(e,t)=>{for(var s in t)We(e,s,{get:t[s],enumerable:!0})},yi=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xi(t))!wi.call(e,i)&&i!==s&&We(e,i,{get:()=>t[i],enumerable:!(n=pi(t,i))||n.enumerable});return e},vi=e=>yi(We({},"__esModule",{value:!0}),e),dn={};if(bi(dn,{AABBRectangleBoundsProvider:()=>Yr,ATTACH_RETAIN:()=>Ls,ATTACH_SETUP:()=>Xs,AlphaTimeline:()=>ds,Animation:()=>xe,AnimationState:()=>Ys,AnimationStateAdapter:()=>Pi,AnimationStateData:()=>In,AssetCache:()=>kn,AssetManagerBase:()=>Fi,AtlasAttachmentLoader:()=>Fn,Attachment:()=>Je,AttachmentTimeline:()=>Ut,BinaryInput:()=>Nn,BlendMode:()=>Hs,Bone:()=>Se,BoneData:()=>Ds,BonePose:()=>Te,BoneTimeline1:()=>Mt,BoneTimeline2:()=>we,BoundingBoxAttachment:()=>Vs,CURRENT:()=>Es,ClippingAttachment:()=>Bt,Color:()=>z,Constraint:()=>qt,ConstraintData:()=>zt,ConstraintTimeline1:()=>$t,CurveTimeline:()=>kt,CurveTimeline1:()=>te,DarkSlotMesh:()=>Jn,DarkTintBatchGeometry:()=>jn,DarkTintGeometry:()=>Wn,DarkTintMaterial:()=>Hn,DarkTintMesh:()=>Kn,DarkTintRenderer:()=>Zn,DebugUtils:()=>Ci,DeformTimeline:()=>ms,Downloader:()=>Mn,DrawOrder:()=>Yn,DrawOrderFolderTimeline:()=>ne,DrawOrderTimeline:()=>Et,Event:()=>Ae,EventData:()=>Os,EventQueue:()=>Sn,EventTimeline:()=>be,EventType:()=>Cn,FIRST:()=>Bs,FakeTexture:()=>ki,FromProperty:()=>Rt,FromRotate:()=>Be,FromScaleX:()=>Le,FromScaleY:()=>Ve,FromShearY:()=>De,FromX:()=>Re,FromY:()=>Xe,HOLD:()=>ie,IkConstraint:()=>En,IkConstraintData:()=>oe,IkConstraintPose:()=>Ie,IkConstraintTimeline:()=>ps,Inherit:()=>ve,InheritTimeline:()=>ls,IntSet:()=>Ti,Interpolation:()=>jt,MODE:()=>Rs,MathUtils:()=>X,MeshAttachment:()=>vt,MixFrom:()=>xn,PathAttachment:()=>re,PathConstraint:()=>Bn,PathConstraintData:()=>ae,PathConstraintMixTimeline:()=>ys,PathConstraintPose:()=>ke,PathConstraintPositionTimeline:()=>ws,PathConstraintSpacingTimeline:()=>bs,Physics:()=>Rn,PhysicsConstraint:()=>zs,PhysicsConstraintDampingTimeline:()=>Ss,PhysicsConstraintData:()=>le,PhysicsConstraintGravityTimeline:()=>Is,PhysicsConstraintInertiaTimeline:()=>vs,PhysicsConstraintMassTimeline:()=>Cs,PhysicsConstraintMixTimeline:()=>ks,PhysicsConstraintPose:()=>Me,PhysicsConstraintResetTimeline:()=>Ms,PhysicsConstraintStrengthTimeline:()=>Ts,PhysicsConstraintTimeline:()=>Tt,PhysicsConstraintWindTimeline:()=>As,PointAttachment:()=>Pn,Pool:()=>Zt,Posed:()=>Ns,PosedActive:()=>_s,PosedData:()=>ye,PositionMode:()=>Us,Pow:()=>fn,PowOut:()=>Si,Property:()=>wn,RGB2Timeline:()=>fs,RGBA2Timeline:()=>us,RGBATimeline:()=>cs,RGBTimeline:()=>hs,RegionAttachment:()=>It,RotateMode:()=>qs,RotateTimeline:()=>ee,SETUP:()=>An,ScaleTimeline:()=>ss,ScaleXTimeline:()=>ns,ScaleYMode:()=>Ce,ScaleYTimeline:()=>is,Sequence:()=>Qt,SequenceMode:()=>je,SequenceModeValues:()=>Ze,SequenceTimeline:()=>gs,SetupPoseBoundsProvider:()=>Er,ShearTimeline:()=>rs,ShearXTimeline:()=>os,ShearYTimeline:()=>as,Skeleton:()=>Gt,SkeletonBinary:()=>Dn,SkeletonBounds:()=>Un,SkeletonClipping:()=>he,SkeletonData:()=>Ye,SkeletonJson:()=>qn,SkeletonPhysicsMovement:()=>Gn,SkeletonRendererCore:()=>wr,Skin:()=>ce,SkinEntry:()=>Gs,SkinsAndAnimationBoundsProvider:()=>Br,Slider:()=>Ln,SliderData:()=>Pt,SliderMixTimeline:()=>Fs,SliderPose:()=>Fe,SliderTimeline:()=>Ps,Slot:()=>Xn,SlotCurveTimeline:()=>se,SlotData:()=>Ws,SlotMesh:()=>Qn,SlotPose:()=>Pe,SpacingMode:()=>$s,Spine:()=>Rr,SpineDebugRenderer:()=>Lr,SpineTexture:()=>de,StringSet:()=>un,Texture:()=>He,TextureAtlas:()=>pe,TextureAtlasPage:()=>pn,TextureAtlasRegion:()=>Ke,TextureFilter:()=>ge,TextureRegion:()=>gn,TextureWrap:()=>mn,TimeKeeper:()=>Ai,Timeline:()=>Q,ToProperty:()=>Xt,ToRotate:()=>Ks,ToScaleX:()=>Zs,ToScaleY:()=>Qs,ToShearY:()=>tn,ToX:()=>Js,ToY:()=>js,TrackEntry:()=>Tn,TransformConstraint:()=>Vn,TransformConstraintData:()=>K,TransformConstraintPose:()=>Ee,TransformConstraintTimeline:()=>xs,TranslateTimeline:()=>Qe,TranslateXTimeline:()=>ts,TranslateYTimeline:()=>es,Triangulator:()=>$n,Utils:()=>V,Vector2:()=>me,VertexAttachment:()=>At,WindowedMean:()=>Ii,isBoneTimeline:()=>yn,isConstraintTimeline:()=>vn,isSlotTimeline:()=>bn}),typeof window<"u"&&window.PIXI){const e=window.require;window.require=t=>{if(e)return e(t);if(t.startsWith("@pixi/"))return window.PIXI}}var Ti=class{array=[];add(e){const t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!==void 0}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}},un=class{entries={};size=0;add(e){const t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){const t=this.size;for(let s=0,n=e.length;s<n;s++)this.add(e[s]);return t!==this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}},z=class Vt{constructor(t=0,s=0,n=0,i=0){this.r=t,this.g=s,this.b=n,this.a=i}static WHITE=new Vt(1,1,1,1);static RED=new Vt(1,0,0,1);static GREEN=new Vt(0,1,0,1);static BLUE=new Vt(0,0,1,1);static MAGENTA=new Vt(1,0,1,1);set(t,s,n,i){return this.r=t,this.g=s,this.b=n,this.a=i,this.clamp()}setFromColor(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}setFromString(t){return t=t.charAt(0)==="#"?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=t.length!==8?1:parseInt(t.substr(6,2),16)/255,this}add(t,s,n,i){return this.r+=t,this.g+=s,this.b+=n,this.a+=i,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(t,s){t.r=((s&4278190080)>>>24)/255,t.g=((s&16711680)>>>16)/255,t.b=((s&65280)>>>8)/255,t.a=(s&255)/255}static rgb888ToColor(t,s){t.r=((s&16711680)>>>16)/255,t.g=((s&65280)>>>8)/255,t.b=(s&255)/255}toRgb888(){const t=s=>`0${(s*255).toString(16)}`.slice(-2);return+`0x${t(this.r)}${t(this.g)}${t(this.b)}`}static fromString(t,s=new Vt){return s.setFromString(t)}},X=class ut{static epsilon=1e-5;static epsilon2=ut.epsilon*ut.epsilon;static PI=3.1415927;static PI2=ut.PI*2;static invPI2=1/ut.PI2;static radiansToDegrees=180/ut.PI;static radDeg=ut.radiansToDegrees;static degreesToRadians=ut.PI/180;static degRad=ut.degreesToRadians;static clamp(t,s,n){return t<s?s:t>n?n:t}static cosDeg(t){return Math.cos(t*ut.degRad)}static sinDeg(t){return Math.sin(t*ut.degRad)}static atan2Deg(t,s){return Math.atan2(t,s)*ut.radDeg}static signum(t){return t>0?1:t<0?-1:0}static toInt(t){return t>0?Math.floor(t):Math.ceil(t)}static cbrt(t){const s=Math.pow(Math.abs(t),.3333333333333333);return t<0?-s:s}static randomTriangular(t,s){return ut.randomTriangularWith(t,s,(t+s)*.5)}static randomTriangularWith(t,s,n){const i=Math.random(),r=s-t;return i<=(n-t)/r?t+Math.sqrt(i*r*(n-t)):s-Math.sqrt((1-i)*r*(s-n))}static isPowerOfTwo(t){return t&&(t&t-1)===0}},jt=class Kt{static linear=new class extends Kt{applyInternal(t){return t}};static smooth=new class extends Kt{applyInternal(t){return t*t*(3-2*t)}};static slowFast=new class extends Kt{applyInternal(t){return t*t}};static fastSlow=new class extends Kt{applyInternal(t){return(t-1)*(t-1)*-1+1}};static circle=new class extends Kt{applyInternal(t){return t<=.5?(t*=2,(1-Math.sqrt(1-t*t))/2):(t--,t*=2,(Math.sqrt(1-t*t)+1)/2)}};apply(t,s,n){return s===void 0||n===void 0?this.applyInternal(t):t+(s-t)*this.applyInternal(n)}},fn=class extends jt{power=2;constructor(e){super(),this.power=e}applyInternal(e){return e<=.5?Math.pow(e*2,this.power)/2:Math.pow((e-1)*2,this.power)/(this.power%2===0?-2:2)+1}},Si=class extends fn{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}},V=class Jt{static SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";static arrayCopy(t,s,n,i,r){for(let a=s,c=i;a<s+r;a++,c++)n[c]=t[a]}static arrayFill(t,s,n,i){for(let r=s;r<n;r++)t[r]=i}static setArraySize(t,s,n=0){const i=t.length;if(i===s)return t;if(t.length=s,i<s)for(let r=i;r<s;r++)t[r]=n;return t}static ensureArrayCapacity(t,s,n=0){return t.length>=s?t:Jt.setArraySize(t,s,n)}static newArray(t,s){const n=[];for(let i=0;i<t;i++)n[i]=s;return n}static newFloatArray(t){if(Jt.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static newShortArray(t){if(Jt.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{const s=[];for(let n=0;n<s.length;n++)s[n]=0;return s}}static toFloatArray(t){return Jt.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return Jt.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t){}static contains(t,s,n=!0){for(let i=0;i<t.length;i++)if(t[i]===s)return!0;return!1}static enumValue(t,s){return t[s[0].toUpperCase()+s.slice(1)]}},Ci=class{static logBones(e){for(let t=0;t<e.bones.length;t++){const s=e.bones[t].appliedPose;console.log(`${s.bone.data.name}, ${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.worldX}, ${s.worldY}`)}}},Zt=class{items=[];instantiator;constructor(e){this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset?.(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},me=class{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){const e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){const e=this.length();return e!==0&&(this.x/=e,this.y/=e),this}},Ai=class{maxDelta=.064;framesPerSecond=0;delta=0;totalTime=0;lastTime=Date.now()/1e3;frameCount=0;frameTime=0;update(){const e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Ii=class{values;addedValues=0;lastValue=0;mean=0;dirty=!0;constructor(e=32){this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}},He=class{_image;constructor(e){this._image=e}getImage(){return this._image}},ge=(e=>(e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.MipMap=9987]="MipMap",e[e.MipMapNearestNearest=9984]="MipMapNearestNearest",e[e.MipMapLinearNearest=9985]="MipMapLinearNearest",e[e.MipMapNearestLinear=9986]="MipMapNearestLinear",e[e.MipMapLinearLinear=9987]="MipMapLinearLinear",e))(ge||{}),mn=(e=>(e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.ClampToEdge=33071]="ClampToEdge",e[e.Repeat=10497]="Repeat",e))(mn||{}),gn=class{texture;u=0;v=0;u2=0;v2=0;width=0;height=0;degrees=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0},ki=class extends He{setFilters(e,t){}setWraps(e,t){}dispose(){}},pe=class{pages=[];regions=[];constructor(e){const t=new Mi(e),s=new Array(4),n={};n.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},n.format=()=>{},n.filter=o=>{o.minFilter=V.enumValue(ge,s[1]),o.magFilter=V.enumValue(ge,s[2])},n.repeat=o=>{s[1].indexOf("x")!==-1&&(o.uWrap=10497),s[1].indexOf("y")!==-1&&(o.vWrap=10497)},n.pma=o=>{o.pma=s[1]==="true"};var i={};i.xy=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2])},i.size=o=>{o.width=parseInt(s[1]),o.height=parseInt(s[2])},i.bounds=o=>{o.x=parseInt(s[1]),o.y=parseInt(s[2]),o.width=parseInt(s[3]),o.height=parseInt(s[4])},i.offset=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2])},i.orig=o=>{o.originalWidth=parseInt(s[1]),o.originalHeight=parseInt(s[2])},i.offsets=o=>{o.offsetX=parseInt(s[1]),o.offsetY=parseInt(s[2]),o.originalWidth=parseInt(s[3]),o.originalHeight=parseInt(s[4])},i.rotate=o=>{const h=s[1];h==="true"?o.degrees=90:h!=="false"&&(o.degrees=parseInt(h))},i.index=o=>{o.index=parseInt(s[1])};let r=t.readLine();for(;r&&r.trim().length===0;)r=t.readLine();for(;!(!r||r.trim().length===0||t.readEntry(s,r)===0);)r=t.readLine();let a=null,c=null,l=null;for(;r!==null;)if(r.trim().length===0)a=null,r=t.readLine();else if(a){const o=new Ke(a,r);for(;;){const h=t.readEntry(s,r=t.readLine());if(h===0)break;const d=i[s[0]];if(d)d(o);else{c||(c=[]),l||(l=[]),c.push(s[0]);const m=[];for(let f=0;f<h;f++)m.push(parseInt(s[f+1]));l.push(m)}}o.originalWidth===0&&o.originalHeight===0&&(o.originalWidth=o.width,o.originalHeight=o.height),c&&c.length>0&&l&&l.length>0&&(o.names=c,o.values=l,c=null,l=null),o.u=o.x/a.width,o.v=o.y/a.height,o.degrees===90?(o.u2=(o.x+o.height)/a.width,o.v2=(o.y+o.width)/a.height):(o.u2=(o.x+o.width)/a.width,o.v2=(o.y+o.height)/a.height),this.regions.push(o)}else{for(a=new pn(r.trim());t.readEntry(s,r=t.readLine())!==0;){const o=n[s[0]];o&&o(a)}this.pages.push(a)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name===e)return this.regions[t];return null}setTextures(e,t=""){for(const s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){for(let e=0;e<this.pages.length;e++)this.pages[e].texture?.dispose()}},Mi=class{lines;index=0;constructor(e){this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length===0))return 0;const s=t.indexOf(":");if(s===-1)return 0;e[0]=t.substr(0,s).trim();for(let n=1,i=s+1;;n++){const r=t.indexOf(",",i);if(r===-1)return e[n]=t.substr(i).trim(),n;if(e[n]=t.substr(i,r-i).trim(),i=r+1,n===4)return 4}}},pn=class{name;minFilter=9728;magFilter=9728;uWrap=33071;vWrap=33071;texture=null;width=0;height=0;pma=!1;regions=[];constructor(e){this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(const t of this.regions)t.texture=e}},Ke=class extends gn{page;name;x=0;y=0;offsetX=0;offsetY=0;originalWidth=0;originalHeight=0;index=0;degrees=0;names=null;values=null;constructor(e,t){super(),this.page=e,this.name=t,e.regions.push(this)}},Je=class si{static empty=[];name;timelineAttachment;timelineSlots=si.empty;constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t,this.timelineAttachment=this}isTimelineActive(t,s,n){let i=t[s];if(i.bone.isActive()){const r=(n?i.getAppliedPose():i.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,a=this.timelineSlots.length;r<a;r++){if(i=t[this.timelineSlots[r]],!i.bone.isActive())continue;const c=(n?i.getAppliedPose():i.getPose()).getAttachment();if(c!=null&&c.timelineAttachment===this)return!0}return!1}},At=class ni extends Je{static nextID=0;id=ni.nextID++;bones=null;vertices=[];worldVerticesLength=0;constructor(t){super(t)}computeWorldVertices(t,s,n,i,r,a,c){i=a+(i>>1)*c;const l=s.appliedPose.deform;let o=this.vertices;const h=this.bones;if(!h){l.length>0&&(o=l);const u=s.bone.appliedPose,p=u.worldX,g=u.worldY,x=u.a,w=u.b,b=u.c,v=u.d;for(let y=n,T=a;T<i;y+=2,T+=c){const S=o[y],A=o[y+1];r[T]=S*x+A*w+p,r[T+1]=S*b+A*v+g}return}let d=0,m=0;for(let u=0;u<n;u+=2){const p=h[d];d+=p+1,m+=p}const f=t.bones;if(l.length===0)for(let u=a,p=m*3;u<i;u+=c){let g=0,x=0,w=h[d++];for(w+=d;d<w;d++,p+=3){const b=f[h[d]].appliedPose,v=o[p],y=o[p+1],T=o[p+2];g+=(v*b.a+y*b.b+b.worldX)*T,x+=(v*b.c+y*b.d+b.worldY)*T}r[u]=g,r[u+1]=x}else{const u=l;for(let p=a,g=m*3,x=m<<1;p<i;p+=c){let w=0,b=0,v=h[d++];for(v+=d;d<v;d++,g+=3,x+=2){const y=f[h[d]].appliedPose,T=o[g]+u[x],S=o[g+1]+u[x+1],A=o[g+2];w+=(T*y.a+S*y.b+y.worldX)*A,b+=(T*y.c+S*y.d+y.worldY)*A}r[p]=w,r[p+1]=b}}}copyTo(t){this.bones?(t.bones=[],V.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=V.newFloatArray(this.vertices.length),V.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}},vt=class on extends At{sequence;regionUVs=[];triangles=[];hullLength=0;path;color=new z(1,1,1,1);sourceMesh=null;edges=[];width=0;height=0;tempColor=new z(0,0,0,0);constructor(t,s){super(t),this.sequence=s}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new on(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],V.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],V.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],V.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(t){this.sourceMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength,this.edges=t.edges,this.width=t.width,this.height=t.height)}newLinkedMesh(){const t=new on(this.name,this.sequence.copy());return t.timelineAttachment=this.timelineAttachment,t.path=this.path,t.color.setFromColor(this.color),t.setSourceMesh(this.sourceMesh?this.sourceMesh:this),t.updateSequence(),t}static computeUVs(t,s,n){if(!t)throw new Error("Region not set.");const i=n.length;let r=t.u,a=t.v,c=0,l=0;if(t instanceof Ke){const o=t.page,h=o.width,d=o.height;switch(t.degrees){case 90:r-=(t.originalHeight-t.offsetY-t.height)/h,a-=(t.originalWidth-t.offsetX-t.width)/d,c=t.originalHeight/h,l=t.originalWidth/d;for(let m=0;m<i;m+=2)n[m]=r+s[m+1]*c,n[m+1]=a+(1-s[m])*l;return;case 180:r-=(t.originalWidth-t.offsetX-t.width)/h,a-=t.offsetY/d,c=t.originalWidth/h,l=t.originalHeight/d;for(let m=0;m<i;m+=2)n[m]=r+(1-s[m])*c,n[m+1]=a+(1-s[m+1])*l;return;case 270:r-=t.offsetY/h,a-=t.offsetX/d,c=t.originalHeight/h,l=t.originalWidth/d;for(let m=0;m<i;m+=2)n[m]=r+(1-s[m+1])*c,n[m+1]=a+s[m]*l;return;default:r-=t.offsetX/h,a-=(t.originalHeight-t.offsetY-t.height)/d,c=t.originalWidth/h,l=t.originalHeight/d}}else t?(c=t.u2-r,l=t.v2-a):(r=a=0,c=l=1);for(let o=0;o<i;o+=2)n[o]=r+s[o]*c,n[o+1]=a+s[o+1]*l}},It=class ii extends Je{sequence;x=0;y=0;scaleX=1;scaleY=1;rotation=0;width=0;height=0;path;color=new z(1,1,1,1);tempColor=new z(1,1,1,1);constructor(t,s){super(t),this.sequence=s}copy(){const t=new ii(this.name,this.sequence.copy());return t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,t.color.setFromColor(this.color),t}computeWorldVertices(t,s,n,i,r){const a=t.bone.appliedPose,c=a.worldX,l=a.worldY,o=a.a,h=a.b,d=a.c,m=a.d;let f=s[0],u=s[1];n[i]=f*o+u*h+c,n[i+1]=f*d+u*m+l,i+=r,f=s[2],u=s[3],n[i]=f*o+u*h+c,n[i+1]=f*d+u*m+l,i+=r,f=s[4],u=s[5],n[i]=f*o+u*h+c,n[i+1]=f*d+u*m+l,i+=r,f=s[6],u=s[7],n[i]=f*o+u*h+c,n[i+1]=f*d+u*m+l}getOffsets(t){return this.sequence.offsets[this.sequence.resolveIndex(t)]}updateSequence(){this.sequence.update(this)}static computeUVs(t,s,n,i,r,a,c,l,o,h){if(!t)throw new Error("Region not set.");const d=c/t.originalWidth*i,m=l/t.originalHeight*r,f=-c/2*i+t.offsetX*d,u=-l/2*r+t.offsetY*m,p=f+t.width*d,g=u+t.height*m,x=a*X.degRad,w=Math.cos(x),b=Math.sin(x),v=f*w+s,y=f*b,T=u*w+n,S=u*b,A=p*w+s,k=p*b,C=g*w+n,I=g*b;o[0]=v-S,o[1]=T+y,o[2]=v-I,o[3]=C+y,o[4]=A-I,o[5]=C+k,o[6]=A-S,o[7]=T+k,t==null?(h[0]=0,h[1]=0,h[2]=0,h[3]=1,h[4]=1,h[5]=1,h[6]=1,h[7]=0):(h[1]=t.v2,h[2]=t.u,h[5]=t.v,h[6]=t.u2,t.degrees===90?(h[0]=t.u2,h[3]=t.v2,h[4]=t.u,h[7]=t.v):(h[0]=t.u,h[3]=t.v,h[4]=t.u2,h[7]=t.v2))}static X1=0;static Y1=1;static C1R=2;static C1G=3;static C1B=4;static C1A=5;static U1=6;static V1=7;static X2=8;static Y2=9;static C2R=10;static C2G=11;static C2B=12;static C2A=13;static U2=14;static V2=15;static X3=16;static Y3=17;static C3R=18;static C3G=19;static C3B=20;static C3A=21;static U3=22;static V3=23;static X4=24;static Y4=25;static C4R=26;static C4G=27;static C4B=28;static C4A=29;static U4=30;static V4=31},Qt=class qe{static _nextID=0;id=qe.nextID();regions;pathSuffix;uvs;offsets;start=0;digits=0;setupIndex=0;constructor(t,s){this.regions=new Array(t),this.pathSuffix=s}copy(){const t=this.regions.length,s=new qe(t,this.pathSuffix);if(V.arrayCopy(this.regions,0,s.regions,0,t),s.start=this.start,s.digits=this.digits,s.setupIndex=this.setupIndex,this.uvs!=null){const n=this.uvs[0].length;s.uvs=[];for(let i=0;i<t;i++)s.uvs[i]=V.newFloatArray(n),V.arrayCopy(this.uvs[i],0,s.uvs[i],0,n)}if(this.offsets!=null){s.offsets=[];for(let n=0;n<t;n++)s.offsets[n]=[],V.arrayCopy(this.offsets[n],0,s.offsets[n],0,8)}return s}update(t){const s=this.regions.length;if(t instanceof It){this.uvs=[],this.offsets=[];for(let n=0;n<s;n++)this.uvs[n]=V.newFloatArray(8),this.offsets[n]=[],It.computeUVs(this.regions[n],t.x,t.y,t.scaleX,t.scaleY,t.rotation,t.width,t.height,this.offsets[n],this.uvs[n])}else if(t instanceof vt){const n=t.regionUVs;this.uvs=[],this.offsets=void 0;for(let i=0;i<s;i++)this.uvs[i]=V.newFloatArray(n.length),vt.computeUVs(this.regions[i],n,this.uvs[i])}}resolveIndex(t){let s=t.sequenceIndex;return s===-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1),s}getUVs(t){return this.uvs[t]}hasPathSuffix(){return this.pathSuffix}getPath(t,s){if(!this.pathSuffix)return t;let n=t;const i=(this.start+s).toString();for(let r=this.digits-i.length;r>0;r--)n+="0";return n+=i,n}static nextID(){return qe._nextID++}},je=(e=>(e[e.hold=0]="hold",e[e.once=1]="once",e[e.loop=2]="loop",e[e.pingpong=3]="pingpong",e[e.onceReverse=4]="onceReverse",e[e.loopReverse=5]="loopReverse",e[e.pingpongReverse=6]="pingpongReverse",e))(je||{}),Ze=[0,1,2,3,4,5,6],xe=class{name;timelines=[];timelineIds;bones;color=new z(1,1,1,1);duration;constructor(e,t,s){if(!e)throw new Error("name cannot be null.");this.name=e,this.duration=s,this.timelineIds=new un,this.bones=[],this.setTimelines(t)}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e;const t=e.length;this.timelineIds.clear(),this.bones.length=0;const s=new Set,n=e;for(let i=0;i<t;i++){const r=n[i];this.timelineIds.addAll(r.propertyIds),yn(r)&&s.add(r.boneIndex)&&this.bones.push(r.boneIndex)}}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,n,i,r,a,c,l,o){if(!e)throw new Error("skeleton cannot be null.");n&&this.duration!==0&&(s%=this.duration,t>0&&(t%=this.duration));const h=this.timelines;for(let d=0,m=h.length;d<m;d++)h[d].apply(e,t,s,i,r,a,c,l,o)}},xn=(e=>(e[e.current=0]="current",e[e.setup=1]="setup",e[e.first=2]="first",e))(xn||{}),wn=(e=>(e[e.rotate=0]="rotate",e[e.x=1]="x",e[e.y=2]="y",e[e.scaleX=3]="scaleX",e[e.scaleY=4]="scaleY",e[e.shearX=5]="shearX",e[e.shearY=6]="shearY",e[e.inherit=7]="inherit",e[e.rgb=8]="rgb",e[e.alpha=9]="alpha",e[e.rgb2=10]="rgb2",e[e.attachment=11]="attachment",e[e.deform=12]="deform",e[e.event=13]="event",e[e.drawOrder=14]="drawOrder",e[e.drawOrderFolder=15]="drawOrderFolder",e[e.ikConstraint=16]="ikConstraint",e[e.transformConstraint=17]="transformConstraint",e[e.pathConstraintPosition=18]="pathConstraintPosition",e[e.pathConstraintSpacing=19]="pathConstraintSpacing",e[e.pathConstraintMix=20]="pathConstraintMix",e[e.physicsConstraintInertia=21]="physicsConstraintInertia",e[e.physicsConstraintStrength=22]="physicsConstraintStrength",e[e.physicsConstraintDamping=23]="physicsConstraintDamping",e[e.physicsConstraintMass=24]="physicsConstraintMass",e[e.physicsConstraintWind=25]="physicsConstraintWind",e[e.physicsConstraintGravity=26]="physicsConstraintGravity",e[e.physicsConstraintMix=27]="physicsConstraintMix",e[e.physicsConstraintReset=28]="physicsConstraintReset",e[e.sequence=29]="sequence",e[e.sliderTime=30]="sliderTime",e[e.sliderMix=31]="sliderMix",e))(wn||{}),Q=class{propertyIds;frames;additive=!1;instant=!1;constructor(e,...t){this.propertyIds=t,this.frames=V.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search(e,t,s=1){const n=e.length;for(let i=s;i<n;i+=s)if(e[i]>t)return i-s;return n-s}};function bn(e){return typeof e=="object"&&e!==null&&typeof e.slotIndex=="number"}var kt=class extends Q{curves;constructor(e,t,...s){super(e,...s),this.curves=V.newFloatArray(e+t*18),this.curves[e-1]=1}setLinear(e){this.curves[e]=0}setStepped(e){this.curves[e]=1}shrink(e){const t=this.getFrameCount()+e*18;if(this.curves.length>t){const s=V.newFloatArray(t);V.arrayCopy(this.curves,0,s,0,t),this.curves=s}}setBezier(e,t,s,n,i,r,a,c,l,o,h){const d=this.curves;let m=this.getFrameCount()+e*18;s===0&&(d[t]=2+m);const f=(n-r*2+c)*.03,u=(i-a*2+l)*.03,p=((r-c)*3-n+o)*.006,g=((a-l)*3-i+h)*.006;let x=f*2+p,w=u*2+g,b=(r-n)*.3+f+p*.16666667,v=(a-i)*.3+u+g*.16666667,y=n+b,T=i+v;for(let S=m+18;m<S;m+=2)d[m]=y,d[m+1]=T,b+=x,v+=w,x+=p,w+=g,y+=b,T+=v}getBezierValue(e,t,s,n){const i=this.curves;if(i[n]>e){const l=this.frames[t],o=this.frames[t+s];return o+(e-l)/(i[n]-l)*(i[n+1]-o)}const r=n+18;for(n+=2;n<r;n+=2)if(i[n]>=e){const l=i[n-2],o=i[n-1];return o+(e-l)/(i[n]-l)*(i[n+1]-o)}t+=this.getFrameEntries();const a=i[r-2],c=i[r-1];return c+(e-a)/(this.frames[t]-a)*(this.frames[t+s]-c)}},te=class fe extends kt{constructor(t,s,n){super(t,s,n)}getFrameEntries(){return 2}setFrame(t,s,n){t<<=1,this.frames[t]=s,this.frames[t+1]=n}getCurveValue(t){const s=this.frames;let n=s.length-2;for(let r=2;r<=n;r+=2)if(s[r]>t){n=r-2;break}const i=this.curves[n>>1];switch(i){case 0:{const r=s[n],a=s[n+1];return a+(t-r)/(s[n+2]-r)*(s[n+2+1]-a)}case 1:return s[n+1]}return this.getBezierValue(t,n,1,i-2)}getRelativeValue(t,s,n,i,r,a){if(t<this.frames[0])return fe.beforeFirstKey(n,s,r,a);const c=this.getCurveValue(t);return n===1?a+c*s:r+(i?c:c+a-r)*s}getAbsoluteValue(t,s,n,i,r,a,c){return c===void 0?this.getAbsoluteValue1(t,s,n,i,r,a):this.getAbsoluteValue2(t,s,n,i,r,a,c)}getAbsoluteValue1(t,s,n,i,r,a){if(t<this.frames[0])return fe.beforeFirstKey(n,s,r,a);const c=this.getCurveValue(t);return n===1?a+(i?c:c-a)*s:r+(i?c:c-r)*s}getAbsoluteValue2(t,s,n,i,r,a,c){return t<this.frames[0]?fe.beforeFirstKey(n,s,r,a):n===1?a+(i?c:c-a)*s:r+(i?c:c-r)*s}getScaleValue(t,s,n,i,r,a,c){if(t<this.frames[0])return fe.beforeFirstKey(n,s,a,c);const l=this.getCurveValue(t)*c;if(s===1&&!i)return l;let o=n===1?c:a;return i?o+(l-c)*s:r?o+(Math.abs(l)*Math.sign(o)-o)*s:(o=Math.abs(o)*Math.sign(l),o+(l-o)*s)}static beforeFirstKey(t,s,n,i){switch(t){case 1:return i;case 2:return n+(i-n)*s;case 0:return n}}};function yn(e){return typeof e=="object"&&e!==null&&typeof e.boneIndex=="number"}var Mt=class extends te{boneIndex;constructor(e,t,s,n){super(e,t,`${n}|${s}`),this.boneIndex=s,this.additive=!0}apply(e,t,s,n,i,r,a,c,l){const o=e.bones[this.boneIndex];o.active&&this.apply1(l?o.appliedPose:o.pose,o.data.setupPose,s,i,r,a,c)}},we=class extends kt{boneIndex;constructor(e,t,s,n,i){super(e,t,`${n}|${s}`,`${i}|${s}`),this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(e,t,s,n){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n}apply(e,t,s,n,i,r,a,c,l){const o=e.bones[this.boneIndex];o.active&&this.apply1(l?o.appliedPose:o.pose,o.data.setupPose,s,i,r,a,c)}},ee=class extends Mt{constructor(e,t,s){super(e,t,s,0)}apply1(e,t,s,n,i,r,a){e.rotation=this.getRelativeValue(s,n,i,r,e.rotation,t.rotation)}},Qe=class extends we{constructor(e,t,s){super(e,t,s,1,2)}apply1(e,t,s,n,i,r,a){const c=this.frames;if(s<c[0]){switch(i){case 1:e.x=t.x,e.y=t.y;break;case 2:e.x+=(t.x-e.x)*n,e.y+=(t.y-e.y)*n;break}return}let l=0,o=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const m=c[h];l=c[h+1],o=c[h+2];const f=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*f,o+=(c[h+3+2]-o)*f;break}case 1:l=c[h+1],o=c[h+2];break;default:l=this.getBezierValue(s,h,1,d-2),o=this.getBezierValue(s,h,2,d+18-2)}i===1?(e.x=t.x+l*n,e.y=t.y+o*n):r?(e.x+=l*n,e.y+=o*n):(e.x+=(t.x+l-e.x)*n,e.y+=(t.y+o-e.y)*n)}},ts=class extends Mt{constructor(e,t,s){super(e,t,s,1)}apply1(e,t,s,n,i,r,a){e.x=this.getRelativeValue(s,n,i,r,e.x,t.x)}},es=class extends Mt{constructor(e,t,s){super(e,t,s,2)}apply1(e,t,s,n,i,r,a){e.y=this.getRelativeValue(s,n,i,r,e.y,t.y)}},ss=class extends we{constructor(e,t,s){super(e,t,s,3,4)}apply1(e,t,s,n,i,r,a){const c=this.frames;if(s<c[0]){switch(i){case 1:e.scaleX=t.scaleX,e.scaleY=t.scaleY;break;case 2:e.scaleX+=(t.scaleX-e.scaleX)*n,e.scaleY+=(t.scaleY-e.scaleY)*n;break}return}let l,o;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const m=c[h];l=c[h+1],o=c[h+2];const f=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*f,o+=(c[h+3+2]-o)*f;break}case 1:l=c[h+1],o=c[h+2];break;default:l=this.getBezierValue(s,h,1,d-2),o=this.getBezierValue(s,h,2,d+18-2)}if(l*=t.scaleX,o*=t.scaleY,n===1&&!r)e.scaleX=l,e.scaleY=o;else{let m=0,f=0;i===1?(m=t.scaleX,f=t.scaleY):(m=e.scaleX,f=e.scaleY),r?(e.scaleX=m+(l-t.scaleX)*n,e.scaleY=f+(o-t.scaleY)*n):a?(e.scaleX=m+(Math.abs(l)*Math.sign(m)-m)*n,e.scaleY=f+(Math.abs(o)*Math.sign(f)-f)*n):(m=Math.abs(m)*Math.sign(l),f=Math.abs(f)*Math.sign(o),e.scaleX=m+(l-m)*n,e.scaleY=f+(o-f)*n)}}},ns=class extends Mt{constructor(e,t,s){super(e,t,s,3)}apply1(e,t,s,n,i,r,a){e.scaleX=this.getScaleValue(s,n,i,r,a,e.scaleX,t.scaleX)}},is=class extends Mt{constructor(e,t,s){super(e,t,s,4)}apply1(e,t,s,n,i,r,a){e.scaleY=this.getScaleValue(s,n,i,r,a,e.scaleY,t.scaleY)}},rs=class extends we{constructor(e,t,s){super(e,t,s,5,6)}apply1(e,t,s,n,i,r,a){const c=this.frames;if(s<c[0]){switch(i){case 1:e.shearX=t.shearX,e.shearY=t.shearY;break;case 2:e.shearX+=(t.shearX-e.shearX)*n,e.shearY+=(t.shearY-e.shearY)*n;break}return}let l=0,o=0;const h=Q.search(c,s,3),d=this.curves[h/3];switch(d){case 0:{const m=c[h];l=c[h+1],o=c[h+2];const f=(s-m)/(c[h+3]-m);l+=(c[h+3+1]-l)*f,o+=(c[h+3+2]-o)*f;break}case 1:l=c[h+1],o=c[h+2];break;default:l=this.getBezierValue(s,h,1,d-2),o=this.getBezierValue(s,h,2,d+18-2)}i===1?(e.shearX=t.shearX+l*n,e.shearY=t.shearY+o*n):r?(e.shearX+=l*n,e.shearY+=o*n):(e.shearX+=(t.shearX+l-e.shearX)*n,e.shearY+=(t.shearY+o-e.shearY)*n)}},os=class extends Mt{constructor(e,t,s){super(e,t,s,5)}apply1(e,t,s,n,i,r,a){e.shearX=this.getRelativeValue(s,n,i,r,e.shearX,t.shearX)}},as=class extends Mt{constructor(e,t,s){super(e,t,s,6)}apply1(e,t,s,n,i,r,a){e.shearY=this.getRelativeValue(s,n,i,r,e.shearY,t.shearY)}},ls=class extends Q{boneIndex;constructor(e,t){super(e,`7|${t}`),this.boneIndex=t,this.instant=!0}getFrameEntries(){return 2}setFrame(e,t,s){e*=2,this.frames[e]=t,this.frames[e+1]=s}apply(e,t,s,n,i,r,a,c,l){const o=e.bones[this.boneIndex];if(!o.active)return;const h=l?o.appliedPose:o.pose;if(c)r!==0&&(h.inherit=o.data.setupPose.inherit);else{const d=this.frames;s<d[0]?r!==0&&(h.inherit=o.data.setupPose.inherit):h.inherit=this.frames[Q.search(d,s,2)+1]}}},se=class extends kt{slotIndex;constructor(e,t,s,...n){super(e,t,...n),this.slotIndex=s}apply(e,t,s,n,i,r,a,c,l){const o=e.slots[this.slotIndex];o.bone.active&&this.apply1(o,l?o.appliedPose:o.pose,s,i,r,a)}},cs=class extends se{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`)}getFrameEntries(){return 5}setFrame(e,t,s,n,i,r){e*=5,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i,this.frames[e+4]=r}apply1(e,t,s,n,i,r){const a=t.color,c=this.frames;if(s<c[0]){const u=e.data.setupPose.color;switch(i){case 1:a.setFromColor(u);break;case 2:a.add((u.r-a.r)*n,(u.g-a.g)*n,(u.b-a.b)*n,(u.a-a.a)*n);break}return}let l=0,o=0,h=0,d=0;const m=Q.search(c,s,5),f=this.curves[m/5];switch(f){case 0:{const u=c[m];l=c[m+1],o=c[m+2],h=c[m+3],d=c[m+4];const p=(s-u)/(c[m+5]-u);l+=(c[m+5+1]-l)*p,o+=(c[m+5+2]-o)*p,h+=(c[m+5+3]-h)*p,d+=(c[m+5+4]-d)*p;break}case 1:l=c[m+1],o=c[m+2],h=c[m+3],d=c[m+4];break;default:l=this.getBezierValue(s,m,1,f-2),o=this.getBezierValue(s,m,2,f+18-2),h=this.getBezierValue(s,m,3,f+36-2),d=this.getBezierValue(s,m,4,f+54-2)}if(n===1)a.set(l,o,h,d);else if(i===1){const u=e.data.setupPose.color;a.set(u.r+(l-u.r)*n,u.g+(o-u.g)*n,u.b+(h-u.b)*n,u.a+(d-u.a)*n)}else a.add((l-a.r)*n,(o-a.g)*n,(h-a.b)*n,(d-a.a)*n)}},hs=class extends se{constructor(e,t,s){super(e,t,s,`8|${s}`)}getFrameEntries(){return 4}setFrame(e,t,s,n,i){e<<=2,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i}apply1(e,t,s,n,i,r){const a=t.color;let c=0,l=0,o=0;const h=this.frames;if(s<h[0]){const f=e.data.setupPose.color;switch(i){case 1:{a.r=f.r,a.g=f.g,a.b=f.b;break}case 2:{a.r+=(f.r-a.r)*n,a.g+=(f.g-a.g)*n,a.b+=(f.b-a.b)*n;break}}return}const d=Q.search(h,s,4),m=this.curves[d>>2];switch(m){case 0:{const f=h[d];c=h[d+1],l=h[d+2],o=h[d+3];const u=(s-f)/(h[d+4]-f);c+=(h[d+4+1]-c)*u,l+=(h[d+4+2]-l)*u,o+=(h[d+4+3]-o)*u;break}case 1:c=h[d+1],l=h[d+2],o=h[d+3];break;default:c=this.getBezierValue(s,d,1,m-2),l=this.getBezierValue(s,d,2,m+18-2),o=this.getBezierValue(s,d,3,m+36-2)}if(n!==1)if(i===1){const f=e.data.setupPose.color;c=f.r+(c-f.r)*n,l=f.g+(l-f.g)*n,o=f.b+(o-f.b)*n}else c=a.r+(c-a.r)*n,l=a.g+(l-a.g)*n,o=a.b+(o-a.b)*n;a.r=c<0?0:c>1?1:c,a.g=l<0?0:l>1?1:l,a.b=o<0?0:o>1?1:o}},ds=class extends te{slotIndex=0;constructor(e,t,s){super(e,t,`9|${s}`),this.slotIndex=s}apply(e,t,s,n,i,r,a,c,l){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const h=(l?o.appliedPose:o.pose).color;let d=0;const m=this.frames;if(s<m[0]){const f=o.data.setupPose.color.a;switch(r){case 1:h.a=f;break;case 2:h.a+=(f-h.a)*i;break}return}if(d=this.getCurveValue(s),i!==1)if(r===1){const f=o.data.setupPose.color;d=f.a+(d-f.a)*i}else d=h.a+(d-h.a)*i;h.a=d<0?0:d>1?1:d}},us=class extends se{constructor(e,t,s){super(e,t,s,`8|${s}`,`9|${s}`,`10|${s}`)}getFrameEntries(){return 8}setFrame(e,t,s,n,i,r,a,c,l){e<<=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i,this.frames[e+4]=r,this.frames[e+5]=a,this.frames[e+6]=c,this.frames[e+7]=l}apply1(e,t,s,n,i,r){const a=t.color,c=t.darkColor;let l=0,o=0,h=0;const d=this.frames;if(s<d[0]){const w=e.data.setupPose,b=w.color,v=w.darkColor;switch(i){case 1:{a.setFromColor(b),c.r=v.r,c.g=v.g,c.b=v.b;break}case 2:{a.add((b.r-a.r)*n,(b.g-a.g)*n,(b.b-a.b)*n,(b.a-a.a)*n),c.r+=(v.r-c.r)*n,c.g+=(v.g-c.g)*n,c.b+=(v.b-c.b)*n;break}}return}let m=0,f=0,u=0,p=0;const g=Q.search(d,s,8),x=this.curves[g>>3];switch(x){case 0:{const w=d[g];m=d[g+1],f=d[g+2],u=d[g+3],p=d[g+4],l=d[g+5],o=d[g+6],h=d[g+7];const b=(s-w)/(d[g+8]-w);m+=(d[g+8+1]-m)*b,f+=(d[g+8+2]-f)*b,u+=(d[g+8+3]-u)*b,p+=(d[g+8+4]-p)*b,l+=(d[g+8+5]-l)*b,o+=(d[g+8+6]-o)*b,h+=(d[g+8+7]-h)*b;break}case 1:m=d[g+1],f=d[g+2],u=d[g+3],p=d[g+4],l=d[g+5],o=d[g+6],h=d[g+7];break;default:m=this.getBezierValue(s,g,1,x-2),f=this.getBezierValue(s,g,2,x+18-2),u=this.getBezierValue(s,g,3,x+36-2),p=this.getBezierValue(s,g,4,x+54-2),l=this.getBezierValue(s,g,5,x+72-2),o=this.getBezierValue(s,g,6,x+90-2),h=this.getBezierValue(s,g,7,x+108-2)}if(n===1)a.set(m,f,u,p);else if(i===1){const w=e.data.setupPose;let b=w.color;a.set(b.r+(m-b.r)*n,b.g+(f-b.g)*n,b.b+(u-b.b)*n,b.a+(p-b.a)*n),b=w.darkColor,l=b.r+(l-b.r)*n,o=b.g+(o-b.g)*n,h=b.b+(h-b.b)*n}else a.add((m-a.r)*n,(f-a.g)*n,(u-a.b)*n,(p-a.a)*n),l=c.r+(l-c.r)*n,o=c.g+(o-c.g)*n,h=c.b+(h-c.b)*n;c.r=l<0?0:l>1?1:l,c.g=o<0?0:o>1?1:o,c.b=h<0?0:h>1?1:h}},fs=class extends se{constructor(e,t,s){super(e,t,s,`8|${s}`,`10|${s}`)}getFrameEntries(){return 7}setFrame(e,t,s,n,i,r,a,c){e*=7,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i,this.frames[e+4]=r,this.frames[e+5]=a,this.frames[e+6]=c}apply1(e,t,s,n,i,r){const a=t.color,c=t.darkColor;let l=0,o=0,h=0,d=0,m=0,f=0;const u=this.frames;if(s<u[0]){const x=e.data.setupPose,w=x.color,b=x.darkColor;switch(i){case 1:a.r=w.r,a.g=w.g,a.b=w.b,c.r=b.r,c.g=b.g,c.b=b.b;break;case 2:a.r+=(w.r-a.r)*n,a.g+=(w.g-a.g)*n,a.b+=(w.b-a.b)*n,c.r+=(b.r-c.r)*n,c.g+=(b.g-c.g)*n,c.b+=(b.b-c.b)*n;break}return}const p=Q.search(u,s,7),g=this.curves[p/7];switch(g){case 0:{const x=u[p];l=u[p+1],o=u[p+2],h=u[p+3],d=u[p+4],m=u[p+5],f=u[p+6];const w=(s-x)/(u[p+7]-x);l+=(u[p+7+1]-l)*w,o+=(u[p+7+2]-o)*w,h+=(u[p+7+3]-h)*w,d+=(u[p+7+4]-d)*w,m+=(u[p+7+5]-m)*w,f+=(u[p+7+6]-f)*w;break}case 1:l=u[p+1],o=u[p+2],h=u[p+3],d=u[p+4],m=u[p+5],f=u[p+6];break;default:l=this.getBezierValue(s,p,1,g-2),o=this.getBezierValue(s,p,2,g+18-2),h=this.getBezierValue(s,p,3,g+36-2),d=this.getBezierValue(s,p,4,g+54-2),m=this.getBezierValue(s,p,5,g+72-2),f=this.getBezierValue(s,p,6,g+90-2)}if(n!==1)if(i===1){const x=e.data.setupPose;let w=x.color;l=w.r+(l-w.r)*n,o=w.g+(o-w.g)*n,h=w.b+(h-w.b)*n,w=x.darkColor,d=w.r+(d-w.r)*n,m=w.g+(m-w.g)*n,f=w.b+(f-w.b)*n}else l=a.r+(l-a.r)*n,o=a.g+(o-a.g)*n,h=a.b+(h-a.b)*n,d=c.r+(d-c.r)*n,m=c.g+(m-c.g)*n,f=c.b+(f-c.b)*n;a.r=l<0?0:l>1?1:l,a.g=o<0?0:o>1?1:o,a.b=h<0?0:h>1?1:h,c.r=d<0?0:d>1?1:d,c.g=m<0?0:m>1?1:m,c.b=f<0?0:f>1?1:f}},Ut=class extends Q{slotIndex=0;attachmentNames;constructor(e,t){super(e,`11|${t}`),this.slotIndex=t,this.attachmentNames=new Array(e),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.attachmentNames[e]=s}apply(e,t,s,n,i,r,a,c,l){const o=e.slots[this.slotIndex];if(!o.bone.active)return;const h=l?o.appliedPose:o.pose;c||s<this.frames[0]?r!==0&&this.setAttachment(e,h,o.data.attachmentName):this.setAttachment(e,h,this.attachmentNames[Q.search(this.frames,s)])}setAttachment(e,t,s){t.setAttachment(s?e.getAttachment(this.slotIndex,s):null)}},ms=class extends kt{slotIndex;attachment;vertices;constructor(e,t,s,n){super(e,t,`12|${s}|${n.id}`),this.slotIndex=s,this.attachment=n,this.vertices=new Array(e),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(e,t,s){this.frames[e]=t,this.vertices[e]=s}setBezier(e,t,s,n,i,r,a,c,l,o,h){const d=this.curves;let m=this.getFrameCount()+e*18;s===0&&(d[t]=2+m);const f=(n-r*2+c)*.03,u=l*.03-a*.06,p=((r-c)*3-n+o)*.006,g=(a-l+.33333333)*.018;let x=f*2+p,w=u*2+g,b=(r-n)*.3+f+p*.16666667,v=a*.3+u+g*.16666667,y=n+b,T=v;for(let S=m+18;m<S;m+=2)d[m]=y,d[m+1]=T,b+=x,v+=w,x+=p,w+=g,y+=b,T+=v}getCurvePercent(e,t){const s=this.curves;let n=s[t];switch(n){case 0:{const c=this.frames[t];return(e-c)/(this.frames[t+this.getFrameEntries()]-c)}case 1:return 0}if(n-=2,s[n]>e){const c=this.frames[t];return s[n+1]*(e-c)/(s[n]-c)}const i=n+18;for(n+=2;n<i;n+=2)if(s[n]>=e){const c=s[n-2],l=s[n-1];return l+(e-c)/(s[n]-c)*(s[n+1]-l)}const r=s[i-2],a=s[i-1];return a+(1-a)*(e-r)/(this.frames[t+this.getFrameEntries()]-r)}apply(e,t,s,n,i,r,a,c,l){const o=e.slots;if(!this.attachment.isTimelineActive(o,this.slotIndex,l))return;const h=this.attachment.timelineSlots,d=this.frames;if(s<d[0]){this.applyBeforeFirst(o[this.slotIndex],l,i,r);for(const g of h)this.applyBeforeFirst(o[g],l,i,r);return}let m,f,u;if(s>=d[d.length-1])u=0,m=this.vertices[d.length-1],f=null;else{const g=Q.search(d,s);u=this.getCurvePercent(s,g),m=this.vertices[g],f=this.vertices[g+1]}const p=this.vertices[0].length;this.applyToSlot(o[this.slotIndex],l,m,f,u,p,i,r,a);for(const g of h)this.applyToSlot(o[g],l,m,f,u,p,i,r,a)}applyBeforeFirst(e,t,s,n){if(!e.bone.active)return;const i=t?e.appliedPose:e.pose;if(i.attachment==null||i.attachment.timelineAttachment!==this.attachment)return;const r=i.deform;switch(r.length===0&&(n=1),n){case 1:r.length=0;break;case 2:{if(s===1){r.length=0;return}const a=this.vertices[0].length;r.length=a;const c=r,l=i.attachment;if(l.bones===null){const o=l.vertices;for(let h=0;h<a;h++)c[h]+=(o[h]-c[h])*s}else{s=1-s;for(let o=0;o<a;o++)c[o]*=s}}}}applyToSlot(e,t,s,n,i,r,a,c,l){if(!e.bone.active)return;const o=t?e.appliedPose:e.pose;if(o.attachment===null||o.attachment.timelineAttachment!==this.attachment)return;const h=o.attachment,d=o.deform;d.length===0&&(c=1);const m=c===1;if(d.length=r,n===null)if(a===1)if(l&&!m)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f];else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=s[u]-f[u]}else V.arrayCopy(s,0,d,0,r);else if(m)if(h.bones)for(let f=0;f<r;f++)d[f]=s[f]*a;else{const f=h.vertices;for(let u=0;u<r;u++){const p=f[u];d[u]=p+(s[u]-p)*a}}else if(l)if(h.bones)for(let f=0;f<r;f++)d[f]+=s[f]*a;else{const f=h.vertices;for(let u=0;u<r;u++)d[u]+=(s[u]-f[u])*a}else for(let f=0;f<r;f++)d[f]+=(s[f]-d[f])*a;else if(a===1)if(l&&!m)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=u+(n[f]-u)*i}else{const f=h.vertices;for(let u=0;u<r;u++){const p=s[u];d[u]+=p+(n[u]-p)*i-f[u]}}else if(i===0)V.arrayCopy(s,0,d,0,r);else for(let f=0;f<r;f++){const u=s[f];d[f]=u+(n[f]-u)*i}else if(m)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]=(u+(n[f]-u)*i)*a}else{const f=h.vertices;for(let u=0;u<r;u++){const p=s[u],g=f[u];d[u]=g+(p+(n[u]-p)*i-g)*a}}else if(l)if(h.bones)for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i)*a}else{const f=h.vertices;for(let u=0;u<r;u++){const p=s[u];d[u]+=(p+(n[u]-p)*i-f[u])*a}}else for(let f=0;f<r;f++){const u=s[f];d[f]+=(u+(n[f]-u)*i-d[f])*a}}},gs=class Yt extends Q{static ENTRIES=3;static MODE=1;static DELAY=2;slotIndex;attachment;constructor(t,s,n){super(t,`29|${s}|${n.sequence.id}`),this.slotIndex=s,this.attachment=n,this.instant=!0}getFrameEntries(){return Yt.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,n,i,r){const a=this.frames;t*=Yt.ENTRIES,a[t]=s,a[t+Yt.MODE]=n|i<<4,a[t+Yt.DELAY]=r}apply(t,s,n,i,r,a,c,l,o){const h=t.slots;if(!this.attachment.isTimelineActive(h,this.slotIndex,o))return;const d=this.attachment.timelineSlots,m=this.frames;if(l||n<m[0]){if(a!==0){this.setupPose(h[this.slotIndex],o);for(const x of d)this.setupPose(h[x],o)}return}const f=Q.search(m,n,Yt.ENTRIES),u=m[f],p=m[f+Yt.MODE],g=m[f+Yt.DELAY];this.applyToSlot(h[this.slotIndex],o,n,u,p,g);for(const x of d)this.applyToSlot(h[x],o,n,u,p,g)}setupPose(t,s){if(!t.bone.active)return;const n=s?t.appliedPose:t.pose;n.attachment===null||n.attachment.timelineAttachment!==this.attachment||(n.sequenceIndex=-1)}applyToSlot(t,s,n,i,r,a){if(!t.bone.active)return;const c=s?t.appliedPose:t.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;let l=r>>4,o=c.attachment.sequence.regions.length;const h=Ze[r&15];if(h!==0)switch(l+=(n-i)/a+1e-5|0,h){case 1:l=Math.min(o-1,l);break;case 2:l%=o;break;case 3:{const d=(o<<1)-2;l=d===0?0:l%d,l>=o&&(l=d-l);break}case 4:l=Math.max(o-1-l,0);break;case 5:l=o-1-l%o;break;case 6:{const d=(o<<1)-2;l=d===0?0:(l+o-1)%d,l>=o&&(l=d-l)}}c.sequenceIndex=l}},be=class ri extends Q{static propertyIds=["13"];events;constructor(t){super(t,...ri.propertyIds),this.events=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,n,i,r,a,c,l,o){if(!i)return;const h=this.frames,d=this.frames.length;if(s>n)this.apply(null,s,Number.MAX_VALUE,i,0,a,!1,!1,!1),s=-1;else if(s>=h[d-1])return;if(n<h[0])return;let m=0;if(s<h[0])m=0;else{m=Q.search(h,s)+1;const f=h[m];for(;m>0&&h[m-1]===f;)m--}for(;m<d&&n>=h[m];m++)i.push(this.events[m])}},Et=class an extends Q{static propertyID="14";static propertyIds=[an.propertyID];drawOrders;constructor(t){super(t,...an.propertyIds),this.drawOrders=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s,n){this.frames[t]=s,this.drawOrders[t]=n}apply(t,s,n,i,r,a,c,l,o){const h=o?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||n<this.frames[0]){a!==0&&V.arrayCopy(d,0,h,0,t.slots.length);return}const m=this.drawOrders[Q.search(this.frames,n)];if(!m)V.arrayCopy(d,0,h,0,t.slots.length);else for(let f=0,u=m.length;f<u;f++)h[f]=d[m[f]]}},ne=class ln extends Q{static propertyID="15";slots;inFolder;drawOrders;constructor(t,s,n){super(t,...ln.propertyIds(s)),this.slots=s,this.drawOrders=new Array(t),this.inFolder=new Array(n);for(const i of s)this.inFolder[i]=!0;this.instant=!0}static propertyIds(t){const s=t.length,n=new Array(s);for(let i=0;i<s;i++)n[i]=`${ln.propertyID}|${t[i]}`;return n}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(t,s,n){this.frames[t]=s,this.drawOrders[t]=n}apply(t,s,n,i,r,a,c,l,o){const h=o?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||n<this.frames[0])a!==0&&this.setup(h,d);else{const m=this.drawOrders[Q.search(this.frames,n)];if(!m)this.setup(h,d);else{const f=this.inFolder,u=this.slots;for(let p=0,g=0,x=u.length;!(f[h[p].data.index]&&(h[p]=d[u[m[g]]],++g===x));p++);}}}setup(t,s){const{inFolder:n,slots:i}=this;for(let r=0,a=0,c=i.length;!(n[t[r].data.index]&&(t[r]=s[i[a]],++a===c));r++);}};function vn(e){return typeof e=="object"&&e!==null&&typeof e.constraintIndex=="number"}var ps=class extends kt{constraintIndex=0;constructor(e,t,s){super(e,t,`16|${s}`),this.constraintIndex=s}getFrameEntries(){return 6}setFrame(e,t,s,n,i,r,a){e*=6,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n,this.frames[e+3]=i,this.frames[e+4]=r?1:0,this.frames[e+5]=a?1:0}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(!o.active)return;const h=l?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){const x=o.data.setupPose;switch(r){case 1:{h.mix=x.mix,h.softness=x.softness,h.bendDirection=x.bendDirection,h.compress=x.compress,h.stretch=x.stretch;break}case 2:{h.mix+=(x.mix-h.mix)*i,h.softness+=(x.softness-h.softness)*i,h.bendDirection=x.bendDirection,h.compress=x.compress,h.stretch=x.stretch;break}}return}let m=0,f=0;const u=Q.search(d,s,6),p=this.curves[u/6];switch(p){case 0:{const x=d[u];m=d[u+1],f=d[u+2];const w=(s-x)/(d[u+6]-x);m+=(d[u+6+1]-m)*w,f+=(d[u+6+2]-f)*w;break}case 1:m=d[u+1],f=d[u+2];break;default:m=this.getBezierValue(s,u,1,p-2),f=this.getBezierValue(s,u,2,p+18-2)}const g=r===1?o.data.setupPose:h;h.mix=g.mix+(m-g.mix)*i,h.softness=g.softness+(f-g.softness)*i,c?r===1&&(h.bendDirection=g.bendDirection,h.compress=g.compress,h.stretch=g.stretch):(h.bendDirection=d[u+3],h.compress=d[u+4]!==0,h.stretch=d[u+5]!==0)}},xs=class extends kt{constraintIndex=0;constructor(e,t,s){super(e,t,`17|${s}`),this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(e,t,s,n,i,r,a,c){const l=this.frames;e*=7,l[e]=t,l[e+1]=s,l[e+2]=n,l[e+3]=i,l[e+4]=r,l[e+5]=a,l[e+6]=c}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(!o.active)return;const h=l?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){const y=o.data.setupPose;switch(r){case 1:{h.mixRotate=y.mixRotate,h.mixX=y.mixX,h.mixY=y.mixY,h.mixScaleX=y.mixScaleX,h.mixScaleY=y.mixScaleY,h.mixShearY=y.mixShearY;break}case 2:{h.mixRotate+=(y.mixRotate-h.mixRotate)*i,h.mixX+=(y.mixX-h.mixX)*i,h.mixY+=(y.mixY-h.mixY)*i,h.mixScaleX+=(y.mixScaleX-h.mixScaleX)*i,h.mixScaleY+=(y.mixScaleY-h.mixScaleY)*i,h.mixShearY+=(y.mixShearY-h.mixShearY)*i;break}}return}let m,f,u,p,g,x;const w=Q.search(d,s,7),b=this.curves[w/7];switch(b){case 0:{const y=d[w];m=d[w+1],f=d[w+2],u=d[w+3],p=d[w+4],g=d[w+5],x=d[w+6];const T=(s-y)/(d[w+7]-y);m+=(d[w+7+1]-m)*T,f+=(d[w+7+2]-f)*T,u+=(d[w+7+3]-u)*T,p+=(d[w+7+4]-p)*T,g+=(d[w+7+5]-g)*T,x+=(d[w+7+6]-x)*T;break}case 1:m=d[w+1],f=d[w+2],u=d[w+3],p=d[w+4],g=d[w+5],x=d[w+6];break;default:m=this.getBezierValue(s,w,1,b-2),f=this.getBezierValue(s,w,2,b+18-2),u=this.getBezierValue(s,w,3,b+36-2),p=this.getBezierValue(s,w,4,b+54-2),g=this.getBezierValue(s,w,5,b+72-2),x=this.getBezierValue(s,w,6,b+90-2)}const v=r===1?o.data.setupPose:h;a?(h.mixRotate=v.mixRotate+m*i,h.mixX=v.mixX+f*i,h.mixY=v.mixY+u*i,h.mixScaleX=v.mixScaleX+p*i,h.mixScaleY=v.mixScaleY+g*i,h.mixShearY=v.mixShearY+x*i):(h.mixRotate=v.mixRotate+(m-v.mixRotate)*i,h.mixX=v.mixX+(f-v.mixX)*i,h.mixY=v.mixY+(u-v.mixY)*i,h.mixScaleX=v.mixScaleX+(p-v.mixScaleX)*i,h.mixScaleY=v.mixScaleY+(g-v.mixScaleY)*i,h.mixShearY=v.mixShearY+(x-v.mixShearY)*i)}},$t=class extends te{constraintIndex;constructor(e,t,s,n){super(e,t,`${n}|${s}`),this.constraintIndex=s}},ws=class extends $t{constructor(e,t,s){super(e,t,s,18),this.additive=!0}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;h.position=this.getAbsoluteValue(s,i,r,a,h.position,o.data.setupPose.position)}}},bs=class extends $t{constructor(e,t,s){super(e,t,s,19)}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;h.spacing=this.getAbsoluteValue(s,i,r,!1,h.spacing,o.data.setupPose.spacing)}}},ys=class extends kt{constraintIndex;constructor(e,t,s){super(e,t,`20|${s}`),this.constraintIndex=s}getFrameEntries(){return 4}setFrame(e,t,s,n,i){const r=this.frames;e<<=2,r[e]=t,r[e+1]=s,r[e+2]=n,r[e+3]=i}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(!o.active)return;const h=l?o.appliedPose:o.pose,d=this.frames;if(s<d[0]){const w=o.data.setupPose;switch(r){case 1:{h.mixRotate=w.mixRotate,h.mixX=w.mixX,h.mixY=w.mixY;break}case 2:{h.mixRotate+=(w.mixRotate-h.mixRotate)*i,h.mixX+=(w.mixX-h.mixX)*i,h.mixY+=(w.mixY-h.mixY)*i;break}}return}let m,f,u;const p=Q.search(d,s,4),g=this.curves[p>>2];switch(g){case 0:{const w=d[p];m=d[p+1],f=d[p+2],u=d[p+3];const b=(s-w)/(d[p+4]-w);m+=(d[p+4+1]-m)*b,f+=(d[p+4+2]-f)*b,u+=(d[p+4+3]-u)*b;break}case 1:m=d[p+1],f=d[p+2],u=d[p+3];break;default:m=this.getBezierValue(s,p,1,g-2),f=this.getBezierValue(s,p,2,g+18-2),u=this.getBezierValue(s,p,3,g+36-2)}const x=r===1?o.data.setupPose:h;a?(h.mixRotate=x.mixRotate+m*i,h.mixX=x.mixX+f*i,h.mixY=x.mixY+u*i):(h.mixRotate=x.mixRotate+(m-x.mixRotate)*i,h.mixX=x.mixX+(f-x.mixX)*i,h.mixY=x.mixY+(u-x.mixY)*i)}},Tt=class extends $t{constructor(e,t,s,n){super(e,t,s,n)}apply(e,t,s,n,i,r,a,c,l){if(a&&!this.additive&&(a=!1),this.constraintIndex===-1){const o=s>=this.frames[0]?this.getCurveValue(s):0,h=e.physics;for(const d of h)if(d.active&&this.global(d.data)){const m=l?d.appliedPose:d.pose;this.set(m,this.getAbsoluteValue(s,i,r,a,this.get(m),this.get(d.data.setupPose),o))}}else{const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;this.set(h,this.getAbsoluteValue(s,i,r,a,this.get(h),this.get(o.data.setupPose)))}}}},vs=class extends Tt{constructor(e,t,s){super(e,t,s,21)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},Ts=class extends Tt{constructor(e,t,s){super(e,t,s,22)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},Ss=class extends Tt{constructor(e,t,s){super(e,t,s,23)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},Cs=class extends Tt{constructor(e,t,s){super(e,t,s,24)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},As=class extends Tt{constructor(e,t,s){super(e,t,s,25),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},Is=class extends Tt{constructor(e,t,s){super(e,t,s,26),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},ks=class extends Tt{constructor(e,t,s){super(e,t,s,27)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}},Ms=class oi extends Q{static propertyIds=["28"];constraintIndex;constructor(t,s){super(t,...oi.propertyIds),this.constraintIndex=s,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,n,i,r,a,c,l,o){let h;if(this.constraintIndex!==-1&&(h=t.constraints[this.constraintIndex],!h.active))return;const d=this.frames;if(s>n)this.apply(t,s,Number.MAX_VALUE,[],r,a,!1,!1,!1),s=-1;else if(s>=d[d.length-1])return;if(!(n<d[0])&&(s<d[0]||n>=d[Q.search(d,s)+1]))if(h!=null)h.reset(t);else for(const m of t.physics)m.active&&m.reset(t)}},Ps=class extends $t{constructor(e,t,s){super(e,t,s,30)}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;h.time=this.getAbsoluteValue(s,i,r,a,h.time,o.data.setupPose.time)}}},Fs=class extends $t{constructor(e,t,s){super(e,t,s,31),this.additive=!0}apply(e,t,s,n,i,r,a,c,l){const o=e.constraints[this.constraintIndex];if(o.active){const h=l?o.appliedPose:o.pose;h.mix=this.getAbsoluteValue(s,i,r,a,h.mix,o.data.setupPose.mix)}}},Ys=class cn{static emptyAnimation=new xe("<empty>",[],0);data;tracks=[];timeScale=1;unkeyedState=0;events=[];listeners=[];queue=new Sn(this);propertyIds=new Map;animationsChanged=!1;trackEntryPool=new Zt(()=>new Tn);constructor(t){this.data=t}update(t){t*=this.timeScale;const s=this.tracks;for(let n=0,i=s.length;n<i;n++){const r=s[n];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let a=t*r.timeScale;if(r.delay>0){if(r.delay-=a,r.delay>0)continue;a=-r.delay,r.delay=0}let c=r.next;if(c){const l=r.trackLast-c.delay;if(l>=0){for(c.delay=0,c.trackTime+=r.timeScale===0?0:(l/r.timeScale+t)*c.timeScale,r.trackTime+=a,this.setTrack(n,c,!0);c.mixingFrom;)c.mixTime+=t,c=c.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){s[n]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){let l=r.mixingFrom;for(r.mixingFrom=null,l&&(l.mixingTo=null);l;)this.queue.end(l),l=l.mixingFrom}r.trackTime+=a}this.queue.drain()}updateMixingFrom(t,s){const n=t.mixingFrom;if(!n)return!0;const i=this.updateMixingFrom(n,s);if(n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.nextTrackLast!==-1&&t.mixTime>=t.mixDuration){if(n.totalAlpha===0||t.mixDuration===0){if(t.mixingFrom=n.mixingFrom,n.mixingFrom!=null&&(n.mixingFrom.mixingTo=t),n.totalAlpha===0)for(let r=t;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(n)}return i}return n.trackTime+=s*n.timeScale,t.mixTime+=s,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const s=this.events,n=this.tracks;let i=!1;for(let c=0,l=n.length;c<l;c++){const o=n[c];if(!o||o.delay>0)continue;i=!0;let h=o.alpha;o.mixingFrom?h*=this.applyMixingFrom(o,t):o.trackTime>=o.trackEnd&&!o.next&&(h=0);let d=o.animationLast,m=o.getAnimationTime(),f=m,u=s;o.reverse&&(f=o.animation.duration-f,u=null);const p=o.animation.timelines,g=p.length;if(c===0&&h===1)for(let x=0;x<g;x++){V.webkit602BugfixHelper(h);const w=p[x];w instanceof Ut?this.applyAttachmentTimeline(w,t,f,1,!0):w.apply(t,d,f,u,h,1,!1,!1,!1)}else{const x=o.timelineMode,w=h>=o.alphaAttachmentThreshold,b=o.additive,v=b||o.shortestRotation,y=!v&&o.timelinesRotation.length!==g<<1;y&&(o.timelinesRotation.length=g<<1);for(let T=0;T<g;T++){const S=p[T],A=x[T]&Rs;!v&&S instanceof ee?this.applyRotateTimeline(S,t,f,h,A,o.timelinesRotation,T<<1,y):S instanceof Ut?this.applyAttachmentTimeline(S,t,f,A,w):(V.webkit602BugfixHelper(h),S.apply(t,d,f,u,h,A,b,!1,!1))}}o.reverse&&this.eventsReverse(o,d,m),this.queueEvents(o,m),s.length=0,o.nextAnimationLast=m,o.nextTrackLast=o.trackTime}const r=this.unkeyedState+Xs,a=t.slots;for(let c=0,l=t.slots.length;c<l;c++){const o=a[c];if(o.attachmentState===r){const h=o.data.attachmentName;o.pose.setAttachment(h?t.getAttachment(o.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,s){const n=t.mixingFrom,i=n.mixingFrom!==null?this.applyMixingFrom(n,s):1,r=t.mix(),a=n.alpha*i,c=1-r*t.alpha,l=a*(1-r),o=c>0?l/c:a,h=n.animation.timelines,d=h.length,m=n.timelineMode,f=n.timelineHoldMix,u=r<n.mixAttachmentThreshold,p=r<n.mixDrawOrderThreshold,g=n.additive,x=g||n.shortestRotation,w=!x&&n.timelinesRotation.length!==d<<1;w&&(n.timelinesRotation.length=d<<1);const b=n.timelinesRotation;let v=n.animationLast,y=n.getAnimationTime(),T=y,S=null;n.reverse?T=n.animation.duration-T:r<n.eventThreshold&&(S=this.events),n.totalAlpha=0;for(let A=0;A<d;A++){const k=h[A],C=m[A],I=C&Rs;let P=0;if((C&ie)!==0){const F=f[A];P=F==null?o:o*(1-F.mix())}else{if(!p&&k instanceof Et&&I===0)continue;P=l}if(n.totalAlpha+=P,!x&&k instanceof ee)this.applyRotateTimeline(k,s,T,P,I,b,A<<1,w);else if(k instanceof Ut)this.applyAttachmentTimeline(k,s,T,I,u&&P>=n.alphaAttachmentThreshold);else{const F=!p||!(k instanceof Et)||I===0;k.apply(s,v,T,S,P,I,g,F,!1)}}return n.reverse&&r<n.eventThreshold&&this.eventsReverse(n,v,y),t.mixDuration>0&&this.queueEvents(n,y),this.events.length=0,n.nextAnimationLast=y,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(t,s,n,i,r){const a=s.slots[t.slotIndex];if(!a.bone.active||!r&&a.attachmentState===this.unkeyedState+Ls)return;let c=n<t.frames[0],l=null;if(c||(l=t.attachmentNames[Q.search(t.frames,n)],c=!r&&l==null),c){if(i===0)return;l=a.data.attachmentName}a.pose.setAttachment(l==null?null:s.getAttachment(a.data.index,l)),r?a.attachmentState=this.unkeyedState+Ls:c||(a.attachmentState=this.unkeyedState+Xs)}applyRotateTimeline(t,s,n,i,r,a,c,l){if(l&&(a[c]=0),i===1){t.apply(s,0,n,null,1,r,!1,!1,!1);return}const o=s.bones[t.boneIndex];if(!o.active)return;const h=o.pose,d=o.data.setupPose,m=t.frames;let f,u;if(n<m[0]){switch(r){case 1:{h.rotation=d.rotation;return}case 0:return}f=h.rotation,u=d.rotation}else f=r===1?d.rotation:h.rotation,u=d.rotation+t.getCurveValue(n);let p=0,g=u-f;if(g-=Math.ceil(g/360-.5)*360,g===0)p=a[c];else{let x=0,w=0;l?(x=0,w=g):(x=a[c],w=a[c+1]);const b=x-x%360;p=g+b;let v=g>=0,y=x>=0;Math.abs(w)<=90&&X.signum(w)!==X.signum(g)&&(Math.abs(x-b)>180?(p+=360*X.signum(x),y=v):b!==0?p-=360*X.signum(x):y=v),y!==v&&(p+=360*X.signum(x)),a[c]=p}a[c+1]=g,h.rotation=f+p*i}queueEvents(t,s){const n=t.animationStart,i=t.animationEnd,r=i-n,a=t.reverse;let c=t.trackLast%r;a&&(c=r-c);const l=this.events;let o=0,h=l.length;for(;o<h;o++){const m=l[o];if(m.time<c!==a)break;m.time>=n&&m.time<=i&&this.queue.event(t,m)}let d=!1;if(t.loop)if(r===0)d=!0;else{const m=Math.floor(t.trackTime/r);d=m>0&&m>Math.floor(t.trackLast/r)}else d=s>=i&&t.animationLast<i;for(d&&this.queue.complete(t);o<h;o++){const m=l[o];m.time>=n&&m.time<=i&&this.queue.event(t,m)}}eventsReverse(t,s,n){const i=t.animation.duration,r=i-s,a=i-n,c=t.animation.timelines;for(let l=0,o=t.animation.timelines.length;l<o;l++){const h=c[l];if(!(h instanceof be))continue;const d=h.events,m=h.frames,f=m.length;if(r>=a){for(let u=0;u<f;u++)if(!(m[u]<a)){if(m[u]>=r)break;this.events.push(d[u])}}else{for(let p=0;p<f&&!(m[p]>=r);p++)this.events.push(d[p]);let u=0;for(;u<f&&!(m[u]>=a);u++);for(;u<f;u++)this.events.push(d[u])}}}clearTracks(){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++)this.clearTrack(s);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");if(t>=this.tracks.length)return;const s=this.tracks[t];if(!s)return;this.queue.end(s),this.clearNext(s);let n=s;for(;;){const i=n.mixingFrom;if(!i)break;this.queue.end(i),n.mixingFrom=null,n.mixingTo=null,n=i}this.tracks[s.trackIndex]=null,this.queue.drain()}setTrack(t,s,n){const i=this.expandToIndex(t);this.tracks[t]=s,s.previous=null,i&&(i.next=null,n&&this.queue.interrupt(i),s.mixingFrom=i,i.mixingTo=s,s.mixTime=0,i.timelinesRotation.length=0),this.queue.start(s)}setAnimation(t,s,n=!1){return typeof s=="string"?this.setAnimation1(t,s,n):this.setAnimation2(t,s,n)}setAnimation1(t,s,n=!1){const i=this.data.skeletonData.findAnimation(s);if(!i)throw new Error(`Animation not found: ${s}`);return this.setAnimation2(t,i,n)}setAnimation2(t,s,n=!1){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(t);r&&(r.nextTrackLast===-1&&r.animation===s?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,i=!1):this.clearNext(r));const a=this.trackEntry(t,s,n,r);return this.setTrack(t,a,i),this.queue.drain(),a}addAnimation(t,s,n=!1,i=0){return typeof s=="string"?this.addAnimation1(t,s,n,i):this.addAnimation2(t,s,n,i)}addAnimation1(t,s,n=!1,i=0){const r=this.data.skeletonData.findAnimation(s);if(!r)throw new Error(`Animation not found: ${s}`);return this.addAnimation2(t,r,n,i)}addAnimation2(t,s,n=!1,i=0){if(t<0)throw new Error("trackIndex must be >= 0.");if(!s)throw new Error("animation cannot be null.");let r=this.expandToIndex(t);if(r)for(;r.next;)r=r.next;const a=this.trackEntry(t,s,n,r);return r?(r.next=a,a.previous=r,i<=0&&(i=Math.max(i+r.getTrackComplete()-a.mixDuration,0))):(this.setTrack(t,a,!0),this.queue.drain(),i<0&&(i=0)),a.delay=i,a}setEmptyAnimation(t,s=0){const n=this.setAnimation(t,cn.emptyAnimation,!1);return n.mixDuration=s,n.trackEnd=s,n}addEmptyAnimation(t,s=0,n=0){const i=this.addAnimation(t,cn.emptyAnimation,!1,n);return n<=0&&(i.delay=Math.max(i.delay+i.mixDuration-s,0)),i.mixDuration=s,i.trackEnd=s,i}setEmptyAnimations(t=0){const s=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let n=0,i=this.tracks.length;n<i;n++){const r=this.tracks[n];r&&this.setEmptyAnimation(r.trackIndex,t)}this.queue.drainDisabled=s,this.queue.drain()}expandToIndex(t){return t<this.tracks.length?this.tracks[t]:(V.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)}trackEntry(t,s,n,i){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=t,r.animation=s,r.loop=n,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=s.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=i?this.data.getMix(i.animation,s):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(t){let s=t.next;for(;s;)this.queue.dispose(s),s=s.next;t.next=null}_animationsChanged(){this.animationsChanged=!1;const t=this.tracks;for(let s=0,n=t.length;s<n;s++){const i=t[s];if(!i)continue;let r=i;for(;r.mixingFrom;)r=r.mixingFrom;do this.computeHold(r,i),r=r.mixingTo;while(r)}this.propertyIds.clear()}computeHold(t,s){const n=t.animation.timelines,i=t.animation.timelines.length,r=t.timelineMode;r.length=i;const a=t.timelineHoldMix;a.length=0;const c=t.additive,l=t.keepHold,o=t.mixingTo;for(let h=0;h<i;h++){const d=n[h],m=d.propertyIds,f=this.from(s,d,m);if(c&&d.additive){r[h]=f;continue}let u;if(o===null||d.instant||o.additive&&d.additive||!o.animation?.hasTimeline(m))u=f;else{u=f|ie;for(let p=o.mixingTo;p!=null;p=p.mixingTo)if(p.additive&&d.additive||!p.animation?.hasTimeline(m)){p.mixDuration>0&&(a[h]=p);break}}l&&(u=u&~ie|r[h]&ie),r[h]=u}}from(t,s,n){const i=this.propertyIds;let r=An;for(let a=0,c=n.length;a<c;a++){const l=i.get(n[a]);if(l===void 0)i.set(n[a],t);else{if(l!==t){for(;++a<c;)i.has(n[a])||i.set(n[a],t);return Es}r=Bs}}if(s instanceof ne){const a=i.get(Et.propertyID);if(a!=null)return a!==t?Es:Bs}return r}getTrack(t){if(t<0)throw new Error("trackIndex must be >= 0.");return t>=this.tracks.length?null:this.tracks[t]}addListener(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}removeListener(t){const s=this.listeners.indexOf(t);s>=0&&this.listeners.splice(s,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Tn=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=jt.linear;setMixDuration(e,t){this.mixDuration=e,t!==void 0&&(t<=0&&(t=this.previous==null?0:Math.max(t+this.previous.getTrackComplete()-e,0)),this.delay=t)}setMixInterpolation(e){if(!e)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=e}mix(){if(this.mixDuration===0)return 1;let e=this.mixTime/this.mixDuration;return e>=1?1:this.mixInterpolation===jt.linear?e:(e=this.mixInterpolation.apply(e),e<0?0:e>1?1:e)}timelineMode=[];timelineHoldMix=[];timelinesRotation=[];reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=jt.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const e=this.animationEnd-this.animationStart;return e===0?this.animationStart:this.trackTime%e+this.animationStart}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const e=this.animationEnd-this.animationStart;if(e!==0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},Sn=class{objects=[];drainDisabled=!1;animState;constructor(e){this.animState=e}start(e){this.objects.push(0),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(1),this.objects.push(e)}end(e){this.objects.push(2),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(3),this.objects.push(e)}complete(e){this.objects.push(4),this.objects.push(e)}event(e,t){this.objects.push(5),this.objects.push(e),this.objects.push(t)}drain(){if(!this.drainDisabled){this.drainDisabled=!0;for(let e=0;e<this.objects.length;e+=2){const t=this.objects,s=t[e],n=t[e+1],i=this.animState.listeners.slice();switch(s){case 0:n.listener?.start&&n.listener.start(n);for(let r=0;r<i.length;r++){const a=i[r];a.start&&a.start(n)}break;case 1:n.listener?.interrupt&&n.listener.interrupt(n);for(let r=0;r<i.length;r++){const a=i[r];a.interrupt&&a.interrupt(n)}break;case 2:n.listener?.end&&n.listener.end(n);for(let r=0;r<i.length;r++){const a=i[r];a.end&&a.end(n)}case 3:n.listener?.dispose&&n.listener.dispose(n);for(let r=0;r<i.length;r++){const a=i[r];a.dispose&&a.dispose(n)}this.animState.trackEntryPool.free(n);break;case 4:n.listener?.complete&&n.listener.complete(n);for(let r=0;r<i.length;r++){const a=i[r];a.complete&&a.complete(n)}break;case 5:{const r=t[e+++2];n.listener?.event&&n.listener.event(n,r);for(let a=0;a<i.length;a++){const c=i[a];c.event&&c.event(n,r)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}},Cn=(e=>(e[e.start=0]="start",e[e.interrupt=1]="interrupt",e[e.end=2]="end",e[e.dispose=3]="dispose",e[e.complete=4]="complete",e[e.event=5]="event",e))(Cn||{}),Pi=class{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}},Es=0,An=1,Bs=2,Rs=3,ie=4,Xs=1,Ls=2,In=class{skeletonData;animationToMixTime={};defaultMix=0;constructor(e){if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){return typeof e=="string"?this.setMix1(e,t,s):this.setMix2(e,t,s)}setMix1(e,t,s){const n=this.skeletonData.findAnimation(e);if(!n)throw new Error(`Animation not found: ${e}`);const i=this.skeletonData.findAnimation(t);if(!i)throw new Error(`Animation not found: ${t}`);this.setMix2(n,i,s)}setMix2(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");const n=`${e.name}.${t.name}`;this.animationToMixTime[n]=s}getMix(e,t){const s=`${e.name}.${t.name}`,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}},Fi=class{constructor(e,t="",s=new Mn,n=new kn){this.textureLoader=e,this.pathPrefix=t,this.downloader=s,this.cache=n}errors={};toLoad=0;loaded=0;texturePmaInfo={};start(e){return this.toLoad++,this.pathPrefix+e}success(e,t,s){this.toLoad--,this.loaded++,this.cache.assets[t]=s,this.cache.assetsRefCount[t]=(this.cache.assetsRefCount[t]||0)+1,e&&e(t,s)}error(e,t,s){this.toLoad--,this.loaded++,this.errors[t]=s,e&&e(t,s)}loadAll(){return new Promise((t,s)=>{const n=()=>{if(this.isLoadingComplete()){this.hasErrors()?s(this.errors):t(this);return}requestAnimationFrame(n)};requestAnimationFrame(n)})}setRawDataURI(e,t){this.downloader.rawDataUris[this.pathPrefix+e]=t}loadBinary(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((n,i)=>{this.downloader.downloadBinary(e,r=>{this.success(t,e,r),n(r)},(r,a)=>{const c=`Couldn't load binary ${e}: status ${r}, ${a}`;this.error(s,e,c),i(c)})}))}loadText(e,t=()=>{},s=()=>{}){e=this.start(e),this.downloader.downloadText(e,n=>{this.success(t,e,n)},(n,i)=>{this.error(s,e,`Couldn't load text ${e}: status ${n}, ${i}`)})}loadJson(e,t=()=>{},s=()=>{}){e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((n,i)=>{this.downloader.downloadJson(e,r=>{this.success(t,e,r),n(r)},(r,a)=>{const c=`Couldn't load JSON ${e}: status ${r}, ${a}`;this.error(s,e,c),i(c)})}))}reuseAssets(e,t=()=>{},s=()=>{}){const n=this.cache.getAsset(e),i=n!==void 0;return i&&(this.cache.assetsLoaded[e]=n.then(r=>(r=r instanceof Image||r instanceof ImageBitmap?this.textureLoader(r):r,this.success(t,e,r),r)).catch(r=>{this.error(s,e,r)})),i}loadTexture(e,t=()=>{},s=()=>{}){if(e=this.start(e),this.reuseAssets(e,t,s))return;const n=this.texturePmaInfo[e];this.cache.assetsLoaded[e]=new Promise((i,r)=>{if(!!!(typeof window<"u"&&typeof navigator<"u"&&window.document))fetch(e,{mode:"cors"}).then(l=>{if(l.ok)return l.blob();const o=`Couldn't load image: ${e}`;this.error(s,e,`Couldn't load image: ${e}`),r(o)}).then(l=>l?createImageBitmap(l,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null).then(l=>{if(l){const o=this.createTexture(e,n,l);this.success(t,e,o),i(o)}});else{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>{const o=this.createTexture(e,n,l);this.success(t,e,o),i(o)},l.onerror=()=>{const o=`Couldn't load image: ${e}`;this.error(s,e,o),r(o)},this.downloader.rawDataUris[e]&&(e=this.downloader.rawDataUris[e]),l.src=e}})}loadTextureAtlas(e,t=()=>{},s=()=>{},n){const i=e.lastIndexOf("/"),r=i>=0?e.substring(0,i+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((a,c)=>{this.downloader.downloadText(e,l=>{try{const o=this.createTextureAtlas(l,r,e,n);let h=o.pages.length,d=!1;if(h===0){this.success(t,e,o),a(o);return}for(const m of o.pages)this.loadTexture(this.texturePath(r,m.name,n),(f,u)=>{d||(m.setTexture(u),--h===0&&(this.success(t,e,o),a(o)))},(f,u)=>{if(!d){const p=`Couldn't load texture ${e} page image: ${f}`;this.error(s,e,p),c(p)}d=!0})}catch(o){const h=`Couldn't parse texture atlas ${e}: ${o.message}`;this.error(s,e,h),c(h)}},(l,o)=>{const h=`Couldn't load texture atlas ${e}: status ${l}, ${o}`;this.error(s,e,h),c(h)})}))}loadTextureAtlasButNoTextures(e,t=()=>{},s=()=>{}){const n=e.lastIndexOf("/"),i=n>=0?e.substring(0,n+1):"";e=this.start(e),!this.reuseAssets(e,t,s)&&(this.cache.assetsLoaded[e]=new Promise((r,a)=>{this.downloader.downloadText(e,c=>{try{const l=this.createTextureAtlas(c,i,e);this.success(t,e,l),r(l)}catch(l){const o=`Couldn't parse texture atlas ${e}: ${l.message}`;this.error(s,e,o),a(o)}},(c,l)=>{const o=`Couldn't load texture atlas ${e}: status ${c}, ${l}`;this.error(s,e,o),a(o)})}))}async loadBinaryAsync(e){return new Promise((t,s)=>{this.loadBinary(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadJsonAsync(e){return new Promise((t,s)=>{this.loadJson(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadTextureAsync(e){return new Promise((t,s)=>{this.loadTexture(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadTextureAtlasAsync(e){return new Promise((t,s)=>{this.loadTextureAtlas(e,(n,i)=>t(i),(n,i)=>s(i))})}async loadTextureAtlasButNoTexturesAsync(e){return new Promise((t,s)=>{this.loadTextureAtlasButNoTextures(e,(n,i)=>t(i),(n,i)=>s(i))})}setCache(e){this.cache=e}get(e){return this.cache.assets[this.pathPrefix+e]}require(e){e=this.pathPrefix+e;const t=this.cache.assets[e];if(t)return t;const s=this.errors[e];throw Error(`Asset not found: ${e}${s?`
${s}`:""}`)}remove(e){e=this.pathPrefix+e;const t=this.cache.assets[e];return t.dispose&&t.dispose(),delete this.cache.assets[e],delete this.cache.assetsRefCount[e],delete this.cache.assetsLoaded[e],t}removeAll(){for(const e in this.cache.assets){const t=this.cache.assets[e];t.dispose&&t.dispose()}this.cache.assets={},this.cache.assetsLoaded={},this.cache.assetsRefCount={}}isLoadingComplete(){return this.toLoad===0}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}disposeAsset(e){const t=this.cache.assets[e];if(t instanceof pe){t.dispose();return}this.disposeAssetInternal(e)}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}disposeAssetInternal(e){if(this.cache.assetsRefCount[e]>0&&--this.cache.assetsRefCount[e]===0)return this.remove(e)}createTextureAtlas(e,t,s,n){const i=new pe(e);i.dispose=()=>{if(!(this.cache.assetsRefCount[s]<=0)){this.disposeAssetInternal(s);for(const r of i.pages)r.texture?.dispose()}};for(const r of i.pages){const a=this.texturePath(t,r.name,n);this.texturePmaInfo[this.pathPrefix+a]=r.pma}return i}createTexture(e,t,s){const n=this.textureLoader(s,t),i=n.dispose.bind(n);return n.dispose=()=>{this.disposeAssetInternal(e)&&i()},n}texturePath(e,t,s){return s?s[t]:e+t}},kn=class ze{assets={};assetsRefCount={};assetsLoaded={};static AVAILABLE_CACHES=new Map;static getCache(t){const s=ze.AVAILABLE_CACHES.get(t);if(s)return s;const n=new ze;return ze.AVAILABLE_CACHES.set(t,n),n}async addAsset(t,s){return this.assetsLoaded[t]=Promise.resolve(s),this.assets[t]=s,s}getAsset(t){return this.assetsLoaded[t]}},Mn=class{callbacks={};rawDataUris={};dataUriToString(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");return t!==-1?(t+=7,atob(e.substr(t))):e.substr(e.indexOf(",")+1)}base64ToUint8Array(e){var t=window.atob(e),s=t.length,n=new Uint8Array(s);for(let i=0;i<s;i++)n[i]=t.charCodeAt(i);return n}dataUriToUint8Array(e){if(!e.startsWith("data:"))throw new Error("Not a data URI.");let t=e.indexOf("base64,");if(t===-1)throw new Error("Not a binary data URI.");return t+=7,this.base64ToUint8Array(e.substr(t))}downloadText(e,t,s){if(this.start(e,t,s))return;const n=this.rawDataUris[e];if(n&&!n.includes(".")){try{this.finish(e,200,this.dataUriToString(n))}catch(a){this.finish(e,400,JSON.stringify(a))}return}const i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",n||e,!0);const r=()=>{this.finish(e,i.status,i.responseText)};i.onload=r,i.onerror=r,i.send()}downloadJson(e,t,s){this.downloadText(e,n=>{t(JSON.parse(n))},s)}downloadBinary(e,t,s){if(this.start(e,t,s))return;const n=this.rawDataUris[e];if(n&&!n.includes(".")){try{this.finish(e,200,this.dataUriToUint8Array(n))}catch(a){this.finish(e,400,JSON.stringify(a))}return}const i=new XMLHttpRequest;i.open("GET",n||e,!0),i.responseType="arraybuffer";const r=()=>{this.finish(e,i.status,i.response)};i.onload=()=>{i.status===200||i.status===0?this.finish(e,200,new Uint8Array(i.response)):r()},i.onerror=r,i.send()}start(e,t,s){let n=this.callbacks[e];try{if(n)return!0;this.callbacks[e]=n=[]}finally{n.push(t,s)}}finish(e,t,s){const n=this.callbacks[e];if(delete this.callbacks[e],t===200||t===0)for(let i=0,r=n.length;i<r;i+=2)n[i](s);else for(let i=1,r=n.length;i<r;i+=2)n[i](t,s)}},Vs=class ai extends At{color=new z(1,1,1,1);constructor(t){super(t)}copy(){const t=new ai(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Bt=class li extends At{endSlot=null;convex=!1;inverse=!1;color=new z(.2275,.2275,.8078,1);constructor(t){super(t)}copy(){const t=new li(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.convex=this.convex,t.inverse=this.inverse,t.color.setFromColor(this.color),t}},re=class ci extends At{lengths=[];closed=!1;constantSpeed=!1;color=new z(1,1,1,1);constructor(t){super(t)}copy(){const t=new ci(this.name);return this.copyTo(t),t.lengths=[],V.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=this.closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},Pn=class hi extends At{x=0;y=0;rotation=0;color=new z(.38,.94,0,1);constructor(t){super(t)}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*X.degRad,n=Math.cos(s),i=Math.sin(s),r=n*t.a+i*t.b,a=n*t.c+i*t.d;return X.atan2Deg(a,r)}copy(){const t=new hi(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},Fn=class{atlas;allowMissingRegions;constructor(e,t=!1){this.atlas=e,this.allowMissingRegions=t}findRegions(e,t,s){const n=s.regions;for(let i=0,r=n.length;i<r;i++)n[i]=this.findRegion(e,s.getPath(t,i))}findRegion(e,t){const s=this.atlas.findRegion(t);if(!s&&!this.allowMissingRegions)throw new Error(`Region not found in atlas: ${t} (attachment: ${e})`);return s}newRegionAttachment(e,t,s,n,i){return this.findRegions(s,n,i),new It(s,i)}newMeshAttachment(e,t,s,n,i){return this.findRegions(s,n,i),new vt(s,i)}newBoundingBoxAttachment(e,t,s){return new Vs(s)}newPathAttachment(e,t,s){return new re(s)}newPointAttachment(e,t,s){return new Pn(s)}newClippingAttachment(e,t,s){return new Bt(s)}},ye=class{name;setupPose;skinRequired=!1;constructor(e,t){if(e==null)throw new Error("name cannot be null.");this.name=e,this.setupPose=t}},Ds=class di extends ye{index=0;parent=null;length=0;color=new z;icon;iconSize=1;iconRotation=0;visible=!1;constructor(t,s,n){if(super(s,new Te),t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("name cannot be null.");this.index=t,this.parent=n}copy(t){const s=new di(this.index,this.name,t);return s.length=this.length,s.setupPose.set(this.setupPose),s}},ve=(e=>(e[e.Normal=0]="Normal",e[e.OnlyTranslation=1]="OnlyTranslation",e[e.NoRotationOrReflection=2]="NoRotationOrReflection",e[e.NoScale=3]="NoScale",e[e.NoScaleOrReflection=4]="NoScaleOrReflection",e))(ve||{}),Te=class{bone;x=0;y=0;rotation=0;scaleX=0;scaleY=0;shearX=0;shearY=0;inherit=0;a=0;b=0;c=0;d=0;worldY=0;worldX=0;world=0;local=0;set(e){if(e==null)throw new Error("pose cannot be null.");this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}setPosition(e,t){this.x=e,this.y=t}setScale(e,t){this.scaleX=e,this.scaleY=t===void 0?e:t}getInherit(){return this.inherit}setInherit(e){if(e==null)throw new Error("inherit cannot be null.");this.inherit=e}update(e,t){this.world!==e._update&&this.updateWorldTransform(e)}updateWorldTransform(e){this.local===e._update?this.updateLocalTransform(e):this.world=e._update;const t=this.rotation,s=this.scaleX,n=this.scaleY,i=this.shearX,r=this.shearY;if(!this.bone.parent){const d=e.scaleX,m=e.scaleY,f=(t+i)*X.degRad,u=(t+90+r)*X.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(u)*n*d,this.c=Math.sin(f)*s*m,this.d=Math.sin(u)*n*m,this.worldX=this.x*d+e.x,this.worldY=this.y*m+e.y;return}const a=this.bone.parent.appliedPose;let c=a.a,l=a.b,o=a.c,h=a.d;switch(this.worldX=c*this.x+l*this.y+a.worldX,this.worldY=o*this.x+h*this.y+a.worldY,this.inherit){case 0:{const d=(t+i)*X.degRad,m=(t+90+r)*X.degRad,f=Math.cos(d)*s,u=Math.cos(m)*n,p=Math.sin(d)*s,g=Math.sin(m)*n;this.a=c*f+l*p,this.b=c*u+l*g,this.c=o*f+h*p,this.d=o*u+h*g;return}case 1:{const d=e.scaleX,m=e.scaleY,f=(t+i)*X.degRad,u=(t+90+r)*X.degRad;this.a=Math.cos(f)*s*d,this.b=Math.cos(u)*n*d,this.c=Math.sin(f)*s*m,this.d=Math.sin(u)*n*m;break}case 2:{const d=e.scaleX,m=e.scaleY,f=1/d,u=1/m;c*=f,o*=u;let p=c*c+o*o,g=0;p>X.epsilon2?(p=Math.abs(c*h*u-l*f*o)/p,l=o*p,h=c*p,g=t-X.atan2Deg(o,c)):(c=0,o=0,g=t-90+X.atan2Deg(h,l));const x=(g+i)*X.degRad,w=(g+r+90)*X.degRad,b=Math.cos(x)*s,v=Math.cos(w)*n,y=Math.sin(x)*s,T=Math.sin(w)*n;this.a=(c*b-l*y)*d,this.b=(c*v-l*T)*d,this.c=(o*b+h*y)*m,this.d=(o*v+h*T)*m;break}case 3:case 4:{const d=e.scaleX,m=e.scaleY,f=1/d,u=1/m,p=t*X.degRad,g=Math.cos(p),x=Math.sin(p);let w=(c*g+l*x)*f,b=(o*g+h*x)*u;const v=1/Math.sqrt(w*w+b*b);w*=v,b*=v;let y=-b,T=w;this.inherit===3&&c*h-l*o<0!=(d<0!=m<0)&&(y=-y,T=-T);const S=i*X.degRad,A=(90+r)*X.degRad,k=Math.cos(S)*s,C=Math.cos(A)*n,I=Math.sin(S)*s,P=Math.sin(A)*n;this.a=(w*k+y*I)*d,this.b=(w*C+y*P)*d,this.c=(b*k+T*I)*m,this.d=(b*C+T*P)*m;break}}}updateLocalTransform(e){this.local=0,this.world=e._update;const t=e.scaleX,s=e.scaleY;if(!this.bone.parent){const g=1/t,x=1/s;this.x=(this.worldX-e.x)*g,this.y=(this.worldY-e.y)*x,this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);return}const n=this.bone.parent.appliedPose;let i=n.a,r=n.b,a=n.c,c=n.d;const l=i*c-r*a,o=1/(i*c-r*a),h=c*o,d=r*o,m=a*o,f=i*o,u=this.worldX-n.worldX,p=this.worldY-n.worldY;switch(this.x=u*h-p*d,this.y=p*f-u*m,this.inherit){case 0:this.set5(h*this.a-d*this.c,h*this.b-d*this.d,f*this.c-m*this.a,f*this.d-m*this.b,0);break;case 1:{const g=1/t,x=1/s;this.set5(this.a*g,this.b*g,this.c*x,this.d*x,0);break}case 2:{const g=1/t,x=1/s;i*=g,a*=x;const w=this.a*g,b=this.b*g,v=this.c*x,y=this.d*x,T=1/(i*i+a*a),S=1/Math.abs(l*g*x);this.set5((i*w+a*v)*T,(i*b+a*y)*T,(i*v-a*w)*S,(i*y-a*b)*S,X.atan2Deg(a,i));break}case 3:case 4:{const g=1/t,x=1/s,w=this.a*g,b=this.b*g,v=this.c*x,y=this.d*x;let T=c*this.a-r*this.c,S=i*this.c-a*this.a;l<0&&(T=-T,S=-S);let A=X.atan2Deg(S,T);this.rotation=A,A*=X.degRad;const k=Math.cos(A),C=Math.sin(A);let I=(i*k+r*C)*g,P=(a*k+c*C)*x;const F=1/Math.sqrt(I*I+P*P);I*=F,P*=F;const B=this.inherit===3&&l<0!=(t<0!=s<0)?-1:1;this.set4(I*w+P*v,I*b+P*y,(I*v-P*w)*B,(I*y-P*b)*B)}}}set4(e,t,s,n){const i=e*e+s*s,r=t*t+n*n;i>X.epsilon2?(this.shearX=X.atan2Deg(s,e),this.scaleX=Math.sqrt(i)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(r),r>X.epsilon2?(this.shearY=X.atan2Deg(n,t),e*n-t*s<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(e,t,s,n,i){this.shearX=0;const r=e*e+s*s,a=t*t+n*n;if(r>X.epsilon2){const c=X.atan2Deg(s,e);this.rotation=c+i,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(a),a>X.epsilon2?(this.shearY=X.atan2Deg(n,t),e*n-t*s<0?(this.scaleY=-this.scaleY,this.shearY+=90-c):this.shearY-=90+c,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(a),this.shearY=0,this.rotation=a>X.epsilon2?X.atan2Deg(n,t)-90+i:i}validateLocalTransform(e){this.local===e._update&&this.updateLocalTransform(e)}modifyLocal(e){this.local===e._update&&this.updateLocalTransform(e),this.world=0,this.resetWorld(e,e._update)}modifyWorld(e){const t=e._update;this.local=t,this.world=t,this.resetWorld(e,t)}resetWorld(e,t){const s=this.bone.children;for(let n=0,i=s.length;n<i;n++){const r=s[n].appliedPose;r.world===t&&(r.local===t&&r.updateLocalTransform(e),r.world=0,r.resetWorld(e,t))}}getWorldRotationX(){return X.atan2Deg(this.c,this.a)}getWorldRotationY(){return X.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){if(e==null)throw new Error("world cannot be null.");const t=this.a*this.d-this.b*this.c,s=e.x-this.worldX,n=e.y-this.worldY;return e.x=(s*this.d-n*this.b)/t,e.y=(n*this.a-s*this.c)/t,e}localToWorld(e){if(e==null)throw new Error("local cannot be null.");const t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.localToWorld(e)}worldToLocalRotation(e){e*=X.degRad;const t=Math.sin(e),s=Math.cos(e);return X.atan2Deg(this.a*t-this.c*s,this.d*s-this.b*t)+this.rotation-this.shearX}localToWorldRotation(e){e=(e-this.rotation-this.shearX)*X.degRad;const t=Math.sin(e),s=Math.cos(e);return X.atan2Deg(s*this.c+t*this.d,s*this.a+t*this.b)}rotateWorld(e){e*=X.degRad;const t=Math.sin(e),s=Math.cos(e),n=this.a,i=this.b;this.a=s*n-t*this.c,this.b=s*i-t*this.d,this.c=t*n+s*this.c,this.d=t*i+s*this.d}},Ns=class{data;pose;constrainedPose;appliedPose;constructor(e,t,s){if(e==null)throw new Error("data cannot be null.");this.data=e,this.pose=t,this.constrainedPose=s,this.appliedPose=t}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}},_s=class extends Ns{active=!1;constructor(e,t,s){super(e,t,s),this.setupPose()}isActive(){return this.active}},Se=class ui extends _s{parent=null;children=[];sorted=!1;constructor(t,s){super(t,new Te,new Te),this.parent=s,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(t){const s=new ui(this.data,t);return s.pose.set(this.pose),s}},qt=class extends _s{constructor(e,t,s){super(e,t,s)}isSourceActive(){return!0}},Yn=class{_setupPose;pose;constrainedPose;appliedPose;constructor(e){this._setupPose=e,this.pose=[...e],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,V.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,V.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}},zt=class extends ye{constructor(e,t){super(e,t)}},Ce=(e=>(e[e.None=0]="None",e[e.Uniform=1]="Uniform",e[e.Volume=2]="Volume",e))(Ce||{}),Ae=class{time=0;data;intValue=0;floatValue=0;stringValue=null;volume=0;balance=0;constructor(e,t){if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Os=class{name;_audioPath=null;get audioPath(){return this._audioPath}set audioPath(e){if(e==null)throw new Error("audioPath cannot be null.");this._audioPath=e}setupPose=new Ae(-1,this);constructor(e){this.name=e}},Ie=class{bendDirection=0;compress=!1;stretch=!1;mix=0;softness=0;set(e){this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}},En=class Dt extends qt{bones;target;constructor(t,s){if(super(t,new Ie,new Ie),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of t.bones)this.bones.push(s.bones[n.index].constrainedPose);this.target=s.bones[t.target.index]}copy(t){var s=new Dt(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.target.appliedPose,r=this.bones;switch(r.length){case 1:Dt.apply(t,r[0],i.worldX,i.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Dt.apply(t,r[0],r[1],i.worldX,i.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(t){t.sortBone(this.target);const s=this.bones[0].bone;t.sortBone(s),t._updateCache.push(this),s.sorted=!1,t.sortReset(s.children),t.constrained(s),this.bones.length>1&&t.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(t,s,n,i,r,a,c,l,o,h){typeof n=="number"?Dt.apply1(t,s,n,i,r,a,c,l):Dt.apply2(t,s,n,i,r,a,c,l,o,h)}static apply1(t,s,n,i,r,a,c,l){s.modifyLocal(t);const o=s.bone.parent.appliedPose;let h=o.a,d=o.b,m=o.c,f=o.d,u=-s.shearX-s.rotation,p=0,g=0;switch(s.inherit){case 1:p=(n-s.worldX)*X.signum(t.scaleX),g=(i-s.worldY)*X.signum(t.scaleY);break;case 2:{const x=Math.abs(h*f-d*m)/Math.max(X.epsilon,h*h+m*m),w=h/t.scaleX,b=m/t.scaleY;d=-b*x*t.scaleX,f=w*x*t.scaleY,u+=X.atan2Deg(b,w)}default:{const x=n-o.worldX,w=i-o.worldY,b=h*f-d*m;Math.abs(b)<=X.epsilon?(p=0,g=0):(p=(x*f-w*d)/b-s.x,g=(w*h-x*m)/b-s.y)}}if(u+=X.atan2Deg(g,p),s.scaleX<0&&(u+=180),u>180?u-=360:u<=-180&&(u+=360),s.rotation+=u*l,r||a){switch(s.inherit){case 3:case 4:p=n-s.worldX,g=i-s.worldY}const x=s.bone.data.length*s.scaleX;if(x>X.epsilon){const w=p*p+g*g;if(r&&w<x*x||a&&w>x*x){const b=(Math.sqrt(w)/x-1)*l+1;switch(s.scaleX*=b,c){case 1:s.scaleY*=b;break;case 2:s.scaleY/=b<.7?.25+.642857*b:b}}}}}static apply2(t,s,n,i,r,a,c,l,o,h){if(s.inherit!==0||n.inherit!==0)return;s.modifyLocal(t),n.modifyLocal(t);let d=s.x,m=s.y,f=s.scaleX,u=s.scaleY,p=n.scaleX,g=0,x=0,w=0;f<0?(f=-f,g=180,w=-1):(g=0,w=1),u<0&&(u=-u,w=-w),p<0?(p=-p,x=180):x=0;let b=0,v=0,y=s.a,T=s.b,S=s.c,A=s.d;const k=Math.abs(f-u)<=X.epsilon;!k||c?(n.y=0,b=y*n.x+s.worldX,v=S*n.x+s.worldY):(b=y*n.x+T*n.y+s.worldX,v=S*n.x+A*n.y+s.worldY);const C=s.bone.parent.appliedPose;y=C.a,T=C.b,S=C.c,A=C.d;let I=y*A-T*S,P=b-C.worldX,F=v-C.worldY;I=Math.abs(I)<=X.epsilon?0:1/I;const B=(P*A-F*T)*I-d,R=(F*y-P*S)*I-m;let L=Math.sqrt(B*B+R*R),O=n.bone.data.length*p,N,Y;if(L<X.epsilon){Dt.apply(t,s,i,r,!1,c,0,h),n.rotation=0;return}P=i-C.worldX,F=r-C.worldY;let E=(P*A-F*T)*I-d,U=(F*y-P*S)*I-m,_=E*E+U*U;if(o!==0){o*=f*(p+1)*.5;const D=Math.sqrt(_),q=D-L-O*f+o;if(q>0){let $=Math.min(1,q/(o*2))-1;$=(q-o*(1-$*$))/D,E-=$*E,U-=$*U,_=E*E+U*U}}t:if(k){O*=f;let D=(_-L*L-O*O)/(2*L*O);if(D<-1)D=-1,Y=Math.PI*a;else if(D>1){if(D=1,Y=0,c)switch(y=(Math.sqrt(_)/(L+O)-1)*h+1,s.scaleX*=y,l){case 1:s.scaleY*=y;break;case 2:s.scaleY/=y<.7?.25+.642857*y:y}}else Y=Math.acos(D)*a;y=L+O*D,T=O*Math.sin(Y),N=Math.atan2(U*y-E*T,E*y+U*T)}else{y=f*O,T=u*O;const D=y*y,q=T*T,$=Math.atan2(U,E);S=q*L*L+D*_-D*q;const J=-2*q*L,st=q-D;if(A=J*J-4*st*S,A>=0){let yt=Math.sqrt(A);J<0&&(yt=-yt),yt=-(J+yt)*.5;let Ct=yt/st,ue=S/yt;const $e=Math.abs(Ct)<Math.abs(ue)?Ct:ue;if(Ct=_-$e*$e,Ct>=0){F=Math.sqrt(Ct)*a,N=$-Math.atan2(F,$e),Y=Math.atan2(F/u,($e-L)/f);break t}}let j=X.PI,nt=L-y,ot=nt*nt,it=0,pt=0,at=L+y,lt=at*at,xt=0;S=-y*L/(D-q),S>=-1&&S<=1&&(S=Math.acos(S),P=y*Math.cos(S)+L,F=T*Math.sin(S),A=P*P+F*F,A<ot&&(j=S,ot=A,nt=P,it=F),A>lt&&(pt=S,lt=A,at=P,xt=F)),_<=(ot+lt)*.5?(N=$-Math.atan2(it*a,nt),Y=j*a):(N=$-Math.atan2(xt*a,at),Y=pt*a)}const G=Math.atan2(n.y,n.x)*w;N=(N-G)*X.radDeg+g-s.rotation,N>180?N-=360:N<=-180&&(N+=360),s.rotation+=N*h,Y=((Y+G)*X.radDeg-n.shearX)*w+x-n.rotation,Y>180?Y-=360:Y<=-180&&(Y+=360),n.rotation+=Y*h}},oe=class extends zt{bones=[];_target=null;set target(e){this._target=e}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}_scaleYMode=0;set scaleYMode(e){this._scaleYMode=e}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}constructor(e){super(e,new Ie)}create(e){return new En(this,e)}},ke=class{position=0;spacing=0;mixRotate=0;mixX=0;mixY=0;set(e){this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}},ae=class extends zt{bones=[];set slot(e){this._slot=e}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}_slot=null;positionMode=0;spacingMode=1;rotateMode=1;offsetRotation=0;constructor(e){super(e,new ke)}create(e){return new Bn(this,e)}},Us=(e=>(e[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",e))(Us||{}),$s=(e=>(e[e.Length=0]="Length",e[e.Fixed=1]="Fixed",e[e.Percent=2]="Percent",e[e.Proportional=3]="Proportional",e))($s||{}),qs=(e=>(e[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale",e))(qs||{}),Bn=class Nt extends qt{static NONE=-1;static BEFORE=-2;static AFTER=-3;data;bones;slot;spaces=[];positions=[];world=[];curves=[];lengths=[];segments=[];constructor(t,s){if(super(t,new ke,new ke),!s)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const n of this.data.bones)this.bones.push(s.bones[n.index].constrainedPose);this.slot=s.slots[t.slot.index]}copy(t){var s=new Nt(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.slot.appliedPose.attachment;if(!(n instanceof re))return;const i=this.appliedPose,r=i.mixRotate,a=i.mixX,c=i.mixY;if(r===0&&a===0&&c===0)return;const l=this.data,o=l.rotateMode===0,h=l.rotateMode===2,d=this.bones,m=d.length,f=o?m:m+1,u=V.setArraySize(this.spaces,f),p=h?this.lengths=V.setArraySize(this.lengths,m):[],g=i.spacing;switch(l.spacingMode){case 2:if(h)for(let T=0,S=f-1;T<S;T++){const A=d[T],k=A.bone.data.length,C=k*A.a,I=k*A.c;p[T]=Math.sqrt(C*C+I*I)}V.arrayFill(u,1,f,g);break;case 3:{let T=0;for(let S=0,A=f-1;S<A;){const k=d[S],C=k.bone.data.length;if(C<X.epsilon)h&&(p[S]=0),u[++S]=g;else{const I=C*k.a,P=C*k.c,F=Math.sqrt(I*I+P*P);h&&(p[S]=F),u[++S]=F,T+=F}}if(T>0){T=f/T*g;for(let S=1;S<f;S++)u[S]*=T}break}default:{const T=l.spacingMode===0;for(let S=0,A=f-1;S<A;){const k=d[S],C=k.bone.data.length;if(C<X.epsilon)h&&(p[S]=0),u[++S]=g;else{const I=C*k.a,P=C*k.c,F=Math.sqrt(I*I+P*P);h&&(p[S]=F),u[++S]=(T?Math.max(0,C+g):g)*F/C}}}}const x=this.computeWorldPositions(t,n,f,o);let w=x[0],b=x[1],v=l.offsetRotation,y=!1;if(v===0)y=l.rotateMode===1;else{y=!1;const T=this.slot.bone.appliedPose;v*=T.a*T.d-T.b*T.c>0?X.degRad:-X.degRad}for(let T=0,S=3;T<m;T++,S+=3){const A=d[T];A.modifyWorld(t),A.worldX+=(w-A.worldX)*a,A.worldY+=(b-A.worldY)*c;const k=x[S],C=x[S+1],I=k-w,P=C-b;if(h){const F=p[T];if(F!==0){const B=(Math.sqrt(I*I+P*P)/F-1)*r+1;A.a*=B,A.c*=B}}if(w=k,b=C,r>0){let F=A.a,B=A.b,R=A.c,L=A.d,O=0,N=0,Y=0;if(o?O=x[S-1]:u[T+1]===0?O=x[S+2]:O=Math.atan2(P,I),O-=Math.atan2(R,F),y){N=Math.cos(O),Y=Math.sin(O);const E=A.bone.data.length;w+=(E*(N*F-Y*R)-I)*r,b+=(E*(Y*F+N*R)-P)*r}else O+=v;O>X.PI?O-=X.PI2:O<-X.PI&&(O+=X.PI2),O*=r,N=Math.cos(O),Y=Math.sin(O),A.a=N*F-Y*R,A.b=N*B-Y*L,A.c=Y*F+N*R,A.d=Y*B+N*L}}}computeWorldPositions(t,s,n,i){const r=this.slot;let a=this.appliedPose.position,c=this.spaces,l=V.setArraySize(this.positions,n*3+2),o=this.world;const h=s.closed;let d=s.worldVerticesLength,m=d/6,f=Nt.NONE;if(!s.constantSpeed){const Y=s.lengths;m-=h?1:2;const E=Y[m];this.data.positionMode===1&&(a*=E);let U;switch(this.data.spacingMode){case 2:U=E;break;case 3:U=E/n;break;default:U=1}o=V.setArraySize(this.world,8);for(let _=0,G=0,D=0;_<n;_++,G+=3){const q=c[_]*U;a+=q;let $=a;if(h)$%=E,$<0&&($+=E),D=0;else if($<0){f!==Nt.BEFORE&&(f=Nt.BEFORE,s.computeWorldVertices(t,r,2,4,o,0,2)),this.addBeforePosition($,o,0,l,G);continue}else if($>E){f!==Nt.AFTER&&(f=Nt.AFTER,s.computeWorldVertices(t,r,d-6,4,o,0,2)),this.addAfterPosition($-E,o,0,l,G);continue}for(;;D++){const J=Y[D];if(!($>J)){if(D===0)$/=J;else{const st=Y[D-1];$=($-st)/(J-st)}break}}D!==f&&(f=D,h&&D===m?(s.computeWorldVertices(t,r,d-4,4,o,0,2),s.computeWorldVertices(t,r,0,4,o,4,2)):s.computeWorldVertices(t,r,D*6+2,8,o,0,2)),this.addCurvePosition($,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],l,G,i||_>0&&q===0)}return l}h?(d+=2,o=V.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d-4,o,0,2),s.computeWorldVertices(t,r,0,2,o,d-4,2),o[d-2]=o[0],o[d-1]=o[1]):(m--,d-=4,o=V.setArraySize(this.world,d),s.computeWorldVertices(t,r,2,d,o,0,2));const u=V.setArraySize(this.curves,m);let p=0,g=o[0],x=o[1],w=0,b=0,v=0,y=0,T=0,S=0,A=0,k=0,C=0,I=0,P=0,F=0,B=0,R=0;for(let Y=0,E=2;Y<m;Y++,E+=6)w=o[E],b=o[E+1],v=o[E+2],y=o[E+3],T=o[E+4],S=o[E+5],A=(g-w*2+v)*.1875,k=(x-b*2+y)*.1875,C=((w-v)*3-g+T)*.09375,I=((b-y)*3-x+S)*.09375,P=A*2+C,F=k*2+I,B=(w-g)*.75+A+C*.16666667,R=(b-x)*.75+k+I*.16666667,p+=Math.sqrt(B*B+R*R),B+=P,R+=F,P+=C,F+=I,p+=Math.sqrt(B*B+R*R),B+=P,R+=F,p+=Math.sqrt(B*B+R*R),B+=P+C,R+=F+I,p+=Math.sqrt(B*B+R*R),u[Y]=p,g=T,x=S;this.data.positionMode===1&&(a*=p);let L;switch(this.data.spacingMode){case 2:L=p;break;case 3:L=p/n;break;default:L=1}const O=this.segments;let N=0;for(let Y=0,E=0,U=0,_=0;Y<n;Y++,E+=3){const G=c[Y]*L;a+=G;let D=a;if(h)D%=p,D<0&&(D+=p),U=0,_=0;else if(D<0){this.addBeforePosition(D,o,0,l,E);continue}else if(D>p){this.addAfterPosition(D-p,o,d-4,l,E);continue}for(;;U++){const q=u[U];if(!(D>q)){if(U===0)D/=q;else{const $=u[U-1];D=(D-$)/(q-$)}break}}if(U!==f){f=U;let q=U*6;for(g=o[q],x=o[q+1],w=o[q+2],b=o[q+3],v=o[q+4],y=o[q+5],T=o[q+6],S=o[q+7],A=(g-w*2+v)*.03,k=(x-b*2+y)*.03,C=((w-v)*3-g+T)*.006,I=((b-y)*3-x+S)*.006,P=A*2+C,F=k*2+I,B=(w-g)*.3+A+C*.16666667,R=(b-x)*.3+k+I*.16666667,N=Math.sqrt(B*B+R*R),O[0]=N,q=1;q<8;q++)B+=P,R+=F,P+=C,F+=I,N+=Math.sqrt(B*B+R*R),O[q]=N;B+=P,R+=F,N+=Math.sqrt(B*B+R*R),O[8]=N,B+=P+C,R+=F+I,N+=Math.sqrt(B*B+R*R),O[9]=N,_=0}for(D*=N;;_++){const q=O[_];if(!(D>q)){if(_===0)D/=q;else{const $=O[_-1];D=_+(D-$)/(q-$)}break}}this.addCurvePosition(D*.1,g,x,w,b,v,y,T,S,l,E,i||Y>0&&G===0)}return l}addBeforePosition(t,s,n,i,r){const a=s[n],c=s[n+1],l=s[n+2]-a,o=s[n+3]-c,h=Math.atan2(o,l);i[r]=a+t*Math.cos(h),i[r+1]=c+t*Math.sin(h),i[r+2]=h}addAfterPosition(t,s,n,i,r){const a=s[n+2],c=s[n+3],l=a-s[n],o=c-s[n+1],h=Math.atan2(o,l);i[r]=a+t*Math.cos(h),i[r+1]=c+t*Math.sin(h),i[r+2]=h}addCurvePosition(t,s,n,i,r,a,c,l,o,h,d,m){if(t===0||Number.isNaN(t)){h[d]=s,h[d+1]=n,h[d+2]=Math.atan2(r-n,i-s);return}const f=t*t,u=f*t,p=1-t,g=p*p,x=g*p,w=p*t,b=w*3,v=p*b,y=b*t,T=s*x+i*v+a*y+l*u,S=n*x+r*v+c*y+o*u;h[d]=T,h[d+1]=S,m&&(t<.001?h[d+2]=Math.atan2(r-n,i-s):h[d+2]=Math.atan2(S-(n*g+r*w*2+c*f),T-(s*g+i*w*2+a*f)))}sort(t){const s=this.slot.data.index,n=this.slot.bone;t.skin!=null&&this.sortPathSlot(t,t.skin,s,n),t.data.defaultSkin!=null&&t.data.defaultSkin!==t.skin&&this.sortPathSlot(t,t.data.defaultSkin,s,n),this.sortPath(t,this.slot.pose.attachment,n);const i=this.bones,r=this.bones.length;for(let a=0;a<r;a++){const c=i[a].bone;t.sortBone(c),t.constrained(c)}t._updateCache.push(this);for(let a=0;a<r;a++)t.sortReset(i[a].bone.children);for(let a=0;a<r;a++)i[a].bone.sorted=!0}sortPathSlot(t,s,n,i){const r=s.getAttachments();for(let a=0,c=r.length;a<c;a++){const l=r[a];l.slotIndex===n&&this.sortPath(t,l.attachment,i)}}sortPath(t,s,n){if(!(s instanceof re))return;const i=s.bones;if(i==null)t.sortBone(n);else{const r=t.bones;for(let a=0,c=i.length;a<c;){let l=i[a++];for(l+=a;a<l;)t.sortBone(r[i[a++]])}}}isSourceActive(){return this.slot.bone.active}},Rn=(e=>(e[e.none=0]="none",e[e.reset=1]="reset",e[e.update=2]="update",e[e.pose=3]="pose",e))(Rn||{}),Me=class{inertia=0;strength=0;damping=0;massInverse=0;wind=0;gravity=0;mix=0;set(e){this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}},Pe=class{color=new z(1,1,1,1);darkColor=null;attachment=null;sequenceIndex=0;deform=[];SlotPose(){}set(e){if(e==null)throw new Error("pose cannot be null.");this.color.setFromColor(e.color),this.darkColor!=null&&e.darkColor!=null&&this.darkColor.setFromColor(e.darkColor),this.attachment=e.attachment,this.sequenceIndex=e.sequenceIndex,this.deform.length=0,this.deform.push(...e.deform)}getAttachment(){return this.attachment}setAttachment(e){this.attachment!==e&&((!(e instanceof At)||!(this.attachment instanceof At)||e.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}},Xn=class fi extends Ns{skeleton;bone;attachmentState=0;constructor(t,s){if(super(t,new Pe,new Pe),!s)throw new Error("skeleton cannot be null.");this.skeleton=s,this.bone=s.bones[t.boneData.index],t.setupPose.darkColor!=null&&(this.pose.darkColor=new z,this.constrainedPose.darkColor=new z),this.setupPose()}copy(t,s,n){const i=new fi(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(i.pose.darkColor=new z,i.constrainedPose.darkColor=new z),i.pose.set(t.pose),i}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}},Gt=class Ge{static quadTriangles=[0,1,2,2,3,0];static yDown=!1;static get yDir(){return Ge.yDown?-1:1}data;bones;slots;drawOrder;constraints;physics;_updateCache=[];resetCache=[];skin=null;color;scaleX=1;_scaleY=1;get scaleY(){return this._scaleY*Ge.yDir}set scaleY(t){this._scaleY=t}x=0;y=0;time=0;windX=1;windY=0;gravityX=0;gravityY=1;_update=0;constructor(t){if(!t)throw new Error("data cannot be null.");this.data=t,this.bones=[];for(let s=0;s<t.bones.length;s++){const n=t.bones[s];let i;if(!n.parent)i=new Se(n,null);else{const r=this.bones[n.parent.index];i=new Se(n,r),r.children.push(i)}this.bones.push(i)}this.slots=[];for(const s of this.data.slots)this.slots.push(new Xn(s,this));this.drawOrder=new Yn(this.slots),this.physics=[],this.constraints=[];for(const s of this.data.constraints){const n=s.create(this);n instanceof zs&&this.physics.push(n),this.constraints.push(n)}this.color=new z(1,1,1,1),this.updateCache()}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const t=this.slots;for(let a=0,c=t.length;a<c;a++)t[a].unconstrained();const s=this.bones,n=s.length;for(let a=0,c=n;a<c;a++){const l=s[a];l.sorted=l.data.skinRequired,l.active=!l.sorted,l.unconstrained()}if(this.skin){const a=this.skin.bones;for(let c=0,l=this.skin.bones.length;c<l;c++){let o=this.bones[a[c].index];do o.sorted=!1,o.active=!0,o=o.parent;while(o)}}const i=this.constraints;let r=this.constraints.length;for(let a=0;a<r;a++)i[a].unconstrained();for(let a=0;a<r;a++){const c=i[a];c.active=c.isSourceActive()&&(!c.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(c.data)),c.active&&c.sort(this)}for(let a=0;a<n;a++)this.sortBone(s[a]);r=this._updateCache.length;for(let a=0;a<r;a++){const c=this._updateCache[a];c instanceof Se&&(this._updateCache[a]=c.appliedPose)}}constrained(t){t.pose===t.appliedPose&&(t.constrained(),this.resetCache.push(t))}sortBone(t){if(t.sorted||!t.active)return;const s=t.parent;s&&this.sortBone(s),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let s=0,n=t.length;s<n;s++){const i=t[s];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(t){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const s=this.resetCache;for(let i=0,r=this.resetCache.length;i<r;i++)s[i].resetConstrained();const n=this._updateCache;for(let i=0,r=this._updateCache.length;i<r;i++)n[i].update(this,t)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const t=this.bones;for(let n=0,i=t.length;n<i;n++)t[n].setupPose();const s=this.constraints;for(let n=0,i=s.length;n<i;n++)s[n].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const t=this.slots;for(let s=0,n=t.length;s<n;s++)t[s].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");const s=this.bones;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===t)return s[n];return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const s=this.slots;for(let n=0,i=s.length;n<i;n++)if(s[n].data.name===t)return s[n];return null}setSkin(t){typeof t=="string"?this.setSkinByName(t):this.setSkinBySkin(t)}setSkinByName(t){const s=this.data.findSkin(t);if(!s)throw new Error(`Skin not found: ${t}`);this.setSkin(s)}setSkinBySkin(t){if(t!==this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{const s=this.slots;for(let n=0,i=s.length;n<i;n++){const r=s[n],a=r.data.attachmentName;if(a){const c=t.getAttachment(n,a);c&&r.pose.setAttachment(c)}}}this.skin=t,this.updateCache()}}getAttachment(t,s){return typeof t=="string"?this.getAttachmentByName(t,s):this.getAttachmentByIndex(t,s)}getAttachmentByName(t,s){const n=this.data.findSlot(t);if(!n)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(n.index,s)}getAttachmentByIndex(t,s){if(!s)throw new Error("placeholder cannot be null.");if(this.skin){const n=this.skin.getAttachment(t,s);if(n)return n}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,s):null}setAttachment(t,s){if(!t)throw new Error("slotName cannot be null.");const n=this.findSlot(t);if(!n)throw new Error(`Slot not found: ${t}`);let i=null;if(s&&(i=this.getAttachment(n.data.index,s),!i))throw new Error(`Attachment not found: ${s}, for slot: ${t}`);n.pose.setAttachment(i)}findConstraint(t,s){if(t==null)throw new Error("constraintName cannot be null.");if(s==null)throw new Error("type cannot be null.");const n=this.constraints;for(let i=0,r=n.length;i<r;i++){const a=n[i];if(a instanceof s&&a.data.name===t)return a}return null}getBoundsRect(t){const s=new me,n=new me;return this.getBounds(s,n,void 0,t),{x:s.x,y:s.y,width:n.x,height:n.y}}getBounds(t,s,n=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!s)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,a=r;let c=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let d=0,m=r.length;d<m;d++){const f=a[d];if(!f.bone.active)continue;let u=0,p=null,g=null;const x=f.appliedPose.attachment;if(x){if(x instanceof It)u=8,p=V.setArraySize(n,u,0),x.computeWorldVertices(f,x.getOffsets(f.appliedPose),p,0,2),g=Ge.quadTriangles;else if(x instanceof vt)u=x.worldVerticesLength,p=V.setArraySize(n,u,0),x.computeWorldVertices(this,f,0,u,p,0,2),g=x.triangles;else if(x instanceof Bt&&i){i.clipEnd(f),i.clipStart(this,f,x);continue}if(p&&g){i?.isClipping()&&i.clipTriangles(p,g,g.length)&&(p=i.clippedVertices,u=i.clippedVertices.length);for(let w=0,b=p.length;w<b;w+=2){const v=p[w],y=p[w+1];c=Math.min(c,v),l=Math.min(l,y),o=Math.max(o,v),h=Math.max(h,y)}}}i&&i.clipEnd(f)}i&&i.clipEnd(),t.set(c,l),s.set(o-c,h-l)}setScale(t,s){this.scaleX=t,this.scaleY=s}setPosition(t,s){this.x=t,this.y=s}update(t){this.time+=t}physicsTranslate(t,s){const n=this.physics;for(let i=0,r=n.length;i<r;i++)n[i].translate(t,s)}physicsRotate(t,s,n){const i=this.physics;for(let r=0,a=i.length;r<a;r++)i[r].rotate(t,s,n)}},zs=class mi extends qt{bone;_reset=!0;ux=0;uy=0;cx=0;cy=0;tx=0;ty=0;xOffset=0;xLag=0;xVelocity=0;yOffset=0;yLag=0;yVelocity=0;rotateOffset=0;rotateLag=0;rotateVelocity=0;scaleOffset=0;scaleLag=0;scaleVelocity=0;remaining=0;lastTime=0;constructor(t,s){if(super(t,new Me,new Me),s==null)throw new Error("skeleton cannot be null.");this.bone=s.bones[t.bone.index].constrainedPose}copy(t){var s=new mi(this.data,t);return s.pose.set(this.pose),s}reset(t){this.remaining=0,this.lastTime=t.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(t,s){this.ux-=t,this.uy-=s,this.cx-=t,this.cy-=s}rotate(t,s,n){const i=n*X.degRad,r=Math.cos(i),a=Math.sin(i),c=this.cx-t,l=this.cy-s;this.translate(c*r-l*a-c,c*a+l*r-l)}update(t,s){const n=this.appliedPose,i=n.mix;if(i===0)return;const r=this.data.x>0,a=this.data.y>0,c=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,o=this.bone;let h=o.bone.data.length,d=this.data.step,m=0;if(s!==0){switch(o.modifyWorld(t),s){case 1:this.reset(t);case 2:{const f=Math.max(t.time-this.lastTime,0),u=this.remaining;this.remaining+=f,this.lastTime=t.time;const p=o.worldX,g=o.worldY;if(this._reset)this._reset=!1,this.ux=p,this.uy=g;else{let x=this.remaining,w=n.inertia,b=t.data.referenceScale,v=-1,y=0,T=0,S=this.data.limit*f,A=S*Math.abs(t.scaleY);if(S*=Math.abs(t.scaleX),r||a){if(r){const k=(this.ux-p)*w;this.xOffset+=k>S?S:k<-S?-S:k,this.ux=p}if(a){const k=(this.uy-g)*w;this.yOffset+=k>A?A:k<-A?-A:k,this.uy=g}if(x>=d){const k=this.xOffset,C=this.yOffset;v=n.damping**(60*d),y=d*n.massInverse,T=n.strength;const I=b*n.wind,P=b*n.gravity,F=(I*t.windX+P*t.gravityX)*t.scaleX,B=(I*t.windY+P*t.gravityY)*t.scaleY;do r&&(this.xVelocity+=(F-this.xOffset*T)*y,this.xOffset+=this.xVelocity*d,this.xVelocity*=v),a&&(this.yVelocity-=(B+this.yOffset*T)*y,this.yOffset+=this.yVelocity*d,this.yVelocity*=v),x-=d;while(x>=d);this.xLag=this.xOffset-k,this.yLag=this.yOffset-C}m=Math.max(0,1-x/d),r&&(o.worldX+=(this.xOffset-this.xLag*m)*i*this.data.x),a&&(o.worldY+=(this.yOffset-this.yLag*m)*i*this.data.y)}if(c||l){let k=Math.atan2(o.c,o.a),C=0,I=0,P=0,F=this.cx-o.worldX,B=this.cy-o.worldY;if(F>S?F=S:F<-S&&(F=-S),B>A?B=A:B<-A&&(B=-A),x=this.remaining,c){P=(this.data.rotate+this.data.shearX)*i,m=this.rotateLag*Math.max(0,1-u/d);let R=Math.atan2(B+this.ty,F+this.tx)-k-(this.rotateOffset-m)*P;this.rotateOffset+=(R-Math.ceil(R*X.invPI2-.5)*X.PI2)*w,R=(this.rotateOffset-m)*P+k,C=Math.cos(R),I=Math.sin(R),l&&(R=h*o.getWorldScaleX(),R>0&&(this.scaleOffset+=(F*C+B*I)*w/R))}else{C=Math.cos(k),I=Math.sin(k);const R=h*o.getWorldScaleX()-this.scaleLag*Math.max(0,1-u/d);R>0&&(this.scaleOffset+=(F*C+B*I)*w/R)}if(x>=d){v===-1&&(v=n.damping**(60*d),y=d*n.massInverse,T=n.strength);const R=n.wind*t.windX+n.gravity*t.gravityX,L=(n.wind*t.windY+n.gravity*t.gravityY)*Gt.yDir,O=this.rotateOffset,N=this.scaleOffset,Y=h/b;for(;;)if(x-=d,l&&(this.scaleVelocity+=(R*C-L*I-this.scaleOffset*T)*y,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=v),c){if(this.rotateVelocity-=((R*I+L*C)*Y+this.rotateOffset*T)*y,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=v,x<d)break;const E=this.rotateOffset*P+k;C=Math.cos(E),I=Math.sin(E)}else if(x<d)break;this.rotateLag=this.rotateOffset-O,this.scaleLag=this.scaleOffset-N}m=Math.max(0,1-x/d)}this.remaining=x}this.cx=o.worldX,this.cy=o.worldY;break}case 3:m=Math.max(0,1-this.remaining/d),r&&(o.worldX+=(this.xOffset-this.xLag*m)*i*this.data.x),a&&(o.worldY+=(this.yOffset-this.yLag*m)*i*this.data.y)}if(c){let f=(this.rotateOffset-this.rotateLag*m)*i,u=0,p=0,g=0;if(this.data.shearX>0){let x=0;this.data.rotate>0&&(x=f*this.data.rotate,u=Math.sin(x),p=Math.cos(x),g=o.b,o.b=p*g-u*o.d,o.d=u*g+p*o.d),x+=f*this.data.shearX,u=Math.sin(x),p=Math.cos(x),g=o.a,o.a=p*g-u*o.c,o.c=u*g+p*o.c}else f*=this.data.rotate,u=Math.sin(f),p=Math.cos(f),g=o.a,o.a=p*g-u*o.c,o.c=u*g+p*o.c,g=o.b,o.b=p*g-u*o.d,o.d=u*g+p*o.d}if(l){let f=1+(this.scaleOffset-this.scaleLag*m)*i*this.data.scaleX;switch(o.a*=f,o.c*=f,this.data.scaleYMode){case 1:o.b*=f,o.d*=f;break;case 2:f=Math.abs(f),f=f>=.7?1/f:4-3.67347*f,o.b*=f,o.d*=f}}s!==3&&(this.tx=h*o.a,this.ty=h*o.c)}}sort(t){const s=this.bone.bone;t.sortBone(s),t._updateCache.push(this),t.sortReset(s.children),t.constrained(s)}isSourceActive(){return this.bone.bone.active}},le=class extends zt{set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}_bone=null;x=0;y=0;rotate=0;scaleX=0;shearX=0;limit=0;step=0;inertiaGlobal=!1;strengthGlobal=!1;dampingGlobal=!1;massGlobal=!1;windGlobal=!1;gravityGlobal=!1;mixGlobal=!1;_scaleYMode=0;get scaleYMode(){return this._scaleYMode}set scaleYMode(e){if(e==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=e}constructor(e){super(e,new Me)}create(e){return new zs(this,e)}};typeof Math.fround>"u"&&(Math.fround=(e=>t=>(e[0]=t,e[0]))(new Float32Array(1)));var Fe=class{time=0;mix=0;set(e){this.time=e.time,this.mix=e.mix}},Ln=class hn extends qt{static offsets=[0,0,0,0,0,0];bone=null;constructor(t,s){if(super(t,new Fe,new Fe),!s)throw new Error("skeleton cannot be null.");t.bone!=null&&(this.bone=s.bones[t.bone.index])}copy(t){var s=new hn(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.appliedPose;if(n.mix===0)return;const i=this.data,r=i.animation,a=this.bone;if(a!==null){if(!a.active)return;i.local&&a.appliedPose.validateLocalTransform(t),n.time=i.offset+(i.property.value(t,a.appliedPose,i.local,hn.offsets)-i.property.offset)*i.scale,i.loop?n.time=r.duration+n.time%r.duration:n.time=Math.max(0,n.time)}const c=t.bones,l=r.bones;for(let o=0,h=r.bones.length;o<h;o++)c[l[o]].appliedPose.modifyLocal(t);r.apply(t,n.time,n.time,i.loop,null,n.mix,0,i.additive,!1,!0)}sort(t){const s=this.bone,n=this.data;s&&!n.local&&t.sortBone(s),t._updateCache.push(this);const i=t.bones,r=n.animation.bones;for(let d=0,m=n.animation.bones.length;d<m;d++){const f=i[r[d]];f.sorted=!1,t.sortReset(f.children),t.constrained(f)}const a=n.animation.timelines,c=t.slots,l=t.constraints,o=t.physics,h=t.physics.length;for(let d=0,m=n.animation.timelines.length;d<m;d++){const f=a[d];if(bn(f))t.constrained(c[f.slotIndex]);else if(f instanceof Et||f instanceof ne)t.drawOrder.constrained();else if(f instanceof Tt)if(f.constraintIndex===-1)for(let u=0;u<h;u++)t.constrained(o[u]);else t.constrained(l[f.constraintIndex]);else if(vn(f)){const u=f.constraintIndex;u!==-1&&t.constrained(l[u])}}}},Pt=class extends zt{animation;additive=!1;loop=!1;bone=null;property;scale=0;offset=0;local=!1;max=0;constructor(e){super(e,new Fe)}create(e){return new Ln(this,e)}},Ye=class{name=null;bones=[];slots=[];skins=[];defaultSkin=null;events=[];animations=[];constraints=[];x=0;y=0;width=0;height=0;referenceScale=100;version=null;hash=null;fps=30;imagesPath=null;audioPath=null;findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let s=0,n=t.length;s<n;s++)if(t[s].name===e)return t[s];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const t=this.slots;for(let s=0,n=t.length;s<n;s++)if(t[s].name===e)return t[s];return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");const t=this.skins;for(let s=0,n=t.length;s<n;s++)if(t[s].name===e)return t[s];return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");const t=this.events;for(let s=0,n=t.length;s<n;s++)if(t[s].name===e)return t[s];return null}findSliderAnimations(e){const t=this.constraints;for(let s=0,n=this.constraints.length;s<n;s++){const i=t[s];i instanceof Pt&&i.animation!=null&&e.push(i.animation)}return e}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");const t=this.animations;for(let s=0,n=t.length;s<n;s++)if(t[s].name===e)return t[s];return null}findConstraint(e,t){if(!e)throw new Error("constraintName cannot be null.");if(t==null)throw new Error("type cannot be null.");const s=this.constraints;for(let n=0,i=this.constraints.length;n<i;n++){const r=s[n];if(r instanceof t&&r.name===e)return r}return null}},Gs=class{slotIndex=0;placeholder;attachment;constructor(e=0,t,s){this.slotIndex=e,this.placeholder=t,this.attachment=s}},ce=class{name;attachments=[];bones=[];constraints=[];color=new z(.99607843,.61960787,.30980393,1);constructor(e){if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");const n=this.attachments;e>=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=s}addSkin(e){for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){const n=e.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const t=e.getAttachments();for(let s=0;s<t.length;s++){const n=t[s];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(e){for(let s=0;s<e.bones.length;s++){const n=e.bones[s];let i=!1;for(let r=0;r<this.bones.length;r++)if(this.bones[r]===n){i=!0;break}i||this.bones.push(n)}for(let s=0;s<e.constraints.length;s++){const n=e.constraints[s];let i=!1;for(let r=0;r<this.constraints.length;r++)if(this.constraints[r]===n){i=!0;break}i||this.constraints.push(n)}const t=e.getAttachments();for(let s=0;s<t.length;s++){const n=t[s];n.attachment&&(n.attachment instanceof vt?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(e,t){const s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){const s=this.attachments[e];s&&delete s[t]}getAttachments(){const e=[];for(let t=0;t<this.attachments.length;t++){const s=this.attachments[t];if(s)for(const n in s){const i=s[n];i&&e.push(new Gs(t,n,i))}}return e}getAttachmentsForSlot(e,t){const s=this.attachments[e];if(s)for(const n in s){const i=s[n];i&&t.push(new Gs(e,n,i))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let n=0;n<e.slots.length;n++){const i=e.slots[n],r=i.pose.getAttachment();if(r&&s<t.attachments.length){const a=t.attachments[s];for(const c in a){const l=a[c];if(r===l){const o=this.getAttachment(s,c);o&&i.pose.setAttachment(o);break}}}s++}}},Ws=class extends ye{index=0;boneData;attachmentName=null;blendMode=0;visible=!0;constructor(e,t,s){if(super(t,new Pe),e<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.boneData=s}},Hs=(e=>(e[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen",e))(Hs||{}),Ee=class{mixRotate=0;mixX=0;mixY=0;mixScaleX=0;mixScaleY=0;mixShearY=0;set(e){this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}},Vn=class gi extends qt{bones;source;constructor(t,s){if(super(t,new Ee,new Ee),!s)throw new Error("skeleton cannot be null.");this.bones=[];for(const i of t.bones)this.bones.push(s.bones[i.index].constrainedPose);const n=s.bones[t.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(t){var s=new gi(this.data,t);return s.pose.set(this.pose),s}update(t,s){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const i=this.data,r=i.localSource,a=i.localTarget,c=i.additive,l=i.clamp,o=i.offsets,h=this.source.appliedPose;r&&h.validateLocalTransform(t);const d=i.properties,m=i.properties.length,f=this.bones;for(let u=0,p=this.bones.length;u<p;u++){const g=f[u];a?g.modifyLocal(t):g.modifyWorld(t);for(let x=0;x<m;x++){const w=d[x],b=w.value(t,h,r,o)-w.offset,v=w.to;for(let y=0,T=w.to.length;y<T;y++){const S=v[y];if(S.mix(n)!==0){let A=S.offset+b*S.scale;l&&(S.offset<S.max?A=X.clamp(A,S.offset,S.max):A=X.clamp(A,S.max,S.offset)),S.apply(t,n,g,A,a,c)}}}}}sort(t){this.data.localSource||t.sortBone(this.source);const s=this.bones,n=this.bones.length,i=!this.data.localTarget;if(i)for(let r=0;r<n;r++)t.sortBone(s[r].bone);t._updateCache.push(this);for(let r=0;r<n;r++){const a=s[r].bone;t.sortReset(a.children),t.constrained(a)}for(let r=0;r<n;r++)s[r].bone.sorted=i}isSourceActive(){return this.source.active}},K=class ft extends zt{static ROTATION=0;static X=1;static Y=2;static SCALEX=3;static SCALEY=4;static SHEARY=5;bones=[];set source(t){this._source=t}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}_source=null;offsets=[0,0,0,0,0,0];offsetX=0;offsetY=0;localSource=!1;localTarget=!1;additive=!1;clamp=!1;properties=[];constructor(t){super(t,new Ee)}create(t){return new Vn(this,t)}getOffsetRotation(){return this.offsets[ft.ROTATION]}setOffsetRotation(t){this.offsets[ft.ROTATION]=t}getOffsetX(){return this.offsets[ft.X]}setOffsetX(t){this.offsets[ft.X]=t}getOffsetY(){return this.offsets[ft.Y]}setOffsetY(t){this.offsets[ft.Y]=t}getOffsetScaleX(){return this.offsets[ft.SCALEX]}setOffsetScaleX(t){this.offsets[ft.SCALEX]=t}getOffsetScaleY(){return this.offsets[ft.SCALEY]}setOffsetScaleY(t){this.offsets[ft.SCALEY]=t}getOffsetShearY(){return this.offsets[ft.SHEARY]}setOffsetShearY(t){this.offsets[ft.SHEARY]=t}},Rt=class{offset=0;to=[]},Xt=class{offset=0;max=0;scale=0},Be=class extends Rt{value(e,t,s,n){if(s)return t.rotation+n[K.ROTATION];const i=e.scaleX,r=e.scaleY;let a=Math.atan2(t.c/r,t.a/i)*X.radDeg+((t.a*t.d-t.b*t.c)*i*r>0?n[K.ROTATION]:-n[K.ROTATION]);return a<0&&(a+=360),a}},Ks=class extends Xt{mix(e){return e.mixRotate}apply(e,t,s,n,i,r){if(i)s.rotation+=(r?n:n-s.rotation)*t.mixRotate;else{const a=e.scaleX,c=e.scaleY,l=1/a,o=1/c,h=s.a*l,d=s.b*l,m=s.c*o,f=s.d*o;n*=X.degRad,r||(n-=Math.atan2(m,h)),n>X.PI?n-=X.PI2:n<-X.PI&&(n+=X.PI2),n*=t.mixRotate;const u=Math.cos(n),p=Math.sin(n);s.a=(u*h-p*m)*a,s.b=(u*d-p*f)*a,s.c=(p*h+u*m)*c,s.d=(p*d+u*f)*c}}},Re=class extends Rt{value(e,t,s,n){return s?t.x+n[K.X]:(n[K.X]*t.a+n[K.Y]*t.b+t.worldX)/e.scaleX}},Js=class extends Xt{mix(e){return e.mixX}apply(e,t,s,n,i,r){i?s.x+=(r?n:n-s.x)*t.mixX:(r||(n-=s.worldX/e.scaleX),s.worldX+=n*t.mixX*e.scaleX)}},Xe=class extends Rt{value(e,t,s,n){return s?t.y+n[K.Y]:(n[K.X]*t.c+n[K.Y]*t.d+t.worldY)/e.scaleY}},js=class extends Xt{mix(e){return e.mixY}apply(e,t,s,n,i,r){i?s.y+=(r?n:n-s.y)*t.mixY:(r||(n-=s.worldY/e.scaleY),s.worldY+=n*t.mixY*e.scaleY)}},Le=class extends Rt{value(e,t,s,n){if(s)return t.scaleX+n[K.SCALEX];const i=t.a/e.scaleX,r=t.c/e.scaleY;return Math.sqrt(i*i+r*r)+n[K.SCALEX]}},Zs=class extends Xt{mix(e){return e.mixScaleX}apply(e,t,s,n,i,r){if(i)r?s.scaleX*=1+(n-1)*t.mixScaleX:s.scaleX!==0&&(s.scaleX+=(n-s.scaleX)*t.mixScaleX);else if(r){const a=1+(n-1)*t.mixScaleX;s.a*=a,s.c*=a}else{let a=s.a/e.scaleX,c=s.c/e.scaleY,l=Math.sqrt(a*a+c*c);l!==0&&(l=1+(n-l)*t.mixScaleX/l,s.a*=l,s.c*=l)}}},Ve=class extends Rt{value(e,t,s,n){if(s)return t.scaleY+n[K.SCALEY];const i=t.b/e.scaleX,r=t.d/e.scaleY;return Math.sqrt(i*i+r*r)+n[K.SCALEY]}},Qs=class extends Xt{mix(e){return e.mixScaleY}apply(e,t,s,n,i,r){if(i)r?s.scaleY*=1+(n-1)*t.mixScaleY:s.scaleY!==0&&(s.scaleY+=(n-s.scaleY)*t.mixScaleY);else if(r){const a=1+(n-1)*t.mixScaleY;s.b*=a,s.d*=a}else{let a=s.b/e.scaleX,c=s.d/e.scaleY,l=Math.sqrt(a*a+c*c);l!==0&&(l=1+(n-l)*t.mixScaleY/l,s.b*=l,s.d*=l)}}},De=class extends Rt{value(e,t,s,n){if(s)return t.shearY+n[K.SHEARY];const i=1/e.scaleX,r=1/e.scaleY;return(Math.atan2(t.d*r,t.b*i)-Math.atan2(t.c*r,t.a*i))*X.radDeg-90+n[K.SHEARY]}},tn=class extends Xt{mix(e){return e.mixShearY}apply(e,t,s,n,i,r){if(i)r||(n-=s.shearY),s.shearY+=n*t.mixShearY;else{const a=e.scaleX,c=e.scaleY,l=s.b/a,o=s.d/c,h=Math.atan2(o,l);n=(n+90)*X.degRad,r?n-=X.PI/2:(n-=h-Math.atan2(s.c/c,s.a/a),n>X.PI?n-=X.PI2:n<-X.PI&&(n+=X.PI2)),n=h+n*t.mixShearY;const d=Math.sqrt(l*l+o*o);s.b=Math.cos(n)*d*a,s.d=Math.sin(n)*d*c}}},Dn=class{scale=1;attachmentLoader;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new Ye;s.name="";const n=new Nn(e),i=n.readInt32(),r=n.readInt32();s.hash=r===0&&i===0?null:r.toString(16)+i.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*t;const a=n.readBoolean();a&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let c=0;c=n.readInt(!0);for(let f=0;f<c;f++){const u=n.readString();if(!u)throw new Error("String in string table must not be null.");n.strings.push(u)}const l=s.bones;c=n.readInt(!0);for(let f=0;f<c;f++){const u=n.readString();if(!u)throw new Error("Bone name must not be null.");const p=f===0?null:l[n.readInt(!0)],g=new Ds(f,u,p),x=g.setupPose;x.rotation=n.readFloat(),x.x=n.readFloat()*t,x.y=n.readFloat()*t,x.scaleX=n.readFloat(),x.scaleY=n.readFloat(),x.shearX=n.readFloat(),x.shearY=n.readFloat(),x.inherit=n.readByte(),g.length=n.readFloat()*t,g.skinRequired=n.readBoolean(),a&&(z.rgba8888ToColor(g.color,n.readInt32()),g.icon=n.readString()??void 0,g.iconSize=n.readFloat(),g.iconRotation=n.readFloat(),g.visible=n.readBoolean()),l.push(g)}c=n.readInt(!0);for(let f=0;f<c;f++){const u=n.readString();if(!u)throw new Error("Slot name must not be null.");const p=l[n.readInt(!0)],g=new Ws(f,u,p);z.rgba8888ToColor(g.setupPose.color,n.readInt32());const x=n.readInt32();x!==-1&&z.rgb888ToColor(g.setupPose.darkColor=new z,x),g.attachmentName=n.readStringRef(),g.blendMode=n.readInt(!0),a&&(g.visible=n.readBoolean()),s.slots.push(g)}const o=s.constraints,h=n.readInt(!0);for(let f=0;f<h;f++){const u=n.readString();if(!u)throw new Error("Constraint data name must not be null.");let p;switch(n.readByte()){case ji:{const g=new oe(u);p=n.readInt(!0);for(let b=0;b<p;b++)g.bones.push(l[n.readInt(!0)]);g.target=l[n.readInt(!0)];const x=n.readByte();g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.scaleYMode=n.readUnsignedByte());const w=g.setupPose;w.bendDirection=(x&4)!==0?-1:1,w.compress=(x&8)!==0,w.stretch=(x&16)!==0,(x&32)!==0&&(w.mix=(x&64)!==0?n.readFloat():1),(x&128)!==0&&(w.softness=n.readFloat()*t),o.push(g);break}case Qi:{const g=new K(u);p=n.readInt(!0);for(let b=0;b<p;b++)g.bones.push(l[n.readInt(!0)]);g.source=l[n.readInt(!0)];let x=n.readUnsignedByte();g.skinRequired=(x&1)!==0,g.localSource=(x&2)!==0,g.localTarget=(x&4)!==0,g.additive=(x&8)!==0,g.clamp=(x&16)!==0,p=x>>5;for(let b=0,v;b<p;b++){let y=1,T;switch(n.readByte()){case 0:T=new Be;break;case 1:{y=t,T=new Re;break}case 2:{y=t,T=new Xe;break}case 3:T=new Le;break;case 4:T=new Ve;break;case 5:T=new De;break;default:T=null}if(T){T.offset=n.readFloat()*y,v=n.readByte();for(let S=0;S<v;S++){let A=1,k;switch(n.readByte()){case 0:k=new Ks;break;case 1:{A=t,k=new Js;break}case 2:{A=t,k=new js;break}case 3:k=new Zs;break;case 4:k=new Qs;break;case 5:k=new tn;break;default:k=null}k&&(k.offset=n.readFloat()*A,k.max=n.readFloat()*A,k.scale=n.readFloat()*A/y,T.to[S]=k)}g.properties[b]=T}}x=n.readByte(),(x&1)!==0&&(g.offsets[K.ROTATION]=n.readFloat()),(x&2)!==0&&(g.offsets[K.X]=n.readFloat()*t),(x&4)!==0&&(g.offsets[K.Y]=n.readFloat()*t),(x&8)!==0&&(g.offsets[K.SCALEX]=n.readFloat()),(x&16)!==0&&(g.offsets[K.SCALEY]=n.readFloat()),(x&32)!==0&&(g.offsets[K.SHEARY]=n.readFloat()),x=n.readByte();const w=g.setupPose;(x&1)!==0&&(w.mixRotate=n.readFloat()),(x&2)!==0&&(w.mixX=n.readFloat()),(x&4)!==0&&(w.mixY=n.readFloat()),(x&8)!==0&&(w.mixScaleX=n.readFloat()),(x&16)!==0&&(w.mixScaleY=n.readFloat()),(x&32)!==0&&(w.mixShearY=n.readFloat()),o.push(g);break}case Zi:{const g=new ae(u);p=n.readInt(!0);for(let b=0;b<p;b++)g.bones.push(l[n.readInt(!0)]);g.slot=s.slots[n.readInt(!0)];const x=n.readByte();g.skinRequired=(x&1)!==0,g.positionMode=x>>1&1,g.spacingMode=x>>2&3,g.rotateMode=x>>4&3,(x&128)!==0&&(g.offsetRotation=n.readFloat());const w=g.setupPose;w.position=n.readFloat(),g.positionMode===0&&(w.position*=t),w.spacing=n.readFloat(),(g.spacingMode===0||g.spacingMode===1)&&(w.spacing*=t),w.mixRotate=n.readFloat(),w.mixX=n.readFloat(),w.mixY=n.readFloat(),o.push(g);break}case tr:{const g=new le(u);g.bone=l[n.readInt(!0)];let x=n.readByte();if(g.skinRequired=(x&1)!==0,(x&2)!==0&&(g.x=n.readFloat()),(x&4)!==0&&(g.y=n.readFloat()),(x&8)!==0&&(g.rotate=n.readFloat()),(x&16)!==0){let b=n.readFloat();b<-2?(g.scaleYMode=2,b=-2-b):b<0&&(g.scaleYMode=1,b=-1-b),g.scaleX=b}(x&32)!==0&&(g.shearX=n.readFloat()),g.limit=((x&64)!==0?n.readFloat():5e3)*t,g.step=1/n.readUnsignedByte();const w=g.setupPose;w.inertia=n.readFloat(),w.strength=n.readFloat(),w.damping=n.readFloat(),w.massInverse=(x&128)!==0?n.readFloat():1,w.wind=n.readFloat(),w.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),w.mix=(x&128)!==0?n.readFloat():1,o.push(g);break}case er:{const g=new Pt(u),x=n.readByte();if(g.skinRequired=(x&1)!==0,g.loop=(x&2)!==0,g.additive=(x&4)!==0,(x&8)!==0){const w=n.readFloat();a&&(x&64)!==0?g.max=w:g.setupPose.time=w}if((x&16)!==0&&(g.setupPose.mix=(x&32)!==0?n.readFloat():1),(x&64)!==0){g.local=(x&128)!==0,g.bone=l[n.readInt(!0)];const w=n.readFloat();let b=1;switch(n.readByte()){case 0:g.property=new Be;break;case 1:{b=t,g.property=new Re;break}case 2:{b=t,g.property=new Xe;break}case 3:g.property=new Le;break;case 4:g.property=new Ve;break;case 5:g.property=new De;break;default:continue}g.property.offset=w*b,g.offset=n.readFloat(),g.scale=n.readFloat()/b}o.push(g);break}}}const d=this.readSkin(n,s,!0,a);d&&(s.defaultSkin=d,s.skins.push(d));{let f=s.skins.length;for(V.setArraySize(s.skins,c=f+n.readInt(!0));f<c;f++){const u=this.readSkin(n,s,!1,a);if(!u)throw new Error("readSkin() should not have returned null.");s.skins[f]=u}}c=this.linkedMeshes.length;for(let f=0;f<c;f++){const u=this.linkedMeshes[f],p=s.skins[u.skinIndex];if(!u.source)throw new Error("Linked mesh parent must not be null");const g=p.getAttachment(u.sourceIndex,u.source);if(!g)throw new Error(`Source mesh not found: ${u.source}`);u.mesh.timelineAttachment=u.inheritTimelines?g:u.mesh,u.mesh.setSourceMesh(g),u.mesh.updateSequence()}this.linkedMeshes.length=0,c=n.readInt(!0);for(let f=0;f<c;f++){const u=n.readString();if(!u)throw new Error("Event data name must not be null");const p=new Os(u),g=p.setupPose;g.intValue=n.readInt(!1),g.floatValue=n.readFloat(),g.stringValue=n.readString(),p._audioPath=n.readString(),p.audioPath&&(g.volume=n.readFloat(),g.balance=n.readFloat()),s.events.push(p)}const m=s.animations;c=n.readInt(!0);for(let f=0;f<c;f++){const u=n.readString();if(!u)throw new Error("Animation name must not be null.");m.push(this.readAnimation(n,u,s,a))}for(let f=0;f<h;f++){const u=o[f];u instanceof Pt&&(u.animation=m[n.readInt(!0)])}return s}readSkin(e,t,s,n){let i=null,r=0;if(s){if(r=e.readInt(!0),r===0)return null;i=new ce("default")}else{const a=e.readString();if(!a)throw new Error("Skin name must not be null.");i=new ce(a),n&&z.rgba8888ToColor(i.color,e.readInt32());let c=e.readInt(!0),l=t.bones,o=i.bones;for(let h=0;h<c;h++)o[h]=l[e.readInt(!0)];c=e.readInt(!0),l=t.constraints,o=i.constraints;for(let h=0;h<c;h++)o[h]=l[e.readInt(!0)];r=e.readInt(!0)}for(let a=0;a<r;a++){const c=e.readInt(!0);for(let l=0,o=e.readInt(!0);l<o;l++){const h=e.readStringRef();if(!h)throw new Error("Attachment name must not be null");const d=this.readAttachment(e,t,i,c,h,n);d&&i.setAttachment(c,h,d)}}return i}readAttachment(e,t,s,n,i,r){const a=this.scale,c=e.readByte(),l=(c&8)!==0?e.readStringRef():i;if(!l)throw new Error("Attachment name must not be null");switch(c&7){case 0:{let o=(c&16)!==0?e.readStringRef():null;const h=(c&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(c&64)!==0),m=(c&128)!==0?e.readFloat():0,f=e.readFloat(),u=e.readFloat(),p=e.readFloat(),g=e.readFloat(),x=e.readFloat(),w=e.readFloat();o||(o=l);const b=this.attachmentLoader.newRegionAttachment(s,i,l,o,d);return b?(b.path=o,b.x=f*a,b.y=u*a,b.scaleX=p,b.scaleY=g,b.rotation=m,b.width=x*a,b.height=w*a,z.rgba8888ToColor(b.color,h),b.updateSequence(),b):null}case 1:{const o=this.readVertices(e,(c&16)!==0),h=r?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,i,l);return d?(d.worldVerticesLength=o.length,d.vertices=o.vertices,d.bones=o.bones,r&&z.rgba8888ToColor(d.color,h),d):null}case 2:{let o=(c&16)!==0?e.readStringRef():l;const h=(c&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(c&64)!==0),m=e.readInt(!0),f=this.readVertices(e,(c&128)!==0),u=this.readFloatArray(e,f.length,1),p=this.readShortArray(e,(f.length-m-2)*3),g=e.readInt(!0);let x=null;if(g>0){x=[];for(let T=0;T<g;T++)x[T]=e.readInt(!0)}let w=[],b=0,v=0;r&&(w=this.readShortArray(e,e.readInt(!0)),b=e.readFloat(),v=e.readFloat()),o||(o=l);const y=this.attachmentLoader.newMeshAttachment(s,i,l,o,d);return y?(y.path=o,z.rgba8888ToColor(y.color,h),y.hullLength=m<<1,y.bones=f.bones,y.vertices=f.vertices,y.worldVerticesLength=f.length,y.regionUVs=u,y.triangles=p,x&&(y.timelineSlots=x),r&&(y.edges=w,y.width=b*a,y.height=v*a),y.updateSequence(),y):null}case 3:{const o=(c&16)!==0?e.readStringRef():l;if(o==null)throw new Error("Path of linked mesh must not be null");const h=(c&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(c&64)!==0),m=(c&128)!==0,f=e.readInt(!0),u=e.readInt(!0),p=e.readStringRef();let g=0,x=0;r&&(g=e.readFloat(),x=e.readFloat());const w=this.attachmentLoader.newMeshAttachment(s,i,l,o,d);return w?(w.path=o,z.rgba8888ToColor(w.color,h),r&&(w.width=g*a,w.height=x*a),this.linkedMeshes.push(new Yi(w,u,n,f,p,m)),w):null}case 4:{const o=(c&16)!==0,h=(c&32)!==0,d=this.readVertices(e,(c&64)!==0),m=this.readFloatArray(e,d.length/6,a),f=r?e.readInt32():0,u=this.attachmentLoader.newPathAttachment(s,i,l);return u?(u.closed=o,u.constantSpeed=h,u.worldVerticesLength=d.length,u.vertices=d.vertices,u.bones=d.bones,u.lengths=m,r&&z.rgba8888ToColor(u.color,f),u):null}case 5:{const o=e.readFloat(),h=e.readFloat(),d=e.readFloat(),m=r?e.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,i,l);return f?(f.x=h*a,f.y=d*a,f.rotation=o,r&&z.rgba8888ToColor(f.color,m),f):null}case 6:{const o=e.readInt(!0),h=this.readVertices(e,(c&16)!==0),d=r?e.readInt32():0,m=this.attachmentLoader.newClippingAttachment(s,i,l);return m?(m.endSlot=t.slots[o],m.convex=(c&32)!==0,m.inverse=(c&64)!==0,m.worldVerticesLength=h.length,m.vertices=h.vertices,m.bones=h.bones,r&&z.rgba8888ToColor(m.color,d),m):null}}}readSequence(e,t){if(!t)return new Qt(1,!1);const s=new Qt(e.readInt(!0),!0);return s.start=e.readInt(!0),s.digits=e.readInt(!0),s.setupIndex=e.readInt(!0),s}readVertices(e,t){const s=this.scale,i=e.readInt(!0)<<1;if(!t)return new _n(null,this.readFloatArray(e,i,s),i);const r=e.readInt(!0),a=[],c=[];for(let l=0,o=0;l<r;){const h=e.readInt(!0);a[l++]=h;for(let d=0;d<h;d++,o+=3)a[l++]=e.readInt(!0),c[o]=e.readFloat()*s,c[o+1]=e.readFloat()*s,c[o+2]=e.readFloat()}return new _n(a,V.toFloatArray(c),i)}readFloatArray(e,t,s){const n=[];if(s===1)for(let i=0;i<t;i++)n[i]=e.readFloat();else for(let i=0;i<t;i++)n[i]=e.readFloat()*s;return n}readShortArray(e,t){const s=[];for(let n=0;n<t;n++)s[n]=e.readInt(!0);return s}readAnimation(e,t,s,n){e.readInt(!0);const i=[],r=this.scale;for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),w=e.readInt(!0),b=w-1;switch(x){case zi:{const v=new Ut(w,u);for(let y=0;y<w;y++)v.setFrame(y,e.readFloat(),e.readStringRef());i.push(v);break}case Gi:{const v=e.readInt(!0),y=new cs(w,v,u);let T=e.readFloat(),S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255;for(let I=0,P=0;y.setFrame(I,T,S,A,k,C),I!==b;I++){const F=e.readFloat(),B=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case wt:y.setStepped(I);break;case bt:W(e,y,P++,I,0,T,F,S,B,1),W(e,y,P++,I,1,T,F,A,R,1),W(e,y,P++,I,2,T,F,k,L,1),W(e,y,P++,I,3,T,F,C,O,1)}T=F,S=B,A=R,k=L,C=O}i.push(y);break}case Wi:{const v=e.readInt(!0),y=new hs(w,v,u);let T=e.readFloat(),S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let C=0,I=0;y.setFrame(C,T,S,A,k),C!==b;C++){const P=e.readFloat(),F=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;switch(e.readByte()){case wt:y.setStepped(C);break;case bt:W(e,y,I++,C,0,T,P,S,F,1),W(e,y,I++,C,1,T,P,A,B,1),W(e,y,I++,C,2,T,P,k,R,1)}T=P,S=F,A=B,k=R}i.push(y);break}case Hi:{const v=e.readInt(!0),y=new us(w,v,u);let T=e.readFloat(),S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;for(let B=0,R=0;y.setFrame(B,T,S,A,k,C,I,P,F),B!==b;B++){const L=e.readFloat(),O=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255;switch(e.readByte()){case wt:y.setStepped(B);break;case bt:W(e,y,R++,B,0,T,L,S,O,1),W(e,y,R++,B,1,T,L,A,N,1),W(e,y,R++,B,2,T,L,k,Y,1),W(e,y,R++,B,3,T,L,C,E,1),W(e,y,R++,B,4,T,L,I,U,1),W(e,y,R++,B,5,T,L,P,_,1),W(e,y,R++,B,6,T,L,F,G,1)}T=L,S=O,A=N,k=Y,C=E,I=U,P=_,F=G}i.push(y);break}case Ki:{const v=e.readInt(!0),y=new fs(w,v,u);let T=e.readFloat(),S=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;for(let F=0,B=0;y.setFrame(F,T,S,A,k,C,I,P),F!==b;F++){const R=e.readFloat(),L=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255;switch(e.readByte()){case wt:y.setStepped(F);break;case bt:W(e,y,B++,F,0,T,R,S,L,1),W(e,y,B++,F,1,T,R,A,O,1),W(e,y,B++,F,2,T,R,k,N,1),W(e,y,B++,F,3,T,R,C,Y,1),W(e,y,B++,F,4,T,R,I,E,1),W(e,y,B++,F,5,T,R,P,U,1)}T=R,S=L,A=O,k=N,C=Y,I=E,P=U}i.push(y);break}case Ji:{const v=new ds(w,e.readInt(!0),u);let y=e.readFloat(),T=e.readUnsignedByte()/255;for(let S=0,A=0;v.setFrame(S,y,T),S!==b;S++){const k=e.readFloat(),C=e.readUnsignedByte()/255;switch(e.readByte()){case wt:v.setStepped(S);break;case bt:W(e,v,A++,S,0,y,k,T,C,1)}y=k,T=C}i.push(v)}}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),w=e.readInt(!0);if(x===qi){const v=new ls(w,u);for(let y=0;y<w;y++)v.setFrame(y,e.readFloat(),e.readByte());i.push(v);continue}const b=e.readInt(!0);switch(x){case Ri:tt(e,i,new ee(w,b,u),1);break;case Xi:tt(e,i,new Qe(w,b,u),r);break;case Li:tt(e,i,new ts(w,b,u),r);break;case Vi:tt(e,i,new es(w,b,u),r);break;case Di:tt(e,i,new ss(w,b,u),1);break;case Ni:tt(e,i,new ns(w,b,u),1);break;case _i:tt(e,i,new is(w,b,u),1);break;case Oi:tt(e,i,new rs(w,b,u),1);break;case Ui:tt(e,i,new os(w,b,u),1);break;case $i:tt(e,i,new as(w,b,u),1);break}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0),p=e.readInt(!0),g=p-1,x=new ps(p,e.readInt(!0),u);let w=e.readByte(),b=e.readFloat(),v=(w&1)!==0?(w&2)!==0?e.readFloat():1:0,y=(w&4)!==0?e.readFloat()*r:0;for(let T=0,S=0;x.setFrame(T,b,v,y,(w&8)!==0?1:-1,(w&16)!==0,(w&32)!==0),T!==g;T++){w=e.readByte();const A=e.readFloat(),k=(w&1)!==0?(w&2)!==0?e.readFloat():1:0,C=(w&4)!==0?e.readFloat()*r:0;(w&64)!==0?x.setStepped(T):(w&128)!==0&&(W(e,x,S++,T,0,b,A,v,k,1),W(e,x,S++,T,1,b,A,y,C,r)),b=A,v=k,y=C}i.push(x)}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0),p=e.readInt(!0),g=p-1,x=new xs(p,e.readInt(!0),u);let w=e.readFloat(),b=e.readFloat(),v=e.readFloat(),y=e.readFloat(),T=e.readFloat(),S=e.readFloat(),A=e.readFloat();for(let k=0,C=0;x.setFrame(k,w,b,v,y,T,S,A),k!==g;k++){const I=e.readFloat(),P=e.readFloat(),F=e.readFloat(),B=e.readFloat(),R=e.readFloat(),L=e.readFloat(),O=e.readFloat();switch(e.readByte()){case wt:x.setStepped(k);break;case bt:W(e,x,C++,k,0,w,I,b,P,1),W(e,x,C++,k,1,w,I,v,F,1),W(e,x,C++,k,2,w,I,y,B,1),W(e,x,C++,k,3,w,I,T,R,1),W(e,x,C++,k,4,w,I,S,L,1),W(e,x,C++,k,5,w,I,A,O,1)}w=I,b=P,v=F,y=B,T=R,S=L,A=O}i.push(x)}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0),p=s.constraints[u];for(let g=0,x=e.readInt(!0);g<x;g++){const w=e.readByte(),b=e.readInt(!0),v=e.readInt(!0);switch(w){case ir:tt(e,i,new ws(b,v,u),p.positionMode===0?r:1);break;case rr:tt(e,i,new bs(b,v,u),p.spacingMode===0||p.spacingMode===1?r:1);break;case or:{const y=new ys(b,v,u);let T=e.readFloat(),S=e.readFloat(),A=e.readFloat(),k=e.readFloat();for(let C=0,I=0,P=y.getFrameCount()-1;y.setFrame(C,T,S,A,k),C!==P;C++){const F=e.readFloat(),B=e.readFloat(),R=e.readFloat(),L=e.readFloat();switch(e.readByte()){case wt:y.setStepped(C);break;case bt:W(e,y,I++,C,0,T,F,S,B,1),W(e,y,I++,C,1,T,F,A,R,1),W(e,y,I++,C,2,T,F,k,L,1)}T=F,S=B,A=R,k=L}i.push(y)}}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0)-1;for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),w=e.readInt(!0);if(x===mr){const v=new Ms(w,u);for(let y=0;y<w;y++)v.setFrame(y,e.readFloat());i.push(v);continue}const b=e.readInt(!0);switch(x){case ar:tt(e,i,new vs(w,b,u),1);break;case lr:tt(e,i,new Ts(w,b,u),1);break;case cr:tt(e,i,new Ss(w,b,u),1);break;case hr:tt(e,i,new Cs(w,b,u),1);break;case dr:tt(e,i,new As(w,b,u),1);break;case ur:tt(e,i,new Is(w,b,u),1);break;case fr:tt(e,i,new ks(w,b,u),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readByte(),w=e.readInt(!0),b=e.readInt(!0);switch(x){case gr:tt(e,i,new Ps(w,b,u),1);break;case pr:tt(e,i,new Fs(w,b,u),1);break;default:throw new Error(`Uknown slider type: ${x}`)}}}for(let m=0,f=e.readInt(!0);m<f;m++){const u=s.skins[e.readInt(!0)];for(let p=0,g=e.readInt(!0);p<g;p++){const x=e.readInt(!0);for(let w=0,b=e.readInt(!0);w<b;w++){const v=e.readStringRef();if(!v)throw new Error("attachmentName must not be null.");const y=u.getAttachment(x,v),T=e.readByte(),S=e.readInt(!0),A=S-1;switch(T){case sr:{const k=y,C=k.bones,I=k.vertices,P=C?I.length/3*2:I.length,F=e.readInt(!0),B=new ms(S,F,x,k);let R=e.readFloat();for(let L=0,O=0;;L++){let N,Y=e.readInt(!0);if(Y===0)N=C?V.newFloatArray(P):I;else{N=V.newFloatArray(P);const U=e.readInt(!0);if(Y+=U,r===1)for(let _=U;_<Y;_++)N[_]=e.readFloat();else for(let _=U;_<Y;_++)N[_]=e.readFloat()*r;if(!C)for(let _=0,G=N.length;_<G;_++)N[_]+=I[_]}if(B.setFrame(L,R,N),L===A)break;const E=e.readFloat();switch(e.readByte()){case wt:B.setStepped(L);break;case bt:W(e,B,O++,L,0,R,E,0,1,1)}R=E}i.push(B);break}case nr:{const k=new gs(S,x,y);for(let C=0;C<S;C++){const I=e.readFloat(),P=e.readInt32();k.setFrame(C,I,Ze[P&15],P>>4,e.readFloat())}i.push(k);break}}}}}const a=s.slots.length,c=e.readInt(!0);if(c>0){const m=new Et(c);for(let f=0;f<c;f++)m.setFrame(f,e.readFloat(),On(e,a));i.push(m)}const l=e.readInt(!0);for(let m=0;m<l;m++){const f=e.readInt(!0),u=new Array(f);for(let x=0;x<f;x++)u[x]=e.readInt(!0);const p=e.readInt(!0),g=new ne(p,u,a);for(let x=0;x<p;x++)g.setFrame(x,e.readFloat(),On(e,f));i.push(g)}const o=e.readInt(!0);if(o>0){const m=new be(o);for(let f=0;f<o;f++){const u=e.readFloat(),p=s.events[e.readInt(!0)],g=new Ae(u,p);g.intValue=e.readInt(!1),g.floatValue=e.readFloat(),g.stringValue=e.readString(),g.stringValue==null&&(g.stringValue=p.setupPose.stringValue),g.data.audioPath&&(g.volume=e.readFloat(),g.balance=e.readFloat()),m.setFrame(f,g)}i.push(m)}let h=0;for(let m=0,f=i.length;m<f;m++)h=Math.max(h,i[m].getDuration());const d=new xe(t,i,h);return n&&z.rgba8888ToColor(d.color,e.readInt32()),d}},Nn=class{constructor(e,t=[],s=0,n=new DataView(e instanceof ArrayBuffer?e:e.buffer)){this.strings=t,this.index=s,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){const e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!==0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){const e=this.readInt(!0);return e===0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="";for(let s=0;s<e;){const n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(n),s++}}return t}readFloat(){const e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!==0}},Yi=class{source;skinIndex;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,n,i,r){this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}},_n=class{constructor(e=null,t,s=0){this.bones=e,this.vertices=t,this.length=s}};function tt(e,t,s,n){s instanceof te?Ei(e,t,s,n):Bi(e,t,s,n)}function Ei(e,t,s,n){let i=e.readFloat(),r=e.readFloat()*n;for(let a=0,c=0,l=s.getFrameCount()-1;s.setFrame(a,i,r),a!==l;a++){const o=e.readFloat(),h=e.readFloat()*n;switch(e.readByte()){case wt:s.setStepped(a);break;case bt:W(e,s,c++,a,0,i,o,r,h,n)}i=o,r=h}t.push(s)}function Bi(e,t,s,n){let i=e.readFloat(),r=e.readFloat()*n,a=e.readFloat()*n;for(let c=0,l=0,o=s.getFrameCount()-1;s.setFrame(c,i,r,a),c!==o;c++){const h=e.readFloat(),d=e.readFloat()*n,m=e.readFloat()*n;switch(e.readByte()){case wt:s.setStepped(c);break;case bt:W(e,s,l++,c,0,i,h,r,d,n),W(e,s,l++,c,1,i,h,a,m,n)}i=h,r=d,a=m}t.push(s)}function On(e,t){const s=e.readInt(!0);if(s===0)return null;const n=new Array(t).fill(-1),i=new Array(t-s);let r=0,a=0;for(let c=0;c<s;c++){const l=e.readInt(!0);for(;r!==l;)i[a++]=r++;n[r+e.readInt(!0)]=r++}for(;r<t;)i[a++]=r++;for(let c=t-1;c>=0;c--)n[c]===-1&&(n[c]=i[--a]);return n}function W(e,t,s,n,i,r,a,c,l,o){t.setBezier(s,n,i,r,c,e.readFloat(),e.readFloat()*o,e.readFloat(),e.readFloat()*o,a,l)}var Ri=0,Xi=1,Li=2,Vi=3,Di=4,Ni=5,_i=6,Oi=7,Ui=8,$i=9,qi=10,zi=0,Gi=1,Wi=2,Hi=3,Ki=4,Ji=5,ji=0,Zi=1,Qi=2,tr=3,er=4,sr=0,nr=1,ir=0,rr=1,or=2,ar=0,lr=1,cr=2,hr=4,dr=5,ur=6,fr=7,mr=8,gr=0,pr=1,wt=1,bt=2,Un=class{minX=0;minY=0;maxX=0;maxY=0;boundingBoxes=[];polygons=[];polygonPool=new Zt(()=>V.newFloatArray(16));update(e,t){if(!e)throw new Error("skeleton cannot be null.");const s=this.boundingBoxes,n=this.polygons,i=this.polygonPool,r=e.slots,a=r.length;s.length=0,i.freeAll(n),n.length=0;for(let c=0;c<a;c++){const l=r[c];if(!l.bone.active)continue;const o=l.appliedPose.attachment;if(o instanceof Vs){s.push(o);let h=i.obtain();h.length!==o.worldVerticesLength&&(h=V.newFloatArray(o.worldVerticesLength)),n.push(h),o.computeWorldVertices(e,l,0,o.worldVerticesLength,h,0,2)}}t?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let e=Number.POSITIVE_INFINITY,t=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;const i=this.polygons;for(let r=0,a=i.length;r<a;r++){const c=i[r],l=c;for(let o=0,h=c.length;o<h;o+=2){const d=l[o],m=l[o+1];e=Math.min(e,d),t=Math.min(t,m),s=Math.max(s,d),n=Math.max(n,m)}}this.minX=e,this.minY=t,this.maxX=s,this.maxY=n}aabbContainsPoint(e,t){return e>=this.minX&&e<=this.maxX&&t>=this.minY&&t<=this.maxY}aabbIntersectsSegment(e,t,s,n){const i=this.minX,r=this.minY,a=this.maxX,c=this.maxY;if(e<=i&&s<=i||t<=r&&n<=r||e>=a&&s>=a||t>=c&&n>=c)return!1;const l=(n-t)/(s-e);let o=l*(i-e)+t;if(o>r&&o<c||(o=l*(a-e)+t,o>r&&o<c))return!0;let h=(r-t)/l+e;return h>i&&h<a||(h=(c-t)/l+e,h>i&&h<a)}aabbIntersectsSkeleton(e){return this.minX<e.maxX&&this.maxX>e.minX&&this.minY<e.maxY&&this.maxY>e.minY}containsPoint(e,t){const s=this.polygons;for(let n=0,i=s.length;n<i;n++)if(this.containsPointPolygon(s[n],e,t))return this.boundingBoxes[n];return null}containsPointPolygon(e,t,s){const n=e,i=e.length;let r=i-2,a=!1;for(let c=0;c<i;c+=2){const l=n[c+1],o=n[r+1];if(l<s&&o>=s||o<s&&l>=s){const h=n[c];h+(s-l)/(o-l)*(n[r]-h)<t&&(a=!a)}r=c}return a}intersectsSegment(e,t,s,n){const i=this.polygons;for(let r=0,a=i.length;r<a;r++)if(this.intersectsSegmentPolygon(i[r],e,t,s,n))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(e,t,s,n,i){const r=e,a=e.length,c=t-n,l=s-i,o=t*i-s*n;let h=r[a-2],d=r[a-1];for(let m=0;m<a;m+=2){const f=r[m],u=r[m+1],p=h*u-d*f,g=h-f,x=d-u,w=c*x-l*g,b=(o*g-c*p)/w;if((b>=h&&b<=f||b>=f&&b<=h)&&(b>=t&&b<=n||b>=n&&b<=t)){const v=(o*x-l*p)/w;if((v>=d&&v<=u||v>=u&&v<=d)&&(v>=s&&v<=i||v>=i&&v<=s))return!0}h=f,d=u}return!1}getPolygon(e){if(!e)throw new Error("boundingBox cannot be null.");const t=this.boundingBoxes.indexOf(e);return t===-1?null:this.polygons[t]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},$n=class ct{convexPolygons=[];convexPolygonsIndices=[];indicesArray=[];isConcaveArray=[];triangles=[];polygonPool=new Zt(()=>[]);polygonIndicesPool=new Zt(()=>[]);triangulate(t){const s=t;let n=t.length>>1;const i=this.indicesArray;i.length=0;for(let c=0;c<n;c++)i[c]=c;const r=this.isConcaveArray;r.length=0;for(let c=0;c<n;c++)r[c]=ct.isConcave(c,n,s,i);const a=this.triangles;for(a.length=0;n>3;){let c=n-1,l=0,o=1;for(;;){t:if(!r[l]){const m=i[c]<<1,f=i[l]<<1,u=i[o]<<1,p=s[m],g=s[m+1],x=s[f],w=s[f+1],b=s[u],v=s[u+1];for(let y=o+1<n?o+1:0;y!==c;){if(r[y]){const T=i[y]<<1,S=s[T],A=s[T+1];if(ct.positiveArea(b,v,p,g,S,A)&&ct.positiveArea(p,g,x,w,S,A)&&ct.positiveArea(x,w,b,v,S,A))break t}++y===n&&(y=0)}break}if(o===0){do{if(!r[l])break;l--}while(l>0);c=l>0?l-1:n-1,o=l+1<n?l+1:0;break}c=l,l=o,++o===n&&(o=0)}a.push(i[c],i[l],i[o]),i.splice(l,1),r.splice(l,1),n--;const h=l>0?l-1:n-1,d=l<n?l:0;r[h]=ct.isConcave(h,n,s,i),r[d]=ct.isConcave(d,n,s,i)}return n===3&&a.push(i[2],i[0],i[1]),a}decompose(t,s){const n=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;const r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let a=this.polygonIndicesPool.obtain();a.length=0;let c=this.polygonPool.obtain();c.length=0;let l=-1,o=0;for(let h=0,d=s.length;h<d;h+=3){const m=s[h]<<1,f=s[h+1]<<1,u=s[h+2]<<1,p=n[m],g=n[m+1],x=n[f],w=n[f+1],b=n[u],v=n[u+1];if(l===m){const y=c.length-4;if(ct.winding(c[y],c[y+1],c[y+2],c[y+3],b,v)===o&&ct.winding(b,v,c[0],c[1],c[2],c[3])===o){c.push(b,v),a.push(u);continue}}c.length>0&&(i.push(c),r.push(a),c=this.polygonPool.obtain(),a=this.polygonIndicesPool.obtain()),c.length=0,c.push(p,g,x,w),c.push(b,v),a.length=0,a.push(m,f,u),o=ct.winding(p,g,x,w,b,v),l=m}c.length>0&&(i.push(c),r.push(a));for(let h=0,d=i.length;h<d;h++){if(a=r[h],a.length===0)continue;const m=a[0];let f=a[a.length-1];c=i[h];const u=c.length-4;let p=c[u],g=c[u+1],x=c[u+2],w=c[u+3];const b=c[0],v=c[1],y=c[2],T=c[3],S=ct.winding(p,g,x,w,b,v);for(let A=0;A<d;A++){if(A===h)continue;const k=r[A];if(k.length!==3)continue;const C=k[0],I=k[1],P=k[2],F=i[A],B=F[F.length-2],R=F[F.length-1];C!==m||I!==f||ct.winding(p,g,x,w,B,R)===S&&ct.winding(B,R,b,v,y,T)===S&&(F.length=0,k.length=0,c.push(B,R),a.push(P),f=P,p=x,g=w,x=B,w=R,A=-1)}}for(let h=i.length-1;h>=0;h--)c=i[h],c.length===0?(i.splice(h,1),this.polygonPool.free(c),a=r[h],r.splice(h,1),this.polygonIndicesPool.free(a)):c.push(c[0],c[1]);return i}static isConcave(t,s,n,i){const r=i[t>0?t-1:s-1]<<1,a=i[t]<<1,c=i[t+1<s?t+1:0]<<1;return!ct.positiveArea(n[r],n[r+1],n[a],n[a+1],n[c],n[c+1])}static positiveArea(t,s,n,i,r,a){return t*(a-i)+n*(s-a)+r*(i-s)>=0}static winding(t,s,n,i,r,a){return t*(a-i)+n*(s-a)+r*(i-s)>=0?1:-1}},he=class{triangulator=null;clippingPolygon=[];clippingPolygons=[];clipOutput=[];clippedVertices=[];clippedUVs=[];clippedTriangles=[];inverseVertices=[];_clippedVerticesTyped=new Float32Array(1024);_clippedUVsTyped=new Float32Array(1024);_clippedTrianglesTyped=new Uint16Array(1024);clippedVerticesTyped=new Float32Array(0);clippedUVsTyped=new Float32Array(0);clippedTrianglesTyped=new Uint16Array(0);clippedVerticesLength=0;clippedUVsLength=0;clippedTrianglesLength=0;scratch=[];inverse=!1;clipAttachment=null;clipStart(e,t,s){if(this.clipAttachment)return;const n=s.worldVerticesLength;this.clipAttachment=s,this.inverse=s.inverse;const i=V.setArraySize(this.clippingPolygon,n);s.computeWorldVertices(e,t,0,n,i,0,2);const r=this.clippingPolygon,a=this.makeClockwise(r);a||this.inverse||s.convex?(a||this.makeConvex(r),this.clippingPolygon.push(r[0],r[1]),this.clippingPolygons.push(r)):(this.triangulator===null&&(this.triangulator=new $n),this.clippingPolygons.push(...this.triangulator.decompose(r,this.triangulator.triangulate(r))))}clipEnd(e){this.clipAttachment&&(e&&this.clipAttachment.endSlot!==e.data||(this.clipAttachment=null,this.clippingPolygons.length=0))}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,n,i,r,a,c){return n&&i&&r&&typeof a=="boolean"&&typeof c=="number"?this.clipTrianglesRender(e,t,s,n,i,r,a,c):this.clipTrianglesNoRender(e,t,s)}clipTrianglesNoRender(e,t,s){const n=this.clippedVertices;n.length=0;const i=this.clippedTriangles;i.length=0;let r=0;if(this.inverse){const h=this.clippingPolygons[0];for(let d=0;d<s;d+=3){let m=t[d]<<1;const f=e[m],u=e[m+1];m=t[d+1]<<1;const p=e[m],g=e[m+1];m=t[d+2]<<1;const x=e[m],w=e[m+1];this.clipInverse(f,u,p,g,x,w,h);const b=this.inverseVertices;for(let v=0,y=this.inverseVertices.length;v<y;){const T=b[v++];let S=T>>1,A=n.length;const k=V.setArraySize(n,A+T);V.arrayCopy(b,v,k,A,T),A=i.length;const C=V.setArraySize(i,A+3*(S-2));for(let I=1;I<S-1;I++,A+=3)C[A]=r,C[A+1]=r+I,C[A+2]=r+I+1;r+=S,v+=T}}return!0}const a=this.clipOutput,c=this.clippingPolygons,l=c.length;let o=null;for(let h=0;h<s;h+=3){let d=t[h]<<1;const m=e[d],f=e[d+1];d=t[h+1]<<1;const u=e[d],p=e[d+1];d=t[h+2]<<1;const g=e[d],x=e[d+1];for(let w=0;w<l;w++){let b=n.length;if(this.clip(m,f,u,p,g,x,c[w])){o=this.clipOutput;const v=a.length;if(v===0)continue;let y=v>>1;const T=V.setArraySize(n,b+v);V.arrayCopy(o,0,T,b,v),b=i.length;const S=V.setArraySize(i,b+3*(y-2));y--;for(let A=1;A<y;A++,b+=3)S[b]=r,S[b+1]=r+A,S[b+2]=r+A+1;r+=y}else{const v=V.setArraySize(n,b+6);v[b]=m,v[b+1]=f,v[b+2]=u,v[b+3]=p,v[b+4]=g,v[b+5]=x,b=i.length;const y=V.setArraySize(i,b+3);y[b]=r,y[b+1]=r+1,y[b+2]=r+2,r+=3;break}}}return o!=null}clipTrianglesRender(e,t,s,n,i,r,a,c){const l=this.clippedVertices;l.length=0;const o=this.clippedTriangles;o.length=0;let h=0;if(this.inverse){const p=this.clippingPolygons[0];for(let g=0;g<s;g+=3){let x=t[g],w=t[g+1],b=t[g+2];const v=e[x*c],y=e[x*c+1],T=e[w*c],S=e[w*c+1],A=e[b*c],k=e[b*c+1];this.clipInverse(v,y,T,S,A,k,p);const C=this.inverseVertices.length;if(C===0)continue;const I=n[x<<=1],P=n[x+1],F=n[w<<=1],B=n[w+1],R=n[b<<=1],L=n[b+1],O=S-k,N=A-T,Y=v-A,E=k-y,U=1/(O*Y+N*(y-k)),_=this.inverseVertices;for(let G=0;G<C;){const D=_[G++],q=D>>1;let $=l.length;const J=V.setArraySize(l,$+q*c);for(let j=0;j<D;j+=2,$+=c){const nt=_[G+j],ot=_[G+j+1];J[$]=nt,J[$+1]=ot,J[$+2]=i.r,J[$+3]=i.g,J[$+4]=i.b,J[$+5]=i.a;const it=nt-A,pt=ot-k,at=(O*it+N*pt)*U,lt=(E*it+Y*pt)*U,xt=1-at-lt;J[$+6]=I*at+F*lt+R*xt,J[$+7]=P*at+B*lt+L*xt,a&&(J[$+8]=r.r,J[$+9]=r.g,J[$+10]=r.b,J[$+11]=r.a)}$=o.length;const st=V.setArraySize(o,$+3*(q-2));for(let j=1;j<q-1;j++,$+=3)st[$]=h,st[$+1]=h+j,st[$+2]=h+j+1;h+=q,G+=D}}return!0}const d=this.clipOutput,m=this.clippingPolygons,f=this.clippingPolygons.length;let u=null;for(let p=0;p<s;p+=3){let g=t[p];const x=e[g*c],w=e[g*c+1],b=n[g<<1],v=n[(g<<1)+1];g=t[p+1];const y=e[g*c],T=e[g*c+1],S=n[g<<1],A=n[(g<<1)+1];g=t[p+2];const k=e[g*c],C=e[g*c+1],I=n[g<<1],P=n[(g<<1)+1];let F=0,B=0,R=0,L=0,O=0;for(let N=0;N<f;N++){let Y=l.length;if(this.clip(x,w,y,T,k,C,m[N])){u=this.clipOutput;const E=d.length;if(E===0)continue;let U=E>>1;O===0&&(F=T-C,B=k-y,R=x-k,L=C-w,O=1/(F*R-B*L));const _=V.setArraySize(l,Y+U*c);for(let D=0;D<E;D+=2,Y+=c){const q=u[D],$=u[D+1];_[Y]=q,_[Y+1]=$,_[Y+2]=i.r,_[Y+3]=i.g,_[Y+4]=i.b,_[Y+5]=i.a;const J=q-k,st=$-C,j=(F*J+B*st)*O,nt=(L*J+R*st)*O,ot=1-j-nt;_[Y+6]=b*j+S*nt+I*ot,_[Y+7]=v*j+A*nt+P*ot,a&&(_[Y+8]=r.r,_[Y+9]=r.g,_[Y+10]=r.b,_[Y+11]=r.a)}Y=o.length;const G=V.setArraySize(o,Y+3*(U-2));U--;for(let D=1;D<U;D++,Y+=3)G[Y]=h,G[Y+1]=h+D,G[Y+2]=h+D+1;h+=U+1}else{const E=V.setArraySize(l,Y+3*c);E[Y]=x,E[Y+1]=w,E[Y+2]=i.r,E[Y+3]=i.g,E[Y+4]=i.b,E[Y+5]=i.a,a?(E[Y+6]=b,E[Y+7]=v,E[Y+8]=r.r,E[Y+9]=r.g,E[Y+10]=r.b,E[Y+11]=r.a,E[Y+12]=y,E[Y+13]=T,E[Y+14]=i.r,E[Y+15]=i.g,E[Y+16]=i.b,E[Y+17]=i.a,E[Y+18]=S,E[Y+19]=A,E[Y+20]=r.r,E[Y+21]=r.g,E[Y+22]=r.b,E[Y+23]=r.a,E[Y+24]=k,E[Y+25]=C,E[Y+26]=i.r,E[Y+27]=i.g,E[Y+28]=i.b,E[Y+29]=i.a,E[Y+30]=I,E[Y+31]=P,E[Y+32]=r.r,E[Y+33]=r.g,E[Y+34]=r.b,E[Y+35]=r.a):(E[Y+6]=b,E[Y+7]=v,E[Y+8]=y,E[Y+9]=T,E[Y+10]=i.r,E[Y+11]=i.g,E[Y+12]=i.b,E[Y+13]=i.a,E[Y+14]=S,E[Y+15]=A,E[Y+16]=k,E[Y+17]=C,E[Y+18]=i.r,E[Y+19]=i.g,E[Y+20]=i.b,E[Y+21]=i.a,E[Y+22]=I,E[Y+23]=P),Y=o.length;const U=V.setArraySize(o,Y+3);U[Y]=h,U[Y+1]=h+1,U[Y+2]=h+2,h+=3;break}}}return u!=null}clipTrianglesUnpacked(e,t,s,n,i,r=2){let a=this._clippedVerticesTyped,c=this._clippedUVsTyped,l=this._clippedTrianglesTyped,o=0;if(this.clippedVerticesLength=0,this.clippedUVsLength=0,this.clippedTrianglesLength=0,this.inverse){const u=this.clippingPolygons[0];for(let p=0;p<n;p+=3){let g=s[p]*r;const x=e[t+g],w=e[t+g+1];let b=s[p]<<1;const v=i[b],y=i[b+1];g=s[p+1]*r;const T=e[t+g],S=e[t+g+1];b=s[p+1]<<1;const A=i[b],k=i[b+1];g=s[p+2]*r;const C=e[t+g],I=e[t+g+1];b=s[p+2]<<1;const P=i[b],F=i[b+1];this.clipInverse(x,w,T,S,C,I,u);const B=this.inverseVertices.length;if(B===0)continue;const R=S-I,L=C-T,O=x-C,N=I-w,Y=1/(R*O+L*(w-I)),E=this.inverseVertices;for(let U=0;U<B;){const _=E[U++],G=_>>1;let D=this.clippedVerticesLength;const q=D+G*r,$=this.clippedUVsLength+G*2;a.length<q&&(this._clippedVerticesTyped=new Float32Array(q*2),this._clippedVerticesTyped.set(a.subarray(0,D)),a=this._clippedVerticesTyped),c.length<$&&(this._clippedUVsTyped=new Float32Array($*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped),this.clippedVerticesLength=q,this.clippedUVsLength=$;const J=this._clippedVerticesTyped,st=this._clippedUVsTyped;let j=$-G*2;for(let it=0;it<_;it+=2,D+=r,j+=2){const pt=E[U+it],at=E[U+it+1];J[D]=pt,J[D+1]=at;const lt=pt-C,xt=at-I,yt=(R*lt+L*xt)*Y,Ct=(N*lt+O*xt)*Y,ue=1-yt-Ct;st[j]=v*yt+A*Ct+P*ue,st[j+1]=y*yt+k*Ct+F*ue}D=this.clippedTrianglesLength;const nt=D+3*(G-2);l.length<nt&&(this._clippedTrianglesTyped=new Uint16Array(nt*2),this._clippedTrianglesTyped.set(l.subarray(0,D)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=nt;const ot=l;for(let it=1;it<G-1;it++,D+=3)ot[D]=o,ot[D+1]=o+it,ot[D+2]=o+it+1;o+=G,U+=_}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),!0}const h=this.clipOutput,d=this.clippingPolygons,m=this.clippingPolygons.length;let f=null;for(let u=0;u<n;u+=3){let p=s[u],g=p*r;const x=e[t+g],w=e[t+g+1];let b=p<<1;const v=i[b],y=i[b+1];p=s[u+1],g=p*r;const T=e[t+g],S=e[t+g+1];b=p<<1;const A=i[b],k=i[b+1];p=s[u+2],g=p*r;const C=e[t+g],I=e[t+g+1];b=p<<1;const P=i[b],F=i[b+1];let B=0,R=0,L=0,O=0,N=0;for(let Y=0;Y<m;Y++){let E=this.clippedVerticesLength;if(this.clip(x,w,T,S,C,I,d[Y])){f=h;const U=h.length;if(U===0)continue;let _=U>>1;N===0&&(B=S-I,R=C-T,L=x-C,O=I-w,N=1/(B*L-R*O));const G=E+_*r;a.length<G&&(this._clippedVerticesTyped=new Float32Array(G*2),this._clippedVerticesTyped.set(a.subarray(0,E)),this._clippedUVsTyped=new Float32Array((this.clippedUVsLength+_*2)*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),a=this._clippedVerticesTyped,c=this._clippedUVsTyped);const D=a,q=c;this.clippedVerticesLength=G;let $=this.clippedUVsLength;this.clippedUVsLength=$+_*2;for(let j=0;j<U;j+=2,E+=r,$+=2){const nt=f[j],ot=f[j+1];D[E]=nt,D[E+1]=ot;const it=nt-C,pt=ot-I,at=(B*it+R*pt)*N,lt=(O*it+L*pt)*N,xt=1-at-lt;q[$]=v*at+A*lt+P*xt,q[$+1]=y*at+k*lt+F*xt}E=this.clippedTrianglesLength;const J=E+3*(_-2);l.length<J&&(this._clippedTrianglesTyped=new Uint16Array(J*2),this._clippedTrianglesTyped.set(l.subarray(0,E)),l=this._clippedTrianglesTyped),this.clippedTrianglesLength=J;const st=l;_--;for(let j=1;j<_;j++,E+=3)st[E]=o,st[E+1]=o+j,st[E+2]=o+j+1;o+=_+1}else{let U=E+3*r;a.length<U&&(this._clippedVerticesTyped=new Float32Array(U*2),this._clippedVerticesTyped.set(a.subarray(0,E)),a=this._clippedVerticesTyped),a[E]=x,a[E+1]=w,a[E+r]=T,a[E+r+1]=S,a[E+r*2]=C,a[E+r*2+1]=I;const _=this.clippedUVsLength+6;c.length<_&&(this._clippedUVsTyped=new Float32Array(_*2),this._clippedUVsTyped.set(c.subarray(0,this.clippedUVsLength)),c=this._clippedUVsTyped);const G=this.clippedUVsLength;c[G]=v,c[G+1]=y,c[G+2]=A,c[G+3]=k,c[G+4]=P,c[G+5]=F,this.clippedVerticesLength=U,this.clippedUVsLength=_,E=this.clippedTrianglesLength,U=E+3,l.length<U&&(this._clippedTrianglesTyped=new Uint16Array(U*2),this._clippedTrianglesTyped.set(l.subarray(0,E)),l=this._clippedTrianglesTyped);const D=l;D[E]=o,D[E+1]=o+1,D[E+2]=o+2,o+=3,this.clippedTrianglesLength=U;break}}}return this.clippedVerticesTyped=this._clippedVerticesTyped.subarray(0,this.clippedVerticesLength),this.clippedUVsTyped=this._clippedUVsTyped.subarray(0,this.clippedUVsLength),this.clippedTrianglesTyped=this._clippedTrianglesTyped.subarray(0,this.clippedTrianglesLength),f!==null}clip(e,t,s,n,i,r,a){const c=this.clipOutput;let l=!1,o,h;a.length%4>=2?(o=this.clipOutput,h=this.scratch):(o=this.scratch,h=this.clipOutput);const d=a;o.length=8;const m=o;m[0]=e,m[1]=t,m[2]=s,m[3]=n,m[4]=i,m[5]=r,m[6]=e,m[7]=t,h.length=0;const f=a.length-4;for(let u=0;;u+=2){const p=d[u],g=d[u+1],x=p-d[u+2],w=g-d[u+3],b=h.length,v=o;e=v[0],t=v[1];let y=w*(p-e)-x*(g-t);for(let S=2,A=o.length-2;S<=A;S+=2){s=v[S],n=v[S+1];const k=w*(p-s)-x*(g-n);if(y>0)if(k>0)h.push(s,n);else{const C=s-e,I=n-t,P=y/(C*w-I*x);P>=0&&P<=1?(h.push(e+C*P,t+I*P),l=!0):h.push(s,n)}else if(k>0){const C=s-e,I=n-t,P=y/(C*w-I*x);P>=0&&P<=1?(h.push(e+C*P,t+I*P,s,n),l=!0):h.push(s,n)}else l=!0;e=s,t=n,y=k}if(b===h.length)return c.length=0,!0;if(h.push(h[0],h[1]),u===f)break;const T=h;h=o,h.length=0,o=T}if(c!==h){c.length=0;for(let u=0,p=h.length-2;u<p;u++)c[u]=h[u]}else c.length=c.length-2;return l}clipInverse(e,t,s,n,i,r,a){this.inverseVertices.length=0;const c=a.length-4;let l,o;a.length%4>=2?(l=this.clipOutput,o=this.scratch):(l=this.scratch,o=this.clipOutput),l.length=8;let h=a,d=l;d[0]=e,d[1]=t,d[2]=s,d[3]=n,d[4]=i,d[5]=r,d[6]=e,d[7]=t,o.length=0;for(let m=0;;m+=2){const f=h[m],u=h[m+1],p=f-h[m+2],g=u-h[m+3],x=o.length,w=this.inverseVertices.length;this.inverseVertices.push(0),d=l,e=d[0],t=d[1];let b=g*(f-e)-p*(u-t);for(let T=2,S=l.length-2;T<=S;T+=2){s=d[T],n=d[T+1];const A=g*(f-s)-p*(u-n);if(b>0)if(A>0)o.push(s,n);else{const k=s-e,C=n-t,I=b/(k*g-C*p);if(I>=0&&I<=1){const P=e+k*I,F=t+C*I;o.push(P,F),this.inverseVertices.push(P,F,s,n)}else o.push(s,n)}else if(A>0){const k=s-e,C=n-t,I=b/(k*g-C*p);if(I>=0&&I<=1){const P=e+k*I,F=t+C*I;this.inverseVertices.push(P,F),o.push(P,F,s,n)}else o.push(s,n)}else this.inverseVertices.push(s,n);e=s,t=n,b=A}const v=this.inverseVertices.length-w-1;if(v>=6?this.inverseVertices[w]=v:this.inverseVertices.length=w,x===o.length||(o.push(o[0],o[1]),m===c))break;const y=o;o=l,o.length=0,l=y}}makeClockwise(e){const t=e,s=e.length;let n=!0,i=!0,r=0,a=t[s-2],c=t[s-1],l=t[0],o=t[1];for(let d=2;d<s;d+=2){const m=t[d],f=t[d+1];r+=l*f-m*o;const u=(l-a)*(f-o)-(o-c)*(m-l);i=i&&u<=0,n=n&&u>=0,a=l,c=o,l=m,o=f}r+=l*t[1]-t[0]*o;const h=(l-a)*(t[1]-o)-(o-c)*(t[0]-l);if(i=i&&h<=0,n=n&&h>=0,r>=0){for(let d=0,m=s-2,f=s>>1;d<f;d+=2){const u=t[d],p=t[d+1],g=m-d;t[d]=t[g],t[d+1]=t[g+1],t[g]=u,t[g+1]=p}return n}return i}makeConvex(e){const t=e.length,s=e;this.clipOutput.length=t;const n=this.clipOutput;n[0]=s[0],n[1]=s[1];for(let a=2;a<t;a+=2){const c=s[a],l=s[a+1];let o=a-2;for(;o>=0&&(n[o]>c||n[o]===c&&n[o+1]>l);o-=2)n[o+2]=n[o],n[o+3]=n[o+1];n[o+2]=c,n[o+3]=l}s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];let i=4;for(let a=4;a<t;a+=2,i+=2){const c=n[a],l=n[a+1];for(;(s[i-2]-s[i-4])*(l-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==2););s[i]=c,s[i+1]=l}s[i]=n[t-4],s[i+1]=n[t-3];const r=i;i+=2;for(let a=t-6;a>=0;a-=2,i+=2){const c=n[a],l=n[a+1];for(;(s[i-2]-s[i-4])*(l-s[i-3])-(s[i-1]-s[i-3])*(c-s[i-4])>=0&&(i-=2,i!==r););s[i]=c,s[i+1]=l}e.length=i-2}},qn=class{attachmentLoader;scale=1;linkedMeshes=[];constructor(e){this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,s=new Ye,n=typeof e=="string"?JSON.parse(e):e,i=n.skeleton;if(i&&(s.hash=i.hash,s.version=i.spine,s.x=i.x,s.y=i.y,s.width=i.width,s.height=i.height,s.referenceScale=M(i,"referenceScale",100)*t,s.fps=i.fps,s.imagesPath=i.images??null,s.audioPath=i.audio??null),n.bones)for(let r=0;r<n.bones.length;r++){const a=n.bones[r];let c=null;const l=M(a,"parent",null);l&&(c=s.findBone(l));const o=new Ds(s.bones.length,a.name,c);o.length=M(a,"length",0)*t;const h=o.setupPose;h.x=M(a,"x",0)*t,h.y=M(a,"y",0)*t,h.rotation=M(a,"rotation",0),h.scaleX=M(a,"scaleX",1),h.scaleY=M(a,"scaleY",1),h.shearX=M(a,"shearX",0),h.shearY=M(a,"shearY",0),h.inherit=V.enumValue(ve,M(a,"inherit","Normal")),o.skinRequired=M(a,"skin",!1);const d=M(a,"color",null);d&&o.color.setFromString(d),o.icon=M(a,"icon",void 0),o.iconSize=M(a,"iconSize",1),o.iconRotation=M(a,"iconRotation",0),s.bones.push(o)}if(n.slots)for(let r=0;r<n.slots.length;r++){const a=n.slots[r],c=a.name,l=s.findBone(a.bone);if(!l)throw new Error(`Couldn't find bone ${a.bone} for slot ${c}`);const o=new Ws(s.slots.length,c,l),h=M(a,"color",null);h&&o.setupPose.color.setFromString(h);const d=M(a,"dark",null);d&&(o.setupPose.darkColor=z.fromString(d)),o.attachmentName=M(a,"attachment",null),o.blendMode=V.enumValue(Hs,M(a,"blend","normal")),o.visible=M(a,"visible",!0),s.slots.push(o)}if(n.constraints)for(const r of n.constraints){const a=r.name,c=M(r,"skin",!1);switch(M(r,"type",!1)){case"ik":{const l=new oe(a);l.skinRequired=c;for(let f=0;f<r.bones.length;f++){const u=s.findBone(r.bones[f]);if(!u)throw new Error(`Couldn't find bone ${r.bones[f]} for IK constraint ${a}.`);l.bones.push(u)}const o=r.target,h=s.findBone(o);if(!h)throw new Error(`Couldn't find target bone ${o} for IK constraint ${a}.`);l.target=h;const d=M(r,"scaleY",null);d!=null&&(l.scaleYMode=V.enumValue(Ce,d));const m=l.setupPose;m.mix=M(r,"mix",1),m.softness=M(r,"softness",0)*t,m.bendDirection=M(r,"bendPositive",!0)?1:-1,m.compress=M(r,"compress",!1),m.stretch=M(r,"stretch",!1),s.constraints.push(l);break}case"transform":{const l=new K(a);l.skinRequired=c;for(let b=0;b<r.bones.length;b++){const v=r.bones[b],y=s.findBone(v);if(!y)throw new Error(`Couldn't find bone ${v} for transform constraint ${r.name}.`);l.bones.push(y)}const o=r.source,h=s.findBone(o);if(!h)throw new Error(`Couldn't find source bone ${o} for transform constraint ${r.name}.`);l.source=h,l.localSource=M(r,"localSource",!1),l.localTarget=M(r,"localTarget",!1),l.additive=M(r,"additive",!1),l.clamp=M(r,"clamp",!1);let d=!1,m=!1,f=!1,u=!1,p=!1,g=!1;const x=Object.entries(M(r,"properties",{}));for(const[b,v]of x){const y=this.fromProperty(b),T=this.propertyScale(b,t);y.offset=M(v,"offset",0)*T;const S=Object.entries(M(v,"to",{}));for(const[A,k]of S){let C=1,I;switch(A){case"rotate":{d=!0,I=new Ks;break}case"x":{m=!0,I=new Js,C=t;break}case"y":{f=!0,I=new js,C=t;break}case"scaleX":{u=!0,I=new Zs;break}case"scaleY":{p=!0,I=new Qs;break}case"shearY":{g=!0,I=new tn;break}default:throw new Error(`Invalid transform constraint to property: ${A}`)}I.offset=M(k,"offset",0)*C,I.max=M(k,"max",1)*C,I.scale=M(k,"scale",1)*C/T,y.to.push(I)}y.to.length>0&&l.properties.push(y)}l.offsets[K.ROTATION]=M(r,"rotation",0),l.offsets[K.X]=M(r,"x",0)*t,l.offsets[K.Y]=M(r,"y",0)*t,l.offsets[K.SCALEX]=M(r,"scaleX",0),l.offsets[K.SCALEY]=M(r,"scaleY",0),l.offsets[K.SHEARY]=M(r,"shearY",0);const w=l.setupPose;d&&(w.mixRotate=M(r,"mixRotate",1)),m&&(w.mixX=M(r,"mixX",1)),f&&(w.mixY=M(r,"mixY",w.mixX)),u&&(w.mixScaleX=M(r,"mixScaleX",1)),p&&(w.mixScaleY=M(r,"mixScaleY",w.mixScaleX)),g&&(w.mixShearY=M(r,"mixShearY",1)),s.constraints.push(l);break}case"path":{const l=new ae(a);l.skinRequired=c;for(let m=0;m<r.bones.length;m++){const f=r.bones[m],u=s.findBone(f);if(!u)throw new Error(`Couldn't find bone ${f} for path constraint ${r.name}.`);l.bones.push(u)}const o=r.slot,h=s.findSlot(o);if(!h)throw new Error(`Couldn't find slot ${o} for path constraint ${r.name}.`);l.slot=h,l.positionMode=V.enumValue(Us,M(r,"positionMode","Percent")),l.spacingMode=V.enumValue($s,M(r,"spacingMode","Length")),l.rotateMode=V.enumValue(qs,M(r,"rotateMode","Tangent")),l.offsetRotation=M(r,"rotation",0);const d=l.setupPose;d.position=M(r,"position",0),l.positionMode===0&&(d.position*=t),d.spacing=M(r,"spacing",0),(l.spacingMode===0||l.spacingMode===1)&&(d.spacing*=t),d.mixRotate=M(r,"mixRotate",1),d.mixX=M(r,"mixX",1),d.mixY=M(r,"mixY",d.mixX),s.constraints.push(l);break}case"physics":{const l=new le(a);l.skinRequired=c;const o=r.bone,h=s.findBone(o);if(h==null)throw new Error(`Physics bone not found: ${o}`);l.bone=h,l.x=M(r,"x",0),l.y=M(r,"y",0),l.rotate=M(r,"rotate",0),l.scaleX=M(r,"scaleX",0);const d=M(r,"scaleY",null);d!=null&&(l.scaleYMode=V.enumValue(Ce,d)),l.shearX=M(r,"shearX",0),l.limit=M(r,"limit",5e3)*t,l.step=1/M(r,"fps",60);const m=l.setupPose;m.inertia=M(r,"inertia",.5),m.strength=M(r,"strength",100),m.damping=M(r,"damping",.85),m.massInverse=1/M(r,"mass",1),m.wind=M(r,"wind",0),m.gravity=M(r,"gravity",0),m.mix=M(r,"mix",1),l.inertiaGlobal=M(r,"inertiaGlobal",!1),l.strengthGlobal=M(r,"strengthGlobal",!1),l.dampingGlobal=M(r,"dampingGlobal",!1),l.massGlobal=M(r,"massGlobal",!1),l.windGlobal=M(r,"windGlobal",!1),l.gravityGlobal=M(r,"gravityGlobal",!1),l.mixGlobal=M(r,"mixGlobal",!1),s.constraints.push(l);break}case"slider":{const l=new Pt(a);l.skinRequired=c,l.additive=M(r,"additive",!1),l.loop=M(r,"loop",!1),l.setupPose.mix=M(r,"mix",1);const o=r.bone;if(o){if(l.bone=s.findBone(o),!l.bone)throw new Error(`Slider bone not found: ${o}`);const h=r.property;l.property=this.fromProperty(h);const d=this.propertyScale(h,t);l.property.offset=M(r,"from",0)*d,l.offset=M(r,"to",0),l.scale=M(r,"scale",1)/d,l.max=M(r,"max",0),l.local=M(r,"local",!1)}else l.setupPose.time=M(r,"time",0);s.constraints.push(l);break}}}if(n.skins)for(let r=0;r<n.skins.length;r++){const a=n.skins[r],c=new ce(a.name);if(a.bones)for(let l=0;l<a.bones.length;l++){const o=a.bones[l],h=s.findBone(o);if(!h)throw new Error(`Couldn't find bone ${o} for skin ${a.name}.`);c.bones.push(h)}if(a.ik)for(let l=0;l<a.ik.length;l++){const o=a.ik[l],h=s.findConstraint(o,oe);if(!h)throw new Error(`Couldn't find IK constraint ${o} for skin ${a.name}.`);c.constraints.push(h)}if(a.transform)for(let l=0;l<a.transform.length;l++){const o=a.transform[l],h=s.findConstraint(o,K);if(!h)throw new Error(`Couldn't find transform constraint ${o} for skin ${a.name}.`);c.constraints.push(h)}if(a.path)for(let l=0;l<a.path.length;l++){const o=a.path[l],h=s.findConstraint(o,ae);if(!h)throw new Error(`Couldn't find path constraint ${o} for skin ${a.name}.`);c.constraints.push(h)}if(a.physics)for(let l=0;l<a.physics.length;l++){const o=a.physics[l],h=s.findConstraint(o,le);if(!h)throw new Error(`Couldn't find physics constraint ${o} for skin ${a.name}.`);c.constraints.push(h)}if(a.slider)for(let l=0;l<a.slider.length;l++){const o=a.slider[l],h=s.findConstraint(o,Pt);if(!h)throw new Error(`Couldn't find slider constraint ${o} for skin ${a.name}.`);c.constraints.push(h)}for(const l in a.attachments){const o=s.findSlot(l);if(!o)throw new Error(`Couldn't find skin slot ${l} for skin ${a.name}.`);const h=a.attachments[l];for(const d in h){const m=this.readAttachment(h[d],c,o.index,d,s);m&&c.setAttachment(o.index,d,m)}}s.skins.push(c),c.name==="default"&&(s.defaultSkin=c)}for(let r=0,a=this.linkedMeshes.length;r<a;r++){const c=this.linkedMeshes[r],l=c.skin?s.findSkin(c.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${c.skin}`);const o=l.getAttachment(c.sourceIndex,c.source);if(!o)throw new Error(`Source mesh not found: ${c.source}`);c.mesh.timelineAttachment=c.inheritTimelines?o:c.mesh,c.mesh.setSourceMesh(o),c.mesh.updateSequence();t:if(c.inheritTimelines&&c.slotIndex!==c.sourceIndex){const h=o.timelineSlots;for(const m of h)if(m===c.slotIndex)break t;const d=[...h];d[h.length]=c.slotIndex,o.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const r in n.events){const a=n.events[r],c=new Os(r),l=c.setupPose;l.intValue=M(a,"int",0),l.floatValue=M(a,"float",0),l.stringValue=M(a,"string",""),c._audioPath=M(a,"audio",null),c.audioPath&&(l.volume=M(a,"volume",l.volume),l.balance=M(a,"balance",l.balance)),s.events.push(c)}if(n.animations)for(const r in n.animations){const a=n.animations[r];this.readAnimation(a,r,s)}if(n.constraints)for(const r in n.constraints){const a=n.constraints[r];if(a.type==="slider"){const c=s.findConstraint(a.name,Pt),l=a.animation,o=s.findAnimation(l);if(!o)throw new Error(`Slider animation not found: ${l}`);c.animation=o}}return s}fromProperty(e){let t;switch(e){case"rotate":t=new Be;break;case"x":t=new Re;break;case"y":t=new Xe;break;case"scaleX":t=new Le;break;case"scaleY":t=new Ve;break;case"shearY":t=new De;break;default:throw new Error(`Invalid transform constraint from property: ${e}`)}return t}propertyScale(e,t){switch(e){case"x":case"y":return t;default:return 1}}readAttachment(e,t,s,n,i){const r=this.scale,a=M(e,"name",n);switch(M(e,"type","region")){case"region":{const c=M(e,"path",a),l=this.readSequence(M(e,"sequence",null)),o=this.attachmentLoader.newRegionAttachment(t,n,a,c,l);if(!o)return null;o.path=c,o.x=M(e,"x",0)*r,o.y=M(e,"y",0)*r,o.scaleX=M(e,"scaleX",1),o.scaleY=M(e,"scaleY",1),o.rotation=M(e,"rotation",0),o.width=e.width*r,o.height=e.height*r;const h=M(e,"color",null);return h&&o.color.setFromString(h),o.updateSequence(),o}case"boundingbox":{const c=this.attachmentLoader.newBoundingBoxAttachment(t,n,a);if(!c)return null;this.readVertices(e,c,e.vertexCount<<1);const l=M(e,"color",null);return l&&c.color.setFromString(l),c}case"mesh":case"linkedmesh":{const c=M(e,"path",a),l=this.readSequence(M(e,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(t,n,a,c,l);if(!o)return null;o.path=c;const h=M(e,"color",null);h&&o.color.setFromString(h),o.width=M(e,"width",0)*r,o.height=M(e,"height",0)*r;const d=M(e,"source",null);if(d){let f=s;const u=M(e,"slot",null);if(u){const p=i.findSlot(u);if(!p)throw new Error(`Source mesh slot not found: ${u}`);f=p.index}return this.linkedMeshes.push(new xr(o,M(e,"skin",null),s,f,d,M(e,"timelines",!0))),o}const m=e.uvs;return this.readVertices(e,o,m.length),o.triangles=e.triangles,o.regionUVs=m,o.edges=M(e,"edges",null),o.hullLength=M(e,"hull",0)*2,o.updateSequence(),o}case"path":{const c=this.attachmentLoader.newPathAttachment(t,n,a);if(!c)return null;c.closed=M(e,"closed",!1),c.constantSpeed=M(e,"constantSpeed",!0);const l=e.vertexCount;this.readVertices(e,c,l<<1);const o=V.newArray(l/3,0);for(let d=0;d<e.lengths.length;d++)o[d]=e.lengths[d]*r;c.lengths=o;const h=M(e,"color",null);return h&&c.color.setFromString(h),c}case"point":{const c=this.attachmentLoader.newPointAttachment(t,n,a);if(!c)return null;c.x=M(e,"x",0)*r,c.y=M(e,"y",0)*r,c.rotation=M(e,"rotation",0);const l=M(e,"color",null);return l&&c.color.setFromString(l),c}case"clipping":{const c=this.attachmentLoader.newClippingAttachment(t,n,a);if(!c)return null;const l=M(e,"end",null);l&&(c.endSlot=i.findSlot(l)),c.convex=M(e,"convex",!1),c.inverse=M(e,"inverse",!1);const o=e.vertexCount;this.readVertices(e,c,o<<1);const h=M(e,"color",null);return h&&c.color.setFromString(h),c}}return null}readSequence(e){if(e==null)return new Qt(1,!1);const t=new Qt(M(e,"count",0),!0);return t.start=M(e,"start",1),t.digits=M(e,"digits",0),t.setupIndex=M(e,"setup",0),t}readVertices(e,t,s){const n=this.scale;t.worldVerticesLength=s;const i=e.vertices;if(s===i.length){const c=V.toFloatArray(i);if(n!==1)for(let l=0,o=i.length;l<o;l++)c[l]*=n;t.vertices=c;return}const r=[],a=[];for(let c=0,l=i.length;c<l;){const o=i[c++];a.push(o);for(let h=c+o*4;c<h;c+=4)a.push(i[c]),r.push(i[c+1]*n),r.push(i[c+2]*n),r.push(i[c+3])}t.bones=a,t.vertices=V.toFloatArray(r)}readAnimation(e,t,s){const n=this.scale,i=[];if(e.slots)for(const l in e.slots){const o=e.slots[l],h=s.findSlot(l);if(!h)throw new Error(`Slot not found: ${l}`);const d=h.index;for(const m in o){const f=o[m];if(!f)continue;const u=f.length;switch(m){case"attachment":{const p=new Ut(u,d);for(let g=0;g<u;g++){const x=f[g];p.setFrame(g,M(x,"time",0),M(x,"name",null))}i.push(p);break}case"rgba":{const p=new cs(u,u<<2,d);let g=f[0],x=M(g,"time",0),w=z.fromString(g.color);for(let b=0,v=0;;b++){p.setFrame(b,x,w.r,w.g,w.b,w.a);const y=f[b+1];if(!y){p.shrink(v);break}const T=M(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(v=H(A,p,v,b,0,x,T,w.r,S.r,1),v=H(A,p,v,b,1,x,T,w.g,S.g,1),v=H(A,p,v,b,2,x,T,w.b,S.b,1),v=H(A,p,v,b,3,x,T,w.a,S.a,1)),x=T,w=S,g=y}i.push(p);break}case"rgb":{const p=new hs(u,u*3,d);let g=f[0],x=M(g,"time",0),w=z.fromString(g.color);for(let b=0,v=0;;b++){p.setFrame(b,x,w.r,w.g,w.b);const y=f[b+1];if(!y){p.shrink(v);break}const T=M(y,"time",0),S=z.fromString(y.color),A=g.curve;A&&(v=H(A,p,v,b,0,x,T,w.r,S.r,1),v=H(A,p,v,b,1,x,T,w.g,S.g,1),v=H(A,p,v,b,2,x,T,w.b,S.b,1)),x=T,w=S,g=y}i.push(p);break}case"alpha":{ht(i,f,new ds(u,u,d),0,1);break}case"rgba2":{const p=new us(u,u*7,d);let g=f[0],x=M(g,"time",0),w=z.fromString(g.light),b=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,x,w.r,w.g,w.b,w.a,b.r,b.g,b.b);const T=f[v+1];if(!T){p.shrink(y);break}const S=M(T,"time",0),A=z.fromString(T.light),k=z.fromString(T.dark),C=g.curve;C&&(y=H(C,p,y,v,0,x,S,w.r,A.r,1),y=H(C,p,y,v,1,x,S,w.g,A.g,1),y=H(C,p,y,v,2,x,S,w.b,A.b,1),y=H(C,p,y,v,3,x,S,w.a,A.a,1),y=H(C,p,y,v,4,x,S,b.r,k.r,1),y=H(C,p,y,v,5,x,S,b.g,k.g,1),y=H(C,p,y,v,6,x,S,b.b,k.b,1)),x=S,w=A,b=k,g=T}i.push(p);break}case"rgb2":{const p=new fs(u,u*6,d);let g=f[0],x=M(g,"time",0),w=z.fromString(g.light),b=z.fromString(g.dark);for(let v=0,y=0;;v++){p.setFrame(v,x,w.r,w.g,w.b,b.r,b.g,b.b);const T=f[v+1];if(!T){p.shrink(y);break}const S=M(T,"time",0),A=z.fromString(T.light),k=z.fromString(T.dark),C=g.curve;C&&(y=H(C,p,y,v,0,x,S,w.r,A.r,1),y=H(C,p,y,v,1,x,S,w.g,A.g,1),y=H(C,p,y,v,2,x,S,w.b,A.b,1),y=H(C,p,y,v,3,x,S,b.r,k.r,1),y=H(C,p,y,v,4,x,S,b.g,k.g,1),y=H(C,p,y,v,5,x,S,b.b,k.b,1)),x=S,w=A,b=k,g=T}i.push(p);break}default:throw new Error(`Invalid timeline type for a slot: ${f.name} (${o.name})`)}}}if(e.bones)for(const l in e.bones){const o=e.bones[l],h=s.findBone(l);if(!h)throw new Error(`Bone not found: ${l}`);const d=h.index;for(const m in o){const f=o[m],u=f.length;if(u!==0)switch(m){case"rotate":ht(i,f,new ee(u,u,d),0,1);break;case"translate":en(i,f,new Qe(u,u<<1,d),"x","y",0,n);break;case"translatex":ht(i,f,new ts(u,u,d),0,n);break;case"translatey":ht(i,f,new es(u,u,d),0,n);break;case"scale":en(i,f,new ss(u,u<<1,d),"x","y",1,1);break;case"scalex":ht(i,f,new ns(u,u,d),1,1);break;case"scaley":ht(i,f,new is(u,u,d),1,1);break;case"shear":en(i,f,new rs(u,u<<1,d),"x","y",0,1);break;case"shearx":ht(i,f,new os(u,u,d),0,1);break;case"sheary":ht(i,f,new as(u,u,d),0,1);break;case"inherit":{const p=new ls(u,h.index);for(let g=0;g<f.length;g++){const x=f[g];p.setFrame(g,M(x,"time",0),V.enumValue(ve,M(x,"inherit","Normal")))}i.push(p);break}default:throw new Error(`Invalid timeline type for a bone: ${f.name} (${o.name})`)}}}if(e.ik)for(const l in e.ik){const o=e.ik[l];let h=o[0];if(!h)continue;const d=s.findConstraint(l,oe);if(!d)throw new Error(`IK Constraint not found: ${l}`);const m=new ps(o.length,o.length<<1,s.constraints.indexOf(d));let f=M(h,"time",0),u=M(h,"mix",1),p=M(h,"softness",0)*n;for(let g=0,x=0;;g++){m.setFrame(g,f,u,p,M(h,"bendPositive",!0)?1:-1,M(h,"compress",!1),M(h,"stretch",!1));const w=o[g+1];if(!w){m.shrink(x);break}const b=M(w,"time",0),v=M(w,"mix",1),y=M(w,"softness",0)*n,T=h.curve;T&&(x=H(T,m,x,g,0,f,b,u,v,1),x=H(T,m,x,g,1,f,b,p,y,n)),f=b,u=v,p=y,h=w}i.push(m)}if(e.transform)for(const l in e.transform){const o=e.transform[l];let h=o[0];if(!h)continue;const d=s.findConstraint(l,K);if(!d)throw new Error(`Transform constraint not found: ${l}`);const m=new xs(o.length,o.length*6,s.constraints.indexOf(d));let f=M(h,"time",0),u=M(h,"mixRotate",1),p=M(h,"mixX",1),g=M(h,"mixY",p),x=M(h,"mixScaleX",1),w=M(h,"mixScaleY",1),b=M(h,"mixShearY",1);for(let v=0,y=0;;v++){m.setFrame(v,f,u,p,g,x,w,b);const T=o[v+1];if(!T){m.shrink(y);break}const S=M(T,"time",0),A=M(T,"mixRotate",1),k=M(T,"mixX",1),C=M(T,"mixY",k),I=M(T,"mixScaleX",1),P=M(T,"mixScaleY",1),F=M(T,"mixShearY",1),B=h.curve;B&&(y=H(B,m,y,v,0,f,S,u,A,1),y=H(B,m,y,v,1,f,S,p,k,1),y=H(B,m,y,v,2,f,S,g,C,1),y=H(B,m,y,v,3,f,S,x,I,1),y=H(B,m,y,v,4,f,S,w,P,1),y=H(B,m,y,v,5,f,S,b,F,1)),f=S,u=A,p=k,g=C,x=I,w=P,b=F,h=T}i.push(m)}if(e.path)for(const l in e.path){const o=e.path[l],h=s.findConstraint(l,ae);if(!h)throw new Error(`Path constraint not found: ${l}`);const d=s.constraints.indexOf(h);for(const m in o){const f=o[m];let u=f[0];if(!u)continue;const p=f.length;switch(m){case"position":{const g=new ws(p,p,d);ht(i,f,g,0,h.positionMode===0?n:1);break}case"spacing":{const g=new bs(p,p,d);ht(i,f,g,0,h.spacingMode===0||h.spacingMode===1?n:1);break}case"mix":{const g=new ys(p,p*3,d);let x=M(u,"time",0),w=M(u,"mixRotate",1),b=M(u,"mixX",1),v=M(u,"mixY",b);for(let y=0,T=0;;y++){g.setFrame(y,x,w,b,v);const S=f[y+1];if(!S){g.shrink(T);break}const A=M(S,"time",0),k=M(S,"mixRotate",1),C=M(S,"mixX",1),I=M(S,"mixY",C),P=u.curve;P&&(T=H(P,g,T,y,0,x,A,w,k,1),T=H(P,g,T,y,1,x,A,b,C,1),T=H(P,g,T,y,2,x,A,v,I,1)),x=A,w=k,b=C,v=I,u=S}i.push(g);break}}}}if(e.physics)for(const l in e.physics){const o=e.physics[l];let h=-1;if(l.length>0){const d=s.findConstraint(l,le);if(!d)throw new Error(`Physics constraint not found: ${l}`);h=s.constraints.indexOf(d)}for(const d in o){const m=o[d];let f=m[0];if(!f)continue;const u=m.length;let p,g=0;if(d==="reset"){const x=new Ms(u,h);for(let w=0;f!=null;f=m[w+1],w++)x.setFrame(w,M(f,"time",0));i.push(x);continue}switch(d){case"inertia":p=new vs(u,u,h);break;case"strength":p=new Ts(u,u,h);break;case"damping":p=new Ss(u,u,h);break;case"mass":p=new Cs(u,u,h);break;case"wind":p=new As(u,u,h);break;case"gravity":p=new Is(u,u,h);break;case"mix":{g=1,p=new ks(u,u,h);break}default:continue}ht(i,m,p,g,1)}}if(e.slider)for(const l in e.slider){const o=e.slider[l],h=s.findConstraint(l,Pt);if(!h)throw new Error(`Slider not found: ${l}`);const d=s.constraints.indexOf(h);for(const m in o){const f=o[m];if(!f[0])continue;const p=f.length;switch(m){case"time":ht(i,f,new Ps(p,p,d),1,1);break;case"mix":ht(i,f,new Fs(p,p,d),1,1);break}}}if(e.attachments)for(const l in e.attachments){const o=e.attachments[l],h=s.findSkin(l);if(!h)throw new Error(`Skin not found: ${l}`);for(const d in o){const m=o[d],f=s.findSlot(d);if(!f)throw new Error(`Attachment slot not found: ${d}`);const u=f.index;for(const p in m){const g=m[p],x=h.getAttachment(u,p);if(!x)throw new Error(`Timeline attachment not found: ${p}`);for(const w in g){const b=g[w];let v=b[0];if(v){if(w==="deform"){const y=x.bones,T=x.vertices,S=y?T.length/3*2:T.length,A=new ms(b.length,b.length,u,x);let k=M(v,"time",0);for(let C=0,I=0;;C++){let P;const F=M(v,"vertices",null);if(!F)P=y?V.newFloatArray(S):T;else{P=V.newFloatArray(S);const O=M(v,"offset",0);if(V.arrayCopy(F,0,P,O,F.length),n!==1)for(let N=O,Y=N+F.length;N<Y;N++)P[N]*=n;if(!y)for(let N=0;N<S;N++)P[N]+=T[N]}A.setFrame(C,k,P);const B=b[C+1];if(!B){A.shrink(I);break}const R=M(B,"time",0),L=v.curve;L&&(I=H(L,A,I,C,0,k,R,0,1,1)),k=R,v=B}i.push(A)}else if(w==="sequence"){const y=new gs(b.length,u,x);let T=0;for(let S=0;S<b.length;S++){const A=M(v,"delay",T),k=M(v,"time",0),C=je[M(v,"mode","hold")],I=M(v,"index",0);y.setFrame(S,k,C,I,A),T=A,v=b[S+1]}i.push(y)}}}}}}if(e.drawOrder){const l=new Et(e.drawOrder.length),o=s.slots.length;let h=0;for(const d of e.drawOrder)l.setFrame(h++,M(d,"time",0),zn(s,d,o,null));i.push(l)}if(e.drawOrderFolder)for(const l of e.drawOrderFolder){const o=M(l,"slots",[]),h=new Array(o.length);let d=0;for(const p of o){const g=s.findSlot(p);if(!g)throw new Error(`Draw order folder slot not found: ${p}`);h[d++]=g.index}const m=M(l,"keys",[]),f=new ne(m.length,h,s.slots.length);let u=0;for(const p of m)f.setFrame(u++,M(p,"time",0),zn(s,p,h.length,h));i.push(f)}if(e.events){const l=new be(e.events.length);let o=0;for(let h=0;h<e.events.length;h++,o++){const d=e.events[h],m=s.findEvent(d.name);if(!m)throw new Error(`Event not found: ${d.name}`);const f=m.setupPose,u=new Ae(V.toSinglePrecision(M(d,"time",0)),m);u.intValue=M(d,"int",f.intValue),u.floatValue=M(d,"float",f.floatValue),u.stringValue=M(d,"string",f.stringValue),u.data.audioPath&&(u.volume=M(d,"volume",f.volume),u.balance=M(d,"balance",f.volume)),l.setFrame(o,u)}i.push(l)}let r=0;for(let l=0,o=i.length;l<o;l++)r=Math.max(r,i[l].getDuration());const a=new xe(t,i,r),c=M(e,"color",null);c!==null&&a.color.setFromString(c),s.animations.push(a)}},xr=class{source;skin;slotIndex;sourceIndex;mesh;inheritTimelines;constructor(e,t,s,n,i,r){this.mesh=e,this.skin=t,this.slotIndex=s,this.sourceIndex=n,this.source=i,this.inheritTimelines=r}};function ht(e,t,s,n,i){let r=t[0],a=r.time??0,c=(r.value??n)*i,l=0;for(let o=0;;o++){s.setFrame(o,a,c);const h=t[o+1];if(!h){s.shrink(l),e.push(s);return}const d=h.time??0,m=(h.value??n)*i;r.curve&&(l=H(r.curve,s,l,o,0,a,d,c,m,i)),a=d,c=m,r=h}}function en(e,t,s,n,i,r,a){let c=t[0],l=c.time??0,o=(c[n]??r)*a,h=(c[i]??r)*a,d=0;for(let m=0;;m++){s.setFrame(m,l,o,h);const f=t[m+1];if(!f){s.shrink(d),e.push(s);return}const u=f.time??0,p=(f[n]??r)*a,g=(f[i]??r)*a,x=c.curve;x&&(d=H(x,s,d,m,0,l,u,o,p,a),d=H(x,s,d,m,1,l,u,h,g,a)),l=u,o=p,h=g,c=f}}function zn(e,t,s,n){const i=t.offsets;if(!i)return null;const r=new Array(s).fill(-1),a=new Array(s-i.length);let c=0,l=0;for(const o of i){const h=e.findSlot(o.slot);if(h==null)throw new Error(`Draw order slot not found: ${o.slot}`);let d=0;if(!n)d=h.index;else{d=-1;for(let m=0;m<s;m++)if(n[m]===h.index){d=m;break}if(d===-1)throw new Error(`Slot not in folder: ${o.slot}`)}for(;c!==d;)a[l++]=c++;r[c+o.offset]=c++}for(;c<s;)a[l++]=c++;for(let o=s-1;o>=0;o--)r[o]===-1&&(r[o]=a[--l]);return r}function H(e,t,s,n,i,r,a,c,l,o){if(e==="stepped")return t.setStepped(n),s;const h=i<<2,d=e[h],m=e[h+1]*o,f=e[h+2],u=e[h+3]*o;return t.setBezier(s,n,i,r,c,d,m,f,u,a,l),s+1}function M(e,t,s){return e[t]!==void 0?e[t]:s}var Gn=class{constructor(e,t,s={}){this.skeleton=e,this.adapter=t,this.positionInheritanceFactorX=s.positionInheritanceX??0,this.positionInheritanceFactorY=s.positionInheritanceY??0,this.rotationInheritanceFactor=s.rotationInheritance??0}positionInheritanceFactorX=0;positionInheritanceFactorY=0;rotationInheritanceFactor=0;hasLastTransform=!1;lastX=0;lastY=0;lastZ=0;lastRotation=0;currentTransform={x:0,y:0,z:0,rotation:0};currentPosition={x:0,y:0,z:0};lastPosition={x:0,y:0,z:0};get positionInheritanceX(){return this.positionInheritanceFactorX}get positionInheritanceY(){return this.positionInheritanceFactorY}setPositionInheritance(e,t){const s=this.positionInheritanceFactorX===0&&this.positionInheritanceFactorY===0,n=e!==0||t!==0;this.positionInheritanceFactorX=e,this.positionInheritanceFactorY=t,s&&n&&this.resetPosition()}get rotationInheritance(){return this.rotationInheritanceFactor}set rotationInheritance(e){const t=this.rotationInheritanceFactor===0;this.rotationInheritanceFactor=e,t&&e!==0&&this.resetRotation()}resetPosition(){const e=this.currentTransform,t=!this.hasLastTransform&&this.rotationInheritanceFactor!==0;this.adapter.readTransform(e,t),this.lastX=e.x,this.lastY=e.y,this.lastZ=e.z,t&&(this.lastRotation=e.rotation),this.hasLastTransform=!0}resetRotation(){const e=this.currentTransform;this.adapter.readTransform(e,!0),this.lastRotation=e.rotation,this.hasLastTransform||(this.lastX=e.x,this.lastY=e.y,this.lastZ=e.z),this.hasLastTransform=!0}resetTransform(){const e=this.currentTransform;this.adapter.readTransform(e,!0),this.setLastTransform(e.x,e.y,e.z,e.rotation)}applyTransformMovement(){const e=this.positionInheritanceFactorX!==0||this.positionInheritanceFactorY!==0,t=this.rotationInheritanceFactor!==0;if(!e&&!t)return;const s=this.currentTransform;this.adapter.readTransform(s,t);const{x:n,y:i,z:r}=s,a=t?s.rotation:this.lastRotation,c=n!==this.lastX||i!==this.lastY||r!==this.lastZ;if(this.hasLastTransform){if(!c&&a===this.lastRotation)return;e&&c&&this.applyPositionMovement(n,i,r),t&&a!==this.lastRotation&&this.applyRotationMovement(a)}this.setLastTransform(n,i,r,a)}applyPositionMovement(e,t,s){const n=this.currentPosition;n.x=e,n.y=t,n.z=s,this.adapter.worldToSkeleton(n);const i=this.lastPosition;i.x=this.lastX,i.y=this.lastY,i.z=this.lastZ,this.adapter.worldToSkeleton(i),this.skeleton.physicsTranslate((n.x-i.x)*this.positionInheritanceFactorX,(n.y-i.y)*this.positionInheritanceFactorY)}applyRotationMovement(e){const t=this.rotationInheritanceFactor;t!==0&&this.skeleton.physicsRotate(0,0,this.getRotationDelta(e,this.lastRotation)*t)}setLastTransform(e,t,s,n){this.lastX=e,this.lastY=t,this.lastZ=s,this.lastRotation=n,this.hasLastTransform=!0}getRotationDelta(e,t){let s=e-t;return s=(s+180)%360-180,s<-180?s+360:s}},wr=class{commandPool=new br;worldVertices=new Float32Array(12*1024);quadIndices=new Uint16Array([0,1,2,2,3,0]);clipping=new he;renderCommands=[];render(e,t=!1,s,n=2,i=0){this.commandPool.reset(),this.renderCommands.length=0;const r=this.clipping;let a=0;const c=e.drawOrder.appliedPose;for(let l=0,o=c.length;l<o;l++){const h=c[l];if(!h.bone.active){r.clipEnd(h);continue}const d=h.appliedPose,m=d.attachment;if(!m){r.clipEnd(h);continue}const f=d.color;if(f.a===0&&!(m instanceof Bt)){r.clipEnd(h);continue}let p,g,x,w,b,v,y;if(m instanceof It){if(v=m.color,v.a===0){r.clipEnd(h);continue}const C=m.sequence,I=C.resolveIndex(d);m.computeWorldVertices(h,m.getOffsets(d),this.worldVertices,0,n),p=this.worldVertices,g=4,x=C.getUVs(I),w=this.quadIndices,b=6,y=C.regions[I]?.texture}else if(m instanceof vt){if(v=m.color,v.a===0){r.clipEnd(h);continue}this.worldVertices.length<m.worldVerticesLength&&(this.worldVertices=new Float32Array(m.worldVerticesLength)),m.computeWorldVertices(e,h,0,m.worldVerticesLength,this.worldVertices,0,n),p=this.worldVertices,g=m.worldVerticesLength>>1;const C=m.sequence,I=C.resolveIndex(d);x=C.getUVs(I),w=m.triangles,b=w.length,y=C.regions[I]?.texture}else if(m instanceof Bt){r.clipEnd(h),r.clipStart(e,h,m);continue}else{r.clipEnd(h);continue}if(!y){r.clipEnd(h);continue}const T=e.color;let S,A;if(t){let C;if(s){C=Math.floor(s[3]*T.a*f.a*v.a*255);const I=Math.floor(C*s[0]*T.r*f.r*v.r),P=Math.floor(C*s[1]*T.g*f.g*v.g),F=Math.floor(C*s[2]*T.b*f.b*v.b);S=C<<24|I<<16|P<<8|F}else{C=Math.floor(T.a*f.a*v.a*255);const I=Math.floor(C*T.r*f.r*v.r),P=Math.floor(C*T.g*f.g*v.g),F=Math.floor(C*T.b*f.b*v.b);S=C<<24|I<<16|P<<8|F}if(A=4278190080,d.darkColor){const{r:I,g:P,b:F}=d.darkColor;A=4278190080|Math.floor(I*C)<<16|Math.floor(P*C)<<8|Math.floor(F*C)}}else{if(s){const C=Math.floor(s[3]*T.a*f.a*v.a*255),I=Math.floor(s[0]*T.r*f.r*v.r*255),P=Math.floor(s[1]*T.g*f.g*v.g*255),F=Math.floor(s[2]*T.b*f.b*v.b*255);S=C<<24|I<<16|P<<8|F}else{const C=Math.floor(T.a*f.a*v.a*255),I=Math.floor(T.r*f.r*v.r*255),P=Math.floor(T.g*f.g*v.g*255),F=Math.floor(T.b*f.b*v.b*255);S=C<<24|I<<16|P<<8|F}if(A=0,d.darkColor){const{r:C,g:I,b:P}=d.darkColor;A=Math.floor(C*255)<<16|Math.floor(I*255)<<8|Math.floor(P*255)}}r.isClipping()&&(r.clipTrianglesUnpacked(p,0,w,b,x,n),p=r.clippedVerticesTyped,g=r.clippedVerticesLength/n,x=r.clippedUVsTyped,w=r.clippedTrianglesTyped,b=r.clippedTrianglesLength);const k=this.commandPool.getCommand(g,b,n);if(k.blendMode=h.data.blendMode,k.texture=y,k.positions.set(p.subarray(0,g*n)),n>=3)for(let C=2,I=g*n;C<I;C+=n)k.positions[C]=a;k.uvs.set(x.subarray(0,g<<1));for(let C=0;C<g;C++)k.colors[C]=S,k.darkColors[C]=A;w instanceof Uint16Array?k.indices.set(w.subarray(0,b)):k.indices.set(w.slice(0,b)),this.renderCommands.push(k),a+=i,r.clipEnd(h)}return r.clipEnd(),this.batchCommands(n)}batchSubCommands(e,t,s,n,i,r){const a=e[t],c=this.commandPool.getCommand(n,i,r);c.blendMode=a.blendMode,c.texture=a.texture;let l=0,o=0,h=0,d=0,m=0;for(let f=t;f<=s;f++){const u=e[f];c.positions.set(u.positions,l),l+=u.numVertices*r,c.uvs.set(u.uvs,o),o+=u.numVertices<<1,c.colors.set(u.colors,h),c.darkColors.set(u.darkColors,h),h+=u.numVertices;for(let p=0;p<u.numIndices;p++)c.indices[d+p]=u.indices[p]+m;d+=u.numIndices,m+=u.numVertices}return c}batchCommands(e){if(this.renderCommands.length===0)return;let t,s,n=this.renderCommands[0],i=0,r=1,a=n.numVertices,c=n.numIndices;for(;r<=this.renderCommands.length;){const l=r<this.renderCommands.length?this.renderCommands[r]:null;if(l&&l.numVertices===0&&l.numIndices===0){r++;continue}if(l!==null&&l.texture===n.texture&&l.blendMode===n.blendMode&&l.colors[0]===n.colors[0]&&l.darkColors[0]===n.darkColors[0]&&c+l.numIndices<65535)a+=l.numVertices,c+=l.numIndices;else{const h=this.batchSubCommands(this.renderCommands,i,r-1,a,c,e);if(s?(s.next=h,s=h):t=s=h,r===this.renderCommands.length)break;n=this.renderCommands[r],i=r,a=n.numVertices,c=n.numIndices}r++}return t}},br=class{pool=[];inUse=[];getCommand(e,t,s){let n;for(const i of this.pool)if(i._positions.length>=e*s&&i._indices.length>=t){n=i;break}if(n)this.pool.splice(this.pool.indexOf(n),1),n.next=void 0,n.numVertices=e,n.numIndices=t,n.positions=n._positions.subarray(0,e*s),n.uvs=n._uvs.subarray(0,e<<1),n.colors=n._colors.subarray(0,e),n.darkColors=n._darkColors.subarray(0,e),n.indices=n._indices.subarray(0,t);else{const i=new Float32Array(e*s),r=new Float32Array(e<<1),a=new Uint32Array(e),c=new Uint32Array(e),l=new Uint16Array(t);n={positions:i,uvs:r,colors:a,darkColors:c,indices:l,_positions:i,_uvs:r,_colors:a,_darkColors:c,_indices:l,numVertices:e,numIndices:t,blendMode:0,texture:null}}return this.inUse.push(n),n}reset(){this.pool.push(...this.inUse),this.inUse.length=0}},Lt=et("@pixi/assets"),dt=et("@pixi/core"),mt=et("@pixi/core"),de=class _t extends He{static textureMap=new Map;static from(t){return _t.textureMap.has(t)?_t.textureMap.get(t):new _t(t)}texture;constructor(t){super(t.resource.source),this.texture=mt.Texture.from(t)}setFilters(t,s){this.texture.baseTexture.scaleMode=_t.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=_t.toPixiMipMap(t)}setWraps(t,s){this.texture.baseTexture.wrapMode=_t.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return mt.SCALE_MODES.NEAREST;case 9729:case 9987:case 9985:return mt.SCALE_MODES.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case 9728:case 9729:return mt.MIPMAP_MODES.OFF;case 9986:case 9984:case 9987:case 9985:return mt.MIPMAP_MODES.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return mt.WRAP_MODES.CLAMP;case 33648:return mt.WRAP_MODES.MIRRORED_REPEAT;case 10497:return mt.WRAP_MODES.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return mt.BLEND_MODES.NORMAL;case 1:return mt.BLEND_MODES.ADD;case 2:return mt.BLEND_MODES.MULTIPLY;case 3:return mt.BLEND_MODES.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Ne="spineTextureAtlasLoader",yr={extension:dt.ExtensionType.Asset,resolver:{test:e=>(0,Lt.checkExtension)(e,".atlas"),parse:e=>{const t=e.split(".");return{resolution:parseFloat(dt.settings.RETINA_PREFIX?.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:Ne,extension:{type:dt.ExtensionType.LoadParser,priority:Lt.LoaderParserPriority.Normal,name:Ne},test(e){return(0,Lt.checkExtension)(e,".atlas")},async load(e){const t=await dt.settings.ADAPTER.fetch(e);if(!t.ok)throw new Error(`[${Ne}] Failed to fetch ${e}: ${t.status} ${t.statusText}`);return await t.text()},testParse(e,t){const s=(0,Lt.checkExtension)(t.src,".atlas"),n=typeof e=="string",i=t.loadParser===Ne;return Promise.resolve((s||i)&&n)},unload(e){e.dispose()},async parse(e,t,s){const n=t.data||{};let i=dt.utils.path.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");const r=new pe(e);if(n.images instanceof dt.BaseTexture||typeof n.images=="string"){const l=n.images;n.images={},n.images[r.pages[0].name]=l}const a=[];let c=!0;for(const l of s.parsers)if(l.name==="loadTextures"){c=l.config?.preferCreateImageBitmap;break}Lt.Assets.setPreferences({preferCreateImageBitmap:!1});for(const l of r.pages){const o=l.name,h=n?.images?n.images[o]:void 0;if(h instanceof dt.BaseTexture)l.setTexture(de.from(h));else{const d=h??dt.utils.path.normalize([...i.split(dt.utils.path.sep),o].join(dt.utils.path.sep)),m={src:(0,Lt.copySearchParams)(d,t.src),data:{...n.imageMetadata,alphaMode:l.pma?dt.ALPHA_MODES.PMA:dt.ALPHA_MODES.UNPACK}},f=s.load(m).then(u=>{l.setTexture(de.from(u.baseTexture))});a.push(f)}}return await Promise.all(a),Lt.Assets.setPreferences({preferCreateImageBitmap:c}),r}}};dt.extensions.add(yr);var _e=et("@pixi/assets"),Oe=et("@pixi/core"),Ue="spineSkeletonLoader";function vr(e){return e.hasOwnProperty("bones")}function Tr(e){return e instanceof Uint8Array}var Sr={extension:Oe.ExtensionType.Asset,loader:{name:Ue,extension:{type:Oe.ExtensionType.LoadParser,priority:_e.LoaderParserPriority.Normal,name:Ue},test(e){return(0,_e.checkExtension)(e,".skel")},async load(e){const t=await Oe.settings.ADAPTER.fetch(e);if(!t.ok)throw new Error(`[${Ue}] Failed to fetch ${e}: ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())},testParse(e,t){const s=(0,_e.checkExtension)(t.src,".json")&&vr(e),n=(0,_e.checkExtension)(t.src,".skel")&&Tr(e),i=t.loadParser===Ue;return Promise.resolve(s||n||i)}}};Oe.extensions.add(Sr);var Cr=et("@pixi/mesh"),Wt=et("@pixi/core"),Wn=class extends Wt.Geometry{constructor(e=!1){super();const t=new Wt.Buffer(void 0),s=new Wt.Buffer(void 0,!0),n=new Wt.Buffer(void 0,!0,!0);this.addAttribute("aVertexPosition",t,2,!1,Wt.TYPES.FLOAT),this.addAttribute("aTextureCoord",s,2,!1,Wt.TYPES.FLOAT),this.addIndex(n)}},St=et("@pixi/core"),Ar=`
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform mat3 uTextureMatrix;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
}
`,Ir=`
varying vec2 vTextureCoord;
uniform vec4 uColor;
uniform vec4 uDarkColor;
uniform sampler2D uSampler;
void main(void)
{
vec4 texColor = texture2D(uSampler, vTextureCoord);
gl_FragColor.a = texColor.a * uColor.a;
gl_FragColor.rgb = ((texColor.a - 1.0) * uDarkColor.a + 1.0 - texColor.rgb) * uDarkColor.rgb + texColor.rgb * uColor.rgb;
}
`,Hn=class extends St.Shader{uvMatrix;batchable;pluginName;_tintRGB;_darkTintRGB;_colorDirty;_alpha;_tintColor;_darkTintColor;constructor(e){const t={uSampler:e??St.Texture.EMPTY,alpha:1,uTextureMatrix:St.Matrix.IDENTITY,uColor:new Float32Array([1,1,1,1]),uDarkColor:new Float32Array([0,0,0,0])},s={tint:16777215,darkTint:0,alpha:1,pluginName:"darkTintBatch"};super(St.Program.from(Ar,Ir),t),this._colorDirty=!1,this.uvMatrix=new St.TextureMatrix(t.uSampler),this.batchable=!0,this.pluginName=s.pluginName,this._tintColor=new St.Color(s.tint),this._darkTintColor=new St.Color(s.darkTint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._alpha=s.alpha,this._colorDirty=!0}get texture(){return this.uniforms.uSampler}set texture(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)}set alpha(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(e){e!==this.tint&&(this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}set darkTint(e){e!==this.darkTint&&(this._darkTintColor.setValue(e),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._colorDirty=!0)}get darkTint(){return this._darkTintColor.value}get tintValue(){return this._tintColor.toNumber()}get darkTintValue(){return this._darkTintColor.toNumber()}update(){this._colorDirty&&(this._colorDirty=!1,St.Color.shared.setValue(this._tintColor).premultiply(this._alpha,!0).toArray(this.uniforms.uColor),St.Color.shared.setValue(this._darkTintColor).premultiply(this._alpha,!0).premultiply(1,!1).toArray(this.uniforms.uDarkColor)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}},Kn=class extends Cr.Mesh{_darkTintRGB=0;constructor(e){super(new Wn,new Hn(e),void 0,void 0)}get darkTint(){return"darkTint"in this.shader?this.shader.darkTint:null}set darkTint(e){this.shader.darkTint=e}get darkTintValue(){return this.shader.darkTintValue}_renderToBatch(e){const t=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=t.indexBuffer.data,this._tintRGB=s._tintRGB,this._darkTintRGB=s._darkTintRGB,this._texture=s.texture;const n=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[n]),e.plugins[n].render(this)}},Jn=class rt extends Kn{name="";static auxColor=[0,0,0,0];constructor(){super()}updateFromSpineData(t,s,n,i,r,a,c,l){this.texture=t.texture;const o=r/(l?12:8)*2,h=this.geometry.getBuffer("aTextureCoord");h.data?.length!==o&&(h.data=new Float32Array(o));const d=this.geometry.getBuffer("aVertexPosition");d.data?.length!==o&&(d.data=new Float32Array(o));let m=0;const f=h.data,u=d.data;for(let g=0;g<r;g+=l?12:8){let x=g;u[m]=i[x++],u[m+1]=i[x++],x+=4,f[m]=i[x++],f[m+1]=i[x++],m+=2}l?(rt.auxColor[0]=i[8],rt.auxColor[1]=i[9],rt.auxColor[2]=i[10],rt.auxColor[3]=i[11],this.darkTint=rt.auxColor,rt.auxColor[0]=i[2],rt.auxColor[1]=i[3],rt.auxColor[2]=i[4],rt.auxColor[3]=i[5],this.tint=rt.auxColor):(rt.auxColor[0]=i[2],rt.auxColor[1]=i[3],rt.auxColor[2]=i[4],rt.auxColor[3]=i[5],this.tint=rt.auxColor),this.blendMode=de.toPixiBlending(s),this.alpha=rt.auxColor[3];const p=this.geometry.indexBuffer;if(p.data.length!==a.length)p.data=new Uint32Array(a);else{const g=p.data;for(let x=0;x<c;x++)g[x]=a[x]}this.name=n,h.update(),d.update(),p.update()}},Ft=et("@pixi/core"),jn=class extends Ft.Geometry{_buffer;_indexBuffer;constructor(e=!1){super(),this._buffer=new Ft.Buffer(void 0,e,!1),this._indexBuffer=new Ft.Buffer(void 0,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,Ft.TYPES.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,Ft.TYPES.FLOAT).addAttribute("aColor",this._buffer,4,!0,Ft.TYPES.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,Ft.TYPES.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,Ft.TYPES.FLOAT).addIndex(this._indexBuffer)}},Ht=et("@pixi/core"),kr=`
precision highp float;
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
attribute vec4 aColor;
attribute vec4 aDarkColor;
attribute float aTextureId;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform vec4 tint;
varying vec2 vTextureCoord;
varying vec4 vColor;
varying vec4 vDarkColor;
varying float vTextureId;
void main(void){
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
vTextureId = aTextureId;
vColor = aColor * tint;
vDarkColor = aDarkColor * tint;
}
`,Mr=`
varying vec2 vTextureCoord;
varying vec4 vColor;
varying vec4 vDarkColor;
varying float vTextureId;
uniform sampler2D uSamplers[%count%];
void main(void){
vec4 color;
%forloop%
gl_FragColor.a = color.a * vColor.a;
gl_FragColor.rgb = ((color.a - 1.0) * vDarkColor.a + 1.0 - color.rgb) * vDarkColor.rgb + color.rgb * vColor.rgb;
}
`,Zn=class extends Ht.BatchRenderer{static extension={name:"darkTintBatch",type:Ht.ExtensionType.RendererPlugin};constructor(e){super(e),this.shaderGenerator=new Ht.BatchShaderGenerator(kr,Mr),this.geometryClass=jn,this.vertexSize=7}packInterleavedGeometry(e,t,s,n,i){const{uint32View:r,float32View:a}=t,c=n/this.vertexSize,l=e.uvs,o=e.indices,h=e.vertexData,d=e._texture.baseTexture._batchLocation,m=Math.min(e.worldAlpha,1),f=Ht.Color.shared.setValue(e._tintRGB).toPremultiplied(m,!0),u=Ht.Color.shared.setValue(e._darkTintRGB).premultiply(m,!0).toPremultiplied(1,!1);for(let p=0;p<h.length;p+=2)a[n++]=h[p],a[n++]=h[p+1],a[n++]=l[p],a[n++]=l[p+1],r[n++]=f,r[n++]=u,a[n++]=d;for(let p=0;p<o.length;p++)s[i++]=c+o[p]}};Ht.extensions.add(Zn);var Pr=et("@pixi/core"),sn=et("@pixi/mesh"),Qn=class Ot extends sn.Mesh{name="";static auxColor=[0,0,0,0];warnedTwoTint=!1;constructor(){const t=new sn.MeshGeometry;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const s=new sn.MeshMaterial(Pr.Texture.EMPTY);super(t,s)}updateFromSpineData(t,s,n,i,r,a,c,l){this.texture=t.texture;const o=r/(l?12:8)*2,h=this.geometry.getBuffer("aTextureCoord");h.data?.length!==o&&(h.data=new Float32Array(o));const d=this.geometry.getBuffer("aVertexPosition");d.data?.length!==o&&(d.data=new Float32Array(o));let m=0;const f=h.data,u=d.data;for(let g=0;g<r;g+=l?12:8){let x=g;u[m]=i[x++],u[m+1]=i[x++],x+=4,f[m]=i[x++],f[m+1]=i[x++],m+=2}l&&!this.warnedTwoTint&&(console.warn("DarkTint is not enabled by default. To enable use a DarkSlotMesh factory while creating the Spine object."),this.warnedTwoTint=!0),Ot.auxColor[0]=i[2],Ot.auxColor[1]=i[3],Ot.auxColor[2]=i[4],Ot.auxColor[3]=i[5],this.tint=Ot.auxColor,this.alpha=Ot.auxColor[3],this.blendMode=de.toPixiBlending(s);const p=this.geometry.indexBuffer;if(p.data.length!==a.length)p.data=new Uint32Array(a);else{const g=p.data;for(let x=0;x<c;x++)g[x]=a[x]}this.name=n,h.update(),d.update(),p.update()}},ti=et("@pixi/assets"),nn=et("@pixi/core"),ei=et("@pixi/display"),Fr=et("@pixi/graphics"),Vr=et("@pixi/events"),Yr=class{constructor(e,t,s,n){this.x=e,this.y=t,this.width=s,this.height=n}calculateBounds(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Er=class{constructor(e=!1){this.clipping=e}calculateBounds(e){if(!e.skeleton)return{x:0,y:0,width:0,height:0};const t=new Gt(e.skeleton.data);t.setupPose(),t.updateWorldTransform(2);const s=t.getBoundsRect(this.clipping?new he:void 0);return s.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:s}},Br=class{constructor(e,t=[],s=.05,n=!1){this.animation=e,this.skins=t,this.timeStep=s,this.clipping=n}calculateBounds(e){if(!e.skeleton||!e.state)return{x:0,y:0,width:0,height:0};const t=new Ys(e.state.data),s=new Gt(e.skeleton.data),n=this.clipping?new he:void 0,i=s.data;if(this.skins.length>0){const a=new ce("custom-skin");for(const c of this.skins){const l=i.findSkin(c);l!=null&&a.addSkin(l)}s.setSkin(a)}s.setupPose();const r=this.animation!=null?i.findAnimation(this.animation):null;if(r==null){s.updateWorldTransform(2);const a=s.getBoundsRect(n);return a.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:a}else{let a=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;t.clearTracks(),t.setAnimation(0,r,!1);const h=Math.max(r.duration/this.timeStep,1);for(let m=0;m<h;m++){const f=m>0?this.timeStep:0;t.update(f),t.apply(s),s.update(f),s.updateWorldTransform(2);const u=s.getBoundsRect(n);a=Math.min(a,u.x),c=Math.min(c,u.y),l=Math.max(l,u.x+u.width),o=Math.max(o,u.y+u.height)}const d={x:a,y:c,width:l-a,height:o-c};return d.width===Number.NEGATIVE_INFINITY?{x:0,y:0,width:0,height:0}:d}}},Rr=class Z extends ei.Container{skeleton;state;skeletonPhysics;darkTint=!1;hasNeverUpdated=!0;_debug=void 0;get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}slotMeshFactory=()=>new Qn;beforeUpdateWorldTransforms=()=>{};afterUpdateWorldTransforms=()=>{};_autoUpdate=!1;_ticker=nn.Ticker.shared;get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!t&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=t}get ticker(){return this._ticker}set ticker(t){t=t??nn.Ticker.shared,this._ticker!==t&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),t.add(this.internalUpdate,this)),this._ticker=t)}meshesCache=new Map;static vectorAux=new me;static clipper=new he;static QUAD_TRIANGLES=[0,1,2,2,3,0];static VERTEX_SIZE=8;static DARK_VERTEX_SIZE=12;lightColor=new z;darkColor=new z;clippingVertAux=new Float32Array(6);_boundsProvider;get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t?(this._boundsSpineID=-1,this._boundsSpineDirty=!0,this.interactiveChildren=!1):(this.interactiveChildren=!0,this.hitArea=null),this.hasNeverUpdated||this.calculateBounds()}_boundsPoint=new nn.Point;_boundsSpineID=-1;_boundsSpineDirty=!0;constructor(t){super(),t instanceof Ye?t={skeletonData:t}:"skeleton"in t&&(t=new.target.createOptions(t));const{autoUpdate:s=!0,boundsProvider:n,darkTint:i,skeletonData:r,ticker:a}=t;this.skeleton=new Gt(r),this.skeletonPhysics=new Gn(this.skeleton,{readTransform:(c,l)=>this.readPhysicsTransform(c,l),worldToSkeleton:c=>this.pixiWorldCoordinatesToSkeleton(c)}),this.state=new Ys(new In(r)),a&&(this._ticker=a),this.autoUpdate=s,this.boundsProvider=n,this.darkTint=i===void 0?this.skeleton.slots.some(c=>!!c.data.setupPose.darkColor):i,this.darkTint&&(this.slotMeshFactory=()=>new Jn)}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this.hasNeverUpdated=!1;const n=s??this._ticker.deltaMS/1e3;this.state.update(n),this.state.apply(this.skeleton),this.skeletonPhysics.applyTransformMovement(),this.beforeUpdateWorldTransforms(this),this.skeleton.update(n),this.skeleton.updateWorldTransform(2),this.afterUpdateWorldTransforms(this)}readPhysicsTransform(t,s){const n=this.worldTransform;if(t.x=n.tx,t.y=n.ty,t.z=0,!s)return;let i=0;for(let r=this;r;r=r.parent)i+=r.rotation+(r.skew.y-r.skew.x)/2;t.rotation=i*180/Math.PI}updateTransform(){this.renderMeshes(),this.sortChildren(),this.debug?.renderDebug(this),super.updateTransform()}destroy(t){this.autoUpdate&&(this.autoUpdate=!1),this._ticker=null;for(const[,s]of this.meshesCache)s?.destroy();this.state.clearListeners(),this.debug=void 0,this.meshesCache.clear(),this.slotsObject.clear();for(const s in this.clippingSlotToPixiMasks)this.clippingSlotToPixiMasks[s].destroy(),delete this.clippingSlotToPixiMasks[s];super.destroy(t)}unloadFromCache(){const t=this.skeleton?.data;if(!t)return!1;const s=Z.skeletonDataCacheKeys.get(t);return!s||Z.skeletonCache[s]!==t?!1:(delete Z.skeletonCache[s],Z.skeletonDataCacheKeys.delete(t),!0)}resetMeshes(){for(const[,t]of this.meshesCache)t.zIndex=-1,t.visible=!1}_calculateBounds(){this.hasNeverUpdated&&(this.internalUpdate(0,0),this.renderMeshes())}hasMeshForSlot(t){return this.meshesCache.has(t)}getMeshForSlot(t){let s=this.hasMeshForSlot(t)?this.meshesCache.get(t):null;return s?s.visible=!0:(s=this.slotMeshFactory(),this.addChild(s),this.meshesCache.set(t,s)),s}slotsObject=new Map;getSlotFromRef(t){let s;if(typeof t=="number"?s=this.skeleton.slots[t]:typeof t=="string"?s=this.skeleton.findSlot(t):s=t,!s)throw new Error(`No slot found with the given slot reference: ${t}`);return s}addSlotObject(t,s,n){const i=this.getSlotFromRef(t),r=this.slotsObject.get(i)?.container;if(!(r&&r===s)){for(const[a,{container:c}]of this.slotsObject)if(a!==i&&c===s){this.removeSlotObject(a,s);break}r&&this.removeChild(r),this.slotsObject.set(i,{container:s,followAttachmentTimeline:n?.followAttachmentTimeline||!1,followSlotColor:n?.followSlotColor||!1}),this.addChild(s)}}getSlotObject(t){const s=this.slotsObject.get(this.getSlotFromRef(t));return s?s.container:void 0}removeSlotObject(t,s){const n=this.getSlotFromRef(t),i=this.slotsObject.get(n)?.container;i&&(s&&s!==i||(this.removeChild(i),this.slotsObject.delete(n)))}removeSlotObjects(){for(const[,t]of this.slotsObject)t.container.removeFromParent();this.slotsObject.clear()}verticesCache=V.newFloatArray(1024);clippingSlotToPixiMasks={};pixiMaskCleanup(t){const s=this.clippingSlotToPixiMasks[t.data.name];s&&(delete this.clippingSlotToPixiMasks[t.data.name],s.destroy())}updateSlotObject(t,s,n){const{container:i,followAttachmentTimeline:r}=t,a=s.appliedPose,c=r?!!a.attachment:!0,l=this.skeleton.drawOrder.appliedPose;if(i.visible=l.includes(s)&&c,i.visible){const o=s.bone.appliedPose,h=i.localTransform;h.a=o.a,h.b=o.c,h.c=-o.b,h.d=-o.d,h.tx=o.worldX,h.ty=o.worldY,i.transform.setFromMatrix(h),i.zIndex=n+1,i.alpha=this.skeleton.color.a*a.color.a,t.followSlotColor&&this.setSlotObjectTint(i,255*this.skeleton.color.r*a.color.r<<16|255*this.skeleton.color.g*a.color.g<<8|255*this.skeleton.color.b*a.color.b)}}setSlotObjectTint(t,s){const n=t;"tint"in n&&(n.tint=s);for(const i of n.children??[])this.setSlotObjectTint(i,s)}updateAndSetPixiMask(t,s){if(Z.clipper.isClipping()&&t){let n=this.clippingSlotToPixiMasks[t.slot.data.name];if(n||(n=new Fr.Graphics,this.clippingSlotToPixiMasks[t.slot.data.name]=n,this.addChild(n)),!t.computed){t.computed=!0;const i=t.slot.appliedPose.attachment,r=i.worldVerticesLength;this.clippingVertAux.length<r&&(this.clippingVertAux=new Float32Array(r)),i.computeWorldVertices(this.skeleton,t.slot,0,r,this.clippingVertAux,0,2),n.clear().lineStyle(0).beginFill(0),n.moveTo(this.clippingVertAux[0],this.clippingVertAux[1]);for(let a=2;a<r;a+=2)n.lineTo(this.clippingVertAux[a],this.clippingVertAux[a+1]);n.finishPoly()}s.mask=n}else s.mask&&(s.mask=null)}renderMeshes(){this.resetMeshes();let t=null,s=null,n=null;const i=this.skeleton.drawOrder.appliedPose,r=i;for(let a=0,c=i.length,l=0;a<c;a++){const o=r[a],h=this.slotsObject.get(o),d=a+l;h&&(this.updateSlotObject(h,o,d+1),l++,this.updateAndSetPixiMask(n,h.container));const m=o.appliedPose,f=!!m.darkColor,u=f?Z.DARK_VERTEX_SIZE:Z.VERTEX_SIZE;if(!o.bone.active){Z.clipper.clipEnd(o),this.pixiMaskCleanup(o);continue}const p=m.attachment;let g,x,w=0;const b=this.skeleton;if(p instanceof It){g=p.color,w=u*4;const y=p.sequence,T=y.resolveIndex(m);p.computeWorldVertices(o,p.getOffsets(m),this.verticesCache,0,u),t=Z.QUAD_TRIANGLES,s=y.getUVs(T),x=y.regions[T]?.texture}else if(p instanceof vt){const v=p;g=v.color,w=(v.worldVerticesLength>>1)*u,w>this.verticesCache.length&&(this.verticesCache=V.newFloatArray(w)),v.computeWorldVertices(b,o,0,v.worldVerticesLength,this.verticesCache,0,u),t=v.triangles;const y=p.sequence,T=y.resolveIndex(m);s=y.getUVs(T),x=y.regions[T]?.texture}else if(p instanceof Bt){Z.clipper.clipStart(b,o,p),n={slot:o,computed:!1};continue}else{this.hasMeshForSlot(o)&&(this.getMeshForSlot(o).visible=!1),Z.clipper.clipEnd(o),this.pixiMaskCleanup(o);continue}if(x!=null){const v=b.color,y=m.color,T=v.a*y.a*g.a;this.lightColor.set(v.r*y.r*g.r,v.g*y.g*g.g,v.b*y.b*g.b,T),m.darkColor!=null?this.darkColor.set(m.darkColor.r,m.darkColor.g,m.darkColor.b,1):this.darkColor.set(0,0,0,1);let S,A,k,C;if(Z.clipper.isClipping()&&Z.clipper.clipTriangles(this.verticesCache,t,t.length,s,this.lightColor,this.darkColor,f,u))S=Z.clipper.clippedVertices,A=S.length,k=Z.clipper.clippedTriangles,C=k.length;else{const P=this.verticesCache;for(let F=2,B=0,R=w;F<R;F+=u,B+=2){let L=F;P[L++]=this.lightColor.r,P[L++]=this.lightColor.g,P[L++]=this.lightColor.b,P[L++]=this.lightColor.a,P[L++]=s[B],P[L++]=s[B+1],f&&(P[L++]=this.darkColor.r,P[L++]=this.darkColor.g,P[L++]=this.darkColor.b,P[L++]=this.darkColor.a)}S=this.verticesCache,A=w,k=t,C=t.length}if(A===0||C===0){Z.clipper.clipEnd(o);continue}const I=this.getMeshForSlot(o);I.renderable=!0,I.zIndex=d,I.updateFromSpineData(x,o.data.blendMode,o.data.name,S,A,k,C,f)}Z.clipper.clipEnd(o),this.pixiMaskCleanup(o)}Z.clipper.clipEnd()}calculateBounds(){if(!this._boundsProvider){super.calculateBounds();return}const t=this.transform;if(this._boundsSpineID===t._worldID)return;this.updateBounds();const s=this._localBounds,n=this._boundsPoint;n.set(s.minX,s.minY),t.worldTransform.apply(n,n),this._bounds.minX=n.x,this._bounds.minY=n.y,n.set(s.maxX,s.maxY),t.worldTransform.apply(n,n),this._bounds.maxX=n.x,this._bounds.maxY=n.y}updateBounds(){if(!this._boundsProvider||!this._boundsSpineDirty)return;this._boundsSpineDirty=!1,this._localBounds||(this._localBounds=new ei.Bounds);const t=this._boundsProvider.calculateBounds(this),s=this._localBounds;s.clear(),s.minX=t.x,s.minY=t.y,s.maxX=t.x+t.width,s.maxY=t.y+t.height,this.hitArea=this._localBounds.getRectangle()}setBonePosition(t,s){const n=typeof t=="string"?this.skeleton.findBone(t):t;if(!n)throw Error(`Cannot set bone position, bone ${String(t)} not found`);Z.vectorAux.set(s.x,s.y);const i=n.appliedPose;if(n.parent){const r=n.parent.appliedPose.worldToLocal(Z.vectorAux);i.x=r.x,i.y=r.y}else i.x=Z.vectorAux.x,i.y=Z.vectorAux.y}getBonePosition(t,s){const n=typeof t=="string"?this.skeleton.findBone(t):t;return n?(s||(s={x:0,y:0}),s.x=n.appliedPose.worldX,s.y=n.appliedPose.worldY,s):(console.error(`Cannot get bone position! Bone ${String(t)} not found`),s)}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,s){this.pixiWorldCoordinatesToSkeleton(t),s.parent?s.parent.appliedPose.worldToLocal(t):s.appliedPose.worldToLocal(t)}static skeletonCache=Object.create(null);static skeletonDataCacheKeys=new WeakMap;static getSkeletonCacheKey({skeleton:t,atlas:s,scale:n=1}){return`${t}-${s}-${n}`}static createOptions({skeleton:t,atlas:s,scale:n=1,darkTint:i,autoUpdate:r=!0,boundsProvider:a,allowMissingRegions:c,ticker:l}){const o=Z.getSkeletonCacheKey({skeleton:t,atlas:s,scale:n});let h=Z.skeletonCache[o];if(!h){const d=ti.Assets.get(t),m=ti.Assets.get(s),f=new Fn(m,c),u=d instanceof Uint8Array?new Dn(f):new qn(f);u.scale=n,h=u.readSkeletonData(d),Z.skeletonCache[o]=h}return Z.skeletonDataCacheKeys.set(h,o),{skeletonData:h,darkTint:i,autoUpdate:r,boundsProvider:a,ticker:l}}static from(t){return new Z(Z.createOptions(t))}get tint(){return this.skeleton.color.toRgb888()}set tint(t){z.rgb888ToColor(this.skeleton.color,t)}};Gt.yDown=!0;var rn=et("@pixi/display"),gt=et("@pixi/graphics"),Xr=et("@pixi/text"),Lr=class{registeredSpines=new Map;drawMeshHull=!0;drawMeshTriangles=!0;drawBones=!0;drawPaths=!0;drawBoundingBoxes=!0;drawClipping=!0;drawRegionAttachments=!0;drawEvents=!0;lineWidth=1;regionAttachmentsColor=30975;meshHullColor=30975;meshTrianglesColor=16763904;clippingPolygonColor=16711935;boundingBoxesRectColor=65280;boundingBoxesPolygonColor=65280;boundingBoxesCircleColor=65280;pathsCurveColor=16711680;pathsLineColor=16711935;skeletonXYColor=16711680;bonesColor=61132;eventFontSize=24;eventFontColor=0;registerSpine(e){if(this.registeredSpines.has(e)){console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",e);return}const t={parentDebugContainer:new rn.Container,bones:new rn.Container,skeletonXY:new gt.Graphics,regionAttachmentsShape:new gt.Graphics,meshTrianglesLine:new gt.Graphics,meshHullLine:new gt.Graphics,clippingPolygon:new gt.Graphics,boundingBoxesRect:new gt.Graphics,boundingBoxesCircle:new gt.Graphics,boundingBoxesPolygon:new gt.Graphics,pathsCurve:new gt.Graphics,pathsLine:new gt.Graphics,eventText:new rn.Container,eventCallback:{event:(s,n)=>{if(this.drawEvents){const i=Math.abs(e.scale.x||e.scale.y||1),r=new Xr.Text(n.data.name,{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"});r.scale.x=Math.sign(e.scale.x),r.anchor.set(.5),t.eventText.addChild(r),setTimeout(()=>{r.destroyed||r.destroy()},250)}}}};t.parentDebugContainer.addChild(t.bones),t.parentDebugContainer.addChild(t.skeletonXY),t.parentDebugContainer.addChild(t.regionAttachmentsShape),t.parentDebugContainer.addChild(t.meshTrianglesLine),t.parentDebugContainer.addChild(t.meshHullLine),t.parentDebugContainer.addChild(t.clippingPolygon),t.parentDebugContainer.addChild(t.boundingBoxesRect),t.parentDebugContainer.addChild(t.boundingBoxesCircle),t.parentDebugContainer.addChild(t.boundingBoxesPolygon),t.parentDebugContainer.addChild(t.pathsCurve),t.parentDebugContainer.addChild(t.pathsLine),t.parentDebugContainer.addChild(t.eventText),t.parentDebugContainer.zIndex=9999999,t.parentDebugContainer.accessibleChildren=!1,t.parentDebugContainer.eventMode="none",t.parentDebugContainer.interactiveChildren=!1,e.addChild(t.parentDebugContainer),e.state.addListener(t.eventCallback),this.registeredSpines.set(e,t)}renderDebug(e){this.registeredSpines.has(e)||this.registerSpine(e);const t=this.registeredSpines.get(e);if(!t)return;e.addChild(t.parentDebugContainer),t.skeletonXY.clear(),t.regionAttachmentsShape.clear(),t.meshTrianglesLine.clear(),t.meshHullLine.clear(),t.clippingPolygon.clear(),t.boundingBoxesRect.clear(),t.boundingBoxesCircle.clear(),t.boundingBoxesPolygon.clear(),t.pathsCurve.clear(),t.pathsLine.clear();for(let i=t.bones.children.length;i>0;i--)t.bones.children[i-1].destroy({children:!0,texture:!0,baseTexture:!0});const s=Math.abs(e.scale.x||e.scale.y||1),n=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(e,t,n,s),this.drawPaths&&this.drawPathsFunc(e,t,n),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(e,t,n),this.drawClipping&&this.drawClippingFunc(e,t,n),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(e,t,n),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(e,t,n),this.drawEvents)for(const i of t.eventText.children)i.alpha-=.05,i.y-=2}drawBonesFunc(e,t,s,n){const i=e.skeleton,r=i.x,a=i.y,c=i.bones;t.skeletonXY.lineStyle(s,this.skeletonXYColor,1);for(let o=0,h=c.length;o<h;o++){const d=c[o],m=d.data.length,f=d.appliedPose,u=r+f.worldX,p=a+f.worldY,g=r+m*f.a+f.worldX,x=a+m*f.b+f.worldY;if(d.data.name==="root"||d.data.parent===null)continue;const w=Math.abs(u-g),b=Math.abs(p-x),v=Math.pow(w,2),y=b,T=Math.pow(b,2),S=Math.sqrt(v+T),A=Math.pow(S,2),k=Math.PI/180,C=Math.acos((A+T-v)/(2*y*S))||0;if(S===0)continue;const I=new gt.Graphics;t.bones.addChild(I);const P=S/50/n;I.beginFill(this.bonesColor,1),I.drawPolygon(0,0,0-P,S-P*3,0,S-P,0+P,S-P*3),I.endFill(),I.x=u,I.y=p,I.pivot.y=S;let F=0;u<g&&p<x?F=-C+180*k:u>g&&p<x?F=180*k+C:u>g&&p>x?F=-C:u<g&&p>x?F=C:p===x&&u<g?F=90*k:p===x&&u>g?F=-90*k:u===g&&p<x?F=180*k:u===g&&p>x&&(F=0),I.rotation=F,I.lineStyle(s+P/2.4,this.bonesColor,1),I.beginFill(0,.6),I.drawCircle(0,S,P*1.2),I.endFill()}const l=s*3;t.skeletonXY.moveTo(r-l,a-l),t.skeletonXY.lineTo(r+l,a+l),t.skeletonXY.moveTo(r+l,a-l),t.skeletonXY.lineTo(r-l,a+l)}drawRegionAttachmentsFunc(e,t,s){const i=e.skeleton.slots;t.regionAttachmentsShape.lineStyle(s,this.regionAttachmentsColor,1);for(let r=0,a=i.length;r<a;r++){const c=i[r],l=c.appliedPose.attachment;if(l==null||!(l instanceof It))continue;const o=new Float32Array(8);l.computeWorldVertices(c,l.getOffsets(c.appliedPose),o,0,2),t.regionAttachmentsShape.drawPolygon(Array.from(o.slice(0,8)))}}drawMeshHullAndMeshTriangles(e,t,s){const n=e.skeleton,i=n.slots;t.meshHullLine.lineStyle(s,this.meshHullColor,1),t.meshTrianglesLine.lineStyle(s,this.meshTrianglesColor,1);for(let r=0,a=i.length;r<a;r++){const c=i[r];if(!c.bone.active)continue;const l=c.appliedPose.attachment;if(l==null||!(l instanceof vt))continue;const o=l,h=new Float32Array(o.worldVerticesLength),d=o.triangles;let m=o.hullLength;if(o.computeWorldVertices(n,c,0,o.worldVerticesLength,h,0,2),this.drawMeshTriangles)for(let f=0,u=d.length;f<u;f+=3){const p=d[f]*2,g=d[f+1]*2,x=d[f+2]*2;t.meshTrianglesLine.moveTo(h[p],h[p+1]),t.meshTrianglesLine.lineTo(h[g],h[g+1]),t.meshTrianglesLine.lineTo(h[x],h[x+1])}if(this.drawMeshHull&&m>0){m=(m>>1)*2;let f=h[m-2],u=h[m-1];for(let p=0,g=m;p<g;p+=2){const x=h[p],w=h[p+1];t.meshHullLine.moveTo(x,w),t.meshHullLine.lineTo(f,u),f=x,u=w}}}}drawClippingFunc(e,t,s){const n=e.skeleton,i=n.slots;t.clippingPolygon.lineStyle(s,this.clippingPolygonColor,1);for(let r=0,a=i.length;r<a;r++){const c=i[r];if(!c.bone.active)continue;const l=c.appliedPose.attachment;if(l==null||!(l instanceof Bt))continue;const o=l,h=o.worldVerticesLength,d=new Float32Array(h);o.computeWorldVertices(n,c,0,h,d,0,2),t.clippingPolygon.drawPolygon(Array.from(d))}}drawBoundingBoxesFunc(e,t,s){t.boundingBoxesRect.lineStyle(s,this.boundingBoxesRectColor,5);const n=new Un;n.update(e.skeleton,!0),n.minX!==1/0&&t.boundingBoxesRect.drawRect(n.minX,n.minY,n.getWidth(),n.getHeight());const i=n.polygons,r=(a,c,l)=>{if(t.boundingBoxesPolygon.lineStyle(s,this.boundingBoxesPolygonColor,1),t.boundingBoxesPolygon.beginFill(this.boundingBoxesPolygonColor,.1),l<3)throw new Error("Polygon must contain at least 3 vertices");const o=[],h=s*2;for(let d=0,m=a.length;d<m;d+=2){const f=a[d],u=a[d+1];t.boundingBoxesCircle.lineStyle(0),t.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),t.boundingBoxesCircle.drawCircle(f,u,h),t.boundingBoxesCircle.endFill(),o.push(f,u)}t.boundingBoxesPolygon.drawPolygon(o),t.boundingBoxesPolygon.endFill()};for(let a=0,c=i.length;a<c;a++){const l=i[a];r(l,0,l.length)}}drawPathsFunc(e,t,s){const n=e.skeleton,i=n.slots;t.pathsCurve.lineStyle(s,this.pathsCurveColor,1),t.pathsLine.lineStyle(s,this.pathsLineColor,1);for(let r=0,a=i.length;r<a;r++){const c=i[r];if(!c.bone.active)continue;const l=c.appliedPose.attachment;if(l==null||!(l instanceof re))continue;const o=l;let h=o.worldVerticesLength;const d=new Float32Array(h);o.computeWorldVertices(n,c,0,h,d,0,2);let m=d[2],f=d[3],u=0,p=0;if(o.closed){const g=d[0],x=d[1],w=d[h-2],b=d[h-1];u=d[h-4],p=d[h-3],t.pathsCurve.moveTo(m,f),t.pathsCurve.bezierCurveTo(g,x,w,b,u,p),t.pathsLine.moveTo(m,f),t.pathsLine.lineTo(g,x),t.pathsLine.moveTo(u,p),t.pathsLine.lineTo(w,b)}h-=4;for(let g=4;g<h;g+=6){const x=d[g],w=d[g+1],b=d[g+2],v=d[g+3];u=d[g+4],p=d[g+5],t.pathsCurve.moveTo(m,f),t.pathsCurve.bezierCurveTo(x,w,b,v,u,p),t.pathsLine.moveTo(m,f),t.pathsLine.lineTo(x,w),t.pathsLine.moveTo(u,p),t.pathsLine.lineTo(b,v),m=u,f=p}}}unregisterSpine(e){this.registeredSpines.has(e)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",e);const t=this.registeredSpines.get(e);t&&(e.state.removeListener(t.eventCallback),t.parentDebugContainer.destroy({baseTexture:!0,children:!0,texture:!0}),this.registeredSpines.delete(e))}};return vi(dn)})();