@eva/plugin-renderer-spine 2.0.1-beta.1 → 2.0.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var i in s)({}).hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_spine=function(t,e,s,i){"use strict";var n=Object.defineProperty,r=Object.defineProperties,a=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,c=(t,e,s)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,d=(t,e)=>{for(var s in e||(e={}),e)l.call(e,s)&&c(t,s,e[s]);if(o)for(var s of o(e))h.call(e,s)&&c(t,s,e[s]);return t},u=(t,e,s)=>new Promise(((i,n)=>{var r=t=>{try{o(s.next(t))}catch(t){n(t)}},a=t=>{try{o(s.throw(t))}catch(t){n(t)}},o=t=>t.done?i(t.value):Promise.resolve(t.value).then(r,a);o((s=s.apply(t,e)).next())}));if("undefined"!=typeof window&&window.PIXI){const t=window.require;window.require=e=>t?t(e):e.startsWith("@pixi/")||e.startsWith("pixi.js")?window.PIXI:void 0}var m=class{constructor(){this.entries={},this.size=0}add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},f=class{constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,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=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,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,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new f).setFromString(t)}},g=f;g.WHITE=new f(1,1,1,1),g.RED=new f(1,0,0,1),g.GREEN=new f(0,1,0,1),g.BLUE=new f(0,0,1,1),g.MAGENTA=new f(1,0,1,1);var p=class{static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*p.degRad)}static sinDeg(t){return Math.sin(t*p.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*p.degRad}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){let e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}static randomTriangular(t,e){return p.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let i=Math.random(),n=e-t;return i<=(s-t)/n?t+Math.sqrt(i*n*(s-t)):e-Math.sqrt((1-i)*n*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}},x=p;x.PI=3.1415927,x.PI2=2*p.PI,x.invPI2=1/p.PI2,x.radiansToDegrees=180/p.PI,x.radDeg=p.radiansToDegrees,x.degreesToRadians=p.PI/180,x.degRad=p.degreesToRadians;var b=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},w=class extends b{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}},y=class{static arrayCopy(t,e,s,i,n){for(let r=e,a=i;r<e+n;r++,a++)s[a]=t[r]}static arrayFill(t,e,s,i){for(let n=e;n<s;n++)t[n]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let n=i;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:y.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(y.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static newShortArray(t){if(y.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static toFloatArray(t){return y.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return y.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}},v=y;v.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var k=class{constructor(t){this.items=new Array,this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},A=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}},S=class{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},C=class extends S{constructor(t){super(t),this.id=C.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVertices(t,e,s,i,n,r){s=n+(s>>1)*r;let a=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let a=t.bone,h=a.worldX,c=a.worldY,d=a.a,u=a.b,m=a.c,f=a.d;for(let t=e,a=n;a<s;t+=2,a+=r){let e=l[t],s=l[t+1];i[a]=e*d+s*u+h,i[a+1]=e*m+s*f+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=a.bones;if(0==o.length)for(let t=n,e=3*d;t<s;t+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,e+=3){let t=u[h[c]],i=l[e],r=l[e+1],a=l[e+2];s+=(i*t.a+r*t.b+t.worldX)*a,n+=(i*t.c+r*t.d+t.worldY)*a}i[t]=s,i[t+1]=n}else{let t=o;for(let e=n,a=3*d,o=d<<1;e<s;e+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,a+=3,o+=2){let e=u[h[c]],i=l[a]+t[o],r=l[a+1]+t[o+1],d=l[a+2];s+=(i*e.a+r*e.b+e.worldX)*d,n+=(i*e.c+r*e.d+e.worldY)*d}i[e]=s,i[e+1]=n}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),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=C;T.nextID=0;var I=class{constructor(t){this.id=I.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(t)}copy(){let t=new I(this.regions.length);return v.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let t=this.digits-i.length;t>0;t--)s+="0";return s+=i,s}static nextID(){return I._nextID++}},M=I;M._nextID=0;var F,Y,E,P=((F=P||{})[F.hold=0]="hold",F[F.once=1]="once",F[F.loop=2]="loop",F[F.pingpong=3]="pingpong",F[F.onceReverse=4]="onceReverse",F[F.loopReverse=5]="loopReverse",F[F.pingpongReverse=6]="pingpongReverse",F),X=[0,1,2,3,4,5,6],B=class{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new m,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,r,a,o){if(!t)throw new Error("skeleton cannot be null.");i&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let i=0,h=l.length;i<h;i++)l[i].apply(t,e,s,n,r,a,o)}},R=((Y=R||{})[Y.setup=0]="setup",Y[Y.first=1]="first",Y[Y.replace=2]="replace",Y[Y.add=3]="add",Y),D=((E=D||{})[E.mixIn=0]="mixIn",E[E.mixOut=1]="mixOut",E),V={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},O=class{constructor(t,e){this.propertyIds=e,this.frames=v.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}},L=class extends O{constructor(t,e,s){super(t,s),this.curves=v.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+18*t;if(this.curves.length>e){let t=v.newFloatArray(e);v.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,i,n,r,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*r+o),f=.03*(n-2*a+l),g=.006*(3*(r-o)-i+h),p=.006*(3*(a-l)-n+c),x=2*m+g,b=2*f+p,w=.3*(r-i)+m+.16666667*g,y=.3*(a-n)+f+.16666667*p,v=i+w,k=n+y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,w+=x,y+=b,x+=g,b+=p,v+=w,k+=y}getBezierValue(t,e,s,i){let n=this.curves;if(n[i]>t){let r=this.frames[e],a=this.frames[e+s];return a+(t-r)/(n[i]-r)*(n[i+1]-a)}let r=i+18;for(i+=2;i<r;i+=2)if(n[i]>=t){let e=n[i-2],s=n[i-1];return s+(t-e)/(n[i]-e)*(n[i+1]-s)}e+=this.getFrameEntries();let a=n[r-2],o=n[r-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}},_=class extends L{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let i=this.curves[s>>1];switch(i){case 0:let i=e[s],n=e[s+1];return n+(t-i)/(e[s+2]-i)*(e[s+2+1]-n);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}let r=this.getCurveValue(t);switch(s){case 0:return n+r*e;case 1:case 2:r+=n-i}return i+r*e}getAbsoluteValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}let r=this.getCurveValue(t);return 0==s?n+(r-n)*e:i+(r-i)*e}getAbsoluteValue2(t,e,s,i,n,r){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}return 0==s?n+(r-n)*e:i+(r-i)*e}getScaleValue(t,e,s,i,n,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return n+(r-n)*e}return n}let a=this.getCurveValue(t)*r;if(1==e)return 3==s?n+a-r:a;if(1==i)switch(s){case 0:return r+(Math.abs(a)*x.signum(r)-r)*e;case 1:case 2:return n+(Math.abs(a)*x.signum(n)-n)*e}else{let t=0;switch(s){case 0:return t=Math.abs(r)*x.signum(a),t+(a-t)*e;case 1:case 2:return t=Math.abs(n)*x.signum(a),t+(a-t)*e}}return n+(a-r)*e}},N=class extends L{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}},U=class extends _{constructor(t,e,s){super(t,e,V.rotate+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,n,r,o.rotation,o.data.rotation))}},q=class extends N{constructor(t,e,s){super(t,e,V.x+"|"+s,V.y+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.x=o.data.x,void(o.y=o.data.y);case 1:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let h=0,c=0,d=O.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(r){case 0:o.x=o.data.x+h*n,o.y=o.data.y+c*n;break;case 1:case 2:o.x+=(o.data.x+h-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case 3:o.x+=h*n,o.y+=c*n}}},W=class extends _{constructor(t,e,s){super(t,e,V.x+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,n,r,o.x,o.data.x))}},z=class extends _{constructor(t,e,s){super(t,e,V.y+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,n,r,o.y,o.data.y))}},G=class extends N{constructor(t,e,s){super(t,e,V.scaleX+"|"+s,V.scaleY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l,h,c=this.frames;if(s<c[0]){switch(r){case 0:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case 1:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let d=O.search(c,s,3),u=this.curves[d/3];switch(u){case 0:let t=c[d];l=c[d+1],h=c[d+2];let e=(s-t)/(c[d+3]-t);l+=(c[d+3+1]-l)*e,h+=(c[d+3+2]-h)*e;break;case 1:l=c[d+1],h=c[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),h=this.getBezierValue(s,d,2,u+18-2)}if(l*=o.data.scaleX,h*=o.data.scaleY,1==n)3==r?(o.scaleX+=l-o.data.scaleX,o.scaleY+=h-o.data.scaleY):(o.scaleX=l,o.scaleY=h);else{let t=0,e=0;if(1==a)switch(r){case 0:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(l)*x.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*x.signum(e)-e)*n;break;case 1:case 2:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(l)*x.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*x.signum(e)-e)*n;break;case 3:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}else switch(r){case 0:t=Math.abs(o.data.scaleX)*x.signum(l),e=Math.abs(o.data.scaleY)*x.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case 1:case 2:t=Math.abs(o.scaleX)*x.signum(l),e=Math.abs(o.scaleY)*x.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case 3:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}}}},j=class extends _{constructor(t,e,s){super(t,e,V.scaleX+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,n,r,a,o.scaleX,o.data.scaleX))}},$=class extends _{constructor(t,e,s){super(t,e,V.scaleY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,n,r,a,o.scaleY,o.data.scaleY))}},H=class extends N{constructor(t,e,s){super(t,e,V.shearX+"|"+s,V.shearY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case 1:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let h=0,c=0,d=O.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(r){case 0:o.shearX=o.data.shearX+h*n,o.shearY=o.data.shearY+c*n;break;case 1:case 2:o.shearX+=(o.data.shearX+h-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case 3:o.shearX+=h*n,o.shearY+=c*n}}},J=class extends _{constructor(t,e,s){super(t,e,V.shearX+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,n,r,o.shearX,o.data.shearX))}},K=class extends _{constructor(t,e,s){super(t,e,V.shearY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,n,r,o.shearY,o.data.shearY))}},Q=class extends O{constructor(t,e){super(t,[V.inherit+"|"+e]),this.boneIndex=0,this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;if(1==a)return void(0==r&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?0!=r&&1!=r||(o.inherit=o.data.inherit):o.inherit=this.frames[O.search(l,s,2)+1]}},Z=class extends L{constructor(t,e,s){super(t,e,[V.rgb+"|"+s,V.alpha+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(r){case 0:return void h.setFromColor(t);case 1:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n)}return}let c=0,d=0,u=0,m=0,f=O.search(l,s,5),g=this.curves[f/5];switch(g){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];let e=(s-t)/(l[f+5]-t);c+=(l[f+5+1]-c)*e,d+=(l[f+5+2]-d)*e,u+=(l[f+5+3]-u)*e,m+=(l[f+5+4]-m)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];break;default:c=this.getBezierValue(s,f,1,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+36-2),m=this.getBezierValue(s,f,4,g+54-2)}1==n?h.set(c,d,u,m):(0==r&&h.setFromColor(o.data.color),h.add((c-h.r)*n,(d-h.g)*n,(u-h.b)*n,(m-h.a)*n))}},tt=class extends L{constructor(t,e,s){super(t,e,[V.rgb+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(r){case 0:return h.r=t.r,h.g=t.g,void(h.b=t.b);case 1:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n}return}let c=0,d=0,u=0,m=O.search(l,s,4),f=this.curves[m>>2];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3];let e=(s-t)/(l[m+4]-t);c+=(l[m+4+1]-c)*e,d+=(l[m+4+2]-d)*e,u+=(l[m+4+3]-u)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(1==n)h.r=c,h.g=d,h.b=u;else{if(0==r){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*n,h.g+=(d-h.g)*n,h.b+=(u-h.b)*n}}},et=class extends _{constructor(t,e,s){super(t,e,V.alpha+"|"+s),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.color;if(s<this.frames[0]){let t=o.data.color;switch(r){case 0:return void(l.a=t.a);case 1:l.a+=(t.a-l.a)*n}return}let h=this.getCurveValue(s);1==n?l.a=h:(0==r&&(l.a=o.data.color.a),l.a+=(h-l.a)*n)}},st=class extends L{constructor(t,e,s){super(t,e,[V.rgb+"|"+s,V.alpha+"|"+s,V.rgb2+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,r,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(r){case 0:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case 1:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n),c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=0,b=O.search(l,s,8),w=this.curves[b>>3];switch(w){case 0:let t=l[b];d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],g=l[b+5],p=l[b+6],x=l[b+7];let e=(s-t)/(l[b+8]-t);d+=(l[b+8+1]-d)*e,u+=(l[b+8+2]-u)*e,m+=(l[b+8+3]-m)*e,f+=(l[b+8+4]-f)*e,g+=(l[b+8+5]-g)*e,p+=(l[b+8+6]-p)*e,x+=(l[b+8+7]-x)*e;break;case 1:d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],g=l[b+5],p=l[b+6],x=l[b+7];break;default:d=this.getBezierValue(s,b,1,w-2),u=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+36-2),f=this.getBezierValue(s,b,4,w+54-2),g=this.getBezierValue(s,b,5,w+72-2),p=this.getBezierValue(s,b,6,w+90-2),x=this.getBezierValue(s,b,7,w+108-2)}if(1==n)h.set(d,u,m,f),c.r=g,c.g=p,c.b=x;else{if(0==r){h.setFromColor(o.data.color);let t=o.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b}h.add((d-h.r)*n,(u-h.g)*n,(m-h.b)*n,(f-h.a)*n),c.r+=(g-c.r)*n,c.g+=(p-c.g)*n,c.b+=(x-c.b)*n}}},it=class extends L{constructor(t,e,s){super(t,e,[V.rgb+"|"+s,V.rgb2+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,r,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(r){case 0:return h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,void(c.b=e.b);case 1:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n,c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=O.search(l,s,7),b=this.curves[x/7];switch(b){case 0:let t=l[x];d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];let e=(s-t)/(l[x+7]-t);d+=(l[x+7+1]-d)*e,u+=(l[x+7+2]-u)*e,m+=(l[x+7+3]-m)*e,f+=(l[x+7+4]-f)*e,g+=(l[x+7+5]-g)*e,p+=(l[x+7+6]-p)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];break;default:d=this.getBezierValue(s,x,1,b-2),u=this.getBezierValue(s,x,2,b+18-2),m=this.getBezierValue(s,x,3,b+36-2),f=this.getBezierValue(s,x,4,b+54-2),g=this.getBezierValue(s,x,5,b+72-2),p=this.getBezierValue(s,x,6,b+90-2)}if(1==n)h.r=d,h.g=u,h.b=m,c.r=f,c.g=g,c.b=p;else{if(0==r){let t=o.data.color,e=o.data.darkColor;h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,c.b=e.b}h.r+=(d-h.r)*n,h.g+=(u-h.g)*n,h.b+=(m-h.b)*n,c.r+=(f-c.r)*n,c.g+=(g-c.g)*n,c.b+=(p-c.b)*n}}},nt=class extends O{constructor(t,e){super(t,[V.attachment+"|"+e]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];o.bone.active&&(1!=a?s<this.frames[0]?0!=r&&1!=r||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[O.search1(this.frames,s)]):0==r&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},rt=class extends L{constructor(t,e,s,i){super(t,e,[V.deform+"|"+s+"|"+i.id]),this.slotIndex=0,this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,r,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*r+o),f=.03*l-.06*a,g=.006*(3*(r-o)-i+h),p=.018*(a-l+.33333333),x=2*m+g,b=2*f+p,w=.3*(r-i)+m+.16666667*g,y=.3*a+f+.16666667*p,v=i+w,k=y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,w+=x,y+=b,x+=g,b+=p,v+=w,k+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){let e=s[i-2],n=s[i-1];return n+(t-e)/(s[i]-e)*(s[i+1]-n)}let r=s[n-2],a=s[n-1];return a+(1-a)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof T)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(r=0);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(r){case 0:return void(h.length=0);case 1:if(1==n)return void(h.length=0);h.length=d;let t=l;if(t.bones){n=1-n;for(m=0;m<d;m++)h[m]*=n}else{let e=t.vertices;for(var m=0;m<d;m++)h[m]+=(e[m]-h[m])*n}}return}if(h.length=d,s>=u[u.length-1]){let t=c[u.length-1];if(1==n)if(3==r){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else v.arrayCopy(t,0,h,0,d);else switch(r){case 0:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++){let i=s[e];h[e]=i+(t[e]-i)*n}}break}case 1:case 2:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*n;break;case 3:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*n}}return}let f=O.search1(u,s),g=this.getCurvePercent(s,f),p=c[f],x=c[f+1];if(1==n)if(3==r){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]+=e+(x[t]-e)*g}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t];h[t]+=s+(x[t]-s)*g-e[t]}}}else for(let t=0;t<d;t++){let e=p[t];h[t]=e+(x[t]-e)*g}else switch(r){case 0:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]=(e+(x[t]-e)*g)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t],i=e[t];h[t]=i+(s+(x[t]-s)*g-i)*n}}break}case 1:case 2:for(let t=0;t<d;t++){let e=p[t];h[t]+=(e+(x[t]-e)*g-h[t])*n}break;case 3:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]+=(e+(x[t]-e)*g)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t];h[t]+=(s+(x[t]-s)*g-e[t])*n}}}}},at=class extends O{constructor(t){super(t,at.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,r,a){if(!i)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,r,a),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let h=0;if(e<o[0])h=0;else{h=O.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)i.push(this.events[h])}},ot=at;ot.propertyIds=[""+V.event];var lt=class extends O{constructor(t){super(t,lt.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,n,r,a){if(1==a)return void(0==r&&v.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(0!=r&&1!=r||v.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=O.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,i=l.length;t<i;t++)e[t]=s[l[t]]}else v.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}},ht=lt;ht.propertyIds=[""+V.drawOrder];var ct=class extends L{constructor(t,e,s){super(t,e,[V.ikConstraint+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,r,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,i,n,r,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,void(o.stretch=o.data.stretch);case 1:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=O.search(l,s,6),u=this.curves[d/6];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+6]-t);h+=(l[d+6+1]-h)*e,c+=(l[d+6+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}0==r?(o.mix=o.data.mix+(h-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,1==a?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5])):(o.mix+=(h-o.mix)*n,o.softness+=(c-o.softness)*n,0==a&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}},dt=class extends L{constructor(t,e,s){super(t,e,[V.transformConstraint+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,r,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,l[t+4]=r,l[t+5]=a,l[t+6]=o}apply(t,e,s,i,n,r,a){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,m,f=this.frames;if(s<f[0]){let t=o.data;switch(r){case 0:return o.mixRotate=t.mixRotate,o.mixX=t.mixX,o.mixY=t.mixY,o.mixScaleX=t.mixScaleX,o.mixScaleY=t.mixScaleY,void(o.mixShearY=t.mixShearY);case 1:o.mixRotate+=(t.mixRotate-o.mixRotate)*n,o.mixX+=(t.mixX-o.mixX)*n,o.mixY+=(t.mixY-o.mixY)*n,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(t.mixShearY-o.mixShearY)*n}return}let g=O.search(f,s,7),p=this.curves[g/7];switch(p){case 0:let t=f[g];l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];let e=(s-t)/(f[g+7]-t);l+=(f[g+7+1]-l)*e,h+=(f[g+7+2]-h)*e,c+=(f[g+7+3]-c)*e,d+=(f[g+7+4]-d)*e,u+=(f[g+7+5]-u)*e,m+=(f[g+7+6]-m)*e;break;case 1:l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),h=this.getBezierValue(s,g,2,p+18-2),c=this.getBezierValue(s,g,3,p+36-2),d=this.getBezierValue(s,g,4,p+54-2),u=this.getBezierValue(s,g,5,p+72-2),m=this.getBezierValue(s,g,6,p+90-2)}if(0==r){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*n,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*n,o.mixShearY=t.mixShearY+(m-t.mixShearY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n,o.mixScaleX+=(d-o.mixScaleX)*n,o.mixScaleY+=(u-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}},ut=class extends _{constructor(t,e,s){super(t,e,V.pathConstraintPosition+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,n,r,o.position,o.data.position))}},mt=class extends _{constructor(t,e,s){super(t,e,V.pathConstraintSpacing+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,n,r,o.spacing,o.data.spacing))}},ft=class extends L{constructor(t,e,s){super(t,e,[V.pathConstraintMix+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){let r=this.frames;r[t<<=2]=e,r[t+1]=s,r[t+2]=i,r[t+3]=n}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(r){case 0:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case 1:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u=O.search(d,s,4),m=this.curves[u>>2];switch(m){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,m-2),h=this.getBezierValue(s,u,2,m+18-2),c=this.getBezierValue(s,u,3,m+36-2)}if(0==r){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n}},gt=class extends _{constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const i of t.physicsConstraints)i.active&&this.global(i.data)&&this.set(i,this.getAbsoluteValue2(s,n,r,this.get(i),this.setup(i),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,n,r,this.get(o),this.setup(o)))}},pt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},xt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},bt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},wt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},yt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},vt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},kt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},At=class extends O{constructor(t,e){super(t,At.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,n,r,a){let o;if(-1!=this.constraintIndex&&(o=t.physicsConstraints[this.constraintIndex],!o.active))return;const l=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],n,r,a),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[O.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}},St=At;St.propertyIds=[V.physicsConstraintReset.toString()];var Ct=class extends O{constructor(t,e,s){super(t,[V.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return Ct.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,n){let r=this.frames;r[t*=Ct.ENTRIES]=e,r[t+Ct.MODE]=s|i<<4,r[t+Ct.DELAY]=n}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof T&&l.timelineAttachment==h))return;if(1==a)return void(0==r&&(o.sequenceIndex=-1));let c=this.frames;if(s<c[0])return void(0!=r&&1!=r||(o.sequenceIndex=-1));let d=O.search(c,s,Ct.ENTRIES),u=c[d],m=c[d+Ct.MODE],f=c[d+Ct.DELAY];if(!this.attachment.sequence)return;let g=m>>4,p=this.attachment.sequence.regions.length,x=X[15&m];if(0!=x)switch(g+=(s-u)/f+1e-5|0,x){case 1:g=Math.min(p-1,g);break;case 2:g%=p;break;case 3:{let t=(p<<1)-2;g=0==t?0:g%t,g>=p&&(g=t-g);break}case 4:g=Math.max(p-1-g,0);break;case 5:g=p-1-g%p;break;case 6:{let t=(p<<1)-2;g=0==t?0:(g+p-1)%t,g>=p&&(g=t-g)}}o.sequenceIndex=g}},Tt=Ct;Tt.ENTRIES=3,Tt.MODE=1,Tt.DELAY=2;var It=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Xt(this),this.propertyIDs=new m,this.animationsChanged=!1,this.trackEntryPool=new k((()=>new Pt)),this.data=t}static emptyAnimation(){return It._emptyAnimation}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(!i)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let n=t*i.timeScale;if(i.delay>0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let r=i.next;if(r){let e=i.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime+=0==i.timeScale?0:(e/i.timeScale+t)*r.timeScale,i.trackTime+=n,this.setCurrent(s,r,!0);r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){e[s]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,t)){let t=i.mixingFrom;for(i.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);if(s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,-1!=t.nextTrackLast){const e=0==t.mixTime&&0==s.mixTime;if(t.mixTime>=t.mixDuration||e)return(0==s.totalAlpha||0==t.mixDuration||e)&&(t.mixingFrom=s.mixingFrom,null!=s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i}return s.trackTime+=e*s.timeScale,t.mixTime+=e,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,i=!1;for(let r=0,a=s.length;r<a;r++){let a=s[r];if(!a||a.delay>0)continue;i=!0;let o=0==r?1:a.mixBlend,l=a.alpha;a.mixingFrom?l*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(l=0);let h=l>=a.alphaAttachmentThreshold,c=a.animationLast,d=a.getAnimationTime(),u=d,m=e;a.reverse&&(u=a.animation.duration-u,m=null);let f=a.animation.timelines,g=f.length;if(0==r&&1==l||3==o){0==r&&(h=!0);for(let e=0;e<g;e++){v.webkit602BugfixHelper(l,o);var n=f[e];n instanceof nt?this.applyAttachmentTimeline(n,t,u,o,h):n.apply(t,c,u,m,l,o,0)}}else{let e=a.timelineMode,s=a.shortestRotation,i=!s&&a.timelinesRotation.length!=g<<1;i&&(a.timelinesRotation.length=g<<1);for(let n=0;n<g;n++){let r=f[n],d=e[n]==Rt?o:0;!s&&r instanceof U?this.applyRotateTimeline(r,t,u,l,d,a.timelinesRotation,n<<1,i):r instanceof nt?this.applyAttachmentTimeline(r,t,u,o,h):(v.webkit602BugfixHelper(l,o),r.apply(t,c,u,m,l,d,0))}}this.queueEvents(a,d),e.length=0,a.nextAnimationLast=d,a.nextTrackLast=a.trackTime}for(var r=this.unkeyedState+_t,a=t.slots,o=0,l=t.slots.length;o<l;o++){var h=a[o];if(h.attachmentState==r){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e,s){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,e,s);let n=0;0==t.mixDuration?(n=1,1==s&&(s=0)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),1!=s&&(s=i.mixBlend));let r=n<i.mixAttachmentThreshold,a=n<i.mixDrawOrderThreshold,o=i.animation.timelines,l=o.length,h=i.alpha*t.interruptAlpha,c=h*(1-n),d=i.animationLast,u=i.getAnimationTime(),m=u,f=null;if(i.reverse?m=i.animation.duration-m:n<i.eventThreshold&&(f=this.events),3==s)for(let t=0;t<l;t++)o[t].apply(e,d,m,f,c,s,1);else{let t=i.timelineMode,n=i.timelineHoldMix,u=i.shortestRotation,g=!u&&i.timelinesRotation.length!=l<<1;g&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let p=0;p<l;p++){let l,x=o[p],b=1,w=0;switch(t[p]){case Rt:if(!a&&x instanceof ht)continue;l=s,w=c;break;case Dt:l=0,w=c;break;case Vt:l=s,w=h;break;case Ot:l=0,w=h;break;default:l=0;let t=n[p];w=h*Math.max(0,1-t.mixTime/t.mixDuration)}i.totalAlpha+=w,!u&&x instanceof U?this.applyRotateTimeline(x,e,m,w,l,i.timelinesRotation,p<<1,g):x instanceof nt?this.applyAttachmentTimeline(x,e,m,l,r&&w>=i.alphaAttachmentThreshold):(v.webkit602BugfixHelper(w,s),a&&x instanceof ht&&0==l&&(b=0),x.apply(e,d,m,f,w,l,b))}}return t.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,n}applyAttachmentTimeline(t,e,s,i,n){var r=e.slots[t.slotIndex];r.bone.active&&(s<t.frames[0]?0!=i&&1!=i||this.setAttachment(e,r,r.data.attachmentName,n):this.setAttachment(e,r,t.attachmentNames[O.search1(t.frames,s)],n),r.attachmentState<=this.unkeyedState&&(r.attachmentState=this.unkeyedState+_t))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+Nt)}applyRotateTimeline(t,e,s,i,n,r,a,o){if(o&&(r[a]=0),1==i)return void t.apply(e,0,s,null,1,n,0);let l=e.bones[t.boneIndex];if(!l.active)return;let h=0,c=0;if(s<t.frames[0])switch(n){case 0:l.rotation=l.data.rotation;default:return;case 1:h=l.rotation,c=l.data.rotation}else h=0==n?l.data.rotation:l.rotation,c=l.data.rotation+t.getCurveValue(s);let d=0,u=c-h;if(u-=360*Math.ceil(u/360-.5),0==u)d=r[a];else{let t=0,e=0;o?(t=0,e=u):(t=r[a],e=r[a+1]);let s=t-t%360;d=u+s;let i=u>=0,n=t>=0;Math.abs(e)<=90&&x.signum(e)!=x.signum(u)&&(Math.abs(t-s)>180?(d+=360*x.signum(t),n=i):0!=s?d-=360*x.signum(t):n=i),n!=i&&(d+=360*x.signum(t)),r[a]=d}r[a+1]=u,l.rotation=h+d*i}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,n=i-s,r=t.trackLast%n,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<r)break;e.time>i||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==n)h=!0;else{const e=Math.floor(t.trackTime/n);h=e>0&&e>Math.floor(t.trackLast/n)}else h=e>=i&&t.animationLast<i;for(h&&this.queue.complete(t);o<l;o++){let e=a[o];e.time<s||this.queue.event(t,e)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){let t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,n=this.expandToIndex(t);n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,i=!1):this.clearNext(n));let r=this.trackEntry(t,e,s,n);return this.setCurrent(t,r,i),this.queue.drain(),r}addAnimation(t,e,s=!1,i=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let r=this.trackEntry(t,e,s,n);return n?(n.next=r,r.previous=n,i<=0&&(i+=n.getTrackComplete()-r.mixDuration)):(this.setCurrent(t,r,!0),this.queue.drain()),r.delay=i,r}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,It.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,It.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-e),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,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,e,s,i){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=i?this.data.getMix(i.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do{s.mixingTo&&3==s.mixBlend||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;let r=t.timelineHoldMix;r.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<i;t++)n[t]=a.addAll(s[t].getPropertyIds())?Ot:Vt;else t:for(let o=0;o<i;o++){let i=s[o],l=i.getPropertyIds();if(a.addAll(l))if(!e||i instanceof nt||i instanceof ht||i instanceof ot||!e.animation.hasTimeline(l))n[o]=Dt;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){n[o]=Lt,r[o]=s;continue t}break}n[o]=Ot}else n[o]=Rt}}getCurrent(t){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){let e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Mt=It;Mt._emptyAnimation=new B("<empty>",[],0);var Ft,Yt,Et,Pt=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.mixAttachmentThreshold=0,this.alphaAttachmentThreshold=0,this.mixDrawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this._mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=2,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}},Xt=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(Bt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Bt.interrupt),this.objects.push(t)}end(t){this.objects.push(Bt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Bt.dispose),this.objects.push(t)}complete(t){this.objects.push(Bt.complete),this.objects.push(t)}event(t,e){this.objects.push(Bt.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],n=t[s+1];switch(i){case Bt.start:n.listener&&n.listener.start&&n.listener.start(n);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(n)}break;case Bt.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(n)}break;case Bt.end:n.listener&&n.listener.end&&n.listener.end(n);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(n)}case Bt.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(n)}this.animState.trackEntryPool.free(n);break;case Bt.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(n)}break;case Bt.event:let i=t[2+s++];n.listener&&n.listener.event&&n.listener.event(n,i);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(n,i)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Bt=((Ft=Bt||{})[Ft.start=0]="start",Ft[Ft.interrupt=1]="interrupt",Ft[Ft.end=2]="end",Ft[Ft.dispose=3]="dispose",Ft[Ft.complete=4]="complete",Ft[Ft.event=5]="event",Ft),Rt=0,Dt=1,Vt=2,Ot=3,Lt=4,_t=1,Nt=2,Ut=class{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(i,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return void 0===i?this.defaultMix:i}},qt=class extends T{constructor(t){super(t),this.color=new g(1,1,1,1)}copy(){let t=new qt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Wt=class extends T{constructor(t){super(t),this.endSlot=null,this.color=new g(.2275,.2275,.8078,1)}copy(){let t=new Wt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},zt=class{constructor(t){this._image=t}getImage(){return this._image}},Gt=((Yt=Gt||{})[Yt.Nearest=9728]="Nearest",Yt[Yt.Linear=9729]="Linear",Yt[Yt.MipMap=9987]="MipMap",Yt[Yt.MipMapNearestNearest=9984]="MipMapNearestNearest",Yt[Yt.MipMapLinearNearest=9985]="MipMapLinearNearest",Yt[Yt.MipMapNearestLinear=9986]="MipMapNearestLinear",Yt[Yt.MipMapLinearLinear=9987]="MipMapLinearLinear",Yt),jt=((Et=jt||{})[Et.MirroredRepeat=33648]="MirroredRepeat",Et[Et.ClampToEdge=33071]="ClampToEdge",Et[Et.Repeat=10497]="Repeat",Et),$t=class{constructor(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.degrees=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0}},Ht=class{constructor(t){this.pages=new Array,this.regions=new Array;let e=new Jt(t),s=new Array(4),i={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=v.enumValue(Gt,s[1]),t.magFilter=v.enumValue(Gt,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=10497),-1!=s[1].indexOf("y")&&(t.vWrap=10497)},pma:t=>{t.pma="true"==s[1]}};var n={xy:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2])},size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},bounds:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2]),t.width=parseInt(s[3]),t.height=parseInt(s[4])},offset:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2])},orig:t=>{t.originalWidth=parseInt(s[1]),t.originalHeight=parseInt(s[2])},offsets:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2]),t.originalWidth=parseInt(s[3]),t.originalHeight=parseInt(s[4])},rotate:t=>{let e=s[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:t=>{t.index=parseInt(s[1])}};let r=e.readLine();for(;r&&0==r.trim().length;)r=e.readLine();for(;r&&0!=r.trim().length&&0!=e.readEntry(s,r);)r=e.readLine();let a=null,o=null,l=null;for(;null!==r;)if(0==r.trim().length)a=null,r=e.readLine();else if(a){let t=new Qt(a,r);for(;;){let i=e.readEntry(s,r=e.readLine());if(0==i)break;let a=n[s[0]];if(a)a(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<i;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=null),t.u=t.x/a.width,t.v=t.y/a.height,90==t.degrees?(t.u2=(t.x+t.height)/a.width,t.v2=(t.y+t.width)/a.height):(t.u2=(t.x+t.width)/a.width,t.v2=(t.y+t.height)/a.height),this.regions.push(t)}else{for(a=new Kt(r.trim());0!=e.readEntry(s,r=e.readLine());){let t=i[s[0]];t&&t(a)}this.pages.push(a)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){var t;for(let e=0;e<this.pages.length;e++)null==(t=this.pages[e].texture)||t.dispose()}},Jt=class{constructor(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){let s=e.indexOf(",",n);if(-1==s)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,s-n).trim(),n=s+1,4==i)return 4}}},Kt=class{constructor(t){this.minFilter=9728,this.magFilter=9728,this.uWrap=33071,this.vWrap=33071,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.regions=new Array,this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},Qt=class extends $t{constructor(t,e){super(),this.x=0,this.y=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.index=0,this.degrees=0,this.names=null,this.values=null,this.page=t,this.name=e,t.regions.push(this)}},Zt=class extends T{constructor(t,e){super(t),this.region=null,this.regionUVs=[],this.uvs=[],this.triangles=[],this.color=new g(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new g(0,0,0,0),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=v.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,n=this.region.v,r=0,a=0;if(this.region instanceof Qt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:i-=(o.originalHeight-o.offsetY-o.height)/h,n-=(o.originalWidth-o.offsetX-o.width)/c,r=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+t[o+1]*r,e[o+1]=n+(1-t[o])*a;return;case 180:i-=(o.originalWidth-o.offsetX-o.width)/h,n-=o.offsetY/c,r=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o])*r,e[o+1]=n+(1-t[o+1])*a;return;case 270:i-=o.offsetY/h,n-=o.offsetX/c,r=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o+1])*r,e[o+1]=n+t[o]*a;return}i-=o.offsetX/h,n-=(o.originalHeight-o.offsetY-o.height)/c,r=o.originalWidth/h,a=o.originalHeight/c}else this.region?(r=this.region.u2-i,a=this.region.v2-n):(i=n=0,r=a=1);for(let o=0;o<s;o+=2)e[o]=i+t[o]*r,e[o+1]=n+t[o+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=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)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Zt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),v.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),v.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),v.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),v.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,r){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,r)}newLinkedMesh(){let t=new Zt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),null!=t.region&&t.updateRegion(),t}},te=class extends T{constructor(t){super(t),this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new g(1,1,1,1)}copy(){let t=new te(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),v.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},ee=class extends T{constructor(t){super(t),this.x=0,this.y=0,this.rotation=0,this.color=new g(.38,.94,0,1)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){const e=this.rotation*x.degRad,s=Math.cos(e),i=Math.sin(e),n=s*t.a+i*t.b,r=s*t.c+i*t.d;return x.atan2Deg(r,n)}copy(){let t=new ee(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},se=class extends S{constructor(t,e){super(t),this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new g(1,1,1,1),this.region=null,this.sequence=null,this.offset=v.newFloatArray(8),this.uvs=v.newFloatArray(8),this.tempColor=new g(1,1,1,1),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,r=-this.height/2*this.scaleY+this.region.offsetY*i,a=n+this.region.width*s,o=r+this.region.height*i,l=this.rotation*x.degRad,h=Math.cos(l),c=Math.sin(l),d=this.x,u=this.y,m=n*h+d,f=n*c,g=r*h+u,p=r*c,b=a*h+d,w=a*c,y=o*h+u,v=o*c,k=this.offset;k[0]=m-p,k[1]=g+f,k[2]=m-v,k[3]=y+f,k[4]=b-v,k[5]=y+w,k[6]=b-p,k[7]=g+w,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){null!=this.sequence&&this.sequence.apply(t,this);let n=t.bone,r=this.offset,a=n.worldX,o=n.worldY,l=n.a,h=n.b,c=n.c,d=n.d,u=0,m=0;u=r[0],m=r[1],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[2],m=r[3],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[4],m=r[5],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[6],m=r[7],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o}copy(){let t=new se(this.name,this.path);return t.region=this.region,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,v.arrayCopy(this.uvs,0,t.uvs,0,8),v.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}},ie=se;ie.X1=0,ie.Y1=1,ie.C1R=2,ie.C1G=3,ie.C1B=4,ie.C1A=5,ie.U1=6,ie.V1=7,ie.X2=8,ie.Y2=9,ie.C2R=10,ie.C2G=11,ie.C2B=12,ie.C2A=13,ie.U2=14,ie.V2=15,ie.X3=16,ie.Y3=17,ie.C3R=18,ie.C3G=19,ie.C3B=20,ie.C3A=21,ie.U3=22,ie.V3=23,ie.X4=24,ie.Y4=25,ie.C4R=26,ie.C4G=27,ie.C4B=28,ie.C4A=29,ie.U4=30,ie.V4=31;var ne,re,ae,oe,le=class{constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let n=0,r=i.length;n<r;n++){let r=s.getPath(e,n),a=this.atlas.findRegion(r);if(null==a)throw new Error("Region not found in atlas: "+r+" (sequence: "+t+")");i[n]=a}}newRegionAttachment(t,e,s,i){let n=new ie(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=t}return n}newMeshAttachment(t,e,s,i){let n=new Zt(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=t}return n}newBoundingBoxAttachment(t,e){return new qt(e)}newPathAttachment(t,e){return new te(e)}newPointAttachment(t,e){return new ee(e)}newClippingAttachment(t,e){return new Wt(e)}},he=class{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.inherit=ce.Normal,this.skinRequired=!1,this.color=new g,this.visible=!1,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},ce=((ne=ce||{})[ne.Normal=0]="Normal",ne[ne.OnlyTranslation=1]="OnlyTranslation",ne[ne.NoRotationOrReflection=2]="NoRotationOrReflection",ne[ne.NoScale=3]="NoScale",ne[ne.NoScaleOrReflection=4]="NoScaleOrReflection",ne),de=class{constructor(t,e,s){if(this.parent=null,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.inherit=0,this.sorted=!1,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,n,r,a){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=r,this.ashearY=a;let o=this.parent;if(!o){let o=this.skeleton;const l=o.scaleX,h=o.scaleY,c=(s+r)*x.degRad,d=(s+90+a)*x.degRad;return this.a=Math.cos(c)*i*l,this.b=Math.cos(d)*n*l,this.c=Math.sin(c)*i*h,this.d=Math.sin(d)*n*h,this.worldX=t*l+o.x,void(this.worldY=e*h+o.y)}let l=o.a,h=o.b,c=o.c,d=o.d;switch(this.worldX=l*t+h*e+o.worldX,this.worldY=c*t+d*e+o.worldY,this.inherit){case 0:{const t=(s+r)*x.degRad,e=(s+90+a)*x.degRad,o=Math.cos(t)*i,u=Math.cos(e)*n,m=Math.sin(t)*i,f=Math.sin(e)*n;return this.a=l*o+h*m,this.b=l*u+h*f,this.c=c*o+d*m,void(this.d=c*u+d*f)}case 1:{const t=(s+r)*x.degRad,e=(s+90+a)*x.degRad;this.a=Math.cos(t)*i,this.b=Math.cos(e)*n,this.c=Math.sin(t)*i,this.d=Math.sin(e)*n;break}case 2:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;l*=t,c*=e;let o=l*l+c*c,u=0;o>1e-4?(o=Math.abs(l*d*e-h*t*c)/o,h=c*o,d=l*o,u=Math.atan2(c,l)*x.radDeg):(l=0,c=0,u=90-Math.atan2(d,h)*x.radDeg);const m=(s+r-u)*x.degRad,f=(s+a-u+90)*x.degRad,g=Math.cos(m)*i,p=Math.cos(f)*n,b=Math.sin(m)*i,w=Math.sin(f)*n;this.a=l*g-h*b,this.b=l*p-h*w,this.c=c*g+d*b,this.d=c*p+d*w;break}case 3:case 4:{s*=x.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(l*t+h*e)/this.skeleton.scaleX,u=(c*t+d*e)/this.skeleton.scaleY,m=Math.sqrt(o*o+u*u);m>1e-5&&(m=1/m),o*=m,u*=m,m=Math.sqrt(o*o+u*u),3==this.inherit&&l*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(u,o);const f=Math.cos(s)*m,g=Math.sin(s)*m;r*=x.degRad,a=(90+a)*x.degRad;const p=Math.cos(r)*i,b=Math.cos(a)*n,w=Math.sin(r)*i,y=Math.sin(a)*n;this.a=o*p+f*w,this.b=o*b+f*y,this.c=u*p+g*w,this.d=u*b+g*y;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*x.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*x.radDeg);let e,s,i,n,r=t.a,a=t.b,o=t.c,l=t.d,h=1/(r*l-a*o),c=l*h,d=a*h,u=o*h,m=r*h,f=this.worldX-t.worldX,g=this.worldY-t.worldY;if(this.ax=f*c-g*d,this.ay=g*m-f*u,1==this.inherit)e=this.a,s=this.b,i=this.c,n=this.d;else{switch(this.inherit){case 2:{let t=Math.abs(r*l-a*o)/(r*r+o*o);a=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,l=r*this.skeleton.scaleY*t/this.skeleton.scaleX,h=1/(r*l-a*o),c=l*h,d=a*h;break}case 3:case 4:let t=x.cosDeg(this.rotation),e=x.sinDeg(this.rotation);r=(r*t+a*e)/this.skeleton.scaleX,o=(o*t+l*e)/this.skeleton.scaleY;let s=Math.sqrt(r*r+o*o);s>1e-5&&(s=1/s),r*=s,o*=s,s=Math.sqrt(r*r+o*o),3==this.inherit&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let i=x.PI/2+Math.atan2(o,r);a=Math.cos(i)*s,l=Math.sin(i)*s,h=1/(r*l-a*o),c=l*h,d=a*h,u=o*h,m=r*h}e=c*this.a-d*this.c,s=c*this.b-d*this.d,i=m*this.c-u*this.a,n=m*this.d-u*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+i*i),this.ascaleX>1e-4){let t=e*n-s*i;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+i*n,t)*x.radDeg,this.arotation=Math.atan2(i,e)*x.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+n*n),this.ashearY=0,this.arotation=90-Math.atan2(n,s)*x.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*x.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*x.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=x.sinDeg(t),s=x.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*x.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=x.sinDeg(t),s=x.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*x.radDeg}rotateWorld(t){t*=x.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,n=this.b;this.a=s*i-e*this.c,this.b=s*n-e*this.d,this.c=e*i+s*this.c,this.d=e*n+s*this.d}},ue=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},me=class{constructor(){this.callbacks={},this.rawDataUris={}}dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),n=0;n<s;n++)i[n]=e.charCodeAt(n);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",t,!0);let n=()=>{this.finish(t,i.status,i.responseText)};i.onload=n,i.onerror=n,i.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer";let n=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{200==i.status||0==i.status?this.finish(t,200,new Uint8Array(i.response)):n()},i.onerror=n,i.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let n=200==e||0==e?[s]:[e,s];for(let t=n.length-1,e=i.length;t<e;t+=2)i[t].apply(null,n)}},fe=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},ge=class{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}},pe=class{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(t,e,s,i,n,r,a){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let l=o.a,h=o.b,c=o.c,d=o.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case 1:m=(e-t.worldX)*x.signum(t.skeleton.scaleX),f=(s-t.worldY)*x.signum(t.skeleton.scaleY);break;case 2:let i=Math.abs(l*d-h*c)/Math.max(1e-4,l*l+c*c),n=l/t.skeleton.scaleX,r=c/t.skeleton.scaleY;h=-r*i*t.skeleton.scaleX,d=n*i*t.skeleton.scaleY,u+=Math.atan2(r,n)*x.radDeg;default:let a=e-o.worldX,g=s-o.worldY,p=l*d-h*c;Math.abs(p)<=1e-4?(m=0,f=0):(m=(a*d-g*h)/p-t.ax,f=(g*l-a*c)/p-t.ay)}u+=Math.atan2(f,m)*x.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=t.ascaleX,p=t.ascaleY;if(i||n){switch(t.inherit){case 3:case 4:m=e-t.worldX,f=s-t.worldY}const o=t.data.length*g;if(o>1e-4){const t=m*m+f*f;if(i&&t<o*o||n&&t>o*o){const e=(Math.sqrt(t)/o-1)*a+1;g*=e,r&&(p*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*a,g,p,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,r,a,o,l){if(0!=t.inherit||0!=e.inherit)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,g=e.ascaleX,p=0,b=0,w=0;d<0?(d=-d,p=180,w=-1):(p=0,w=1),u<0&&(u=-u,w=-w),g<0?(g=-g,b=180):b=0;let y=e.ax,v=0,k=0,A=0,S=t.a,C=t.b,T=t.c,I=t.d,M=Math.abs(d-u)<=1e-4;!M||r?(v=0,k=S*y+t.worldX,A=T*y+t.worldY):(v=e.ay,k=S*y+C*v+t.worldX,A=T*y+I*v+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,C=F.b,T=F.c,I=F.d;let Y=S*I-C*T,E=k-F.worldX,P=A-F.worldY;Y=Math.abs(Y)<=1e-4?0:1/Y;let X,B,R=(E*I-P*C)*Y-h,D=(P*S-E*T)*Y-c,V=Math.sqrt(R*R+D*D),O=e.data.length*g;if(V<1e-4)return this.apply1(t,s,i,!1,r,!1,l),void e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);E=s-F.worldX,P=i-F.worldY;let L=(E*I-P*C)*Y-h,_=(P*S-E*T)*Y-c,N=L*L+_*_;if(0!=o){o*=d*(g+1)*.5;let t=Math.sqrt(N),e=t-V-O*d+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,L-=s*L,_-=s*_,N=L*L+_*_}}t:if(M){O*=d;let t=(N-V*V-O*O)/(2*V*O);t<-1?(t=-1,B=Math.PI*n):t>1?(t=1,B=0,r&&(S=(Math.sqrt(N)/(V+O)-1)*l+1,m*=S,a&&(f*=S))):B=Math.acos(t)*n,S=V+O*t,C=O*Math.sin(B),X=Math.atan2(_*S-L*C,L*S+_*C)}else{S=d*O,C=u*O;let t=S*S,e=C*C,s=Math.atan2(_,L);T=e*V*V+t*N-t*e;let i=-2*e*V,r=e-t;if(I=i*i-4*r*T,I>=0){let t=Math.sqrt(I);i<0&&(t=-t),t=.5*-(i+t);let e=t/r,a=T/t,o=Math.abs(e)<Math.abs(a)?e:a;if(e=N-o*o,e>=0){P=Math.sqrt(e)*n,X=s-Math.atan2(P,o),B=Math.atan2(P/u,(o-V)/d);break t}}let a=x.PI,o=V-S,l=o*o,h=0,c=0,m=V+S,f=m*m,g=0;T=-S*V/(t-e),T>=-1&&T<=1&&(T=Math.acos(T),E=S*Math.cos(T)+V,P=C*Math.sin(T),I=E*E+P*P,I<l&&(a=T,l=I,o=E,h=P),I>f&&(c=T,f=I,m=E,g=P)),N<=.5*(l+f)?(X=s-Math.atan2(h*n,o),B=a*n):(X=s-Math.atan2(g*n,m),B=c*n)}let U=Math.atan2(v,y)*w,q=t.arotation;X=(X-U)*x.radDeg+p-q,X>180?X-=360:X<-180&&(X+=360),t.updateWorldTransformWith(h,c,q+X*l,m,f,0,0),q=e.arotation,B=((B+U)*x.radDeg-e.ashearX)*w+b-q,B>180?B-=360:B<-180&&(B+=360),e.updateWorldTransformWith(y,v,q+B*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},xe=class extends ue{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=0,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=0,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},be=class extends ue{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=we.Fixed,this.spacingMode=ye.Fixed,this.rotateMode=ve.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}},we=((re=we||{})[re.Fixed=0]="Fixed",re[re.Percent=1]="Percent",re),ye=((ae=ye||{})[ae.Length=0]="Length",ae[ae.Fixed=1]="Fixed",ae[ae.Percent=2]="Percent",ae[ae.Proportional=3]="Proportional",ae),ve=((oe=ve||{})[oe.Tangent=0]="Tangent",oe[oe.Chain=1]="Chain",oe[oe.ChainScale=2]="ChainScale",oe),ke=class{constructor(t,e){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,i=t.bones.length;s<i;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof te))return;let s=this.mixRotate,i=this.mixX,n=this.mixY;if(0==s&&0==i&&0==n)return;let r=this.data,a=0==r.rotateMode,o=2==r.rotateMode,l=this.bones,h=l.length,c=a?h:h+1,d=v.setArraySize(this.spaces,c),u=o?this.lengths=v.setArraySize(this.lengths,h):[],m=this.spacing;switch(r.spacingMode){case 2:if(o)for(let t=0,e=c-1;t<e;t++){let e=l[t],s=e.data.length,i=s*e.a,n=s*e.c;u[t]=Math.sqrt(i*i+n*n)}v.arrayFill(d,1,c,m);break;case 3:let t=0;for(let e=0,s=c-1;e<s;){let s=l[e],i=s.data.length;if(i<ke.epsilon)o&&(u[e]=0),d[++e]=m;else{let n=i*s.a,r=i*s.c,a=Math.sqrt(n*n+r*r);o&&(u[e]=a),d[++e]=a,t+=a}}if(t>0){t=c/t*m;for(let e=1;e<c;e++)d[e]*=t}break;default:let e=0==r.spacingMode;for(let t=0,s=c-1;t<s;){let s=l[t],i=s.data.length;if(i<ke.epsilon)o&&(u[t]=0),d[++t]=m;else{let n=i*s.a,r=i*s.c,a=Math.sqrt(n*n+r*r);o&&(u[t]=a),d[++t]=(e?i+m:m)*a/i}}}let f=this.computeWorldPositions(e,c,a),g=f[0],p=f[1],b=r.offsetRotation,w=!1;if(0==b)w=1==r.rotateMode;else{w=!1;let t=this.target.bone;b*=t.a*t.d-t.b*t.c>0?x.degRad:-x.degRad}for(let t=0,e=3;t<h;t++,e+=3){let r=l[t];r.worldX+=(g-r.worldX)*i,r.worldY+=(p-r.worldY)*n;let h=f[e],c=f[e+1],m=h-g,y=c-p;if(o){let e=u[t];if(0!=e){let t=(Math.sqrt(m*m+y*y)/e-1)*s+1;r.a*=t,r.c*=t}}if(g=h,p=c,s>0){let i=r.a,n=r.b,o=r.c,l=r.d,h=0,c=0,u=0;if(h=a?f[e-1]:0==d[t+1]?f[e+2]:Math.atan2(y,m),h-=Math.atan2(o,i),w){c=Math.cos(h),u=Math.sin(h);let t=r.data.length;g+=(t*(c*i-u*o)-m)*s,p+=(t*(u*i+c*o)-y)*s}else h+=b;h>x.PI?h-=x.PI2:h<-x.PI&&(h+=x.PI2),h*=s,c=Math.cos(h),u=Math.sin(h),r.a=c*i-u*o,r.b=c*n-u*l,r.c=u*i+c*o,r.d=u*n+c*l}r.updateAppliedTransform()}}computeWorldPositions(t,e,s){let i=this.target,n=this.position,r=this.spaces,a=v.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=ke.NONE;if(!t.constantSpeed){let u=t.lengths;c-=l?1:2;let m,f=u[c];switch(1==this.data.positionMode&&(n*=f),this.data.spacingMode){case 2:m=f;break;case 3:m=f/e;break;default:m=1}o=v.setArraySize(this.world,8);for(let g=0,p=0,x=0;g<e;g++,p+=3){let e=r[g]*m;n+=e;let b=n;if(l)b%=f,b<0&&(b+=f),x=0;else{if(b<0){d!=ke.BEFORE&&(d=ke.BEFORE,t.computeWorldVertices(i,2,4,o,0,2)),this.addBeforePosition(b,o,0,a,p);continue}if(b>f){d!=ke.AFTER&&(d=ke.AFTER,t.computeWorldVertices(i,h-6,4,o,0,2)),this.addAfterPosition(b-f,o,0,a,p);continue}}for(;;x++){let t=u[x];if(!(b>t)){if(0==x)b/=t;else{let e=u[x-1];b=(b-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(i,h-4,4,o,0,2),t.computeWorldVertices(i,0,4,o,4,2)):t.computeWorldVertices(i,6*x+2,8,o,0,2)),this.addCurvePosition(b,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],a,p,s||g>0&&0==e)}return a}l?(h+=2,o=v.setArraySize(this.world,h),t.computeWorldVertices(i,2,h-4,o,0,2),t.computeWorldVertices(i,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=v.setArraySize(this.world,h),t.computeWorldVertices(i,2,h,o,0,2));let u,m=v.setArraySize(this.curves,c),f=0,g=o[0],p=o[1],x=0,b=0,w=0,y=0,k=0,A=0,S=0,C=0,T=0,I=0,M=0,F=0,Y=0,E=0;for(let t=0,e=2;t<c;t++,e+=6)x=o[e],b=o[e+1],w=o[e+2],y=o[e+3],k=o[e+4],A=o[e+5],S=.1875*(g-2*x+w),C=.1875*(p-2*b+y),T=.09375*(3*(x-w)-g+k),I=.09375*(3*(b-y)-p+A),M=2*S+T,F=2*C+I,Y=.75*(x-g)+S+.16666667*T,E=.75*(b-p)+C+.16666667*I,f+=Math.sqrt(Y*Y+E*E),Y+=M,E+=F,M+=T,F+=I,f+=Math.sqrt(Y*Y+E*E),Y+=M,E+=F,f+=Math.sqrt(Y*Y+E*E),Y+=M+T,E+=F+I,f+=Math.sqrt(Y*Y+E*E),m[t]=f,g=k,p=A;switch(1==this.data.positionMode&&(n*=f),this.data.spacingMode){case 2:u=f;break;case 3:u=f/e;break;default:u=1}let P=this.segments,X=0;for(let t=0,i=0,c=0,v=0;t<e;t++,i+=3){let e=r[t]*u;n+=e;let B=n;if(l)B%=f,B<0&&(B+=f),c=0;else{if(B<0){this.addBeforePosition(B,o,0,a,i);continue}if(B>f){this.addAfterPosition(B-f,o,h-4,a,i);continue}}for(;;c++){let t=m[c];if(!(B>t)){if(0==c)B/=t;else{let e=m[c-1];B=(B-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(g=o[t],p=o[t+1],x=o[t+2],b=o[t+3],w=o[t+4],y=o[t+5],k=o[t+6],A=o[t+7],S=.03*(g-2*x+w),C=.03*(p-2*b+y),T=.006*(3*(x-w)-g+k),I=.006*(3*(b-y)-p+A),M=2*S+T,F=2*C+I,Y=.3*(x-g)+S+.16666667*T,E=.3*(b-p)+C+.16666667*I,X=Math.sqrt(Y*Y+E*E),P[0]=X,t=1;t<8;t++)Y+=M,E+=F,M+=T,F+=I,X+=Math.sqrt(Y*Y+E*E),P[t]=X;Y+=M,E+=F,X+=Math.sqrt(Y*Y+E*E),P[8]=X,Y+=M+T,E+=F+I,X+=Math.sqrt(Y*Y+E*E),P[9]=X,v=0}for(B*=X;;v++){let t=P[v];if(!(B>t)){if(0==v)B/=t;else{let e=P[v-1];B=v+(B-e)/(t-e)}break}}this.addCurvePosition(.1*B,g,p,x,b,w,y,k,A,a,i,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,i,n){let r=e[s],a=e[s+1],o=e[s+2]-r,l=e[s+3]-a,h=Math.atan2(l,o);i[n]=r+t*Math.cos(h),i[n+1]=a+t*Math.sin(h),i[n+2]=h}addAfterPosition(t,e,s,i,n){let r=e[s+2],a=e[s+3],o=r-e[s],l=a-e[s+1],h=Math.atan2(l,o);i[n]=r+t*Math.cos(h),i[n+1]=a+t*Math.sin(h),i[n+2]=h}addCurvePosition(t,e,s,i,n,r,a,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(n-s,i-e));let u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,b=3*x,w=f*b,y=b*t,v=e*p+i*w+r*y+o*m,k=s*p+n*w+a*y+l*m;h[c]=v,h[c+1]=k,d&&(h[c+2]=t<.001?Math.atan2(n-s,i-e):Math.atan2(k-(s*g+n*x*2+a*u),v-(e*g+i*x*2+r*u)))}},Ae=ke;Ae.NONE=-1,Ae.BEFORE=-2,Ae.AFTER=-3,Ae.epsilon=1e-5;var Se=class{constructor(t,e){this._bone=null,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this._reset=!0,this.ux=0,this.uy=0,this.cx=0,this.cy=0,this.tx=0,this.ty=0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0,this.active=!1,this.remaining=0,this.lastTime=0,this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,i=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,r=this.data.scaleX>0,a=this.bone,o=a.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const t=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=t.time;const h=a.worldX,c=a.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=c;else{let d=this.remaining,u=this.inertia,m=this.data.step,f=this.skeleton.data.referenceScale,g=-1,p=this.data.limit*l,b=p*Math.abs(t.scaleY);if(p*=Math.abs(t.scaleX),s||i){if(s){const t=(this.ux-h)*u;this.xOffset+=t>p?p:t<-p?-p:t,this.ux=h}if(i){const t=(this.uy-c)*u;this.yOffset+=t>b?b:t<-b?-b:t,this.uy=c}if(d>=m){g=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,n=this.wind*f,r=(Me.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(n-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=g),i&&(this.yVelocity-=(r+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=g),d-=m}while(d>=m)}s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n||r){let t=Math.atan2(a.c,a.a),s=0,i=0,l=0,h=this.cx-a.worldX,c=this.cy-a.worldY;if(h>p?h=p:h<-p&&(h=-p),c>b?c=b:c<-b&&(c=-b),n){l=(this.data.rotate+this.data.shearX)*e;let n=Math.atan2(c+this.ty,h+this.tx)-t-this.rotateOffset*l;this.rotateOffset+=(n-Math.ceil(n*x.invPI2-.5)*x.PI2)*u,n=this.rotateOffset*l+t,s=Math.cos(n),i=Math.sin(n),r&&(n=o*a.getWorldScaleX(),n>0&&(this.scaleOffset+=(h*s+c*i)*u/n))}else{s=Math.cos(t),i=Math.sin(t);const e=o*a.getWorldScaleX();e>0&&(this.scaleOffset+=(h*s+c*i)*u/e)}if(d=this.remaining,d>=m){-1==g&&(g=Math.pow(this.damping,60*m));const e=this.massInverse*m,a=this.strength,h=this.wind,c=Me.yDown?-this.gravity:this.gravity,u=o/f;for(;;)if(d-=m,r&&(this.scaleVelocity+=(h*s-c*i-this.scaleOffset*a)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=g),n){if(this.rotateVelocity-=((h*i+c*s)*u+this.rotateOffset*a)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=g,d<m)break;const n=this.rotateOffset*l+t;s=Math.cos(n),i=Math.sin(n)}else if(d<m)break}}this.remaining=d}this.cx=a.worldX,this.cy=a.worldY;break;case 3:s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n){let t=this.rotateOffset*e,s=0,i=0,n=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),i=Math.cos(e),n=a.b,a.b=i*n-s*a.d,a.d=s*n+i*a.d),e+=t*this.data.shearX,s=Math.sin(e),i=Math.cos(e),n=a.a,a.a=i*n-s*a.c,a.c=s*n+i*a.c}else t*=this.data.rotate,s=Math.sin(t),i=Math.cos(t),n=a.a,a.a=i*n-s*a.c,a.c=s*n+i*a.c,n=a.b,a.b=i*n-s*a.d,a.d=s*n+i*a.d}if(r){const t=1+this.scaleOffset*e*this.data.scaleX;a.a*=t,a.c*=t}3!=t&&(this.tx=o*a.a,this.ty=o*a.c),a.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*x.degRad,n=Math.cos(i),r=Math.sin(i),a=this.cx-t,o=this.cy-e;this.translate(a*n-o*r-a,a*r+o*n-o)}},Ce=class{constructor(t,e){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new g,this.darkColor=t.darkColor?new g:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof T&&this.attachment instanceof T&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Te=class{constructor(t,e){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new A,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?x.degRad:-x.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let u=0,p=g.length;u<p;u++){let p=g[u];if(0!=t){let e=p.a,s=p.b,i=p.c,n=p.d,r=Math.atan2(c,l)-Math.atan2(i,e)+m;r>x.PI?r-=x.PI2:r<-x.PI&&(r+=x.PI2),r*=t;let a=Math.cos(r),o=Math.sin(r);p.a=a*e-o*i,p.b=a*s-o*n,p.c=o*e+a*i,p.d=o*s+a*n}if(a){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(t.x-p.worldX)*e,p.worldY+=(t.y-p.worldY)*s}if(0!=i){let t=Math.sqrt(p.a*p.a+p.c*p.c);0!=t&&(t=(t+(Math.sqrt(l*l+c*c)-t+this.data.offsetScaleX)*i)/t),p.a*=t,p.c*=t}if(0!=n){let t=Math.sqrt(p.b*p.b+p.d*p.d);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleY)*n)/t),p.b*=t,p.d*=t}if(r>0){let t=p.b,e=p.d,s=Math.atan2(e,t),i=Math.atan2(d,h)-Math.atan2(c,l)-(s-Math.atan2(p.c,p.a));i>x.PI?i-=x.PI2:i<-x.PI&&(i+=x.PI2),i=s+(i+f)*r;let n=Math.sqrt(t*t+e*e);p.b=Math.cos(i)*n,p.d=Math.sin(i)*n}p.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?x.degRad:-x.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let u=0,p=g.length;u<p;u++){let p=g[u];if(0!=t){let e=p.a,s=p.b,i=p.c,n=p.d,r=Math.atan2(c,l)+m;r>x.PI?r-=x.PI2:r<-x.PI&&(r+=x.PI2),r*=t;let a=Math.cos(r),o=Math.sin(r);p.a=a*e-o*i,p.b=a*s-o*n,p.c=o*e+a*i,p.d=o*s+a*n}if(a){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),p.worldX+=t.x*e,p.worldY+=t.y*s}if(0!=i){let t=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*i+1;p.a*=t,p.c*=t}if(0!=n){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*n+1;p.b*=t,p.d*=t}if(r>0){let t=Math.atan2(d,h)-Math.atan2(c,l);t>x.PI?t-=x.PI2:t<-x.PI&&(t+=x.PI2);let e=p.b,s=p.d;t=Math.atan2(s,e)+(t-x.PI/2+f)*r;let i=Math.sqrt(e*e+s*s);p.b=Math.cos(t)*i,p.d=Math.sin(t)*i}p.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation;0!=t&&(c+=(a.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(a.ax-d+this.data.offsetX)*e,u+=(a.ay-u+this.data.offsetY)*s;let m=h.ascaleX,f=h.ascaleY;0!=i&&0!=m&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*i)/m),0!=n&&0!=f&&(f=(f+(a.ascaleY-f+this.data.offsetScaleY)*n)/f);let g=h.ashearY;0!=r&&(g+=(a.ashearY-g+this.data.offsetShearY)*r),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(a.arotation+this.data.offsetRotation)*t,d=h.ax+(a.ax+this.data.offsetX)*e,u=h.ay+(a.ay+this.data.offsetY)*s,m=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*i+1),f=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),g=h.ashearY+(a.ashearY+this.data.offsetShearY)*r;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}},Ie=class{constructor(t){if(this._updateCache=new Array,this.skin=null,this.scaleX=1,this._scaleY=1,this.x=0,this.y=0,this.time=0,!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,i=t.bones[e];if(i.parent){let t=this.bones[i.parent.index];s=new de(i,this,t),t.children.push(s)}else s=new de(i,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],i=this.bones[s.boneData.index],n=new Ce(s,i);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new pe(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Te(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new Ae(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new Se(s,this))}this.color=new g(1,1,1,1),this.updateCache()}get scaleY(){return Ie.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,i=this.pathConstraints,n=this.physicsConstraints,r=e.length,a=s.length,o=i.length,l=this.physicsConstraints.length,h=r+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<r;s++){let i=e[s];if(i.data.order==t){this.sortIkConstraint(i);continue t}}for(let e=0;e<a;e++){let i=s[e];if(i.data.order==t){this.sortTransformConstraint(i);continue t}}for(let e=0;e<o;e++){let s=i[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=n[e];if(s.data.order==t){this.sortPhysicsConstraint(s);continue t}}}for(let e=0,s=t.length;e<s;e++)this.sortBone(t[e])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&v.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,i=s[0];if(this.sortBone(i),1==s.length)this._updateCache.push(t),this.sortReset(i.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(i.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&v.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,i=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,i);let n=e.getAttachment();n instanceof te&&this.sortPathConstraintAttachmentWith(n,i);let r=t.bones,a=r.length;for(let t=0;t<a;t++)this.sortBone(r[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(r[t].children);for(let t=0;t<a;t++)r[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&v.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let i=t.attachments[e];if(i)for(let t in i)this.sortPathConstraintAttachmentWith(i[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof te))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,i=s.length;e<i;){let i=s[e++];for(i+=e;e<i;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&v.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,i=s.length;e<i;e++)s[e].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let s=this.bones;for(let t=1,e=s.length;t<e;t++){let e=s[t];e.ax=e.x,e.ay=e.y,e.arotation=e.rotation,e.ascaleX=e.scaleX,e.ascaleY=e.scaleY,e.ashearX=e.shearX,e.ashearY=e.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let n=e.a,r=e.b,a=e.c,o=e.d;i.worldX=n*this.x+r*this.y+e.worldX,i.worldY=a*this.x+o*this.y+e.worldY;const l=(i.rotation+i.shearX)*x.degRad,h=(i.rotation+90+i.shearY)*x.degRad,c=Math.cos(l)*i.scaleX,d=Math.cos(h)*i.scaleY,u=Math.sin(l)*i.scaleX,m=Math.sin(h)*i.scaleY;i.a=(n*c+r*u)*this.scaleX,i.b=(n*d+r*m)*this.scaleX,i.c=(a*c+o*u)*this.scaleY,i.d=(a*d+o*m)*this.scaleY;let f=this._updateCache;for(let e=0,s=f.length;e<s;e++){let s=f[e];s!=i&&s.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;v.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s],n=i.data.attachmentName;if(n){let e=t.getAttachment(s,n);e&&i.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,n=s.length;i<n;i++){let n=s[i];if(n.data.name==t){let s=null;if(e&&(s=this.getAttachment(i,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void n.setAttachment(s)}}throw new Error("Slot not found: "+t)}findIkConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return null!=(e=this.ikConstraints.find((e=>e.data.name==t)))?e:null}findTransformConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return null!=(e=this.transformConstraints.find((e=>e.data.name==t)))?e:null}findPathConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return null!=(e=this.pathConstraints.find((e=>e.data.name==t)))?e:null}findPhysicsConstraint(t){var e;if(null==t)throw new Error("constraintName cannot be null.");return null!=(e=this.physicsConstraints.find((e=>e.data.name==t)))?e:null}getBoundsRect(){let t=new A,e=new A;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,r=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=n.length;t<e;t++){let e=n[t];if(!e.bone.active)continue;let h=0,c=null,d=null,u=e.getAttachment();if(u instanceof ie)h=8,c=v.setArraySize(s,h,0),u.computeWorldVertices(e,c,0,2),d=Ie.quadTriangles;else if(u instanceof Zt){let t=u;h=t.worldVerticesLength,c=v.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(u instanceof Wt&&null!=i){i.clipStart(e,u);continue}if(c&&d){null!=i&&i.isClipping()&&(i.clipTriangles(c,d,d.length),c=i.clippedVertices,h=i.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];r=Math.min(r,e),a=Math.min(a,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=i&&i.clipEndWithSlot(e)}null!=i&&i.clipEnd(),t.set(r,a),e.set(o-r,l-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let i=0,n=s.length;i<n;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physicsConstraints;for(let n=0,r=i.length;n<r;n++)i[n].rotate(t,e,s)}},Me=Ie;Me.quadTriangles=[0,1,2,2,3,0],Me.yDown=!1;var Fe,Ye,Ee,Pe=((Fe=Pe||{})[Fe.none=0]="none",Fe[Fe.reset=1]="reset",Fe[Fe.update=2]="update",Fe[Fe.pose=3]="pose",Fe),Xe=class extends ue{constructor(t){super(t,0,!1),this._bone=null,this.x=0,this.y=0,this.rotate=0,this.scaleX=0,this.shearX=0,this.limit=0,this.step=0,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this.inertiaGlobal=!1,this.strengthGlobal=!1,this.dampingGlobal=!1,this.massGlobal=!1,this.windGlobal=!1,this.gravityGlobal=!1,this.mixGlobal=!1}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}},Be=class{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.physicsConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.referenceScale=100,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}},Re=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},De=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,this.color=new g(.99607843,.61960787,.30980393,1),!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof Zt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let n=s[i];n&&t.push(new Re(e,i,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let n=s[i];n&&e.push(new Re(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let n=t.slots[i],r=n.getAttachment();if(r&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(r==t[e]){let t=this.getAttachment(s,e);t&&n.setAttachment(t);break}}}s++}}},Ve=class{constructor(t,e,s){if(this.index=0,this.color=new g(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=Oe.Normal,this.visible=!0,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},Oe=((Ye=Oe||{})[Ye.Normal=0]="Normal",Ye[Ye.Additive=1]="Additive",Ye[Ye.Multiply=2]="Multiply",Ye[Ye.Screen=3]="Screen",Ye),Le=class extends ue{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},_e=class{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){var e;let s=this.scale,i=new Be;i.name="";let n=new Ne(t),r=n.readInt32(),a=n.readInt32();i.hash=0==a&&0==r?null:a.toString(16)+r.toString(16),i.version=n.readString(),i.x=n.readFloat(),i.y=n.readFloat(),i.width=n.readFloat(),i.height=n.readFloat(),i.referenceScale=n.readFloat()*s;let o=n.readBoolean();o&&(i.fps=n.readFloat(),i.imagesPath=n.readString(),i.audioPath=n.readString());let l=0;l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("String in string table must not be null.");n.strings.push(t)}l=n.readInt(!0);for(let t=0;t<l;t++){let r=n.readString();if(!r)throw new Error("Bone name must not be null.");let a=0==t?null:i.bones[n.readInt(!0)],l=new he(t,r,a);l.rotation=n.readFloat(),l.x=n.readFloat()*s,l.y=n.readFloat()*s,l.scaleX=n.readFloat(),l.scaleY=n.readFloat(),l.shearX=n.readFloat(),l.shearY=n.readFloat(),l.length=n.readFloat()*s,l.inherit=n.readByte(),l.skinRequired=n.readBoolean(),o&&(g.rgba8888ToColor(l.color,n.readInt32()),l.icon=null!=(e=n.readString())?e:void 0,l.visible=n.readBoolean()),i.bones.push(l)}l=n.readInt(!0);for(let t=0;t<l;t++){let e=n.readString();if(!e)throw new Error("Slot name must not be null.");let s=i.bones[n.readInt(!0)],r=new Ve(t,e,s);g.rgba8888ToColor(r.color,n.readInt32());let a=n.readInt32();-1!=a&&g.rgb888ToColor(r.darkColor=new g,a),r.attachmentName=n.readStringRef(),r.blendMode=n.readInt(!0),o&&(r.visible=n.readBoolean()),i.slots.push(r)}l=n.readInt(!0);for(let t,e=0;e<l;e++){let e=n.readString();if(!e)throw new Error("IK constraint data name must not be null.");let r=new xe(e);r.order=n.readInt(!0),t=n.readInt(!0);for(let e=0;e<t;e++)r.bones.push(i.bones[n.readInt(!0)]);r.target=i.bones[n.readInt(!0)];let a=n.readByte();r.skinRequired=!!(1&a),r.bendDirection=2&a?1:-1,r.compress=!!(4&a),r.stretch=!!(8&a),r.uniform=!!(16&a),32&a&&(r.mix=64&a?n.readFloat():1),128&a&&(r.softness=n.readFloat()*s),i.ikConstraints.push(r)}l=n.readInt(!0);for(let t,e=0;e<l;e++){let e=n.readString();if(!e)throw new Error("Transform constraint data name must not be null.");let r=new Le(e);r.order=n.readInt(!0),t=n.readInt(!0);for(let e=0;e<t;e++)r.bones.push(i.bones[n.readInt(!0)]);r.target=i.bones[n.readInt(!0)];let a=n.readByte();r.skinRequired=!!(1&a),r.local=!!(2&a),r.relative=!!(4&a),8&a&&(r.offsetRotation=n.readFloat()),16&a&&(r.offsetX=n.readFloat()*s),32&a&&(r.offsetY=n.readFloat()*s),64&a&&(r.offsetScaleX=n.readFloat()),128&a&&(r.offsetScaleY=n.readFloat()),a=n.readByte(),1&a&&(r.offsetShearY=n.readFloat()),2&a&&(r.mixRotate=n.readFloat()),4&a&&(r.mixX=n.readFloat()),8&a&&(r.mixY=n.readFloat()),16&a&&(r.mixScaleX=n.readFloat()),32&a&&(r.mixScaleY=n.readFloat()),64&a&&(r.mixShearY=n.readFloat()),i.transformConstraints.push(r)}l=n.readInt(!0);for(let t,e=0;e<l;e++){let e=n.readString();if(!e)throw new Error("Path constraint data name must not be null.");let r=new be(e);r.order=n.readInt(!0),r.skinRequired=n.readBoolean(),t=n.readInt(!0);for(let e=0;e<t;e++)r.bones.push(i.bones[n.readInt(!0)]);r.target=i.slots[n.readInt(!0)];const a=n.readByte();r.positionMode=1&a,r.spacingMode=a>>1&3,r.rotateMode=a>>3&3,128&a&&(r.offsetRotation=n.readFloat()),r.position=n.readFloat(),0==r.positionMode&&(r.position*=s),r.spacing=n.readFloat(),0!=r.spacingMode&&1!=r.spacingMode||(r.spacing*=s),r.mixRotate=n.readFloat(),r.mixX=n.readFloat(),r.mixY=n.readFloat(),i.pathConstraints.push(r)}l=n.readInt(!0);for(let t=0;t<l;t++){const t=n.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const e=new Xe(t);e.order=n.readInt(!0),e.bone=i.bones[n.readInt(!0)];let r=n.readByte();e.skinRequired=!!(1&r),2&r&&(e.x=n.readFloat()),4&r&&(e.y=n.readFloat()),8&r&&(e.rotate=n.readFloat()),16&r&&(e.scaleX=n.readFloat()),32&r&&(e.shearX=n.readFloat()),e.limit=(64&r?n.readFloat():5e3)*s,e.step=1/n.readUnsignedByte(),e.inertia=n.readFloat(),e.strength=n.readFloat(),e.damping=n.readFloat(),e.massInverse=128&r?n.readFloat():1,e.wind=n.readFloat(),e.gravity=n.readFloat(),r=n.readByte(),1&r&&(e.inertiaGlobal=!0),2&r&&(e.strengthGlobal=!0),4&r&&(e.dampingGlobal=!0),8&r&&(e.massGlobal=!0),16&r&&(e.windGlobal=!0),32&r&&(e.gravityGlobal=!0),64&r&&(e.mixGlobal=!0),e.mix=128&r?n.readFloat():1,i.physicsConstraints.push(e)}let h=this.readSkin(n,i,!0,o);h&&(i.defaultSkin=h,i.skins.push(h));{let t=i.skins.length;for(v.setArraySize(i.skins,l=t+n.readInt(!0));t<l;t++){let e=this.readSkin(n,i,!1,o);if(!e)throw new Error("readSkin() should not have returned null.");i.skins[t]=e}}l=this.linkedMeshes.length;for(let t=0;t<l;t++){let e=this.linkedMeshes[t];const s=i.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let n=s.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("Event data name must not be null");let e=new ge(t);e.intValue=n.readInt(!1),e.floatValue=n.readFloat(),e.stringValue=n.readString(),e.audioPath=n.readString(),e.audioPath&&(e.volume=n.readFloat(),e.balance=n.readFloat()),i.events.push(e)}l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(n,t,i))}return i}readSkin(t,e,s,i){let n=null,r=0;if(s){if(r=t.readInt(!0),0==r)return null;n=new De("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new De(s),i&&g.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,i=n.bones.length;s<i;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);r=t.readInt(!0)}for(let s=0;s<r;s++){let s=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let r=t.readStringRef();if(!r)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,n,s,r,i);a&&n.setAttachment(s,r,a)}}return n}readAttachment(t,e,s,i,n,r){let a=this.scale,o=t.readByte();const l=8&o?t.readStringRef():n;if(!l)throw new Error("Attachment name must not be null");switch(7&o){case We.Region:{let e=16&o?t.readStringRef():null;const i=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null;let r=128&o?t.readFloat():0,h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=l);let p=this.attachmentLoader.newRegionAttachment(s,l,e,n);return p?(p.path=e,p.x=h*a,p.y=c*a,p.scaleX=d,p.scaleY=u,p.rotation=r,p.width=m*a,p.height=f*a,g.rgba8888ToColor(p.color,i),p.sequence=n,null==n&&p.updateRegion(),p):null}case We.BoundingBox:{let e=this.readVertices(t,!!(16&o)),i=r?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,l);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,r&&g.rgba8888ToColor(n.color,i),n):null}case We.Mesh:{let e=16&o?t.readStringRef():l;const i=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null,h=t.readInt(!0),c=this.readVertices(t,!!(128&o)),d=this.readFloatArray(t,c.length,1),u=this.readShortArray(t,3*(c.length-h-2));let m=[],f=0,p=0;r&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),p=t.readFloat()),e||(e=l);let x=this.attachmentLoader.newMeshAttachment(s,l,e,n);return x?(x.path=e,g.rgba8888ToColor(x.color,i),x.bones=c.bones,x.vertices=c.vertices,x.worldVerticesLength=c.length,x.triangles=u,x.regionUVs=d,null==n&&x.updateRegion(),x.hullLength=h<<1,x.sequence=n,r&&(x.edges=m,x.width=f*a,x.height=p*a),x):null}case We.LinkedMesh:{const e=16&o?t.readStringRef():l;if(null==e)throw new Error("Path of linked mesh must not be null");const n=32&o?t.readInt32():4294967295,h=64&o?this.readSequence(t):null,c=!!(128&o),d=t.readInt(!0),u=t.readStringRef();let m=0,f=0;r&&(m=t.readFloat(),f=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,l,e,h);return p?(p.path=e,g.rgba8888ToColor(p.color,n),p.sequence=h,r&&(p.width=m*a,p.height=f*a),this.linkedMeshes.push(new Ue(p,d,i,u,c)),p):null}case We.Path:{const e=!!(16&o),i=!!(32&o),n=this.readVertices(t,!!(64&o)),h=v.newArray(n.length/6,0);for(let e=0,s=h.length;e<s;e++)h[e]=t.readFloat()*a;const c=r?t.readInt32():0,d=this.attachmentLoader.newPathAttachment(s,l);return d?(d.closed=e,d.constantSpeed=i,d.worldVerticesLength=n.length,d.vertices=n.vertices,d.bones=n.bones,d.lengths=h,r&&g.rgba8888ToColor(d.color,c),d):null}case We.Point:{const e=t.readFloat(),i=t.readFloat(),n=t.readFloat(),o=r?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,l);return h?(h.x=i*a,h.y=n*a,h.rotation=e,r&&g.rgba8888ToColor(h.color,o),h):null}case We.Clipping:{const i=t.readInt(!0),n=this.readVertices(t,!!(16&o));let a=r?t.readInt32():0,h=this.attachmentLoader.newClippingAttachment(s,l);return h?(h.endSlot=e.slots[i],h.worldVerticesLength=n.length,h.vertices=n.vertices,h.bones=n.bones,r&&g.rgba8888ToColor(h.color,a),h):null}}return null}readSequence(t){let e=new M(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),n=new qe;if(n.length=i<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let r=new Array,a=new Array;for(let e=0;e<i;e++){let e=t.readInt(!0);a.push(e);for(let i=0;i<e;i++)a.push(t.readInt(!0)),r.push(t.readFloat()*s),r.push(t.readFloat()*s),r.push(t.readFloat())}return n.vertices=v.toFloatArray(r),n.bones=a,n}readFloatArray(t,e,s){let i=new Array(e);if(1==s)for(let s=0;s<e;s++)i[s]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,n=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readByte(),n=t.readInt(!0),r=n-1;switch(s){case as:{let s=new nt(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readStringRef());i.push(s);break}case os:{let s=t.readInt(!0),a=new Z(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case Cs:a.setStepped(e);break;case Ts:je(t,a,s++,e,0,o,i,l,n,1),je(t,a,s++,e,1,o,i,h,r,1),je(t,a,s++,e,2,o,i,c,u,1),je(t,a,s++,e,3,o,i,d,m,1)}o=i,l=n,h=r,c=u,d=m}i.push(a);break}case ls:{let s=t.readInt(!0),a=new tt(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Cs:a.setStepped(e);break;case Ts:je(t,a,s++,e,0,o,i,l,n,1),je(t,a,s++,e,1,o,i,h,r,1),je(t,a,s++,e,2,o,i,c,d,1)}o=i,l=n,h=r,c=d}i.push(a);break}case hs:{let s=t.readInt(!0),a=new st(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,m,f),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;switch(t.readByte()){case Cs:a.setStepped(e);break;case Ts:je(t,a,s++,e,0,o,i,l,n,1),je(t,a,s++,e,1,o,i,h,r,1),je(t,a,s++,e,2,o,i,c,g,1),je(t,a,s++,e,3,o,i,d,p,1),je(t,a,s++,e,4,o,i,u,x,1),je(t,a,s++,e,5,o,i,m,b,1),je(t,a,s++,e,6,o,i,f,w,1)}o=i,l=n,h=r,c=g,d=p,u=x,m=b,f=w}i.push(a);break}case cs:{let s=t.readInt(!0),a=new it(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,m),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Cs:a.setStepped(e);break;case Ts:je(t,a,s++,e,0,o,i,l,n,1),je(t,a,s++,e,1,o,i,h,r,1),je(t,a,s++,e,2,o,i,c,f,1),je(t,a,s++,e,3,o,i,d,g,1),je(t,a,s++,e,4,o,i,u,p,1),je(t,a,s++,e,5,o,i,m,x,1)}o=i,l=n,h=r,c=f,d=g,u=p,m=x}i.push(a);break}case ds:{let s=new et(n,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,i=0;s.setFrame(e,a,o),e!=r;e++){let n=t.readFloat(),r=t.readUnsignedByte()/255;switch(t.readByte()){case Cs:s.setStepped(e);break;case Ts:je(t,s,i++,e,0,a,n,o,r,1)}a=n,o=r}i.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readByte(),r=t.readInt(!0);if(s==rs){let s=new Q(r,e);for(let e=0;e<r;e++)s.setFrame(e,t.readFloat(),t.readByte());i.push(s);continue}let a=t.readInt(!0);switch(s){case He:i.push(ze(t,new U(r,a,e),1));break;case Je:i.push(Ge(t,new q(r,a,e),n));break;case Ke:i.push(ze(t,new W(r,a,e),n));break;case Qe:i.push(ze(t,new z(r,a,e),n));break;case Ze:i.push(Ge(t,new G(r,a,e),1));break;case ts:i.push(ze(t,new j(r,a,e),1));break;case es:i.push(ze(t,new $(r,a,e),1));break;case ss:i.push(Ge(t,new H(r,a,e),1));break;case is:i.push(ze(t,new J(r,a,e),1));break;case ns:i.push(ze(t,new K(r,a,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),r=s-1,a=new ct(s,t.readInt(!0),e),o=t.readByte(),l=t.readFloat(),h=1&o?2&o?t.readFloat():1:0,c=4&o?t.readFloat()*n:0;for(let e=0,s=0;a.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=r;e++){o=t.readByte();const i=t.readFloat(),r=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*n:0;64&o?a.setStepped(e):128&o&&(je(t,a,s++,e,0,l,i,h,r,1),je(t,a,s++,e,1,l,i,c,d,n)),l=i,h=r,c=d}i.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,r=new dt(s,t.readInt(!0),e),a=t.readFloat(),o=t.readFloat(),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat();for(let e=0,s=0;r.setFrame(e,a,o,l,h,c,d,u),e!=n;e++){let i=t.readFloat(),n=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),x=t.readFloat();switch(t.readByte()){case Cs:r.setStepped(e);break;case Ts:je(t,r,s++,e,0,a,i,o,n,1),je(t,r,s++,e,1,a,i,l,m,1),je(t,r,s++,e,2,a,i,h,f,1),je(t,r,s++,e,3,a,i,c,g,1),je(t,r,s++,e,4,a,i,d,p,1),je(t,r,s++,e,5,a,i,u,x,1)}a=i,o=n,l=m,h=f,c=g,d=p,u=x}i.push(r)}for(let e=0,r=t.readInt(!0);e<r;e++){let e=t.readInt(!0),r=s.pathConstraints[e];for(let s=0,a=t.readInt(!0);s<a;s++){const s=t.readByte(),a=t.readInt(!0),o=t.readInt(!0);switch(s){case fs:i.push(ze(t,new ut(a,o,e),0==r.positionMode?n:1));break;case gs:i.push(ze(t,new mt(a,o,e),0==r.spacingMode||1==r.spacingMode?n:1));break;case ps:let s=new ft(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,i=0,n=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=n;e++){let n=t.readFloat(),r=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Cs:s.setStepped(e);break;case Ts:je(t,s,i++,e,0,l,n,h,r,1),je(t,s,i++,e,1,l,n,c,a,1),je(t,s,i++,e,2,l,n,d,o,1)}l=n,h=r,c=a,d=o}i.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,n=t.readInt(!0);s<n;s++){const s=t.readByte(),n=t.readInt(!0);if(s==Ss){const s=new St(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat());i.push(s);continue}const r=t.readInt(!0);switch(s){case xs:i.push(ze(t,new pt(n,r,e),1));break;case bs:i.push(ze(t,new xt(n,r,e),1));break;case ws:i.push(ze(t,new bt(n,r,e),1));break;case ys:i.push(ze(t,new wt(n,r,e),1));break;case vs:i.push(ze(t,new yt(n,r,e),1));break;case ks:i.push(ze(t,new vt(n,r,e),1));break;case As:i.push(ze(t,new kt(n,r,e),1))}}}for(let e=0,r=t.readInt(!0);e<r;e++){let e=s.skins[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let r=t.readStringRef();if(!r)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,r),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case us:{let e=a,r=e.bones,o=e.vertices,c=r?o.length/3*2:o.length,d=t.readInt(!0),u=new rt(l,d,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let i,a=t.readInt(!0);if(0==a)i=r?v.newFloatArray(c):o;else{i=v.newFloatArray(c);let e=t.readInt(!0);if(a+=e,1==n)for(let s=e;s<a;s++)i[s]=t.readFloat();else for(let s=e;s<a;s++)i[s]=t.readFloat()*n;if(!r)for(let t=0,e=i.length;t<e;t++)i[t]+=o[t]}if(u.setFrame(e,m,i),e==h)break;let l=t.readFloat();switch(t.readByte()){case Cs:u.setStepped(e);break;case Ts:je(t,u,s++,e,0,m,l,0,1,1)}m=l}i.push(u);break}case ms:{let e=new Tt(l,s,a);for(let s=0;s<l;s++){let i=t.readFloat(),n=t.readInt32();e.setFrame(s,i,X[15&n],n>>4,t.readFloat())}i.push(e);break}}}}}let r=t.readInt(!0);if(r>0){let e=new ht(r),n=s.slots.length;for(let s=0;s<r;s++){let i=t.readFloat(),r=t.readInt(!0),a=v.newArray(n,0);for(let t=n-1;t>=0;t--)a[t]=-1;let o=v.newArray(n-r,0),l=0,h=0;for(let e=0;e<r;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;a[l+t.readInt(!0)]=l++}for(;l<n;)o[h++]=l++;for(let t=n-1;t>=0;t--)-1==a[t]&&(a[t]=o[--h]);e.setFrame(s,i,a)}i.push(e)}let a=t.readInt(!0);if(a>0){let e=new ot(a);for(let i=0;i<a;i++){let n=t.readFloat(),r=s.events[t.readInt(!0)],a=new fe(n,r);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=r.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(i,a)}i.push(e)}let o=0;for(let t=0,e=i.length;t<e;t++)o=Math.max(o,i[t].getDuration());return new B(e,i,o)}},Ne=class{constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}},Ue=class{constructor(t,e,s,i,n){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}},qe=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}},We=((Ee=We||{})[Ee.Region=0]="Region",Ee[Ee.BoundingBox=1]="BoundingBox",Ee[Ee.Mesh=2]="Mesh",Ee[Ee.LinkedMesh=3]="LinkedMesh",Ee[Ee.Path=4]="Path",Ee[Ee.Point=5]="Point",Ee[Ee.Clipping=6]="Clipping",Ee);function ze(t,e,s){let i=t.readFloat(),n=t.readFloat()*s;for(let r=0,a=0,o=e.getFrameCount()-1;e.setFrame(r,i,n),r!=o;r++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Cs:e.setStepped(r);break;case Ts:je(t,e,a++,r,0,i,o,n,l,s)}i=o,n=l}return e}function Ge(t,e,s){let i=t.readFloat(),n=t.readFloat()*s,r=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,i,n,r),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Cs:e.setStepped(a);break;case Ts:je(t,e,o++,a,0,i,l,n,h,s),je(t,e,o++,a,1,i,l,r,c,s)}i=l,n=h,r=c}return e}function je(t,e,s,i,n,r,a,o,l,h){e.setBezier(s,i,n,r,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,l)}var $e,He=0,Je=1,Ke=2,Qe=3,Ze=4,ts=5,es=6,ss=7,is=8,ns=9,rs=10,as=0,os=1,ls=2,hs=3,cs=4,ds=5,us=0,ms=1,fs=0,gs=1,ps=2,xs=0,bs=1,ws=2,ys=4,vs=5,ks=6,As=7,Ss=8,Cs=1,Ts=2,Is=class{constructor(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new k((()=>v.newFloatArray(16)))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,r=t.slots,a=r.length;s.length=0,n.freeAll(i),i.length=0;for(let t=0;t<a;t++){let e=r[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof qt){let t=a;s.push(t);let r=n.obtain();r.length!=t.worldVerticesLength&&(r=v.newFloatArray(t.worldVerticesLength)),i.push(r),t.computeWorldVertices(e,0,t.worldVerticesLength,r,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=this.polygons;for(let r=0,a=n.length;r<a;r++){let a=n[r],o=a;for(let n=0,r=a.length;n<r;n+=2){let r=o[n],a=o[n+1];t=Math.min(t,r),e=Math.min(e,a),s=Math.max(s,r),i=Math.max(i,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let n=this.minX,r=this.minY,a=this.maxX,o=this.maxY;if(t<=n&&s<=n||e<=r&&i<=r||t>=a&&s>=a||e>=o&&i>=o)return!1;let l=(i-e)/(s-t),h=l*(n-t)+e;if(h>r&&h<o)return!0;if(h=l*(a-t)+e,h>r&&h<o)return!0;let c=(r-e)/l+t;return c>n&&c<a||(c=(o-e)/l+t,c>n&&c<a)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,n=t.length,r=n-2,a=!1;for(let t=0;t<n;t+=2){let n=i[t+1],o=i[r+1];if(n<s&&o>=s||o<s&&n>=s){let l=i[t];l+(s-n)/(o-n)*(i[r]-l)<e&&(a=!a)}r=t}return a}intersectsSegment(t,e,s,i){let n=this.polygons;for(let r=0,a=n.length;r<a;r++)if(this.intersectsSegmentPolygon(n[r],t,e,s,i))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,i,n){let r=t,a=t.length,o=e-i,l=s-n,h=e*n-s*i,c=r[a-2],d=r[a-1];for(let t=0;t<a;t+=2){let a=r[t],u=r[t+1],m=c*u-d*a,f=c-a,g=d-u,p=o*g-l*f,x=(h*f-o*m)/p;if((x>=c&&x<=a||x>=a&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let t=(h*g-l*m)/p;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=n||t>=n&&t<=s))return!0}c=a,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Ms=class{constructor(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new k((()=>new Array)),this.polygonIndicesPool=new k((()=>new Array))}triangulate(t){let e=t,s=t.length>>1,i=this.indicesArray;i.length=0;for(let t=0;t<s;t++)i[t]=t;let n=this.isConcaveArray;n.length=0;for(let t=0,r=s;t<r;++t)n[t]=Ms.isConcave(t,s,e,i);let r=this.triangles;for(r.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!n[a]){let r=i[t]<<1,l=i[a]<<1,h=i[o]<<1,c=e[r],d=e[r+1],u=e[l],m=e[l+1],f=e[h],g=e[h+1];for(let r=(o+1)%s;r!=t;r=(r+1)%s){if(!n[r])continue;let t=i[r]<<1,s=e[t],a=e[t+1];if(Ms.positiveArea(f,g,c,d,s,a)&&Ms.positiveArea(c,d,u,m,s,a)&&Ms.positiveArea(u,m,f,g,s,a))break t}break}if(0==o){do{if(!n[a])break;a--}while(a>0);break}t=a,a=o,o=(o+1)%s}r.push(i[(s+a-1)%s]),r.push(i[a]),r.push(i[(a+1)%s]),i.splice(a,1),n.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;n[l]=Ms.isConcave(l,s,e,i),n[h]=Ms.isConcave(h,s,e,i)}return 3==s&&(r.push(i[2]),r.push(i[0]),r.push(i[1])),r}decompose(t,e){let s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let r=this.polygonIndicesPool.obtain();r.length=0;let a=this.polygonPool.obtain();a.length=0;let o=-1,l=0;for(let t=0,h=e.length;t<h;t+=3){let h=e[t]<<1,c=e[t+1]<<1,d=e[t+2]<<1,u=s[h],m=s[h+1],f=s[c],g=s[c+1],p=s[d],x=s[d+1],b=!1;if(o==h){let t=a.length-4,e=Ms.winding(a[t],a[t+1],a[t+2],a[t+3],p,x),s=Ms.winding(p,x,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(p),a.push(x),r.push(d),b=!0)}b||(a.length>0?(i.push(a),n.push(r)):(this.polygonPool.free(a),this.polygonIndicesPool.free(r)),a=this.polygonPool.obtain(),a.length=0,a.push(u),a.push(m),a.push(f),a.push(g),a.push(p),a.push(x),r=this.polygonIndicesPool.obtain(),r.length=0,r.push(h),r.push(c),r.push(d),l=Ms.winding(u,m,f,g,p,x),o=h)}a.length>0&&(i.push(a),n.push(r));for(let t=0,e=i.length;t<e;t++){if(r=n[t],0==r.length)continue;let s=r[0],o=r[r.length-1];a=i[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],m=a[0],f=a[1],g=a[2],p=a[3],x=Ms.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=n[l];if(3!=e.length)continue;let b=e[0],w=e[1],y=e[2],v=i[l],k=v[v.length-2],A=v[v.length-1];if(b!=s||w!=o)continue;let S=Ms.winding(h,c,d,u,k,A),C=Ms.winding(k,A,m,f,g,p);S==x&&C==x&&(v.length=0,e.length=0,a.push(k),a.push(A),r.push(y),h=d,c=u,d=k,u=A,l=0)}}for(let t=i.length-1;t>=0;t--)a=i[t],0==a.length&&(i.splice(t,1),this.polygonPool.free(a),r=n[t],n.splice(t,1),this.polygonIndicesPool.free(r));return i}static isConcave(t,e,s,i){let n=i[(e+t-1)%e]<<1,r=i[t]<<1,a=i[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[r],s[r+1],s[a],s[a+1])}static positiveArea(t,e,s,i,n,r){return t*(r-i)+s*(e-r)+n*(i-e)>=0}static winding(t,e,s,i,n,r){let a=s-t,o=i-e;return n*o-r*a+a*e-t*o>=0?1:-1}},Fs=class{constructor(){this.triangulator=new Ms,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedUVs=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,i=v.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,i,0,2);let n=this.clippingPolygon;Fs.makeClockwise(n);let r=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let t=0,e=r.length;t<e;t++){let e=r[t];Fs.makeClockwise(e),e.push(e[0]),e.push(e[1])}return r.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,i,n,r,a,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=i,c=n,d=r,u=a,m=o):(l=e,h=s,c=i,d=n,u=r,m=a),c&&d&&u&&"boolean"==typeof m?this.clipTrianglesRender(t,l,h,c,d,u,m):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let i=this.clipOutput,n=this.clippedVertices,r=this.clippedTriangles,a=this.clippingPolygons,o=a.length,l=0;n.length=0,r.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let u=t[s],m=t[s+1];s=e[h+2]<<1;let f=t[s],g=t[s+1];for(let t=0;t<o;t++){let e=n.length;if(!this.clip(c,d,u,m,f,g,a[t],i)){let t=v.setArraySize(n,e+6);t[e]=c,t[e+1]=d,t[e+2]=u,t[e+3]=m,t[e+4]=f,t[e+5]=g,e=r.length;let s=v.setArraySize(r,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=i.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=v.setArraySize(n,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],i=a[s+1];o[e]=t,o[e+1]=i}e=r.length;let h=v.setArraySize(r,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,i,n,r,a){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=a?12:8,m=0;l.length=0,h.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,g=t[s],p=t[s+1],x=i[s],b=i[s+1];s=e[f+1]<<1;let w=t[s],y=t[s+1],k=i[s],A=i[s+1];s=e[f+2]<<1;let S=t[s],C=t[s+1],T=i[s],I=i[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(g,p,w,y,S,C,c[t],o)){let t=v.setArraySize(l,e+3*u);t[e]=g,t[e+1]=p,t[e+2]=n.r,t[e+3]=n.g,t[e+4]=n.b,t[e+5]=n.a,a?(t[e+6]=x,t[e+7]=b,t[e+8]=r.r,t[e+9]=r.g,t[e+10]=r.b,t[e+11]=r.a,t[e+12]=w,t[e+13]=y,t[e+14]=n.r,t[e+15]=n.g,t[e+16]=n.b,t[e+17]=n.a,t[e+18]=k,t[e+19]=A,t[e+20]=r.r,t[e+21]=r.g,t[e+22]=r.b,t[e+23]=r.a,t[e+24]=S,t[e+25]=C,t[e+26]=n.r,t[e+27]=n.g,t[e+28]=n.b,t[e+29]=n.a,t[e+30]=T,t[e+31]=I,t[e+32]=r.r,t[e+33]=r.g,t[e+34]=r.b,t[e+35]=r.a):(t[e+6]=x,t[e+7]=b,t[e+8]=w,t[e+9]=y,t[e+10]=n.r,t[e+11]=n.g,t[e+12]=n.b,t[e+13]=n.a,t[e+14]=k,t[e+15]=A,t[e+16]=S,t[e+17]=C,t[e+18]=n.r,t[e+19]=n.g,t[e+20]=n.b,t[e+21]=n.a,t[e+22]=T,t[e+23]=I),e=h.length;let s=v.setArraySize(h,e+3);s[e]=m,s[e+1]=m+1,s[e+2]=m+2,m+=3;break}{let t=o.length;if(0==t)continue;let s=y-C,i=S-w,c=g-S,d=C-p,f=1/(s*c+i*(p-C)),M=t>>1,F=this.clipOutput,Y=v.setArraySize(l,e+M*u);for(let o=0;o<t;o+=2,e+=u){let t=F[o],l=F[o+1];Y[e]=t,Y[e+1]=l,Y[e+2]=n.r,Y[e+3]=n.g,Y[e+4]=n.b,Y[e+5]=n.a;let h=t-S,u=l-C,m=(s*h+i*u)*f,g=(d*h+c*u)*f,p=1-m-g;Y[e+6]=x*m+k*g+T*p,Y[e+7]=b*m+A*g+I*p,a&&(Y[e+8]=r.r,Y[e+9]=r.g,Y[e+10]=r.b,Y[e+11]=r.a)}e=h.length;let E=v.setArraySize(h,e+3*(M-2));M--;for(let t=1;t<M;t++,e+=3)E[e]=m,E[e+1]=m+t,E[e+2]=m+t+1;m+=M+1}}}}clipTrianglesUnpacked(t,e,s,i){let n=this.clipOutput,r=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;r.length=0,a.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,u=t[s],m=t[s+1],f=i[s],g=i[s+1];s=e[d+1]<<1;let p=t[s],x=t[s+1],b=i[s],w=i[s+1];s=e[d+2]<<1;let y=t[s],k=t[s+1],A=i[s],S=i[s+1];for(let t=0;t<h;t++){let e=r.length;if(!this.clip(u,m,p,x,y,k,l[t],n)){let t=v.setArraySize(r,e+6);t[e]=u,t[e+1]=m,t[e+2]=p,t[e+3]=x,t[e+4]=y,t[e+5]=k;let s=v.setArraySize(a,e+6);s[e]=f,s[e+1]=g,s[e+2]=b,s[e+3]=w,s[e+4]=A,s[e+5]=S,e=o.length;let i=v.setArraySize(o,e+3);i[e]=c,i[e+1]=c+1,i[e+2]=c+2,c+=3;break}{let t=n.length;if(0==t)continue;let s=x-k,i=y-p,l=u-y,h=k-m,d=1/(s*l+i*(m-k)),C=t>>1,T=this.clipOutput,I=v.setArraySize(r,e+2*C),M=v.setArraySize(a,e+2*C);for(let n=0;n<t;n+=2,e+=2){let t=T[n],r=T[n+1];I[e]=t,I[e+1]=r;let a=t-y,o=r-k,c=(s*a+i*o)*d,u=(h*a+l*o)*d,m=1-c-u;M[e]=f*c+b*u+A*m,M[e+1]=g*c+w*u+S*m}e=o.length;let F=v.setArraySize(o,e+3*(C-2));C--;for(let t=1;t<C;t++,e+=3)F[e]=c,F[e+1]=c+t,F[e+2]=c+t+1;c+=C+1}}}}clip(t,e,s,i,n,r,a,o){let l,h=o,c=!1;a.length%4>=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(s),l.push(i),l.push(n),l.push(r),l.push(t),l.push(e),o.length=0;let d=a.length-4,u=a;for(let t=0;;t+=2){let e=u[t],s=u[t+1],i=e-u[t+2],n=s-u[t+3],r=o.length,a=l;for(let t=0,r=l.length-2;t<r;){let r=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=n*(e-h)>i*(s-d),m=n*(e-r)-i*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-r,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s)}else if(u){let t=h-r,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(r==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,i=e[s-2]*e[1]-e[0]*e[s-1],n=0,r=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)n=e[t],r=e[t+1],a=e[t+2],o=e[t+3],i+=n*o-a*r;if(!(i<0))for(let t=0,i=s-2,n=s>>1;t<n;t+=2){let s=e[t],n=e[t+1],r=i-t;e[t]=e[r],e[t+1]=e[r+1],e[r]=s,e[r+1]=n}}},Ys=class{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){var e,s;let i=this.scale,n=new Be,r="string"==typeof t?JSON.parse(t):t,a=r.skeleton;if(a&&(n.hash=a.hash,n.version=a.spine,n.x=a.x,n.y=a.y,n.width=a.width,n.height=a.height,n.referenceScale=Rs(a,"referenceScale",100)*i,n.fps=a.fps,n.imagesPath=null!=(e=a.images)?e:null,n.audioPath=null!=(s=a.audio)?s:null),r.bones)for(let t=0;t<r.bones.length;t++){let e=r.bones[t],s=null,a=Rs(e,"parent",null);a&&(s=n.findBone(a));let o=new he(n.bones.length,e.name,s);o.length=Rs(e,"length",0)*i,o.x=Rs(e,"x",0)*i,o.y=Rs(e,"y",0)*i,o.rotation=Rs(e,"rotation",0),o.scaleX=Rs(e,"scaleX",1),o.scaleY=Rs(e,"scaleY",1),o.shearX=Rs(e,"shearX",0),o.shearY=Rs(e,"shearY",0),o.inherit=v.enumValue(ce,Rs(e,"inherit","Normal")),o.skinRequired=Rs(e,"skin",!1);let l=Rs(e,"color",null);l&&o.color.setFromString(l),n.bones.push(o)}if(r.slots)for(let t=0;t<r.slots.length;t++){let e=r.slots[t],s=e.name,i=n.findBone(e.bone);if(!i)throw new Error(`Couldn't find bone ${e.bone} for slot ${s}`);let a=new Ve(n.slots.length,s,i),o=Rs(e,"color",null);o&&a.color.setFromString(o);let l=Rs(e,"dark",null);l&&(a.darkColor=g.fromString(l)),a.attachmentName=Rs(e,"attachment",null),a.blendMode=v.enumValue(Oe,Rs(e,"blend","normal")),a.visible=Rs(e,"visible",!0),n.slots.push(a)}if(r.ik)for(let t=0;t<r.ik.length;t++){let e=r.ik[t],s=new xe(e.name);s.order=Rs(e,"order",0),s.skinRequired=Rs(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let i=n.findBone(e.bones[t]);if(!i)throw new Error(`Couldn't find bone ${e.bones[t]} for IK constraint ${e.name}.`);s.bones.push(i)}let a=n.findBone(e.target);if(!a)throw new Error(`Couldn't find target bone ${e.target} for IK constraint ${e.name}.`);s.target=a,s.mix=Rs(e,"mix",1),s.softness=Rs(e,"softness",0)*i,s.bendDirection=Rs(e,"bendPositive",!0)?1:-1,s.compress=Rs(e,"compress",!1),s.stretch=Rs(e,"stretch",!1),s.uniform=Rs(e,"uniform",!1),n.ikConstraints.push(s)}if(r.transform)for(let t=0;t<r.transform.length;t++){let e=r.transform[t],s=new Le(e.name);s.order=Rs(e,"order",0),s.skinRequired=Rs(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=n.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for transform constraint ${e.name}.`);s.bones.push(r)}let a=e.target,o=n.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${e.name}.`);s.target=o,s.local=Rs(e,"local",!1),s.relative=Rs(e,"relative",!1),s.offsetRotation=Rs(e,"rotation",0),s.offsetX=Rs(e,"x",0)*i,s.offsetY=Rs(e,"y",0)*i,s.offsetScaleX=Rs(e,"scaleX",0),s.offsetScaleY=Rs(e,"scaleY",0),s.offsetShearY=Rs(e,"shearY",0),s.mixRotate=Rs(e,"mixRotate",1),s.mixX=Rs(e,"mixX",1),s.mixY=Rs(e,"mixY",s.mixX),s.mixScaleX=Rs(e,"mixScaleX",1),s.mixScaleY=Rs(e,"mixScaleY",s.mixScaleX),s.mixShearY=Rs(e,"mixShearY",1),n.transformConstraints.push(s)}if(r.path)for(let t=0;t<r.path.length;t++){let e=r.path[t],s=new be(e.name);s.order=Rs(e,"order",0),s.skinRequired=Rs(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=n.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for path constraint ${e.name}.`);s.bones.push(r)}let a=e.target,o=n.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${e.name}.`);s.target=o,s.positionMode=v.enumValue(we,Rs(e,"positionMode","Percent")),s.spacingMode=v.enumValue(ye,Rs(e,"spacingMode","Length")),s.rotateMode=v.enumValue(ve,Rs(e,"rotateMode","Tangent")),s.offsetRotation=Rs(e,"rotation",0),s.position=Rs(e,"position",0),0==s.positionMode&&(s.position*=i),s.spacing=Rs(e,"spacing",0),0!=s.spacingMode&&1!=s.spacingMode||(s.spacing*=i),s.mixRotate=Rs(e,"mixRotate",1),s.mixX=Rs(e,"mixX",1),s.mixY=Rs(e,"mixY",s.mixX),n.pathConstraints.push(s)}if(r.physics)for(let t=0;t<r.physics.length;t++){const e=r.physics[t],s=new Xe(e.name);s.order=Rs(e,"order",0),s.skinRequired=Rs(e,"skin",!1);const a=e.bone,o=n.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);s.bone=o,s.x=Rs(e,"x",0),s.y=Rs(e,"y",0),s.rotate=Rs(e,"rotate",0),s.scaleX=Rs(e,"scaleX",0),s.shearX=Rs(e,"shearX",0),s.limit=Rs(e,"limit",5e3)*i,s.step=1/Rs(e,"fps",60),s.inertia=Rs(e,"inertia",1),s.strength=Rs(e,"strength",100),s.damping=Rs(e,"damping",1),s.massInverse=1/Rs(e,"mass",1),s.wind=Rs(e,"wind",0),s.gravity=Rs(e,"gravity",0),s.mix=Rs(e,"mix",1),s.inertiaGlobal=Rs(e,"inertiaGlobal",!1),s.strengthGlobal=Rs(e,"strengthGlobal",!1),s.dampingGlobal=Rs(e,"dampingGlobal",!1),s.massGlobal=Rs(e,"massGlobal",!1),s.windGlobal=Rs(e,"windGlobal",!1),s.gravityGlobal=Rs(e,"gravityGlobal",!1),s.mixGlobal=Rs(e,"mixGlobal",!1),n.physicsConstraints.push(s)}if(r.skins)for(let t=0;t<r.skins.length;t++){let e=r.skins[t],s=new De(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=n.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for skin ${e.name}.`);s.bones.push(r)}if(e.ik)for(let t=0;t<e.ik.length;t++){let i=e.ik[t],r=n.findIkConstraint(i);if(!r)throw new Error(`Couldn't find IK constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}if(e.transform)for(let t=0;t<e.transform.length;t++){let i=e.transform[t],r=n.findTransformConstraint(i);if(!r)throw new Error(`Couldn't find transform constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}if(e.path)for(let t=0;t<e.path.length;t++){let i=e.path[t],r=n.findPathConstraint(i);if(!r)throw new Error(`Couldn't find path constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}if(e.physics)for(let t=0;t<e.physics.length;t++){let i=e.physics[t],r=n.findPhysicsConstraint(i);if(!r)throw new Error(`Couldn't find physics constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}for(let t in e.attachments){let i=n.findSlot(t);if(!i)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let r=e.attachments[t];for(let t in r){let e=this.readAttachment(r[t],s,i.index,t,n);e&&s.setAttachment(i.index,t,e)}}n.skins.push(s),"default"==s.name&&(n.defaultSkin=s)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],s=e.skin?n.findSkin(e.skin):n.defaultSkin;if(!s)throw new Error(`Skin not found: ${e.skin}`);let i=s.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let t in r.events){let e=r.events[t],s=new ge(t);s.intValue=Rs(e,"int",0),s.floatValue=Rs(e,"float",0),s.stringValue=Rs(e,"string",""),s.audioPath=Rs(e,"audio",null),s.audioPath&&(s.volume=Rs(e,"volume",1),s.balance=Rs(e,"balance",0)),n.events.push(s)}if(r.animations)for(let t in r.animations){let e=r.animations[t];this.readAnimation(e,t,n)}return n}readAttachment(t,e,s,i,n){let r=this.scale;switch(i=Rs(t,"name",i),Rs(t,"type","region")){case"region":{let s=Rs(t,"path",i),n=this.readSequence(Rs(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,s,n);if(!a)return null;a.path=s,a.x=Rs(t,"x",0)*r,a.y=Rs(t,"y",0)*r,a.scaleX=Rs(t,"scaleX",1),a.scaleY=Rs(t,"scaleY",1),a.rotation=Rs(t,"rotation",0),a.width=t.width*r,a.height=t.height*r,a.sequence=n;let o=Rs(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let n=Rs(t,"color",null);return n&&s.color.setFromString(n),s}case"mesh":case"linkedmesh":{let n=Rs(t,"path",i),a=this.readSequence(Rs(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,i,n,a);if(!o)return null;o.path=n;let l=Rs(t,"color",null);l&&o.color.setFromString(l),o.width=Rs(t,"width",0)*r,o.height=Rs(t,"height",0)*r,o.sequence=a;let h=Rs(t,"parent",null);if(h)return this.linkedMeshes.push(new Es(o,Rs(t,"skin",null),s,h,Rs(t,"timelines",!0))),o;let c=t.uvs;return this.readVertices(t,o,c.length),o.triangles=t.triangles,o.regionUVs=c,null!=o.region&&o.updateRegion(),o.edges=Rs(t,"edges",null),o.hullLength=2*Rs(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,i);if(!s)return null;s.closed=Rs(t,"closed",!1),s.constantSpeed=Rs(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,s,n<<1);let a=v.newArray(n/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*r;s.lengths=a;let o=Rs(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,i);if(!s)return null;s.x=Rs(t,"x",0)*r,s.y=Rs(t,"y",0)*r,s.rotation=Rs(t,"rotation",0);let n=Rs(t,"color",null);return n&&s.color.setFromString(n),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,i);if(!s)return null;let r=Rs(t,"end",null);r&&(s.endSlot=n.findSlot(r));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=Rs(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new M(Rs(t,"count",0));return e.start=Rs(t,"start",1),e.digits=Rs(t,"digits",0),e.setupIndex=Rs(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let t=v.toFloatArray(n);if(1!=i)for(let e=0,s=n.length;e<s;e++)t[e]*=i;return void(e.vertices=t)}let r=new Array,a=new Array;for(let t=0,e=n.length;t<e;){let e=n[t++];a.push(e);for(let s=t+4*e;t<s;t+=4)a.push(n[t]),r.push(n[t+1]*i),r.push(n[t+2]*i),r.push(n[t+3])}e.bones=a,e.vertices=v.toFloatArray(r)}readAnimation(t,e,s){let i=this.scale,n=new Array;if(t.slots)for(let e in t.slots){let i=t.slots[e],r=s.findSlot(e);if(!r)throw new Error("Slot not found: "+e);let a=r.index;for(let t in i){let e=i[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new nt(s,a);for(let i=0;i<s;i++){let s=e[i];t.setFrame(i,Rs(s,"time",0),Rs(s,"name",null))}n.push(t)}else if("rgba"==t){let t=new Z(s,s<<2,a),i=e[0],r=Rs(i,"time",0),o=g.fromString(i.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a);let a=e[s+1];if(!a){t.shrink(n);break}let l=Rs(a,"time",0),h=g.fromString(a.color),c=i.curve;c&&(n=Bs(c,t,n,s,0,r,l,o.r,h.r,1),n=Bs(c,t,n,s,1,r,l,o.g,h.g,1),n=Bs(c,t,n,s,2,r,l,o.b,h.b,1),n=Bs(c,t,n,s,3,r,l,o.a,h.a,1)),r=l,o=h,i=a}n.push(t)}else if("rgb"==t){let t=new tt(s,3*s,a),i=e[0],r=Rs(i,"time",0),o=g.fromString(i.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b);let a=e[s+1];if(!a){t.shrink(n);break}let l=Rs(a,"time",0),h=g.fromString(a.color),c=i.curve;c&&(n=Bs(c,t,n,s,0,r,l,o.r,h.r,1),n=Bs(c,t,n,s,1,r,l,o.g,h.g,1),n=Bs(c,t,n,s,2,r,l,o.b,h.b,1)),r=l,o=h,i=a}n.push(t)}else if("alpha"==t)n.push(Ps(e,new et(s,s,a),0,1));else if("rgba2"==t){let t=new st(s,7*s,a),i=e[0],r=Rs(i,"time",0),o=g.fromString(i.light),l=g.fromString(i.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a,l.r,l.g,l.b);let a=e[s+1];if(!a){t.shrink(n);break}let h=Rs(a,"time",0),c=g.fromString(a.light),d=g.fromString(a.dark),u=i.curve;u&&(n=Bs(u,t,n,s,0,r,h,o.r,c.r,1),n=Bs(u,t,n,s,1,r,h,o.g,c.g,1),n=Bs(u,t,n,s,2,r,h,o.b,c.b,1),n=Bs(u,t,n,s,3,r,h,o.a,c.a,1),n=Bs(u,t,n,s,4,r,h,l.r,d.r,1),n=Bs(u,t,n,s,5,r,h,l.g,d.g,1),n=Bs(u,t,n,s,6,r,h,l.b,d.b,1)),r=h,o=c,l=d,i=a}n.push(t)}else if("rgb2"==t){let t=new it(s,6*s,a),i=e[0],r=Rs(i,"time",0),o=g.fromString(i.light),l=g.fromString(i.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,l.r,l.g,l.b);let a=e[s+1];if(!a){t.shrink(n);break}let h=Rs(a,"time",0),c=g.fromString(a.light),d=g.fromString(a.dark),u=i.curve;u&&(n=Bs(u,t,n,s,0,r,h,o.r,c.r,1),n=Bs(u,t,n,s,1,r,h,o.g,c.g,1),n=Bs(u,t,n,s,2,r,h,o.b,c.b,1),n=Bs(u,t,n,s,3,r,h,l.r,d.r,1),n=Bs(u,t,n,s,4,r,h,l.g,d.g,1),n=Bs(u,t,n,s,5,r,h,l.b,d.b,1)),r=h,o=c,l=d,i=a}n.push(t)}}}if(t.bones)for(let e in t.bones){let r=t.bones[e],a=s.findBone(e);if(!a)throw new Error("Bone not found: "+e);let o=a.index;for(let t in r){let e=r[t],s=e.length;if(0!=s)if("rotate"===t)n.push(Ps(e,new U(s,s,o),0,1));else if("translate"===t){let t=new q(s,s<<1,o);n.push(Xs(e,t,"x","y",0,i))}else if("translatex"===t){let t=new W(s,s,o);n.push(Ps(e,t,0,i))}else if("translatey"===t){let t=new z(s,s,o);n.push(Ps(e,t,0,i))}else if("scale"===t){let t=new G(s,s<<1,o);n.push(Xs(e,t,"x","y",1,1))}else if("scalex"===t){let t=new j(s,s,o);n.push(Ps(e,t,1,1))}else if("scaley"===t){let t=new $(s,s,o);n.push(Ps(e,t,1,1))}else if("shear"===t){let t=new H(s,s<<1,o);n.push(Xs(e,t,"x","y",0,1))}else if("shearx"===t){let t=new J(s,s,o);n.push(Ps(e,t,0,1))}else if("sheary"===t){let t=new K(s,s,o);n.push(Ps(e,t,0,1))}else if("inherit"===t){let t=new Q(s,a.index);for(let s=0;s<e.length;s++){let i=e[s];t.setFrame(s,Rs(i,"time",0),v.enumValue(ce,Rs(i,"inherit","Normal")))}n.push(t)}}}if(t.ik)for(let e in t.ik){let r=t.ik[e],a=r[0];if(!a)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new ct(r.length,r.length<<1,l),c=Rs(a,"time",0),d=Rs(a,"mix",1),u=Rs(a,"softness",0)*i;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Rs(a,"bendPositive",!0)?1:-1,Rs(a,"compress",!1),Rs(a,"stretch",!1));let s=r[t+1];if(!s){h.shrink(e);break}let n=Rs(s,"time",0),o=Rs(s,"mix",1),l=Rs(s,"softness",0)*i,m=a.curve;m&&(e=Bs(m,h,e,t,0,c,n,d,o,1),e=Bs(m,h,e,t,1,c,n,u,l,i)),c=n,d=o,u=l,a=s}n.push(h)}if(t.transform)for(let e in t.transform){let i=t.transform[e],r=i[0];if(!r)continue;let a=s.findTransformConstraint(e);if(!a)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(a),l=new dt(i.length,6*i.length,o),h=Rs(r,"time",0),c=Rs(r,"mixRotate",1),d=Rs(r,"mixX",1),u=Rs(r,"mixY",d),m=Rs(r,"mixScaleX",1),f=Rs(r,"mixScaleY",m),g=Rs(r,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,g);let s=i[t+1];if(!s){l.shrink(e);break}let n=Rs(s,"time",0),a=Rs(s,"mixRotate",1),o=Rs(s,"mixX",1),p=Rs(s,"mixY",o),x=Rs(s,"mixScaleX",1),b=Rs(s,"mixScaleY",x),w=Rs(s,"mixShearY",1),y=r.curve;y&&(e=Bs(y,l,e,t,0,h,n,c,a,1),e=Bs(y,l,e,t,1,h,n,d,o,1),e=Bs(y,l,e,t,2,h,n,u,p,1),e=Bs(y,l,e,t,3,h,n,m,x,1),e=Bs(y,l,e,t,4,h,n,f,b,1),e=Bs(y,l,e,t,5,h,n,g,w,1)),h=n,c=a,d=o,u=p,m=x,f=b,m=x,r=s}n.push(l)}if(t.path)for(let e in t.path){let r=t.path[e],a=s.findPathConstraint(e);if(!a)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(a);for(let t in r){let e=r[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new ut(l,l,o);n.push(Ps(e,t,0,0==a.positionMode?i:1))}else if("spacing"===t){let t=new mt(l,l,o);n.push(Ps(e,t,0,0==a.spacingMode||1==a.spacingMode?i:1))}else if("mix"===t){let t=new ft(l,3*l,o),i=Rs(s,"time",0),r=Rs(s,"mixRotate",1),a=Rs(s,"mixX",1),h=Rs(s,"mixY",a);for(let n=0,o=0;;n++){t.setFrame(n,i,r,a,h);let l=e[n+1];if(!l){t.shrink(o);break}let c=Rs(l,"time",0),d=Rs(l,"mixRotate",1),u=Rs(l,"mixX",1),m=Rs(l,"mixY",u),f=s.curve;f&&(o=Bs(f,t,o,n,0,i,c,r,d,1),o=Bs(f,t,o,n,1,i,c,a,u,1),o=Bs(f,t,o,n,2,i,c,h,m,1)),i=c,r=d,a=u,h=m,s=l}n.push(t)}}}if(t.physics)for(let e in t.physics){let i=t.physics[e],r=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);r=s.physicsConstraints.indexOf(t)}for(let t in i){let e=i[t],s=e[0];if(!s)continue;let a,o=e.length;if("reset"!=t){if("inertia"==t)a=new pt(o,o,r);else if("strength"==t)a=new xt(o,o,r);else if("damping"==t)a=new bt(o,o,r);else if("mass"==t)a=new wt(o,o,r);else if("wind"==t)a=new yt(o,o,r);else if("gravity"==t)a=new vt(o,o,r);else{if("mix"!=t)continue;a=new kt(o,o,r)}n.push(Ps(e,a,0,1))}else{const t=new St(o,r);for(let i=0;null!=s;s=e[i+1],i++)t.setFrame(i,Rs(s,"time",0));n.push(t)}}}if(t.attachments)for(let e in t.attachments){let r=t.attachments[e],a=s.findSkin(e);if(!a)throw new Error("Skin not found: "+e);for(let t in r){let e=r[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],r=a.getAttachment(l,t);for(let t in s){let e=s[t],a=e[0];if(a)if("deform"==t){let t=r.bones,s=r.vertices,o=t?s.length/3*2:s.length,h=new rt(e.length,e.length,l,r),c=Rs(a,"time",0);for(let n=0,r=0;;n++){let l,d=Rs(a,"vertices",null);if(d){l=v.newFloatArray(o);let e=Rs(a,"offset",0);if(v.arrayCopy(d,0,l,e,d.length),1!=i)for(let t=e,s=t+d.length;t<s;t++)l[t]*=i;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?v.newFloatArray(o):s;h.setFrame(n,c,l);let u=e[n+1];if(!u){h.shrink(r);break}let m=Rs(u,"time",0),f=a.curve;f&&(r=Bs(f,h,r,n,0,c,m,0,1,1)),c=m,a=u}n.push(h)}else if("sequence"==t){let t=new Tt(e.length,l,r),s=0;for(let i=0;i<e.length;i++){let n=Rs(a,"delay",s),r=Rs(a,"time",0),o=P[Rs(a,"mode","hold")],l=Rs(a,"index",0);t.setFrame(i,r,o,l,n),s=n,a=e[i+1]}n.push(t)}}}}}if(t.drawOrder){let e=new ht(t.drawOrder.length),i=s.slots.length,r=0;for(let n=0;n<t.drawOrder.length;n++,r++){let a=t.drawOrder[n],o=null,l=Rs(a,"offsets",null);if(l){o=v.newArray(i,-1);let t=v.newArray(i-l.length,0),e=0,n=0;for(let i=0;i<l.length;i++){let r=l[i],a=s.findSlot(r.slot);if(!a)throw new Error("Slot not found: "+a);let h=a.index;for(;e!=h;)t[n++]=e++;o[e+r.offset]=e++}for(;e<i;)t[n++]=e++;for(let e=i-1;e>=0;e--)-1==o[e]&&(o[e]=t[--n])}e.setFrame(r,Rs(a,"time",0),o)}n.push(e)}if(t.events){let e=new ot(t.events.length),i=0;for(let n=0;n<t.events.length;n++,i++){let r=t.events[n],a=s.findEvent(r.name);if(!a)throw new Error("Event not found: "+r.name);let o=new fe(v.toSinglePrecision(Rs(r,"time",0)),a);o.intValue=Rs(r,"int",a.intValue),o.floatValue=Rs(r,"float",a.floatValue),o.stringValue=Rs(r,"string",a.stringValue),o.data.audioPath&&(o.volume=Rs(r,"volume",1),o.balance=Rs(r,"balance",0)),e.setFrame(i,o)}n.push(e)}let r=0;for(let t=0,e=n.length;t<e;t++)r=Math.max(r,n[t].getDuration());s.animations.push(new B(e,n,r))}},Es=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}};function Ps(t,e,s,i){let n=t[0],r=Rs(n,"time",0),a=Rs(n,"value",s)*i,o=0;for(let l=0;;l++){e.setFrame(l,r,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Rs(h,"time",0),d=Rs(h,"value",s)*i;n.curve&&(o=Bs(n.curve,e,o,l,0,r,c,a,d,i)),r=c,a=d,n=h}}function Xs(t,e,s,i,n,r){let a=t[0],o=Rs(a,"time",0),l=Rs(a,s,n)*r,h=Rs(a,i,n)*r,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=Rs(u,"time",0),f=Rs(u,s,n)*r,g=Rs(u,i,n)*r,p=a.curve;p&&(c=Bs(p,e,c,d,0,o,m,l,f,r),c=Bs(p,e,c,d,1,o,m,h,g,r)),o=m,l=f,h=g,a=u}}function Bs(t,e,s,i,n,r,a,o,l,h){if("stepped"==t)return e.setStepped(i),s;let c=n<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,i,n,r,o,d,u,m,f,a,l),s+1}function Rs(t,e,s){return void 0!==t[e]?t[e]:s}void 0===Math.fround&&(Math.fround=($e=new Float32Array(1),function(t){return $e[0]=t,$e[0]}));var Ds=class extends zt{constructor(t){super(t.resource),this.texture=e.Texture.from(t)}static from(t){return Ds.textureMap.has(t)?Ds.textureMap.get(t):new Ds(t)}setFilters(t,e){const s=this.texture.source.style;s.minFilter=Ds.toPixiTextureFilter(t),s.magFilter=Ds.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=Ds.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){const s=this.texture.source.style;s.addressModeU=Ds.toPixiTextureWrap(t),s.addressModeV=Ds.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Vs=Ds;Vs.textureMap=new Map;var Os={extension:e.ExtensionType.Asset,resolver:{test:t=>e.checkExtension(t,".atlas"),parse:t=>{var s,i,n;const r=t.split(".");return{resolution:parseFloat(null!=(n=null==(i=null==(s=e.Resolver.RETINA_PREFIX)?void 0:s.exec(t))?void 0:i[1])?n:"1"),format:r[r.length-2],src:t}}},loader:{extension:{type:e.ExtensionType.LoadParser,priority:e.LoaderParserPriority.Normal,name:"spineTextureAtlasLoader"},test:t=>e.checkExtension(t,".atlas"),load(t){return u(this,null,(function*(){const s=yield e.DOMAdapter.get().fetch(t);return yield s.text()}))},testParse(t,s){const i=e.checkExtension(s.src,".atlas"),n="string"==typeof t;return Promise.resolve(i&&n)},unload(t){t.dispose()},parse(t,s,i){return u(this,null,(function*(){const n=s.data||{};let o=e.path.dirname(s.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=new Ht(t);if(n.images instanceof e.TextureSource||"string"==typeof n.images){const t=n.images;n.images={},n.images[l.pages[0].name]=t}const h=[];for(const t of l.pages){if(n.resolve){const e=n.resolve().then((e=>{t.setTexture(Vs.from(e.source))}));h.push(e);continue}const s=t.name,l=(null==n?void 0:n.images)?n.images[s]:void 0;if(l instanceof e.TextureSource)t.setTexture(Vs.from(l));else{const m={src:null!=l?l:e.path.normalize([...o.split(e.path.sep),s].join(e.path.sep)),data:(c=d({},n.imageMetadata),u={alphaMode:t.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"},r(c,a(u)))},f=i.load(m).then((e=>{t.setTexture(Vs.from(e.source))}));h.push(f)}}var c,u;return yield Promise.all(h),l}))}}};e.extensions.add(Os);var Ls={extension:e.ExtensionType.Asset,loader:{extension:{type:e.ExtensionType.LoadParser,priority:e.LoaderParserPriority.Normal,name:"spineSkeletonLoader"},test:t=>e.checkExtension(t,".skel"),load(t){return u(this,null,(function*(){const s=yield e.DOMAdapter.get().fetch(t);return new Uint8Array(yield s.arrayBuffer())}))},testParse(t,s){const i=e.checkExtension(s.src,".json")&&(n=t,Object.prototype.hasOwnProperty.call(n,"bones"));var n;const r=e.checkExtension(s.src,".skel")&&function(t){return t instanceof Uint8Array}(t);return Promise.resolve(i||r)}}};e.extensions.add(Ls);var _s=new Float32Array(1),Ns=new Uint32Array(1),Us=class extends e.Geometry{constructor(){const t=new e.Buffer({data:_s,label:"attribute-batch-buffer",usage:e.BufferUsage.VERTEX|e.BufferUsage.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:28,offset:0},aUV:{buffer:t,format:"float32x2",stride:28,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:28,offset:16},aDarkColor:{buffer:t,format:"unorm8x4",stride:28,offset:20},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:28,offset:24}},indexBuffer:new e.Buffer({data:Ns,label:"index-batch-buffer",usage:e.BufferUsage.INDEX|e.BufferUsage.COPY_DST,shrinkToFit:!1})})}},qs={name:"color-bit",vertex:{header:"\n @in aDarkColor: vec4<f32>;\n @out vDarkColor: vec4<f32>;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n @in vDarkColor: vec4<f32>;\n ",end:"\n\n let alpha = outColor.a * vColor.a;\n let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n\n finalColor = vec4<f32>(rgb, alpha);\n\n "}},Ws={name:"color-bit",vertex:{header:"\n in vec4 aDarkColor;\n out vec4 vDarkColor;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n in vec4 vDarkColor;\n ",end:"\n\n finalColor.a = outColor.a * vColor.a;\n finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n "}},zs=class extends e.Shader{constructor(t){super({glProgram:e.compileHighShaderGlProgram({name:"dark-tint-batch",bits:[e.colorBitGl,Ws,e.generateTextureBatchBitGl(t),e.roundPixelsBitGl]}),gpuProgram:e.compileHighShaderGpuProgram({name:"dark-tint-batch",bits:[e.colorBit,qs,e.generateTextureBatchBit(t),e.roundPixelsBit]}),resources:{batchSamplers:e.getBatchSamplersUniformGroup(t)}})}},Gs=null,js=class extends e.Batcher{constructor(){super(...arguments),this.geometry=new Us,this.shader=Gs||(Gs=new zs(this.maxTextures)),this.name=js.extension.name,this.vertexSize=7}packAttributes(t,s,i,n,r){const a=r<<16|65535&t.roundPixels,o=t.transform,l=o.a,h=o.b,c=o.c,d=o.d,u=o.tx,m=o.ty,{positions:f,uvs:g}=t,p=t.color,x=(p>>24&255)/255,b=e.Color.shared.setValue(t.darkColor).premultiply(x,!0).toPremultiplied(1,!1),w=t.attributeOffset,y=w+t.attributeSize;for(let t=w;t<y;t++){const e=2*t,r=f[e],o=f[e+1];s[n++]=l*r+c*o+u,s[n++]=d*o+h*r+m,s[n++]=g[e],s[n++]=g[e+1],i[n++]=p,i[n++]=b,i[n++]=a}}packQuadAttributes(t,e,s,i,n){const r=t.texture,a=t.transform,o=a.a,l=a.b,h=a.c,c=a.d,d=a.tx,u=a.ty,m=t.bounds,f=m.maxX,g=m.minX,p=m.maxY,x=m.minY,b=r.uvs,w=t.color,y=t.darkColor,v=n<<16|65535&t.roundPixels;e[i+0]=o*g+h*x+d,e[i+1]=c*x+l*g+u,e[i+2]=b.x0,e[i+3]=b.y0,s[i+4]=w,s[i+5]=y,s[i+6]=v,e[i+7]=o*f+h*x+d,e[i+8]=c*x+l*f+u,e[i+9]=b.x1,e[i+10]=b.y1,s[i+11]=w,s[i+12]=y,s[i+13]=v,e[i+14]=o*f+h*p+d,e[i+15]=c*p+l*f+u,e[i+16]=b.x2,e[i+17]=b.y2,s[i+18]=w,s[i+19]=y,s[i+20]=v,e[i+21]=o*g+h*p+d,e[i+22]=c*p+l*g+u,e[i+23]=b.x3,e[i+24]=b.y3,s[i+25]=w,s[i+26]=y,s[i+27]=v}},$s=js;$s.extension={type:[e.ExtensionType.Batcher],name:"darkTint"},e.extensions.add($s);var Hs=class{constructor(){this.indexOffset=0,this.attributeOffset=0,this.batcherName="darkTint",this.topology="triangle-list",this.packAsQuad=!1}get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const n=t.a*s*255;if(16777215!==e){const s=e>>16&255,r=e>>8&255,a=255&e,o=t.r*a,l=t.g*r;i=n<<24|t.b*s<<16|l<<8|o}else i=n<<24|255*t.b<<16|255*t.g<<8|255*t.r;return i}get darkColor(){const t=this.data.darkColor;return 255*t.b<<16|255*t.g<<8|255*t.r}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,i){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const t=e.clippedData;this.indexSize=t.indicesCount,this.attributeSize=t.vertexCount,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},Js={0:"normal",1:"add",2:"multiply",3:"screen"},Ks=class{constructor(t){this.gpuSpineData={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t}validateRenderable(t){if(t._validateAndTransformAttachments(),t.spineAttachmentsDirty)return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let i=0,n=e.length;i<n;i++){const n=e[i],r=n.getAttachment();if(r instanceof ie||r instanceof Zt){const e=t._getCachedData(n,r),i=s.slotBatches[e.id],a=e.texture;if(a!==i.texture&&!i._batcher.checkAndUpdateTexture(i,a))return!0}}}return!1}addRenderable(t,s){var i,n;const r=this._getSpineData(t),a=this.renderer.renderPipes.batch,o=t.skeleton.drawOrder,l=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments();for(let h=0,c=o.length;h<c;h++){const c=o[h],d=c.getAttachment(),u=Js[c.data.blendMode];if(d instanceof ie||d instanceof Zt){const e=t._getCachedData(c,d),o=(i=r.slotBatches)[n=e.id]||(i[n]=new Hs);o.setData(t,e,u,l),e.skipRender||a.addToBatch(o,s)}const m=t._slotsObject[c.data.name];if(m){const t=m.container;t.includeInBuild=!0,e.collectAllRenderables(t,s,this.renderer),t.includeInBuild=!1}}}updateRenderable(t){var e;const s=this.gpuSpineData[t.uid];t._validateAndTransformAttachments();const i=t.skeleton.drawOrder;for(let n=0,r=i.length;n<r;n++){const r=i[n],a=r.getAttachment();if(a instanceof ie||a instanceof Zt){if(!t._getCachedData(r,a).skipRender){const i=s.slotBatches[t._getCachedData(r,a).id];null==(e=i._batcher)||e.updateElement(i)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};Ks.extension={type:[e.ExtensionType.WebGLPipes,e.ExtensionType.WebGPUPipes,e.ExtensionType.CanvasPipes],name:"spine"},e.extensions.add(Ks);var Qs=new A;Me.yDown=!0;var Zs=new Fs,ti=new k((()=>new e.Graphics)),ei=class extends e.ViewContainer{constructor(t){var e;t instanceof Be&&(t={skeletonData:t}),super(),this.batched=!0,this.buildId=0,this.renderPipeId="spine",this._didSpineUpdate=!1,this.beforeUpdateWorldTransforms=()=>{},this.afterUpdateWorldTransforms=()=>{},this.darkTint=!1,this._debug=void 0,this._slotsObject=Object.create(null),this.clippingSlotToPixiMasks=Object.create(null),this.spineAttachmentsDirty=!0,this.spineTexturesDirty=!0,this._lastAttachments=[],this._stateChanged=!0,this.attachmentCacheData=[],this._autoUpdate=!0,this.hasNeverUpdated=!0;const s=t instanceof Be?t:t.skeletonData;this.skeleton=new Me(s),this.state=new Mt(new Ut(s)),this.autoUpdate=null==(e=null==t?void 0:t.autoUpdate)||e,this.darkTint=void 0===(null==t?void 0:t.darkTint)?this.skeleton.slots.some((t=>!!t.data.darkColor)):null==t?void 0:t.darkTint;const i=this.skeleton.slots;for(let t=0;t<i.length;t++)this.attachmentCacheData[t]=Object.create(null)}getSlotFromRef(t){let e;if(e="number"==typeof t?this.skeleton.slots[t]:"string"==typeof t?this.skeleton.findSlot(t):t,!e)throw new Error(`No slot found with the given slot reference: ${t}`);return e}get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t?e.Ticker.shared.add(this.internalUpdate,this):e.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=t}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this._updateAndApplyState(null!=s?s:e.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,e){const s=t;if("string"==typeof t&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(Qs.set(e.x,e.y),t.parent){const e=t.parent.worldToLocal(Qs);t.x=e.x,t.y=-e.y}else t.x=Qs.x,t.y=Qs.y}getBonePosition(t,e){const s=t;return"string"==typeof t&&(t=this.skeleton.findBone(t)),t?(e||(e={x:0,y:0}),e.x=t.worldX,e.y=t.worldY,e):(console.error(`Cant set bone position! Bone ${String(s)} not found`),e)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this._boundsDirty=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,e=this._lastAttachments;let s=0,i=!1;for(let n=0;n<t.length;n++){const r=t[n].getAttachment();r&&(r!==e[s]&&(i=!0,e[s]=r),s++)}s!==e.length&&(i=!0,e.length=s),this.spineAttachmentsDirty=i}updateAndSetPixiMask(t,e){var s,i;const n=t.attachment;if(n&&n instanceof Wt){return((s=this.clippingSlotToPixiMasks)[i=t.data.name]||(s[i]={slot:t,vertices:new Array})).maskComputed=!1,void(this.currentClippingSlot=this.clippingSlotToPixiMasks[t.data.name])}let r=this.currentClippingSlot,a=this._slotsObject[t.data.name];if(r&&a){let t=r.slot,e=t.attachment,s=r.mask;if(s||(s=ti.obtain(),r.mask=s,this.addChild(s)),!r.maskComputed){r.maskComputed=!0;const i=e.worldVerticesLength,n=r.vertices;e.computeWorldVertices(t,0,i,n,0,2),s.clear().poly(n).stroke({width:0}).fill({alpha:.25})}a.container.mask=s}else(null==a?void 0:a.container.mask)&&(a.container.mask=null);if(r&&r.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),e)for(const t in this.clippingSlotToPixiMasks){const e=this.clippingSlotToPixiMasks[t];e.slot.attachment instanceof Wt&&e.maskComputed||!e.mask||(this.removeChild(e.mask),ti.free(e.mask),e.mask=void 0)}}transformAttachments(){var t;const s=this.skeleton.drawOrder;for(let i=0;i<s.length;i++){const n=s[i];this.updateAndSetPixiMask(n,i===s.length-1);const r=n.getAttachment();if(r)if(r instanceof Zt||r instanceof ie){const s=this._getCachedData(n,r);r instanceof ie?r.computeWorldVertices(n,s.vertices,0,2):r.computeWorldVertices(n,0,r.worldVerticesLength,s.vertices,0,2),s.uvs.length<r.uvs.length&&(s.uvs=new Float32Array(r.uvs.length)),e.fastCopy(r.uvs.buffer,s.uvs.buffer);const i=n.bone.skeleton.color,a=n.color,o=r.color;s.color.set(i.r*a.r*o.r,i.g*a.g*o.g,i.b*a.b*o.b,i.a*a.a*o.a),n.darkColor&&s.darkColor.setFromColor(n.darkColor),s.skipRender=s.clipped=!1;const l=(null==(t=r.region)?void 0:t.texture.texture)||e.Texture.EMPTY;s.texture!==l&&(s.texture=l,this.spineTexturesDirty=!0),Zs.isClipping()&&this.updateClippingData(s)}else if(r instanceof Wt){Zs.clipStart(n,r);continue}Zs.clipEndWithSlot(n)}Zs.clipEnd()}updateClippingData(t){t.clipped=!0,Zs.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:e,clippedUVs:s,clippedTriangles:i}=Zs,n=e.length/2,r=i.length;t.clippedData||(t.clippedData={vertices:new Float32Array(2*n),uvs:new Float32Array(2*n),vertexCount:n,indices:new Uint16Array(r),indicesCount:r},this.spineAttachmentsDirty=!0);const a=t.clippedData,o=a.vertexCount!==n||r!==a.indicesCount;t.skipRender=0===n,o&&(this.spineAttachmentsDirty=!0,a.vertexCount<n&&(a.vertices=new Float32Array(2*n),a.uvs=new Float32Array(2*n)),a.indices.length<r&&(a.indices=new Uint16Array(r)));const{vertices:l,uvs:h,indices:c}=a;for(let t=0;t<n;t++)l[2*t]=e[2*t],l[2*t+1]=e[2*t+1],h[2*t]=s[2*t],h[2*t+1]=s[2*t+1];a.vertexCount=n;for(let t=0;t<r;t++)c[t]!==i[t]&&(this.spineAttachmentsDirty=!0,c[t]=i[t]);a.indicesCount=r}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(t){const{slot:s,container:i}=t;if(i.visible=this.skeleton.drawOrder.includes(s),i.visible){const t=s.bone;i.position.set(t.worldX,t.worldY),i.scale.x=t.getWorldScaleX(),i.scale.y=t.getWorldScaleY(),i.rotation=t.getWorldRotationX()*e.DEG_TO_RAD,i.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(t,e){return this.attachmentCacheData[t.data.index][e.name]||this.initCachedData(t,e)}initCachedData(t,e){var s,i;let n;return e instanceof ie?(n=new Float32Array(8),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:n,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(e.uvs.length),color:new g(1,1,1,1),darkColor:new g(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:null==(s=e.region)?void 0:s.texture.texture}):(n=new Float32Array(e.worldVerticesLength),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:n,clipped:!1,indices:e.triangles,uvs:new Float32Array(e.uvs.length),color:new g(1,1,1,1),darkColor:new g(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:null==(i=e.region)?void 0:i.texture.texture}),this.attachmentCacheData[t.data.index][e.name]}onViewUpdate(){var t;if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),null==(t=this.debug)||t.renderDebug(this)}addSlotObject(t,e){var s;t=this.getSlotFromRef(t);for(const t in this._slotsObject)(null==(s=this._slotsObject[t])?void 0:s.container)===e&&this.removeSlotObject(this._slotsObject[t].slot);this.removeSlotObject(t),e.includeInBuild=!1,this.addChild(e);const i={container:e,slot:t};this._slotsObject[t.data.name]=i,this.updateSlotObject(i)}removeSlotObject(t){var s,i;let n;if(t instanceof e.Container){for(const e in this._slotsObject)if((null==(s=this._slotsObject[e])?void 0:s.container)===t){this._slotsObject[e]=null,n=t;break}}else{const e=this.getSlotFromRef(t);n=null==(i=this._slotsObject[e.data.name])?void 0:i.container,this._slotsObject[e.data.name]=null}n&&(this.removeChild(n),n.includeInBuild=!0)}getSlotObject(t){var e;return t=this.getSlotFromRef(t),null==(e=this._slotsObject[t.data.name])?void 0:e.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||(this.skeletonBounds=new Is);const t=this.skeletonBounds;if(t.update(this.skeleton,!0),t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const t=this.skeleton.drawOrder,e=this._bounds;e.clear();for(let s=0;s<t.length;s++){const i=t[s],n=i.getAttachment();if(n&&(n instanceof ie||n instanceof Zt)){const t=this._getCachedData(i,n);e.addVertexData(t.vertices,0,t.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),e.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,e){this.pixiWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}static from({skeleton:t,atlas:s,scale:i=1,darkTint:n,autoUpdate:r=!0}){const a=`${t}-${s}-${i}`;if(e.Cache.has(a))return new ei(e.Cache.get(a));const o=e.Assets.get(t),l=e.Assets.get(s),h=new le(l),c=o instanceof Uint8Array?new _e(h):new Ys(h);c.scale=i;const d=c.readSkeletonData(o);return console.log(">>>skeletonData",d),e.Cache.set(a,d),new ei({skeletonData:d,darkTint:n,autoUpdate:r})}},si={AlphaTimeline:et,Animation:B,AnimationState:Mt,AnimationStateAdapter:class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},AnimationStateData:Ut,AssetManagerBase:class{constructor(t,e="",s=new me){this.pathPrefix="",this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${i}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${i}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${i}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this.success(e,t,this.textureLoader(i))},i.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),i.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let n=t.lastIndexOf("/"),r=n>=0?t.substring(0,n+1):"";t=this.start(t),this.downloader.downloadText(t,(n=>{try{let a=new Ht(n),o=a.pages.length,l=!1;for(let n of a.pages)this.loadTexture(i?i[n.name]:r+n.name,((s,i)=>{l||(n.setTexture(i),0==--o&&this.success(e,t,a))}),((e,i)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,i)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${i}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},AtlasAttachmentLoader:le,Attachment:S,AttachmentTimeline:nt,BinaryInput:Ne,BlendMode:Oe,Bone:de,BoneData:he,BoundingBoxAttachment:qt,CURRENT:Nt,ClippingAttachment:Wt,Color:g,ConstraintData:ue,CurveTimeline:L,CurveTimeline1:_,CurveTimeline2:N,DebugUtils:class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},DeformTimeline:rt,Downloader:me,DrawOrderTimeline:ht,Event:fe,EventData:ge,EventQueue:Xt,EventTimeline:ot,EventType:Bt,FIRST:Dt,FakeTexture:class extends zt{setFilters(t,e){}setWraps(t,e){}dispose(){}},HOLD_FIRST:Ot,HOLD_MIX:Lt,HOLD_SUBSEQUENT:Vt,IkConstraint:pe,IkConstraintData:xe,IkConstraintTimeline:ct,Inherit:ce,InheritTimeline:Q,IntSet:class{constructor(){this.array=new Array}add(t){let e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}},Interpolation:b,MathUtils:x,MeshAttachment:Zt,MixBlend:R,MixDirection:D,PathAttachment:te,PathConstraint:Ae,PathConstraintData:be,PathConstraintMixTimeline:ft,PathConstraintPositionTimeline:ut,PathConstraintSpacingTimeline:mt,Physics:Pe,PhysicsConstraintDampingTimeline:bt,PhysicsConstraintGravityTimeline:vt,PhysicsConstraintInertiaTimeline:pt,PhysicsConstraintMassTimeline:wt,PhysicsConstraintMixTimeline:kt,PhysicsConstraintResetTimeline:St,PhysicsConstraintStrengthTimeline:xt,PhysicsConstraintTimeline:gt,PhysicsConstraintWindTimeline:yt,PointAttachment:ee,Pool:k,PositionMode:we,Pow:w,PowOut:class extends w{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},RGB2Timeline:it,RGBA2Timeline:st,RGBATimeline:Z,RGBTimeline:tt,RegionAttachment:ie,RotateMode:ve,RotateTimeline:U,SETUP:_t,SUBSEQUENT:Rt,ScaleTimeline:G,ScaleXTimeline:j,ScaleYTimeline:$,SequenceTimeline:Tt,ShearTimeline:H,ShearXTimeline:J,ShearYTimeline:K,Skeleton:Me,SkeletonBinary:_e,SkeletonBounds:Is,SkeletonClipping:Fs,SkeletonData:Be,SkeletonJson:Ys,Skin:De,SkinEntry:Re,Slot:Ce,SlotData:Ve,SpacingMode:ye,Spine:ei,SpineDebugRenderer:class{constructor(){this.registeredSpines=new Map,this.drawMeshHull=!0,this.drawMeshTriangles=!0,this.drawBones=!0,this.drawPaths=!0,this.drawBoundingBoxes=!0,this.drawClipping=!0,this.drawRegionAttachments=!0,this.drawEvents=!0,this.lineWidth=1,this.regionAttachmentsColor=30975,this.meshHullColor=30975,this.meshTrianglesColor=16763904,this.clippingPolygonColor=16711935,this.boundingBoxesRectColor=65280,this.boundingBoxesPolygonColor=65280,this.boundingBoxesCircleColor=65280,this.pathsCurveColor=16711680,this.pathsLineColor=16711935,this.skeletonXYColor=16711680,this.bonesColor=61132,this.eventFontSize=24,this.eventFontColor=0}registerSpine(t){if(this.registeredSpines.has(t))return void console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);const s={parentDebugContainer:new e.Container,bones:new e.Container,skeletonXY:new e.Graphics,regionAttachmentsShape:new e.Graphics,meshTrianglesLine:new e.Graphics,meshHullLine:new e.Graphics,clippingPolygon:new e.Graphics,boundingBoxesRect:new e.Graphics,boundingBoxesCircle:new e.Graphics,boundingBoxesPolygon:new e.Graphics,pathsCurve:new e.Graphics,pathsLine:new e.Graphics,eventText:new e.Container,eventCallback:{event:(i,n)=>{if(this.drawEvents){const i=Math.abs(t.scale.x||t.scale.y||1),r=new e.Text({text:n.data.name,style:{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"}});r.scale.x=Math.sign(t.scale.x),r.anchor.set(.5),s.eventText.addChild(r),setTimeout((()=>{r.destroyed||r.destroy()}),250)}}}};s.parentDebugContainer.addChild(s.bones),s.parentDebugContainer.addChild(s.skeletonXY),s.parentDebugContainer.addChild(s.regionAttachmentsShape),s.parentDebugContainer.addChild(s.meshTrianglesLine),s.parentDebugContainer.addChild(s.meshHullLine),s.parentDebugContainer.addChild(s.clippingPolygon),s.parentDebugContainer.addChild(s.boundingBoxesRect),s.parentDebugContainer.addChild(s.boundingBoxesCircle),s.parentDebugContainer.addChild(s.boundingBoxesPolygon),s.parentDebugContainer.addChild(s.pathsCurve),s.parentDebugContainer.addChild(s.pathsLine),s.parentDebugContainer.addChild(s.eventText),s.parentDebugContainer.zIndex=9999999,s.parentDebugContainer.accessibleChildren=!1,s.parentDebugContainer.eventMode="none",s.parentDebugContainer.interactiveChildren=!1,t.addChild(s.parentDebugContainer),t.state.addListener(s.eventCallback),this.registeredSpines.set(t,s)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let t=e.bones.children.length;t>0;t--)e.bones.children[t-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,i,s),this.drawPaths&&this.drawPathsFunc(t,e,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,i),this.drawClipping&&this.drawClippingFunc(t,e,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,i),this.drawEvents)for(const t of e.eventText.children)t.alpha-=.05,t.y-=2}drawBonesFunc(t,s,i,n){const r=t.skeleton,a=r.x,o=r.y,l=r.bones;s.skeletonXY.strokeStyle={width:i,color:this.skeletonXYColor};for(let t=0,r=l.length;t<r;t++){const r=l[t],h=r.data.length,c=a+r.worldX,d=o+r.worldY,u=a+h*r.a+r.worldX,m=o+h*r.b+r.worldY;if("root"===r.data.name||null===r.data.parent)continue;const f=Math.abs(c-u),g=Math.abs(d-m),p=Math.pow(f,2),x=g,b=Math.pow(g,2),w=Math.sqrt(p+b),y=Math.pow(w,2),v=Math.PI/180,k=Math.acos((y+b-p)/(2*x*w))||0;if(0===w)continue;const A=new e.Graphics;s.bones.addChild(A);const S=w/50/n;A.context.poly([0,0,0-S,w-3*S,0,w-S,0+S,w-3*S]).fill(this.bonesColor),A.x=c,A.y=d,A.pivot.y=w;let C=0;c<u&&d<m?C=180*v-k:c>u&&d<m?C=180*v+k:c>u&&d>m?C=-k:c<u&&d>m?C=k:d===m&&c<u?C=90*v:d===m&&c>u?C=-90*v:c===u&&d<m?C=180*v:c===u&&d>m&&(C=0),A.rotation=C,A.circle(0,w,1.2*S).fill({color:0,alpha:.6}).stroke({width:i+S/2.4,color:this.bonesColor})}const h=3*i;s.skeletonXY.context.moveTo(a-h,o-h).lineTo(a+h,o+h).moveTo(a+h,o-h).lineTo(a-h,o+h).stroke()}drawRegionAttachmentsFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t],n=s.getAttachment();if(null===n||!(n instanceof ie))continue;const r=n,a=new Float32Array(8);r.computeWorldVertices(s,a,0,2),e.regionAttachmentsShape.poly(Array.from(a.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Zt))continue;const r=n,a=new Float32Array(r.worldVerticesLength),o=r.triangles;let l=r.hullLength;if(r.computeWorldVertices(s,0,r.worldVerticesLength,a,0,2),this.drawMeshTriangles)for(let t=0,s=o.length;t<s;t+=3){const s=2*o[t],i=2*o[t+1],n=2*o[t+2];e.meshTrianglesLine.context.moveTo(a[s],a[s+1]).lineTo(a[i],a[i+1]).lineTo(a[n],a[n+1])}if(this.drawMeshHull&&l>0){l=2*(l>>1);let t=a[l-2],s=a[l-1];for(let i=0,n=l;i<n;i+=2){const n=a[i],r=a[i+1];e.meshHullLine.context.moveTo(n,r).lineTo(t,s),t=n,s=r}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Wt))continue;const r=n,a=r.worldVerticesLength,o=new Float32Array(a);r.computeWorldVertices(s,0,a,o,0,2),e.clippingPolygon.poly(Array.from(o))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const i=new Is;i.update(t.skeleton,!0),i.minX!==1/0&&e.boundingBoxesRect.rect(i.minX,i.minY,i.getWidth(),i.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const n=i.polygons,r=(t,i,n)=>{if(n<3)throw new Error("Polygon must contain at least 3 vertices");const r=[],a=2*s;for(let s=0,i=t.length;s<i;s+=2){const i=t[s],n=t[s+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(i,n,a),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(i,n,a).fill({color:this.boundingBoxesCircleColor}),r.push(i,n)}e.boundingBoxesPolygon.poly(r).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let t=0,e=n.length;t<e;t++){const e=n[t];r(e,0,e.length)}}drawPathsFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof te))continue;const r=n;let a=r.worldVerticesLength;const o=new Float32Array(a);r.computeWorldVertices(s,0,a,o,0,2);let l=o[2],h=o[3],c=0,d=0;if(r.closed){const t=o[0],s=o[1],i=o[a-2],n=o[a-1];c=o[a-4],d=o[a-3],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(t,s,i,n,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(t,s),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(i,n)}a-=4;for(let t=4;t<a;t+=6){const s=o[t],i=o[t+1],n=o[t+2],r=o[t+3];c=o[t+4],d=o[t+5],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(s,i,n,r,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(s,i),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(n,r),l=c,h=d}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}},SpinePipe:Ks,SpineTexture:Vs,StringSet:m,Texture:zt,TextureAtlas:Ht,TextureAtlasPage:Kt,TextureAtlasRegion:Qt,TextureFilter:Gt,TextureRegion:$t,TextureWrap:jt,TimeKeeper:class{constructor(){this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.frameTime=0}update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Timeline:O,TrackEntry:Pt,TransformConstraint:Te,TransformConstraintData:Le,TransformConstraintTimeline:dt,TranslateTimeline:q,TranslateXTimeline:W,TranslateYTimeline:z,Triangulator:Ms,Utils:v,Vector2:A,VertexAttachment:T,WindowedMean:class{constructor(t=32){this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}};function ii(t){return function(e,s){var i=function(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}(e,s);i.key=s,i.type=t}}function ni(t,e,s,i){var n,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,i);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,s,a):n(e,s))||a);return r>3&&a&&Object.defineProperty(e,s,a),a}function ri(t,e,s,i){return new(s||(s=Promise))((function(n,r){function a(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){t.done?n(t.value):new s((function(e){e(t.value)})).then(a,o)}l((i=i.apply(t,e||[])).next())}))}class ai extends s.Component{constructor(){super(...arguments),this.resource="",this.scale=1,this.animationName="",this.autoPlay=!0,this.waitExecuteInfos=[]}set armature(t){if(this._armature=t,t){this.autoPlay&&this.play(this.animationName);for(const t of this.waitExecuteInfos)if(t.playType){const{name:e,loop:s,track:i}=t;this.play(e,s,i)}else this.stop(t.track);this.waitExecuteInfos=[]}}get armature(){return this._armature}init(t){t&&_extends(this,t)}onDestroy(){this.destroied=!0}play(t,e,s){try{t&&(this.animationName=t),this.armature?(void 0===s&&(s=0),this.armature.state.setAnimation(s,this.animationName,e)):this.waitExecuteInfos.push({playType:!0,name:t,loop:null!=e?e:this.autoPlay,track:s})}catch(t){console.log(t)}}stop(t){this.armature?(void 0===t&&(t=0),this.armature.state.setEmptyAnimation(t,0)):this.waitExecuteInfos.push({playType:!1,track:t})}addAnimation(t,e,s,i){try{this.armature&&(void 0===i&&(i=0),this.armature.state.addAnimation(i,t,s,e))}catch(t){console.log(t)}}setMix(t,e,s){this.armature&&this.armature.state.data.setMix(t,e,s)}getAnim(t=0){try{if(this.armature)return this.armature.state.tracks[t].animation.name}catch(t){console.log(t)}}setDefaultMix(t){this.armature&&(this.armature.state.data.defaultMix=t)}setAttachment(t,e){this.armature&&this.armature.skeleton.setAttachment(t,e)}getBone(t){if(this.armature)return this.armature.skeleton.findBone(t)}}ai.componentName="Spine",ni([ii("string")],ai.prototype,"resource",void 0),ni([ii("number")],ai.prototype,"scale",void 0),ni([ii("string")],ai.prototype,"animationName",void 0),ni([ii("boolean")],ai.prototype,"autoPlay",void 0);let oi={};function li(t,e,s){return ri(this,void 0,void 0,(function*(){let i=oi[t.name];if(!i)if(t.complete)i=function(t,e,s,i){const n=e.ske,r=e.atlas,a=new i.AtlasAttachmentLoader(r),o=n instanceof Uint8Array?new i.SkeletonBinary(a):new i.SkeletonJson(a);o.scale=s||1;const l={spineData:o.readSkeletonData(n),ref:0,imageSrc:e.image.label};return oi[t]=l,l}(t.name,t.data,e,s);else if(!i)return;return i.ref++,i.spineData}))}let hi=class extends i.Renderer{constructor(){super(...arguments),this.armatures={}}init({pixiSpine:t}){this.renderSystem=this.game.getSystem(i.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=t,this.game.canvas.addEventListener("webglcontextrestored",(()=>{const t=this.game.gameObjects;let e=[];for(let i in this.armatures){const n=+i;for(let i=0;i<t.length;++i){let r=t[i];if(r.id===n){let t=r.getComponent(ai);t&&(this.remove({type:s.OBSERVER_TYPE.REMOVE,gameObject:r,component:t,componentName:ai.componentName}),e.push({type:s.OBSERVER_TYPE.ADD,gameObject:r,component:t,componentName:ai.componentName}));break}}}setTimeout((()=>{e.forEach((t=>{this.add(t)}))}),1e3)}),!1)}update(t){for(let e in this.armatures)this.armatures[e].update(.001*t.deltaTime);super.update()}componentChanged(t){return ri(this,void 0,void 0,(function*(){if("Spine"===t.componentName)if(t.type===s.OBSERVER_TYPE.ADD)this.add(t);else if(t.type===s.OBSERVER_TYPE.CHANGE){if("resource"===t.prop.prop[0])this.change(t)}else t.type===s.OBSERVER_TYPE.REMOVE&&this.remove(t)}))}add(t,e){var i,n;return ri(this,void 0,void 0,(function*(){const r=t.component;clearTimeout(r.addHandler);const a=t.gameObject.id,o=this.increaseAsyncId(a),l=yield s.resource.getResource(r.resource);if(!this.validateAsyncId(a,o))return;const h=yield li(l,r.scale,this.pixiSpine);if(!this.validateAsyncId(a,o))return;if(!h)return void(r.addHandler=setTimeout((()=>{r.destroied||(void 0===e&&(e=20),--e>0?this.add(t,e):console.log("retry exceed max times",r.resource))}),1e3));this.remove(t);const c=null===(n=null===(i=this.renderSystem)||void 0===i?void 0:i.containerManager)||void 0===n?void 0:n.getContainer(t.gameObject.id);if(!c)return;r.lastResource=r.resource;const d=new this.pixiSpine.Spine({skeletonData:h,autoUpdate:!1});if(this.armatures[t.gameObject.id]=d,t.gameObject&&t.gameObject.transform){const e=t.gameObject.transform;d.x=e.size.width*e.origin.x,d.y=e.size.height*e.origin.y}c.addChildAt(d,0),d.update(),r.armature=d,r.emit("loaded",{resource:r.resource}),d.state.addListener({start:(t,e)=>{r.emit("start",{track:t,name:t.animation.name})},complete:(t,e)=>{r.emit("complete",{track:t,name:t.animation.name})},interrupt:(t,e)=>{r.emit("interrupt",{track:t,name:t.animation.name})},end:(t,e)=>{r.emit("end",{track:t,name:t.animation.name})},event:(t,e)=>{r.emit("event",t,e)}})}))}change(t){this.remove(t),this.add(t)}remove(t){var i,n,r,a,o,l;return ri(this,void 0,void 0,(function*(){this.increaseAsyncId(t.gameObject.id);const h=t.component;clearTimeout(h.addHandler);const c=this.armatures[t.gameObject.id],d=null===(n=null===(i=this.renderSystem)||void 0===i?void 0:i.containerManager)||void 0===n?void 0:n.getContainer(t.gameObject.id);if(d&&c&&d.removeChild(c),h.armature){h.armature.destroy({children:!0});const t=yield s.resource.getResource(h.lastResource);(null===(a=null===(r=t.data)||void 0===r?void 0:r.image)||void 0===a?void 0:a.src)||null===(l=null===(o=t.data)||void 0===o?void 0:o.image)||void 0===l||l.label,yield function(t){const i=t.name,n=oi[i];n&&(n.ref--,setTimeout((()=>ri(this,void 0,void 0,(function*(){if(n.ref<=0){yield e.Assets.unload([t.src.image.url,t.src.atlas.url,t.src.ske.url]);const n=e.Assets.resolver;delete n._assetMap[t.src.image.url],delete n._assetMap[t.src.atlas.url],delete n._assetMap[t.src.ske.url],delete n._resolverHash[t.src.image.url],delete n._resolverHash[t.src.atlas.url],delete n._resolverHash[t.src.ske.url],s.resource.destroy(i),delete oi[i]}}))),100))}(t)}h.armature=null,delete this.armatures[t.gameObject.id],t.type,s.OBSERVER_TYPE.CHANGE}))}};hi.systemName="SpineSystem",hi=ni([s.decorators.componentObserver({Spine:["resource"]})],hi);var ci=hi;s.resource.registerResourceType("SPINE");return t.PixiSpine=si,t.Spine=class extends ai{},t.SpineSystem=class extends ci{init(){super.init({pixiSpine:si})}},Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,EVA,EVA.plugin.renderer);globalThis.EVA.plugin.renderer.spine=globalThis.EVA.plugin.renderer.spine||_EVA_IIFE_spine;
|
|
1
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var i in s)({}).hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_spine=function(t,e,s,i){"use strict";var n=Object.defineProperty,r=Object.defineProperties,a=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,c=(t,e,s)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,d=(t,e)=>{for(var s in e||(e={}),e)l.call(e,s)&&c(t,s,e[s]);if(o)for(var s of o(e))h.call(e,s)&&c(t,s,e[s]);return t},u=(t,e,s)=>new Promise(((i,n)=>{var r=t=>{try{o(s.next(t))}catch(t){n(t)}},a=t=>{try{o(s.throw(t))}catch(t){n(t)}},o=t=>t.done?i(t.value):Promise.resolve(t.value).then(r,a);o((s=s.apply(t,e)).next())}));if("undefined"!=typeof window&&window.PIXI){const t=window.require;window.require=e=>t?t(e):e.startsWith("@pixi/")||e.startsWith("pixi.js")?window.PIXI:void 0}var m=class{constructor(){this.entries={},this.size=0}add(t){let e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}addAll(t){let e=this.size;for(var s=0,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}},f=class{constructor(t=0,e=0,s=0,i=0){this.r=t,this.g=e,this.b=s,this.a=i}set(t,e,s,i){return this.r=t,this.g=e,this.b=s,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=8!=t.length?1:parseInt(t.substr(6,2),16)/255,this}add(t,e,s,i){return this.r+=t,this.g+=e,this.b+=s,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,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255}static rgb888ToColor(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}toRgb888(){const t=t=>("0"+(255*t).toString(16)).slice(-2);return Number("0x"+t(this.r)+t(this.g)+t(this.b))}static fromString(t){return(new f).setFromString(t)}},g=f;g.WHITE=new f(1,1,1,1),g.RED=new f(1,0,0,1),g.GREEN=new f(0,1,0,1),g.BLUE=new f(0,0,1,1),g.MAGENTA=new f(1,0,1,1);var p=class{static clamp(t,e,s){return t<e?e:t>s?s:t}static cosDeg(t){return Math.cos(t*p.degRad)}static sinDeg(t){return Math.sin(t*p.degRad)}static atan2Deg(t,e){return Math.atan2(t,e)*p.degRad}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){let e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}static randomTriangular(t,e){return p.randomTriangularWith(t,e,.5*(t+e))}static randomTriangularWith(t,e,s){let i=Math.random(),n=e-t;return i<=(s-t)/n?t+Math.sqrt(i*n*(s-t)):e-Math.sqrt((1-i)*n*(e-s))}static isPowerOfTwo(t){return t&&!(t&t-1)}},x=p;x.PI=3.1415927,x.PI2=2*p.PI,x.invPI2=1/p.PI2,x.radiansToDegrees=180/p.PI,x.radDeg=p.radiansToDegrees,x.degreesToRadians=p.PI/180,x.degRad=p.degreesToRadians;var b=class{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}},w=class extends b{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}},y=class{static arrayCopy(t,e,s,i,n){for(let r=e,a=i;r<e+n;r++,a++)s[a]=t[r]}static arrayFill(t,e,s,i){for(let n=e;n<s;n++)t[n]=i}static setArraySize(t,e,s=0){let i=t.length;if(i==e)return t;if(t.length=e,i<e)for(let n=i;n<e;n++)t[n]=s;return t}static ensureArrayCapacity(t,e,s=0){return t.length>=e?t:y.setArraySize(t,e,s)}static newArray(t,e){let s=new Array(t);for(let i=0;i<t;i++)s[i]=e;return s}static newFloatArray(t){if(y.SUPPORTS_TYPED_ARRAYS)return new Float32Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static newShortArray(t){if(y.SUPPORTS_TYPED_ARRAYS)return new Int16Array(t);{let e=new Array(t);for(let t=0;t<e.length;t++)e[t]=0;return e}}static toFloatArray(t){return y.SUPPORTS_TYPED_ARRAYS?new Float32Array(t):t}static toSinglePrecision(t){return y.SUPPORTS_TYPED_ARRAYS?Math.fround(t):t}static webkit602BugfixHelper(t,e){}static contains(t,e,s=!0){for(var i=0;i<t.length;i++)if(t[i]==e)return!0;return!1}static enumValue(t,e){return t[e[0].toUpperCase()+e.slice(1)]}},v=y;v.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var k=class{constructor(t){this.items=new Array,this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}},A=class{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){let t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){let t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}},S=class{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}},C=class extends S{constructor(t){super(t),this.id=C.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVertices(t,e,s,i,n,r){s=n+(s>>1)*r;let a=t.bone.skeleton,o=t.deform,l=this.vertices,h=this.bones;if(!h){o.length>0&&(l=o);let a=t.bone,h=a.worldX,c=a.worldY,d=a.a,u=a.b,m=a.c,f=a.d;for(let t=e,a=n;a<s;t+=2,a+=r){let e=l[t],s=l[t+1];i[a]=e*d+s*u+h,i[a+1]=e*m+s*f+c}return}let c=0,d=0;for(let t=0;t<e;t+=2){let t=h[c];c+=t+1,d+=t}let u=a.bones;if(0==o.length)for(let t=n,e=3*d;t<s;t+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,e+=3){let t=u[h[c]],i=l[e],r=l[e+1],a=l[e+2];s+=(i*t.a+r*t.b+t.worldX)*a,n+=(i*t.c+r*t.d+t.worldY)*a}i[t]=s,i[t+1]=n}else{let t=o;for(let e=n,a=3*d,o=d<<1;e<s;e+=r){let s=0,n=0,r=h[c++];for(r+=c;c<r;c++,a+=3,o+=2){let e=u[h[c]],i=l[a]+t[o],r=l[a+1]+t[o+1],d=l[a+2];s+=(i*e.a+r*e.b+e.worldX)*d,n+=(i*e.c+r*e.d+e.worldY)*d}i[e]=s,i[e+1]=n}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),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=C;T.nextID=0;var I=class{constructor(t){this.id=I.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(t)}copy(){let t=new I(this.regions.length);return v.arrayCopy(this.regions,0,t.regions,0,this.regions.length),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,t}apply(t,e){let s=t.sequenceIndex;-1==s&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let i=this.regions[s];e.region!=i&&(e.region=i,e.updateRegion())}getPath(t,e){let s=t,i=(this.start+e).toString();for(let t=this.digits-i.length;t>0;t--)s+="0";return s+=i,s}static nextID(){return I._nextID++}},M=I;M._nextID=0;var F,Y,E,P=((F=P||{})[F.hold=0]="hold",F[F.once=1]="once",F[F.loop=2]="loop",F[F.pingpong=3]="pingpong",F[F.onceReverse=4]="onceReverse",F[F.loopReverse=5]="loopReverse",F[F.pingpongReverse=6]="pingpongReverse",F),X=[0,1,2,3,4,5,6],B=class{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new m,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,i,n,r,a,o){if(!t)throw new Error("skeleton cannot be null.");i&&0!=this.duration&&(s%=this.duration,e>0&&(e%=this.duration));let l=this.timelines;for(let i=0,h=l.length;i<h;i++)l[i].apply(t,e,s,n,r,a,o)}},R=((Y=R||{})[Y.setup=0]="setup",Y[Y.first=1]="first",Y[Y.replace=2]="replace",Y[Y.add=3]="add",Y),D=((E=D||{})[E.mixIn=0]="mixIn",E[E.mixOut=1]="mixOut",E),V={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28},O=class{constructor(t,e){this.propertyIds=e,this.frames=v.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){let s=t.length;for(let i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){let i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}},L=class extends O{constructor(t,e,s){super(t,s),this.curves=v.newFloatArray(t+18*e),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let e=this.getFrameCount()+18*t;if(this.curves.length>e){let t=v.newFloatArray(e);v.arrayCopy(this.curves,0,t,0,e),this.curves=t}}setBezier(t,e,s,i,n,r,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*r+o),f=.03*(n-2*a+l),g=.006*(3*(r-o)-i+h),p=.006*(3*(a-l)-n+c),x=2*m+g,b=2*f+p,w=.3*(r-i)+m+.16666667*g,y=.3*(a-n)+f+.16666667*p,v=i+w,k=n+y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,w+=x,y+=b,x+=g,b+=p,v+=w,k+=y}getBezierValue(t,e,s,i){let n=this.curves;if(n[i]>t){let r=this.frames[e],a=this.frames[e+s];return a+(t-r)/(n[i]-r)*(n[i+1]-a)}let r=i+18;for(i+=2;i<r;i+=2)if(n[i]>=t){let e=n[i-2],s=n[i-1];return s+(t-e)/(n[i]-e)*(n[i+1]-s)}e+=this.getFrameEntries();let a=n[r-2],o=n[r-1];return o+(t-a)/(this.frames[e]-a)*(this.frames[e+s]-o)}},_=class extends L{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){let e=this.frames,s=e.length-2;for(let i=2;i<=s;i+=2)if(e[i]>t){s=i-2;break}let i=this.curves[s>>1];switch(i){case 0:let i=e[s],n=e[s+1];return n+(t-i)/(e[s+2]-i)*(e[s+2+1]-n);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}getRelativeValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}let r=this.getCurveValue(t);switch(s){case 0:return n+r*e;case 1:case 2:r+=n-i}return i+r*e}getAbsoluteValue(t,e,s,i,n){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}let r=this.getCurveValue(t);return 0==s?n+(r-n)*e:i+(r-i)*e}getAbsoluteValue2(t,e,s,i,n,r){if(t<this.frames[0]){switch(s){case 0:return n;case 1:return i+(n-i)*e}return i}return 0==s?n+(r-n)*e:i+(r-i)*e}getScaleValue(t,e,s,i,n,r){if(t<this.frames[0]){switch(s){case 0:return r;case 1:return n+(r-n)*e}return n}let a=this.getCurveValue(t)*r;if(1==e)return 3==s?n+a-r:a;if(1==i)switch(s){case 0:return r+(Math.abs(a)*x.signum(r)-r)*e;case 1:case 2:return n+(Math.abs(a)*x.signum(n)-n)*e}else{let t=0;switch(s){case 0:return t=Math.abs(r)*x.signum(a),t+(a-t)*e;case 1:case 2:return t=Math.abs(n)*x.signum(a),t+(a-t)*e}}return n+(a-r)*e}},N=class extends L{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}},U=class extends _{constructor(t,e,s){super(t,e,V.rotate+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.rotation=this.getRelativeValue(s,n,r,o.rotation,o.data.rotation))}},q=class extends N{constructor(t,e,s){super(t,e,V.x+"|"+s,V.y+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.x=o.data.x,void(o.y=o.data.y);case 1:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let h=0,c=0,d=O.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(r){case 0:o.x=o.data.x+h*n,o.y=o.data.y+c*n;break;case 1:case 2:o.x+=(o.data.x+h-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case 3:o.x+=h*n,o.y+=c*n}}},W=class extends _{constructor(t,e,s){super(t,e,V.x+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.x=this.getRelativeValue(s,n,r,o.x,o.data.x))}},z=class extends _{constructor(t,e,s){super(t,e,V.y+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.y=this.getRelativeValue(s,n,r,o.y,o.data.y))}},G=class extends N{constructor(t,e,s){super(t,e,V.scaleX+"|"+s,V.scaleY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l,h,c=this.frames;if(s<c[0]){switch(r){case 0:return o.scaleX=o.data.scaleX,void(o.scaleY=o.data.scaleY);case 1:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let d=O.search(c,s,3),u=this.curves[d/3];switch(u){case 0:let t=c[d];l=c[d+1],h=c[d+2];let e=(s-t)/(c[d+3]-t);l+=(c[d+3+1]-l)*e,h+=(c[d+3+2]-h)*e;break;case 1:l=c[d+1],h=c[d+2];break;default:l=this.getBezierValue(s,d,1,u-2),h=this.getBezierValue(s,d,2,u+18-2)}if(l*=o.data.scaleX,h*=o.data.scaleY,1==n)3==r?(o.scaleX+=l-o.data.scaleX,o.scaleY+=h-o.data.scaleY):(o.scaleX=l,o.scaleY=h);else{let t=0,e=0;if(1==a)switch(r){case 0:t=o.data.scaleX,e=o.data.scaleY,o.scaleX=t+(Math.abs(l)*x.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*x.signum(e)-e)*n;break;case 1:case 2:t=o.scaleX,e=o.scaleY,o.scaleX=t+(Math.abs(l)*x.signum(t)-t)*n,o.scaleY=e+(Math.abs(h)*x.signum(e)-e)*n;break;case 3:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}else switch(r){case 0:t=Math.abs(o.data.scaleX)*x.signum(l),e=Math.abs(o.data.scaleY)*x.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case 1:case 2:t=Math.abs(o.scaleX)*x.signum(l),e=Math.abs(o.scaleY)*x.signum(h),o.scaleX=t+(l-t)*n,o.scaleY=e+(h-e)*n;break;case 3:o.scaleX+=(l-o.data.scaleX)*n,o.scaleY+=(h-o.data.scaleY)*n}}}},j=class extends _{constructor(t,e,s){super(t,e,V.scaleX+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleX=this.getScaleValue(s,n,r,a,o.scaleX,o.data.scaleX))}},$=class extends _{constructor(t,e,s){super(t,e,V.scaleY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.scaleY=this.getScaleValue(s,n,r,a,o.scaleY,o.data.scaleY))}},H=class extends N{constructor(t,e,s){super(t,e,V.shearX+"|"+s,V.shearY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.shearX=o.data.shearX,void(o.shearY=o.data.shearY);case 1:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let h=0,c=0,d=O.search(l,s,3),u=this.curves[d/3];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+3]-t);h+=(l[d+3+1]-h)*e,c+=(l[d+3+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}switch(r){case 0:o.shearX=o.data.shearX+h*n,o.shearY=o.data.shearY+c*n;break;case 1:case 2:o.shearX+=(o.data.shearX+h-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case 3:o.shearX+=h*n,o.shearY+=c*n}}},J=class extends _{constructor(t,e,s){super(t,e,V.shearX+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.shearX=this.getRelativeValue(s,n,r,o.shearX,o.data.shearX))}},K=class extends _{constructor(t,e,s){super(t,e,V.shearY+"|"+s),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];o.active&&(o.shearY=this.getRelativeValue(s,n,r,o.shearY,o.data.shearY))}},Q=class extends O{constructor(t,e){super(t,[V.inherit+"|"+e]),this.boneIndex=0,this.boneIndex=e}getFrameEntries(){return 2}setFrame(t,e,s){t*=2,this.frames[t]=e,this.frames[t+1]=s}apply(t,e,s,i,n,r,a){let o=t.bones[this.boneIndex];if(!o.active)return;if(1==a)return void(0==r&&(o.inherit=o.data.inherit));let l=this.frames;s<l[0]?0!=r&&1!=r||(o.inherit=o.data.inherit):o.inherit=this.frames[O.search(l,s,2)+1]}},Z=class extends L{constructor(t,e,s){super(t,e,[V.rgb+"|"+s,V.alpha+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,r){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(r){case 0:return void h.setFromColor(t);case 1:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n)}return}let c=0,d=0,u=0,m=0,f=O.search(l,s,5),g=this.curves[f/5];switch(g){case 0:let t=l[f];c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];let e=(s-t)/(l[f+5]-t);c+=(l[f+5+1]-c)*e,d+=(l[f+5+2]-d)*e,u+=(l[f+5+3]-u)*e,m+=(l[f+5+4]-m)*e;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3],m=l[f+4];break;default:c=this.getBezierValue(s,f,1,g-2),d=this.getBezierValue(s,f,2,g+18-2),u=this.getBezierValue(s,f,3,g+36-2),m=this.getBezierValue(s,f,4,g+54-2)}1==n?h.set(c,d,u,m):(0==r&&h.setFromColor(o.data.color),h.add((c-h.r)*n,(d-h.g)*n,(u-h.b)*n,(m-h.a)*n))}},tt=class extends L{constructor(t,e,s){super(t,e,[V.rgb+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color;if(s<l[0]){let t=o.data.color;switch(r){case 0:return h.r=t.r,h.g=t.g,void(h.b=t.b);case 1:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n}return}let c=0,d=0,u=0,m=O.search(l,s,4),f=this.curves[m>>2];switch(f){case 0:let t=l[m];c=l[m+1],d=l[m+2],u=l[m+3];let e=(s-t)/(l[m+4]-t);c+=(l[m+4+1]-c)*e,d+=(l[m+4+2]-d)*e,u+=(l[m+4+3]-u)*e;break;case 1:c=l[m+1],d=l[m+2],u=l[m+3];break;default:c=this.getBezierValue(s,m,1,f-2),d=this.getBezierValue(s,m,2,f+18-2),u=this.getBezierValue(s,m,3,f+36-2)}if(1==n)h.r=c,h.g=d,h.b=u;else{if(0==r){let t=o.data.color;h.r=t.r,h.g=t.g,h.b=t.b}h.r+=(c-h.r)*n,h.g+=(d-h.g)*n,h.b+=(u-h.b)*n}}},et=class extends _{constructor(t,e,s){super(t,e,V.alpha+"|"+s),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.color;if(s<this.frames[0]){let t=o.data.color;switch(r){case 0:return void(l.a=t.a);case 1:l.a+=(t.a-l.a)*n}return}let h=this.getCurveValue(s);1==n?l.a=h:(0==r&&(l.a=o.data.color.a),l.a+=(h-l.a)*n)}},st=class extends L{constructor(t,e,s){super(t,e,[V.rgb+"|"+s,V.alpha+"|"+s,V.rgb2+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,r,a,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=a,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(r){case 0:return h.setFromColor(t),c.r=e.r,c.g=e.g,void(c.b=e.b);case 1:h.add((t.r-h.r)*n,(t.g-h.g)*n,(t.b-h.b)*n,(t.a-h.a)*n),c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=0,b=O.search(l,s,8),w=this.curves[b>>3];switch(w){case 0:let t=l[b];d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],g=l[b+5],p=l[b+6],x=l[b+7];let e=(s-t)/(l[b+8]-t);d+=(l[b+8+1]-d)*e,u+=(l[b+8+2]-u)*e,m+=(l[b+8+3]-m)*e,f+=(l[b+8+4]-f)*e,g+=(l[b+8+5]-g)*e,p+=(l[b+8+6]-p)*e,x+=(l[b+8+7]-x)*e;break;case 1:d=l[b+1],u=l[b+2],m=l[b+3],f=l[b+4],g=l[b+5],p=l[b+6],x=l[b+7];break;default:d=this.getBezierValue(s,b,1,w-2),u=this.getBezierValue(s,b,2,w+18-2),m=this.getBezierValue(s,b,3,w+36-2),f=this.getBezierValue(s,b,4,w+54-2),g=this.getBezierValue(s,b,5,w+72-2),p=this.getBezierValue(s,b,6,w+90-2),x=this.getBezierValue(s,b,7,w+108-2)}if(1==n)h.set(d,u,m,f),c.r=g,c.g=p,c.b=x;else{if(0==r){h.setFromColor(o.data.color);let t=o.data.darkColor;c.r=t.r,c.g=t.g,c.b=t.b}h.add((d-h.r)*n,(u-h.g)*n,(m-h.b)*n,(f-h.a)*n),c.r+=(g-c.r)*n,c.g+=(p-c.g)*n,c.b+=(x-c.b)*n}}},it=class extends L{constructor(t,e,s){super(t,e,[V.rgb+"|"+s,V.rgb2+"|"+s]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,r,a,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r,this.frames[t+5]=a,this.frames[t+6]=o}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=this.frames,h=o.color,c=o.darkColor;if(s<l[0]){let t=o.data.color,e=o.data.darkColor;switch(r){case 0:return h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,void(c.b=e.b);case 1:h.r+=(t.r-h.r)*n,h.g+=(t.g-h.g)*n,h.b+=(t.b-h.b)*n,c.r+=(e.r-c.r)*n,c.g+=(e.g-c.g)*n,c.b+=(e.b-c.b)*n}return}let d=0,u=0,m=0,f=0,g=0,p=0,x=O.search(l,s,7),b=this.curves[x/7];switch(b){case 0:let t=l[x];d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];let e=(s-t)/(l[x+7]-t);d+=(l[x+7+1]-d)*e,u+=(l[x+7+2]-u)*e,m+=(l[x+7+3]-m)*e,f+=(l[x+7+4]-f)*e,g+=(l[x+7+5]-g)*e,p+=(l[x+7+6]-p)*e;break;case 1:d=l[x+1],u=l[x+2],m=l[x+3],f=l[x+4],g=l[x+5],p=l[x+6];break;default:d=this.getBezierValue(s,x,1,b-2),u=this.getBezierValue(s,x,2,b+18-2),m=this.getBezierValue(s,x,3,b+36-2),f=this.getBezierValue(s,x,4,b+54-2),g=this.getBezierValue(s,x,5,b+72-2),p=this.getBezierValue(s,x,6,b+90-2)}if(1==n)h.r=d,h.g=u,h.b=m,c.r=f,c.g=g,c.b=p;else{if(0==r){let t=o.data.color,e=o.data.darkColor;h.r=t.r,h.g=t.g,h.b=t.b,c.r=e.r,c.g=e.g,c.b=e.b}h.r+=(d-h.r)*n,h.g+=(u-h.g)*n,h.b+=(m-h.b)*n,c.r+=(f-c.r)*n,c.g+=(g-c.g)*n,c.b+=(p-c.b)*n}}},nt=class extends O{constructor(t,e){super(t,[V.attachment+"|"+e]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];o.bone.active&&(1!=a?s<this.frames[0]?0!=r&&1!=r||this.setAttachment(t,o,o.data.attachmentName):this.setAttachment(t,o,this.attachmentNames[O.search1(this.frames,s)]):0==r&&this.setAttachment(t,o,o.data.attachmentName))}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},rt=class extends L{constructor(t,e,s,i){super(t,e,[V.deform+"|"+s+"|"+i.id]),this.slotIndex=0,this.slotIndex=s,this.attachment=i,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,i,n,r,a,o,l,h,c){let d=this.curves,u=this.getFrameCount()+18*t;0==s&&(d[e]=2+u);let m=.03*(i-2*r+o),f=.03*l-.06*a,g=.006*(3*(r-o)-i+h),p=.018*(a-l+.33333333),x=2*m+g,b=2*f+p,w=.3*(r-i)+m+.16666667*g,y=.3*a+f+.16666667*p,v=i+w,k=y;for(let t=u+18;u<t;u+=2)d[u]=v,d[u+1]=k,w+=x,y+=b,x+=g,b+=p,v+=w,k+=y}getCurvePercent(t,e){let s=this.curves,i=s[e];switch(i){case 0:let s=this.frames[e];return(t-s)/(this.frames[e+this.getFrameEntries()]-s);case 1:return 0}if(i-=2,s[i]>t){let n=this.frames[e];return s[i+1]*(t-n)/(s[i]-n)}let n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){let e=s[i-2],n=s[i-1];return n+(t-e)/(s[i]-e)*(s[i+1]-n)}let r=s[n-2],a=s[n-1];return a+(1-a)*(t-r)/(this.frames[e+this.getFrameEntries()]-r)}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.getAttachment();if(!l)return;if(!(l instanceof T)||l.timelineAttachment!=this.attachment)return;let h=o.deform;0==h.length&&(r=0);let c=this.vertices,d=c[0].length,u=this.frames;if(s<u[0]){switch(r){case 0:return void(h.length=0);case 1:if(1==n)return void(h.length=0);h.length=d;let t=l;if(t.bones){n=1-n;for(m=0;m<d;m++)h[m]*=n}else{let e=t.vertices;for(var m=0;m<d;m++)h[m]+=(e[m]-h[m])*n}}return}if(h.length=d,s>=u[u.length-1]){let t=c[u.length-1];if(1==n)if(3==r){let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e];else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=t[e]-s[e]}}else v.arrayCopy(t,0,h,0,d);else switch(r){case 0:{let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++){let i=s[e];h[e]=i+(t[e]-i)*n}}break}case 1:case 2:for(let e=0;e<d;e++)h[e]+=(t[e]-h[e])*n;break;case 3:let e=l;if(e.bones)for(let e=0;e<d;e++)h[e]+=t[e]*n;else{let s=e.vertices;for(let e=0;e<d;e++)h[e]+=(t[e]-s[e])*n}}return}let f=O.search1(u,s),g=this.getCurvePercent(s,f),p=c[f],x=c[f+1];if(1==n)if(3==r){let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]+=e+(x[t]-e)*g}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t];h[t]+=s+(x[t]-s)*g-e[t]}}}else for(let t=0;t<d;t++){let e=p[t];h[t]=e+(x[t]-e)*g}else switch(r){case 0:{let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]=(e+(x[t]-e)*g)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t],i=e[t];h[t]=i+(s+(x[t]-s)*g-i)*n}}break}case 1:case 2:for(let t=0;t<d;t++){let e=p[t];h[t]+=(e+(x[t]-e)*g-h[t])*n}break;case 3:let t=l;if(t.bones)for(let t=0;t<d;t++){let e=p[t];h[t]+=(e+(x[t]-e)*g)*n}else{let e=t.vertices;for(let t=0;t<d;t++){let s=p[t];h[t]+=(s+(x[t]-s)*g-e[t])*n}}}}},at=class extends O{constructor(t){super(t,at.propertyIds),this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,i,n,r,a){if(!i)return;let o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,r,a),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let h=0;if(e<o[0])h=0;else{h=O.search1(o,e)+1;let t=o[h];for(;h>0&&o[h-1]==t;)h--}for(;h<l&&s>=o[h];h++)i.push(this.events[h])}},ot=at;ot.propertyIds=[""+V.event];var lt=class extends O{constructor(t){super(t,lt.propertyIds),this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,i,n,r,a){if(1==a)return void(0==r&&v.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));if(s<this.frames[0])return void(0!=r&&1!=r||v.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length));let o=O.search1(this.frames,s),l=this.drawOrders[o];if(l){let e=t.drawOrder,s=t.slots;for(let t=0,i=l.length;t<i;t++)e[t]=s[l[t]]}else v.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)}},ht=lt;ht.propertyIds=[""+V.drawOrder];var ct=class extends L{constructor(t,e,s){super(t,e,[V.ikConstraint+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,r,a){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=r?1:0,this.frames[t+5]=a?1:0}apply(t,e,s,i,n,r,a){let o=t.ikConstraints[this.constraintIndex];if(!o.active)return;let l=this.frames;if(s<l[0]){switch(r){case 0:return o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,void(o.stretch=o.data.stretch);case 1:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let h=0,c=0,d=O.search(l,s,6),u=this.curves[d/6];switch(u){case 0:let t=l[d];h=l[d+1],c=l[d+2];let e=(s-t)/(l[d+6]-t);h+=(l[d+6+1]-h)*e,c+=(l[d+6+2]-c)*e;break;case 1:h=l[d+1],c=l[d+2];break;default:h=this.getBezierValue(s,d,1,u-2),c=this.getBezierValue(s,d,2,u+18-2)}0==r?(o.mix=o.data.mix+(h-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,1==a?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5])):(o.mix+=(h-o.mix)*n,o.softness+=(c-o.softness)*n,0==a&&(o.bendDirection=l[d+3],o.compress=0!=l[d+4],o.stretch=0!=l[d+5]))}},dt=class extends L{constructor(t,e,s){super(t,e,[V.transformConstraint+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,r,a,o){let l=this.frames;l[t*=7]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,l[t+4]=r,l[t+5]=a,l[t+6]=o}apply(t,e,s,i,n,r,a){let o=t.transformConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d,u,m,f=this.frames;if(s<f[0]){let t=o.data;switch(r){case 0:return o.mixRotate=t.mixRotate,o.mixX=t.mixX,o.mixY=t.mixY,o.mixScaleX=t.mixScaleX,o.mixScaleY=t.mixScaleY,void(o.mixShearY=t.mixShearY);case 1:o.mixRotate+=(t.mixRotate-o.mixRotate)*n,o.mixX+=(t.mixX-o.mixX)*n,o.mixY+=(t.mixY-o.mixY)*n,o.mixScaleX+=(t.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(t.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(t.mixShearY-o.mixShearY)*n}return}let g=O.search(f,s,7),p=this.curves[g/7];switch(p){case 0:let t=f[g];l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];let e=(s-t)/(f[g+7]-t);l+=(f[g+7+1]-l)*e,h+=(f[g+7+2]-h)*e,c+=(f[g+7+3]-c)*e,d+=(f[g+7+4]-d)*e,u+=(f[g+7+5]-u)*e,m+=(f[g+7+6]-m)*e;break;case 1:l=f[g+1],h=f[g+2],c=f[g+3],d=f[g+4],u=f[g+5],m=f[g+6];break;default:l=this.getBezierValue(s,g,1,p-2),h=this.getBezierValue(s,g,2,p+18-2),c=this.getBezierValue(s,g,3,p+36-2),d=this.getBezierValue(s,g,4,p+54-2),u=this.getBezierValue(s,g,5,p+72-2),m=this.getBezierValue(s,g,6,p+90-2)}if(0==r){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n,o.mixScaleX=t.mixScaleX+(d-t.mixScaleX)*n,o.mixScaleY=t.mixScaleY+(u-t.mixScaleY)*n,o.mixShearY=t.mixShearY+(m-t.mixShearY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n,o.mixScaleX+=(d-o.mixScaleX)*n,o.mixScaleY+=(u-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}},ut=class extends _{constructor(t,e,s){super(t,e,V.pathConstraintPosition+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.position=this.getAbsoluteValue(s,n,r,o.position,o.data.position))}},mt=class extends _{constructor(t,e,s){super(t,e,V.pathConstraintSpacing+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];o.active&&(o.spacing=this.getAbsoluteValue(s,n,r,o.spacing,o.data.spacing))}},ft=class extends L{constructor(t,e,s){super(t,e,[V.pathConstraintMix+"|"+s]),this.constraintIndex=0,this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){let r=this.frames;r[t<<=2]=e,r[t+1]=s,r[t+2]=i,r[t+3]=n}apply(t,e,s,i,n,r,a){let o=t.pathConstraints[this.constraintIndex];if(!o.active)return;let l,h,c,d=this.frames;if(s<d[0]){switch(r){case 0:return o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,void(o.mixY=o.data.mixY);case 1:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u=O.search(d,s,4),m=this.curves[u>>2];switch(m){case 0:let t=d[u];l=d[u+1],h=d[u+2],c=d[u+3];let e=(s-t)/(d[u+4]-t);l+=(d[u+4+1]-l)*e,h+=(d[u+4+2]-h)*e,c+=(d[u+4+3]-c)*e;break;case 1:l=d[u+1],h=d[u+2],c=d[u+3];break;default:l=this.getBezierValue(s,u,1,m-2),h=this.getBezierValue(s,u,2,m+18-2),c=this.getBezierValue(s,u,3,m+36-2)}if(0==r){let t=o.data;o.mixRotate=t.mixRotate+(l-t.mixRotate)*n,o.mixX=t.mixX+(h-t.mixX)*n,o.mixY=t.mixY+(c-t.mixY)*n}else o.mixRotate+=(l-o.mixRotate)*n,o.mixX+=(h-o.mixX)*n,o.mixY+=(c-o.mixY)*n}},gt=class extends _{constructor(t,e,s,i){super(t,e,i+"|"+s),this.constraintIndex=0,this.constraintIndex=s}apply(t,e,s,i,n,r,a){let o;if(-1==this.constraintIndex){const e=s>=this.frames[0]?this.getCurveValue(s):0;for(const i of t.physicsConstraints)i.active&&this.global(i.data)&&this.set(i,this.getAbsoluteValue2(s,n,r,this.get(i),this.setup(i),e))}else o=t.physicsConstraints[this.constraintIndex],o.active&&this.set(o,this.getAbsoluteValue(s,n,r,this.get(o),this.setup(o)))}},pt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintInertia)}setup(t){return t.data.inertia}get(t){return t.inertia}set(t,e){t.inertia=e}global(t){return t.inertiaGlobal}},xt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintStrength)}setup(t){return t.data.strength}get(t){return t.strength}set(t,e){t.strength=e}global(t){return t.strengthGlobal}},bt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintDamping)}setup(t){return t.data.damping}get(t){return t.damping}set(t,e){t.damping=e}global(t){return t.dampingGlobal}},wt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintMass)}setup(t){return 1/t.data.massInverse}get(t){return 1/t.massInverse}set(t,e){t.massInverse=1/e}global(t){return t.massGlobal}},yt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintWind)}setup(t){return t.data.wind}get(t){return t.wind}set(t,e){t.wind=e}global(t){return t.windGlobal}},vt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintGravity)}setup(t){return t.data.gravity}get(t){return t.gravity}set(t,e){t.gravity=e}global(t){return t.gravityGlobal}},kt=class extends gt{constructor(t,e,s){super(t,e,s,V.physicsConstraintMix)}setup(t){return t.data.mix}get(t){return t.mix}set(t,e){t.mix=e}global(t){return t.mixGlobal}},At=class extends O{constructor(t,e){super(t,At.propertyIds),this.constraintIndex=e}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e}apply(t,e,s,i,n,r,a){let o;if(-1!=this.constraintIndex&&(o=t.physicsConstraints[this.constraintIndex],!o.active))return;const l=this.frames;if(e>s)this.apply(t,e,Number.MAX_VALUE,[],n,r,a),e=-1;else if(e>=l[l.length-1])return;if(!(s<l[0])&&(e<l[0]||s>=l[O.search1(l,e)+1]))if(null!=o)o.reset();else for(const e of t.physicsConstraints)e.active&&e.reset()}},St=At;St.propertyIds=[V.physicsConstraintReset.toString()];var Ct=class extends O{constructor(t,e,s){super(t,[V.sequence+"|"+e+"|"+s.sequence.id]),this.slotIndex=e,this.attachment=s}getFrameEntries(){return Ct.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,e,s,i,n){let r=this.frames;r[t*=Ct.ENTRIES]=e,r[t+Ct.MODE]=s|i<<4,r[t+Ct.DELAY]=n}apply(t,e,s,i,n,r,a){let o=t.slots[this.slotIndex];if(!o.bone.active)return;let l=o.attachment,h=this.attachment;if(!(l==h||l instanceof T&&l.timelineAttachment==h))return;if(1==a)return void(0==r&&(o.sequenceIndex=-1));let c=this.frames;if(s<c[0])return void(0!=r&&1!=r||(o.sequenceIndex=-1));let d=O.search(c,s,Ct.ENTRIES),u=c[d],m=c[d+Ct.MODE],f=c[d+Ct.DELAY];if(!this.attachment.sequence)return;let g=m>>4,p=this.attachment.sequence.regions.length,x=X[15&m];if(0!=x)switch(g+=(s-u)/f+1e-5|0,x){case 1:g=Math.min(p-1,g);break;case 2:g%=p;break;case 3:{let t=(p<<1)-2;g=0==t?0:g%t,g>=p&&(g=t-g);break}case 4:g=Math.max(p-1-g,0);break;case 5:g=p-1-g%p;break;case 6:{let t=(p<<1)-2;g=0==t?0:(g+p-1)%t,g>=p&&(g=t-g)}}o.sequenceIndex=g}},Tt=Ct;Tt.ENTRIES=3,Tt.MODE=1,Tt.DELAY=2;var It=class{constructor(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Xt(this),this.propertyIDs=new m,this.animationsChanged=!1,this.trackEntryPool=new k((()=>new Pt)),this.data=t}static emptyAnimation(){return It._emptyAnimation}update(t){t*=this.timeScale;let e=this.tracks;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(!i)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let n=t*i.timeScale;if(i.delay>0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let r=i.next;if(r){let e=i.trackLast-r.delay;if(e>=0){for(r.delay=0,r.trackTime+=0==i.timeScale?0:(e/i.timeScale+t)*r.timeScale,i.trackTime+=n,this.setCurrent(s,r,!0);r.mixingFrom;)r.mixTime+=t,r=r.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&!i.mixingFrom){e[s]=null,this.queue.end(i),this.clearNext(i);continue}if(i.mixingFrom&&this.updateMixingFrom(i,t)){let t=i.mixingFrom;for(i.mixingFrom=null,t&&(t.mixingTo=null);t;)this.queue.end(t),t=t.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(t,e){let s=t.mixingFrom;if(!s)return!0;let i=this.updateMixingFrom(s,e);if(s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,-1!=t.nextTrackLast){const e=0==t.mixTime&&0==s.mixTime;if(t.mixTime>=t.mixDuration||e)return(0==s.totalAlpha||0==t.mixDuration||e)&&(t.mixingFrom=s.mixingFrom,null!=s.mixingFrom&&(s.mixingFrom.mixingTo=t),t.interruptAlpha=s.interruptAlpha,this.queue.end(s)),i}return s.trackTime+=e*s.timeScale,t.mixTime+=e,!1}apply(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let e=this.events,s=this.tracks,i=!1;for(let r=0,a=s.length;r<a;r++){let a=s[r];if(!a||a.delay>0)continue;i=!0;let o=0==r?1:a.mixBlend,l=a.alpha;a.mixingFrom?l*=this.applyMixingFrom(a,t,o):a.trackTime>=a.trackEnd&&!a.next&&(l=0);let h=l>=a.alphaAttachmentThreshold,c=a.animationLast,d=a.getAnimationTime(),u=d,m=e;a.reverse&&(u=a.animation.duration-u,m=null);let f=a.animation.timelines,g=f.length;if(0==r&&1==l||3==o){0==r&&(h=!0);for(let e=0;e<g;e++){v.webkit602BugfixHelper(l,o);var n=f[e];n instanceof nt?this.applyAttachmentTimeline(n,t,u,o,h):n.apply(t,c,u,m,l,o,0)}}else{let e=a.timelineMode,s=a.shortestRotation,i=!s&&a.timelinesRotation.length!=g<<1;i&&(a.timelinesRotation.length=g<<1);for(let n=0;n<g;n++){let r=f[n],d=e[n]==Rt?o:0;!s&&r instanceof U?this.applyRotateTimeline(r,t,u,l,d,a.timelinesRotation,n<<1,i):r instanceof nt?this.applyAttachmentTimeline(r,t,u,o,h):(v.webkit602BugfixHelper(l,o),r.apply(t,c,u,m,l,d,0))}}this.queueEvents(a,d),e.length=0,a.nextAnimationLast=d,a.nextTrackLast=a.trackTime}for(var r=this.unkeyedState+_t,a=t.slots,o=0,l=t.slots.length;o<l;o++){var h=a[o];if(h.attachmentState==r){var c=h.data.attachmentName;h.setAttachment(c?t.getAttachment(h.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(t,e,s){let i=t.mixingFrom;i.mixingFrom&&this.applyMixingFrom(i,e,s);let n=0;0==t.mixDuration?(n=1,1==s&&(s=0)):(n=t.mixTime/t.mixDuration,n>1&&(n=1),1!=s&&(s=i.mixBlend));let r=n<i.mixAttachmentThreshold,a=n<i.mixDrawOrderThreshold,o=i.animation.timelines,l=o.length,h=i.alpha*t.interruptAlpha,c=h*(1-n),d=i.animationLast,u=i.getAnimationTime(),m=u,f=null;if(i.reverse?m=i.animation.duration-m:n<i.eventThreshold&&(f=this.events),3==s)for(let t=0;t<l;t++)o[t].apply(e,d,m,f,c,s,1);else{let t=i.timelineMode,n=i.timelineHoldMix,u=i.shortestRotation,g=!u&&i.timelinesRotation.length!=l<<1;g&&(i.timelinesRotation.length=l<<1),i.totalAlpha=0;for(let p=0;p<l;p++){let l,x=o[p],b=1,w=0;switch(t[p]){case Rt:if(!a&&x instanceof ht)continue;l=s,w=c;break;case Dt:l=0,w=c;break;case Vt:l=s,w=h;break;case Ot:l=0,w=h;break;default:l=0;let t=n[p];w=h*Math.max(0,1-t.mixTime/t.mixDuration)}i.totalAlpha+=w,!u&&x instanceof U?this.applyRotateTimeline(x,e,m,w,l,i.timelinesRotation,p<<1,g):x instanceof nt?this.applyAttachmentTimeline(x,e,m,l,r&&w>=i.alphaAttachmentThreshold):(v.webkit602BugfixHelper(w,s),a&&x instanceof ht&&0==l&&(b=0),x.apply(e,d,m,f,w,l,b))}}return t.mixDuration>0&&this.queueEvents(i,u),this.events.length=0,i.nextAnimationLast=u,i.nextTrackLast=i.trackTime,n}applyAttachmentTimeline(t,e,s,i,n){var r=e.slots[t.slotIndex];r.bone.active&&(s<t.frames[0]?0!=i&&1!=i||this.setAttachment(e,r,r.data.attachmentName,n):this.setAttachment(e,r,t.attachmentNames[O.search1(t.frames,s)],n),r.attachmentState<=this.unkeyedState&&(r.attachmentState=this.unkeyedState+_t))}setAttachment(t,e,s,i){e.setAttachment(s?t.getAttachment(e.data.index,s):null),i&&(e.attachmentState=this.unkeyedState+Nt)}applyRotateTimeline(t,e,s,i,n,r,a,o){if(o&&(r[a]=0),1==i)return void t.apply(e,0,s,null,1,n,0);let l=e.bones[t.boneIndex];if(!l.active)return;let h=0,c=0;if(s<t.frames[0])switch(n){case 0:l.rotation=l.data.rotation;default:return;case 1:h=l.rotation,c=l.data.rotation}else h=0==n?l.data.rotation:l.rotation,c=l.data.rotation+t.getCurveValue(s);let d=0,u=c-h;if(u-=360*Math.ceil(u/360-.5),0==u)d=r[a];else{let t=0,e=0;o?(t=0,e=u):(t=r[a],e=r[a+1]);let s=t-t%360;d=u+s;let i=u>=0,n=t>=0;Math.abs(e)<=90&&x.signum(e)!=x.signum(u)&&(Math.abs(t-s)>180?(d+=360*x.signum(t),n=i):0!=s?d-=360*x.signum(t):n=i),n!=i&&(d+=360*x.signum(t)),r[a]=d}r[a+1]=u,l.rotation=h+d*i}queueEvents(t,e){let s=t.animationStart,i=t.animationEnd,n=i-s,r=t.trackLast%n,a=this.events,o=0,l=a.length;for(;o<l;o++){let e=a[o];if(e.time<r)break;e.time>i||this.queue.event(t,e)}let h=!1;if(t.loop)if(0==n)h=!0;else{const e=Math.floor(t.trackTime/n);h=e>0&&e>Math.floor(t.trackLast/n)}else h=e>=i&&t.animationLast<i;for(h&&this.queue.complete(t);o<l;o++){let e=a[o];e.time<s||this.queue.event(t,e)}}clearTracks(){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()}clearTrack(t){if(t>=this.tracks.length)return;let e=this.tracks[t];if(!e)return;this.queue.end(e),this.clearNext(e);let s=e;for(;;){let t=s.mixingFrom;if(!t)break;this.queue.end(t),s.mixingFrom=null,s.mixingTo=null,s=t}this.tracks[e.trackIndex]=null,this.queue.drain()}setCurrent(t,e,s){let i=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,i&&(s&&this.queue.interrupt(i),e.mixingFrom=i,i.mixingTo=e,e.mixTime=0,i.mixingFrom&&i.mixDuration>0&&(e.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(e)}setAnimation(t,e,s=!1){let i=this.data.skeletonData.findAnimation(e);if(!i)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,i,s)}setAnimationWith(t,e,s=!1){if(!e)throw new Error("animation cannot be null.");let i=!0,n=this.expandToIndex(t);n&&(-1==n.nextTrackLast?(this.tracks[t]=n.mixingFrom,this.queue.interrupt(n),this.queue.end(n),this.clearNext(n),n=n.mixingFrom,i=!1):this.clearNext(n));let r=this.trackEntry(t,e,s,n);return this.setCurrent(t,r,i),this.queue.drain(),r}addAnimation(t,e,s=!1,i=0){let n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,n,s,i)}addAnimationWith(t,e,s=!1,i=0){if(!e)throw new Error("animation cannot be null.");let n=this.expandToIndex(t);if(n)for(;n.next;)n=n.next;let r=this.trackEntry(t,e,s,n);return n?(n.next=r,r.previous=n,i<=0&&(i+=n.getTrackComplete()-r.mixDuration)):(this.setCurrent(t,r,!0),this.queue.drain()),r.delay=i,r}setEmptyAnimation(t,e=0){let s=this.setAnimationWith(t,It.emptyAnimation(),!1);return s.mixDuration=e,s.trackEnd=e,s}addEmptyAnimation(t,e=0,s=0){let i=this.addAnimationWith(t,It.emptyAnimation(),!1,s);return s<=0&&(i.delay+=i.mixDuration-e),i.mixDuration=e,i.trackEnd=e,i}setEmptyAnimations(t=0){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){let s=this.tracks[e];s&&this.setEmptyAnimation(s.trackIndex,t)}this.queue.drainDisabled=e,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,e,s,i){let n=this.trackEntryPool.obtain();return n.reset(),n.trackIndex=t,n.animation=e,n.loop=s,n.holdPrevious=!1,n.reverse=!1,n.shortestRotation=!1,n.eventThreshold=0,n.alphaAttachmentThreshold=0,n.mixAttachmentThreshold=0,n.mixDrawOrderThreshold=0,n.animationStart=0,n.animationEnd=e.duration,n.animationLast=-1,n.nextAnimationLast=-1,n.delay=0,n.trackTime=0,n.trackLast=-1,n.nextTrackLast=-1,n.trackEnd=Number.MAX_VALUE,n.timeScale=1,n.alpha=1,n.mixTime=0,n.mixDuration=i?this.data.getMix(i.animation,e):0,n.interruptAlpha=1,n.totalAlpha=0,n.mixBlend=2,n}clearNext(t){let e=t.next;for(;e;)this.queue.dispose(e),e=e.next;t.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let t=this.tracks;for(let e=0,s=t.length;e<s;e++){let s=t[e];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do{s.mixingTo&&3==s.mixBlend||this.computeHold(s),s=s.mixingTo}while(s)}}}computeHold(t){let e=t.mixingTo,s=t.animation.timelines,i=t.animation.timelines.length,n=t.timelineMode;n.length=i;let r=t.timelineHoldMix;r.length=0;let a=this.propertyIDs;if(e&&e.holdPrevious)for(let t=0;t<i;t++)n[t]=a.addAll(s[t].getPropertyIds())?Ot:Vt;else t:for(let o=0;o<i;o++){let i=s[o],l=i.getPropertyIds();if(a.addAll(l))if(!e||i instanceof nt||i instanceof ht||i instanceof ot||!e.animation.hasTimeline(l))n[o]=Dt;else{for(let s=e.mixingTo;s;s=s.mixingTo)if(!s.animation.hasTimeline(l)){if(t.mixDuration>0){n[o]=Lt,r[o]=s;continue t}break}n[o]=Ot}else n[o]=Rt}}getCurrent(t){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){let e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},Mt=It;Mt._emptyAnimation=new B("<empty>",[],0);var Ft,Yt,Et,Pt=class{constructor(){this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.mixAttachmentThreshold=0,this.alphaAttachmentThreshold=0,this.mixDrawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this._mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=2,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}get mixDuration(){return this._mixDuration}set mixDuration(t){this._mixDuration=t}setMixDurationWithDelay(t,e){this._mixDuration=t,null!=this.previous&&e<=0&&(e+=this.previous.getTrackComplete()-t),this.delay=e}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(t){this.animationLast=t,this.nextAnimationLast=t}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime<t)return t}return this.trackTime}wasApplied(){return-1!=this.nextTrackLast}isNextReady(){return null!=this.next&&this.nextTrackLast-this.next.delay>=0}},Xt=class{constructor(t){this.objects=[],this.drainDisabled=!1,this.animState=t}start(t){this.objects.push(Bt.start),this.objects.push(t),this.animState.animationsChanged=!0}interrupt(t){this.objects.push(Bt.interrupt),this.objects.push(t)}end(t){this.objects.push(Bt.end),this.objects.push(t),this.animState.animationsChanged=!0}dispose(t){this.objects.push(Bt.dispose),this.objects.push(t)}complete(t){this.objects.push(Bt.complete),this.objects.push(t)}event(t,e){this.objects.push(Bt.event),this.objects.push(t),this.objects.push(e)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let t=this.objects,e=this.animState.listeners;for(let s=0;s<t.length;s+=2){let i=t[s],n=t[s+1];switch(i){case Bt.start:n.listener&&n.listener.start&&n.listener.start(n);for(let t=0;t<e.length;t++){let s=e[t];s.start&&s.start(n)}break;case Bt.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let t=0;t<e.length;t++){let s=e[t];s.interrupt&&s.interrupt(n)}break;case Bt.end:n.listener&&n.listener.end&&n.listener.end(n);for(let t=0;t<e.length;t++){let s=e[t];s.end&&s.end(n)}case Bt.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let t=0;t<e.length;t++){let s=e[t];s.dispose&&s.dispose(n)}this.animState.trackEntryPool.free(n);break;case Bt.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let t=0;t<e.length;t++){let s=e[t];s.complete&&s.complete(n)}break;case Bt.event:let i=t[2+s++];n.listener&&n.listener.event&&n.listener.event(n,i);for(let t=0;t<e.length;t++){let s=e[t];s.event&&s.event(n,i)}}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}},Bt=((Ft=Bt||{})[Ft.start=0]="start",Ft[Ft.interrupt=1]="interrupt",Ft[Ft.end=2]="end",Ft[Ft.dispose=3]="dispose",Ft[Ft.complete=4]="complete",Ft[Ft.event=5]="event",Ft),Rt=0,Dt=1,Vt=2,Ot=3,Lt=4,_t=1,Nt=2,Ut=class{constructor(t){if(this.animationToMixTime={},this.defaultMix=0,!t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}setMix(t,e,s){let i=this.skeletonData.findAnimation(t);if(!i)throw new Error("Animation not found: "+t);let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);this.setMixWith(i,n,s)}setMixWith(t,e,s){if(!t)throw new Error("from cannot be null.");if(!e)throw new Error("to cannot be null.");let i=t.name+"."+e.name;this.animationToMixTime[i]=s}getMix(t,e){let s=t.name+"."+e.name,i=this.animationToMixTime[s];return void 0===i?this.defaultMix:i}},qt=class extends T{constructor(t){super(t),this.color=new g(1,1,1,1)}copy(){let t=new qt(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Wt=class extends T{constructor(t){super(t),this.endSlot=null,this.color=new g(.2275,.2275,.8078,1)}copy(){let t=new Wt(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},zt=class{constructor(t){this._image=t}getImage(){return this._image}},Gt=((Yt=Gt||{})[Yt.Nearest=9728]="Nearest",Yt[Yt.Linear=9729]="Linear",Yt[Yt.MipMap=9987]="MipMap",Yt[Yt.MipMapNearestNearest=9984]="MipMapNearestNearest",Yt[Yt.MipMapLinearNearest=9985]="MipMapLinearNearest",Yt[Yt.MipMapNearestLinear=9986]="MipMapNearestLinear",Yt[Yt.MipMapLinearLinear=9987]="MipMapLinearLinear",Yt),jt=((Et=jt||{})[Et.MirroredRepeat=33648]="MirroredRepeat",Et[Et.ClampToEdge=33071]="ClampToEdge",Et[Et.Repeat=10497]="Repeat",Et),$t=class{constructor(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.degrees=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0}},Ht=class{constructor(t){this.pages=new Array,this.regions=new Array;let e=new Jt(t),s=new Array(4),i={size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},format:()=>{},filter:t=>{t.minFilter=v.enumValue(Gt,s[1]),t.magFilter=v.enumValue(Gt,s[2])},repeat:t=>{-1!=s[1].indexOf("x")&&(t.uWrap=10497),-1!=s[1].indexOf("y")&&(t.vWrap=10497)},pma:t=>{t.pma="true"==s[1]}};var n={xy:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2])},size:t=>{t.width=parseInt(s[1]),t.height=parseInt(s[2])},bounds:t=>{t.x=parseInt(s[1]),t.y=parseInt(s[2]),t.width=parseInt(s[3]),t.height=parseInt(s[4])},offset:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2])},orig:t=>{t.originalWidth=parseInt(s[1]),t.originalHeight=parseInt(s[2])},offsets:t=>{t.offsetX=parseInt(s[1]),t.offsetY=parseInt(s[2]),t.originalWidth=parseInt(s[3]),t.originalHeight=parseInt(s[4])},rotate:t=>{let e=s[1];"true"==e?t.degrees=90:"false"!=e&&(t.degrees=parseInt(e))},index:t=>{t.index=parseInt(s[1])}};let r=e.readLine();for(;r&&0==r.trim().length;)r=e.readLine();for(;r&&0!=r.trim().length&&0!=e.readEntry(s,r);)r=e.readLine();let a=null,o=null,l=null;for(;null!==r;)if(0==r.trim().length)a=null,r=e.readLine();else if(a){let t=new Qt(a,r);for(;;){let i=e.readEntry(s,r=e.readLine());if(0==i)break;let a=n[s[0]];if(a)a(t);else{o||(o=[]),l||(l=[]),o.push(s[0]);let t=[];for(let e=0;e<i;e++)t.push(parseInt(s[e+1]));l.push(t)}}0==t.originalWidth&&0==t.originalHeight&&(t.originalWidth=t.width,t.originalHeight=t.height),o&&o.length>0&&l&&l.length>0&&(t.names=o,t.values=l,o=null,l=null),t.u=t.x/a.width,t.v=t.y/a.height,90==t.degrees?(t.u2=(t.x+t.height)/a.width,t.v2=(t.y+t.width)/a.height):(t.u2=(t.x+t.width)/a.width,t.v2=(t.y+t.height)/a.height),this.regions.push(t)}else{for(a=new Kt(r.trim());0!=e.readEntry(s,r=e.readLine());){let t=i[s[0]];t&&t(a)}this.pages.push(a)}}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}setTextures(t,e=""){for(let s of this.pages)s.setTexture(t.get(e+s.name))}dispose(){var t;for(let e=0;e<this.pages.length;e++)null==(t=this.pages[e].texture)||t.dispose()}},Jt=class{constructor(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;let s=e.indexOf(":");if(-1==s)return 0;t[0]=e.substr(0,s).trim();for(let i=1,n=s+1;;i++){let s=e.indexOf(",",n);if(-1==s)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,s-n).trim(),n=s+1,4==i)return 4}}},Kt=class{constructor(t){this.minFilter=9728,this.magFilter=9728,this.uWrap=33071,this.vWrap=33071,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.regions=new Array,this.name=t}setTexture(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);for(let e of this.regions)e.texture=t}},Qt=class extends $t{constructor(t,e){super(),this.x=0,this.y=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.index=0,this.degrees=0,this.names=null,this.values=null,this.page=t,this.name=e,t.regions.push(this)}},Zt=class extends T{constructor(t,e){super(t),this.region=null,this.regionUVs=[],this.uvs=[],this.triangles=[],this.color=new g(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new g(0,0,0,0),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=v.newFloatArray(t.length));let e=this.uvs,s=this.uvs.length,i=this.region.u,n=this.region.v,r=0,a=0;if(this.region instanceof Qt){let o=this.region,l=o.page,h=l.width,c=l.height;switch(o.degrees){case 90:i-=(o.originalHeight-o.offsetY-o.height)/h,n-=(o.originalWidth-o.offsetX-o.width)/c,r=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+t[o+1]*r,e[o+1]=n+(1-t[o])*a;return;case 180:i-=(o.originalWidth-o.offsetX-o.width)/h,n-=o.offsetY/c,r=o.originalWidth/h,a=o.originalHeight/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o])*r,e[o+1]=n+(1-t[o+1])*a;return;case 270:i-=o.offsetY/h,n-=o.offsetX/c,r=o.originalHeight/h,a=o.originalWidth/c;for(let o=0;o<s;o+=2)e[o]=i+(1-t[o+1])*r,e[o+1]=n+t[o]*a;return}i-=o.offsetX/h,n-=(o.originalHeight-o.offsetY-o.height)/c,r=o.originalWidth/h,a=o.originalHeight/c}else this.region?(r=this.region.u2-i,a=this.region.v2-n):(i=n=0,r=a=1);for(let o=0;o<s;o+=2)e[o]=i+t[o]*r,e[o+1]=n+t[o+1]*a}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=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)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Zt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),v.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),v.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),v.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=null!=this.sequence?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),v.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,i,n,r){null!=this.sequence&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,r)}newLinkedMesh(){let t=new Zt(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),null!=t.region&&t.updateRegion(),t}},te=class extends T{constructor(t){super(t),this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new g(1,1,1,1)}copy(){let t=new te(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),v.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},ee=class extends T{constructor(t){super(t),this.x=0,this.y=0,this.rotation=0,this.color=new g(.38,.94,0,1)}computeWorldPosition(t,e){return e.x=this.x*t.a+this.y*t.b+t.worldX,e.y=this.x*t.c+this.y*t.d+t.worldY,e}computeWorldRotation(t){const e=this.rotation*x.degRad,s=Math.cos(e),i=Math.sin(e),n=s*t.a+i*t.b,r=s*t.c+i*t.d;return x.atan2Deg(r,n)}copy(){let t=new ee(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},se=class extends S{constructor(t,e){super(t),this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new g(1,1,1,1),this.region=null,this.sequence=null,this.offset=v.newFloatArray(8),this.uvs=v.newFloatArray(8),this.tempColor=new g(1,1,1,1),this.path=e}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,e=this.uvs;if(null==t)return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=1,e[5]=1,e[6]=1,void(e[7]=0);let s=this.width/this.region.originalWidth*this.scaleX,i=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*s,r=-this.height/2*this.scaleY+this.region.offsetY*i,a=n+this.region.width*s,o=r+this.region.height*i,l=this.rotation*x.degRad,h=Math.cos(l),c=Math.sin(l),d=this.x,u=this.y,m=n*h+d,f=n*c,g=r*h+u,p=r*c,b=a*h+d,w=a*c,y=o*h+u,v=o*c,k=this.offset;k[0]=m-p,k[1]=g+f,k[2]=m-v,k[3]=y+f,k[4]=b-v,k[5]=y+w,k[6]=b-p,k[7]=g+w,90==t.degrees?(e[0]=t.u2,e[1]=t.v2,e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,i){null!=this.sequence&&this.sequence.apply(t,this);let n=t.bone,r=this.offset,a=n.worldX,o=n.worldY,l=n.a,h=n.b,c=n.c,d=n.d,u=0,m=0;u=r[0],m=r[1],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[2],m=r[3],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[4],m=r[5],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o,s+=i,u=r[6],m=r[7],e[s]=u*l+m*h+a,e[s+1]=u*c+m*d+o}copy(){let t=new se(this.name,this.path);return t.region=this.region,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,v.arrayCopy(this.uvs,0,t.uvs,0,8),v.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=null!=this.sequence?this.sequence.copy():null,t}},ie=se;ie.X1=0,ie.Y1=1,ie.C1R=2,ie.C1G=3,ie.C1B=4,ie.C1A=5,ie.U1=6,ie.V1=7,ie.X2=8,ie.Y2=9,ie.C2R=10,ie.C2G=11,ie.C2B=12,ie.C2A=13,ie.U2=14,ie.V2=15,ie.X3=16,ie.Y3=17,ie.C3R=18,ie.C3G=19,ie.C3B=20,ie.C3A=21,ie.U3=22,ie.V3=23,ie.X4=24,ie.Y4=25,ie.C4R=26,ie.C4G=27,ie.C4B=28,ie.C4A=29,ie.U4=30,ie.V4=31;var ne,re,ae,oe,le=class{constructor(t){this.atlas=t}loadSequence(t,e,s){let i=s.regions;for(let n=0,r=i.length;n<r;n++){let r=s.getPath(e,n),a=this.atlas.findRegion(r);if(null==a)throw new Error("Region not found in atlas: "+r+" (sequence: "+t+")");i[n]=a}}newRegionAttachment(t,e,s,i){let n=new ie(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (region attachment: "+e+")");n.region=t}return n}newMeshAttachment(t,e,s,i){let n=new Zt(e,s);if(null!=i)this.loadSequence(e,s,i);else{let t=this.atlas.findRegion(s);if(!t)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+e+")");n.region=t}return n}newBoundingBoxAttachment(t,e){return new qt(e)}newPathAttachment(t,e){return new te(e)}newPointAttachment(t,e){return new ee(e)}newClippingAttachment(t,e){return new Wt(e)}},he=class{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.inherit=ce.Normal,this.skinRequired=!1,this.color=new g,this.visible=!1,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},ce=((ne=ce||{})[ne.Normal=0]="Normal",ne[ne.OnlyTranslation=1]="OnlyTranslation",ne[ne.NoRotationOrReflection=2]="NoRotationOrReflection",ne[ne.NoScale=3]="NoScale",ne[ne.NoScaleOrReflection=4]="NoScaleOrReflection",ne),de=class{constructor(t,e,s){if(this.parent=null,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.inherit=0,this.sorted=!1,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(t){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,i,n,r,a){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=r,this.ashearY=a;let o=this.parent;if(!o){let o=this.skeleton;const l=o.scaleX,h=o.scaleY,c=(s+r)*x.degRad,d=(s+90+a)*x.degRad;return this.a=Math.cos(c)*i*l,this.b=Math.cos(d)*n*l,this.c=Math.sin(c)*i*h,this.d=Math.sin(d)*n*h,this.worldX=t*l+o.x,void(this.worldY=e*h+o.y)}let l=o.a,h=o.b,c=o.c,d=o.d;switch(this.worldX=l*t+h*e+o.worldX,this.worldY=c*t+d*e+o.worldY,this.inherit){case 0:{const t=(s+r)*x.degRad,e=(s+90+a)*x.degRad,o=Math.cos(t)*i,u=Math.cos(e)*n,m=Math.sin(t)*i,f=Math.sin(e)*n;return this.a=l*o+h*m,this.b=l*u+h*f,this.c=c*o+d*m,void(this.d=c*u+d*f)}case 1:{const t=(s+r)*x.degRad,e=(s+90+a)*x.degRad;this.a=Math.cos(t)*i,this.b=Math.cos(e)*n,this.c=Math.sin(t)*i,this.d=Math.sin(e)*n;break}case 2:{let t=1/this.skeleton.scaleX,e=1/this.skeleton.scaleY;l*=t,c*=e;let o=l*l+c*c,u=0;o>1e-4?(o=Math.abs(l*d*e-h*t*c)/o,h=c*o,d=l*o,u=Math.atan2(c,l)*x.radDeg):(l=0,c=0,u=90-Math.atan2(d,h)*x.radDeg);const m=(s+r-u)*x.degRad,f=(s+a-u+90)*x.degRad,g=Math.cos(m)*i,p=Math.cos(f)*n,b=Math.sin(m)*i,w=Math.sin(f)*n;this.a=l*g-h*b,this.b=l*p-h*w,this.c=c*g+d*b,this.d=c*p+d*w;break}case 3:case 4:{s*=x.degRad;const t=Math.cos(s),e=Math.sin(s);let o=(l*t+h*e)/this.skeleton.scaleX,u=(c*t+d*e)/this.skeleton.scaleY,m=Math.sqrt(o*o+u*u);m>1e-5&&(m=1/m),o*=m,u*=m,m=Math.sqrt(o*o+u*u),3==this.inherit&&l*d-h*c<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(m=-m),s=Math.PI/2+Math.atan2(u,o);const f=Math.cos(s)*m,g=Math.sin(s)*m;r*=x.degRad,a=(90+a)*x.degRad;const p=Math.cos(r)*i,b=Math.cos(a)*n,w=Math.sin(r)*i,y=Math.sin(a)*n;this.a=o*p+f*w,this.b=o*b+f*y,this.c=u*p+g*w,this.d=u*b+g*y;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY,this.inherit=t.inherit}updateAppliedTransform(){let t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*x.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*x.radDeg);let e,s,i,n,r=t.a,a=t.b,o=t.c,l=t.d,h=1/(r*l-a*o),c=l*h,d=a*h,u=o*h,m=r*h,f=this.worldX-t.worldX,g=this.worldY-t.worldY;if(this.ax=f*c-g*d,this.ay=g*m-f*u,1==this.inherit)e=this.a,s=this.b,i=this.c,n=this.d;else{switch(this.inherit){case 2:{let t=Math.abs(r*l-a*o)/(r*r+o*o);a=-o*this.skeleton.scaleX*t/this.skeleton.scaleY,l=r*this.skeleton.scaleY*t/this.skeleton.scaleX,h=1/(r*l-a*o),c=l*h,d=a*h;break}case 3:case 4:let t=x.cosDeg(this.rotation),e=x.sinDeg(this.rotation);r=(r*t+a*e)/this.skeleton.scaleX,o=(o*t+l*e)/this.skeleton.scaleY;let s=Math.sqrt(r*r+o*o);s>1e-5&&(s=1/s),r*=s,o*=s,s=Math.sqrt(r*r+o*o),3==this.inherit&&h<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(s=-s);let i=x.PI/2+Math.atan2(o,r);a=Math.cos(i)*s,l=Math.sin(i)*s,h=1/(r*l-a*o),c=l*h,d=a*h,u=o*h,m=r*h}e=c*this.a-d*this.c,s=c*this.b-d*this.d,i=m*this.c-u*this.a,n=m*this.d-u*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(e*e+i*i),this.ascaleX>1e-4){let t=e*n-s*i;this.ascaleY=t/this.ascaleX,this.ashearY=-Math.atan2(e*s+i*n,t)*x.radDeg,this.arotation=Math.atan2(i,e)*x.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(s*s+n*n),this.ashearY=0,this.arotation=90-Math.atan2(n,s)*x.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*x.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*x.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(t){let e=1/(this.a*this.d-this.b*this.c),s=t.x-this.worldX,i=t.y-this.worldY;return t.x=s*this.d*e-i*this.b*e,t.y=i*this.a*e-s*this.c*e,t}localToWorld(t){let e=t.x,s=t.y;return t.x=e*this.a+s*this.b+this.worldX,t.y=e*this.c+s*this.d+this.worldY,t}worldToParent(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.worldToLocal(t)}parentToWorld(t){if(null==t)throw new Error("world cannot be null.");return null==this.parent?t:this.parent.localToWorld(t)}worldToLocalRotation(t){let e=x.sinDeg(t),s=x.cosDeg(t);return Math.atan2(this.a*e-this.c*s,this.d*s-this.b*e)*x.radDeg+this.rotation-this.shearX}localToWorldRotation(t){t-=this.rotation-this.shearX;let e=x.sinDeg(t),s=x.cosDeg(t);return Math.atan2(s*this.c+e*this.d,s*this.a+e*this.b)*x.radDeg}rotateWorld(t){t*=x.degRad;const e=Math.sin(t),s=Math.cos(t),i=this.a,n=this.b;this.a=s*i-e*this.c,this.b=s*n-e*this.d,this.c=e*i+s*this.c,this.d=e*n+s*this.d}},ue=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},me=class{constructor(){this.callbacks={},this.rawDataUris={}}dataUriToString(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}base64ToUint8Array(t){for(var e=window.atob(t),s=e.length,i=new Uint8Array(s),n=0;n<s;n++)i[n]=e.charCodeAt(n);return i}dataUriToUint8Array(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");let e=t.indexOf("base64,");if(-1==e)throw new Error("Not a binary data URI.");return e+=7,this.base64ToUint8Array(t.substr(e))}downloadText(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToString(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.overrideMimeType("text/html"),i.open("GET",t,!0);let n=()=>{this.finish(t,i.status,i.responseText)};i.onload=n,i.onerror=n,i.send()}downloadJson(t,e,s){this.downloadText(t,(t=>{e(JSON.parse(t))}),s)}downloadBinary(t,e,s){if(this.start(t,e,s))return;if(this.rawDataUris[t]){try{let e=this.rawDataUris[t];this.finish(t,200,this.dataUriToUint8Array(e))}catch(e){this.finish(t,400,JSON.stringify(e))}return}let i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer";let n=()=>{this.finish(t,i.status,i.response)};i.onload=()=>{200==i.status||0==i.status?this.finish(t,200,new Uint8Array(i.response)):n()},i.onerror=n,i.send()}start(t,e,s){let i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,s)}}finish(t,e,s){let i=this.callbacks[t];delete this.callbacks[t];let n=200==e||0==e?[s]:[e,s];for(let t=n.length-1,e=i.length;t<e;t+=2)i[t].apply(null,n)}},fe=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}},ge=class{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}},pe=class{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find bone ${t.target.name}`);this.target=s,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch}update(t){if(0==this.mix)return;let e=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],e.worldX,e.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],e.worldX,e.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix)}}apply1(t,e,s,i,n,r,a){let o=t.parent;if(!o)throw new Error("IK bone must have parent.");let l=o.a,h=o.b,c=o.c,d=o.d,u=-t.ashearX-t.arotation,m=0,f=0;switch(t.inherit){case 1:m=(e-t.worldX)*x.signum(t.skeleton.scaleX),f=(s-t.worldY)*x.signum(t.skeleton.scaleY);break;case 2:let i=Math.abs(l*d-h*c)/Math.max(1e-4,l*l+c*c),n=l/t.skeleton.scaleX,r=c/t.skeleton.scaleY;h=-r*i*t.skeleton.scaleX,d=n*i*t.skeleton.scaleY,u+=Math.atan2(r,n)*x.radDeg;default:let a=e-o.worldX,g=s-o.worldY,p=l*d-h*c;Math.abs(p)<=1e-4?(m=0,f=0):(m=(a*d-g*h)/p-t.ax,f=(g*l-a*c)/p-t.ay)}u+=Math.atan2(f,m)*x.radDeg,t.ascaleX<0&&(u+=180),u>180?u-=360:u<-180&&(u+=360);let g=t.ascaleX,p=t.ascaleY;if(i||n){switch(t.inherit){case 3:case 4:m=e-t.worldX,f=s-t.worldY}const o=t.data.length*g;if(o>1e-4){const t=m*m+f*f;if(i&&t<o*o||n&&t>o*o){const e=(Math.sqrt(t)/o-1)*a+1;g*=e,r&&(p*=e)}}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+u*a,g,p,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,r,a,o,l){if(0!=t.inherit||0!=e.inherit)return;let h=t.ax,c=t.ay,d=t.ascaleX,u=t.ascaleY,m=d,f=u,g=e.ascaleX,p=0,b=0,w=0;d<0?(d=-d,p=180,w=-1):(p=0,w=1),u<0&&(u=-u,w=-w),g<0?(g=-g,b=180):b=0;let y=e.ax,v=0,k=0,A=0,S=t.a,C=t.b,T=t.c,I=t.d,M=Math.abs(d-u)<=1e-4;!M||r?(v=0,k=S*y+t.worldX,A=T*y+t.worldY):(v=e.ay,k=S*y+C*v+t.worldX,A=T*y+I*v+t.worldY);let F=t.parent;if(!F)throw new Error("IK parent must itself have a parent.");S=F.a,C=F.b,T=F.c,I=F.d;let Y=S*I-C*T,E=k-F.worldX,P=A-F.worldY;Y=Math.abs(Y)<=1e-4?0:1/Y;let X,B,R=(E*I-P*C)*Y-h,D=(P*S-E*T)*Y-c,V=Math.sqrt(R*R+D*D),O=e.data.length*g;if(V<1e-4)return this.apply1(t,s,i,!1,r,!1,l),void e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);E=s-F.worldX,P=i-F.worldY;let L=(E*I-P*C)*Y-h,_=(P*S-E*T)*Y-c,N=L*L+_*_;if(0!=o){o*=d*(g+1)*.5;let t=Math.sqrt(N),e=t-V-O*d+o;if(e>0){let s=Math.min(1,e/(2*o))-1;s=(e-o*(1-s*s))/t,L-=s*L,_-=s*_,N=L*L+_*_}}t:if(M){O*=d;let t=(N-V*V-O*O)/(2*V*O);t<-1?(t=-1,B=Math.PI*n):t>1?(t=1,B=0,r&&(S=(Math.sqrt(N)/(V+O)-1)*l+1,m*=S,a&&(f*=S))):B=Math.acos(t)*n,S=V+O*t,C=O*Math.sin(B),X=Math.atan2(_*S-L*C,L*S+_*C)}else{S=d*O,C=u*O;let t=S*S,e=C*C,s=Math.atan2(_,L);T=e*V*V+t*N-t*e;let i=-2*e*V,r=e-t;if(I=i*i-4*r*T,I>=0){let t=Math.sqrt(I);i<0&&(t=-t),t=.5*-(i+t);let e=t/r,a=T/t,o=Math.abs(e)<Math.abs(a)?e:a;if(e=N-o*o,e>=0){P=Math.sqrt(e)*n,X=s-Math.atan2(P,o),B=Math.atan2(P/u,(o-V)/d);break t}}let a=x.PI,o=V-S,l=o*o,h=0,c=0,m=V+S,f=m*m,g=0;T=-S*V/(t-e),T>=-1&&T<=1&&(T=Math.acos(T),E=S*Math.cos(T)+V,P=C*Math.sin(T),I=E*E+P*P,I<l&&(a=T,l=I,o=E,h=P),I>f&&(c=T,f=I,m=E,g=P)),N<=.5*(l+f)?(X=s-Math.atan2(h*n,o),B=a*n):(X=s-Math.atan2(g*n,m),B=c*n)}let U=Math.atan2(v,y)*w,q=t.arotation;X=(X-U)*x.radDeg+p-q,X>180?X-=360:X<-180&&(X+=360),t.updateWorldTransformWith(h,c,q+X*l,m,f,0,0),q=e.arotation,B=((B+U)*x.radDeg-e.ashearX)*w+b-q,B>180?B-=360:B<-180&&(B+=360),e.updateWorldTransformWith(y,v,q+B*l,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}},xe=class extends ue{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=0,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=0,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},be=class extends ue{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=we.Fixed,this.spacingMode=ye.Fixed,this.rotateMode=ve.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}},we=((re=we||{})[re.Fixed=0]="Fixed",re[re.Percent=1]="Percent",re),ye=((ae=ye||{})[ae.Length=0]="Length",ae[ae.Fixed=1]="Fixed",ae[ae.Percent=2]="Percent",ae[ae.Proportional=3]="Proportional",ae),ve=((oe=ve||{})[oe.Tangent=0]="Tangent",oe[oe.Chain=1]="Chain",oe[oe.ChainScale=2]="ChainScale",oe),ke=class{constructor(t,e){if(this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0,i=t.bones.length;s<i;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findSlot(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}`);this.target=s,this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.position=t.position,this.spacing=t.spacing,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY}update(t){let e=this.target.getAttachment();if(!(e instanceof te))return;let s=this.mixRotate,i=this.mixX,n=this.mixY;if(0==s&&0==i&&0==n)return;let r=this.data,a=0==r.rotateMode,o=2==r.rotateMode,l=this.bones,h=l.length,c=a?h:h+1,d=v.setArraySize(this.spaces,c),u=o?this.lengths=v.setArraySize(this.lengths,h):[],m=this.spacing;switch(r.spacingMode){case 2:if(o)for(let t=0,e=c-1;t<e;t++){let e=l[t],s=e.data.length,i=s*e.a,n=s*e.c;u[t]=Math.sqrt(i*i+n*n)}v.arrayFill(d,1,c,m);break;case 3:let t=0;for(let e=0,s=c-1;e<s;){let s=l[e],i=s.data.length;if(i<ke.epsilon)o&&(u[e]=0),d[++e]=m;else{let n=i*s.a,r=i*s.c,a=Math.sqrt(n*n+r*r);o&&(u[e]=a),d[++e]=a,t+=a}}if(t>0){t=c/t*m;for(let e=1;e<c;e++)d[e]*=t}break;default:let e=0==r.spacingMode;for(let t=0,s=c-1;t<s;){let s=l[t],i=s.data.length;if(i<ke.epsilon)o&&(u[t]=0),d[++t]=m;else{let n=i*s.a,r=i*s.c,a=Math.sqrt(n*n+r*r);o&&(u[t]=a),d[++t]=(e?i+m:m)*a/i}}}let f=this.computeWorldPositions(e,c,a),g=f[0],p=f[1],b=r.offsetRotation,w=!1;if(0==b)w=1==r.rotateMode;else{w=!1;let t=this.target.bone;b*=t.a*t.d-t.b*t.c>0?x.degRad:-x.degRad}for(let t=0,e=3;t<h;t++,e+=3){let r=l[t];r.worldX+=(g-r.worldX)*i,r.worldY+=(p-r.worldY)*n;let h=f[e],c=f[e+1],m=h-g,y=c-p;if(o){let e=u[t];if(0!=e){let t=(Math.sqrt(m*m+y*y)/e-1)*s+1;r.a*=t,r.c*=t}}if(g=h,p=c,s>0){let i=r.a,n=r.b,o=r.c,l=r.d,h=0,c=0,u=0;if(h=a?f[e-1]:0==d[t+1]?f[e+2]:Math.atan2(y,m),h-=Math.atan2(o,i),w){c=Math.cos(h),u=Math.sin(h);let t=r.data.length;g+=(t*(c*i-u*o)-m)*s,p+=(t*(u*i+c*o)-y)*s}else h+=b;h>x.PI?h-=x.PI2:h<-x.PI&&(h+=x.PI2),h*=s,c=Math.cos(h),u=Math.sin(h),r.a=c*i-u*o,r.b=c*n-u*l,r.c=u*i+c*o,r.d=u*n+c*l}r.updateAppliedTransform()}}computeWorldPositions(t,e,s){let i=this.target,n=this.position,r=this.spaces,a=v.setArraySize(this.positions,3*e+2),o=this.world,l=t.closed,h=t.worldVerticesLength,c=h/6,d=ke.NONE;if(!t.constantSpeed){let u=t.lengths;c-=l?1:2;let m,f=u[c];switch(1==this.data.positionMode&&(n*=f),this.data.spacingMode){case 2:m=f;break;case 3:m=f/e;break;default:m=1}o=v.setArraySize(this.world,8);for(let g=0,p=0,x=0;g<e;g++,p+=3){let e=r[g]*m;n+=e;let b=n;if(l)b%=f,b<0&&(b+=f),x=0;else{if(b<0){d!=ke.BEFORE&&(d=ke.BEFORE,t.computeWorldVertices(i,2,4,o,0,2)),this.addBeforePosition(b,o,0,a,p);continue}if(b>f){d!=ke.AFTER&&(d=ke.AFTER,t.computeWorldVertices(i,h-6,4,o,0,2)),this.addAfterPosition(b-f,o,0,a,p);continue}}for(;;x++){let t=u[x];if(!(b>t)){if(0==x)b/=t;else{let e=u[x-1];b=(b-e)/(t-e)}break}}x!=d&&(d=x,l&&x==c?(t.computeWorldVertices(i,h-4,4,o,0,2),t.computeWorldVertices(i,0,4,o,4,2)):t.computeWorldVertices(i,6*x+2,8,o,0,2)),this.addCurvePosition(b,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],a,p,s||g>0&&0==e)}return a}l?(h+=2,o=v.setArraySize(this.world,h),t.computeWorldVertices(i,2,h-4,o,0,2),t.computeWorldVertices(i,0,2,o,h-4,2),o[h-2]=o[0],o[h-1]=o[1]):(c--,h-=4,o=v.setArraySize(this.world,h),t.computeWorldVertices(i,2,h,o,0,2));let u,m=v.setArraySize(this.curves,c),f=0,g=o[0],p=o[1],x=0,b=0,w=0,y=0,k=0,A=0,S=0,C=0,T=0,I=0,M=0,F=0,Y=0,E=0;for(let t=0,e=2;t<c;t++,e+=6)x=o[e],b=o[e+1],w=o[e+2],y=o[e+3],k=o[e+4],A=o[e+5],S=.1875*(g-2*x+w),C=.1875*(p-2*b+y),T=.09375*(3*(x-w)-g+k),I=.09375*(3*(b-y)-p+A),M=2*S+T,F=2*C+I,Y=.75*(x-g)+S+.16666667*T,E=.75*(b-p)+C+.16666667*I,f+=Math.sqrt(Y*Y+E*E),Y+=M,E+=F,M+=T,F+=I,f+=Math.sqrt(Y*Y+E*E),Y+=M,E+=F,f+=Math.sqrt(Y*Y+E*E),Y+=M+T,E+=F+I,f+=Math.sqrt(Y*Y+E*E),m[t]=f,g=k,p=A;switch(1==this.data.positionMode&&(n*=f),this.data.spacingMode){case 2:u=f;break;case 3:u=f/e;break;default:u=1}let P=this.segments,X=0;for(let t=0,i=0,c=0,v=0;t<e;t++,i+=3){let e=r[t]*u;n+=e;let B=n;if(l)B%=f,B<0&&(B+=f),c=0;else{if(B<0){this.addBeforePosition(B,o,0,a,i);continue}if(B>f){this.addAfterPosition(B-f,o,h-4,a,i);continue}}for(;;c++){let t=m[c];if(!(B>t)){if(0==c)B/=t;else{let e=m[c-1];B=(B-e)/(t-e)}break}}if(c!=d){d=c;let t=6*c;for(g=o[t],p=o[t+1],x=o[t+2],b=o[t+3],w=o[t+4],y=o[t+5],k=o[t+6],A=o[t+7],S=.03*(g-2*x+w),C=.03*(p-2*b+y),T=.006*(3*(x-w)-g+k),I=.006*(3*(b-y)-p+A),M=2*S+T,F=2*C+I,Y=.3*(x-g)+S+.16666667*T,E=.3*(b-p)+C+.16666667*I,X=Math.sqrt(Y*Y+E*E),P[0]=X,t=1;t<8;t++)Y+=M,E+=F,M+=T,F+=I,X+=Math.sqrt(Y*Y+E*E),P[t]=X;Y+=M,E+=F,X+=Math.sqrt(Y*Y+E*E),P[8]=X,Y+=M+T,E+=F+I,X+=Math.sqrt(Y*Y+E*E),P[9]=X,v=0}for(B*=X;;v++){let t=P[v];if(!(B>t)){if(0==v)B/=t;else{let e=P[v-1];B=v+(B-e)/(t-e)}break}}this.addCurvePosition(.1*B,g,p,x,b,w,y,k,A,a,i,s||t>0&&0==e)}return a}addBeforePosition(t,e,s,i,n){let r=e[s],a=e[s+1],o=e[s+2]-r,l=e[s+3]-a,h=Math.atan2(l,o);i[n]=r+t*Math.cos(h),i[n+1]=a+t*Math.sin(h),i[n+2]=h}addAfterPosition(t,e,s,i,n){let r=e[s+2],a=e[s+3],o=r-e[s],l=a-e[s+1],h=Math.atan2(l,o);i[n]=r+t*Math.cos(h),i[n+1]=a+t*Math.sin(h),i[n+2]=h}addCurvePosition(t,e,s,i,n,r,a,o,l,h,c,d){if(0==t||isNaN(t))return h[c]=e,h[c+1]=s,void(h[c+2]=Math.atan2(n-s,i-e));let u=t*t,m=u*t,f=1-t,g=f*f,p=g*f,x=f*t,b=3*x,w=f*b,y=b*t,v=e*p+i*w+r*y+o*m,k=s*p+n*w+a*y+l*m;h[c]=v,h[c+1]=k,d&&(h[c+2]=t<.001?Math.atan2(n-s,i-e):Math.atan2(k-(s*g+n*x*2+a*u),v-(e*g+i*x*2+r*u)))}},Ae=ke;Ae.NONE=-1,Ae.BEFORE=-2,Ae.AFTER=-3,Ae.epsilon=1e-5;var Se=class{constructor(t,e){this._bone=null,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this._reset=!0,this.ux=0,this.uy=0,this.cx=0,this.cy=0,this.tx=0,this.ty=0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0,this.active=!1,this.remaining=0,this.lastTime=0,this.data=t,this.skeleton=e,this.bone=e.bones[t.bone.index],this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const t=this.data;this.inertia=t.inertia,this.strength=t.strength,this.damping=t.damping,this.massInverse=t.massInverse,this.wind=t.wind,this.gravity=t.gravity,this.mix=t.mix}isActive(){return this.active}update(t){const e=this.mix;if(0==e)return;const s=this.data.x>0,i=this.data.y>0,n=this.data.rotate>0||this.data.shearX>0,r=this.data.scaleX>0,a=this.bone,o=a.data.length;switch(t){case 0:return;case 1:this.reset();case 2:const t=this.skeleton,l=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=l,this.lastTime=t.time;const h=a.worldX,c=a.worldY;if(this._reset)this._reset=!1,this.ux=h,this.uy=c;else{let d=this.remaining,u=this.inertia,m=this.data.step,f=this.skeleton.data.referenceScale,g=-1,p=this.data.limit*l,b=p*Math.abs(t.scaleY);if(p*=Math.abs(t.scaleX),s||i){if(s){const t=(this.ux-h)*u;this.xOffset+=t>p?p:t<-p?-p:t,this.ux=h}if(i){const t=(this.uy-c)*u;this.yOffset+=t>b?b:t<-b?-b:t,this.uy=c}if(d>=m){g=Math.pow(this.damping,60*m);const t=this.massInverse*m,e=this.strength,n=this.wind*f,r=(Me.yDown?-this.gravity:this.gravity)*f;do{s&&(this.xVelocity+=(n-this.xOffset*e)*t,this.xOffset+=this.xVelocity*m,this.xVelocity*=g),i&&(this.yVelocity-=(r+this.yOffset*e)*t,this.yOffset+=this.yVelocity*m,this.yVelocity*=g),d-=m}while(d>=m)}s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n||r){let t=Math.atan2(a.c,a.a),s=0,i=0,l=0,h=this.cx-a.worldX,c=this.cy-a.worldY;if(h>p?h=p:h<-p&&(h=-p),c>b?c=b:c<-b&&(c=-b),n){l=(this.data.rotate+this.data.shearX)*e;let n=Math.atan2(c+this.ty,h+this.tx)-t-this.rotateOffset*l;this.rotateOffset+=(n-Math.ceil(n*x.invPI2-.5)*x.PI2)*u,n=this.rotateOffset*l+t,s=Math.cos(n),i=Math.sin(n),r&&(n=o*a.getWorldScaleX(),n>0&&(this.scaleOffset+=(h*s+c*i)*u/n))}else{s=Math.cos(t),i=Math.sin(t);const e=o*a.getWorldScaleX();e>0&&(this.scaleOffset+=(h*s+c*i)*u/e)}if(d=this.remaining,d>=m){-1==g&&(g=Math.pow(this.damping,60*m));const e=this.massInverse*m,a=this.strength,h=this.wind,c=Me.yDown?-this.gravity:this.gravity,u=o/f;for(;;)if(d-=m,r&&(this.scaleVelocity+=(h*s-c*i-this.scaleOffset*a)*e,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=g),n){if(this.rotateVelocity-=((h*i+c*s)*u+this.rotateOffset*a)*e,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=g,d<m)break;const n=this.rotateOffset*l+t;s=Math.cos(n),i=Math.sin(n)}else if(d<m)break}}this.remaining=d}this.cx=a.worldX,this.cy=a.worldY;break;case 3:s&&(a.worldX+=this.xOffset*e*this.data.x),i&&(a.worldY+=this.yOffset*e*this.data.y)}if(n){let t=this.rotateOffset*e,s=0,i=0,n=0;if(this.data.shearX>0){let e=0;this.data.rotate>0&&(e=t*this.data.rotate,s=Math.sin(e),i=Math.cos(e),n=a.b,a.b=i*n-s*a.d,a.d=s*n+i*a.d),e+=t*this.data.shearX,s=Math.sin(e),i=Math.cos(e),n=a.a,a.a=i*n-s*a.c,a.c=s*n+i*a.c}else t*=this.data.rotate,s=Math.sin(t),i=Math.cos(t),n=a.a,a.a=i*n-s*a.c,a.c=s*n+i*a.c,n=a.b,a.b=i*n-s*a.d,a.d=s*n+i*a.d}if(r){const t=1+this.scaleOffset*e*this.data.scaleX;a.a*=t,a.c*=t}3!=t&&(this.tx=o*a.a,this.ty=o*a.c),a.updateAppliedTransform()}translate(t,e){this.ux-=t,this.uy-=e,this.cx-=t,this.cy-=e}rotate(t,e,s){const i=s*x.degRad,n=Math.cos(i),r=Math.sin(i),a=this.cx-t,o=this.cy-e;this.translate(a*n-o*r-a,a*r+o*n-o)}},Ce=class{constructor(t,e){if(this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!t)throw new Error("data cannot be null.");if(!e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new g,this.darkColor=t.darkColor?new g:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(t instanceof T&&this.attachment instanceof T&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}},Te=class{constructor(t,e){if(this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new A,this.active=!1,!t)throw new Error("data cannot be null.");if(!e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(let s=0;s<t.bones.length;s++){let i=e.findBone(t.bones[s].name);if(!i)throw new Error(`Couldn't find bone ${t.bones[s].name}.`);this.bones.push(i)}let s=e.findBone(t.target.name);if(!s)throw new Error(`Couldn't find target bone ${t.target.name}.`);this.target=s,this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}isActive(){return this.active}setToSetupPose(){const t=this.data;this.mixRotate=t.mixRotate,this.mixX=t.mixX,this.mixY=t.mixY,this.mixScaleX=t.mixScaleX,this.mixScaleY=t.mixScaleY,this.mixShearY=t.mixShearY}update(t){0==this.mixRotate&&0==this.mixX&&0==this.mixY&&0==this.mixScaleX&&0==this.mixScaleY&&0==this.mixShearY||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?x.degRad:-x.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let u=0,p=g.length;u<p;u++){let p=g[u];if(0!=t){let e=p.a,s=p.b,i=p.c,n=p.d,r=Math.atan2(c,l)-Math.atan2(i,e)+m;r>x.PI?r-=x.PI2:r<-x.PI&&(r+=x.PI2),r*=t;let a=Math.cos(r),o=Math.sin(r);p.a=a*e-o*i,p.b=a*s-o*n,p.c=o*e+a*i,p.d=o*s+a*n}if(a){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(t.x-p.worldX)*e,p.worldY+=(t.y-p.worldY)*s}if(0!=i){let t=Math.sqrt(p.a*p.a+p.c*p.c);0!=t&&(t=(t+(Math.sqrt(l*l+c*c)-t+this.data.offsetScaleX)*i)/t),p.a*=t,p.c*=t}if(0!=n){let t=Math.sqrt(p.b*p.b+p.d*p.d);0!=t&&(t=(t+(Math.sqrt(h*h+d*d)-t+this.data.offsetScaleY)*n)/t),p.b*=t,p.d*=t}if(r>0){let t=p.b,e=p.d,s=Math.atan2(e,t),i=Math.atan2(d,h)-Math.atan2(c,l)-(s-Math.atan2(p.c,p.a));i>x.PI?i-=x.PI2:i<-x.PI&&(i+=x.PI2),i=s+(i+f)*r;let n=Math.sqrt(t*t+e*e);p.b=Math.cos(i)*n,p.d=Math.sin(i)*n}p.updateAppliedTransform()}}applyRelativeWorld(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=0!=e||0!=s,o=this.target,l=o.a,h=o.b,c=o.c,d=o.d,u=l*d-h*c>0?x.degRad:-x.degRad,m=this.data.offsetRotation*u,f=this.data.offsetShearY*u,g=this.bones;for(let u=0,p=g.length;u<p;u++){let p=g[u];if(0!=t){let e=p.a,s=p.b,i=p.c,n=p.d,r=Math.atan2(c,l)+m;r>x.PI?r-=x.PI2:r<-x.PI&&(r+=x.PI2),r*=t;let a=Math.cos(r),o=Math.sin(r);p.a=a*e-o*i,p.b=a*s-o*n,p.c=o*e+a*i,p.d=o*s+a*n}if(a){let t=this.temp;o.localToWorld(t.set(this.data.offsetX,this.data.offsetY)),p.worldX+=t.x*e,p.worldY+=t.y*s}if(0!=i){let t=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleX)*i+1;p.a*=t,p.c*=t}if(0!=n){let t=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*n+1;p.b*=t,p.d*=t}if(r>0){let t=Math.atan2(d,h)-Math.atan2(c,l);t>x.PI?t-=x.PI2:t<-x.PI&&(t+=x.PI2);let e=p.b,s=p.d;t=Math.atan2(s,e)+(t-x.PI/2+f)*r;let i=Math.sqrt(e*e+s*s);p.b=Math.cos(t)*i,p.d=Math.sin(t)*i}p.updateAppliedTransform()}}applyAbsoluteLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation;0!=t&&(c+=(a.arotation-c+this.data.offsetRotation)*t);let d=h.ax,u=h.ay;d+=(a.ax-d+this.data.offsetX)*e,u+=(a.ay-u+this.data.offsetY)*s;let m=h.ascaleX,f=h.ascaleY;0!=i&&0!=m&&(m=(m+(a.ascaleX-m+this.data.offsetScaleX)*i)/m),0!=n&&0!=f&&(f=(f+(a.ascaleY-f+this.data.offsetScaleY)*n)/f);let g=h.ashearY;0!=r&&(g+=(a.ashearY-g+this.data.offsetShearY)*r),h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}applyRelativeLocal(){let t=this.mixRotate,e=this.mixX,s=this.mixY,i=this.mixScaleX,n=this.mixScaleY,r=this.mixShearY,a=this.target,o=this.bones;for(let l=0,h=o.length;l<h;l++){let h=o[l],c=h.arotation+(a.arotation+this.data.offsetRotation)*t,d=h.ax+(a.ax+this.data.offsetX)*e,u=h.ay+(a.ay+this.data.offsetY)*s,m=h.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*i+1),f=h.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*n+1),g=h.ashearY+(a.ashearY+this.data.offsetShearY)*r;h.updateWorldTransformWith(d,u,c,m,f,h.ashearX,g)}}},Ie=class{constructor(t){if(this._updateCache=new Array,this.skin=null,this.scaleX=1,this._scaleY=1,this.x=0,this.y=0,this.time=0,!t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(let e=0;e<t.bones.length;e++){let s,i=t.bones[e];if(i.parent){let t=this.bones[i.parent.index];s=new de(i,this,t),t.children.push(s)}else s=new de(i,this,null);this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let e=0;e<t.slots.length;e++){let s=t.slots[e],i=this.bones[s.boneData.index],n=new Ce(s,i);this.slots.push(n),this.drawOrder.push(n)}this.ikConstraints=new Array;for(let e=0;e<t.ikConstraints.length;e++){let s=t.ikConstraints[e];this.ikConstraints.push(new pe(s,this))}this.transformConstraints=new Array;for(let e=0;e<t.transformConstraints.length;e++){let s=t.transformConstraints[e];this.transformConstraints.push(new Te(s,this))}this.pathConstraints=new Array;for(let e=0;e<t.pathConstraints.length;e++){let s=t.pathConstraints[e];this.pathConstraints.push(new Ae(s,this))}this.physicsConstraints=new Array;for(let e=0;e<t.physicsConstraints.length;e++){let s=t.physicsConstraints[e];this.physicsConstraints.push(new Se(s,this))}this.color=new g(1,1,1,1),this.updateCache()}get scaleY(){return Ie.yDown?-this._scaleY:this._scaleY}set scaleY(t){this._scaleY=t}updateCache(){this._updateCache.length=0;let t=this.bones;for(let e=0,s=t.length;e<s;e++){let s=t[e];s.sorted=s.data.skinRequired,s.active=!s.sorted}if(this.skin){let t=this.skin.bones;for(let e=0,s=this.skin.bones.length;e<s;e++){let s=this.bones[t[e].index];do{s.sorted=!1,s.active=!0,s=s.parent}while(s)}}let e=this.ikConstraints,s=this.transformConstraints,i=this.pathConstraints,n=this.physicsConstraints,r=e.length,a=s.length,o=i.length,l=this.physicsConstraints.length,h=r+a+o+l;t:for(let t=0;t<h;t++){for(let s=0;s<r;s++){let i=e[s];if(i.data.order==t){this.sortIkConstraint(i);continue t}}for(let e=0;e<a;e++){let i=s[e];if(i.data.order==t){this.sortTransformConstraint(i);continue t}}for(let e=0;e<o;e++){let s=i[e];if(s.data.order==t){this.sortPathConstraint(s);continue t}}for(let e=0;e<l;e++){const s=n[e];if(s.data.order==t){this.sortPhysicsConstraint(s);continue t}}}for(let e=0,s=t.length;e<s;e++)this.sortBone(t[e])}sortIkConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&v.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target;this.sortBone(e);let s=t.bones,i=s[0];if(this.sortBone(i),1==s.length)this._updateCache.push(t),this.sortReset(i.children);else{let e=s[s.length-1];this.sortBone(e),this._updateCache.push(t),this.sortReset(i.children),e.sorted=!0}}sortPathConstraint(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||this.skin&&v.contains(this.skin.constraints,t.data,!0)),!t.active)return;let e=t.target,s=e.data.index,i=e.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,i),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,i);for(let t=0,e=this.data.skins.length;t<e;t++)this.sortPathConstraintAttachment(this.data.skins[t],s,i);let n=e.getAttachment();n instanceof te&&this.sortPathConstraintAttachmentWith(n,i);let r=t.bones,a=r.length;for(let t=0;t<a;t++)this.sortBone(r[t]);this._updateCache.push(t);for(let t=0;t<a;t++)this.sortReset(r[t].children);for(let t=0;t<a;t++)r[t].sorted=!0}sortTransformConstraint(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||this.skin&&v.contains(this.skin.constraints,t.data,!0)),!t.active)return;this.sortBone(t.target);let e=t.bones,s=e.length;if(t.data.local)for(let t=0;t<s;t++){let s=e[t];this.sortBone(s.parent),this.sortBone(s)}else for(let t=0;t<s;t++)this.sortBone(e[t]);this._updateCache.push(t);for(let t=0;t<s;t++)this.sortReset(e[t].children);for(let t=0;t<s;t++)e[t].sorted=!0}sortPathConstraintAttachment(t,e,s){let i=t.attachments[e];if(i)for(let t in i)this.sortPathConstraintAttachmentWith(i[t],s)}sortPathConstraintAttachmentWith(t,e){if(!(t instanceof te))return;let s=t.bones;if(s){let t=this.bones;for(let e=0,i=s.length;e<i;){let i=s[e++];for(i+=e;e<i;)this.sortBone(t[s[e++]])}}else this.sortBone(e)}sortPhysicsConstraint(t){const e=t.bone;t.active=e.active&&(!t.data.skinRequired||null!=this.skin&&v.contains(this.skin.constraints,t.data,!0)),t.active&&(this.sortBone(e),this._updateCache.push(t),this.sortReset(e.children),e.sorted=!0)}sortBone(t){if(!t)return;if(t.sorted)return;let e=t.parent;e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}sortReset(t){for(let e=0,s=t.length;e<s;e++){let s=t[e];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(t){if(null==t)throw new Error("physics is undefined");let e=this.bones;for(let t=0,s=e.length;t<s;t++){let s=e[t];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY}let s=this._updateCache;for(let e=0,i=s.length;e<i;e++)s[e].update(t)}updateWorldTransformWith(t,e){if(!e)throw new Error("parent cannot be null.");let s=this.bones;for(let t=1,e=s.length;t<e;t++){let e=s[t];e.ax=e.x,e.ay=e.y,e.arotation=e.rotation,e.ascaleX=e.scaleX,e.ascaleY=e.scaleY,e.ashearX=e.shearX,e.ashearY=e.shearY}let i=this.getRootBone();if(!i)throw new Error("Root bone must not be null.");let n=e.a,r=e.b,a=e.c,o=e.d;i.worldX=n*this.x+r*this.y+e.worldX,i.worldY=a*this.x+o*this.y+e.worldY;const l=(i.rotation+i.shearX)*x.degRad,h=(i.rotation+90+i.shearY)*x.degRad,c=Math.cos(l)*i.scaleX,d=Math.cos(h)*i.scaleY,u=Math.sin(l)*i.scaleX,m=Math.sin(h)*i.scaleY;i.a=(n*c+r*u)*this.scaleX,i.b=(n*d+r*m)*this.scaleX,i.c=(a*c+o*u)*this.scaleY,i.d=(a*d+o*m)*this.scaleY;let f=this._updateCache;for(let e=0,s=f.length;e<s;e++){let s=f[e];s!=i&&s.update(t)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const t of this.bones)t.setToSetupPose();for(const t of this.ikConstraints)t.setToSetupPose();for(const t of this.transformConstraints)t.setToSetupPose();for(const t of this.pathConstraints)t.setToSetupPose();for(const t of this.physicsConstraints)t.setToSetupPose()}setSlotsToSetupPose(){let t=this.slots;v.arrayCopy(t,0,this.drawOrder,0,t.length);for(let e=0,s=t.length;e<s;e++)t[e].setToSetupPose()}getRootBone(){return 0==this.bones.length?null:this.bones[0]}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.data.name==t)return i}return null}setSkinByName(t){let e=this.data.findSkin(t);if(!e)throw new Error("Skin not found: "+t);this.setSkin(e)}setSkin(t){if(t!=this.skin){if(t)if(this.skin)t.attachAll(this,this.skin);else{let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s],n=i.data.attachmentName;if(n){let e=t.getAttachment(s,n);e&&i.setAttachment(e)}}}this.skin=t,this.updateCache()}}getAttachmentByName(t,e){let s=this.data.findSlot(t);if(!s)throw new Error(`Can't find slot with name ${t}`);return this.getAttachment(s.index,e)}getAttachment(t,e){if(!e)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(t,e);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null}setAttachment(t,e){if(!t)throw new Error("slotName cannot be null.");let s=this.slots;for(let i=0,n=s.length;i<n;i++){let n=s[i];if(n.data.name==t){let s=null;if(e&&(s=this.getAttachment(i,e),!s))throw new Error("Attachment not found: "+e+", for slot: "+t);return void n.setAttachment(s)}}throw new Error("Slot not found: "+t)}findIkConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return null!=(e=this.ikConstraints.find((e=>e.data.name==t)))?e:null}findTransformConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return null!=(e=this.transformConstraints.find((e=>e.data.name==t)))?e:null}findPathConstraint(t){var e;if(!t)throw new Error("constraintName cannot be null.");return null!=(e=this.pathConstraints.find((e=>e.data.name==t)))?e:null}findPhysicsConstraint(t){var e;if(null==t)throw new Error("constraintName cannot be null.");return null!=(e=this.physicsConstraints.find((e=>e.data.name==t)))?e:null}getBoundsRect(){let t=new A,e=new A;return this.getBounds(t,e),{x:t.x,y:t.y,width:e.x,height:e.y}}getBounds(t,e,s=new Array(2),i=null){if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");let n=this.drawOrder,r=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let t=0,e=n.length;t<e;t++){let e=n[t];if(!e.bone.active)continue;let h=0,c=null,d=null,u=e.getAttachment();if(u instanceof ie)h=8,c=v.setArraySize(s,h,0),u.computeWorldVertices(e,c,0,2),d=Ie.quadTriangles;else if(u instanceof Zt){let t=u;h=t.worldVerticesLength,c=v.setArraySize(s,h,0),t.computeWorldVertices(e,0,h,c,0,2),d=t.triangles}else if(u instanceof Wt&&null!=i){i.clipStart(e,u);continue}if(c&&d){null!=i&&i.isClipping()&&(i.clipTriangles(c,d,d.length),c=i.clippedVertices,h=i.clippedVertices.length);for(let t=0,e=c.length;t<e;t+=2){let e=c[t],s=c[t+1];r=Math.min(r,e),a=Math.min(a,s),o=Math.max(o,e),l=Math.max(l,s)}}null!=i&&i.clipEndWithSlot(e)}null!=i&&i.clipEnd(),t.set(r,a),e.set(o-r,l-a)}update(t){this.time+=t}physicsTranslate(t,e){const s=this.physicsConstraints;for(let i=0,n=s.length;i<n;i++)s[i].translate(t,e)}physicsRotate(t,e,s){const i=this.physicsConstraints;for(let n=0,r=i.length;n<r;n++)i[n].rotate(t,e,s)}},Me=Ie;Me.quadTriangles=[0,1,2,2,3,0],Me.yDown=!1;var Fe,Ye,Ee,Pe=((Fe=Pe||{})[Fe.none=0]="none",Fe[Fe.reset=1]="reset",Fe[Fe.update=2]="update",Fe[Fe.pose=3]="pose",Fe),Xe=class extends ue{constructor(t){super(t,0,!1),this._bone=null,this.x=0,this.y=0,this.rotate=0,this.scaleX=0,this.shearX=0,this.limit=0,this.step=0,this.inertia=0,this.strength=0,this.damping=0,this.massInverse=0,this.wind=0,this.gravity=0,this.mix=0,this.inertiaGlobal=!1,this.strengthGlobal=!1,this.dampingGlobal=!1,this.massGlobal=!1,this.windGlobal=!1,this.gravityGlobal=!1,this.mixGlobal=!1}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}},Be=class{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.physicsConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.referenceScale=100,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");let e=this.bones;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSlot(t){if(!t)throw new Error("slotName cannot be null.");let e=this.slots;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findSkin(t){if(!t)throw new Error("skinName cannot be null.");let e=this.skins;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");let e=this.events;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");let e=this.animations;for(let s=0,i=e.length;s<i;s++){let i=e[s];if(i.name==t)return i}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}findPhysicsConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.physicsConstraints;for(let s=0,i=e.length;s<i;s++){const i=e[s];if(i.name==t)return i}return null}},Re=class{constructor(t=0,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},De=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,this.color=new g(.99607843,.61960787,.30980393,1),!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");let i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e],i=!1;for(let t=0;t<this.bones.length;t++)if(this.bones[t]==s){i=!0;break}i||this.bones.push(s)}for(let e=0;e<t.constraints.length;e++){let s=t.constraints[e],i=!1;for(let t=0;t<this.constraints.length;t++)if(this.constraints[t]==s){i=!0;break}i||this.constraints.push(s)}let e=t.getAttachments();for(let t=0;t<e.length;t++){var s=e[t];s.attachment&&(s.attachment instanceof Zt?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(t,e){let s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){let s=this.attachments[t];s&&delete s[e]}getAttachments(){let t=new Array;for(var e=0;e<this.attachments.length;e++){let s=this.attachments[e];if(s)for(let i in s){let n=s[i];n&&t.push(new Re(e,i,n))}}return t}getAttachmentsForSlot(t,e){let s=this.attachments[t];if(s)for(let i in s){let n=s[i];n&&e.push(new Re(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){let n=t.slots[i],r=n.getAttachment();if(r&&s<e.attachments.length){let t=e.attachments[s];for(let e in t){if(r==t[e]){let t=this.getAttachment(s,e);t&&n.setAttachment(t);break}}}s++}}},Ve=class{constructor(t,e,s){if(this.index=0,this.color=new g(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=Oe.Normal,this.visible=!0,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},Oe=((Ye=Oe||{})[Ye.Normal=0]="Normal",Ye[Ye.Additive=1]="Additive",Ye[Ye.Multiply=2]="Multiply",Ye[Ye.Screen=3]="Screen",Ye),Le=class extends ue{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},_e=class{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){var e;let s=this.scale,i=new Be;i.name="";let n=new Ne(t),r=n.readInt32(),a=n.readInt32();i.hash=0==a&&0==r?null:a.toString(16)+r.toString(16),i.version=n.readString(),i.x=n.readFloat(),i.y=n.readFloat(),i.width=n.readFloat(),i.height=n.readFloat(),i.referenceScale=n.readFloat()*s;let o=n.readBoolean();o&&(i.fps=n.readFloat(),i.imagesPath=n.readString(),i.audioPath=n.readString());let l=0;l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("String in string table must not be null.");n.strings.push(t)}l=n.readInt(!0);for(let t=0;t<l;t++){let r=n.readString();if(!r)throw new Error("Bone name must not be null.");let a=0==t?null:i.bones[n.readInt(!0)],l=new he(t,r,a);l.rotation=n.readFloat(),l.x=n.readFloat()*s,l.y=n.readFloat()*s,l.scaleX=n.readFloat(),l.scaleY=n.readFloat(),l.shearX=n.readFloat(),l.shearY=n.readFloat(),l.length=n.readFloat()*s,l.inherit=n.readByte(),l.skinRequired=n.readBoolean(),o&&(g.rgba8888ToColor(l.color,n.readInt32()),l.icon=null!=(e=n.readString())?e:void 0,l.visible=n.readBoolean()),i.bones.push(l)}l=n.readInt(!0);for(let t=0;t<l;t++){let e=n.readString();if(!e)throw new Error("Slot name must not be null.");let s=i.bones[n.readInt(!0)],r=new Ve(t,e,s);g.rgba8888ToColor(r.color,n.readInt32());let a=n.readInt32();-1!=a&&g.rgb888ToColor(r.darkColor=new g,a),r.attachmentName=n.readStringRef(),r.blendMode=n.readInt(!0),o&&(r.visible=n.readBoolean()),i.slots.push(r)}l=n.readInt(!0);for(let t,e=0;e<l;e++){let e=n.readString();if(!e)throw new Error("IK constraint data name must not be null.");let r=new xe(e);r.order=n.readInt(!0),t=n.readInt(!0);for(let e=0;e<t;e++)r.bones.push(i.bones[n.readInt(!0)]);r.target=i.bones[n.readInt(!0)];let a=n.readByte();r.skinRequired=!!(1&a),r.bendDirection=2&a?1:-1,r.compress=!!(4&a),r.stretch=!!(8&a),r.uniform=!!(16&a),32&a&&(r.mix=64&a?n.readFloat():1),128&a&&(r.softness=n.readFloat()*s),i.ikConstraints.push(r)}l=n.readInt(!0);for(let t,e=0;e<l;e++){let e=n.readString();if(!e)throw new Error("Transform constraint data name must not be null.");let r=new Le(e);r.order=n.readInt(!0),t=n.readInt(!0);for(let e=0;e<t;e++)r.bones.push(i.bones[n.readInt(!0)]);r.target=i.bones[n.readInt(!0)];let a=n.readByte();r.skinRequired=!!(1&a),r.local=!!(2&a),r.relative=!!(4&a),8&a&&(r.offsetRotation=n.readFloat()),16&a&&(r.offsetX=n.readFloat()*s),32&a&&(r.offsetY=n.readFloat()*s),64&a&&(r.offsetScaleX=n.readFloat()),128&a&&(r.offsetScaleY=n.readFloat()),a=n.readByte(),1&a&&(r.offsetShearY=n.readFloat()),2&a&&(r.mixRotate=n.readFloat()),4&a&&(r.mixX=n.readFloat()),8&a&&(r.mixY=n.readFloat()),16&a&&(r.mixScaleX=n.readFloat()),32&a&&(r.mixScaleY=n.readFloat()),64&a&&(r.mixShearY=n.readFloat()),i.transformConstraints.push(r)}l=n.readInt(!0);for(let t,e=0;e<l;e++){let e=n.readString();if(!e)throw new Error("Path constraint data name must not be null.");let r=new be(e);r.order=n.readInt(!0),r.skinRequired=n.readBoolean(),t=n.readInt(!0);for(let e=0;e<t;e++)r.bones.push(i.bones[n.readInt(!0)]);r.target=i.slots[n.readInt(!0)];const a=n.readByte();r.positionMode=1&a,r.spacingMode=a>>1&3,r.rotateMode=a>>3&3,128&a&&(r.offsetRotation=n.readFloat()),r.position=n.readFloat(),0==r.positionMode&&(r.position*=s),r.spacing=n.readFloat(),0!=r.spacingMode&&1!=r.spacingMode||(r.spacing*=s),r.mixRotate=n.readFloat(),r.mixX=n.readFloat(),r.mixY=n.readFloat(),i.pathConstraints.push(r)}l=n.readInt(!0);for(let t=0;t<l;t++){const t=n.readString();if(!t)throw new Error("Physics constraint data name must not be null.");const e=new Xe(t);e.order=n.readInt(!0),e.bone=i.bones[n.readInt(!0)];let r=n.readByte();e.skinRequired=!!(1&r),2&r&&(e.x=n.readFloat()),4&r&&(e.y=n.readFloat()),8&r&&(e.rotate=n.readFloat()),16&r&&(e.scaleX=n.readFloat()),32&r&&(e.shearX=n.readFloat()),e.limit=(64&r?n.readFloat():5e3)*s,e.step=1/n.readUnsignedByte(),e.inertia=n.readFloat(),e.strength=n.readFloat(),e.damping=n.readFloat(),e.massInverse=128&r?n.readFloat():1,e.wind=n.readFloat(),e.gravity=n.readFloat(),r=n.readByte(),1&r&&(e.inertiaGlobal=!0),2&r&&(e.strengthGlobal=!0),4&r&&(e.dampingGlobal=!0),8&r&&(e.massGlobal=!0),16&r&&(e.windGlobal=!0),32&r&&(e.gravityGlobal=!0),64&r&&(e.mixGlobal=!0),e.mix=128&r?n.readFloat():1,i.physicsConstraints.push(e)}let h=this.readSkin(n,i,!0,o);h&&(i.defaultSkin=h,i.skins.push(h));{let t=i.skins.length;for(v.setArraySize(i.skins,l=t+n.readInt(!0));t<l;t++){let e=this.readSkin(n,i,!1,o);if(!e)throw new Error("readSkin() should not have returned null.");i.skins[t]=e}}l=this.linkedMeshes.length;for(let t=0;t<l;t++){let e=this.linkedMeshes[t];const s=i.skins[e.skinIndex];if(!e.parent)throw new Error("Linked mesh parent must not be null");let n=s.getAttachment(e.slotIndex,e.parent);if(!n)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?n:e.mesh,e.mesh.setParentMesh(n),null!=e.mesh.region&&e.mesh.updateRegion()}this.linkedMeshes.length=0,l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("Event data name must not be null");let e=new ge(t);e.intValue=n.readInt(!1),e.floatValue=n.readFloat(),e.stringValue=n.readString(),e.audioPath=n.readString(),e.audioPath&&(e.volume=n.readFloat(),e.balance=n.readFloat()),i.events.push(e)}l=n.readInt(!0);for(let t=0;t<l;t++){let t=n.readString();if(!t)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(n,t,i))}return i}readSkin(t,e,s,i){let n=null,r=0;if(s){if(r=t.readInt(!0),0==r)return null;n=new De("default")}else{let s=t.readString();if(!s)throw new Error("Skin name must not be null.");n=new De(s),i&&g.rgba8888ToColor(n.color,t.readInt32()),n.bones.length=t.readInt(!0);for(let s=0,i=n.bones.length;s<i;s++)n.bones[s]=e.bones[t.readInt(!0)];for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);for(let s=0,i=t.readInt(!0);s<i;s++)n.constraints.push(e.physicsConstraints[t.readInt(!0)]);r=t.readInt(!0)}for(let s=0;s<r;s++){let s=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let r=t.readStringRef();if(!r)throw new Error("Attachment name must not be null");let a=this.readAttachment(t,e,n,s,r,i);a&&n.setAttachment(s,r,a)}}return n}readAttachment(t,e,s,i,n,r){let a=this.scale,o=t.readByte();const l=8&o?t.readStringRef():n;if(!l)throw new Error("Attachment name must not be null");switch(7&o){case We.Region:{let e=16&o?t.readStringRef():null;const i=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null;let r=128&o?t.readFloat():0,h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),m=t.readFloat(),f=t.readFloat();e||(e=l);let p=this.attachmentLoader.newRegionAttachment(s,l,e,n);return p?(p.path=e,p.x=h*a,p.y=c*a,p.scaleX=d,p.scaleY=u,p.rotation=r,p.width=m*a,p.height=f*a,g.rgba8888ToColor(p.color,i),p.sequence=n,null==n&&p.updateRegion(),p):null}case We.BoundingBox:{let e=this.readVertices(t,!!(16&o)),i=r?t.readInt32():0,n=this.attachmentLoader.newBoundingBoxAttachment(s,l);return n?(n.worldVerticesLength=e.length,n.vertices=e.vertices,n.bones=e.bones,r&&g.rgba8888ToColor(n.color,i),n):null}case We.Mesh:{let e=16&o?t.readStringRef():l;const i=32&o?t.readInt32():4294967295,n=64&o?this.readSequence(t):null,h=t.readInt(!0),c=this.readVertices(t,!!(128&o)),d=this.readFloatArray(t,c.length,1),u=this.readShortArray(t,3*(c.length-h-2));let m=[],f=0,p=0;r&&(m=this.readShortArray(t,t.readInt(!0)),f=t.readFloat(),p=t.readFloat()),e||(e=l);let x=this.attachmentLoader.newMeshAttachment(s,l,e,n);return x?(x.path=e,g.rgba8888ToColor(x.color,i),x.bones=c.bones,x.vertices=c.vertices,x.worldVerticesLength=c.length,x.triangles=u,x.regionUVs=d,null==n&&x.updateRegion(),x.hullLength=h<<1,x.sequence=n,r&&(x.edges=m,x.width=f*a,x.height=p*a),x):null}case We.LinkedMesh:{const e=16&o?t.readStringRef():l;if(null==e)throw new Error("Path of linked mesh must not be null");const n=32&o?t.readInt32():4294967295,h=64&o?this.readSequence(t):null,c=!!(128&o),d=t.readInt(!0),u=t.readStringRef();let m=0,f=0;r&&(m=t.readFloat(),f=t.readFloat());let p=this.attachmentLoader.newMeshAttachment(s,l,e,h);return p?(p.path=e,g.rgba8888ToColor(p.color,n),p.sequence=h,r&&(p.width=m*a,p.height=f*a),this.linkedMeshes.push(new Ue(p,d,i,u,c)),p):null}case We.Path:{const e=!!(16&o),i=!!(32&o),n=this.readVertices(t,!!(64&o)),h=v.newArray(n.length/6,0);for(let e=0,s=h.length;e<s;e++)h[e]=t.readFloat()*a;const c=r?t.readInt32():0,d=this.attachmentLoader.newPathAttachment(s,l);return d?(d.closed=e,d.constantSpeed=i,d.worldVerticesLength=n.length,d.vertices=n.vertices,d.bones=n.bones,d.lengths=h,r&&g.rgba8888ToColor(d.color,c),d):null}case We.Point:{const e=t.readFloat(),i=t.readFloat(),n=t.readFloat(),o=r?t.readInt32():0,h=this.attachmentLoader.newPointAttachment(s,l);return h?(h.x=i*a,h.y=n*a,h.rotation=e,r&&g.rgba8888ToColor(h.color,o),h):null}case We.Clipping:{const i=t.readInt(!0),n=this.readVertices(t,!!(16&o));let a=r?t.readInt32():0,h=this.attachmentLoader.newClippingAttachment(s,l);return h?(h.endSlot=e.slots[i],h.worldVerticesLength=n.length,h.vertices=n.vertices,h.bones=n.bones,r&&g.rgba8888ToColor(h.color,a),h):null}}return null}readSequence(t){let e=new M(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readVertices(t,e){const s=this.scale,i=t.readInt(!0),n=new qe;if(n.length=i<<1,!e)return n.vertices=this.readFloatArray(t,n.length,s),n;let r=new Array,a=new Array;for(let e=0;e<i;e++){let e=t.readInt(!0);a.push(e);for(let i=0;i<e;i++)a.push(t.readInt(!0)),r.push(t.readFloat()*s),r.push(t.readFloat()*s),r.push(t.readFloat())}return n.vertices=v.toFloatArray(r),n.bones=a,n}readFloatArray(t,e,s){let i=new Array(e);if(1==s)for(let s=0;s<e;s++)i[s]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t,e){let s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readInt(!0);return s}readAnimation(t,e,s){t.readInt(!0);let i=new Array,n=this.scale;for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,n=t.readInt(!0);s<n;s++){let s=t.readByte(),n=t.readInt(!0),r=n-1;switch(s){case as:{let s=new nt(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat(),t.readStringRef());i.push(s);break}case os:{let s=t.readInt(!0),a=new Z(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;switch(t.readByte()){case Cs:a.setStepped(e);break;case Ts:je(t,a,s++,e,0,o,i,l,n,1),je(t,a,s++,e,1,o,i,h,r,1),je(t,a,s++,e,2,o,i,c,u,1),je(t,a,s++,e,3,o,i,d,m,1)}o=i,l=n,h=r,c=u,d=m}i.push(a);break}case ls:{let s=t.readInt(!0),a=new tt(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255;switch(t.readByte()){case Cs:a.setStepped(e);break;case Ts:je(t,a,s++,e,0,o,i,l,n,1),je(t,a,s++,e,1,o,i,h,r,1),je(t,a,s++,e,2,o,i,c,d,1)}o=i,l=n,h=r,c=d}i.push(a);break}case hs:{let s=t.readInt(!0),a=new st(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,m,f),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;switch(t.readByte()){case Cs:a.setStepped(e);break;case Ts:je(t,a,s++,e,0,o,i,l,n,1),je(t,a,s++,e,1,o,i,h,r,1),je(t,a,s++,e,2,o,i,c,g,1),je(t,a,s++,e,3,o,i,d,p,1),je(t,a,s++,e,4,o,i,u,x,1),je(t,a,s++,e,5,o,i,m,b,1),je(t,a,s++,e,6,o,i,f,w,1)}o=i,l=n,h=r,c=g,d=p,u=x,m=b,f=w}i.push(a);break}case cs:{let s=t.readInt(!0),a=new it(n,s,e),o=t.readFloat(),l=t.readUnsignedByte()/255,h=t.readUnsignedByte()/255,c=t.readUnsignedByte()/255,d=t.readUnsignedByte()/255,u=t.readUnsignedByte()/255,m=t.readUnsignedByte()/255;for(let e=0,s=0;a.setFrame(e,o,l,h,c,d,u,m),e!=r;e++){let i=t.readFloat(),n=t.readUnsignedByte()/255,r=t.readUnsignedByte()/255,f=t.readUnsignedByte()/255,g=t.readUnsignedByte()/255,p=t.readUnsignedByte()/255,x=t.readUnsignedByte()/255;switch(t.readByte()){case Cs:a.setStepped(e);break;case Ts:je(t,a,s++,e,0,o,i,l,n,1),je(t,a,s++,e,1,o,i,h,r,1),je(t,a,s++,e,2,o,i,c,f,1),je(t,a,s++,e,3,o,i,d,g,1),je(t,a,s++,e,4,o,i,u,p,1),je(t,a,s++,e,5,o,i,m,x,1)}o=i,l=n,h=r,c=f,d=g,u=p,m=x}i.push(a);break}case ds:{let s=new et(n,t.readInt(!0),e),a=t.readFloat(),o=t.readUnsignedByte()/255;for(let e=0,i=0;s.setFrame(e,a,o),e!=r;e++){let n=t.readFloat(),r=t.readUnsignedByte()/255;switch(t.readByte()){case Cs:s.setStepped(e);break;case Ts:je(t,s,i++,e,0,a,n,o,r,1)}a=n,o=r}i.push(s)}}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0);for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readByte(),r=t.readInt(!0);if(s==rs){let s=new Q(r,e);for(let e=0;e<r;e++)s.setFrame(e,t.readFloat(),t.readByte());i.push(s);continue}let a=t.readInt(!0);switch(s){case He:i.push(ze(t,new U(r,a,e),1));break;case Je:i.push(Ge(t,new q(r,a,e),n));break;case Ke:i.push(ze(t,new W(r,a,e),n));break;case Qe:i.push(ze(t,new z(r,a,e),n));break;case Ze:i.push(Ge(t,new G(r,a,e),1));break;case ts:i.push(ze(t,new j(r,a,e),1));break;case es:i.push(ze(t,new $(r,a,e),1));break;case ss:i.push(Ge(t,new H(r,a,e),1));break;case is:i.push(ze(t,new J(r,a,e),1));break;case ns:i.push(ze(t,new K(r,a,e),1))}}}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),r=s-1,a=new ct(s,t.readInt(!0),e),o=t.readByte(),l=t.readFloat(),h=1&o?2&o?t.readFloat():1:0,c=4&o?t.readFloat()*n:0;for(let e=0,s=0;a.setFrame(e,l,h,c,8&o?1:-1,!!(16&o),!!(32&o)),e!=r;e++){o=t.readByte();const i=t.readFloat(),r=1&o?2&o?t.readFloat():1:0,d=4&o?t.readFloat()*n:0;64&o?a.setStepped(e):128&o&&(je(t,a,s++,e,0,l,i,h,r,1),je(t,a,s++,e,1,l,i,c,d,n)),l=i,h=r,c=d}i.push(a)}for(let e=0,s=t.readInt(!0);e<s;e++){let e=t.readInt(!0),s=t.readInt(!0),n=s-1,r=new dt(s,t.readInt(!0),e),a=t.readFloat(),o=t.readFloat(),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=t.readFloat();for(let e=0,s=0;r.setFrame(e,a,o,l,h,c,d,u),e!=n;e++){let i=t.readFloat(),n=t.readFloat(),m=t.readFloat(),f=t.readFloat(),g=t.readFloat(),p=t.readFloat(),x=t.readFloat();switch(t.readByte()){case Cs:r.setStepped(e);break;case Ts:je(t,r,s++,e,0,a,i,o,n,1),je(t,r,s++,e,1,a,i,l,m,1),je(t,r,s++,e,2,a,i,h,f,1),je(t,r,s++,e,3,a,i,c,g,1),je(t,r,s++,e,4,a,i,d,p,1),je(t,r,s++,e,5,a,i,u,x,1)}a=i,o=n,l=m,h=f,c=g,d=p,u=x}i.push(r)}for(let e=0,r=t.readInt(!0);e<r;e++){let e=t.readInt(!0),r=s.pathConstraints[e];for(let s=0,a=t.readInt(!0);s<a;s++){const s=t.readByte(),a=t.readInt(!0),o=t.readInt(!0);switch(s){case fs:i.push(ze(t,new ut(a,o,e),0==r.positionMode?n:1));break;case gs:i.push(ze(t,new mt(a,o,e),0==r.spacingMode||1==r.spacingMode?n:1));break;case ps:let s=new ft(a,o,e),l=t.readFloat(),h=t.readFloat(),c=t.readFloat(),d=t.readFloat();for(let e=0,i=0,n=s.getFrameCount()-1;s.setFrame(e,l,h,c,d),e!=n;e++){let n=t.readFloat(),r=t.readFloat(),a=t.readFloat(),o=t.readFloat();switch(t.readByte()){case Cs:s.setStepped(e);break;case Ts:je(t,s,i++,e,0,l,n,h,r,1),je(t,s,i++,e,1,l,n,c,a,1),je(t,s,i++,e,2,l,n,d,o,1)}l=n,h=r,c=a,d=o}i.push(s)}}}for(let e=0,s=t.readInt(!0);e<s;e++){const e=t.readInt(!0)-1;for(let s=0,n=t.readInt(!0);s<n;s++){const s=t.readByte(),n=t.readInt(!0);if(s==Ss){const s=new St(n,e);for(let e=0;e<n;e++)s.setFrame(e,t.readFloat());i.push(s);continue}const r=t.readInt(!0);switch(s){case xs:i.push(ze(t,new pt(n,r,e),1));break;case bs:i.push(ze(t,new xt(n,r,e),1));break;case ws:i.push(ze(t,new bt(n,r,e),1));break;case ys:i.push(ze(t,new wt(n,r,e),1));break;case vs:i.push(ze(t,new yt(n,r,e),1));break;case ks:i.push(ze(t,new vt(n,r,e),1));break;case As:i.push(ze(t,new kt(n,r,e),1))}}}for(let e=0,r=t.readInt(!0);e<r;e++){let e=s.skins[t.readInt(!0)];for(let s=0,r=t.readInt(!0);s<r;s++){let s=t.readInt(!0);for(let r=0,a=t.readInt(!0);r<a;r++){let r=t.readStringRef();if(!r)throw new Error("attachmentName must not be null.");let a=e.getAttachment(s,r),o=t.readByte(),l=t.readInt(!0),h=l-1;switch(o){case us:{let e=a,r=e.bones,o=e.vertices,c=r?o.length/3*2:o.length,d=t.readInt(!0),u=new rt(l,d,s,e),m=t.readFloat();for(let e=0,s=0;;e++){let i,a=t.readInt(!0);if(0==a)i=r?v.newFloatArray(c):o;else{i=v.newFloatArray(c);let e=t.readInt(!0);if(a+=e,1==n)for(let s=e;s<a;s++)i[s]=t.readFloat();else for(let s=e;s<a;s++)i[s]=t.readFloat()*n;if(!r)for(let t=0,e=i.length;t<e;t++)i[t]+=o[t]}if(u.setFrame(e,m,i),e==h)break;let l=t.readFloat();switch(t.readByte()){case Cs:u.setStepped(e);break;case Ts:je(t,u,s++,e,0,m,l,0,1,1)}m=l}i.push(u);break}case ms:{let e=new Tt(l,s,a);for(let s=0;s<l;s++){let i=t.readFloat(),n=t.readInt32();e.setFrame(s,i,X[15&n],n>>4,t.readFloat())}i.push(e);break}}}}}let r=t.readInt(!0);if(r>0){let e=new ht(r),n=s.slots.length;for(let s=0;s<r;s++){let i=t.readFloat(),r=t.readInt(!0),a=v.newArray(n,0);for(let t=n-1;t>=0;t--)a[t]=-1;let o=v.newArray(n-r,0),l=0,h=0;for(let e=0;e<r;e++){let e=t.readInt(!0);for(;l!=e;)o[h++]=l++;a[l+t.readInt(!0)]=l++}for(;l<n;)o[h++]=l++;for(let t=n-1;t>=0;t--)-1==a[t]&&(a[t]=o[--h]);e.setFrame(s,i,a)}i.push(e)}let a=t.readInt(!0);if(a>0){let e=new ot(a);for(let i=0;i<a;i++){let n=t.readFloat(),r=s.events[t.readInt(!0)],a=new fe(n,r);a.intValue=t.readInt(!1),a.floatValue=t.readFloat(),a.stringValue=t.readString(),null==a.stringValue&&(a.stringValue=r.stringValue),a.data.audioPath&&(a.volume=t.readFloat(),a.balance=t.readFloat()),e.setFrame(i,a)}i.push(e)}let o=0;for(let t=0,e=i.length;t<e;t++)o=Math.max(o,i[t].getDuration());return new B(e,i,o)}},Ne=class{constructor(t,e=new Array,s=0,i=new DataView(t instanceof ArrayBuffer?t:t.buffer)){this.strings=e,this.index=s,this.buffer=i}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){let t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=127&e;return 128&e&&(e=this.readByte(),s|=(127&e)<<7,128&e&&(e=this.readByte(),s|=(127&e)<<14,128&e&&(e=this.readByte(),s|=(127&e)<<21,128&e&&(e=this.readByte(),s|=(127&e)<<28)))),t?s:s>>>1^-(1&s)}readStringRef(){let t=this.readInt(!0);return 0==t?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){let t=this.readUnsignedByte();switch(t>>4){case 12:case 13:e+=String.fromCharCode((31&t)<<6|63&this.readByte()),s+=2;break;case 14:e+=String.fromCharCode((15&t)<<12|(63&this.readByte())<<6|63&this.readByte()),s+=3;break;default:e+=String.fromCharCode(t),s++}}return e}readFloat(){let t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return 0!=this.readByte()}},Ue=class{constructor(t,e,s,i,n){this.mesh=t,this.skinIndex=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}},qe=class{constructor(t=null,e=null,s=0){this.bones=t,this.vertices=e,this.length=s}},We=((Ee=We||{})[Ee.Region=0]="Region",Ee[Ee.BoundingBox=1]="BoundingBox",Ee[Ee.Mesh=2]="Mesh",Ee[Ee.LinkedMesh=3]="LinkedMesh",Ee[Ee.Path=4]="Path",Ee[Ee.Point=5]="Point",Ee[Ee.Clipping=6]="Clipping",Ee);function ze(t,e,s){let i=t.readFloat(),n=t.readFloat()*s;for(let r=0,a=0,o=e.getFrameCount()-1;e.setFrame(r,i,n),r!=o;r++){let o=t.readFloat(),l=t.readFloat()*s;switch(t.readByte()){case Cs:e.setStepped(r);break;case Ts:je(t,e,a++,r,0,i,o,n,l,s)}i=o,n=l}return e}function Ge(t,e,s){let i=t.readFloat(),n=t.readFloat()*s,r=t.readFloat()*s;for(let a=0,o=0,l=e.getFrameCount()-1;e.setFrame(a,i,n,r),a!=l;a++){let l=t.readFloat(),h=t.readFloat()*s,c=t.readFloat()*s;switch(t.readByte()){case Cs:e.setStepped(a);break;case Ts:je(t,e,o++,a,0,i,l,n,h,s),je(t,e,o++,a,1,i,l,r,c,s)}i=l,n=h,r=c}return e}function je(t,e,s,i,n,r,a,o,l,h){e.setBezier(s,i,n,r,o,t.readFloat(),t.readFloat()*h,t.readFloat(),t.readFloat()*h,a,l)}var $e,He=0,Je=1,Ke=2,Qe=3,Ze=4,ts=5,es=6,ss=7,is=8,ns=9,rs=10,as=0,os=1,ls=2,hs=3,cs=4,ds=5,us=0,ms=1,fs=0,gs=1,ps=2,xs=0,bs=1,ws=2,ys=4,vs=5,ks=6,As=7,Ss=8,Cs=1,Ts=2,Is=class{constructor(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new k((()=>v.newFloatArray(16)))}update(t,e){if(!t)throw new Error("skeleton cannot be null.");let s=this.boundingBoxes,i=this.polygons,n=this.polygonPool,r=t.slots,a=r.length;s.length=0,n.freeAll(i),i.length=0;for(let t=0;t<a;t++){let e=r[t];if(!e.bone.active)continue;let a=e.getAttachment();if(a instanceof qt){let t=a;s.push(t);let r=n.obtain();r.length!=t.worldVerticesLength&&(r=v.newFloatArray(t.worldVerticesLength)),i.push(r),t.computeWorldVertices(e,0,t.worldVerticesLength,r,0,2)}}e?this.aabbCompute():(this.minX=Number.POSITIVE_INFINITY,this.minY=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.maxY=Number.NEGATIVE_INFINITY)}aabbCompute(){let t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n=this.polygons;for(let r=0,a=n.length;r<a;r++){let a=n[r],o=a;for(let n=0,r=a.length;n<r;n+=2){let r=o[n],a=o[n+1];t=Math.min(t,r),e=Math.min(e,a),s=Math.max(s,r),i=Math.max(i,a)}}this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}aabbContainsPoint(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}aabbIntersectsSegment(t,e,s,i){let n=this.minX,r=this.minY,a=this.maxX,o=this.maxY;if(t<=n&&s<=n||e<=r&&i<=r||t>=a&&s>=a||e>=o&&i>=o)return!1;let l=(i-e)/(s-t),h=l*(n-t)+e;if(h>r&&h<o)return!0;if(h=l*(a-t)+e,h>r&&h<o)return!0;let c=(r-e)/l+t;return c>n&&c<a||(c=(o-e)/l+t,c>n&&c<a)}aabbIntersectsSkeleton(t){return this.minX<t.maxX&&this.maxX>t.minX&&this.minY<t.maxY&&this.maxY>t.minY}containsPoint(t,e){let s=this.polygons;for(let i=0,n=s.length;i<n;i++)if(this.containsPointPolygon(s[i],t,e))return this.boundingBoxes[i];return null}containsPointPolygon(t,e,s){let i=t,n=t.length,r=n-2,a=!1;for(let t=0;t<n;t+=2){let n=i[t+1],o=i[r+1];if(n<s&&o>=s||o<s&&n>=s){let l=i[t];l+(s-n)/(o-n)*(i[r]-l)<e&&(a=!a)}r=t}return a}intersectsSegment(t,e,s,i){let n=this.polygons;for(let r=0,a=n.length;r<a;r++)if(this.intersectsSegmentPolygon(n[r],t,e,s,i))return this.boundingBoxes[r];return null}intersectsSegmentPolygon(t,e,s,i,n){let r=t,a=t.length,o=e-i,l=s-n,h=e*n-s*i,c=r[a-2],d=r[a-1];for(let t=0;t<a;t+=2){let a=r[t],u=r[t+1],m=c*u-d*a,f=c-a,g=d-u,p=o*g-l*f,x=(h*f-o*m)/p;if((x>=c&&x<=a||x>=a&&x<=c)&&(x>=e&&x<=i||x>=i&&x<=e)){let t=(h*g-l*m)/p;if((t>=d&&t<=u||t>=u&&t<=d)&&(t>=s&&t<=n||t>=n&&t<=s))return!0}c=a,d=u}return!1}getPolygon(t){if(!t)throw new Error("boundingBox cannot be null.");let e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}getWidth(){return this.maxX-this.minX}getHeight(){return this.maxY-this.minY}},Ms=class{constructor(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new k((()=>new Array)),this.polygonIndicesPool=new k((()=>new Array))}triangulate(t){let e=t,s=t.length>>1,i=this.indicesArray;i.length=0;for(let t=0;t<s;t++)i[t]=t;let n=this.isConcaveArray;n.length=0;for(let t=0,r=s;t<r;++t)n[t]=Ms.isConcave(t,s,e,i);let r=this.triangles;for(r.length=0;s>3;){let t=s-1,a=0,o=1;for(;;){t:if(!n[a]){let r=i[t]<<1,l=i[a]<<1,h=i[o]<<1,c=e[r],d=e[r+1],u=e[l],m=e[l+1],f=e[h],g=e[h+1];for(let r=(o+1)%s;r!=t;r=(r+1)%s){if(!n[r])continue;let t=i[r]<<1,s=e[t],a=e[t+1];if(Ms.positiveArea(f,g,c,d,s,a)&&Ms.positiveArea(c,d,u,m,s,a)&&Ms.positiveArea(u,m,f,g,s,a))break t}break}if(0==o){do{if(!n[a])break;a--}while(a>0);break}t=a,a=o,o=(o+1)%s}r.push(i[(s+a-1)%s]),r.push(i[a]),r.push(i[(a+1)%s]),i.splice(a,1),n.splice(a,1),s--;let l=(s+a-1)%s,h=a==s?0:a;n[l]=Ms.isConcave(l,s,e,i),n[h]=Ms.isConcave(h,s,e,i)}return 3==s&&(r.push(i[2]),r.push(i[0]),r.push(i[1])),r}decompose(t,e){let s=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;let n=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(n),n.length=0;let r=this.polygonIndicesPool.obtain();r.length=0;let a=this.polygonPool.obtain();a.length=0;let o=-1,l=0;for(let t=0,h=e.length;t<h;t+=3){let h=e[t]<<1,c=e[t+1]<<1,d=e[t+2]<<1,u=s[h],m=s[h+1],f=s[c],g=s[c+1],p=s[d],x=s[d+1],b=!1;if(o==h){let t=a.length-4,e=Ms.winding(a[t],a[t+1],a[t+2],a[t+3],p,x),s=Ms.winding(p,x,a[0],a[1],a[2],a[3]);e==l&&s==l&&(a.push(p),a.push(x),r.push(d),b=!0)}b||(a.length>0?(i.push(a),n.push(r)):(this.polygonPool.free(a),this.polygonIndicesPool.free(r)),a=this.polygonPool.obtain(),a.length=0,a.push(u),a.push(m),a.push(f),a.push(g),a.push(p),a.push(x),r=this.polygonIndicesPool.obtain(),r.length=0,r.push(h),r.push(c),r.push(d),l=Ms.winding(u,m,f,g,p,x),o=h)}a.length>0&&(i.push(a),n.push(r));for(let t=0,e=i.length;t<e;t++){if(r=n[t],0==r.length)continue;let s=r[0],o=r[r.length-1];a=i[t];let l=a.length-4,h=a[l],c=a[l+1],d=a[l+2],u=a[l+3],m=a[0],f=a[1],g=a[2],p=a[3],x=Ms.winding(h,c,d,u,m,f);for(let l=0;l<e;l++){if(l==t)continue;let e=n[l];if(3!=e.length)continue;let b=e[0],w=e[1],y=e[2],v=i[l],k=v[v.length-2],A=v[v.length-1];if(b!=s||w!=o)continue;let S=Ms.winding(h,c,d,u,k,A),C=Ms.winding(k,A,m,f,g,p);S==x&&C==x&&(v.length=0,e.length=0,a.push(k),a.push(A),r.push(y),h=d,c=u,d=k,u=A,l=0)}}for(let t=i.length-1;t>=0;t--)a=i[t],0==a.length&&(i.splice(t,1),this.polygonPool.free(a),r=n[t],n.splice(t,1),this.polygonIndicesPool.free(r));return i}static isConcave(t,e,s,i){let n=i[(e+t-1)%e]<<1,r=i[t]<<1,a=i[(t+1)%e]<<1;return!this.positiveArea(s[n],s[n+1],s[r],s[r+1],s[a],s[a+1])}static positiveArea(t,e,s,i,n,r){return t*(r-i)+s*(e-r)+n*(i-e)>=0}static winding(t,e,s,i,n,r){let a=s-t,o=i-e;return n*o-r*a+a*e-t*o>=0?1:-1}},Fs=class{constructor(){this.triangulator=new Ms,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedUVs=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}clipStart(t,e){if(this.clipAttachment)return 0;this.clipAttachment=e;let s=e.worldVerticesLength,i=v.setArraySize(this.clippingPolygon,s);e.computeWorldVertices(t,0,s,i,0,2);let n=this.clippingPolygon;Fs.makeClockwise(n);let r=this.clippingPolygons=this.triangulator.decompose(n,this.triangulator.triangulate(n));for(let t=0,e=r.length;t<e;t++){let e=r[t];Fs.makeClockwise(e),e.push(e[0]),e.push(e[1])}return r.length}clipEndWithSlot(t){this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return null!=this.clipAttachment}clipTriangles(t,e,s,i,n,r,a,o){let l,h,c,d,u,m;"number"==typeof e?(l=s,h=i,c=n,d=r,u=a,m=o):(l=e,h=s,c=i,d=n,u=r,m=a),c&&d&&u&&"boolean"==typeof m?this.clipTrianglesRender(t,l,h,c,d,u,m):this.clipTrianglesNoRender(t,l,h)}clipTrianglesNoRender(t,e,s){let i=this.clipOutput,n=this.clippedVertices,r=this.clippedTriangles,a=this.clippingPolygons,o=a.length,l=0;n.length=0,r.length=0;for(let h=0;h<s;h+=3){let s=e[h]<<1,c=t[s],d=t[s+1];s=e[h+1]<<1;let u=t[s],m=t[s+1];s=e[h+2]<<1;let f=t[s],g=t[s+1];for(let t=0;t<o;t++){let e=n.length;if(!this.clip(c,d,u,m,f,g,a[t],i)){let t=v.setArraySize(n,e+6);t[e]=c,t[e+1]=d,t[e+2]=u,t[e+3]=m,t[e+4]=f,t[e+5]=g,e=r.length;let s=v.setArraySize(r,e+3);s[e]=l,s[e+1]=l+1,s[e+2]=l+2,l+=3;break}{let t=i.length;if(0==t)continue;let s=t>>1,a=this.clipOutput,o=v.setArraySize(n,e+2*s);for(let s=0;s<t;s+=2,e+=2){let t=a[s],i=a[s+1];o[e]=t,o[e+1]=i}e=r.length;let h=v.setArraySize(r,e+3*(s-2));s--;for(let t=1;t<s;t++,e+=3)h[e]=l,h[e+1]=l+t,h[e+2]=l+t+1;l+=s+1}}}}clipTrianglesRender(t,e,s,i,n,r,a){let o=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,c=this.clippingPolygons,d=c.length,u=a?12:8,m=0;l.length=0,h.length=0;for(let f=0;f<s;f+=3){let s=e[f]<<1,g=t[s],p=t[s+1],x=i[s],b=i[s+1];s=e[f+1]<<1;let w=t[s],y=t[s+1],k=i[s],A=i[s+1];s=e[f+2]<<1;let S=t[s],C=t[s+1],T=i[s],I=i[s+1];for(let t=0;t<d;t++){let e=l.length;if(!this.clip(g,p,w,y,S,C,c[t],o)){let t=v.setArraySize(l,e+3*u);t[e]=g,t[e+1]=p,t[e+2]=n.r,t[e+3]=n.g,t[e+4]=n.b,t[e+5]=n.a,a?(t[e+6]=x,t[e+7]=b,t[e+8]=r.r,t[e+9]=r.g,t[e+10]=r.b,t[e+11]=r.a,t[e+12]=w,t[e+13]=y,t[e+14]=n.r,t[e+15]=n.g,t[e+16]=n.b,t[e+17]=n.a,t[e+18]=k,t[e+19]=A,t[e+20]=r.r,t[e+21]=r.g,t[e+22]=r.b,t[e+23]=r.a,t[e+24]=S,t[e+25]=C,t[e+26]=n.r,t[e+27]=n.g,t[e+28]=n.b,t[e+29]=n.a,t[e+30]=T,t[e+31]=I,t[e+32]=r.r,t[e+33]=r.g,t[e+34]=r.b,t[e+35]=r.a):(t[e+6]=x,t[e+7]=b,t[e+8]=w,t[e+9]=y,t[e+10]=n.r,t[e+11]=n.g,t[e+12]=n.b,t[e+13]=n.a,t[e+14]=k,t[e+15]=A,t[e+16]=S,t[e+17]=C,t[e+18]=n.r,t[e+19]=n.g,t[e+20]=n.b,t[e+21]=n.a,t[e+22]=T,t[e+23]=I),e=h.length;let s=v.setArraySize(h,e+3);s[e]=m,s[e+1]=m+1,s[e+2]=m+2,m+=3;break}{let t=o.length;if(0==t)continue;let s=y-C,i=S-w,c=g-S,d=C-p,f=1/(s*c+i*(p-C)),M=t>>1,F=this.clipOutput,Y=v.setArraySize(l,e+M*u);for(let o=0;o<t;o+=2,e+=u){let t=F[o],l=F[o+1];Y[e]=t,Y[e+1]=l,Y[e+2]=n.r,Y[e+3]=n.g,Y[e+4]=n.b,Y[e+5]=n.a;let h=t-S,u=l-C,m=(s*h+i*u)*f,g=(d*h+c*u)*f,p=1-m-g;Y[e+6]=x*m+k*g+T*p,Y[e+7]=b*m+A*g+I*p,a&&(Y[e+8]=r.r,Y[e+9]=r.g,Y[e+10]=r.b,Y[e+11]=r.a)}e=h.length;let E=v.setArraySize(h,e+3*(M-2));M--;for(let t=1;t<M;t++,e+=3)E[e]=m,E[e+1]=m+t,E[e+2]=m+t+1;m+=M+1}}}}clipTrianglesUnpacked(t,e,s,i){let n=this.clipOutput,r=this.clippedVertices,a=this.clippedUVs,o=this.clippedTriangles,l=this.clippingPolygons,h=l.length,c=0;r.length=0,a.length=0,o.length=0;for(let d=0;d<s;d+=3){let s=e[d]<<1,u=t[s],m=t[s+1],f=i[s],g=i[s+1];s=e[d+1]<<1;let p=t[s],x=t[s+1],b=i[s],w=i[s+1];s=e[d+2]<<1;let y=t[s],k=t[s+1],A=i[s],S=i[s+1];for(let t=0;t<h;t++){let e=r.length;if(!this.clip(u,m,p,x,y,k,l[t],n)){let t=v.setArraySize(r,e+6);t[e]=u,t[e+1]=m,t[e+2]=p,t[e+3]=x,t[e+4]=y,t[e+5]=k;let s=v.setArraySize(a,e+6);s[e]=f,s[e+1]=g,s[e+2]=b,s[e+3]=w,s[e+4]=A,s[e+5]=S,e=o.length;let i=v.setArraySize(o,e+3);i[e]=c,i[e+1]=c+1,i[e+2]=c+2,c+=3;break}{let t=n.length;if(0==t)continue;let s=x-k,i=y-p,l=u-y,h=k-m,d=1/(s*l+i*(m-k)),C=t>>1,T=this.clipOutput,I=v.setArraySize(r,e+2*C),M=v.setArraySize(a,e+2*C);for(let n=0;n<t;n+=2,e+=2){let t=T[n],r=T[n+1];I[e]=t,I[e+1]=r;let a=t-y,o=r-k,c=(s*a+i*o)*d,u=(h*a+l*o)*d,m=1-c-u;M[e]=f*c+b*u+A*m,M[e+1]=g*c+w*u+S*m}e=o.length;let F=v.setArraySize(o,e+3*(C-2));C--;for(let t=1;t<C;t++,e+=3)F[e]=c,F[e+1]=c+t,F[e+2]=c+t+1;c+=C+1}}}}clip(t,e,s,i,n,r,a,o){let l,h=o,c=!1;a.length%4>=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(s),l.push(i),l.push(n),l.push(r),l.push(t),l.push(e),o.length=0;let d=a.length-4,u=a;for(let t=0;;t+=2){let e=u[t],s=u[t+1],i=e-u[t+2],n=s-u[t+3],r=o.length,a=l;for(let t=0,r=l.length-2;t<r;){let r=a[t],l=a[t+1];t+=2;let h=a[t],d=a[t+1],u=n*(e-h)>i*(s-d),m=n*(e-r)-i*(s-l);if(m>0){if(u){o.push(h),o.push(d);continue}let t=h-r,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s)}else if(u){let t=h-r,e=d-l,s=m/(t*n-e*i);if(!(s>=0&&s<=1)){o.push(h),o.push(d);continue}o.push(r+t*s),o.push(l+e*s),o.push(h),o.push(d)}c=!0}if(r==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),t==d)break;let m=o;(o=l).length=0,l=m}if(h!=o){h.length=0;for(let t=0,e=o.length-2;t<e;t++)h[t]=o[t]}else h.length=h.length-2;return c}static makeClockwise(t){let e=t,s=t.length,i=e[s-2]*e[1]-e[0]*e[s-1],n=0,r=0,a=0,o=0;for(let t=0,l=s-3;t<l;t+=2)n=e[t],r=e[t+1],a=e[t+2],o=e[t+3],i+=n*o-a*r;if(!(i<0))for(let t=0,i=s-2,n=s>>1;t<n;t+=2){let s=e[t],n=e[t+1],r=i-t;e[t]=e[r],e[t+1]=e[r+1],e[r]=s,e[r+1]=n}}},Ys=class{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){var e,s;let i=this.scale,n=new Be,r="string"==typeof t?JSON.parse(t):t,a=r.skeleton;if(a&&(n.hash=a.hash,n.version=a.spine,n.x=a.x,n.y=a.y,n.width=a.width,n.height=a.height,n.referenceScale=Rs(a,"referenceScale",100)*i,n.fps=a.fps,n.imagesPath=null!=(e=a.images)?e:null,n.audioPath=null!=(s=a.audio)?s:null),r.bones)for(let t=0;t<r.bones.length;t++){let e=r.bones[t],s=null,a=Rs(e,"parent",null);a&&(s=n.findBone(a));let o=new he(n.bones.length,e.name,s);o.length=Rs(e,"length",0)*i,o.x=Rs(e,"x",0)*i,o.y=Rs(e,"y",0)*i,o.rotation=Rs(e,"rotation",0),o.scaleX=Rs(e,"scaleX",1),o.scaleY=Rs(e,"scaleY",1),o.shearX=Rs(e,"shearX",0),o.shearY=Rs(e,"shearY",0),o.inherit=v.enumValue(ce,Rs(e,"inherit","Normal")),o.skinRequired=Rs(e,"skin",!1);let l=Rs(e,"color",null);l&&o.color.setFromString(l),n.bones.push(o)}if(r.slots)for(let t=0;t<r.slots.length;t++){let e=r.slots[t],s=e.name,i=n.findBone(e.bone);if(!i)throw new Error(`Couldn't find bone ${e.bone} for slot ${s}`);let a=new Ve(n.slots.length,s,i),o=Rs(e,"color",null);o&&a.color.setFromString(o);let l=Rs(e,"dark",null);l&&(a.darkColor=g.fromString(l)),a.attachmentName=Rs(e,"attachment",null),a.blendMode=v.enumValue(Oe,Rs(e,"blend","normal")),a.visible=Rs(e,"visible",!0),n.slots.push(a)}if(r.ik)for(let t=0;t<r.ik.length;t++){let e=r.ik[t],s=new xe(e.name);s.order=Rs(e,"order",0),s.skinRequired=Rs(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let i=n.findBone(e.bones[t]);if(!i)throw new Error(`Couldn't find bone ${e.bones[t]} for IK constraint ${e.name}.`);s.bones.push(i)}let a=n.findBone(e.target);if(!a)throw new Error(`Couldn't find target bone ${e.target} for IK constraint ${e.name}.`);s.target=a,s.mix=Rs(e,"mix",1),s.softness=Rs(e,"softness",0)*i,s.bendDirection=Rs(e,"bendPositive",!0)?1:-1,s.compress=Rs(e,"compress",!1),s.stretch=Rs(e,"stretch",!1),s.uniform=Rs(e,"uniform",!1),n.ikConstraints.push(s)}if(r.transform)for(let t=0;t<r.transform.length;t++){let e=r.transform[t],s=new Le(e.name);s.order=Rs(e,"order",0),s.skinRequired=Rs(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=n.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for transform constraint ${e.name}.`);s.bones.push(r)}let a=e.target,o=n.findBone(a);if(!o)throw new Error(`Couldn't find target bone ${a} for transform constraint ${e.name}.`);s.target=o,s.local=Rs(e,"local",!1),s.relative=Rs(e,"relative",!1),s.offsetRotation=Rs(e,"rotation",0),s.offsetX=Rs(e,"x",0)*i,s.offsetY=Rs(e,"y",0)*i,s.offsetScaleX=Rs(e,"scaleX",0),s.offsetScaleY=Rs(e,"scaleY",0),s.offsetShearY=Rs(e,"shearY",0),s.mixRotate=Rs(e,"mixRotate",1),s.mixX=Rs(e,"mixX",1),s.mixY=Rs(e,"mixY",s.mixX),s.mixScaleX=Rs(e,"mixScaleX",1),s.mixScaleY=Rs(e,"mixScaleY",s.mixScaleX),s.mixShearY=Rs(e,"mixShearY",1),n.transformConstraints.push(s)}if(r.path)for(let t=0;t<r.path.length;t++){let e=r.path[t],s=new be(e.name);s.order=Rs(e,"order",0),s.skinRequired=Rs(e,"skin",!1);for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=n.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for path constraint ${e.name}.`);s.bones.push(r)}let a=e.target,o=n.findSlot(a);if(!o)throw new Error(`Couldn't find target slot ${a} for path constraint ${e.name}.`);s.target=o,s.positionMode=v.enumValue(we,Rs(e,"positionMode","Percent")),s.spacingMode=v.enumValue(ye,Rs(e,"spacingMode","Length")),s.rotateMode=v.enumValue(ve,Rs(e,"rotateMode","Tangent")),s.offsetRotation=Rs(e,"rotation",0),s.position=Rs(e,"position",0),0==s.positionMode&&(s.position*=i),s.spacing=Rs(e,"spacing",0),0!=s.spacingMode&&1!=s.spacingMode||(s.spacing*=i),s.mixRotate=Rs(e,"mixRotate",1),s.mixX=Rs(e,"mixX",1),s.mixY=Rs(e,"mixY",s.mixX),n.pathConstraints.push(s)}if(r.physics)for(let t=0;t<r.physics.length;t++){const e=r.physics[t],s=new Xe(e.name);s.order=Rs(e,"order",0),s.skinRequired=Rs(e,"skin",!1);const a=e.bone,o=n.findBone(a);if(null==o)throw new Error("Physics bone not found: "+a);s.bone=o,s.x=Rs(e,"x",0),s.y=Rs(e,"y",0),s.rotate=Rs(e,"rotate",0),s.scaleX=Rs(e,"scaleX",0),s.shearX=Rs(e,"shearX",0),s.limit=Rs(e,"limit",5e3)*i,s.step=1/Rs(e,"fps",60),s.inertia=Rs(e,"inertia",1),s.strength=Rs(e,"strength",100),s.damping=Rs(e,"damping",1),s.massInverse=1/Rs(e,"mass",1),s.wind=Rs(e,"wind",0),s.gravity=Rs(e,"gravity",0),s.mix=Rs(e,"mix",1),s.inertiaGlobal=Rs(e,"inertiaGlobal",!1),s.strengthGlobal=Rs(e,"strengthGlobal",!1),s.dampingGlobal=Rs(e,"dampingGlobal",!1),s.massGlobal=Rs(e,"massGlobal",!1),s.windGlobal=Rs(e,"windGlobal",!1),s.gravityGlobal=Rs(e,"gravityGlobal",!1),s.mixGlobal=Rs(e,"mixGlobal",!1),n.physicsConstraints.push(s)}if(r.skins)for(let t=0;t<r.skins.length;t++){let e=r.skins[t],s=new De(e.name);if(e.bones)for(let t=0;t<e.bones.length;t++){let i=e.bones[t],r=n.findBone(i);if(!r)throw new Error(`Couldn't find bone ${i} for skin ${e.name}.`);s.bones.push(r)}if(e.ik)for(let t=0;t<e.ik.length;t++){let i=e.ik[t],r=n.findIkConstraint(i);if(!r)throw new Error(`Couldn't find IK constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}if(e.transform)for(let t=0;t<e.transform.length;t++){let i=e.transform[t],r=n.findTransformConstraint(i);if(!r)throw new Error(`Couldn't find transform constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}if(e.path)for(let t=0;t<e.path.length;t++){let i=e.path[t],r=n.findPathConstraint(i);if(!r)throw new Error(`Couldn't find path constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}if(e.physics)for(let t=0;t<e.physics.length;t++){let i=e.physics[t],r=n.findPhysicsConstraint(i);if(!r)throw new Error(`Couldn't find physics constraint ${i} for skin ${e.name}.`);s.constraints.push(r)}for(let t in e.attachments){let i=n.findSlot(t);if(!i)throw new Error(`Couldn't find slot ${t} for skin ${e.name}.`);let r=e.attachments[t];for(let t in r){let e=this.readAttachment(r[t],s,i.index,t,n);e&&s.setAttachment(i.index,t,e)}}n.skins.push(s),"default"==s.name&&(n.defaultSkin=s)}for(let t=0,e=this.linkedMeshes.length;t<e;t++){let e=this.linkedMeshes[t],s=e.skin?n.findSkin(e.skin):n.defaultSkin;if(!s)throw new Error(`Skin not found: ${e.skin}`);let i=s.getAttachment(e.slotIndex,e.parent);if(!i)throw new Error(`Parent mesh not found: ${e.parent}`);e.mesh.timelineAttachment=e.inheritTimeline?i:e.mesh,e.mesh.setParentMesh(i),null!=e.mesh.region&&e.mesh.updateRegion()}if(this.linkedMeshes.length=0,r.events)for(let t in r.events){let e=r.events[t],s=new ge(t);s.intValue=Rs(e,"int",0),s.floatValue=Rs(e,"float",0),s.stringValue=Rs(e,"string",""),s.audioPath=Rs(e,"audio",null),s.audioPath&&(s.volume=Rs(e,"volume",1),s.balance=Rs(e,"balance",0)),n.events.push(s)}if(r.animations)for(let t in r.animations){let e=r.animations[t];this.readAnimation(e,t,n)}return n}readAttachment(t,e,s,i,n){let r=this.scale;switch(i=Rs(t,"name",i),Rs(t,"type","region")){case"region":{let s=Rs(t,"path",i),n=this.readSequence(Rs(t,"sequence",null)),a=this.attachmentLoader.newRegionAttachment(e,i,s,n);if(!a)return null;a.path=s,a.x=Rs(t,"x",0)*r,a.y=Rs(t,"y",0)*r,a.scaleX=Rs(t,"scaleX",1),a.scaleY=Rs(t,"scaleY",1),a.rotation=Rs(t,"rotation",0),a.width=t.width*r,a.height=t.height*r,a.sequence=n;let o=Rs(t,"color",null);return o&&a.color.setFromString(o),null!=a.region&&a.updateRegion(),a}case"boundingbox":{let s=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!s)return null;this.readVertices(t,s,t.vertexCount<<1);let n=Rs(t,"color",null);return n&&s.color.setFromString(n),s}case"mesh":case"linkedmesh":{let n=Rs(t,"path",i),a=this.readSequence(Rs(t,"sequence",null)),o=this.attachmentLoader.newMeshAttachment(e,i,n,a);if(!o)return null;o.path=n;let l=Rs(t,"color",null);l&&o.color.setFromString(l),o.width=Rs(t,"width",0)*r,o.height=Rs(t,"height",0)*r,o.sequence=a;let h=Rs(t,"parent",null);if(h)return this.linkedMeshes.push(new Es(o,Rs(t,"skin",null),s,h,Rs(t,"timelines",!0))),o;let c=t.uvs;return this.readVertices(t,o,c.length),o.triangles=t.triangles,o.regionUVs=c,null!=o.region&&o.updateRegion(),o.edges=Rs(t,"edges",null),o.hullLength=2*Rs(t,"hull",0),o}case"path":{let s=this.attachmentLoader.newPathAttachment(e,i);if(!s)return null;s.closed=Rs(t,"closed",!1),s.constantSpeed=Rs(t,"constantSpeed",!0);let n=t.vertexCount;this.readVertices(t,s,n<<1);let a=v.newArray(n/3,0);for(let e=0;e<t.lengths.length;e++)a[e]=t.lengths[e]*r;s.lengths=a;let o=Rs(t,"color",null);return o&&s.color.setFromString(o),s}case"point":{let s=this.attachmentLoader.newPointAttachment(e,i);if(!s)return null;s.x=Rs(t,"x",0)*r,s.y=Rs(t,"y",0)*r,s.rotation=Rs(t,"rotation",0);let n=Rs(t,"color",null);return n&&s.color.setFromString(n),s}case"clipping":{let s=this.attachmentLoader.newClippingAttachment(e,i);if(!s)return null;let r=Rs(t,"end",null);r&&(s.endSlot=n.findSlot(r));let a=t.vertexCount;this.readVertices(t,s,a<<1);let o=Rs(t,"color",null);return o&&s.color.setFromString(o),s}}return null}readSequence(t){if(null==t)return null;let e=new M(Rs(t,"count",0));return e.start=Rs(t,"start",1),e.digits=Rs(t,"digits",0),e.setupIndex=Rs(t,"setup",0),e}readVertices(t,e,s){let i=this.scale;e.worldVerticesLength=s;let n=t.vertices;if(s==n.length){let t=v.toFloatArray(n);if(1!=i)for(let e=0,s=n.length;e<s;e++)t[e]*=i;return void(e.vertices=t)}let r=new Array,a=new Array;for(let t=0,e=n.length;t<e;){let e=n[t++];a.push(e);for(let s=t+4*e;t<s;t+=4)a.push(n[t]),r.push(n[t+1]*i),r.push(n[t+2]*i),r.push(n[t+3])}e.bones=a,e.vertices=v.toFloatArray(r)}readAnimation(t,e,s){let i=this.scale,n=new Array;if(t.slots)for(let e in t.slots){let i=t.slots[e],r=s.findSlot(e);if(!r)throw new Error("Slot not found: "+e);let a=r.index;for(let t in i){let e=i[t];if(!e)continue;let s=e.length;if("attachment"==t){let t=new nt(s,a);for(let i=0;i<s;i++){let s=e[i];t.setFrame(i,Rs(s,"time",0),Rs(s,"name",null))}n.push(t)}else if("rgba"==t){let t=new Z(s,s<<2,a),i=e[0],r=Rs(i,"time",0),o=g.fromString(i.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a);let a=e[s+1];if(!a){t.shrink(n);break}let l=Rs(a,"time",0),h=g.fromString(a.color),c=i.curve;c&&(n=Bs(c,t,n,s,0,r,l,o.r,h.r,1),n=Bs(c,t,n,s,1,r,l,o.g,h.g,1),n=Bs(c,t,n,s,2,r,l,o.b,h.b,1),n=Bs(c,t,n,s,3,r,l,o.a,h.a,1)),r=l,o=h,i=a}n.push(t)}else if("rgb"==t){let t=new tt(s,3*s,a),i=e[0],r=Rs(i,"time",0),o=g.fromString(i.color);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b);let a=e[s+1];if(!a){t.shrink(n);break}let l=Rs(a,"time",0),h=g.fromString(a.color),c=i.curve;c&&(n=Bs(c,t,n,s,0,r,l,o.r,h.r,1),n=Bs(c,t,n,s,1,r,l,o.g,h.g,1),n=Bs(c,t,n,s,2,r,l,o.b,h.b,1)),r=l,o=h,i=a}n.push(t)}else if("alpha"==t)n.push(Ps(e,new et(s,s,a),0,1));else if("rgba2"==t){let t=new st(s,7*s,a),i=e[0],r=Rs(i,"time",0),o=g.fromString(i.light),l=g.fromString(i.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,o.a,l.r,l.g,l.b);let a=e[s+1];if(!a){t.shrink(n);break}let h=Rs(a,"time",0),c=g.fromString(a.light),d=g.fromString(a.dark),u=i.curve;u&&(n=Bs(u,t,n,s,0,r,h,o.r,c.r,1),n=Bs(u,t,n,s,1,r,h,o.g,c.g,1),n=Bs(u,t,n,s,2,r,h,o.b,c.b,1),n=Bs(u,t,n,s,3,r,h,o.a,c.a,1),n=Bs(u,t,n,s,4,r,h,l.r,d.r,1),n=Bs(u,t,n,s,5,r,h,l.g,d.g,1),n=Bs(u,t,n,s,6,r,h,l.b,d.b,1)),r=h,o=c,l=d,i=a}n.push(t)}else if("rgb2"==t){let t=new it(s,6*s,a),i=e[0],r=Rs(i,"time",0),o=g.fromString(i.light),l=g.fromString(i.dark);for(let s=0,n=0;;s++){t.setFrame(s,r,o.r,o.g,o.b,l.r,l.g,l.b);let a=e[s+1];if(!a){t.shrink(n);break}let h=Rs(a,"time",0),c=g.fromString(a.light),d=g.fromString(a.dark),u=i.curve;u&&(n=Bs(u,t,n,s,0,r,h,o.r,c.r,1),n=Bs(u,t,n,s,1,r,h,o.g,c.g,1),n=Bs(u,t,n,s,2,r,h,o.b,c.b,1),n=Bs(u,t,n,s,3,r,h,l.r,d.r,1),n=Bs(u,t,n,s,4,r,h,l.g,d.g,1),n=Bs(u,t,n,s,5,r,h,l.b,d.b,1)),r=h,o=c,l=d,i=a}n.push(t)}}}if(t.bones)for(let e in t.bones){let r=t.bones[e],a=s.findBone(e);if(!a)throw new Error("Bone not found: "+e);let o=a.index;for(let t in r){let e=r[t],s=e.length;if(0!=s)if("rotate"===t)n.push(Ps(e,new U(s,s,o),0,1));else if("translate"===t){let t=new q(s,s<<1,o);n.push(Xs(e,t,"x","y",0,i))}else if("translatex"===t){let t=new W(s,s,o);n.push(Ps(e,t,0,i))}else if("translatey"===t){let t=new z(s,s,o);n.push(Ps(e,t,0,i))}else if("scale"===t){let t=new G(s,s<<1,o);n.push(Xs(e,t,"x","y",1,1))}else if("scalex"===t){let t=new j(s,s,o);n.push(Ps(e,t,1,1))}else if("scaley"===t){let t=new $(s,s,o);n.push(Ps(e,t,1,1))}else if("shear"===t){let t=new H(s,s<<1,o);n.push(Xs(e,t,"x","y",0,1))}else if("shearx"===t){let t=new J(s,s,o);n.push(Ps(e,t,0,1))}else if("sheary"===t){let t=new K(s,s,o);n.push(Ps(e,t,0,1))}else if("inherit"===t){let t=new Q(s,a.index);for(let s=0;s<e.length;s++){let i=e[s];t.setFrame(s,Rs(i,"time",0),v.enumValue(ce,Rs(i,"inherit","Normal")))}n.push(t)}}}if(t.ik)for(let e in t.ik){let r=t.ik[e],a=r[0];if(!a)continue;let o=s.findIkConstraint(e);if(!o)throw new Error("IK Constraint not found: "+e);let l=s.ikConstraints.indexOf(o),h=new ct(r.length,r.length<<1,l),c=Rs(a,"time",0),d=Rs(a,"mix",1),u=Rs(a,"softness",0)*i;for(let t=0,e=0;;t++){h.setFrame(t,c,d,u,Rs(a,"bendPositive",!0)?1:-1,Rs(a,"compress",!1),Rs(a,"stretch",!1));let s=r[t+1];if(!s){h.shrink(e);break}let n=Rs(s,"time",0),o=Rs(s,"mix",1),l=Rs(s,"softness",0)*i,m=a.curve;m&&(e=Bs(m,h,e,t,0,c,n,d,o,1),e=Bs(m,h,e,t,1,c,n,u,l,i)),c=n,d=o,u=l,a=s}n.push(h)}if(t.transform)for(let e in t.transform){let i=t.transform[e],r=i[0];if(!r)continue;let a=s.findTransformConstraint(e);if(!a)throw new Error("Transform constraint not found: "+e);let o=s.transformConstraints.indexOf(a),l=new dt(i.length,6*i.length,o),h=Rs(r,"time",0),c=Rs(r,"mixRotate",1),d=Rs(r,"mixX",1),u=Rs(r,"mixY",d),m=Rs(r,"mixScaleX",1),f=Rs(r,"mixScaleY",m),g=Rs(r,"mixShearY",1);for(let t=0,e=0;;t++){l.setFrame(t,h,c,d,u,m,f,g);let s=i[t+1];if(!s){l.shrink(e);break}let n=Rs(s,"time",0),a=Rs(s,"mixRotate",1),o=Rs(s,"mixX",1),p=Rs(s,"mixY",o),x=Rs(s,"mixScaleX",1),b=Rs(s,"mixScaleY",x),w=Rs(s,"mixShearY",1),y=r.curve;y&&(e=Bs(y,l,e,t,0,h,n,c,a,1),e=Bs(y,l,e,t,1,h,n,d,o,1),e=Bs(y,l,e,t,2,h,n,u,p,1),e=Bs(y,l,e,t,3,h,n,m,x,1),e=Bs(y,l,e,t,4,h,n,f,b,1),e=Bs(y,l,e,t,5,h,n,g,w,1)),h=n,c=a,d=o,u=p,m=x,f=b,m=x,r=s}n.push(l)}if(t.path)for(let e in t.path){let r=t.path[e],a=s.findPathConstraint(e);if(!a)throw new Error("Path constraint not found: "+e);let o=s.pathConstraints.indexOf(a);for(let t in r){let e=r[t],s=e[0];if(!s)continue;let l=e.length;if("position"===t){let t=new ut(l,l,o);n.push(Ps(e,t,0,0==a.positionMode?i:1))}else if("spacing"===t){let t=new mt(l,l,o);n.push(Ps(e,t,0,0==a.spacingMode||1==a.spacingMode?i:1))}else if("mix"===t){let t=new ft(l,3*l,o),i=Rs(s,"time",0),r=Rs(s,"mixRotate",1),a=Rs(s,"mixX",1),h=Rs(s,"mixY",a);for(let n=0,o=0;;n++){t.setFrame(n,i,r,a,h);let l=e[n+1];if(!l){t.shrink(o);break}let c=Rs(l,"time",0),d=Rs(l,"mixRotate",1),u=Rs(l,"mixX",1),m=Rs(l,"mixY",u),f=s.curve;f&&(o=Bs(f,t,o,n,0,i,c,r,d,1),o=Bs(f,t,o,n,1,i,c,a,u,1),o=Bs(f,t,o,n,2,i,c,h,m,1)),i=c,r=d,a=u,h=m,s=l}n.push(t)}}}if(t.physics)for(let e in t.physics){let i=t.physics[e],r=-1;if(e.length>0){let t=s.findPhysicsConstraint(e);if(!t)throw new Error("Physics constraint not found: "+e);r=s.physicsConstraints.indexOf(t)}for(let t in i){let e=i[t],s=e[0];if(!s)continue;let a,o=e.length;if("reset"!=t){if("inertia"==t)a=new pt(o,o,r);else if("strength"==t)a=new xt(o,o,r);else if("damping"==t)a=new bt(o,o,r);else if("mass"==t)a=new wt(o,o,r);else if("wind"==t)a=new yt(o,o,r);else if("gravity"==t)a=new vt(o,o,r);else{if("mix"!=t)continue;a=new kt(o,o,r)}n.push(Ps(e,a,0,1))}else{const t=new St(o,r);for(let i=0;null!=s;s=e[i+1],i++)t.setFrame(i,Rs(s,"time",0));n.push(t)}}}if(t.attachments)for(let e in t.attachments){let r=t.attachments[e],a=s.findSkin(e);if(!a)throw new Error("Skin not found: "+e);for(let t in r){let e=r[t],o=s.findSlot(t);if(!o)throw new Error("Slot not found: "+t);let l=o.index;for(let t in e){let s=e[t],r=a.getAttachment(l,t);for(let t in s){let e=s[t],a=e[0];if(a)if("deform"==t){let t=r.bones,s=r.vertices,o=t?s.length/3*2:s.length,h=new rt(e.length,e.length,l,r),c=Rs(a,"time",0);for(let n=0,r=0;;n++){let l,d=Rs(a,"vertices",null);if(d){l=v.newFloatArray(o);let e=Rs(a,"offset",0);if(v.arrayCopy(d,0,l,e,d.length),1!=i)for(let t=e,s=t+d.length;t<s;t++)l[t]*=i;if(!t)for(let t=0;t<o;t++)l[t]+=s[t]}else l=t?v.newFloatArray(o):s;h.setFrame(n,c,l);let u=e[n+1];if(!u){h.shrink(r);break}let m=Rs(u,"time",0),f=a.curve;f&&(r=Bs(f,h,r,n,0,c,m,0,1,1)),c=m,a=u}n.push(h)}else if("sequence"==t){let t=new Tt(e.length,l,r),s=0;for(let i=0;i<e.length;i++){let n=Rs(a,"delay",s),r=Rs(a,"time",0),o=P[Rs(a,"mode","hold")],l=Rs(a,"index",0);t.setFrame(i,r,o,l,n),s=n,a=e[i+1]}n.push(t)}}}}}if(t.drawOrder){let e=new ht(t.drawOrder.length),i=s.slots.length,r=0;for(let n=0;n<t.drawOrder.length;n++,r++){let a=t.drawOrder[n],o=null,l=Rs(a,"offsets",null);if(l){o=v.newArray(i,-1);let t=v.newArray(i-l.length,0),e=0,n=0;for(let i=0;i<l.length;i++){let r=l[i],a=s.findSlot(r.slot);if(!a)throw new Error("Slot not found: "+a);let h=a.index;for(;e!=h;)t[n++]=e++;o[e+r.offset]=e++}for(;e<i;)t[n++]=e++;for(let e=i-1;e>=0;e--)-1==o[e]&&(o[e]=t[--n])}e.setFrame(r,Rs(a,"time",0),o)}n.push(e)}if(t.events){let e=new ot(t.events.length),i=0;for(let n=0;n<t.events.length;n++,i++){let r=t.events[n],a=s.findEvent(r.name);if(!a)throw new Error("Event not found: "+r.name);let o=new fe(v.toSinglePrecision(Rs(r,"time",0)),a);o.intValue=Rs(r,"int",a.intValue),o.floatValue=Rs(r,"float",a.floatValue),o.stringValue=Rs(r,"string",a.stringValue),o.data.audioPath&&(o.volume=Rs(r,"volume",1),o.balance=Rs(r,"balance",0)),e.setFrame(i,o)}n.push(e)}let r=0;for(let t=0,e=n.length;t<e;t++)r=Math.max(r,n[t].getDuration());s.animations.push(new B(e,n,r))}},Es=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}};function Ps(t,e,s,i){let n=t[0],r=Rs(n,"time",0),a=Rs(n,"value",s)*i,o=0;for(let l=0;;l++){e.setFrame(l,r,a);let h=t[l+1];if(!h)return e.shrink(o),e;let c=Rs(h,"time",0),d=Rs(h,"value",s)*i;n.curve&&(o=Bs(n.curve,e,o,l,0,r,c,a,d,i)),r=c,a=d,n=h}}function Xs(t,e,s,i,n,r){let a=t[0],o=Rs(a,"time",0),l=Rs(a,s,n)*r,h=Rs(a,i,n)*r,c=0;for(let d=0;;d++){e.setFrame(d,o,l,h);let u=t[d+1];if(!u)return e.shrink(c),e;let m=Rs(u,"time",0),f=Rs(u,s,n)*r,g=Rs(u,i,n)*r,p=a.curve;p&&(c=Bs(p,e,c,d,0,o,m,l,f,r),c=Bs(p,e,c,d,1,o,m,h,g,r)),o=m,l=f,h=g,a=u}}function Bs(t,e,s,i,n,r,a,o,l,h){if("stepped"==t)return e.setStepped(i),s;let c=n<<2,d=t[c],u=t[c+1]*h,m=t[c+2],f=t[c+3]*h;return e.setBezier(s,i,n,r,o,d,u,m,f,a,l),s+1}function Rs(t,e,s){return void 0!==t[e]?t[e]:s}void 0===Math.fround&&(Math.fround=($e=new Float32Array(1),function(t){return $e[0]=t,$e[0]}));var Ds=class extends zt{constructor(t){super(t.resource),this.texture=e.Texture.from(t)}static from(t){return Ds.textureMap.has(t)?Ds.textureMap.get(t):new Ds(t)}setFilters(t,e){const s=this.texture.source.style;s.minFilter=Ds.toPixiTextureFilter(t),s.magFilter=Ds.toPixiTextureFilter(e),this.texture.source.autoGenerateMipmaps=Ds.toPixiMipMap(t),this.texture.source.updateMipmaps()}setWraps(t,e){const s=this.texture.source.style;s.addressModeU=Ds.toPixiTextureWrap(t),s.addressModeV=Ds.toPixiTextureWrap(e)}dispose(){this.texture.destroy()}static toPixiMipMap(t){switch(t){case 9728:case 9729:return!1;case 9986:case 9984:case 9987:case 9985:return!0;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureFilter(t){switch(t){case 9728:case 9986:case 9984:return"nearest";case 9729:case 9987:case 9985:return"linear";default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case 33071:return"clamp-to-edge";case 33648:return"mirror-repeat";case 10497:return"repeat";default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case 0:return"normal";case 1:return"add";case 2:return"multiply";case 3:return"screen";default:throw new Error(`Unknown blendMode: ${String(t)}`)}}},Vs=Ds;Vs.textureMap=new Map;var Os={extension:e.ExtensionType.Asset,resolver:{test:t=>e.checkExtension(t,".atlas"),parse:t=>{var s,i,n;const r=t.split(".");return{resolution:parseFloat(null!=(n=null==(i=null==(s=e.Resolver.RETINA_PREFIX)?void 0:s.exec(t))?void 0:i[1])?n:"1"),format:r[r.length-2],src:t}}},loader:{extension:{type:e.ExtensionType.LoadParser,priority:e.LoaderParserPriority.Normal,name:"spineTextureAtlasLoader"},test:t=>e.checkExtension(t,".atlas"),load(t){return u(this,null,(function*(){const s=yield e.DOMAdapter.get().fetch(t);return yield s.text()}))},testParse(t,s){const i=e.checkExtension(s.src,".atlas"),n="string"==typeof t;return Promise.resolve(i&&n)},unload(t){t.dispose()},parse(t,s,i){return u(this,null,(function*(){const n=s.data||{};let o=e.path.dirname(s.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=new Ht(t);if(n.images instanceof e.TextureSource||"string"==typeof n.images){const t=n.images;n.images={},n.images[l.pages[0].name]=t}const h=[];for(const t of l.pages){if(n.resolve){const e=n.resolve().then((e=>{t.setTexture(Vs.from(e.source))}));h.push(e);continue}const s=t.name,l=(null==n?void 0:n.images)?n.images[s]:void 0;if(l instanceof e.TextureSource)t.setTexture(Vs.from(l));else{const m={src:null!=l?l:e.path.normalize([...o.split(e.path.sep),s].join(e.path.sep)),data:(c=d({},n.imageMetadata),u={alphaMode:t.pma?"premultiplied-alpha":"premultiply-alpha-on-upload"},r(c,a(u)))},f=i.load(m).then((e=>{t.setTexture(Vs.from(e.source))}));h.push(f)}}var c,u;return yield Promise.all(h),l}))}}};e.extensions.add(Os);var Ls={extension:e.ExtensionType.Asset,loader:{extension:{type:e.ExtensionType.LoadParser,priority:e.LoaderParserPriority.Normal,name:"spineSkeletonLoader"},test:t=>e.checkExtension(t,".skel"),load(t){return u(this,null,(function*(){const s=yield e.DOMAdapter.get().fetch(t);return new Uint8Array(yield s.arrayBuffer())}))},testParse(t,s){const i=e.checkExtension(s.src,".json")&&(n=t,Object.prototype.hasOwnProperty.call(n,"bones"));var n;const r=e.checkExtension(s.src,".skel")&&function(t){return t instanceof Uint8Array}(t);return Promise.resolve(i||r)}}};e.extensions.add(Ls);var _s=new Float32Array(1),Ns=new Uint32Array(1),Us=class extends e.Geometry{constructor(){const t=new e.Buffer({data:_s,label:"attribute-batch-buffer",usage:e.BufferUsage.VERTEX|e.BufferUsage.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:28,offset:0},aUV:{buffer:t,format:"float32x2",stride:28,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:28,offset:16},aDarkColor:{buffer:t,format:"unorm8x4",stride:28,offset:20},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:28,offset:24}},indexBuffer:new e.Buffer({data:Ns,label:"index-batch-buffer",usage:e.BufferUsage.INDEX|e.BufferUsage.COPY_DST,shrinkToFit:!1})})}},qs={name:"color-bit",vertex:{header:"\n @in aDarkColor: vec4<f32>;\n @out vDarkColor: vec4<f32>;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n @in vDarkColor: vec4<f32>;\n ",end:"\n\n let alpha = outColor.a * vColor.a;\n let rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n\n finalColor = vec4<f32>(rgb, alpha);\n\n "}},Ws={name:"color-bit",vertex:{header:"\n in vec4 aDarkColor;\n out vec4 vDarkColor;\n ",main:"\n vDarkColor = aDarkColor;\n "},fragment:{header:"\n in vec4 vDarkColor;\n ",end:"\n\n finalColor.a = outColor.a * vColor.a;\n finalColor.rgb = ((outColor.a - 1.0) * vDarkColor.a + 1.0 - outColor.rgb) * vDarkColor.rgb + outColor.rgb * vColor.rgb;\n "}},zs=class extends e.Shader{constructor(t){super({glProgram:e.compileHighShaderGlProgram({name:"dark-tint-batch",bits:[e.colorBitGl,Ws,e.generateTextureBatchBitGl(t),e.roundPixelsBitGl]}),gpuProgram:e.compileHighShaderGpuProgram({name:"dark-tint-batch",bits:[e.colorBit,qs,e.generateTextureBatchBit(t),e.roundPixelsBit]}),resources:{batchSamplers:e.getBatchSamplersUniformGroup(t)}})}},Gs=null,js=class extends e.Batcher{constructor(){super(...arguments),this.geometry=new Us,this.shader=Gs||(Gs=new zs(this.maxTextures)),this.name=js.extension.name,this.vertexSize=7}packAttributes(t,s,i,n,r){const a=r<<16|65535&t.roundPixels,o=t.transform,l=o.a,h=o.b,c=o.c,d=o.d,u=o.tx,m=o.ty,{positions:f,uvs:g}=t,p=t.color,x=(p>>24&255)/255,b=e.Color.shared.setValue(t.darkColor).premultiply(x,!0).toPremultiplied(1,!1),w=t.attributeOffset,y=w+t.attributeSize;for(let t=w;t<y;t++){const e=2*t,r=f[e],o=f[e+1];s[n++]=l*r+c*o+u,s[n++]=d*o+h*r+m,s[n++]=g[e],s[n++]=g[e+1],i[n++]=p,i[n++]=b,i[n++]=a}}packQuadAttributes(t,e,s,i,n){const r=t.texture,a=t.transform,o=a.a,l=a.b,h=a.c,c=a.d,d=a.tx,u=a.ty,m=t.bounds,f=m.maxX,g=m.minX,p=m.maxY,x=m.minY,b=r.uvs,w=t.color,y=t.darkColor,v=n<<16|65535&t.roundPixels;e[i+0]=o*g+h*x+d,e[i+1]=c*x+l*g+u,e[i+2]=b.x0,e[i+3]=b.y0,s[i+4]=w,s[i+5]=y,s[i+6]=v,e[i+7]=o*f+h*x+d,e[i+8]=c*x+l*f+u,e[i+9]=b.x1,e[i+10]=b.y1,s[i+11]=w,s[i+12]=y,s[i+13]=v,e[i+14]=o*f+h*p+d,e[i+15]=c*p+l*f+u,e[i+16]=b.x2,e[i+17]=b.y2,s[i+18]=w,s[i+19]=y,s[i+20]=v,e[i+21]=o*g+h*p+d,e[i+22]=c*p+l*g+u,e[i+23]=b.x3,e[i+24]=b.y3,s[i+25]=w,s[i+26]=y,s[i+27]=v}},$s=js;$s.extension={type:[e.ExtensionType.Batcher],name:"darkTint"},e.extensions.add($s);var Hs=class{constructor(){this.indexOffset=0,this.attributeOffset=0,this.batcherName="darkTint",this.topology="triangle-list",this.packAsQuad=!1}get color(){const t=this.data.color,e=this.renderable.groupColor,s=this.renderable.groupAlpha;let i;const n=t.a*s*255;if(16777215!==e){const s=e>>16&255,r=e>>8&255,a=255&e,o=t.r*a,l=t.g*r;i=n<<24|t.b*s<<16|l<<8|o}else i=n<<24|255*t.b<<16|255*t.g<<8|255*t.r;return i}get darkColor(){const t=this.data.darkColor;return 255*t.b<<16|255*t.g<<8|255*t.r}get groupTransform(){return this.renderable.groupTransform}setData(t,e,s,i){if(this.renderable=t,this.transform=t.groupTransform,this.data=e,e.clipped){const t=e.clippedData;this.indexSize=t.indicesCount,this.attributeSize=t.vertexCount,this.positions=t.vertices,this.indices=t.indices,this.uvs=t.uvs}else this.indexSize=e.indices.length,this.attributeSize=e.vertices.length/2,this.positions=e.vertices,this.indices=e.indices,this.uvs=e.uvs;this.texture=e.texture,this.roundPixels=i,this.blendMode=s,this.batcherName=e.darkTint?"darkTint":"default"}},Js={0:"normal",1:"add",2:"multiply",3:"screen"},Ks=class{constructor(t){this.gpuSpineData={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t}validateRenderable(t){if(t._validateAndTransformAttachments(),t.spineAttachmentsDirty)return!0;if(t.spineTexturesDirty){const e=t.skeleton.drawOrder,s=this.gpuSpineData[t.uid];for(let i=0,n=e.length;i<n;i++){const n=e[i],r=n.getAttachment();if(r instanceof ie||r instanceof Zt){const e=t._getCachedData(n,r),i=s.slotBatches[e.id],a=e.texture;if(a!==i.texture&&!i._batcher.checkAndUpdateTexture(i,a))return!0}}}return!1}addRenderable(t,s){var i,n;const r=this._getSpineData(t),a=this.renderer.renderPipes.batch,o=t.skeleton.drawOrder,l=this.renderer._roundPixels|t._roundPixels;t._validateAndTransformAttachments();for(let h=0,c=o.length;h<c;h++){const c=o[h],d=c.getAttachment(),u=Js[c.data.blendMode];if(d instanceof ie||d instanceof Zt){const e=t._getCachedData(c,d),o=(i=r.slotBatches)[n=e.id]||(i[n]=new Hs);o.setData(t,e,u,l),e.skipRender||a.addToBatch(o,s)}const m=t._slotsObject[c.data.name];if(m){const t=m.container;t.includeInBuild=!0,e.collectAllRenderables(t,s,this.renderer),t.includeInBuild=!1}}}updateRenderable(t){var e;const s=this.gpuSpineData[t.uid];t._validateAndTransformAttachments();const i=t.skeleton.drawOrder;for(let n=0,r=i.length;n<r;n++){const r=i[n],a=r.getAttachment();if(a instanceof ie||a instanceof Zt){if(!t._getCachedData(r,a).skipRender){const i=s.slotBatches[t._getCachedData(r,a).id];null==(e=i._batcher)||e.updateElement(i)}}}}destroyRenderable(t){this.gpuSpineData[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}destroy(){this.gpuSpineData=null,this.renderer=null}_getSpineData(t){return this.gpuSpineData[t.uid]||this._initMeshData(t)}_initMeshData(t){return this.gpuSpineData[t.uid]={slotBatches:{}},t.on("destroyed",this._destroyRenderableBound),this.gpuSpineData[t.uid]}};Ks.extension={type:[e.ExtensionType.WebGLPipes,e.ExtensionType.WebGPUPipes,e.ExtensionType.CanvasPipes],name:"spine"},e.extensions.add(Ks);var Qs=new A;Me.yDown=!0;var Zs=new Fs,ti=new k((()=>new e.Graphics)),ei=class extends e.ViewContainer{constructor(t){var e;t instanceof Be&&(t={skeletonData:t}),super(),this.batched=!0,this.buildId=0,this.renderPipeId="spine",this._didSpineUpdate=!1,this.beforeUpdateWorldTransforms=()=>{},this.afterUpdateWorldTransforms=()=>{},this.darkTint=!1,this._debug=void 0,this._slotsObject=Object.create(null),this.clippingSlotToPixiMasks=Object.create(null),this.spineAttachmentsDirty=!0,this.spineTexturesDirty=!0,this._lastAttachments=[],this._stateChanged=!0,this.attachmentCacheData=[],this._autoUpdate=!0,this.hasNeverUpdated=!0;const s=t instanceof Be?t:t.skeletonData;this.skeleton=new Me(s),this.state=new Mt(new Ut(s)),this.autoUpdate=null==(e=null==t?void 0:t.autoUpdate)||e,this.darkTint=void 0===(null==t?void 0:t.darkTint)?this.skeleton.slots.some((t=>!!t.data.darkColor)):null==t?void 0:t.darkTint;const i=this.skeleton.slots;for(let t=0;t<i.length;t++)this.attachmentCacheData[t]=Object.create(null)}getSlotFromRef(t){let e;if(e="number"==typeof t?this.skeleton.slots[t]:"string"==typeof t?this.skeleton.findSlot(t):t,!e)throw new Error(`No slot found with the given slot reference: ${t}`);return e}get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t?e.Ticker.shared.add(this.internalUpdate,this):e.Ticker.shared.remove(this.internalUpdate,this),this._autoUpdate=t}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this._updateAndApplyState(null!=s?s:e.Ticker.shared.deltaMS/1e3)}get bounds(){return this._boundsDirty&&this.updateBounds(),this._bounds}setBonePosition(t,e){const s=t;if("string"==typeof t&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cant set bone position, bone ${String(s)} not found`);if(Qs.set(e.x,e.y),t.parent){const e=t.parent.worldToLocal(Qs);t.x=e.x,t.y=-e.y}else t.x=Qs.x,t.y=Qs.y}getBonePosition(t,e){const s=t;return"string"==typeof t&&(t=this.skeleton.findBone(t)),t?(e||(e={x:0,y:0}),e.x=t.worldX,e.y=t.worldY,e):(console.error(`Cant set bone position! Bone ${String(s)} not found`),e)}_updateAndApplyState(t){this.hasNeverUpdated=!1,this.state.update(t),this.skeleton.update(t);const{skeleton:e}=this;this.state.apply(e),this.beforeUpdateWorldTransforms(this),e.updateWorldTransform(2),this.afterUpdateWorldTransforms(this),this.updateSlotObjects(),this._stateChanged=!0,this._boundsDirty=!0,this.onViewUpdate()}_validateAndTransformAttachments(){this._stateChanged&&(this._stateChanged=!1,this.validateAttachments(),this.transformAttachments())}validateAttachments(){const t=this.skeleton.drawOrder,e=this._lastAttachments;let s=0,i=!1;for(let n=0;n<t.length;n++){const r=t[n].getAttachment();r&&(r!==e[s]&&(i=!0,e[s]=r),s++)}s!==e.length&&(i=!0,e.length=s),this.spineAttachmentsDirty=i}updateAndSetPixiMask(t,e){var s,i;const n=t.attachment;if(n&&n instanceof Wt){return((s=this.clippingSlotToPixiMasks)[i=t.data.name]||(s[i]={slot:t,vertices:new Array})).maskComputed=!1,void(this.currentClippingSlot=this.clippingSlotToPixiMasks[t.data.name])}let r=this.currentClippingSlot,a=this._slotsObject[t.data.name];if(r&&a){let t=r.slot,e=t.attachment,s=r.mask;if(s||(s=ti.obtain(),r.mask=s,this.addChild(s)),!r.maskComputed){r.maskComputed=!0;const i=e.worldVerticesLength,n=r.vertices;e.computeWorldVertices(t,0,i,n,0,2),s.clear().poly(n).stroke({width:0}).fill({alpha:.25})}a.container.mask=s}else(null==a?void 0:a.container.mask)&&(a.container.mask=null);if(r&&r.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),e)for(const t in this.clippingSlotToPixiMasks){const e=this.clippingSlotToPixiMasks[t];e.slot.attachment instanceof Wt&&e.maskComputed||!e.mask||(this.removeChild(e.mask),ti.free(e.mask),e.mask=void 0)}}transformAttachments(){var t;const s=this.skeleton.drawOrder;for(let i=0;i<s.length;i++){const n=s[i];this.updateAndSetPixiMask(n,i===s.length-1);const r=n.getAttachment();if(r)if(r instanceof Zt||r instanceof ie){const s=this._getCachedData(n,r);r instanceof ie?r.computeWorldVertices(n,s.vertices,0,2):r.computeWorldVertices(n,0,r.worldVerticesLength,s.vertices,0,2),s.uvs.length<r.uvs.length&&(s.uvs=new Float32Array(r.uvs.length)),e.fastCopy(r.uvs.buffer,s.uvs.buffer);const i=n.bone.skeleton.color,a=n.color,o=r.color;s.color.set(i.r*a.r*o.r,i.g*a.g*o.g,i.b*a.b*o.b,i.a*a.a*o.a),n.darkColor&&s.darkColor.setFromColor(n.darkColor),s.skipRender=s.clipped=!1;const l=(null==(t=r.region)?void 0:t.texture.texture)||e.Texture.EMPTY;s.texture!==l&&(s.texture=l,this.spineTexturesDirty=!0),Zs.isClipping()&&this.updateClippingData(s)}else if(r instanceof Wt){Zs.clipStart(n,r);continue}Zs.clipEndWithSlot(n)}Zs.clipEnd()}updateClippingData(t){t.clipped=!0,Zs.clipTrianglesUnpacked(t.vertices,t.indices,t.indices.length,t.uvs);const{clippedVertices:e,clippedUVs:s,clippedTriangles:i}=Zs,n=e.length/2,r=i.length;t.clippedData||(t.clippedData={vertices:new Float32Array(2*n),uvs:new Float32Array(2*n),vertexCount:n,indices:new Uint16Array(r),indicesCount:r},this.spineAttachmentsDirty=!0);const a=t.clippedData,o=a.vertexCount!==n||r!==a.indicesCount;t.skipRender=0===n,o&&(this.spineAttachmentsDirty=!0,a.vertexCount<n&&(a.vertices=new Float32Array(2*n),a.uvs=new Float32Array(2*n)),a.indices.length<r&&(a.indices=new Uint16Array(r)));const{vertices:l,uvs:h,indices:c}=a;for(let t=0;t<n;t++)l[2*t]=e[2*t],l[2*t+1]=e[2*t+1],h[2*t]=s[2*t],h[2*t+1]=s[2*t+1];a.vertexCount=n;for(let t=0;t<r;t++)c[t]!==i[t]&&(this.spineAttachmentsDirty=!0,c[t]=i[t]);a.indicesCount=r}updateSlotObjects(){for(const t in this._slotsObject){const e=this._slotsObject[t];e&&this.updateSlotObject(e)}}updateSlotObject(t){const{slot:s,container:i}=t;if(i.visible=this.skeleton.drawOrder.includes(s),i.visible){const t=s.bone;i.position.set(t.worldX,t.worldY),i.scale.x=t.getWorldScaleX(),i.scale.y=t.getWorldScaleY(),i.rotation=t.getWorldRotationX()*e.DEG_TO_RAD,i.alpha=this.skeleton.color.a*s.color.a}}_getCachedData(t,e){return this.attachmentCacheData[t.data.index][e.name]||this.initCachedData(t,e)}initCachedData(t,e){var s,i;let n;return e instanceof ie?(n=new Float32Array(8),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:n,clipped:!1,indices:[0,1,2,0,2,3],uvs:new Float32Array(e.uvs.length),color:new g(1,1,1,1),darkColor:new g(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:null==(s=e.region)?void 0:s.texture.texture}):(n=new Float32Array(e.worldVerticesLength),this.attachmentCacheData[t.data.index][e.name]={id:`${t.data.index}-${e.name}`,vertices:n,clipped:!1,indices:e.triangles,uvs:new Float32Array(e.uvs.length),color:new g(1,1,1,1),darkColor:new g(0,0,0,0),darkTint:this.darkTint,skipRender:!1,texture:null==(i=e.region)?void 0:i.texture.texture}),this.attachmentCacheData[t.data.index][e.name]}onViewUpdate(){var t;if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this),null==(t=this.debug)||t.renderDebug(this)}addSlotObject(t,e){var s;t=this.getSlotFromRef(t);for(const t in this._slotsObject)(null==(s=this._slotsObject[t])?void 0:s.container)===e&&this.removeSlotObject(this._slotsObject[t].slot);this.removeSlotObject(t),e.includeInBuild=!1,this.addChild(e);const i={container:e,slot:t};this._slotsObject[t.data.name]=i,this.updateSlotObject(i)}removeSlotObject(t){var s,i;let n;if(t instanceof e.Container){for(const e in this._slotsObject)if((null==(s=this._slotsObject[e])?void 0:s.container)===t){this._slotsObject[e]=null,n=t;break}}else{const e=this.getSlotFromRef(t);n=null==(i=this._slotsObject[e.data.name])?void 0:i.container,this._slotsObject[e.data.name]=null}n&&(this.removeChild(n),n.includeInBuild=!0)}getSlotObject(t){var e;return t=this.getSlotFromRef(t),null==(e=this._slotsObject[t.data.name])?void 0:e.container}updateBounds(){this._boundsDirty=!1,this.skeletonBounds||(this.skeletonBounds=new Is);const t=this.skeletonBounds;if(t.update(this.skeleton,!0),t.minX===1/0){this.hasNeverUpdated&&(this._updateAndApplyState(0),this._boundsDirty=!1),this._validateAndTransformAttachments();const t=this.skeleton.drawOrder,e=this._bounds;e.clear();for(let s=0;s<t.length;s++){const i=t[s],n=i.getAttachment();if(n&&(n instanceof ie||n instanceof Zt)){const t=this._getCachedData(i,n);e.addVertexData(t.vertices,0,t.vertices.length)}}}else this._bounds.minX=t.minX,this._bounds.minY=t.minY,this._bounds.maxX=t.maxX,this._bounds.maxY=t.maxY}addBounds(t){t.addBounds(this.bounds)}destroy(t=!1){super.destroy(t),e.Ticker.shared.remove(this.internalUpdate,this),this.state.clearListeners(),this.debug=void 0,this.skeleton=null,this.state=null,this._slotsObject=null,this._lastAttachments.length=0,this.attachmentCacheData=null}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,e){this.pixiWorldCoordinatesToSkeleton(t),e.parent?e.parent.worldToLocal(t):e.worldToLocal(t)}static from({skeleton:t,atlas:s,scale:i=1,darkTint:n,autoUpdate:r=!0}){const a=`${t}-${s}-${i}`;if(e.Cache.has(a))return new ei(e.Cache.get(a));const o=e.Assets.get(t),l=e.Assets.get(s),h=new le(l),c=o instanceof Uint8Array?new _e(h):new Ys(h);c.scale=i;const d=c.readSkeletonData(o);return console.log(">>>skeletonData",d),e.Cache.set(a,d),new ei({skeletonData:d,darkTint:n,autoUpdate:r})}},si={AlphaTimeline:et,Animation:B,AnimationState:Mt,AnimationStateAdapter:class{start(t){}interrupt(t){}end(t){}dispose(t){}complete(t){}event(t,e){}},AnimationStateData:Ut,AssetManagerBase:class{constructor(t,e="",s=new me){this.pathPrefix="",this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.textureLoader=t,this.pathPrefix=e,this.downloader=s}start(t){return this.toLoad++,this.pathPrefix+t}success(t,e,s){this.toLoad--,this.loaded++,this.assets[e]=s,t&&t(e,s)}error(t,e,s){this.toLoad--,this.loaded++,this.errors[e]=s,t&&t(e,s)}loadAll(){return new Promise(((t,e)=>{let s=()=>{this.isLoadingComplete()?this.hasErrors()?e(this.errors):t(this):requestAnimationFrame(s)};requestAnimationFrame(s)}))}setRawDataURI(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}loadBinary(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadBinary(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load binary ${t}: status ${e}, ${i}`)}))}loadText(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadText(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load text ${t}: status ${e}, ${i}`)}))}loadJson(t,e=()=>{},s=()=>{}){t=this.start(t),this.downloader.downloadJson(t,(s=>{this.success(e,t,s)}),((e,i)=>{this.error(s,t,`Couldn't load JSON ${t}: status ${e}, ${i}`)}))}loadTexture(t,e=()=>{},s=()=>{}){if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((e=>e.ok?e.blob():(this.error(s,t,`Couldn't load image: ${t}`),null))).then((t=>t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null)).then((s=>{s&&this.success(e,t,this.textureLoader(s))}));else{let i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this.success(e,t,this.textureLoader(i))},i.onerror=()=>{this.error(s,t,`Couldn't load image: ${t}`)},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),i.src=t}}loadTextureAtlas(t,e=()=>{},s=()=>{},i){let n=t.lastIndexOf("/"),r=n>=0?t.substring(0,n+1):"";t=this.start(t),this.downloader.downloadText(t,(n=>{try{let a=new Ht(n),o=a.pages.length,l=!1;for(let n of a.pages)this.loadTexture(i?i[n.name]:r+n.name,((s,i)=>{l||(n.setTexture(i),0==--o&&this.success(e,t,a))}),((e,i)=>{l||this.error(s,t,`Couldn't load texture atlas ${t} page image: ${e}`),l=!0}))}catch(e){this.error(s,t,`Couldn't parse texture atlas ${t}: ${e.message}`)}}),((e,i)=>{this.error(s,t,`Couldn't load texture atlas ${t}: status ${e}, ${i}`)}))}get(t){return this.assets[this.pathPrefix+t]}require(t){t=this.pathPrefix+t;let e=this.assets[t];if(e)return e;let s=this.errors[t];throw Error("Asset not found: "+t+(s?"\n"+s:""))}remove(t){t=this.pathPrefix+t;let e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}removeAll(){for(let t in this.assets){let e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}isLoadingComplete(){return 0==this.toLoad}getToLoad(){return this.toLoad}getLoaded(){return this.loaded}dispose(){this.removeAll()}hasErrors(){return Object.keys(this.errors).length>0}getErrors(){return this.errors}},AtlasAttachmentLoader:le,Attachment:S,AttachmentTimeline:nt,BinaryInput:Ne,BlendMode:Oe,Bone:de,BoneData:he,BoundingBoxAttachment:qt,CURRENT:Nt,ClippingAttachment:Wt,Color:g,ConstraintData:ue,CurveTimeline:L,CurveTimeline1:_,CurveTimeline2:N,DebugUtils:class{static logBones(t){for(let e=0;e<t.bones.length;e++){let s=t.bones[e];console.log(s.data.name+", "+s.a+", "+s.b+", "+s.c+", "+s.d+", "+s.worldX+", "+s.worldY)}}},DeformTimeline:rt,Downloader:me,DrawOrderTimeline:ht,Event:fe,EventData:ge,EventQueue:Xt,EventTimeline:ot,EventType:Bt,FIRST:Dt,FakeTexture:class extends zt{setFilters(t,e){}setWraps(t,e){}dispose(){}},HOLD_FIRST:Ot,HOLD_MIX:Lt,HOLD_SUBSEQUENT:Vt,IkConstraint:pe,IkConstraintData:xe,IkConstraintTimeline:ct,Inherit:ce,InheritTimeline:Q,IntSet:class{constructor(){this.array=new Array}add(t){let e=this.contains(t);return this.array[0|t]=0|t,!e}contains(t){return null!=this.array[0|t]}remove(t){this.array[0|t]=void 0}clear(){this.array.length=0}},Interpolation:b,MathUtils:x,MeshAttachment:Zt,MixBlend:R,MixDirection:D,PathAttachment:te,PathConstraint:Ae,PathConstraintData:be,PathConstraintMixTimeline:ft,PathConstraintPositionTimeline:ut,PathConstraintSpacingTimeline:mt,Physics:Pe,PhysicsConstraintDampingTimeline:bt,PhysicsConstraintGravityTimeline:vt,PhysicsConstraintInertiaTimeline:pt,PhysicsConstraintMassTimeline:wt,PhysicsConstraintMixTimeline:kt,PhysicsConstraintResetTimeline:St,PhysicsConstraintStrengthTimeline:xt,PhysicsConstraintTimeline:gt,PhysicsConstraintWindTimeline:yt,PointAttachment:ee,Pool:k,PositionMode:we,Pow:w,PowOut:class extends w{constructor(t){super(t)}applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}},RGB2Timeline:it,RGBA2Timeline:st,RGBATimeline:Z,RGBTimeline:tt,RegionAttachment:ie,RotateMode:ve,RotateTimeline:U,SETUP:_t,SUBSEQUENT:Rt,ScaleTimeline:G,ScaleXTimeline:j,ScaleYTimeline:$,SequenceTimeline:Tt,ShearTimeline:H,ShearXTimeline:J,ShearYTimeline:K,Skeleton:Me,SkeletonBinary:_e,SkeletonBounds:Is,SkeletonClipping:Fs,SkeletonData:Be,SkeletonJson:Ys,Skin:De,SkinEntry:Re,Slot:Ce,SlotData:Ve,SpacingMode:ye,Spine:ei,SpineDebugRenderer:class{constructor(){this.registeredSpines=new Map,this.drawMeshHull=!0,this.drawMeshTriangles=!0,this.drawBones=!0,this.drawPaths=!0,this.drawBoundingBoxes=!0,this.drawClipping=!0,this.drawRegionAttachments=!0,this.drawEvents=!0,this.lineWidth=1,this.regionAttachmentsColor=30975,this.meshHullColor=30975,this.meshTrianglesColor=16763904,this.clippingPolygonColor=16711935,this.boundingBoxesRectColor=65280,this.boundingBoxesPolygonColor=65280,this.boundingBoxesCircleColor=65280,this.pathsCurveColor=16711680,this.pathsLineColor=16711935,this.skeletonXYColor=16711680,this.bonesColor=61132,this.eventFontSize=24,this.eventFontColor=0}registerSpine(t){if(this.registeredSpines.has(t))return void console.warn("SpineDebugRenderer.registerSpine() - this spine is already registered!",t);const s={parentDebugContainer:new e.Container,bones:new e.Container,skeletonXY:new e.Graphics,regionAttachmentsShape:new e.Graphics,meshTrianglesLine:new e.Graphics,meshHullLine:new e.Graphics,clippingPolygon:new e.Graphics,boundingBoxesRect:new e.Graphics,boundingBoxesCircle:new e.Graphics,boundingBoxesPolygon:new e.Graphics,pathsCurve:new e.Graphics,pathsLine:new e.Graphics,eventText:new e.Container,eventCallback:{event:(i,n)=>{if(this.drawEvents){const i=Math.abs(t.scale.x||t.scale.y||1),r=new e.Text({text:n.data.name,style:{fontSize:this.eventFontSize/i,fill:this.eventFontColor,fontFamily:"monospace"}});r.scale.x=Math.sign(t.scale.x),r.anchor.set(.5),s.eventText.addChild(r),setTimeout((()=>{r.destroyed||r.destroy()}),250)}}}};s.parentDebugContainer.addChild(s.bones),s.parentDebugContainer.addChild(s.skeletonXY),s.parentDebugContainer.addChild(s.regionAttachmentsShape),s.parentDebugContainer.addChild(s.meshTrianglesLine),s.parentDebugContainer.addChild(s.meshHullLine),s.parentDebugContainer.addChild(s.clippingPolygon),s.parentDebugContainer.addChild(s.boundingBoxesRect),s.parentDebugContainer.addChild(s.boundingBoxesCircle),s.parentDebugContainer.addChild(s.boundingBoxesPolygon),s.parentDebugContainer.addChild(s.pathsCurve),s.parentDebugContainer.addChild(s.pathsLine),s.parentDebugContainer.addChild(s.eventText),s.parentDebugContainer.zIndex=9999999,s.parentDebugContainer.accessibleChildren=!1,s.parentDebugContainer.eventMode="none",s.parentDebugContainer.interactiveChildren=!1,t.addChild(s.parentDebugContainer),t.state.addListener(s.eventCallback),this.registeredSpines.set(t,s)}renderDebug(t){this.registeredSpines.has(t)||this.registerSpine(t);const e=this.registeredSpines.get(t);if(!e)return;t.addChild(e.parentDebugContainer),e.skeletonXY.clear(),e.regionAttachmentsShape.clear(),e.meshTrianglesLine.clear(),e.meshHullLine.clear(),e.clippingPolygon.clear(),e.boundingBoxesRect.clear(),e.boundingBoxesCircle.clear(),e.boundingBoxesPolygon.clear(),e.pathsCurve.clear(),e.pathsLine.clear();for(let t=e.bones.children.length;t>0;t--)e.bones.children[t-1].destroy({children:!0,texture:!0,textureSource:!0});const s=Math.abs(t.scale.x||t.scale.y||1),i=this.lineWidth/s;if(this.drawBones&&this.drawBonesFunc(t,e,i,s),this.drawPaths&&this.drawPathsFunc(t,e,i),this.drawBoundingBoxes&&this.drawBoundingBoxesFunc(t,e,i),this.drawClipping&&this.drawClippingFunc(t,e,i),(this.drawMeshHull||this.drawMeshTriangles)&&this.drawMeshHullAndMeshTriangles(t,e,i),this.drawRegionAttachments&&this.drawRegionAttachmentsFunc(t,e,i),this.drawEvents)for(const t of e.eventText.children)t.alpha-=.05,t.y-=2}drawBonesFunc(t,s,i,n){const r=t.skeleton,a=r.x,o=r.y,l=r.bones;s.skeletonXY.strokeStyle={width:i,color:this.skeletonXYColor};for(let t=0,r=l.length;t<r;t++){const r=l[t],h=r.data.length,c=a+r.worldX,d=o+r.worldY,u=a+h*r.a+r.worldX,m=o+h*r.b+r.worldY;if("root"===r.data.name||null===r.data.parent)continue;const f=Math.abs(c-u),g=Math.abs(d-m),p=Math.pow(f,2),x=g,b=Math.pow(g,2),w=Math.sqrt(p+b),y=Math.pow(w,2),v=Math.PI/180,k=Math.acos((y+b-p)/(2*x*w))||0;if(0===w)continue;const A=new e.Graphics;s.bones.addChild(A);const S=w/50/n;A.context.poly([0,0,0-S,w-3*S,0,w-S,0+S,w-3*S]).fill(this.bonesColor),A.x=c,A.y=d,A.pivot.y=w;let C=0;c<u&&d<m?C=180*v-k:c>u&&d<m?C=180*v+k:c>u&&d>m?C=-k:c<u&&d>m?C=k:d===m&&c<u?C=90*v:d===m&&c>u?C=-90*v:c===u&&d<m?C=180*v:c===u&&d>m&&(C=0),A.rotation=C,A.circle(0,w,1.2*S).fill({color:0,alpha:.6}).stroke({width:i+S/2.4,color:this.bonesColor})}const h=3*i;s.skeletonXY.context.moveTo(a-h,o-h).lineTo(a+h,o+h).moveTo(a+h,o-h).lineTo(a-h,o+h).stroke()}drawRegionAttachmentsFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t],n=s.getAttachment();if(null===n||!(n instanceof ie))continue;const r=n,a=new Float32Array(8);r.computeWorldVertices(s,a,0,2),e.regionAttachmentsShape.poly(Array.from(a.slice(0,8)))}e.regionAttachmentsShape.stroke({color:this.regionAttachmentsColor,width:s})}drawMeshHullAndMeshTriangles(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Zt))continue;const r=n,a=new Float32Array(r.worldVerticesLength),o=r.triangles;let l=r.hullLength;if(r.computeWorldVertices(s,0,r.worldVerticesLength,a,0,2),this.drawMeshTriangles)for(let t=0,s=o.length;t<s;t+=3){const s=2*o[t],i=2*o[t+1],n=2*o[t+2];e.meshTrianglesLine.context.moveTo(a[s],a[s+1]).lineTo(a[i],a[i+1]).lineTo(a[n],a[n+1])}if(this.drawMeshHull&&l>0){l=2*(l>>1);let t=a[l-2],s=a[l-1];for(let i=0,n=l;i<n;i+=2){const n=a[i],r=a[i+1];e.meshHullLine.context.moveTo(n,r).lineTo(t,s),t=n,s=r}}}e.meshHullLine.stroke({width:s,color:this.meshHullColor}),e.meshTrianglesLine.stroke({width:s,color:this.meshTrianglesColor})}drawClippingFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof Wt))continue;const r=n,a=r.worldVerticesLength,o=new Float32Array(a);r.computeWorldVertices(s,0,a,o,0,2),e.clippingPolygon.poly(Array.from(o))}e.clippingPolygon.stroke({width:s,color:this.clippingPolygonColor,alpha:1})}drawBoundingBoxesFunc(t,e,s){const i=new Is;i.update(t.skeleton,!0),i.minX!==1/0&&e.boundingBoxesRect.rect(i.minX,i.minY,i.getWidth(),i.getHeight()).stroke({width:s,color:this.boundingBoxesRectColor});const n=i.polygons,r=(t,i,n)=>{if(n<3)throw new Error("Polygon must contain at least 3 vertices");const r=[],a=2*s;for(let s=0,i=t.length;s<i;s+=2){const i=t[s],n=t[s+1];e.boundingBoxesCircle.beginFill(this.boundingBoxesCircleColor),e.boundingBoxesCircle.drawCircle(i,n,a),e.boundingBoxesCircle.fill(0),e.boundingBoxesCircle.circle(i,n,a).fill({color:this.boundingBoxesCircleColor}),r.push(i,n)}e.boundingBoxesPolygon.poly(r).fill({color:this.boundingBoxesPolygonColor,alpha:.1}).stroke({width:s,color:this.boundingBoxesPolygonColor})};for(let t=0,e=n.length;t<e;t++){const e=n[t];r(e,0,e.length)}}drawPathsFunc(t,e,s){const i=t.skeleton.slots;for(let t=0,s=i.length;t<s;t++){const s=i[t];if(!s.bone.active)continue;const n=s.getAttachment();if(null===n||!(n instanceof te))continue;const r=n;let a=r.worldVerticesLength;const o=new Float32Array(a);r.computeWorldVertices(s,0,a,o,0,2);let l=o[2],h=o[3],c=0,d=0;if(r.closed){const t=o[0],s=o[1],i=o[a-2],n=o[a-1];c=o[a-4],d=o[a-3],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(t,s,i,n,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(t,s),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(i,n)}a-=4;for(let t=4;t<a;t+=6){const s=o[t],i=o[t+1],n=o[t+2],r=o[t+3];c=o[t+4],d=o[t+5],e.pathsCurve.moveTo(l,h),e.pathsCurve.bezierCurveTo(s,i,n,r,c,d),e.pathsLine.moveTo(l,h),e.pathsLine.lineTo(s,i),e.pathsLine.moveTo(c,d),e.pathsLine.lineTo(n,r),l=c,h=d}}e.pathsCurve.stroke({width:s,color:this.pathsCurveColor}),e.pathsLine.stroke({width:s,color:this.pathsLineColor})}unregisterSpine(t){this.registeredSpines.has(t)||console.warn("SpineDebugRenderer.unregisterSpine() - spine is not registered, can't unregister!",t);const e=this.registeredSpines.get(t);e&&(t.state.removeListener(e.eventCallback),e.parentDebugContainer.destroy({textureSource:!0,children:!0,texture:!0}),this.registeredSpines.delete(t))}},SpinePipe:Ks,SpineTexture:Vs,StringSet:m,Texture:zt,TextureAtlas:Ht,TextureAtlasPage:Kt,TextureAtlasRegion:Qt,TextureFilter:Gt,TextureRegion:$t,TextureWrap:jt,TimeKeeper:class{constructor(){this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.frameTime=0}update(){let t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}},Timeline:O,TrackEntry:Pt,TransformConstraint:Te,TransformConstraintData:Le,TransformConstraintTimeline:dt,TranslateTimeline:q,TranslateXTimeline:W,TranslateYTimeline:z,Triangulator:Ms,Utils:v,Vector2:A,VertexAttachment:T,WindowedMean:class{constructor(t=32){this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(t){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=t,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let t=0;for(let e=0;e<this.values.length;e++)t+=this.values[e];this.mean=t/this.values.length,this.dirty=!1}return this.mean}return 0}}};function ii(t){return function(e,s){var i=function(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}(e,s);i.key=s,i.type=t}}function ni(t,e,s,i){var n,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,i);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,s,a):n(e,s))||a);return r>3&&a&&Object.defineProperty(e,s,a),a}function ri(t,e,s,i){return new(s||(s=Promise))((function(n,r){function a(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){t.done?n(t.value):new s((function(e){e(t.value)})).then(a,o)}l((i=i.apply(t,e||[])).next())}))}class ai extends s.Component{constructor(){super(...arguments),this.resource="",this.scale=1,this.animationName="",this.autoPlay=!0,this.waitExecuteInfos=[]}set armature(t){if(this._armature=t,t){this.autoPlay&&this.play(this.animationName);for(const t of this.waitExecuteInfos)if(t.playType){const{name:e,loop:s,track:i}=t;this.play(e,s,i)}else this.stop(t.track);this.waitExecuteInfos=[]}}get armature(){return this._armature}init(t){t&&_extends(this,t)}onDestroy(){this.destroied=!0}play(t,e,s){try{const i=null!=e?e:this.autoPlay;t&&(this.animationName=t),this.armature?(void 0===s&&(s=0),this.armature.state.setAnimation(s,this.animationName,i)):this.waitExecuteInfos.push({playType:!0,name:t,loop:i,track:s})}catch(t){console.log(t)}}stop(t){this.armature?(void 0===t&&(t=0),this.armature.state.setEmptyAnimation(t,0)):this.waitExecuteInfos.push({playType:!1,track:t})}addAnimation(t,e,s,i){try{this.armature&&(void 0===i&&(i=0),this.armature.state.addAnimation(i,t,s,e))}catch(t){console.log(t)}}setMix(t,e,s){this.armature&&this.armature.state.data.setMix(t,e,s)}getAnim(t=0){try{if(this.armature)return this.armature.state.tracks[t].animation.name}catch(t){console.log(t)}}setDefaultMix(t){this.armature&&(this.armature.state.data.defaultMix=t)}setAttachment(t,e){this.armature&&this.armature.skeleton.setAttachment(t,e)}getBone(t){if(this.armature)return this.armature.skeleton.findBone(t)}}ai.componentName="Spine",ni([ii("string")],ai.prototype,"resource",void 0),ni([ii("number")],ai.prototype,"scale",void 0),ni([ii("string")],ai.prototype,"animationName",void 0),ni([ii("boolean")],ai.prototype,"autoPlay",void 0);let oi={};function li(t,e,s){return ri(this,void 0,void 0,(function*(){let i=oi[t.name];if(!i)if(t.complete)i=function(t,e,s,i){const n=e.ske,r=e.atlas,a=new i.AtlasAttachmentLoader(r),o=n instanceof Uint8Array?new i.SkeletonBinary(a):new i.SkeletonJson(a);o.scale=s||1;const l={spineData:o.readSkeletonData(n),ref:0,imageSrc:e.image.label};return oi[t]=l,l}(t.name,t.data,e,s);else if(!i)return;return i.ref++,i.spineData}))}let hi=class extends i.Renderer{constructor(){super(...arguments),this.armatures={}}init({pixiSpine:t}){this.renderSystem=this.game.getSystem(i.RendererSystem),this.renderSystem.rendererManager.register(this),this.pixiSpine=t,this.game.canvas.addEventListener("webglcontextrestored",(()=>{const t=this.game.gameObjects;let e=[];for(let i in this.armatures){const n=+i;for(let i=0;i<t.length;++i){let r=t[i];if(r.id===n){let t=r.getComponent(ai);t&&(this.remove({type:s.OBSERVER_TYPE.REMOVE,gameObject:r,component:t,componentName:ai.componentName}),e.push({type:s.OBSERVER_TYPE.ADD,gameObject:r,component:t,componentName:ai.componentName}));break}}}setTimeout((()=>{e.forEach((t=>{this.add(t)}))}),1e3)}),!1)}update(t){for(let e in this.armatures)this.armatures[e].update(.001*t.deltaTime);super.update()}componentChanged(t){return ri(this,void 0,void 0,(function*(){if("Spine"===t.componentName)if(t.type===s.OBSERVER_TYPE.ADD)this.add(t);else if(t.type===s.OBSERVER_TYPE.CHANGE){if("resource"===t.prop.prop[0])this.change(t)}else t.type===s.OBSERVER_TYPE.REMOVE&&this.remove(t)}))}add(t,e){var i,n;return ri(this,void 0,void 0,(function*(){const r=t.component;clearTimeout(r.addHandler);const a=t.gameObject.id,o=this.increaseAsyncId(a),l=yield s.resource.getResource(r.resource);if(!this.validateAsyncId(a,o))return;const h=yield li(l,r.scale,this.pixiSpine);if(!this.validateAsyncId(a,o))return;if(!h)return void(r.addHandler=setTimeout((()=>{r.destroied||(void 0===e&&(e=20),--e>0?this.add(t,e):console.log("retry exceed max times",r.resource))}),1e3));this.remove(t);const c=null===(n=null===(i=this.renderSystem)||void 0===i?void 0:i.containerManager)||void 0===n?void 0:n.getContainer(t.gameObject.id);if(!c)return;r.lastResource=r.resource;const d=new this.pixiSpine.Spine({skeletonData:h,autoUpdate:!1});if(this.armatures[t.gameObject.id]=d,t.gameObject&&t.gameObject.transform){const e=t.gameObject.transform;d.x=e.size.width*e.origin.x,d.y=e.size.height*e.origin.y}c.addChildAt(d,0),d.update(),r.armature=d,r.emit("loaded",{resource:r.resource}),d.state.addListener({start:(t,e)=>{r.emit("start",{track:t,name:t.animation.name})},complete:(t,e)=>{r.emit("complete",{track:t,name:t.animation.name})},interrupt:(t,e)=>{r.emit("interrupt",{track:t,name:t.animation.name})},end:(t,e)=>{r.emit("end",{track:t,name:t.animation.name})},event:(t,e)=>{r.emit("event",t,e)}})}))}change(t){this.remove(t),this.add(t)}remove(t){var i,n,r,a,o,l;return ri(this,void 0,void 0,(function*(){this.increaseAsyncId(t.gameObject.id);const h=t.component;clearTimeout(h.addHandler);const c=this.armatures[t.gameObject.id],d=null===(n=null===(i=this.renderSystem)||void 0===i?void 0:i.containerManager)||void 0===n?void 0:n.getContainer(t.gameObject.id);if(d&&c&&d.removeChild(c),h.armature){h.armature.destroy({children:!0});const t=yield s.resource.getResource(h.lastResource);(null===(a=null===(r=t.data)||void 0===r?void 0:r.image)||void 0===a?void 0:a.src)||null===(l=null===(o=t.data)||void 0===o?void 0:o.image)||void 0===l||l.label,function(t){const i=t.name,n=oi[i];n&&(n.ref--,setTimeout((()=>ri(this,void 0,void 0,(function*(){if(n.ref<=0){yield e.Assets.unload([t.src.image.url,t.src.atlas.url,t.src.ske.url]);const n=e.Assets.resolver;delete n._assetMap[t.src.image.url],delete n._assetMap[t.src.atlas.url],delete n._assetMap[t.src.ske.url],delete n._resolverHash[t.src.image.url],delete n._resolverHash[t.src.atlas.url],delete n._resolverHash[t.src.ske.url],s.resource.destroy(i),delete oi[i]}}))),100))}(t)}h.armature=null,delete this.armatures[t.gameObject.id],t.type,s.OBSERVER_TYPE.CHANGE}))}};hi.systemName="SpineSystem",hi=ni([s.decorators.componentObserver({Spine:["resource"]})],hi);var ci=hi;s.resource.registerResourceType("SPINE");return t.PixiSpine=si,t.Spine=class extends ai{},t.SpineSystem=class extends ci{init(){super.init({pixiSpine:si})}},Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,EVA,EVA.plugin.renderer);globalThis.EVA.plugin.renderer.spine=globalThis.EVA.plugin.renderer.spine||_EVA_IIFE_spine;
|