@galacean/engine-spine 1.0.0-test.5 → 1.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -1,2 +1,2 @@
1
- import{BufferMesh as t,VertexElement as e,VertexElementFormat as r,Buffer as n,BufferBindFlag as a,BufferUsage as i,IndexFormat as s,MeshRenderer as o,SubMesh as h,Shader as l,BlendFactor as u,BlendOperation as c,CullMode as d,RenderQueueType as f,Material as v,ignoreClone as p,Script as g,request as m,resourceLoader as w,AssetPromise as E,Entity as x,Loader as y,Texture2D as b,TextureFilterMode as S}from"@galacean/engine";function M(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function A(t,e,r){return e&&M(t.prototype,e),r&&M(t,r),t}function T(){return T=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},T.apply(this,arguments)}function I(t,e){return I=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},I(t,e)}function R(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&I(t,e)}function C(t,e,r,n){var a,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,r,s):a(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function k(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}"function"==typeof SuppressedError&&SuppressedError;var V=function(){function t(){this.array=new Array}var e=t.prototype;return e.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},e.contains=function(t){return null!=this.array[0|t]},e.remove=function(t){this.array[0|t]=void 0},e.clear=function(){this.array.length=0},t}(),P=function(){function t(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),this.r=t,this.g=e,this.b=r,this.a=n}var e=t.prototype;return e.set=function(t,e,r,n){return this.r=t,this.g=e,this.b=r,this.a=n,this.clamp(),this},e.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.setFromString=function(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?255:parseInt(t.substr(6,2),16))/255,this},e.add=function(t,e,r,n){return this.r+=t,this.g+=e,this.b+=r,this.a+=n,this.clamp(),this},e.clamp=function(){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},t.rgba8888ToColor=function(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},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t}();P.WHITE=new P(1,1,1,1),P.RED=new P(1,0,0,1),P.GREEN=new P(0,1,0,1),P.BLUE=new P(0,0,1,1),P.MAGENTA=new P(1,0,1,1);var _=function(){function t(){}return t.clamp=function(t,e,r){return t<e?e:t>r?r:t},t.cosDeg=function(e){return Math.cos(e*t.degRad)},t.sinDeg=function(e){return Math.sin(e*t.degRad)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,r){return t.randomTriangularWith(e,r,.5*(e+r))},t.randomTriangularWith=function(t,e,r){var n=Math.random(),a=e-t;return n<=(r-t)/a?t+Math.sqrt(n*a*(r-t)):e-Math.sqrt((1-n)*a*(e-r))},t}();_.PI=3.1415927,_.PI2=2*_.PI,_.radiansToDegrees=180/_.PI,_.radDeg=_.radiansToDegrees,_.degreesToRadians=_.PI/180,_.degRad=_.degreesToRadians;var F=function(){function t(){}return t.arrayCopy=function(t,e,r,n,a){for(var i=e,s=n;i<e+a;i++,s++)r[s]=t[i]},t.setArraySize=function(t,e,r){void 0===r&&(r=0);var n=t.length;if(n==e)return t;if(t.length=e,n<e)for(var a=n;a<e;a++)t[a]=r;return t},t.ensureArrayCapacity=function(e,r,n){return void 0===n&&(n=0),e.length>=r?e:t.setArraySize(e,r,n)},t.newArray=function(t,e){for(var r=new Array(t),n=0;n<t;n++)r[n]=e;return r},t.newFloatArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);for(var r=new Array(e),n=0;n<r.length;n++)r[n]=0;return r},t.newShortArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);for(var r=new Array(e),n=0;n<r.length;n++)r[n]=0;return r},t.toFloatArray=function(e){return t.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e},t.toSinglePrecision=function(e){return t.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e},t.webkit602BugfixHelper=function(t,e){},t.contains=function(t,e,r){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1},t}();F.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var N,O=function(){function t(t){this.items=new Array,this.instantiator=t}var e=t.prototype;return e.obtain=function(){return this.items.length>0?this.items.pop():this.instantiator()},e.free=function(t){t.reset&&t.reset(),this.items.push(t)},e.freeAll=function(t){for(var e=0;e<t.length;e++)this.free(t[e])},e.clear=function(){this.items.length=0},t}(),L=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},e.normalize=function(){var t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this},t}(),X=function(t,e,r){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=0,this.skinRequired=!1,this.color=new P,t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=r};!function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"}(N||(N={}));var B,D,Y,U=function(){function t(t,e,r){if(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.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=r,this.setToSetupPose()}var e=t.prototype;return e.isActive=function(){return this.active},e.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransformWith=function(t,e,r,n,a,i,s){this.ax=t,this.ay=e,this.arotation=r,this.ascaleX=n,this.ascaleY=a,this.ashearX=i,this.ashearY=s,this.appliedValid=!0;var o=this.parent;if(null==o){var h=this.skeleton,l=r+90+s,u=h.scaleX,c=h.scaleY;return this.a=_.cosDeg(r+i)*n*u,this.b=_.cosDeg(l)*a*u,this.c=_.sinDeg(r+i)*n*c,this.d=_.sinDeg(l)*a*c,this.worldX=t*u+h.x,void(this.worldY=e*c+h.y)}var d=o.a,f=o.b,v=o.c,p=o.d;switch(this.worldX=d*t+f*e+o.worldX,this.worldY=v*t+p*e+o.worldY,this.data.transformMode){case N.Normal:var g=r+90+s,m=_.cosDeg(r+i)*n,w=_.cosDeg(g)*a,E=_.sinDeg(r+i)*n,x=_.sinDeg(g)*a;return this.a=d*m+f*E,this.b=d*w+f*x,this.c=v*m+p*E,void(this.d=v*w+p*x);case N.OnlyTranslation:var y=r+90+s;this.a=_.cosDeg(r+i)*n,this.b=_.cosDeg(y)*a,this.c=_.sinDeg(r+i)*n,this.d=_.sinDeg(y)*a;break;case N.NoRotationOrReflection:var b=d*d+v*v,S=0;b>1e-4?(b=Math.abs(d*p-f*v)/b,d/=this.skeleton.scaleX,f=(v/=this.skeleton.scaleY)*b,p=d*b,S=Math.atan2(v,d)*_.radDeg):(d=0,v=0,S=90-Math.atan2(p,f)*_.radDeg);var M=r+i-S,A=r+s-S+90,T=_.cosDeg(M)*n,I=_.cosDeg(A)*a,R=_.sinDeg(M)*n,C=_.sinDeg(A)*a;this.a=d*T-f*R,this.b=d*I-f*C,this.c=v*T+p*R,this.d=v*I+p*C;break;case N.NoScale:case N.NoScaleOrReflection:var k=_.cosDeg(r),V=_.sinDeg(r),P=(d*k+f*V)/this.skeleton.scaleX,F=(v*k+p*V)/this.skeleton.scaleY,O=Math.sqrt(P*P+F*F);O>1e-5&&(O=1/O),P*=O,F*=O,O=Math.sqrt(P*P+F*F),this.data.transformMode==N.NoScale&&d*p-f*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(O=-O);var L=Math.PI/2+Math.atan2(F,P),X=Math.cos(L)*O,B=Math.sin(L)*O,D=_.cosDeg(i)*n,Y=_.cosDeg(90+s)*a,U=_.sinDeg(i)*n,W=_.sinDeg(90+s)*a;this.a=P*D+X*U,this.b=P*Y+X*W,this.c=F*D+B*U,this.d=F*Y+B*W}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.setToSetupPose=function(){var 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},e.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*_.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*_.radDeg},e.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.updateAppliedTransform=function(){this.appliedValid=!0;var t=this.parent;if(null==t)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*_.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)*_.radDeg);var e=t.a,r=t.b,n=t.c,a=t.d,i=1/(e*a-r*n),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*a*i-o*r*i,this.ay=o*e*i-s*n*i;var h=i*a,l=i*e,u=i*r,c=i*n,d=h*this.a-u*this.c,f=h*this.b-u*this.d,v=l*this.c-c*this.a,p=l*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+v*v),this.ascaleX>1e-4){var g=d*p-f*v;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*f+v*p,g)*_.radDeg,this.arotation=Math.atan2(v,d)*_.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,f)*_.radDeg},e.worldToLocal=function(t){var e=this.a,r=this.b,n=this.c,a=this.d,i=1/(e*a-r*n),s=t.x-this.worldX,o=t.y-this.worldY;return t.x=s*a*i-o*r*i,t.y=o*e*i-s*n*i,t},e.localToWorld=function(t){var e=t.x,r=t.y;return t.x=e*this.a+r*this.b+this.worldX,t.y=e*this.c+r*this.d+this.worldY,t},e.worldToLocalRotation=function(t){var e=_.sinDeg(t),r=_.cosDeg(t);return Math.atan2(this.a*e-this.c*r,this.d*r-this.b*e)*_.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=_.sinDeg(t),r=_.cosDeg(t);return Math.atan2(r*this.c+e*this.d,r*this.a+e*this.b)*_.radDeg},e.rotateWorld=function(t){var e=this.a,r=this.b,n=this.c,a=this.d,i=_.cosDeg(t),s=_.sinDeg(t);this.a=i*e-s*n,this.b=i*r-s*a,this.c=s*e+i*n,this.d=s*r+i*a,this.appliedValid=!1},t}(),W=function(){function t(t,e){if(this.deform=new Array,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new P,this.darkColor=null==t.darkColor?null:new P,this.setToSetupPose()}var e=t.prototype;return e.getSkeleton=function(){return this.bone.skeleton},e.getAttachment=function(){return this.attachment},e.setAttachment=function(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)},e.setAttachmentTime=function(t){this.attachmentTime=this.bone.skeleton.time-t},e.getAttachmentTime=function(){return this.bone.skeleton.time-this.attachmentTime},e.setToSetupPose=function(){this.color.setFromColor(this.data.color),null!=this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),null==this.data.attachmentName?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))},t}(),q=function(){function t(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var r=0;r<t.bones.length;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix)}},e.apply1=function(t,e,r,n,a,i,s){t.appliedValid||t.updateAppliedTransform();var o=t.parent,h=o.a,l=o.b,u=o.c,c=o.d,d=-t.ashearX-t.arotation,f=0,v=0;switch(t.data.transformMode){case N.OnlyTranslation:f=e-t.worldX,v=r-t.worldY;break;case N.NoRotationOrReflection:var p=Math.abs(h*c-l*u)/(h*h+u*u),g=h/t.skeleton.scaleX,m=u/t.skeleton.scaleY;l=-m*p*t.skeleton.scaleX,c=g*p*t.skeleton.scaleY,d+=Math.atan2(m,g)*_.radDeg;default:var w=e-o.worldX,E=r-o.worldY,x=h*c-l*u;f=(w*c-E*l)/x-t.ax,v=(E*h-w*u)/x-t.ay}d+=Math.atan2(v,f)*_.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var y=t.ascaleX,b=t.ascaleY;if(n||a){switch(t.data.transformMode){case N.NoScale:case N.NoScaleOrReflection:f=e-t.worldX,v=r-t.worldY}var S=t.data.length*y,M=Math.sqrt(f*f+v*v);if(n&&M<S||a&&M>S&&S>1e-4){var A=(M/S-1)*s+1;y*=A,i&&(b*=A)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,y,b,t.ashearX,t.ashearY)},e.apply2=function(t,e,r,n,a,i,s,o){if(0!=o){t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();var h=t.ax,l=t.ay,u=t.ascaleX,c=u,d=t.ascaleY,f=e.ascaleX,v=0,p=0,g=0;u<0?(u=-u,v=180,g=-1):(v=0,g=1),d<0&&(d=-d,g=-g),f<0?(f=-f,p=180):p=0;var m=e.ax,w=0,E=0,x=0,y=t.a,b=t.b,S=t.c,M=t.d,A=Math.abs(u-d)<=1e-4;A?(E=y*m+b*(w=e.ay)+t.worldX,x=S*m+M*w+t.worldY):(w=0,E=y*m+t.worldX,x=S*m+t.worldY);var T=t.parent;y=T.a,b=T.b,S=T.c;var I,R,C=1/(y*(M=T.d)-b*S),k=E-T.worldX,V=x-T.worldY,P=(k*M-V*b)*C-h,F=(V*y-k*S)*C-l,N=Math.sqrt(P*P+F*F),O=e.data.length*f;if(N<1e-4)return this.apply1(t,r,n,!1,i,!1,o),void e.updateWorldTransformWith(m,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var L=((k=r-T.worldX)*M-(V=n-T.worldY)*b)*C-h,X=(V*y-k*S)*C-l,B=L*L+X*X;if(0!=s){s*=u*(f+1)/2;var D=Math.sqrt(B),Y=D-N-O*u+s;if(Y>0){var U=Math.min(1,Y/(2*s))-1;B=(L-=(U=(Y-s*(1-U*U))/D)*L)*L+(X-=U*X)*X}}t:if(A){var W=(B-N*N-(O*=u)*O)/(2*N*O);W<-1?W=-1:W>1&&(W=1,i&&(c*=(Math.sqrt(B)/(N+O)-1)*o+1)),R=Math.acos(W)*a,y=N+O*W,b=O*Math.sin(R),I=Math.atan2(X*y-L*b,L*y+X*b)}else{var q=(y=u*O)*y,H=(b=d*O)*b,j=Math.atan2(X,L),G=-2*H*N,z=H-q;if((M=G*G-4*z*(S=H*N*N+q*B-q*H))>=0){var Z=Math.sqrt(M);G<0&&(Z=-Z);var Q=(Z=-(G+Z)/2)/z,J=S/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=B){V=Math.sqrt(B-K*K)*a,I=j-Math.atan2(V,K),R=Math.atan2(V/d,(K-N)/u);break t}}var $=_.PI,tt=N-y,et=tt*tt,rt=0,nt=0,at=N+y,it=at*at,st=0;(S=-y*N/(q-H))>=-1&&S<=1&&(S=Math.acos(S),(M=(k=y*Math.cos(S)+N)*k+(V=b*Math.sin(S))*V)<et&&($=S,et=M,tt=k,rt=V),M>it&&(nt=S,it=M,at=k,st=V)),B<=(et+it)/2?(I=j-Math.atan2(rt*a,tt),R=$*a):(I=j-Math.atan2(st*a,at),R=nt*a)}var ot=Math.atan2(w,m)*g,ht=t.arotation;(I=(I-ot)*_.radDeg+v-ht)>180?I-=360:I<-180&&(I+=360),t.updateWorldTransformWith(h,l,ht+I*o,c,t.ascaleY,0,0),ht=e.arotation,(R=((R+ot)*_.radDeg-e.ashearX)*g+p-ht)>180?R-=360:R<-180&&(R+=360),e.updateWorldTransformWith(m,w,ht+R*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),H=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new L,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(var r=0;r<t.bones.length;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()},e.applyAbsoluteWorld=function(){for(var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,h=a.d,l=i*h-s*o>0?_.degRad:-_.degRad,u=this.data.offsetRotation*l,c=this.data.offsetShearY*l,d=this.bones,f=0,v=d.length;f<v;f++){var p=d[f],g=!1;if(0!=t){var m=p.a,w=p.b,E=p.c,x=p.d,y=Math.atan2(o,i)-Math.atan2(E,m)+u;y>_.PI?y-=_.PI2:y<-_.PI&&(y+=_.PI2),y*=t;var b=Math.cos(y),S=Math.sin(y);p.a=b*m-S*E,p.b=b*w-S*x,p.c=S*m+b*E,p.d=S*w+b*x,g=!0}if(0!=e){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(M.x-p.worldX)*e,p.worldY+=(M.y-p.worldY)*e,g=!0}if(r>0){var A=Math.sqrt(p.a*p.a+p.c*p.c),T=Math.sqrt(i*i+o*o);A>1e-5&&(A=(A+(T-A+this.data.offsetScaleX)*r)/A),p.a*=A,p.c*=A,A=Math.sqrt(p.b*p.b+p.d*p.d),T=Math.sqrt(s*s+h*h),A>1e-5&&(A=(A+(T-A+this.data.offsetScaleY)*r)/A),p.b*=A,p.d*=A,g=!0}if(n>0){var I=p.b,R=p.d,C=Math.atan2(R,I),k=Math.atan2(h,s)-Math.atan2(o,i)-(C-Math.atan2(p.c,p.a));k>_.PI?k-=_.PI2:k<-_.PI&&(k+=_.PI2),k=C+(k+c)*n;var V=Math.sqrt(I*I+R*R);p.b=Math.cos(k)*V,p.d=Math.sin(k)*V,g=!0}g&&(p.appliedValid=!1)}},e.applyRelativeWorld=function(){for(var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,h=a.d,l=i*h-s*o>0?_.degRad:-_.degRad,u=this.data.offsetRotation*l,c=this.data.offsetShearY*l,d=this.bones,f=0,v=d.length;f<v;f++){var p=d[f],g=!1;if(0!=t){var m=p.a,w=p.b,E=p.c,x=p.d,y=Math.atan2(o,i)+u;y>_.PI?y-=_.PI2:y<-_.PI&&(y+=_.PI2),y*=t;var b=Math.cos(y),S=Math.sin(y);p.a=b*m-S*E,p.b=b*w-S*x,p.c=S*m+b*E,p.d=S*w+b*x,g=!0}if(0!=e){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),p.worldX+=M.x*e,p.worldY+=M.y*e,g=!0}if(r>0){var A=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*r+1;p.a*=A,p.c*=A,A=(Math.sqrt(s*s+h*h)-1+this.data.offsetScaleY)*r+1,p.b*=A,p.d*=A,g=!0}if(n>0){var T=Math.atan2(h,s)-Math.atan2(o,i);T>_.PI?T-=_.PI2:T<-_.PI&&(T+=_.PI2);var I=p.b,R=p.d;T=Math.atan2(R,I)+(T-_.PI/2+c)*n;var C=Math.sqrt(I*I+R*R);p.b=Math.cos(T)*C,p.d=Math.sin(T)*C,g=!0}g&&(p.appliedValid=!1)}},e.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var h=i[s];h.appliedValid||h.updateAppliedTransform();var l=h.arotation;if(0!=t){var u=a.arotation-l+this.data.offsetRotation;l+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=h.ax,d=h.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=h.ascaleX,v=h.ascaleY;0!=r&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*r)/f),v>1e-5&&(v=(v+(a.ascaleY-v+this.data.offsetScaleY)*r)/v));var p=h.ashearY;if(0!=n){var g=a.ashearY-p+this.data.offsetShearY;g-=360*(16384-(16384.499999999996-g/360|0)),h.shearY+=g*n}h.updateWorldTransformWith(c,d,l,f,v,h.ashearX,p)}},e.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var h=i[s];h.appliedValid||h.updateAppliedTransform();var l=h.arotation;0!=t&&(l+=(a.arotation+this.data.offsetRotation)*t);var u=h.ax,c=h.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=h.ascaleX,f=h.ascaleY;0!=r&&(d>1e-5&&(d*=(a.ascaleX-1+this.data.offsetScaleX)*r+1),f>1e-5&&(f*=(a.ascaleY-1+this.data.offsetScaleY)*r+1));var v=h.ashearY;0!=n&&(v+=(a.ashearY+this.data.offsetShearY)*n),h.updateWorldTransformWith(u,c,l,d,f,h.ashearX,v)}},t}(),j=function(t,e,r){this.name=t,this.order=e,this.skinRequired=r},G=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r}return R(e,t),e}(j);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(B||(B={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(D||(D={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(Y||(Y={}));var z=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},Z=function(t){function e(r){var n;return(n=t.call(this,r)||this).id=(65535&e.nextID++)<<11,n.worldVerticesLength=0,n.deformAttachment=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n),n}R(e,t);var r=e.prototype;return r.computeWorldVertices=function(t,e,r,n,a,i){r=a+(r>>1)*i;var s=t.bone.skeleton,o=t.deform,h=this.vertices,l=this.bones;if(null!=l){for(var u=0,c=0,d=0;d<e;d+=2){var f=l[u];u+=f+1,c+=f}var v=s.bones;if(0==o.length)for(var p=a,g=3*c;p<r;p+=i){var m=0,w=0,E=l[u++];for(E+=u;u<E;u++,g+=3){var x=v[l[u]],y=h[g],b=h[g+1],S=h[g+2];m+=(y*x.a+b*x.b+x.worldX)*S,w+=(y*x.c+b*x.d+x.worldY)*S}n[p]=m,n[p+1]=w}else for(var M=o,A=a,T=3*c,I=c<<1;A<r;A+=i){var R=0,C=0,k=l[u++];for(k+=u;u<k;u++,T+=3,I+=2){var V=v[l[u]],P=h[T]+M[I],_=h[T+1]+M[I+1],F=h[T+2];R+=(P*V.a+_*V.b+V.worldX)*F,C+=(P*V.c+_*V.d+V.worldY)*F}n[A]=R,n[A+1]=C}}else{o.length>0&&(h=o);for(var N=t.bone,O=N.worldX,L=N.worldY,X=N.a,B=N.b,D=N.c,Y=N.d,U=e,W=a;W<r;U+=2,W+=i){var q=h[U],H=h[U+1];n[W]=q*X+H*B+O,n[W+1]=q*D+H*Y+L}}},r.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),F.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=F.newFloatArray(this.vertices.length),F.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(z);Z.nextID=0;var Q=function(t){function e(e){var r;return(r=t.call(this,e)||this).closed=!1,r.constantSpeed=!1,r.color=new P(1,1,1,1),r}return R(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),F.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(Z),J=function(){function t(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=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,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var r=0,n=t.bones.length;r<n;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findSlot(t.target.name),this.position=t.position,this.spacing=t.spacing,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var e=this.target.getAttachment();if(k(e,Q)){var r=this.rotateMix,n=this.translateMix,a=r>0;if(n>0||a){var i=this.data,s=i.spacingMode==D.Percent,o=i.rotateMode,h=o==Y.Tangent,l=o==Y.ChainScale,u=this.bones.length,c=h?u:u+1,d=this.bones,f=F.setArraySize(this.spaces,c),v=null,p=this.spacing;if(l||!s){l&&(v=F.setArraySize(this.lengths,u));for(var g=i.spacingMode==D.Length,m=0,w=c-1;m<w;){var E=d[m],x=E.data.length;if(x<t.epsilon)l&&(v[m]=0),f[++m]=0;else if(s){if(l){var y=x*E.a,b=x*E.c,S=Math.sqrt(y*y+b*b);v[m]=S}f[++m]=p}else{var M=x*E.a,A=x*E.c,T=Math.sqrt(M*M+A*A);l&&(v[m]=T),f[++m]=(g?x+p:p)*T/x}}}else for(var I=1;I<c;I++)f[I]=p;var R=this.computeWorldPositions(e,c,h,i.positionMode==B.Percent,s),C=R[0],V=R[1],P=i.offsetRotation,N=!1;if(0==P)N=o==Y.Chain;else{N=!1;var O=this.target.bone;P*=O.a*O.d-O.b*O.c>0?_.degRad:-_.degRad}for(var L=0,X=3;L<u;L++,X+=3){var U=d[L];U.worldX+=(C-U.worldX)*n,U.worldY+=(V-U.worldY)*n;var W=R[X],q=R[X+1],H=W-C,j=q-V;if(l){var G=v[L];if(0!=G){var z=(Math.sqrt(H*H+j*j)/G-1)*r+1;U.a*=z,U.c*=z}}if(C=W,V=q,a){var Z=U.a,J=U.b,K=U.c,$=U.d,tt=0,et=0,rt=0;if(tt=h?R[X-1]:0==f[L+1]?R[X+2]:Math.atan2(j,H),tt-=Math.atan2(K,Z),N){et=Math.cos(tt),rt=Math.sin(tt);var nt=U.data.length;C+=(nt*(et*Z-rt*K)-H)*r,V+=(nt*(rt*Z+et*K)-j)*r}else tt+=P;tt>_.PI?tt-=_.PI2:tt<-_.PI&&(tt+=_.PI2),tt*=r,et=Math.cos(tt),rt=Math.sin(tt),U.a=et*Z-rt*K,U.b=et*J-rt*$,U.c=rt*Z+et*K,U.d=rt*J+et*$}U.appliedValid=!1}}}},e.computeWorldPositions=function(e,r,n,a,i){var s=this.target,o=this.position,h=this.spaces,l=F.setArraySize(this.positions,3*r+2),u=null,c=e.closed,d=e.worldVerticesLength,f=d/6,v=t.NONE;if(!e.constantSpeed){var p=e.lengths,g=p[f-=c?1:2];if(a&&(o*=g),i)for(var m=1;m<r;m++)h[m]*=g;u=F.setArraySize(this.world,8);for(var w=0,E=0,x=0;w<r;w++,E+=3){var y=h[w],b=o+=y;if(c)(b%=g)<0&&(b+=g),x=0;else{if(b<0){v!=t.BEFORE&&(v=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(b,u,0,l,E);continue}if(b>g){v!=t.AFTER&&(v=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(b-g,u,0,l,E);continue}}for(;;x++){var S=p[x];if(!(b>S)){if(0==x)b/=S;else{var M=p[x-1];b=(b-M)/(S-M)}break}}x!=v&&(v=x,c&&x==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*x+2,8,u,0,2)),this.addCurvePosition(b,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],l,E,n||w>0&&0==y)}return l}c?(d+=2,u=F.setArraySize(this.world,d),e.computeWorldVertices(s,2,d-4,u,0,2),e.computeWorldVertices(s,0,2,u,d-4,2),u[d-2]=u[0],u[d-1]=u[1]):(f--,d-=4,u=F.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var A=F.setArraySize(this.curves,f),T=0,I=u[0],R=u[1],C=0,k=0,V=0,P=0,_=0,N=0,O=0,L=0,X=0,B=0,D=0,Y=0,U=0,W=0,q=0,H=2;q<f;q++,H+=6)C=u[H],k=u[H+1],V=u[H+2],P=u[H+3],D=2*(O=.1875*(I-2*C+V))+(X=.09375*(3*(C-V)-I+(_=u[H+4]))),Y=2*(L=.1875*(R-2*k+P))+(B=.09375*(3*(k-P)-R+(N=u[H+5]))),U=.75*(C-I)+O+.16666667*X,W=.75*(k-R)+L+.16666667*B,T+=Math.sqrt(U*U+W*W),U+=D,W+=Y,D+=X,Y+=B,T+=Math.sqrt(U*U+W*W),U+=D,W+=Y,T+=Math.sqrt(U*U+W*W),U+=D+X,W+=Y+B,T+=Math.sqrt(U*U+W*W),A[q]=T,I=_,R=N;if(o*=a?T:T/e.lengths[f-1],i)for(var j=1;j<r;j++)h[j]*=T;for(var G=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<r;Z++,Q+=3){var $=h[Z],tt=o+=$;if(c)(tt%=T)<0&&(tt+=T),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,l,Q);continue}if(tt>T){this.addAfterPosition(tt-T,u,d-4,l,Q);continue}}for(;;J++){var et=A[J];if(!(tt>et)){if(0==J)tt/=et;else{var rt=A[J-1];tt=(tt-rt)/(et-rt)}break}}if(J!=v){v=J;var nt=6*J;for(I=u[nt],R=u[nt+1],C=u[nt+2],k=u[nt+3],V=u[nt+4],P=u[nt+5],D=2*(O=.03*(I-2*C+V))+(X=.006*(3*(C-V)-I+(_=u[nt+6]))),Y=2*(L=.03*(R-2*k+P))+(B=.006*(3*(k-P)-R+(N=u[nt+7]))),U=.3*(C-I)+O+.16666667*X,W=.3*(k-R)+L+.16666667*B,z=Math.sqrt(U*U+W*W),G[0]=z,nt=1;nt<8;nt++)U+=D,W+=Y,D+=X,Y+=B,z+=Math.sqrt(U*U+W*W),G[nt]=z;U+=D,W+=Y,z+=Math.sqrt(U*U+W*W),G[8]=z,U+=D+X,W+=Y+B,z+=Math.sqrt(U*U+W*W),G[9]=z,K=0}for(tt*=z;;K++){var at=G[K];if(!(tt>at)){if(0==K)tt/=at;else{var it=G[K-1];tt=K+(tt-it)/(at-it)}break}}this.addCurvePosition(.1*tt,I,R,C,k,V,P,_,N,l,Q,n||Z>0&&0==$)}return l},e.addBeforePosition=function(t,e,r,n,a){var i=e[r],s=e[r+1],o=e[r+2]-i,h=e[r+3]-s,l=Math.atan2(h,o);n[a]=i+t*Math.cos(l),n[a+1]=s+t*Math.sin(l),n[a+2]=l},e.addAfterPosition=function(t,e,r,n,a){var i=e[r+2],s=e[r+3],o=i-e[r],h=s-e[r+1],l=Math.atan2(h,o);n[a]=i+t*Math.cos(l),n[a+1]=s+t*Math.sin(l),n[a+2]=l},e.addCurvePosition=function(t,e,r,n,a,i,s,o,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=r,void(l[u+2]=Math.atan2(a-r,n-e));var d=t*t,f=d*t,v=1-t,p=v*v,g=p*v,m=v*t,w=3*m,E=v*w,x=w*t,y=e*g+n*E+i*x+o*f,b=r*g+a*E+s*x+h*f;l[u]=y,l[u+1]=b,c&&(l[u+2]=t<.001?Math.atan2(a-r,n-e):Math.atan2(b-(r*p+a*m*2+s*d),y-(e*p+n*m*2+i*d)))},t}();J.NONE=-1,J.BEFORE=-2,J.AFTER=-3,J.epsilon=1e-5;var K=function(t){function e(e){var r;return(r=t.call(this,e)||this).x=0,r.y=0,r.scaleX=1,r.scaleY=1,r.rotation=0,r.width=0,r.height=0,r.color=new P(1,1,1,1),r.offset=F.newFloatArray(8),r.uvs=F.newFloatArray(8),r.tempColor=new P(1,1,1,1),r}R(e,t);var r=e.prototype;return r.updateOffset=function(){var t=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*t,a=-this.height/2*this.scaleY+this.region.offsetY*r,i=n+this.region.width*t,s=a+this.region.height*r,o=this.rotation*Math.PI/180,h=Math.cos(o),l=Math.sin(o),u=n*h+this.x,c=n*l,d=a*h+this.y,f=a*l,v=i*h+this.x,p=i*l,g=s*h+this.y,m=s*l,w=this.offset;w[e.OX1]=u-f,w[e.OY1]=d+c,w[e.OX2]=u-m,w[e.OY2]=g+c,w[e.OX3]=v-m,w[e.OY3]=g+p,w[e.OX4]=v-f,w[e.OY4]=d+p},r.setRegion=function(t){this.region=t;var e=this.uvs;t.rotate?(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.u2,e[1]=t.v2):(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)},r.computeWorldVertices=function(t,r,n,a){var i=this.offset,s=t.worldX,o=t.worldY,h=t.a,l=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],r[n]=d*h+f*l+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX2],f=i[e.OY2],r[n]=d*h+f*l+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX3],f=i[e.OY3],r[n]=d*h+f*l+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX4],f=i[e.OY4],r[n]=d*h+f*l+s,r[n+1]=d*u+f*c+o},r.copy=function(){var t=new e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,F.arrayCopy(this.uvs,0,t.uvs,0,8),F.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(z);K.OX1=0,K.OY1=1,K.OX2=2,K.OY2=3,K.OX3=4,K.OY3=5,K.OX4=6,K.OY4=7,K.X1=0,K.Y1=1,K.C1R=2,K.C1G=3,K.C1B=4,K.C1A=5,K.U1=6,K.V1=7,K.X2=8,K.Y2=9,K.C2R=10,K.C2G=11,K.C2B=12,K.C2A=13,K.U2=14,K.V2=15,K.X3=16,K.Y3=17,K.C3R=18,K.C3G=19,K.C3B=20,K.C3A=21,K.U3=22,K.V3=23,K.X4=24,K.Y4=25,K.C4R=26,K.C4G=27,K.C4B=28,K.C4A=29,K.U4=30,K.V4=31;var $,tt,et=function(){function t(t){this._image=t}return t.prototype.getImage=function(){return this._image},t.filterFromString=function(t){switch(t.toLowerCase()){case"nearest":return 9728;case"linear":return 9729;case"mipmap":case"mipmaplinearlinear":return 9987;case"mipmapnearestnearest":return 9984;case"mipmaplinearnearest":return 9985;case"mipmapnearestlinear":return 9986;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return 33648;case"clamptoedge":return 33071;case"repeat":return 10497;default:throw new Error("Unknown texture wrap "+t)}},t}();!function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"}($||($={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(tt||(tt={}));var rt,nt,at,it=function(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.rotate=!1,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0},st=function(t){function e(){return t.apply(this,arguments)}R(e,t);var r=e.prototype;return r.setFilters=function(t,e){},r.setWraps=function(t,e){},r.dispose=function(){},e}(et),ot=function(){function t(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}var e=t.prototype;return e.load=function(t,e){if(null==e)throw new Error("textureLoader cannot be null.");for(var r=new ht(t),n=new Array(4),a=null;;){var i=r.readLine();if(null==i)break;if(0==(i=i.trim()).length)a=null;else if(a){var s=new ut;s.name=i,s.page=a;var o=r.readValue();"true"==o.toLocaleLowerCase()?s.degrees=90:"false"==o.toLocaleLowerCase()?s.degrees=0:s.degrees=parseFloat(o),s.rotate=90==s.degrees,r.readTuple(n);var h=parseInt(n[0]),l=parseInt(n[1]);r.readTuple(n);var u=parseInt(n[0]),c=parseInt(n[1]);s.u=h/a.width,s.v=l/a.height,s.rotate?(s.u2=(h+c)/a.width,s.v2=(l+u)/a.height):(s.u2=(h+u)/a.width,s.v2=(l+c)/a.height),s.x=h,s.y=l,s.width=Math.abs(u),s.height=Math.abs(c),4==r.readTuple(n)&&4==r.readTuple(n)&&r.readTuple(n),s.originalWidth=parseInt(n[0]),s.originalHeight=parseInt(n[1]),r.readTuple(n),s.offsetX=parseInt(n[0]),s.offsetY=parseInt(n[1]),s.index=parseInt(r.readValue()),s.texture=a.texture,this.regions.push(s)}else{(a=new lt).name=i,2==r.readTuple(n)&&(a.width=parseInt(n[0]),a.height=parseInt(n[1]),r.readTuple(n)),r.readTuple(n),a.minFilter=et.filterFromString(n[0]),a.magFilter=et.filterFromString(n[1]);var d=r.readValue();a.uWrap=tt.ClampToEdge,a.vWrap=tt.ClampToEdge,"x"==d?a.uWrap=tt.Repeat:"y"==d?a.vWrap=tt.Repeat:"xy"==d&&(a.uWrap=a.vWrap=tt.Repeat),a.texture=e(i),a.texture.setFilters(a.minFilter,a.magFilter),a.texture.setWraps(a.uWrap,a.vWrap),a.width=a.texture.getImage().width,a.height=a.texture.getImage().height,this.pages.push(a)}}},e.findRegion=function(t){for(var e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null},e.dispose=function(){for(var t=0;t<this.pages.length;t++)this.pages[t].texture.dispose()},t}(),ht=function(){function t(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}var e=t.prototype;return e.readLine=function(){return this.index>=this.lines.length?null:this.lines[this.index++]},e.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},e.readTuple=function(t){var e=this.readLine(),r=e.indexOf(":");if(-1==r)throw new Error("Invalid line: "+e);for(var n=0,a=r+1;n<3;n++){var i=e.indexOf(",",a);if(-1==i)break;t[n]=e.substr(a,i-a).trim(),a=i+1}return t[n]=e.substring(a).trim(),n+1},t}(),lt=function(){},ut=function(t){function e(){return t.apply(this,arguments)}return R(e,t),e}(it),ct=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new P(1,1,1,1),r.tempColor=new P(0,0,0,0),r}R(e,t);var r=e.prototype;return r.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=F.newFloatArray(t.length));var e=this.uvs,r=this.uvs.length,n=this.region.u,a=this.region.v,i=0,s=0;if(k(this.region,ut)){var o=this.region,h=o.texture.getImage().width,l=o.texture.getImage().height;switch(o.degrees){case 90:n-=(o.originalHeight-o.offsetY-o.height)/h,a-=(o.originalWidth-o.offsetX-o.width)/l,i=o.originalHeight/h,s=o.originalWidth/l;for(var u=0;u<r;u+=2)e[u]=n+t[u+1]*i,e[u+1]=a+(1-t[u])*s;return;case 180:n-=(o.originalWidth-o.offsetX-o.width)/h,a-=o.offsetY/l,i=o.originalWidth/h,s=o.originalHeight/l;for(var c=0;c<r;c+=2)e[c]=n+(1-t[c])*i,e[c+1]=a+(1-t[c+1])*s;return;case 270:n-=o.offsetY/h,a-=o.offsetX/l,i=o.originalHeight/h,s=o.originalWidth/l;for(var d=0;d<r;d+=2)e[d]=n+(1-t[d+1])*i,e[d+1]=a+t[d]*s;return}n-=o.offsetX/h,a-=(o.originalHeight-o.offsetY-o.height)/l,i=o.originalWidth/h,s=o.originalHeight/l}else null==this.region?(n=a=0,i=s=1):(i=this.region.u2-n,s=this.region.v2-a);for(var f=0;f<r;f+=2)e[f]=n+t[f]*i,e[f+1]=a+t[f+1]*s},r.getParentMesh=function(){return this.parentMesh},r.setParentMesh=function(t){this.parentMesh=t,null!=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)},r.copy=function(){if(null!=this.parentMesh)return this.newLinkedMesh();var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),F.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),F.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),F.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),F.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t},r.newLinkedMesh=function(){var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(null!=this.parentMesh?this.parentMesh:this),t.updateUVs(),t},e}(Z),dt=function(){function t(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var e=0;e<t.bones.length;e++){var r=t.bones[e],n=void 0;if(null==r.parent)n=new U(r,this,null);else{var a=this.bones[r.parent.index];n=new U(r,this,a),a.children.push(n)}this.bones.push(n)}this.slots=new Array,this.drawOrder=new Array;for(var i=0;i<t.slots.length;i++){var s=t.slots[i],o=this.bones[s.boneData.index],h=new W(s,o);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(var l=0;l<t.ikConstraints.length;l++){var u=t.ikConstraints[l];this.ikConstraints.push(new q(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new H(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var v=t.pathConstraints[f];this.pathConstraints.push(new J(v,this))}this.color=new P(1,1,1,1),this.updateCache()}var e=t.prototype;return e.updateCache=function(){var t=this._updateCache;t.length=0,this.updateCacheReset.length=0;for(var e=this.bones,r=0,n=e.length;r<n;r++){var a=e[r];a.sorted=a.data.skinRequired,a.active=!a.sorted}if(null!=this.skin)for(var i=this.skin.bones,s=0,o=this.skin.bones.length;s<o;s++){var h=this.bones[i[s].index];do{h.sorted=!1,h.active=!0,h=h.parent}while(null!=h)}var l=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=l.length,f=u.length,v=c.length,p=d+f+v;t:for(var g=0;g<p;g++){for(var m=0;m<d;m++){var w=l[m];if(w.data.order==g){this.sortIkConstraint(w);continue t}}for(var E=0;E<f;E++){var x=u[E];if(x.data.order==g){this.sortTransformConstraint(x);continue t}}for(var y=0;y<v;y++){var b=c[y];if(b.data.order==g){this.sortPathConstraint(b);continue t}}}for(var S=0,M=e.length;S<M;S++)this.sortBone(e[S])},e.sortIkConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&F.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target;this.sortBone(e);var r=t.bones,n=r[0];if(this.sortBone(n),r.length>1){var a=r[r.length-1];this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}this._updateCache.push(t),this.sortReset(n.children),r[r.length-1].sorted=!0}},e.sortPathConstraint=function(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||null!=this.skin&&F.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target,r=e.data.index,n=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,r,n),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,n);for(var a=0,i=this.data.skins.length;a<i;a++)this.sortPathConstraintAttachment(this.data.skins[a],r,n);var s=e.getAttachment();k(s,Q)&&this.sortPathConstraintAttachmentWith(s,n);for(var o=t.bones,h=o.length,l=0;l<h;l++)this.sortBone(o[l]);this._updateCache.push(t);for(var u=0;u<h;u++)this.sortReset(o[u].children);for(var c=0;c<h;c++)o[c].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&F.contains(this.skin.constraints,t.data,!0)),t.active){this.sortBone(t.target);var e=t.bones,r=e.length;if(t.data.local)for(var n=0;n<r;n++){var a=e[n];this.sortBone(a.parent),this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}else for(var i=0;i<r;i++)this.sortBone(e[i]);this._updateCache.push(t);for(var s=0;s<r;s++)this.sortReset(e[s].children);for(var o=0;o<r;o++)e[o].sorted=!0}},e.sortPathConstraintAttachment=function(t,e,r){var n=t.attachments[e];if(n)for(var a in n)this.sortPathConstraintAttachmentWith(n[a],r)},e.sortPathConstraintAttachmentWith=function(t,e){if(k(t,Q)){var r=t.bones;if(null==r)this.sortBone(e);else for(var n=this.bones,a=0;a<r.length;)for(var i=r[a++],s=a+i;a<s;a++){var o=r[a];this.sortBone(n[o])}}},e.sortBone=function(t){if(!t.sorted){var e=t.parent;null!=e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}},e.sortReset=function(t){for(var e=0,r=t.length;e<r;e++){var n=t[e];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}},e.updateWorldTransform=function(){for(var t=this.updateCacheReset,e=0,r=t.length;e<r;e++){var n=t[e];n.ax=n.x,n.ay=n.y,n.arotation=n.rotation,n.ascaleX=n.scaleX,n.ascaleY=n.scaleY,n.ashearX=n.shearX,n.ashearY=n.shearY,n.appliedValid=!0}for(var a=this._updateCache,i=0,s=a.length;i<s;i++)a[i].update()},e.setToSetupPose=function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},e.setBonesToSetupPose=function(){for(var t=this.bones,e=0,r=t.length;e<r;e++)t[e].setToSetupPose();for(var n=this.ikConstraints,a=0,i=n.length;a<i;a++){var s=n[a];s.mix=s.data.mix,s.softness=s.data.softness,s.bendDirection=s.data.bendDirection,s.compress=s.data.compress,s.stretch=s.data.stretch}for(var o=this.transformConstraints,h=0,l=o.length;h<l;h++){var u=o[h],c=u.data;u.rotateMix=c.rotateMix,u.translateMix=c.translateMix,u.scaleMix=c.scaleMix,u.shearMix=c.shearMix}for(var d=this.pathConstraints,f=0,v=d.length;f<v;f++){var p=d[f],g=p.data;p.position=g.position,p.spacing=g.spacing,p.rotateMix=g.rotateMix,p.translateMix=g.translateMix}},e.setSlotsToSetupPose=function(){var t=this.slots;F.arrayCopy(t,0,this.drawOrder,0,t.length);for(var e=0,r=t.length;e<r;e++)t[e].setToSetupPose()},e.getRootBone=function(){return 0==this.bones.length?null:this.bones[0]},e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++)if(e[r].data.name==t)return r;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++)if(e[r].data.name==t)return r;return-1},e.setSkinByName=function(t){var e=this.data.findSkin(t);if(null==e)throw new Error("Skin not found: "+t);this.setSkin(e)},e.setSkin=function(t){if(t!=this.skin){if(null!=t)if(null!=this.skin)t.attachAll(this,this.skin);else for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r],i=a.data.attachmentName;if(null!=i){var s=t.getAttachment(r,i);null!=s&&a.setAttachment(s)}}this.skin=t,this.updateCache()}},e.getAttachmentByName=function(t,e){return this.getAttachment(this.data.findSlotIndex(t),e)},e.getAttachment=function(t,e){if(null==e)throw new Error("attachmentName cannot be null.");if(null!=this.skin){var r=this.skin.getAttachment(t,e);if(null!=r)return r}return null!=this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},e.setAttachment=function(t,e){if(null==t)throw new Error("slotName cannot be null.");for(var r=this.slots,n=0,a=r.length;n<a;n++){var i=r[n];if(i.data.name==t){var s=null;if(null!=e&&null==(s=this.getAttachment(n,e)))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.getBounds=function(t,e,r){if(void 0===r&&(r=new Array(2)),null==t)throw new Error("offset cannot be null.");if(null==e)throw new Error("size cannot be null.");for(var n=this.drawOrder,a=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=0,l=n.length;h<l;h++){var u=n[h];if(u.bone.active){var c=0,d=null,f=u.getAttachment();if(k(f,K))c=8,d=F.setArraySize(r,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(k(f,ct)){var v=f;c=v.worldVerticesLength,d=F.setArraySize(r,c,0),v.computeWorldVertices(u,0,c,d,0,2)}if(null!=d)for(var p=0,g=d.length;p<g;p+=2){var m=d[p],w=d[p+1];a=Math.min(a,m),i=Math.min(i,w),s=Math.max(s,m),o=Math.max(o,w)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),ft=function(){function t(t,e,r){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(var n=0;n<e.length;n++)this.timelineIds[e[n].getPropertyId()]=!0;this.duration=r}var e=t.prototype;return e.hasTimeline=function(t){return 1==this.timelineIds[t]},e.apply=function(t,e,r,n,a,i,s,o){if(null==t)throw new Error("skeleton cannot be null.");n&&0!=this.duration&&(r%=this.duration,e>0&&(e%=this.duration));for(var h=this.timelines,l=0,u=h.length;l<u;l++)h[l].apply(t,e,r,a,i,s,o)},t.binarySearch=function(t,e,r){void 0===r&&(r=1);var n=0,a=t.length/r-2;if(0==a)return r;for(var i=a>>>1;;){if(t[(i+1)*r]<=e?n=i+1:a=i,n==a)return(n+1)*r;i=n+a>>>1}},t.linearSearch=function(t,e,r){for(var n=0,a=t.length-r;n<=a;n+=r)if(t[n]>e)return n;return-1},t}();!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(rt||(rt={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(nt||(nt={})),function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"}(at||(at={}));var vt=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=F.newFloatArray((e-1)*t.BEZIER_SIZE)}var e=t.prototype;return e.getFrameCount=function(){return this.curves.length/t.BEZIER_SIZE+1},e.setLinear=function(e){this.curves[e*t.BEZIER_SIZE]=t.LINEAR},e.setStepped=function(e){this.curves[e*t.BEZIER_SIZE]=t.STEPPED},e.getCurveType=function(e){var r=e*t.BEZIER_SIZE;if(r==this.curves.length)return t.LINEAR;var n=this.curves[r];return n==t.LINEAR?t.LINEAR:n==t.STEPPED?t.STEPPED:t.BEZIER},e.setCurve=function(e,r,n,a,i){var s=.03*(2*-r+a),o=.03*(2*-n+i),h=.006*(3*(r-a)+1),l=.006*(3*(n-i)+1),u=2*s+h,c=2*o+l,d=.3*r+s+.16666667*h,f=.3*n+o+.16666667*l,v=e*t.BEZIER_SIZE,p=this.curves;p[v++]=t.BEZIER;for(var g=d,m=f,w=v+t.BEZIER_SIZE-1;v<w;v+=2)p[v]=g,p[v+1]=m,d+=u,f+=c,u+=h,c+=l,g+=d,m+=f},e.getCurvePercent=function(e,r){r=_.clamp(r,0,1);var n=this.curves,a=e*t.BEZIER_SIZE,i=n[a];if(i==t.LINEAR)return r;if(i==t.STEPPED)return 0;for(var s=0,o=++a,h=a+t.BEZIER_SIZE-1;a<h;a+=2)if((s=n[a])>=r){var l=void 0,u=void 0;return a==o?(l=0,u=0):(l=n[a-2],u=n[a-1]),u+(n[a+1]-u)*(r-l)/(s-l)}var c=n[a-1];return c+(1-c)*(r-s)/(1-s)},t}();vt.LINEAR=0,vt.STEPPED=1,vt.BEZIER=2,vt.BEZIER_SIZE=19;var pt=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=F.newFloatArray(e<<1),r}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return 0+this.boneIndex},r.setFrame=function(t,r,n){t<<=1,this.frames[t]=r,this.frames[t+e.ROTATION]=n},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(n<h[0])switch(s){case 0:return void(l.rotation=l.data.rotation);case 1:var u=l.data.rotation-l.rotation;l.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(n>=h[h.length-e.ENTRIES]){var c=h[h.length+e.PREV_ROTATION];switch(s){case 0:l.rotation=l.data.rotation+c*i;break;case 1:case 2:c+=l.data.rotation-l.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:l.rotation+=c*i}}else{var d=ft.binarySearch(h,n,e.ENTRIES),f=h[d+e.PREV_ROTATION],v=h[d],p=this.getCurvePercent((d>>1)-1,1-(n-v)/(h[d+e.PREV_TIME]-v)),g=h[d+e.ROTATION]-f;switch(g=f+(g-360*(16384-(16384.499999999996-g/360|0)))*p,s){case 0:l.rotation=l.data.rotation+(g-360*(16384-(16384.499999999996-g/360|0)))*i;break;case 1:case 2:g+=l.data.rotation-l.rotation;case 3:l.rotation+=(g-360*(16384-(16384.499999999996-g/360|0)))*i}}},e}(vt);pt.ENTRIES=2,pt.PREV_TIME=-2,pt.PREV_ROTATION=-1,pt.ROTATION=1;var gt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(1<<24)+this.boneIndex},r.setFrame=function(t,r,n,a){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.X]=n,this.frames[t+e.Y]=a},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(n<h[0])switch(s){case 0:return l.x=l.data.x,void(l.y=l.data.y);case 1:l.x+=(l.data.x-l.x)*i,l.y+=(l.data.y-l.y)*i}else{var u=0,c=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X],c=h[h.length+e.PREV_Y];else{var d=ft.binarySearch(h,n,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.X]-u)*v,c+=(h[d+e.Y]-c)*v}switch(s){case 0:l.x=l.data.x+u*i,l.y=l.data.y+c*i;break;case 1:case 2:l.x+=(l.data.x+u-l.x)*i,l.y+=(l.data.y+c-l.y)*i;break;case 3:l.x+=u*i,l.y+=c*i}}},e}(vt);gt.ENTRIES=3,gt.PREV_TIME=-3,gt.PREV_X=-2,gt.PREV_Y=-1,gt.X=1,gt.Y=2;var mt=function(t){function e(e){return t.call(this,e)}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(2<<24)+this.boneIndex},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(n<h[0])switch(s){case 0:return l.scaleX=l.data.scaleX,void(l.scaleY=l.data.scaleY);case 1:l.scaleX+=(l.data.scaleX-l.scaleX)*i,l.scaleY+=(l.data.scaleY-l.scaleY)*i}else{var u=0,c=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X]*l.data.scaleX,c=h[h.length+e.PREV_Y]*l.data.scaleY;else{var d=ft.binarySearch(h,n,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(h[d+e.PREV_TIME]-f));u=(u+(h[d+e.X]-u)*v)*l.data.scaleX,c=(c+(h[d+e.Y]-c)*v)*l.data.scaleY}if(1==i)3==s?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{var p=0,g=0;if(1==o)switch(s){case 0:p=l.data.scaleX,g=l.data.scaleY,l.scaleX=p+(Math.abs(u)*_.signum(p)-p)*i,l.scaleY=g+(Math.abs(c)*_.signum(g)-g)*i;break;case 1:case 2:p=l.scaleX,g=l.scaleY,l.scaleX=p+(Math.abs(u)*_.signum(p)-p)*i,l.scaleY=g+(Math.abs(c)*_.signum(g)-g)*i;break;case 3:p=l.scaleX,g=l.scaleY,l.scaleX=p+(Math.abs(u)*_.signum(p)-l.data.scaleX)*i,l.scaleY=g+(Math.abs(c)*_.signum(g)-l.data.scaleY)*i}else switch(s){case 0:p=Math.abs(l.data.scaleX)*_.signum(u),g=Math.abs(l.data.scaleY)*_.signum(c),l.scaleX=p+(u-p)*i,l.scaleY=g+(c-g)*i;break;case 1:case 2:p=Math.abs(l.scaleX)*_.signum(u),g=Math.abs(l.scaleY)*_.signum(c),l.scaleX=p+(u-p)*i,l.scaleY=g+(c-g)*i;break;case 3:p=_.signum(u),g=_.signum(c),l.scaleX=Math.abs(l.scaleX)*p+(u-Math.abs(l.data.scaleX)*p)*i,l.scaleY=Math.abs(l.scaleY)*g+(c-Math.abs(l.data.scaleY)*g)*i}}}},e}(gt),wt=function(t){function e(e){return t.call(this,e)}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(3<<24)+this.boneIndex},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(n<h[0])switch(s){case 0:return l.shearX=l.data.shearX,void(l.shearY=l.data.shearY);case 1:l.shearX+=(l.data.shearX-l.shearX)*i,l.shearY+=(l.data.shearY-l.shearY)*i}else{var u=0,c=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X],c=h[h.length+e.PREV_Y];else{var d=ft.binarySearch(h,n,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.X]-u)*v,c+=(h[d+e.Y]-c)*v}switch(s){case 0:l.shearX=l.data.shearX+u*i,l.shearY=l.data.shearY+c*i;break;case 1:case 2:l.shearX+=(l.data.shearX+u-l.shearX)*i,l.shearY+=(l.data.shearY+c-l.shearY)*i;break;case 3:l.shearX+=u*i,l.shearY+=c*i}}},e}(gt),Et=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(5<<24)+this.slotIndex},r.setFrame=function(t,r,n,a,i,s){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.R]=n,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s},r.apply=function(t,r,n,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=this.frames;if(n<l[0])switch(s){case 0:return void h.color.setFromColor(h.data.color);case 1:var u=h.color,c=h.data.color;u.add((c.r-u.r)*i,(c.g-u.g)*i,(c.b-u.b)*i,(c.a-u.a)*i)}else{var d=0,f=0,v=0,p=0;if(n>=l[l.length-e.ENTRIES]){var g=l.length;d=l[g+e.PREV_R],f=l[g+e.PREV_G],v=l[g+e.PREV_B],p=l[g+e.PREV_A]}else{var m=ft.binarySearch(l,n,e.ENTRIES);d=l[m+e.PREV_R],f=l[m+e.PREV_G],v=l[m+e.PREV_B],p=l[m+e.PREV_A];var w=l[m],E=this.getCurvePercent(m/e.ENTRIES-1,1-(n-w)/(l[m+e.PREV_TIME]-w));d+=(l[m+e.R]-d)*E,f+=(l[m+e.G]-f)*E,v+=(l[m+e.B]-v)*E,p+=(l[m+e.A]-p)*E}if(1==i)h.color.set(d,f,v,p);else{var x=h.color;0==s&&x.setFromColor(h.data.color),x.add((d-x.r)*i,(f-x.g)*i,(v-x.b)*i,(p-x.a)*i)}}}},e}(vt);Et.ENTRIES=5,Et.PREV_TIME=-5,Et.PREV_R=-4,Et.PREV_G=-3,Et.PREV_B=-2,Et.PREV_A=-1,Et.R=1,Et.G=2,Et.B=3,Et.A=4;var xt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(14<<24)+this.slotIndex},r.setFrame=function(t,r,n,a,i,s,o,h,l){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.R]=n,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s,this.frames[t+e.R2]=o,this.frames[t+e.G2]=h,this.frames[t+e.B2]=l},r.apply=function(t,r,n,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=this.frames;if(n<l[0])switch(s){case 0:return h.color.setFromColor(h.data.color),void h.darkColor.setFromColor(h.data.darkColor);case 1:var u=h.color,c=h.darkColor,d=h.data.color,f=h.data.darkColor;u.add((d.r-u.r)*i,(d.g-u.g)*i,(d.b-u.b)*i,(d.a-u.a)*i),c.add((f.r-c.r)*i,(f.g-c.g)*i,(f.b-c.b)*i,0)}else{var v=0,p=0,g=0,m=0,w=0,E=0,x=0;if(n>=l[l.length-e.ENTRIES]){var y=l.length;v=l[y+e.PREV_R],p=l[y+e.PREV_G],g=l[y+e.PREV_B],m=l[y+e.PREV_A],w=l[y+e.PREV_R2],E=l[y+e.PREV_G2],x=l[y+e.PREV_B2]}else{var b=ft.binarySearch(l,n,e.ENTRIES);v=l[b+e.PREV_R],p=l[b+e.PREV_G],g=l[b+e.PREV_B],m=l[b+e.PREV_A],w=l[b+e.PREV_R2],E=l[b+e.PREV_G2],x=l[b+e.PREV_B2];var S=l[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(n-S)/(l[b+e.PREV_TIME]-S));v+=(l[b+e.R]-v)*M,p+=(l[b+e.G]-p)*M,g+=(l[b+e.B]-g)*M,m+=(l[b+e.A]-m)*M,w+=(l[b+e.R2]-w)*M,E+=(l[b+e.G2]-E)*M,x+=(l[b+e.B2]-x)*M}if(1==i)h.color.set(v,p,g,m),h.darkColor.set(w,E,x,1);else{var A=h.color,T=h.darkColor;0==s&&(A.setFromColor(h.data.color),T.setFromColor(h.data.darkColor)),A.add((v-A.r)*i,(p-A.g)*i,(g-A.b)*i,(m-A.a)*i),T.add((w-T.r)*i,(E-T.g)*i,(x-T.b)*i,0)}}}},e}(vt);xt.ENTRIES=8,xt.PREV_TIME=-8,xt.PREV_R=-7,xt.PREV_G=-6,xt.PREV_B=-5,xt.PREV_A=-4,xt.PREV_R2=-3,xt.PREV_G2=-2,xt.PREV_B2=-1,xt.R=1,xt.G=2,xt.B=3,xt.A=4,xt.R2=5,xt.G2=6,xt.B2=7;var yt=function(){function t(t){this.frames=F.newFloatArray(t),this.attachmentNames=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return(4<<24)+this.slotIndex},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,r){this.frames[t]=e,this.attachmentNames[t]=r},e.apply=function(t,e,r,n,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active)if(1!=s){var h=this.frames;if(r<h[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var l=0;l=r>=h[h.length-1]?h.length-1:ft.binarySearch(h,r,1)-1;var u=this.attachmentNames[l];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}}else 0==i&&this.setAttachment(t,o,o.data.attachmentName)},e.setAttachment=function(t,e,r){e.attachment=null==r?null:t.getAttachment(this.slotIndex,r)},t}(),bt=null,St=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=F.newFloatArray(e),r.frameVertices=new Array(e),null==bt&&(bt=F.newFloatArray(64)),r}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(6<<27)+ +this.attachment.id+this.slotIndex},r.setFrame=function(t,e,r){this.frames[t]=e,this.frameVertices[t]=r},r.apply=function(t,e,r,n,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=o.getAttachment();if(k(h,Z)&&h.deformAttachment==this.attachment){var l=o.deform;0==l.length&&(i=0);var u=this.frameVertices,c=u[0].length,d=this.frames;if(r<d[0]){var f=h;switch(i){case 0:return void(l.length=0);case 1:if(1==a){l.length=0;break}var v=F.setArraySize(l,c);if(null==f.bones)for(var p=f.vertices,g=0;g<c;g++)v[g]+=(p[g]-v[g])*a;else{a=1-a;for(g=0;g<c;g++)v[g]*=a}}}else{var m=F.setArraySize(l,c);if(r>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var E=h;if(null==E.bones)for(var x=E.vertices,y=0;y<c;y++)m[y]+=w[y]-x[y];else for(var b=0;b<c;b++)m[b]+=w[b]}else F.arrayCopy(w,0,m,0,c);else switch(i){case 0:var S=h;if(null==S.bones)for(var M=S.vertices,A=0;A<c;A++){var T=M[A];m[A]=T+(w[A]-T)*a}else for(var I=0;I<c;I++)m[I]=w[I]*a;break;case 1:case 2:for(var R=0;R<c;R++)m[R]+=(w[R]-m[R])*a;break;case 3:var C=h;if(null==C.bones)for(var V=C.vertices,P=0;P<c;P++)m[P]+=(w[P]-V[P])*a;else for(var _=0;_<c;_++)m[_]+=w[_]*a}}else{var N=ft.binarySearch(d,r),O=u[N-1],L=u[N],X=d[N],B=this.getCurvePercent(N-1,1-(r-X)/(d[N-1]-X));if(1==a)if(3==i){var D=h;if(null==D.bones)for(var Y=D.vertices,U=0;U<c;U++){var W=O[U];m[U]+=W+(L[U]-W)*B-Y[U]}else for(var q=0;q<c;q++){var H=O[q];m[q]+=H+(L[q]-H)*B}}else for(var j=0;j<c;j++){var G=O[j];m[j]=G+(L[j]-G)*B}else switch(i){case 0:var z=h;if(null==z.bones)for(var Q=z.vertices,J=0;J<c;J++){var K=O[J],$=Q[J];m[J]=$+(K+(L[J]-K)*B-$)*a}else for(var tt=0;tt<c;tt++){var et=O[tt];m[tt]=(et+(L[tt]-et)*B)*a}break;case 1:case 2:for(var rt=0;rt<c;rt++){var nt=O[rt];m[rt]+=(nt+(L[rt]-nt)*B-m[rt])*a}break;case 3:var at=h;if(null==at.bones)for(var it=at.vertices,st=0;st<c;st++){var ot=O[st];m[st]+=(ot+(L[st]-ot)*B-it[st])*a}else for(var ht=0;ht<c;ht++){var lt=O[ht];m[ht]+=(lt+(L[ht]-lt)*B)*a}}}}}}},e}(vt),Mt=function(){function t(t){this.frames=F.newFloatArray(t),this.events=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 7<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e){this.frames[t]=e.time,this.events[t]=e},e.apply=function(t,e,r,n,a,i,s){if(null!=n){var o=this.frames,h=this.frames.length;if(e>r)this.apply(t,e,Number.MAX_VALUE,n,a,i,s),e=-1;else if(e>=o[h-1])return;if(!(r<o[0])){var l=0;if(e<o[0])l=0;else for(var u=o[l=ft.binarySearch(o,e)];l>0&&o[l-1]==u;)l--;for(;l<h&&r>=o[l];l++)n.push(this.events[l])}}},t}(),At=function(){function t(t){this.frames=F.newFloatArray(t),this.drawOrders=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 8<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,r){this.frames[t]=e,this.drawOrders[t]=r},e.apply=function(t,e,r,n,a,i,s){var o=t.drawOrder,h=t.slots;if(1!=s){var l=this.frames;if(r<l[0])0!=i&&1!=i||F.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=r>=l[l.length-1]?l.length-1:ft.binarySearch(l,r)-1;var c=this.drawOrders[u];if(null==c)F.arrayCopy(h,0,o,0,h.length);else for(var d=0,f=c.length;d<f;d++)o[d]=h[c[d]]}}else 0==i&&F.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),Tt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(9<<24)+this.ikConstraintIndex},r.setFrame=function(t,r,n,a,i,s,o){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.MIX]=n,this.frames[t+e.SOFTNESS]=a,this.frames[t+e.BEND_DIRECTION]=i,this.frames[t+e.COMPRESS]=s?1:0,this.frames[t+e.STRETCH]=o?1:0},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(l.active)if(n<h[0])switch(s){case 0:return l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,void(l.stretch=l.data.stretch);case 1:l.mix+=(l.data.mix-l.mix)*i,l.softness+=(l.data.softness-l.softness)*i,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}else if(n>=h[h.length-e.ENTRIES])0==s?(l.mix=l.data.mix+(h[h.length+e.PREV_MIX]-l.data.mix)*i,l.softness=l.data.softness+(h[h.length+e.PREV_SOFTNESS]-l.data.softness)*i,1==o?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[h.length+e.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+e.PREV_COMPRESS],l.stretch=0!=h[h.length+e.PREV_STRETCH])):(l.mix+=(h[h.length+e.PREV_MIX]-l.mix)*i,l.softness+=(h[h.length+e.PREV_SOFTNESS]-l.softness)*i,0==o&&(l.bendDirection=h[h.length+e.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+e.PREV_COMPRESS],l.stretch=0!=h[h.length+e.PREV_STRETCH]));else{var u=ft.binarySearch(h,n,e.ENTRIES),c=h[u+e.PREV_MIX],d=h[u+e.PREV_SOFTNESS],f=h[u],v=this.getCurvePercent(u/e.ENTRIES-1,1-(n-f)/(h[u+e.PREV_TIME]-f));0==s?(l.mix=l.data.mix+(c+(h[u+e.MIX]-c)*v-l.data.mix)*i,l.softness=l.data.softness+(d+(h[u+e.SOFTNESS]-d)*v-l.data.softness)*i,1==o?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[u+e.PREV_BEND_DIRECTION],l.compress=0!=h[u+e.PREV_COMPRESS],l.stretch=0!=h[u+e.PREV_STRETCH])):(l.mix+=(c+(h[u+e.MIX]-c)*v-l.mix)*i,l.softness+=(d+(h[u+e.SOFTNESS]-d)*v-l.softness)*i,0==o&&(l.bendDirection=h[u+e.PREV_BEND_DIRECTION],l.compress=0!=h[u+e.PREV_COMPRESS],l.stretch=0!=h[u+e.PREV_STRETCH]))}},e}(vt);Tt.ENTRIES=6,Tt.PREV_TIME=-6,Tt.PREV_MIX=-5,Tt.PREV_SOFTNESS=-4,Tt.PREV_BEND_DIRECTION=-3,Tt.PREV_COMPRESS=-2,Tt.PREV_STRETCH=-1,Tt.MIX=1,Tt.SOFTNESS=2,Tt.BEND_DIRECTION=3,Tt.COMPRESS=4,Tt.STRETCH=5;var It=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(10<<24)+this.transformConstraintIndex},r.setFrame=function(t,r,n,a,i,s){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.ROTATE]=n,this.frames[t+e.TRANSLATE]=a,this.frames[t+e.SCALE]=i,this.frames[t+e.SHEAR]=s},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(l.active)if(n<h[0]){var u=l.data;switch(s){case 0:return l.rotateMix=u.rotateMix,l.translateMix=u.translateMix,l.scaleMix=u.scaleMix,void(l.shearMix=u.shearMix);case 1:l.rotateMix+=(u.rotateMix-l.rotateMix)*i,l.translateMix+=(u.translateMix-l.translateMix)*i,l.scaleMix+=(u.scaleMix-l.scaleMix)*i,l.shearMix+=(u.shearMix-l.shearMix)*i}}else{var c=0,d=0,f=0,v=0;if(n>=h[h.length-e.ENTRIES]){var p=h.length;c=h[p+e.PREV_ROTATE],d=h[p+e.PREV_TRANSLATE],f=h[p+e.PREV_SCALE],v=h[p+e.PREV_SHEAR]}else{var g=ft.binarySearch(h,n,e.ENTRIES);c=h[g+e.PREV_ROTATE],d=h[g+e.PREV_TRANSLATE],f=h[g+e.PREV_SCALE],v=h[g+e.PREV_SHEAR];var m=h[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(n-m)/(h[g+e.PREV_TIME]-m));c+=(h[g+e.ROTATE]-c)*w,d+=(h[g+e.TRANSLATE]-d)*w,f+=(h[g+e.SCALE]-f)*w,v+=(h[g+e.SHEAR]-v)*w}if(0==s){var E=l.data;l.rotateMix=E.rotateMix+(c-E.rotateMix)*i,l.translateMix=E.translateMix+(d-E.translateMix)*i,l.scaleMix=E.scaleMix+(f-E.scaleMix)*i,l.shearMix=E.shearMix+(v-E.shearMix)*i}else l.rotateMix+=(c-l.rotateMix)*i,l.translateMix+=(d-l.translateMix)*i,l.scaleMix+=(f-l.scaleMix)*i,l.shearMix+=(v-l.shearMix)*i}},e}(vt);It.ENTRIES=5,It.PREV_TIME=-5,It.PREV_ROTATE=-4,It.PREV_TRANSLATE=-3,It.PREV_SCALE=-2,It.PREV_SHEAR=-1,It.ROTATE=1,It.TRANSLATE=2,It.SCALE=3,It.SHEAR=4;var Rt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(11<<24)+this.pathConstraintIndex},r.setFrame=function(t,r,n){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.VALUE]=n},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(n<h[0])switch(s){case 0:return void(l.position=l.data.position);case 1:l.position+=(l.data.position-l.position)*i}else{var u=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_VALUE];else{var c=ft.binarySearch(h,n,e.ENTRIES);u=h[c+e.PREV_VALUE];var d=h[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-d)/(h[c+e.PREV_TIME]-d));u+=(h[c+e.VALUE]-u)*f}0==s?l.position=l.data.position+(u-l.data.position)*i:l.position+=(u-l.position)*i}},e}(vt);Rt.ENTRIES=2,Rt.PREV_TIME=-2,Rt.PREV_VALUE=-1,Rt.VALUE=1;var Ct=function(t){function e(e){return t.call(this,e)}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(12<<24)+this.pathConstraintIndex},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(n<h[0])switch(s){case 0:return void(l.spacing=l.data.spacing);case 1:l.spacing+=(l.data.spacing-l.spacing)*i}else{var u=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_VALUE];else{var c=ft.binarySearch(h,n,e.ENTRIES);u=h[c+e.PREV_VALUE];var d=h[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-d)/(h[c+e.PREV_TIME]-d));u+=(h[c+e.VALUE]-u)*f}0==s?l.spacing=l.data.spacing+(u-l.data.spacing)*i:l.spacing+=(u-l.spacing)*i}},e}(Rt),kt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(13<<24)+this.pathConstraintIndex},r.setFrame=function(t,r,n,a){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.ROTATE]=n,this.frames[t+e.TRANSLATE]=a},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(n<h[0])switch(s){case 0:return l.rotateMix=l.data.rotateMix,void(l.translateMix=l.data.translateMix);case 1:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*i,l.translateMix+=(l.data.translateMix-l.translateMix)*i}else{var u=0,c=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_ROTATE],c=h[h.length+e.PREV_TRANSLATE];else{var d=ft.binarySearch(h,n,e.ENTRIES);u=h[d+e.PREV_ROTATE],c=h[d+e.PREV_TRANSLATE];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.ROTATE]-u)*v,c+=(h[d+e.TRANSLATE]-c)*v}0==s?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*i,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*i):(l.rotateMix+=(u-l.rotateMix)*i,l.translateMix+=(c-l.translateMix)*i)}},e}(vt);kt.ENTRIES=3,kt.PREV_TIME=-3,kt.PREV_ROTATE=-2,kt.PREV_TRANSLATE=-1,kt.ROTATE=1,kt.TRANSLATE=2;var Vt=function(){function t(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Ft(this),this.propertyIDs=new V,this.animationsChanged=!1,this.trackEntryPool=new O((function(){return new _t})),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,r=0,n=e.length;r<n;r++){var a=e[r];if(null!=a){a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;var i=t*a.timeScale;if(a.delay>0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(null!=s){var o=a.trackLast-s.delay;if(o>=0){for(s.delay=0,s.trackTime+=0==a.timeScale?0:(o/a.timeScale+t)*s.timeScale,a.trackTime+=i,this.setCurrent(r,s,!0);null!=s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[r]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var h=a.mixingFrom;for(a.mixingFrom=null,null!=h&&(h.mixingTo=null);null!=h;)this.queue.end(h),h=h.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.updateMixingFrom=function(t,e){var r=t.mixingFrom;if(null==r)return!0;var n=this.updateMixingFrom(r,e);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=r.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=r.mixingFrom,null!=r.mixingFrom&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),n):(r.trackTime+=e*r.timeScale,t.mixTime+=e,!1)},e.apply=function(e){if(null==e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var r=this.events,n=this.tracks,a=!1,i=0,s=n.length;i<s;i++){var o=n[i];if(!(null==o||o.delay>0)){a=!0;var h=0==i?rt.first:o.mixBlend,l=o.alpha;null!=o.mixingFrom?l*=this.applyMixingFrom(o,e,h):o.trackTime>=o.trackEnd&&null==o.next&&(l=0);var u=o.animationLast,c=o.getAnimationTime(),d=o.animation.timelines.length,f=o.animation.timelines;if(0==i&&1==l||h==rt.add)for(var v=0;v<d;v++){F.webkit602BugfixHelper(l,h);var p=f[v];k(p,yt)?this.applyAttachmentTimeline(p,e,c,h,!0):p.apply(e,u,c,r,l,h,nt.mixIn)}else{var g=o.timelineMode,m=0==o.timelinesRotation.length;m&&F.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,E=0;E<d;E++){var x=f[E],y=g[E]==t.SUBSEQUENT?h:rt.setup;k(x,pt)?this.applyRotateTimeline(x,e,c,l,y,w,E<<1,m):k(x,yt)?this.applyAttachmentTimeline(x,e,c,h,!0):(F.webkit602BugfixHelper(l,h),x.apply(e,u,c,r,l,y,nt.mixIn))}}this.queueEvents(o,c),r.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var b=this.unkeyedState+t.SETUP,S=e.slots,M=0,A=e.slots.length;M<A;M++){var T=S[M];if(T.attachmentState==b){var I=T.data.attachmentName;T.attachment=null==I?null:e.getAttachment(T.data.index,I)}}return this.unkeyedState+=2,this.queue.drain(),a},e.applyMixingFrom=function(e,r,n){var a=e.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,r,n);var i=0;0==e.mixDuration?(i=1,n==rt.first&&(n=rt.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),n!=rt.first&&(n=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,h=i<a.drawOrderThreshold,l=a.animationLast,u=a.getAnimationTime(),c=a.animation.timelines.length,d=a.animation.timelines,f=a.alpha*e.interruptAlpha,v=f*(1-i);if(n==rt.add)for(var p=0;p<c;p++)d[p].apply(r,l,u,s,v,n,nt.mixOut);else{var g=a.timelineMode,m=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&F.setArraySize(a.timelinesRotation,c<<1,null);var E=a.timelinesRotation;a.totalAlpha=0;for(var x=0;x<c;x++){var y=d[x],b=nt.mixOut,S=void 0,M=0;switch(g[x]){case t.SUBSEQUENT:if(!h&&k(y,At))continue;S=n,M=v;break;case t.FIRST:S=rt.setup,M=v;break;case t.HOLD_SUBSEQUENT:S=n,M=f;break;case t.HOLD_FIRST:S=rt.setup,M=f;break;default:S=rt.setup;var A=m[x];M=f*Math.max(0,1-A.mixTime/A.mixDuration)}a.totalAlpha+=M,k(y,pt)?this.applyRotateTimeline(y,r,u,M,S,E,x<<1,w):k(y,yt)?this.applyAttachmentTimeline(y,r,u,S,o):(F.webkit602BugfixHelper(M,n),h&&k(y,At)&&S==rt.setup&&(b=nt.mixIn),y.apply(r,l,u,s,M,S,b))}}return e.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,r,n,a,i){var s=r.slots[e.slotIndex];if(s.bone.active){var o,h=e.frames;if(n<h[0])a!=rt.setup&&a!=rt.first||this.setAttachment(r,s,s.data.attachmentName,i);else o=n>=h[h.length-1]?h.length-1:ft.binarySearch(h,n)-1,this.setAttachment(r,s,e.attachmentNames[o],i);s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+t.SETUP)}},e.setAttachment=function(e,r,n,a){r.attachment=null==n?null:e.getAttachment(r.data.index,n),a&&(r.attachmentState=this.unkeyedState+t.CURRENT)},e.applyRotateTimeline=function(t,e,r,n,a,i,s,o){if(o&&(i[s]=0),1!=n){var h=t,l=h.frames,u=e.bones[h.boneIndex];if(u.active){var c=0,d=0;if(r<l[0])switch(a){case rt.setup:u.rotation=u.data.rotation;default:return;case rt.first:c=u.rotation,d=u.data.rotation}else if(c=a==rt.setup?u.data.rotation:u.rotation,r>=l[l.length-pt.ENTRIES])d=u.data.rotation+l[l.length+pt.PREV_ROTATION];else{var f=ft.binarySearch(l,r,pt.ENTRIES),v=l[f+pt.PREV_ROTATION],p=l[f],g=h.getCurvePercent((f>>1)-1,1-(r-p)/(l[f+pt.PREV_TIME]-p));d=l[f+pt.ROTATION]-v,d=v+(d-=360*(16384-(16384.499999999996-d/360|0)))*g+u.data.rotation,d-=360*(16384-(16384.499999999996-d/360|0))}var m=0,w=d-c;if(0==(w-=360*(16384-(16384.499999999996-w/360|0))))m=i[s];else{var E=0,x=0;o?(E=0,x=w):(E=i[s],x=i[s+1]);var y=w>0,b=E>=0;_.signum(x)!=_.signum(w)&&Math.abs(x)<=90&&(Math.abs(E)>180&&(E+=360*_.signum(E)),b=y),m=w+E-E%360,b!=y&&(m+=360*_.signum(E)),i[s]=m}i[s+1]=w,c+=m*n,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,r,null,1,a,nt.mixIn)},e.queueEvents=function(t,e){for(var r=t.animationStart,n=t.animationEnd,a=n-r,i=t.trackLast%a,s=this.events,o=0,h=s.length;o<h;o++){var l=s[o];if(l.time<i)break;l.time>n||this.queue.event(t,l)}for((t.loop?0==a||i>t.trackTime%a:e>=n&&t.animationLast<n)&&this.queue.complete(t);o<h;o++){s[o].time<r||this.queue.event(t,s[o])}},e.clearTracks=function(){var t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var e=0,r=this.tracks.length;e<r;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()},e.clearTrack=function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var r=e;;){var n=r.mixingFrom;if(null==n)break;this.queue.end(n),r.mixingFrom=null,r.mixingTo=null,r=n}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.setCurrent=function(t,e,r){var n=this.expandToIndex(t);this.tracks[t]=e,null!=n&&(r&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,null!=n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)},e.setAnimation=function(t,e,r){var n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,r)},e.setAnimationWith=function(t,e,r){if(null==e)throw new Error("animation cannot be null.");var n=!0,a=this.expandToIndex(t);null!=a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.disposeNext(a),a=a.mixingFrom,n=!1):this.disposeNext(a));var i=this.trackEntry(t,e,r,a);return this.setCurrent(t,i,n),this.queue.drain(),i},e.addAnimation=function(t,e,r,n){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,r,n)},e.addAnimationWith=function(t,e,r,n){if(null==e)throw new Error("animation cannot be null.");var a=this.expandToIndex(t);if(null!=a)for(;null!=a.next;)a=a.next;var i=this.trackEntry(t,e,r,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,n<=0){var s=a.animationEnd-a.animationStart;0!=s?(a.loop?n+=s*(1+(a.trackTime/s|0)):n+=Math.max(s,a.trackTime),n-=this.data.getMix(a.animation,e)):n=a.trackTime}return i.delay=n,i},e.setEmptyAnimation=function(e,r){var n=this.setAnimationWith(e,t.emptyAnimation,!1);return n.mixDuration=r,n.trackEnd=r,n},e.addEmptyAnimation=function(e,r,n){n<=0&&(n-=r);var a=this.addAnimationWith(e,t.emptyAnimation,!1,n);return a.mixDuration=r,a.trackEnd=r,a},e.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var r=0,n=this.tracks.length;r<n;r++){var a=this.tracks[r];null!=a&&this.setEmptyAnimation(a.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()},e.expandToIndex=function(t){return t<this.tracks.length?this.tracks[t]:(F.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)},e.trackEntry=function(t,e,r,n){var a=this.trackEntryPool.obtain();return a.trackIndex=t,a.animation=e,a.loop=r,a.holdPrevious=!1,a.eventThreshold=0,a.attachmentThreshold=0,a.drawOrderThreshold=0,a.animationStart=0,a.animationEnd=e.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.interruptAlpha=1,a.mixTime=0,a.mixDuration=null==n?0:this.data.getMix(n.animation,e),a.mixBlend=rt.replace,a},e.disposeNext=function(t){for(var e=t.next;null!=e;)this.queue.dispose(e),e=e.next;t.next=null},e._animationsChanged=function(){this.animationsChanged=!1,this.propertyIDs.clear();for(var t=0,e=this.tracks.length;t<e;t++){var r=this.tracks[t];if(null!=r){for(;null!=r.mixingFrom;)r=r.mixingFrom;do{null!=r.mixingFrom&&r.mixBlend==rt.add||this.computeHold(r),r=r.mixingTo}while(null!=r)}}},e.computeHold=function(e){var r=e.mixingTo,n=e.animation.timelines,a=e.animation.timelines.length,i=F.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=F.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=r&&r.holdPrevious)for(var h=0;h<a;h++)i[h]=o.add(n[h].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var l=0;l<a;l++){var u=n[l],c=u.getPropertyId();if(o.add(c))if(null==r||k(u,yt)||k(u,At)||k(u,Mt)||!r.animation.hasTimeline(c))i[l]=t.FIRST;else{for(var d=r.mixingTo;null!=d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){i[l]=t.HOLD_MIX,s[l]=d;continue t}break}i[l]=t.HOLD_FIRST}else i[l]=t.SUBSEQUENT}},e.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.clearListeners=function(){this.listeners.length=0},e.clearListenerNotifications=function(){this.queue.clear()},t}();Vt.emptyAnimation=new ft("<empty>",[],0),Vt.SUBSEQUENT=0,Vt.FIRST=1,Vt.HOLD_SUBSEQUENT=2,Vt.HOLD_FIRST=3,Vt.HOLD_MIX=4,Vt.SETUP=1,Vt.CURRENT=2;var Pt,_t=function(){function t(){this.mixBlend=rt.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}var e=t.prototype;return e.reset=function(){this.next=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},e.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.resetRotationDirections=function(){this.timelinesRotation.length=0},t}(),Ft=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}var e=t.prototype;return e.start=function(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0},e.interrupt=function(t){this.objects.push(1),this.objects.push(t)},e.end=function(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0},e.dispose=function(t){this.objects.push(3),this.objects.push(t)},e.complete=function(t){this.objects.push(4),this.objects.push(t)},e.event=function(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)},e.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,r=0;r<t.length;r+=2){var n=t[r],a=t[r+1];switch(n){case 0:null!=a.listener&&a.listener.start&&a.listener.start(a);for(var i=0;i<e.length;i++)e[i].start&&e[i].start(a);break;case 1:null!=a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(var s=0;s<e.length;s++)e[s].interrupt&&e[s].interrupt(a);break;case 2:null!=a.listener&&a.listener.end&&a.listener.end(a);for(var o=0;o<e.length;o++)e[o].end&&e[o].end(a);case 3:null!=a.listener&&a.listener.dispose&&a.listener.dispose(a);for(var h=0;h<e.length;h++)e[h].dispose&&e[h].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var l=0;l<e.length;l++)e[l].complete&&e[l].complete(a);break;case 5:var u=t[2+r++];null!=a.listener&&a.listener.event&&a.listener.event(a,u);for(var c=0;c<e.length;c++)e[c].event&&e[c].event(a,u)}}this.clear(),this.drainDisabled=!1}},e.clear=function(){this.objects.length=0},t}();!function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(Pt||(Pt={}));var Nt=function(){function t(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}var e=t.prototype;return e.setMix=function(t,e,r){var n=this.skeletonData.findAnimation(t);if(null==n)throw new Error("Animation not found: "+t);var a=this.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);this.setMixWith(n,a,r)},e.setMixWith=function(t,e,r){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");var n=t.name+"."+e.name;this.animationToMixTime[n]=r},e.getMix=function(t,e){var r=t.name+"."+e.name,n=this.animationToMixTime[r];return void 0===n?this.defaultMix:n},t}(),Ot=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new P(.2275,.2275,.8078,1),r}return R(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t},e}(Z),Lt=function(){function t(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new O((function(){return new Array})),this.polygonIndicesPool=new O((function(){return new Array}))}var e=t.prototype;return e.triangulate=function(e){var r=e,n=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i<n;i++)a[i]=i;var s=this.isConcaveArray;s.length=0;for(var o=0,h=n;o<h;++o)s[o]=t.isConcave(o,n,r,a);var l=this.triangles;for(l.length=0;n>3;){for(var u=n-1,c=0,d=1;;){t:if(!s[c]){for(var f=a[u]<<1,v=a[c]<<1,p=a[d]<<1,g=r[f],m=r[f+1],w=r[v],E=r[v+1],x=r[p],y=r[p+1],b=(d+1)%n;b!=u;b=(b+1)%n)if(s[b]){var S=a[b]<<1,M=r[S],A=r[S+1];if(t.positiveArea(x,y,g,m,M,A)&&t.positiveArea(g,m,w,E,M,A)&&t.positiveArea(w,E,x,y,M,A))break t}break}if(0==d){do{if(!s[c])break;c--}while(c>0);break}u=c,c=d,d=(d+1)%n}l.push(a[(n+c-1)%n]),l.push(a[c]),l.push(a[(c+1)%n]),a.splice(c,1),s.splice(c,1);var T=(--n+c-1)%n,I=c==n?0:c;s[T]=t.isConcave(T,n,r,a),s[I]=t.isConcave(I,n,r,a)}return 3==n&&(l.push(a[2]),l.push(a[0]),l.push(a[1])),l},e.decompose=function(e,r){var n=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var s=this.polygonIndicesPool.obtain();s.length=0;var o=this.polygonPool.obtain();o.length=0;for(var h=-1,l=0,u=0,c=r.length;u<c;u+=3){var d=r[u]<<1,f=r[u+1]<<1,v=r[u+2]<<1,p=n[d],g=n[d+1],m=n[f],w=n[f+1],E=n[v],x=n[v+1],y=!1;if(h==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],E,x),M=t.winding(E,x,o[0],o[1],o[2],o[3]);S==l&&M==l&&(o.push(E),o.push(x),s.push(v),y=!0)}y||(o.length>0?(a.push(o),i.push(s)):(this.polygonPool.free(o),this.polygonIndicesPool.free(s)),(o=this.polygonPool.obtain()).length=0,o.push(p),o.push(g),o.push(m),o.push(w),o.push(E),o.push(x),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(v),l=t.winding(p,g,m,w,E,x),h=d)}o.length>0&&(a.push(o),i.push(s));for(var A=0,T=a.length;A<T;A++)if(0!=(s=i[A]).length)for(var I=s[0],R=s[s.length-1],C=(o=a[A]).length-4,k=o[C],V=o[C+1],P=o[C+2],_=o[C+3],F=o[0],N=o[1],O=o[2],L=o[3],X=t.winding(k,V,P,_,F,N),B=0;B<T;B++)if(B!=A){var D=i[B];if(3==D.length){var Y=D[0],U=D[1],W=D[2],q=a[B],H=q[q.length-2],j=q[q.length-1];if(Y==I&&U==R){var G=t.winding(k,V,P,_,H,j),z=t.winding(H,j,F,N,O,L);G==X&&z==X&&(q.length=0,D.length=0,o.push(H),o.push(j),s.push(W),k=P,V=_,P=H,_=j,B=0)}}}for(var Z=a.length-1;Z>=0;Z--)0==(o=a[Z]).length&&(a.splice(Z,1),this.polygonPool.free(o),s=i[Z],i.splice(Z,1),this.polygonIndicesPool.free(s));return a},t.isConcave=function(t,e,r,n){var a=n[(e+t-1)%e]<<1,i=n[t]<<1,s=n[(t+1)%e]<<1;return!this.positiveArea(r[a],r[a+1],r[i],r[i+1],r[s],r[s+1])},t.positiveArea=function(t,e,r,n,a,i){return t*(i-n)+r*(e-i)+a*(n-e)>=0},t.winding=function(t,e,r,n,a,i){var s=r-t,o=n-e;return a*o-i*s+s*e-t*o>=0?1:-1},t}(),Xt=function(){function t(){this.triangulator=new Lt,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}var e=t.prototype;return e.clipStart=function(e,r){if(null!=this.clipAttachment)return 0;this.clipAttachment=r;var n=r.worldVerticesLength,a=F.setArraySize(this.clippingPolygon,n);r.computeWorldVertices(e,0,n,a,0,2);var i=this.clippingPolygon;t.makeClockwise(i);for(var s=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i)),o=0,h=s.length;o<h;o++){var l=s[o];t.makeClockwise(l),l.push(l[0]),l.push(l[1])}return s.length},e.clipEndWithSlot=function(t){null!=this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()},e.clipEnd=function(){null!=this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)},e.isClipping=function(){return null!=this.clipAttachment},e.clipTriangles=function(t,e,r,n,a,i,s,o){var h=this.clipOutput,l=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,d=this.clippingPolygons.length,f=o?12:8,v=0;l.length=0,u.length=0;t:for(var p=0;p<n;p+=3)for(var g=r[p]<<1,m=t[g],w=t[g+1],E=a[g],x=a[g+1],y=t[g=r[p+1]<<1],b=t[g+1],S=a[g],M=a[g+1],A=t[g=r[p+2]<<1],T=t[g+1],I=a[g],R=a[g+1],C=0;C<d;C++){var k=l.length;if(!this.clip(m,w,y,b,A,T,c[C],h)){var V=F.setArraySize(l,k+3*f);V[k]=m,V[k+1]=w,V[k+2]=i.r,V[k+3]=i.g,V[k+4]=i.b,V[k+5]=i.a,o?(V[k+6]=E,V[k+7]=x,V[k+8]=s.r,V[k+9]=s.g,V[k+10]=s.b,V[k+11]=s.a,V[k+12]=y,V[k+13]=b,V[k+14]=i.r,V[k+15]=i.g,V[k+16]=i.b,V[k+17]=i.a,V[k+18]=S,V[k+19]=M,V[k+20]=s.r,V[k+21]=s.g,V[k+22]=s.b,V[k+23]=s.a,V[k+24]=A,V[k+25]=T,V[k+26]=i.r,V[k+27]=i.g,V[k+28]=i.b,V[k+29]=i.a,V[k+30]=I,V[k+31]=R,V[k+32]=s.r,V[k+33]=s.g,V[k+34]=s.b,V[k+35]=s.a):(V[k+6]=E,V[k+7]=x,V[k+8]=y,V[k+9]=b,V[k+10]=i.r,V[k+11]=i.g,V[k+12]=i.b,V[k+13]=i.a,V[k+14]=S,V[k+15]=M,V[k+16]=A,V[k+17]=T,V[k+18]=i.r,V[k+19]=i.g,V[k+20]=i.b,V[k+21]=i.a,V[k+22]=I,V[k+23]=R),k=u.length;var P=F.setArraySize(u,k+3);P[k]=v,P[k+1]=v+1,P[k+2]=v+2,v+=3;continue t}var _=h.length;if(0!=_){for(var N=b-T,O=A-y,L=m-A,X=T-w,B=1/(N*L+O*(w-T)),D=_>>1,Y=this.clipOutput,U=F.setArraySize(l,k+D*f),W=0;W<_;W+=2){var q=Y[W],H=Y[W+1];U[k]=q,U[k+1]=H,U[k+2]=i.r,U[k+3]=i.g,U[k+4]=i.b,U[k+5]=i.a;var j=q-A,G=H-T,z=(N*j+O*G)*B,Z=(X*j+L*G)*B,Q=1-z-Z;U[k+6]=E*z+S*Z+I*Q,U[k+7]=x*z+M*Z+R*Q,o&&(U[k+8]=s.r,U[k+9]=s.g,U[k+10]=s.b,U[k+11]=s.a),k+=f}k=u.length;var J=F.setArraySize(u,k+3*(D-2));D--;for(var K=1;K<D;K++)J[k]=v,J[k+1]=v+K,J[k+2]=v+K+1,k+=3;v+=D+1}}},e.clip=function(t,e,r,n,a,i,s,o){var h=o,l=!1,u=null;s.length%4>=2?(u=o,o=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(r),u.push(n),u.push(a),u.push(i),u.push(t),u.push(e),o.length=0;for(var c=s,d=s.length-4,f=0;;f+=2){for(var v=c[f],p=c[f+1],g=c[f+2],m=c[f+3],w=v-g,E=p-m,x=u,y=u.length-2,b=o.length,S=0;S<y;S+=2){var M=x[S],A=x[S+1],T=x[S+2],I=x[S+3],R=w*(I-m)-E*(T-g)>0;if(w*(A-m)-E*(M-g)>0){if(R){o.push(T),o.push(I);continue}var C=I-A,k=T-M,V=C*(g-v)-k*(m-p);if(Math.abs(V)>1e-6){var P=(k*(p-A)-C*(v-M))/V;o.push(v+(g-v)*P),o.push(p+(m-p)*P)}else o.push(v),o.push(p)}else if(R){var _=I-A,F=T-M,N=_*(g-v)-F*(m-p);if(Math.abs(N)>1e-6){var O=(F*(p-A)-_*(v-M))/N;o.push(v+(g-v)*O),o.push(p+(m-p)*O)}else o.push(v),o.push(p);o.push(T),o.push(I)}l=!0}if(b==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var L=o;(o=u).length=0,u=L}if(h!=o){h.length=0;for(var X=0,B=o.length-2;X<B;X++)h[X]=o[X]}else h.length=h.length-2;return l},t.makeClockwise=function(t){for(var e=t,r=t.length,n=e[r-2]*e[1]-e[0]*e[r-1],a=0,i=0,s=0,o=0,h=r-3;o<h;o+=2)a=e[o],i=e[o+1],s=e[o+2],n+=a*e[o+3]-s*i;if(!(n<0))for(var l=0,u=r-2,c=r>>1;l<c;l+=2){var d=e[l],f=e[l+1],v=u-l;e[l]=e[v],e[l+1]=e[v+1],e[v]=d,e[v+1]=f}},t}(),Bt=function(){function o(){}var h=o.prototype;return h.initialize=function(o,h){var l=this._mesh=new t(o),u=[new e("POSITION",0,r.Vector3,0),new e("COLOR_0",12,r.Vector4,0),new e("TEXCOORD_0",28,r.Vector2,0)],c=4*Dt.VERTEX_STRIDE,d=c*h,f=new n(o,a.VertexBuffer,d,i.Dynamic),v=new n(o,a.IndexBuffer,2*h,i.Dynamic);this._indexBuffer=v,this._vertexBuffer=f,l.setVertexBufferBinding(f,c),l.setIndexBufferBinding(v,s.UInt16),l.setVertexElements(u),l.addSubMesh(0,h)},h.changeBuffer=function(t,e){var r=4*Dt.VERTEX_STRIDE,o=r*e,h=new n(t,a.VertexBuffer,o,i.Dynamic),l=new n(t,a.IndexBuffer,2*e,i.Dynamic),u=this._mesh;this._indexBuffer=l,this._vertexBuffer=h,u.setVertexBufferBinding(h,r),u.setIndexBufferBinding(l,s.UInt16)},A(o,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),o}(),Dt=function(){function t(t,e){this._clipper=new Xt,this._spineMesh=new Bt,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this._engine=t,this._entity=e}var e=t.prototype;return e.initialize=function(e,r){if(e){var n=this._entity.getComponent(o);if(n){this._meshRenderer=n,r&&(this._setting=r);for(var a=e.defaultSkin.attachments,i=0,s=t.QUAD_TRIANGLES.length,h=0,l=a.length;h<l;h++){var u=a[h];for(var c in u){var d=u[c];if(d)if(k(d,K))i+=s;else{if(!k(d,ct))continue;i+=d.triangles.length}}}this._vertexCount=i,this._prepareBufferData(this._vertexCount);var f=this._spineMesh;f.initialize(this._engine,this._vertexCount),n.mesh=f.mesh}else console.warn("You need add MeshRenderer component to entity first")}},e.buildMesh=function(e){var r=this._setting||{},n=r.useClipping,a=void 0===n||n,i=r.zSpacing,s=void 0===i?.01:i,o=0,l=0;this._subMeshItems.length=0;for(var u,c,d=this._meshRenderer,f=e.drawOrder,v=f.length,p=this._clipper,g=this._spineMesh,m=g.mesh,w=this._subMeshItems,E=this._vertices,x=0,y=0,b=0;b<v;b+=1){var S=f[b];if(S.bone.active){var M=S.getAttachment(),A=null,T=null,I=s*b,R=0,C=p.isClipping()?2:t.VERTEX_SIZE;if(k(M,K)){var V=M;A=V.color,E=this._vertices,R=4*C,V.computeWorldVertices(S.bone,E,0,C),u=t.QUAD_TRIANGLES,c=V.uvs,T=V.region.renderObject.texture}else if(k(M,ct)){var P=M;A=P.color,E=this._vertices,(R=(P.worldVerticesLength>>1)*C)>E.length&&(E=this._vertices=new Float32Array(R)),P.computeWorldVertices(S,0,P.worldVerticesLength,E,0,C),u=P.triangles,c=P.uvs,T=P.region.renderObject.texture}else if(k(M,Ot)){if(a){var _=M;p.clipStart(S,_);continue}}else if(a){p.clipEndWithSlot(S);continue}if(null!=T){var F=void 0,N=void 0,O=void 0,L=void 0,X=S.bone.skeleton.color,B=S.color,D=X.a*B.a*A.a,Y=t.tempColor;if(Y.set(X.r*B.r*A.r,X.g*B.g*A.g,X.b*B.b*A.b,D),p.isClipping()){p.clipTriangles(E,R,u,u.length,c,Y,null,!1);var U=p.clippedVertices,W=p.clippedTriangles;F=U,N=U.length,O=W,L=W.length}else{for(var q=E,H=2,j=0,G=R;H<G;H+=C,j+=2)q[H]=Y.r,q[H+1]=Y.g,q[H+2]=Y.b,q[H+3]=Y.a,q[H+4]=c[j],q[H+5]=c[j+1];F=E,N=R,O=u,L=u.length}for(var z=o/t.VERTEX_STRIDE,Z=this._verticesWithZ,Q=o,J=0;J<N;)Z[Q++]=F[J++],Z[Q++]=F[J++],Z[Q++]=I,Z[Q++]=F[J++],Z[Q++]=F[J++],Z[Q++]=F[J++],Z[Q++]=F[J++],Z[Q++]=F[J++],Z[Q++]=F[J++];o=Q;var $=this._indices;for(Q=l,J=0;J<L;Q++,J++)$[Q]=O[J]+z;var tt=S.data.name;if(this.separateSlots.includes(tt)){var et=new h(l,L);if(w.push({name:tt,subMesh:et}),y>0){var rt=new h(x,y);w.push({name:"default",subMesh:rt}),y=0}x=l+L}else y+=L;l+=L;for(var nt=d.getMaterials(),at=nt.length,it=0;it<at;it+=1){var st=nt[it];st.shaderData.getTexture("material_SpineTexture")||st.shaderData.setTexture("material_SpineTexture",T.texture)}}p.clipEndWithSlot(S)}else p.clipEndWithSlot(S)}if(p.clipEnd(),y>0){var ot=new h(x,y);w.push({name:"default",subMesh:ot}),y=0}if(w.sort((function(t,e){return t.subMesh.start-e.subMesh.start})),l>0&&l!==this._vertexCount&&l>this._vertexCount)return this._vertexCount=l,this._prepareBufferData(this._vertexCount),void(this._needResize=!0);m.clearSubMesh();for(var ht=w.length,lt=0;lt<ht;lt+=1)m.addSubMesh(w[lt].subMesh);this._needResize&&(g.vertexBuffer.resize(this._verticesWithZ.byteLength),g.indexBuffer.resize(this._indices.byteLength),this._needResize=!1),g.vertexBuffer.setData(this._verticesWithZ),g.indexBuffer.setData(this._indices)},e.addSeparateSlot=function(t){this.separateSlots.push(t)},e._prepareBufferData=function(e){this._vertices=new Float32Array(e*t.VERTEX_SIZE),this._verticesWithZ=new Float32Array(e*t.VERTEX_STRIDE),this._indices=new Uint16Array(e)},A(t,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),t}();Dt.QUAD_TRIANGLES=[0,1,2,2,3,0],Dt.VERTEX_SIZE=8,Dt.VERTEX_STRIDE=9,Dt.tempColor=new P;var Yt=function(t){function e(r){var n,a=l.find("galacean-spine-shader")||l.create("galacean-spine-shader",e._spineVS,e._spineFS),i=(n=t.call(this,r,a)||this).renderState,s=i.blendState.targetBlendState;return s.enabled=!0,s.sourceColorBlendFactor=u.SourceAlpha,s.destinationColorBlendFactor=u.OneMinusSourceAlpha,s.sourceAlphaBlendFactor=u.One,s.destinationAlphaBlendFactor=u.OneMinusSourceAlpha,s.colorBlendOperation=s.alphaBlendOperation=c.Add,i.depthState.writeEnabled=!1,i.rasterState.cullMode=d.Off,i.renderQueueType=f.Transparent,n}return R(e,t),e}(v);Yt._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n ",Yt._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n ";var Ut=function(t){function e(e){var r;return(r=t.call(this,e)||this)._tempOffset=new L,r._tempSize=new L,r._tempArray=[0,0],r.autoUpdate=!0,r.autoUpdateBounds=!1,r._meshGenerator=new Dt(r.engine,e),r}R(e,t);var r=e.prototype;return r.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new dt(t);var r=new Nt(t);this._state=new Vt(r),this._meshGenerator.initialize(t,this.setting)},r.addSeparateSlot=function(t){this.skeleton||console.error("Skeleton not found!");var r=this.entity.getComponent(o);if(r||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(t)){this._meshGenerator.addSeparateSlot(t);var n=e._defaultMaterial.clone(),a=e._defaultMaterial.clone(),i=r.materialCount;r.setMaterial(i,n),r.setMaterial(i+1,a)}else console.warn("Slot: "+t+" not find.")},r.hackSeparateSlotTexture=function(t,e){this._meshGenerator.buildMesh(this._skeleton);var r=this._meshGenerator,n=r.separateSlots,a=r.subMeshItems;if(0!==n.length)if(n.includes(t)){var i=this.entity.getComponent(o),s=a.findIndex((function(e){return e.name===t}));i.getMaterial(s).shaderData.setTexture("material_SpineTexture",e)}else console.warn("Slot "+t+" is not separated. You should use addSeparateSlot to separate it");else console.warn("You need add separate slot")},r.onUpdate=function(t){this.autoUpdate&&this.updateState(t)},r.updateState=function(t){if(this._skeleton&&this.state){var e=this._state,r=this._skeleton;e.update(t),e.apply(r),r.updateWorldTransform(),this.updateGeometry()}},r.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},r.updateBounds=function(){var t,e=this.entity.getComponent(o).bounds,r=this._tempOffset,n=this._tempSize,a=this._tempArray,i=(null==(t=this.setting)?void 0:t.zSpacing)||.01,s=this._skeleton;s.getBounds(r,n,a);var h=s.drawOrder;e.min.set(r.x,r.y,0),e.max.set(r.x+n.x,r.y+n.y,h.length*i)},r._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=T({},this.setting);t.setting=e},r._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},r.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},e.getDefaultMaterial=function(t){return this._defaultMaterial||(this._defaultMaterial=new Yt(t),this._defaultMaterial.isGCIgnored=!0),this._defaultMaterial.clone()},A(e,[{key:"skeletonData",get:function(){return this._skeletonData}},{key:"skeleton",get:function(){return this._skeleton}},{key:"state",get:function(){return this._state}},{key:"mesh",get:function(){return this._meshGenerator.mesh}},{key:"scale",set:function(t){this._skeleton&&(this._skeleton.scaleX=t,this._skeleton.scaleY=t)}}]),e}(g);function Wt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function qt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Wt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Wt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}C([p],Ut.prototype,"_skeletonData",void 0),C([p],Ut.prototype,"_skeleton",void 0),C([p],Ut.prototype,"_state",void 0),C([p],Ut.prototype,"_tempOffset",void 0),C([p],Ut.prototype,"_tempSize",void 0),C([p],Ut.prototype,"_tempArray",void 0),C([p],Ut.prototype,"_meshGenerator",void 0),C([p],Ut.prototype,"setting",void 0);var Ht,jt=function(){function t(t,e){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this.pathPrefix=t||"",this.textureLoader=e}var e=t.prototype;return e.downloadText=function(t,e,r){m(t,{type:"text"}).then((function(t){e(t)})).catch((function(t){r(t)}))},e.downloadBinary=function(t,e,r){var n=new XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status?e(new Uint8Array(n.response)):r(n.status,n.responseText)},n.onerror=function(){r(n.status,n.responseText)},n.send()},e.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},e.loadBinary=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n=this;t=this.pathPrefix+t,this.toLoad++,this.downloadBinary(t,(function(r){n.assets[t]=r,e&&e(t,r),n.onLoad(),n.loaded++}),(function(e,a){n.errors[t]="Couldn't load binary "+t+": status "+status+", "+a,r&&r("Couldn't load binary "+t+": status "+status+", "+a),n.onLoad(),n.loaded++}))},e.loadText=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n=this;t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(r){n.assets[t]=r,e&&e(t,r),n.onLoad(),n.loaded++}),(function(e){n.errors[t]="Couldn't load text "+t+": "+JSON.stringify(e),r&&r("Couldn't load text "+t+": "+JSON.stringify(e)),n.onLoad(),n.loaded++}))},e.loadImage=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n=this,a=t=this.pathPrefix+t;this.toLoad++;var i=new Image;i.crossOrigin="anonymous",i.onload=function(r){n.assets[a]=i,n.onLoad(),n.loaded++,e&&e(t,i)},i.onerror=function(e){n.errors[t]="Couldn't load image "+t,n.onLoad(),n.loaded++,r&&r("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),i.src=t},e.loadTexture=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n=this,a=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),m(t,{type:"image"}).then((function(r){var i=n.textureLoader(r);n.assets[a]=i,n.onLoad(),n.loaded++,e&&e(t,i)})).catch((function(t){r(t)}))},e.loadTextureAtlas=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n=this,a=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(i){var s=function(){var s=u.value,l=!1;n.loadTexture(s,(function(s,u){if(o.count++,o.count==h.length)if(l)n.errors[t]="Couldn't load texture atlas page "+s+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+s+" of atlas "+t),n.onLoad(),n.loaded++;else try{var c=new ot(i,(function(t){return n.get(""==a?t:a+"/"+t)}));n.assets[t]=c,e&&e(t,c),n.onLoad(),n.loaded++}catch(e){var d=e;n.errors[t]="Couldn't load texture atlas "+t+": "+d.message,r&&r("Couldn't load texture atlas "+t+": "+d.message),n.onLoad(),n.loaded++}}),(function(e){l=!0,o.count++,o.count==h.length&&(n.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+e+" of atlas "+t),n.onLoad(),n.loaded++)}))},o={count:0},h=new Array;try{new ot(i,(function(t){h.push(""==a?t:a+"/"+t);var e=document.createElement("img");return e.width=16,e.height=16,new st(e)}))}catch(e){var l=e;return n.errors[t]="Couldn't load texture atlas "+t+": "+l.message,r&&r("Couldn't load texture atlas "+t+": "+l.message),n.onLoad(),void n.loaded++}for(var u,c=qt(h);!(u=c()).done;)s()}),(function(e){n.errors[t]="Couldn't load texture atlas "+t+": "+JSON.stringify(e),r&&r("Couldn't load texture atlas "+t+": "+JSON.stringify(e)),n.onLoad(),n.loaded++}))},e.get=function(t){return t=this.pathPrefix+t,this.assets[t]},e.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},e.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},e.isLoadingComplete=function(){return 0==this.toLoad},e.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},e.getToLoad=function(){return this.toLoad},e.getLoaded=function(){return this.loaded},e.dispose=function(){this.removeAll()},e.hasErrors=function(){return Object.keys(this.errors).length>0},e.getErrors=function(){return this.errors},t}(),Gt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new P(1,1,1,1),r}return R(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(Z),zt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new P(.38,.94,0,1),r.name=e,r}R(e,t);var r=e.prototype;return r.computeWorldPosition=function(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},r.computeWorldRotation=function(t){var e=_.cosDeg(this.rotation),r=_.sinDeg(this.rotation),n=e*t.a+r*t.b,a=e*t.c+r*t.d;return Math.atan2(a,n)*_.radDeg},r.copy=function(){var t=new e(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t},e}(Z),Zt=function(){function t(t){this.atlas=t}var e=t.prototype;return e.newRegionAttachment=function(t,e,r){var n=this.atlas.findRegion(r);if(null==n)throw new Error("Region not found in atlas: "+r+" (region attachment: "+e+")");n.renderObject=n;var a=new K(e);return a.setRegion(n),a},e.newMeshAttachment=function(t,e,r){var n=this.atlas.findRegion(r);if(null==n)throw new Error("Region not found in atlas: "+r+" (mesh attachment: "+e+")");n.renderObject=n;var a=new ct(e);return a.region=n,a},e.newBoundingBoxAttachment=function(t,e){return new Gt(e)},e.newPathAttachment=function(t,e){return new Q(e)},e.newPointAttachment=function(t,e){return new zt(e)},e.newClippingAttachment=function(t,e){return new Ot(e)},t}(),Qt=function(){function t(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}var e=t.prototype;return e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},e.findSkin=function(t){if(null==t)throw new Error("skinName cannot be null.");for(var e=this.skins,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findEvent=function(t){if(null==t)throw new Error("eventDataName cannot be null.");for(var e=this.events,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findAnimation=function(t){if(null==t)throw new Error("animationName cannot be null.");for(var e=this.animations,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findPathConstraintIndex=function(t){if(null==t)throw new Error("pathConstraintName cannot be null.");for(var e=this.pathConstraints,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},t}(),Jt=function(t,e,r){if(this.color=new P(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");if(null==r)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=r},Kt=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r.bendDirection=1,r.compress=!1,r.stretch=!1,r.uniform=!1,r.mix=1,r.softness=0,r}return R(e,t),e}(j),$t=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r.rotateMix=0,r.translateMix=0,r.scaleMix=0,r.shearMix=0,r.offsetRotation=0,r.offsetX=0,r.offsetY=0,r.offsetScaleX=0,r.offsetScaleY=0,r.offsetShearY=0,r.relative=!1,r.local=!1,r}return R(e,t),e}(j),te=function(t,e,r){this.slotIndex=t,this.name=e,this.attachment=r},ee=function(){function t(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,null==t)throw new Error("name cannot be null.");this.name=t}var e=t.prototype;return e.setAttachment=function(t,e,r){if(null==r)throw new Error("attachment cannot be null.");var n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=r},e.addSkin=function(t){for(var e=0;e<t.bones.length;e++){for(var r=t.bones[e],n=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,h=0;h<this.constraints.length;h++)if(this.constraints[h]==s){o=!0;break}o||this.constraints.push(s)}for(var l=t.getAttachments(),u=0;u<l.length;u++){var c=l[u];this.setAttachment(c.slotIndex,c.name,c.attachment)}},e.copySkin=function(t){for(var e=0;e<t.bones.length;e++){for(var r=t.bones[e],n=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,h=0;h<this.constraints.length;h++)if(this.constraints[h]==s){o=!0;break}o||this.constraints.push(s)}for(var l=t.getAttachments(),u=0;u<l.length;u++){var c=l[u];null!=c.attachment&&(k(c.attachment,ct)?(c.attachment=c.attachment.newLinkedMesh(),this.setAttachment(c.slotIndex,c.name,c.attachment)):(c.attachment=c.attachment.copy(),this.setAttachment(c.slotIndex,c.name,c.attachment)))}},e.getAttachment=function(t,e){var r=this.attachments[t];return r?r[e]:null},e.removeAttachment=function(t,e){var r=this.attachments[t];r&&(r[e]=null)},e.getAttachments=function(){for(var t=new Array,e=0;e<this.attachments.length;e++){var r=this.attachments[e];if(r)for(var n in r){var a=r[n];a&&t.push(new te(e,n,a))}}return t},e.getAttachmentsForSlot=function(t,e){var r=this.attachments[t];if(r)for(var n in r){var a=r[n];a&&e.push(new te(t,n,a))}},e.clear=function(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0},e.attachAll=function(t,e){for(var r=0,n=0;n<t.slots.length;n++){var a=t.slots[n],i=a.getAttachment();if(i&&r<e.attachments.length){var s=e.attachments[r];for(var o in s){if(i==s[o]){var h=this.getAttachment(r,o);null!=h&&a.setAttachment(h);break}}}r++}},t}(),re=function(t){this.name=t};!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(Ht||(Ht={}));var ne,ae=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},ie=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var r=this.scale,n=new Qt,a="string"==typeof e?JSON.parse(e):e,i=a.skeleton;if(null!=i){if(n.hash=i.hash,n.version=i.spine,"3.8.75"==n.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");n.x=i.x,n.y=i.y,n.width=i.width,n.height=i.height,n.fps=i.fps,n.imagesPath=i.images}if(a.bones)for(var s=0;s<a.bones.length;s++){var o=a.bones[s],h=null,l=this.getValue(o,"parent",null);if(null!=l&&null==(h=n.findBone(l)))throw new Error("Parent bone not found: "+l);var u=new X(n.bones.length,o.name,h);u.length=this.getValue(o,"length",0)*r,u.x=this.getValue(o,"x",0)*r,u.y=this.getValue(o,"y",0)*r,u.rotation=this.getValue(o,"rotation",0),u.scaleX=this.getValue(o,"scaleX",1),u.scaleY=this.getValue(o,"scaleY",1),u.shearX=this.getValue(o,"shearX",0),u.shearY=this.getValue(o,"shearY",0),u.transformMode=t.transformModeFromString(this.getValue(o,"transform","normal")),u.skinRequired=this.getValue(o,"skin",!1),n.bones.push(u)}if(a.slots)for(var c=0;c<a.slots.length;c++){var d=a.slots[c],f=d.name,v=d.bone,p=n.findBone(v);if(null==p)throw new Error("Slot bone not found: "+v);var g=new Jt(n.slots.length,f,p),m=this.getValue(d,"color",null);null!=m&&g.color.setFromString(m);var w=this.getValue(d,"dark",null);null!=w&&(g.darkColor=new P(1,1,1,1),g.darkColor.setFromString(w)),g.attachmentName=this.getValue(d,"attachment",null),g.blendMode=t.blendModeFromString(this.getValue(d,"blend","normal")),n.slots.push(g)}if(a.ik)for(var E=0;E<a.ik.length;E++){var x=a.ik[E],y=new Kt(x.name);y.order=this.getValue(x,"order",0),y.skinRequired=this.getValue(x,"skin",!1);for(var b=0;b<x.bones.length;b++){var S=x.bones[b],M=n.findBone(S);if(null==M)throw new Error("IK bone not found: "+S);y.bones.push(M)}var A=x.target;if(y.target=n.findBone(A),null==y.target)throw new Error("IK target bone not found: "+A);y.mix=this.getValue(x,"mix",1),y.softness=this.getValue(x,"softness",0)*r,y.bendDirection=this.getValue(x,"bendPositive",!0)?1:-1,y.compress=this.getValue(x,"compress",!1),y.stretch=this.getValue(x,"stretch",!1),y.uniform=this.getValue(x,"uniform",!1),n.ikConstraints.push(y)}if(a.transform)for(var T=0;T<a.transform.length;T++){var I=a.transform[T],R=new $t(I.name);R.order=this.getValue(I,"order",0),R.skinRequired=this.getValue(I,"skin",!1);for(var C=0;C<I.bones.length;C++){var k=I.bones[C],V=n.findBone(k);if(null==V)throw new Error("Transform constraint bone not found: "+k);R.bones.push(V)}var _=I.target;if(R.target=n.findBone(_),null==R.target)throw new Error("Transform constraint target bone not found: "+_);R.local=this.getValue(I,"local",!1),R.relative=this.getValue(I,"relative",!1),R.offsetRotation=this.getValue(I,"rotation",0),R.offsetX=this.getValue(I,"x",0)*r,R.offsetY=this.getValue(I,"y",0)*r,R.offsetScaleX=this.getValue(I,"scaleX",0),R.offsetScaleY=this.getValue(I,"scaleY",0),R.offsetShearY=this.getValue(I,"shearY",0),R.rotateMix=this.getValue(I,"rotateMix",1),R.translateMix=this.getValue(I,"translateMix",1),R.scaleMix=this.getValue(I,"scaleMix",1),R.shearMix=this.getValue(I,"shearMix",1),n.transformConstraints.push(R)}if(a.path)for(var F=0;F<a.path.length;F++){var N=a.path[F],O=new G(N.name);O.order=this.getValue(N,"order",0),O.skinRequired=this.getValue(N,"skin",!1);for(var L=0;L<N.bones.length;L++){var Y=N.bones[L],U=n.findBone(Y);if(null==U)throw new Error("Transform constraint bone not found: "+Y);O.bones.push(U)}var W=N.target;if(O.target=n.findSlot(W),null==O.target)throw new Error("Path target slot not found: "+W);O.positionMode=t.positionModeFromString(this.getValue(N,"positionMode","percent")),O.spacingMode=t.spacingModeFromString(this.getValue(N,"spacingMode","length")),O.rotateMode=t.rotateModeFromString(this.getValue(N,"rotateMode","tangent")),O.offsetRotation=this.getValue(N,"rotation",0),O.position=this.getValue(N,"position",0),O.positionMode==B.Fixed&&(O.position*=r),O.spacing=this.getValue(N,"spacing",0),O.spacingMode!=D.Length&&O.spacingMode!=D.Fixed||(O.spacing*=r),O.rotateMix=this.getValue(N,"rotateMix",1),O.translateMix=this.getValue(N,"translateMix",1),n.pathConstraints.push(O)}if(a.skins)for(var q=0;q<a.skins.length;q++){var H=a.skins[q],j=new ee(H.name);if(H.bones)for(var z=0;z<H.bones.length;z++){var Z=n.findBone(H.bones[z]);if(null==Z)throw new Error("Skin bone not found: "+H.bones[q]);j.bones.push(Z)}if(H.ik)for(var Q=0;Q<H.ik.length;Q++){var J=n.findIkConstraint(H.ik[Q]);if(null==J)throw new Error("Skin IK constraint not found: "+H.ik[q]);j.constraints.push(J)}if(H.transform)for(var K=0;K<H.transform.length;K++){var $=n.findTransformConstraint(H.transform[K]);if(null==$)throw new Error("Skin transform constraint not found: "+H.transform[q]);j.constraints.push($)}if(H.path)for(var tt=0;tt<H.path.length;tt++){var et=n.findPathConstraint(H.path[tt]);if(null==et)throw new Error("Skin path constraint not found: "+H.path[q]);j.constraints.push(et)}for(var rt in H.attachments){var nt=n.findSlot(rt);if(null==nt)throw new Error("Slot not found: "+rt);var at=H.attachments[rt];for(var it in at){var st=this.readAttachment(at[it],j,nt.index,it,n);null!=st&&j.setAttachment(nt.index,it,st)}}n.skins.push(j),"default"==j.name&&(n.defaultSkin=j)}for(var ot=0,ht=this.linkedMeshes.length;ot<ht;ot++){var lt=this.linkedMeshes[ot],ut=null==lt.skin?n.defaultSkin:n.findSkin(lt.skin);if(null==ut)throw new Error("Skin not found: "+lt.skin);var ct=ut.getAttachment(lt.slotIndex,lt.parent);if(null==ct)throw new Error("Parent mesh not found: "+lt.parent);lt.mesh.deformAttachment=lt.inheritDeform?ct:lt.mesh,lt.mesh.setParentMesh(ct),lt.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var dt in a.events){var ft=a.events[dt],vt=new re(dt);vt.intValue=this.getValue(ft,"int",0),vt.floatValue=this.getValue(ft,"float",0),vt.stringValue=this.getValue(ft,"string",""),vt.audioPath=this.getValue(ft,"audio",null),null!=vt.audioPath&&(vt.volume=this.getValue(ft,"volume",1),vt.balance=this.getValue(ft,"balance",0)),n.events.push(vt)}if(a.animations)for(var pt in a.animations){var gt=a.animations[pt];this.readAnimation(gt,pt,n)}return n},e.readAttachment=function(t,e,r,n,a){var i=this.scale;switch(n=this.getValue(t,"name",n),this.getValue(t,"type","region")){case"region":var s=this.getValue(t,"path",n),o=this.attachmentLoader.newRegionAttachment(e,n,s);if(null==o)return null;o.path=s,o.x=this.getValue(t,"x",0)*i,o.y=this.getValue(t,"y",0)*i,o.scaleX=this.getValue(t,"scaleX",1),o.scaleY=this.getValue(t,"scaleY",1),o.rotation=this.getValue(t,"rotation",0),o.width=t.width*i,o.height=t.height*i;var h=this.getValue(t,"color",null);return null!=h&&o.color.setFromString(h),o.updateOffset(),o;case"boundingbox":var l=this.attachmentLoader.newBoundingBoxAttachment(e,n);if(null==l)return null;this.readVertices(t,l,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&l.color.setFromString(u),l;case"mesh":case"linkedmesh":var c=this.getValue(t,"path",n),d=this.attachmentLoader.newMeshAttachment(e,n,c);if(null==d)return null;d.path=c;var f=this.getValue(t,"color",null);null!=f&&d.color.setFromString(f),d.width=this.getValue(t,"width",0)*i,d.height=this.getValue(t,"height",0)*i;var v=this.getValue(t,"parent",null);if(null!=v)return this.linkedMeshes.push(new se(d,this.getValue(t,"skin",null),r,v,this.getValue(t,"deform",!0))),d;var p=t.uvs;return this.readVertices(t,d,p.length),d.triangles=t.triangles,d.regionUVs=p,d.updateUVs(),d.edges=this.getValue(t,"edges",null),d.hullLength=2*this.getValue(t,"hull",0),d;case"path":var g=this.attachmentLoader.newPathAttachment(e,n);if(null==g)return null;g.closed=this.getValue(t,"closed",!1),g.constantSpeed=this.getValue(t,"constantSpeed",!0);var m=t.vertexCount;this.readVertices(t,g,m<<1);for(var w=F.newArray(m/3,0),E=0;E<t.lengths.length;E++)w[E]=t.lengths[E]*i;g.lengths=w;var x=this.getValue(t,"color",null);return null!=x&&g.color.setFromString(x),g;case"point":var y=this.attachmentLoader.newPointAttachment(e,n);if(null==y)return null;y.x=this.getValue(t,"x",0)*i,y.y=this.getValue(t,"y",0)*i,y.rotation=this.getValue(t,"rotation",0);var b=this.getValue(t,"color",null);return null!=b&&y.color.setFromString(b),y;case"clipping":var S=this.attachmentLoader.newClippingAttachment(e,n);if(null==S)return null;var M=this.getValue(t,"end",null);if(null!=M){var A=a.findSlot(M);if(null==A)throw new Error("Clipping end slot not found: "+M);S.endSlot=A}var T=t.vertexCount;this.readVertices(t,S,T<<1);var I=this.getValue(t,"color",null);return null!=I&&S.color.setFromString(I),S}return null},e.readVertices=function(t,e,r){var n=this.scale;e.worldVerticesLength=r;var a=t.vertices;if(r!=a.length){for(var i=new Array,s=new Array,o=0,h=a.length;o<h;){var l=a[o++];s.push(l);for(var u=o+4*l;o<u;o+=4)s.push(a[o]),i.push(a[o+1]*n),i.push(a[o+2]*n),i.push(a[o+3])}e.bones=s,e.vertices=F.toFloatArray(i)}else{var c=F.toFloatArray(a);if(1!=n)for(var d=0,f=a.length;d<f;d++)c[d]*=n;e.vertices=c}},e.readAnimation=function(t,e,r){var n=this.scale,a=new Array,i=0;if(t.slots)for(var s in t.slots){var o=t.slots[s],h=r.findSlotIndex(s);if(-1==h)throw new Error("Slot not found: "+s);for(var l in o){var u=o[l];if("attachment"==l){var c=new yt(u.length);c.slotIndex=h;for(var d=0,f=0;f<u.length;f++){var v=u[f];c.setFrame(d++,this.getValue(v,"time",0),v.name)}a.push(c),i=Math.max(i,c.frames[c.getFrameCount()-1])}else if("color"==l){var p=new Et(u.length);p.slotIndex=h;for(var g=0,m=0;m<u.length;m++){var w=u[m],E=new P;E.setFromString(w.color),p.setFrame(g,this.getValue(w,"time",0),E.r,E.g,E.b,E.a),this.readCurve(w,p,g),g++}a.push(p),i=Math.max(i,p.frames[(p.getFrameCount()-1)*Et.ENTRIES])}else{if("twoColor"!=l)throw new Error("Invalid timeline type for a slot: "+l+" ("+s+")");var x=new xt(u.length);x.slotIndex=h;for(var y=0,b=0;b<u.length;b++){var S=u[b],M=new P,A=new P;M.setFromString(S.light),A.setFromString(S.dark),x.setFrame(y,this.getValue(S,"time",0),M.r,M.g,M.b,M.a,A.r,A.g,A.b),this.readCurve(S,x,y),y++}a.push(x),i=Math.max(i,x.frames[(x.getFrameCount()-1)*xt.ENTRIES])}}}if(t.bones)for(var T in t.bones){var I=t.bones[T],R=r.findBoneIndex(T);if(-1==R)throw new Error("Bone not found: "+T);for(var C in I){var k=I[C];if("rotate"===C){var V=new pt(k.length);V.boneIndex=R;for(var _=0,N=0;N<k.length;N++){var O=k[N];V.setFrame(_,this.getValue(O,"time",0),this.getValue(O,"angle",0)),this.readCurve(O,V,_),_++}a.push(V),i=Math.max(i,V.frames[(V.getFrameCount()-1)*pt.ENTRIES])}else{if("translate"!==C&&"scale"!==C&&"shear"!==C)throw new Error("Invalid timeline type for a bone: "+C+" ("+T+")");var L=null,X=1,Y=0;"scale"===C?(L=new mt(k.length),Y=1):"shear"===C?L=new wt(k.length):(L=new gt(k.length),X=n),L.boneIndex=R;for(var U=0,W=0;W<k.length;W++){var q=k[W],H=this.getValue(q,"x",Y),j=this.getValue(q,"y",Y);L.setFrame(U,this.getValue(q,"time",0),H*X,j*X),this.readCurve(q,L,U),U++}a.push(L),i=Math.max(i,L.frames[(L.getFrameCount()-1)*gt.ENTRIES])}}}if(t.ik)for(var G in t.ik){var z=t.ik[G],Z=r.findIkConstraint(G),Q=new Tt(z.length);Q.ikConstraintIndex=r.ikConstraints.indexOf(Z);for(var J=0,K=0;K<z.length;K++){var $=z[K];Q.setFrame(J,this.getValue($,"time",0),this.getValue($,"mix",1),this.getValue($,"softness",0)*n,this.getValue($,"bendPositive",!0)?1:-1,this.getValue($,"compress",!1),this.getValue($,"stretch",!1)),this.readCurve($,Q,J),J++}a.push(Q),i=Math.max(i,Q.frames[(Q.getFrameCount()-1)*Tt.ENTRIES])}if(t.transform)for(var tt in t.transform){var et=t.transform[tt],rt=r.findTransformConstraint(tt),nt=new It(et.length);nt.transformConstraintIndex=r.transformConstraints.indexOf(rt);for(var at=0,it=0;it<et.length;it++){var st=et[it];nt.setFrame(at,this.getValue(st,"time",0),this.getValue(st,"rotateMix",1),this.getValue(st,"translateMix",1),this.getValue(st,"scaleMix",1),this.getValue(st,"shearMix",1)),this.readCurve(st,nt,at),at++}a.push(nt),i=Math.max(i,nt.frames[(nt.getFrameCount()-1)*It.ENTRIES])}if(t.path)for(var ot in t.path){var ht=t.path[ot],lt=r.findPathConstraintIndex(ot);if(-1==lt)throw new Error("Path constraint not found: "+ot);var ut=r.pathConstraints[lt];for(var ct in ht){var dt=ht[ct];if("position"===ct||"spacing"===ct){var vt=null,bt=1;"spacing"===ct?(vt=new Ct(dt.length),ut.spacingMode!=D.Length&&ut.spacingMode!=D.Fixed||(bt=n)):(vt=new Rt(dt.length),ut.positionMode==B.Fixed&&(bt=n)),vt.pathConstraintIndex=lt;for(var Vt=0,Pt=0;Pt<dt.length;Pt++){var _t=dt[Pt];vt.setFrame(Vt,this.getValue(_t,"time",0),this.getValue(_t,ct,0)*bt),this.readCurve(_t,vt,Vt),Vt++}a.push(vt),i=Math.max(i,vt.frames[(vt.getFrameCount()-1)*Rt.ENTRIES])}else if("mix"===ct){var Ft=new kt(dt.length);Ft.pathConstraintIndex=lt;for(var Nt=0,Ot=0;Ot<dt.length;Ot++){var Lt=dt[Ot];Ft.setFrame(Nt,this.getValue(Lt,"time",0),this.getValue(Lt,"rotateMix",1),this.getValue(Lt,"translateMix",1)),this.readCurve(Lt,Ft,Nt),Nt++}a.push(Ft),i=Math.max(i,Ft.frames[(Ft.getFrameCount()-1)*kt.ENTRIES])}}}if(t.deform)for(var Xt in t.deform){var Bt=t.deform[Xt],Dt=r.findSkin(Xt);if(null==Dt)throw new Error("Skin not found: "+Xt);for(var Yt in Bt){var Ut=Bt[Yt],Wt=r.findSlotIndex(Yt);if(-1==Wt)throw new Error("Slot not found: "+Ut.name);for(var qt in Ut){var Ht=Ut[qt],jt=Dt.getAttachment(Wt,qt);if(null==jt)throw new Error("Deform attachment not found: "+Ht.name);var Gt=null!=jt.bones,zt=jt.vertices,Zt=Gt?zt.length/3*2:zt.length,Qt=new St(Ht.length);Qt.slotIndex=Wt,Qt.attachment=jt;for(var Jt=0,Kt=0;Kt<Ht.length;Kt++){var $t=Ht[Kt],te=void 0,ee=this.getValue($t,"vertices",null);if(null==ee)te=Gt?F.newFloatArray(Zt):zt;else{te=F.newFloatArray(Zt);var re=this.getValue($t,"offset",0);if(F.arrayCopy(ee,0,te,re,ee.length),1!=n)for(var ne=re,ie=ne+ee.length;ne<ie;ne++)te[ne]*=n;if(!Gt)for(var se=0;se<Zt;se++)te[se]+=zt[se]}Qt.setFrame(Jt,this.getValue($t,"time",0),te),this.readCurve($t,Qt,Jt),Jt++}a.push(Qt),i=Math.max(i,Qt.frames[Qt.getFrameCount()-1])}}}var oe=t.drawOrder;if(null==oe&&(oe=t.draworder),null!=oe){for(var he=new At(oe.length),le=r.slots.length,ue=0,ce=0;ce<oe.length;ce++){var de=oe[ce],fe=null,ve=this.getValue(de,"offsets",null);if(null!=ve){fe=F.newArray(le,-1);for(var pe=F.newArray(le-ve.length,0),ge=0,me=0,we=0;we<ve.length;we++){var Ee=ve[we],xe=r.findSlotIndex(Ee.slot);if(-1==xe)throw new Error("Slot not found: "+Ee.slot);for(;ge!=xe;)pe[me++]=ge++;fe[ge+Ee.offset]=ge++}for(;ge<le;)pe[me++]=ge++;for(var ye=le-1;ye>=0;ye--)-1==fe[ye]&&(fe[ye]=pe[--me])}he.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(he),i=Math.max(i,he.frames[he.getFrameCount()-1])}if(t.events){for(var be=new Mt(t.events.length),Se=0,Me=0;Me<t.events.length;Me++){var Ae=t.events[Me],Te=r.findEvent(Ae.name);if(null==Te)throw new Error("Event not found: "+Ae.name);var Ie=new ae(F.toSinglePrecision(this.getValue(Ae,"time",0)),Te);Ie.intValue=this.getValue(Ae,"int",Te.intValue),Ie.floatValue=this.getValue(Ae,"float",Te.floatValue),Ie.stringValue=this.getValue(Ae,"string",Te.stringValue),null!=Ie.data.audioPath&&(Ie.volume=this.getValue(Ae,"volume",1),Ie.balance=this.getValue(Ae,"balance",0)),be.setFrame(Se++,Ie)}a.push(be),i=Math.max(i,be.frames[be.getFrameCount()-1])}if(isNaN(i))throw new Error("Error while parsing animation, duration is NaN");r.animations.push(new ft(e,a,i))},e.readCurve=function(t,e,r){if(t.hasOwnProperty("curve"))if("stepped"==t.curve)e.setStepped(r);else{var n=t.curve;e.setCurve(r,n,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}},e.getValue=function(t,e,r){return void 0!==t[e]?t[e]:r},t.blendModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return Ht.Normal;if("additive"==t)return Ht.Additive;if("multiply"==t)return Ht.Multiply;if("screen"==t)return Ht.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return B.Fixed;if("percent"==t)return B.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return D.Length;if("fixed"==t)return D.Fixed;if("percent"==t)return D.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return Y.Tangent;if("chain"==t)return Y.Chain;if("chainscale"==t)return Y.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return N.Normal;if("onlytranslation"==t)return N.OnlyTranslation;if("norotationorreflection"==t)return N.NoRotationOrReflection;if("noscale"==t)return N.NoScale;if("noscaleorreflection"==t)return N.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),se=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,this.inheritDeform=a};!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(ne||(ne={}));var oe=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var r=this.scale,n=new Qt;n.name="";var a=new he(e);if(n.hash=a.readString(),n.version=a.readString(),"3.8.75"==n.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");n.x=a.readFloat(),n.y=a.readFloat(),n.width=a.readFloat(),n.height=a.readFloat();var i=a.readBoolean();i&&(n.fps=a.readFloat(),n.imagesPath=a.readString(),n.audioPath=a.readString());var s=0;s=a.readInt(!0);for(var o=0;o<s;o++)a.strings.push(a.readString());s=a.readInt(!0);for(var h=0;h<s;h++){var l=a.readString(),u=0==h?null:n.bones[a.readInt(!0)],c=new X(h,l,u);c.rotation=a.readFloat(),c.x=a.readFloat()*r,c.y=a.readFloat()*r,c.scaleX=a.readFloat(),c.scaleY=a.readFloat(),c.shearX=a.readFloat(),c.shearY=a.readFloat(),c.length=a.readFloat()*r,c.transformMode=t.TransformModeValues[a.readInt(!0)],c.skinRequired=a.readBoolean(),i&&P.rgba8888ToColor(c.color,a.readInt32()),n.bones.push(c)}s=a.readInt(!0);for(var d=0;d<s;d++){var f=a.readString(),v=n.bones[a.readInt(!0)],p=new Jt(d,f,v);P.rgba8888ToColor(p.color,a.readInt32());var g=a.readInt32();-1!=g&&P.rgb888ToColor(p.darkColor=new P,g),p.attachmentName=a.readStringRef(),p.blendMode=t.BlendModeValues[a.readInt(!0)],n.slots.push(p)}s=a.readInt(!0);for(var m,w=0;w<s;w++){var E=new Kt(a.readString());E.order=a.readInt(!0),E.skinRequired=a.readBoolean(),m=a.readInt(!0);for(var x=0;x<m;x++)E.bones.push(n.bones[a.readInt(!0)]);E.target=n.bones[a.readInt(!0)],E.mix=a.readFloat(),E.softness=a.readFloat()*r,E.bendDirection=a.readByte(),E.compress=a.readBoolean(),E.stretch=a.readBoolean(),E.uniform=a.readBoolean(),n.ikConstraints.push(E)}s=a.readInt(!0);for(var y,b=0;b<s;b++){var S=new $t(a.readString());S.order=a.readInt(!0),S.skinRequired=a.readBoolean(),y=a.readInt(!0);for(var M=0;M<y;M++)S.bones.push(n.bones[a.readInt(!0)]);S.target=n.bones[a.readInt(!0)],S.local=a.readBoolean(),S.relative=a.readBoolean(),S.offsetRotation=a.readFloat(),S.offsetX=a.readFloat()*r,S.offsetY=a.readFloat()*r,S.offsetScaleX=a.readFloat(),S.offsetScaleY=a.readFloat(),S.offsetShearY=a.readFloat(),S.rotateMix=a.readFloat(),S.translateMix=a.readFloat(),S.scaleMix=a.readFloat(),S.shearMix=a.readFloat(),n.transformConstraints.push(S)}s=a.readInt(!0);for(var A,T=0;T<s;T++){var I=new G(a.readString());I.order=a.readInt(!0),I.skinRequired=a.readBoolean(),A=a.readInt(!0);for(var R=0;R<A;R++)I.bones.push(n.bones[a.readInt(!0)]);I.target=n.slots[a.readInt(!0)],I.positionMode=t.PositionModeValues[a.readInt(!0)],I.spacingMode=t.SpacingModeValues[a.readInt(!0)],I.rotateMode=t.RotateModeValues[a.readInt(!0)],I.offsetRotation=a.readFloat(),I.position=a.readFloat(),I.positionMode==B.Fixed&&(I.position*=r),I.spacing=a.readFloat(),I.spacingMode!=D.Length&&I.spacingMode!=D.Fixed||(I.spacing*=r),I.rotateMix=a.readFloat(),I.translateMix=a.readFloat(),n.pathConstraints.push(I)}var C=this.readSkin(a,n,!0,i);null!=C&&(n.defaultSkin=C,n.skins.push(C));var k=n.skins.length;for(F.setArraySize(n.skins,s=k+a.readInt(!0));k<s;k++)n.skins[k]=this.readSkin(a,n,!1,i);s=this.linkedMeshes.length;for(var V=0;V<s;V++){var _=this.linkedMeshes[V],N=null==_.skin?n.defaultSkin:n.findSkin(_.skin);if(null==N)throw new Error("Skin not found: "+_.skin);var O=N.getAttachment(_.slotIndex,_.parent);if(null==O)throw new Error("Parent mesh not found: "+_.parent);_.mesh.deformAttachment=_.inheritDeform?O:_.mesh,_.mesh.setParentMesh(O),_.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var L=0;L<s;L++){var Y=new re(a.readStringRef());Y.intValue=a.readInt(!1),Y.floatValue=a.readFloat(),Y.stringValue=a.readString(),Y.audioPath=a.readString(),null!=Y.audioPath&&(Y.volume=a.readFloat(),Y.balance=a.readFloat()),n.events.push(Y)}s=a.readInt(!0);for(var U=0;U<s;U++)n.animations.push(this.readAnimation(a,a.readString(),n));return n},e.readSkin=function(t,e,r,n){var a=null,i=0;if(r){if(0==(i=t.readInt(!0)))return null;a=new ee("default")}else{(a=new ee(t.readStringRef())).bones.length=t.readInt(!0);for(var s=0,o=a.bones.length;s<o;s++)a.bones[s]=e.bones[t.readInt(!0)];for(var h=0,l=t.readInt(!0);h<l;h++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(var u=0,c=t.readInt(!0);u<c;u++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(var d=0,f=t.readInt(!0);d<f;d++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);i=t.readInt(!0)}for(var v=0;v<i;v++)for(var p=t.readInt(!0),g=0,m=t.readInt(!0);g<m;g++){var w=t.readStringRef(),E=this.readAttachment(t,e,a,p,w,n);null!=E&&a.setAttachment(p,w,E)}return a},e.readAttachment=function(e,r,n,a,i,s){var o=this.scale,h=e.readStringRef();null==h&&(h=i);var l=e.readByte();switch(t.AttachmentTypeValues[l]){case ne.Region:var u=e.readStringRef(),c=e.readFloat(),d=e.readFloat(),f=e.readFloat(),v=e.readFloat(),p=e.readFloat(),g=e.readFloat(),m=e.readFloat(),w=e.readInt32();null==u&&(u=h);var E=this.attachmentLoader.newRegionAttachment(n,h,u);return null==E?null:(E.path=u,E.x=d*o,E.y=f*o,E.scaleX=v,E.scaleY=p,E.rotation=c,E.width=g*o,E.height=m*o,P.rgba8888ToColor(E.color,w),E.updateOffset(),E);case ne.BoundingBox:var x=e.readInt(!0),y=this.readVertices(e,x),b=s?e.readInt32():0,S=this.attachmentLoader.newBoundingBoxAttachment(n,h);return null==S?null:(S.worldVerticesLength=x<<1,S.vertices=y.vertices,S.bones=y.bones,s&&P.rgba8888ToColor(S.color,b),S);case ne.Mesh:var M=e.readStringRef(),A=e.readInt32(),T=e.readInt(!0),I=this.readFloatArray(e,T<<1,1),R=this.readShortArray(e),C=this.readVertices(e,T),k=e.readInt(!0),V=null,_=0,N=0;s&&(V=this.readShortArray(e),_=e.readFloat(),N=e.readFloat()),null==M&&(M=h);var O=this.attachmentLoader.newMeshAttachment(n,h,M);return null==O?null:(O.path=M,P.rgba8888ToColor(O.color,A),O.bones=C.bones,O.vertices=C.vertices,O.worldVerticesLength=T<<1,O.triangles=R,O.regionUVs=I,O.updateUVs(),O.hullLength=k<<1,s&&(O.edges=V,O.width=_*o,O.height=N*o),O);case ne.LinkedMesh:var L=e.readStringRef(),X=e.readInt32(),B=e.readStringRef(),D=e.readStringRef(),Y=e.readBoolean(),U=0,W=0;s&&(U=e.readFloat(),W=e.readFloat()),null==L&&(L=h);var q=this.attachmentLoader.newMeshAttachment(n,h,L);return null==q?null:(q.path=L,P.rgba8888ToColor(q.color,X),s&&(q.width=U*o,q.height=W*o),this.linkedMeshes.push(new le(q,B,a,D,Y)),q);case ne.Path:for(var H=e.readBoolean(),j=e.readBoolean(),G=e.readInt(!0),z=this.readVertices(e,G),Z=F.newArray(G/3,0),Q=0,J=Z.length;Q<J;Q++)Z[Q]=e.readFloat()*o;var K=s?e.readInt32():0,$=this.attachmentLoader.newPathAttachment(n,h);return null==$?null:($.closed=H,$.constantSpeed=j,$.worldVerticesLength=G<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&P.rgba8888ToColor($.color,K),$);case ne.Point:var tt=e.readFloat(),et=e.readFloat(),rt=e.readFloat(),nt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(n,h);return null==at?null:(at.x=et*o,at.y=rt*o,at.rotation=tt,s&&P.rgba8888ToColor(at.color,nt),at);case ne.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),ht=s?e.readInt32():0,lt=this.attachmentLoader.newClippingAttachment(n,h);return null==lt?null:(lt.endSlot=r.slots[it],lt.worldVerticesLength=st<<1,lt.vertices=ot.vertices,lt.bones=ot.bones,s&&P.rgba8888ToColor(lt.color,ht),lt)}return null},e.readVertices=function(t,e){var r=e<<1,n=new ue,a=this.scale;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,a),n;for(var i=new Array,s=new Array,o=0;o<e;o++){var h=t.readInt(!0);s.push(h);for(var l=0;l<h;l++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return n.vertices=F.toFloatArray(i),n.bones=s,n},e.readFloatArray=function(t,e,r){var n=new Array(e);if(1==r)for(var a=0;a<e;a++)n[a]=t.readFloat();else for(var i=0;i<e;i++)n[i]=t.readFloat()*r;return n},e.readShortArray=function(t){for(var e=t.readInt(!0),r=new Array(e),n=0;n<e;n++)r[n]=t.readShort();return r},e.readAnimation=function(e,r,n){for(var a=new Array,i=this.scale,s=0,o=new P,h=new P,l=0,u=e.readInt(!0);l<u;l++)for(var c=e.readInt(!0),d=0,f=e.readInt(!0);d<f;d++){var v=e.readByte(),p=e.readInt(!0);switch(v){case t.SLOT_ATTACHMENT:var g=new yt(p);g.slotIndex=c;for(var m=0;m<p;m++)g.setFrame(m,e.readFloat(),e.readStringRef());a.push(g),s=Math.max(s,g.frames[p-1]);break;case t.SLOT_COLOR:var w=new Et(p);w.slotIndex=c;for(var E=0;E<p;E++){var x=e.readFloat();P.rgba8888ToColor(o,e.readInt32()),w.setFrame(E,x,o.r,o.g,o.b,o.a),E<p-1&&this.readCurve(e,E,w)}a.push(w),s=Math.max(s,w.frames[(p-1)*Et.ENTRIES]);break;case t.SLOT_TWO_COLOR:var y=new xt(p);y.slotIndex=c;for(var b=0;b<p;b++){var S=e.readFloat();P.rgba8888ToColor(o,e.readInt32()),P.rgb888ToColor(h,e.readInt32()),y.setFrame(b,S,o.r,o.g,o.b,o.a,h.r,h.g,h.b),b<p-1&&this.readCurve(e,b,y)}a.push(y),s=Math.max(s,y.frames[(p-1)*xt.ENTRIES])}}for(var M=0,A=e.readInt(!0);M<A;M++)for(var T=e.readInt(!0),I=0,R=e.readInt(!0);I<R;I++){var C=e.readByte(),k=e.readInt(!0);switch(C){case t.BONE_ROTATE:var V=new pt(k);V.boneIndex=T;for(var _=0;_<k;_++)V.setFrame(_,e.readFloat(),e.readFloat()),_<k-1&&this.readCurve(e,_,V);a.push(V),s=Math.max(s,V.frames[(k-1)*pt.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var N=void 0,O=1;C==t.BONE_SCALE?N=new mt(k):C==t.BONE_SHEAR?N=new wt(k):(N=new gt(k),O=i),N.boneIndex=T;for(var L=0;L<k;L++)N.setFrame(L,e.readFloat(),e.readFloat()*O,e.readFloat()*O),L<k-1&&this.readCurve(e,L,N);a.push(N),s=Math.max(s,N.frames[(k-1)*gt.ENTRIES])}}for(var X=0,Y=e.readInt(!0);X<Y;X++){var U=e.readInt(!0),W=e.readInt(!0),q=new Tt(W);q.ikConstraintIndex=U;for(var H=0;H<W;H++)q.setFrame(H,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),H<W-1&&this.readCurve(e,H,q);a.push(q),s=Math.max(s,q.frames[(W-1)*Tt.ENTRIES])}for(var j=0,G=e.readInt(!0);j<G;j++){var z=e.readInt(!0),Z=e.readInt(!0),Q=new It(Z);Q.transformConstraintIndex=z;for(var J=0;J<Z;J++)Q.setFrame(J,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),J<Z-1&&this.readCurve(e,J,Q);a.push(Q),s=Math.max(s,Q.frames[(Z-1)*It.ENTRIES])}for(var K=0,$=e.readInt(!0);K<$;K++)for(var tt=e.readInt(!0),et=n.pathConstraints[tt],rt=0,nt=e.readInt(!0);rt<nt;rt++){var at=e.readByte(),it=e.readInt(!0);switch(at){case t.PATH_POSITION:case t.PATH_SPACING:var st=void 0,ot=1;at==t.PATH_SPACING?(st=new Ct(it),et.spacingMode!=D.Length&&et.spacingMode!=D.Fixed||(ot=i)):(st=new Rt(it),et.positionMode==B.Fixed&&(ot=i)),st.pathConstraintIndex=tt;for(var ht=0;ht<it;ht++)st.setFrame(ht,e.readFloat(),e.readFloat()*ot),ht<it-1&&this.readCurve(e,ht,st);a.push(st),s=Math.max(s,st.frames[(it-1)*Rt.ENTRIES]);break;case t.PATH_MIX:var lt=new kt(it);lt.pathConstraintIndex=tt;for(var ut=0;ut<it;ut++)lt.setFrame(ut,e.readFloat(),e.readFloat(),e.readFloat()),ut<it-1&&this.readCurve(e,ut,lt);a.push(lt),s=Math.max(s,lt.frames[(it-1)*kt.ENTRIES])}}for(var ct=0,dt=e.readInt(!0);ct<dt;ct++)for(var vt=n.skins[e.readInt(!0)],bt=0,Vt=e.readInt(!0);bt<Vt;bt++)for(var Pt=e.readInt(!0),_t=0,Ft=e.readInt(!0);_t<Ft;_t++){var Nt=vt.getAttachment(Pt,e.readStringRef()),Ot=null!=Nt.bones,Lt=Nt.vertices,Xt=Ot?Lt.length/3*2:Lt.length,Bt=e.readInt(!0),Dt=new St(Bt);Dt.slotIndex=Pt,Dt.attachment=Nt;for(var Yt=0;Yt<Bt;Yt++){var Ut=e.readFloat(),Wt=void 0,qt=e.readInt(!0);if(0==qt)Wt=Ot?F.newFloatArray(Xt):Lt;else{Wt=F.newFloatArray(Xt);var Ht=e.readInt(!0);if(qt+=Ht,1==i)for(var jt=Ht;jt<qt;jt++)Wt[jt]=e.readFloat();else for(var Gt=Ht;Gt<qt;Gt++)Wt[Gt]=e.readFloat()*i;if(!Ot)for(var zt=0,Zt=Wt.length;zt<Zt;zt++)Wt[zt]+=Lt[zt]}Dt.setFrame(Yt,Ut,Wt),Yt<Bt-1&&this.readCurve(e,Yt,Dt)}a.push(Dt),s=Math.max(s,Dt.frames[Bt-1])}var Qt=e.readInt(!0);if(Qt>0){for(var Jt=new At(Qt),Kt=n.slots.length,$t=0;$t<Qt;$t++){for(var te=e.readFloat(),ee=e.readInt(!0),re=F.newArray(Kt,0),ne=Kt-1;ne>=0;ne--)re[ne]=-1;for(var ie=F.newArray(Kt-ee,0),se=0,oe=0,he=0;he<ee;he++){for(var le=e.readInt(!0);se!=le;)ie[oe++]=se++;re[se+e.readInt(!0)]=se++}for(;se<Kt;)ie[oe++]=se++;for(var ue=Kt-1;ue>=0;ue--)-1==re[ue]&&(re[ue]=ie[--oe]);Jt.setFrame($t,te,re)}a.push(Jt),s=Math.max(s,Jt.frames[Qt-1])}var ce=e.readInt(!0);if(ce>0){for(var de=new Mt(ce),fe=0;fe<ce;fe++){var ve=e.readFloat(),pe=n.events[e.readInt(!0)],ge=new ae(ve,pe);ge.intValue=e.readInt(!1),ge.floatValue=e.readFloat(),ge.stringValue=e.readBoolean()?e.readString():pe.stringValue,null!=ge.data.audioPath&&(ge.volume=e.readFloat(),ge.balance=e.readFloat()),de.setFrame(fe,ge)}a.push(de),s=Math.max(s,de.frames[ce-1])}return new ft(r,a,s)},e.readCurve=function(e,r,n){switch(e.readByte()){case t.CURVE_STEPPED:n.setStepped(r);break;case t.CURVE_BEZIER:this.setCurve(n,r,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat())}},e.setCurve=function(t,e,r,n,a,i){t.setCurve(e,r,n,a,i)},t}();oe.AttachmentTypeValues=[0,1,2,3,4,5,6],oe.TransformModeValues=[N.Normal,N.OnlyTranslation,N.NoRotationOrReflection,N.NoScale,N.NoScaleOrReflection],oe.PositionModeValues=[B.Fixed,B.Percent],oe.SpacingModeValues=[D.Length,D.Fixed,D.Percent],oe.RotateModeValues=[Y.Tangent,Y.Chain,Y.ChainScale],oe.BlendModeValues=[Ht.Normal,Ht.Additive,Ht.Multiply,Ht.Screen],oe.BONE_ROTATE=0,oe.BONE_TRANSLATE=1,oe.BONE_SCALE=2,oe.BONE_SHEAR=3,oe.SLOT_ATTACHMENT=0,oe.SLOT_COLOR=1,oe.SLOT_TWO_COLOR=2,oe.PATH_POSITION=0,oe.PATH_SPACING=1,oe.PATH_MIX=2,oe.CURVE_LINEAR=0,oe.CURVE_STEPPED=1,oe.CURVE_BEZIER=2;var he=function(){function t(t,e,r,n){void 0===e&&(e=new Array),void 0===r&&(r=0),void 0===n&&(n=new DataView(t.buffer)),this.strings=e,this.index=r,this.buffer=n}var e=t.prototype;return e.readByte=function(){return this.buffer.getInt8(this.index++)},e.readShort=function(){var t=this.buffer.getInt16(this.index);return this.index+=2,t},e.readInt32=function(){var t=this.buffer.getInt32(this.index);return this.index+=4,t},e.readInt=function(t){var e=this.readByte(),r=127&e;return 0!=(128&e)&&(r|=(127&(e=this.readByte()))<<7,0!=(128&e)&&(r|=(127&(e=this.readByte()))<<14,0!=(128&e)&&(r|=(127&(e=this.readByte()))<<21,0!=(128&e)&&(r|=(127&(e=this.readByte()))<<28)))),t?r:r>>>1^-(1&r)},e.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},e.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",r=0;r<t;){var n=this.readByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((31&n)<<6|63&this.readByte()),r+=2;break;case 14:e+=String.fromCharCode((15&n)<<12|(63&this.readByte())<<6|63&this.readByte()),r+=3;break;default:e+=String.fromCharCode(n),r++}}return e},e.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},e.readBoolean=function(){return 0!=this.readByte()},t}(),le=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,this.inheritDeform=a},ue=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e},ce=function(t){function e(){return t.apply(this,arguments)}R(e,t);var r=e.prototype;return r.load=function(t,e){var r=this;return new E((function(n,a){var i,s=e.engine;"spine"!==t.type&&a("Asset type must be spine."),!t.urls&&t.url&&r.checkUrl(t.url)&&(i=r.getResouceFromUrl(t.url)),t.urls&&r.checkUrls(t.urls)&&(i=r.getResouceFromUrls(t.urls));var h,l=!1;h=new jt(null,(function(t){return r.createAdaptiveTexture(t,s)}));var u=i.skeletonFile,c=i.atlasFile,d=i.textureFile;h.onLoadComplete=function(){try{var t;if(l)t=h.get(c);else{var e=h.get(c);t=new ot(e,r.textureAssetPicker.bind(r,h,d))}var i=new Zt(t),f=(r.isBinFile(u)?new oe(i):new ie(i)).readSkeletonData(h.get(u)),v=new x(s),p=v.addComponent(o),g=Ut.getDefaultMaterial(s);p.setMaterial(g),v.addComponent(Ut).setSkeletonData(f),n(v)}catch(t){a(t)}};var f=r.isBinFile(u);u&&c&&d?(f?h.loadBinary(u,null,a):h.loadText(u,null,a),h.loadText(c,null,a),h.loadTexture(d,null,a)):u&&c&&!d?(l=!0,f?h.loadBinary(u,null,a):h.loadText(u,null,a),h.loadTextureAtlas(c,null,a)):a("Resouce param error")}))},r.textureAssetPicker=function(t,e){return t.get(e)},r.createAdaptiveTexture=function(t,e){return new de(t,e)},r.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},r.checkUrl=function(t){var e=this.getExtFromUrl(t);return"json"===e||"bin"===e||(console.error("When use url as params, url must be json or bin file"),!1)},r.getResouceFromUrl=function(t){var e=t,r=t,n=r.indexOf("?");return n>0&&(r=r.substr(0,n)),{skeletonFile:e,atlasFile:r=r.substr(0,r.lastIndexOf("."))+".atlas"}},r.checkUrls=function(t){if(t.length<2)return console.error("When use urls as params, urls should at least contain: json/bin and atlas"),!1;if(t.length>3)return console.error("Spine runtime dont support multiple texture now"),!1;var e=this.getResouceFromUrls(t),r=e.skeletonFile,n=e.atlasFile;return e.textureFile,!(!r||!n)||(console.error("Lack "+(r?"":"skeletonFile")+(n?" atlasFile":"")),!1)},r.getResouceFromUrls=function(t){for(var e,r,n,a=0;a<t.length;a+=1){var i=t[a],s=this.getExtFromUrl(i);"json"!==s&&"bin"!==s||(e=i),"atlas"===s&&(r=i);["png","jpg","webp","jpeg"].includes(s)&&(n=i)}return{skeletonFile:e,atlasFile:r,textureFile:n}},r.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},e}(y);ce=C([w("spine",["json","bin"])],ce);var de=function(t){function e(e,r){var n;return(n=t.call(this,e)||this).texture=new b(r,e.width,e.height),n.texture.setImageSource(e),n.texture.generateMipmaps(),n}R(e,t);var r=e.prototype;return r.setFilters=function(t,e){t===$.Nearest?this.texture.filterMode=S.Point:e===$.MipMapLinearLinear?this.texture.filterMode=S.Trilinear:this.texture.filterMode=S.Bilinear},r.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},r.dispose=function(){},e}(et),fe=function(t){function e(){return t.apply(this,arguments)}R(e,t);var r=e.prototype;return r.load=function(t,e){var r=this;return new E((function(n,a){var i=e.engine;if(t.url)if(r.checkUrl(t.url)){var s,h,l,u,c,d=t.url;u=new jt(null,(function(t){return r.createAdaptiveTexture(t,i)})),(c=d,new Promise((function(t,e){var r=new XMLHttpRequest;r.responseType="json",r.open("GET",c,!0),r.onload=function(){200==r.status?t(r.response):e("status:"+r.status+", "+r.responseText)},r.onerror=function(){e("status:"+r.status+", "+r.responseText)},r.send()}))).then((function(t){if(l=t,t._ext){var e=t._ext,r=e.atlas,n=e.images,i=n[Object.keys(n)[0]];s=r,h=i,u.loadText(r),u.loadTexture(i)}else a("AntG spine json must have ext data")})).catch((function(){a("Resouce json load fail")})),u.onLoadComplete=function(){var t,e=u.get(s);t=new ot(e,r.textureAssetPicker.bind(r,u,h));var a=new Zt(t),c=new ie(a).readSkeletonData(l),d=new x(i),f=d.addComponent(o);f.shaderData.enableMacro("USE_MODEL_MATRIX"),f.shaderData.enableMacro("USE_CUSTOM_TEXTURE");var v=i._spriteDefaultMaterial.clone();f.setMaterial(v),d.addComponent(Ut).setSkeletonData(c),n(d)}}else a("AntG asset must be a json url.");else a("AntG asset must be a json url.")}))},r.textureAssetPicker=function(t,e){return t.get(e)},r.createAdaptiveTexture=function(t,e){return new ve(t,e)},r.checkUrl=function(t){return"json"===this.getExtFromUrl(t)||(console.error("When use url as params, url must be a json file"),!1)},r.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},e}(y);fe=C([w("antg_spine",["json","bin"])],fe);var ve=function(t){function e(e,r){var n;return(n=t.call(this,e)||this).texture=new b(r,e.width,e.height),n.texture.setImageSource(e),n.texture.generateMipmaps(),n}R(e,t);var r=e.prototype;return r.setFilters=function(t,e){t===$.Nearest?this.texture.filterMode=S.Point:e===$.MipMapLinearLinear?this.texture.filterMode=S.Trilinear:this.texture.filterMode=S.Bilinear},r.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},r.dispose=function(){},e}(et);var pe="1.0.0-test.5";console.log("Galacean spine version :"+pe);export{jt as AssetManager,Zt as AtlasAttachmentLoader,oe as SkeletonBinary,ie as SkeletonJson,Ut as SpineAnimation,et as Texture,ot as TextureAtlas,pe as version};
1
+ import{BufferMesh as t,VertexElement as e,VertexElementFormat as r,Buffer as n,BufferBindFlag as a,BufferUsage as i,IndexFormat as s,MeshRenderer as o,SubMesh as h,Shader as l,BlendFactor as u,BlendOperation as c,CullMode as d,RenderQueueType as f,Material as v,ignoreClone as p,Script as g,request as m,resourceLoader as w,AssetPromise as E,Entity as x,Loader as y,Texture2D as b,TextureFilterMode as S}from"@galacean/engine";function M(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function A(t,e,r){return e&&M(t.prototype,e),r&&M(t,r),t}function T(){return T=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},T.apply(this,arguments)}function I(t,e){return I=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},I(t,e)}function R(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&I(t,e)}function C(t,e,r,n){var a,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,r,s):a(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function k(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}"function"==typeof SuppressedError&&SuppressedError;var V=function(){function t(){this.array=new Array}var e=t.prototype;return e.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},e.contains=function(t){return null!=this.array[0|t]},e.remove=function(t){this.array[0|t]=void 0},e.clear=function(){this.array.length=0},t}(),P=function(){function t(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),this.r=t,this.g=e,this.b=r,this.a=n}var e=t.prototype;return e.set=function(t,e,r,n){return this.r=t,this.g=e,this.b=r,this.a=n,this.clamp(),this},e.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.setFromString=function(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?255:parseInt(t.substr(6,2),16))/255,this},e.add=function(t,e,r,n){return this.r+=t,this.g+=e,this.b+=r,this.a+=n,this.clamp(),this},e.clamp=function(){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},t.rgba8888ToColor=function(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},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t}();P.WHITE=new P(1,1,1,1),P.RED=new P(1,0,0,1),P.GREEN=new P(0,1,0,1),P.BLUE=new P(0,0,1,1),P.MAGENTA=new P(1,0,1,1);var _=function(){function t(){}return t.clamp=function(t,e,r){return t<e?e:t>r?r:t},t.cosDeg=function(e){return Math.cos(e*t.degRad)},t.sinDeg=function(e){return Math.sin(e*t.degRad)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,r){return t.randomTriangularWith(e,r,.5*(e+r))},t.randomTriangularWith=function(t,e,r){var n=Math.random(),a=e-t;return n<=(r-t)/a?t+Math.sqrt(n*a*(r-t)):e-Math.sqrt((1-n)*a*(e-r))},t}();_.PI=3.1415927,_.PI2=2*_.PI,_.radiansToDegrees=180/_.PI,_.radDeg=_.radiansToDegrees,_.degreesToRadians=_.PI/180,_.degRad=_.degreesToRadians;var F=function(){function t(){}return t.arrayCopy=function(t,e,r,n,a){for(var i=e,s=n;i<e+a;i++,s++)r[s]=t[i]},t.setArraySize=function(t,e,r){void 0===r&&(r=0);var n=t.length;if(n==e)return t;if(t.length=e,n<e)for(var a=n;a<e;a++)t[a]=r;return t},t.ensureArrayCapacity=function(e,r,n){return void 0===n&&(n=0),e.length>=r?e:t.setArraySize(e,r,n)},t.newArray=function(t,e){for(var r=new Array(t),n=0;n<t;n++)r[n]=e;return r},t.newFloatArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);for(var r=new Array(e),n=0;n<r.length;n++)r[n]=0;return r},t.newShortArray=function(e){if(t.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);for(var r=new Array(e),n=0;n<r.length;n++)r[n]=0;return r},t.toFloatArray=function(e){return t.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e},t.toSinglePrecision=function(e){return t.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e},t.webkit602BugfixHelper=function(t,e){},t.contains=function(t,e,r){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1},t}();F.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var N,O=function(){function t(t){this.items=new Array,this.instantiator=t}var e=t.prototype;return e.obtain=function(){return this.items.length>0?this.items.pop():this.instantiator()},e.free=function(t){t.reset&&t.reset(),this.items.push(t)},e.freeAll=function(t){for(var e=0;e<t.length;e++)this.free(t[e])},e.clear=function(){this.items.length=0},t}(),L=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},e.normalize=function(){var t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this},t}(),X=function(t,e,r){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=0,this.skinRequired=!1,this.color=new P,t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=r};!function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"}(N||(N={}));var B,D,Y,U=function(){function t(t,e,r){if(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.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=r,this.setToSetupPose()}var e=t.prototype;return e.isActive=function(){return this.active},e.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.updateWorldTransformWith=function(t,e,r,n,a,i,s){this.ax=t,this.ay=e,this.arotation=r,this.ascaleX=n,this.ascaleY=a,this.ashearX=i,this.ashearY=s,this.appliedValid=!0;var o=this.parent;if(null==o){var h=this.skeleton,l=r+90+s,u=h.scaleX,c=h.scaleY;return this.a=_.cosDeg(r+i)*n*u,this.b=_.cosDeg(l)*a*u,this.c=_.sinDeg(r+i)*n*c,this.d=_.sinDeg(l)*a*c,this.worldX=t*u+h.x,void(this.worldY=e*c+h.y)}var d=o.a,f=o.b,v=o.c,p=o.d;switch(this.worldX=d*t+f*e+o.worldX,this.worldY=v*t+p*e+o.worldY,this.data.transformMode){case N.Normal:var g=r+90+s,m=_.cosDeg(r+i)*n,w=_.cosDeg(g)*a,E=_.sinDeg(r+i)*n,x=_.sinDeg(g)*a;return this.a=d*m+f*E,this.b=d*w+f*x,this.c=v*m+p*E,void(this.d=v*w+p*x);case N.OnlyTranslation:var y=r+90+s;this.a=_.cosDeg(r+i)*n,this.b=_.cosDeg(y)*a,this.c=_.sinDeg(r+i)*n,this.d=_.sinDeg(y)*a;break;case N.NoRotationOrReflection:var b=d*d+v*v,S=0;b>1e-4?(b=Math.abs(d*p-f*v)/b,d/=this.skeleton.scaleX,f=(v/=this.skeleton.scaleY)*b,p=d*b,S=Math.atan2(v,d)*_.radDeg):(d=0,v=0,S=90-Math.atan2(p,f)*_.radDeg);var M=r+i-S,A=r+s-S+90,T=_.cosDeg(M)*n,I=_.cosDeg(A)*a,R=_.sinDeg(M)*n,C=_.sinDeg(A)*a;this.a=d*T-f*R,this.b=d*I-f*C,this.c=v*T+p*R,this.d=v*I+p*C;break;case N.NoScale:case N.NoScaleOrReflection:var k=_.cosDeg(r),V=_.sinDeg(r),P=(d*k+f*V)/this.skeleton.scaleX,F=(v*k+p*V)/this.skeleton.scaleY,O=Math.sqrt(P*P+F*F);O>1e-5&&(O=1/O),P*=O,F*=O,O=Math.sqrt(P*P+F*F),this.data.transformMode==N.NoScale&&d*p-f*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(O=-O);var L=Math.PI/2+Math.atan2(F,P),X=Math.cos(L)*O,B=Math.sin(L)*O,D=_.cosDeg(i)*n,Y=_.cosDeg(90+s)*a,U=_.sinDeg(i)*n,W=_.sinDeg(90+s)*a;this.a=P*D+X*U,this.b=P*Y+X*W,this.c=F*D+B*U,this.d=F*Y+B*W}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.setToSetupPose=function(){var 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},e.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*_.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*_.radDeg},e.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.updateAppliedTransform=function(){this.appliedValid=!0;var t=this.parent;if(null==t)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*_.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)*_.radDeg);var e=t.a,r=t.b,n=t.c,a=t.d,i=1/(e*a-r*n),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*a*i-o*r*i,this.ay=o*e*i-s*n*i;var h=i*a,l=i*e,u=i*r,c=i*n,d=h*this.a-u*this.c,f=h*this.b-u*this.d,v=l*this.c-c*this.a,p=l*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+v*v),this.ascaleX>1e-4){var g=d*p-f*v;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*f+v*p,g)*_.radDeg,this.arotation=Math.atan2(v,d)*_.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,f)*_.radDeg},e.worldToLocal=function(t){var e=this.a,r=this.b,n=this.c,a=this.d,i=1/(e*a-r*n),s=t.x-this.worldX,o=t.y-this.worldY;return t.x=s*a*i-o*r*i,t.y=o*e*i-s*n*i,t},e.localToWorld=function(t){var e=t.x,r=t.y;return t.x=e*this.a+r*this.b+this.worldX,t.y=e*this.c+r*this.d+this.worldY,t},e.worldToLocalRotation=function(t){var e=_.sinDeg(t),r=_.cosDeg(t);return Math.atan2(this.a*e-this.c*r,this.d*r-this.b*e)*_.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=_.sinDeg(t),r=_.cosDeg(t);return Math.atan2(r*this.c+e*this.d,r*this.a+e*this.b)*_.radDeg},e.rotateWorld=function(t){var e=this.a,r=this.b,n=this.c,a=this.d,i=_.cosDeg(t),s=_.sinDeg(t);this.a=i*e-s*n,this.b=i*r-s*a,this.c=s*e+i*n,this.d=s*r+i*a,this.appliedValid=!1},t}(),W=function(){function t(t,e){if(this.deform=new Array,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new P,this.darkColor=null==t.darkColor?null:new P,this.setToSetupPose()}var e=t.prototype;return e.getSkeleton=function(){return this.bone.skeleton},e.getAttachment=function(){return this.attachment},e.setAttachment=function(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)},e.setAttachmentTime=function(t){this.attachmentTime=this.bone.skeleton.time-t},e.getAttachmentTime=function(){return this.bone.skeleton.time-this.attachmentTime},e.setToSetupPose=function(){this.color.setFromColor(this.data.color),null!=this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),null==this.data.attachmentName?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))},t}(),q=function(){function t(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var r=0;r<t.bones.length;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix)}},e.apply1=function(t,e,r,n,a,i,s){t.appliedValid||t.updateAppliedTransform();var o=t.parent,h=o.a,l=o.b,u=o.c,c=o.d,d=-t.ashearX-t.arotation,f=0,v=0;switch(t.data.transformMode){case N.OnlyTranslation:f=e-t.worldX,v=r-t.worldY;break;case N.NoRotationOrReflection:var p=Math.abs(h*c-l*u)/(h*h+u*u),g=h/t.skeleton.scaleX,m=u/t.skeleton.scaleY;l=-m*p*t.skeleton.scaleX,c=g*p*t.skeleton.scaleY,d+=Math.atan2(m,g)*_.radDeg;default:var w=e-o.worldX,E=r-o.worldY,x=h*c-l*u;f=(w*c-E*l)/x-t.ax,v=(E*h-w*u)/x-t.ay}d+=Math.atan2(v,f)*_.radDeg,t.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);var y=t.ascaleX,b=t.ascaleY;if(n||a){switch(t.data.transformMode){case N.NoScale:case N.NoScaleOrReflection:f=e-t.worldX,v=r-t.worldY}var S=t.data.length*y,M=Math.sqrt(f*f+v*v);if(n&&M<S||a&&M>S&&S>1e-4){var A=(M/S-1)*s+1;y*=A,i&&(b*=A)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+d*s,y,b,t.ashearX,t.ashearY)},e.apply2=function(t,e,r,n,a,i,s,o){if(0!=o){t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();var h=t.ax,l=t.ay,u=t.ascaleX,c=u,d=t.ascaleY,f=e.ascaleX,v=0,p=0,g=0;u<0?(u=-u,v=180,g=-1):(v=0,g=1),d<0&&(d=-d,g=-g),f<0?(f=-f,p=180):p=0;var m=e.ax,w=0,E=0,x=0,y=t.a,b=t.b,S=t.c,M=t.d,A=Math.abs(u-d)<=1e-4;A?(E=y*m+b*(w=e.ay)+t.worldX,x=S*m+M*w+t.worldY):(w=0,E=y*m+t.worldX,x=S*m+t.worldY);var T=t.parent;y=T.a,b=T.b,S=T.c;var I,R,C=1/(y*(M=T.d)-b*S),k=E-T.worldX,V=x-T.worldY,P=(k*M-V*b)*C-h,F=(V*y-k*S)*C-l,N=Math.sqrt(P*P+F*F),O=e.data.length*f;if(N<1e-4)return this.apply1(t,r,n,!1,i,!1,o),void e.updateWorldTransformWith(m,w,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var L=((k=r-T.worldX)*M-(V=n-T.worldY)*b)*C-h,X=(V*y-k*S)*C-l,B=L*L+X*X;if(0!=s){s*=u*(f+1)/2;var D=Math.sqrt(B),Y=D-N-O*u+s;if(Y>0){var U=Math.min(1,Y/(2*s))-1;B=(L-=(U=(Y-s*(1-U*U))/D)*L)*L+(X-=U*X)*X}}t:if(A){var W=(B-N*N-(O*=u)*O)/(2*N*O);W<-1?W=-1:W>1&&(W=1,i&&(c*=(Math.sqrt(B)/(N+O)-1)*o+1)),R=Math.acos(W)*a,y=N+O*W,b=O*Math.sin(R),I=Math.atan2(X*y-L*b,L*y+X*b)}else{var q=(y=u*O)*y,H=(b=d*O)*b,j=Math.atan2(X,L),G=-2*H*N,z=H-q;if((M=G*G-4*z*(S=H*N*N+q*B-q*H))>=0){var Z=Math.sqrt(M);G<0&&(Z=-Z);var Q=(Z=-(G+Z)/2)/z,J=S/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=B){V=Math.sqrt(B-K*K)*a,I=j-Math.atan2(V,K),R=Math.atan2(V/d,(K-N)/u);break t}}var $=_.PI,tt=N-y,et=tt*tt,rt=0,nt=0,at=N+y,it=at*at,st=0;(S=-y*N/(q-H))>=-1&&S<=1&&(S=Math.acos(S),(M=(k=y*Math.cos(S)+N)*k+(V=b*Math.sin(S))*V)<et&&($=S,et=M,tt=k,rt=V),M>it&&(nt=S,it=M,at=k,st=V)),B<=(et+it)/2?(I=j-Math.atan2(rt*a,tt),R=$*a):(I=j-Math.atan2(st*a,at),R=nt*a)}var ot=Math.atan2(w,m)*g,ht=t.arotation;(I=(I-ot)*_.radDeg+v-ht)>180?I-=360:I<-180&&(I+=360),t.updateWorldTransformWith(h,l,ht+I*o,c,t.ascaleY,0,0),ht=e.arotation,(R=((R+ot)*_.radDeg-e.ashearX)*g+p-ht)>180?R-=360:R<-180&&(R+=360),e.updateWorldTransformWith(m,w,ht+R*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),H=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new L,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(var r=0;r<t.bones.length;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findBone(t.target.name)}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()},e.applyAbsoluteWorld=function(){for(var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,h=a.d,l=i*h-s*o>0?_.degRad:-_.degRad,u=this.data.offsetRotation*l,c=this.data.offsetShearY*l,d=this.bones,f=0,v=d.length;f<v;f++){var p=d[f],g=!1;if(0!=t){var m=p.a,w=p.b,E=p.c,x=p.d,y=Math.atan2(o,i)-Math.atan2(E,m)+u;y>_.PI?y-=_.PI2:y<-_.PI&&(y+=_.PI2),y*=t;var b=Math.cos(y),S=Math.sin(y);p.a=b*m-S*E,p.b=b*w-S*x,p.c=S*m+b*E,p.d=S*w+b*x,g=!0}if(0!=e){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),p.worldX+=(M.x-p.worldX)*e,p.worldY+=(M.y-p.worldY)*e,g=!0}if(r>0){var A=Math.sqrt(p.a*p.a+p.c*p.c),T=Math.sqrt(i*i+o*o);A>1e-5&&(A=(A+(T-A+this.data.offsetScaleX)*r)/A),p.a*=A,p.c*=A,A=Math.sqrt(p.b*p.b+p.d*p.d),T=Math.sqrt(s*s+h*h),A>1e-5&&(A=(A+(T-A+this.data.offsetScaleY)*r)/A),p.b*=A,p.d*=A,g=!0}if(n>0){var I=p.b,R=p.d,C=Math.atan2(R,I),k=Math.atan2(h,s)-Math.atan2(o,i)-(C-Math.atan2(p.c,p.a));k>_.PI?k-=_.PI2:k<-_.PI&&(k+=_.PI2),k=C+(k+c)*n;var V=Math.sqrt(I*I+R*R);p.b=Math.cos(k)*V,p.d=Math.sin(k)*V,g=!0}g&&(p.appliedValid=!1)}},e.applyRelativeWorld=function(){for(var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target,i=a.a,s=a.b,o=a.c,h=a.d,l=i*h-s*o>0?_.degRad:-_.degRad,u=this.data.offsetRotation*l,c=this.data.offsetShearY*l,d=this.bones,f=0,v=d.length;f<v;f++){var p=d[f],g=!1;if(0!=t){var m=p.a,w=p.b,E=p.c,x=p.d,y=Math.atan2(o,i)+u;y>_.PI?y-=_.PI2:y<-_.PI&&(y+=_.PI2),y*=t;var b=Math.cos(y),S=Math.sin(y);p.a=b*m-S*E,p.b=b*w-S*x,p.c=S*m+b*E,p.d=S*w+b*x,g=!0}if(0!=e){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),p.worldX+=M.x*e,p.worldY+=M.y*e,g=!0}if(r>0){var A=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*r+1;p.a*=A,p.c*=A,A=(Math.sqrt(s*s+h*h)-1+this.data.offsetScaleY)*r+1,p.b*=A,p.d*=A,g=!0}if(n>0){var T=Math.atan2(h,s)-Math.atan2(o,i);T>_.PI?T-=_.PI2:T<-_.PI&&(T+=_.PI2);var I=p.b,R=p.d;T=Math.atan2(R,I)+(T-_.PI/2+c)*n;var C=Math.sqrt(I*I+R*R);p.b=Math.cos(T)*C,p.d=Math.sin(T)*C,g=!0}g&&(p.appliedValid=!1)}},e.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var h=i[s];h.appliedValid||h.updateAppliedTransform();var l=h.arotation;if(0!=t){var u=a.arotation-l+this.data.offsetRotation;l+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=h.ax,d=h.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=h.ascaleX,v=h.ascaleY;0!=r&&(f>1e-5&&(f=(f+(a.ascaleX-f+this.data.offsetScaleX)*r)/f),v>1e-5&&(v=(v+(a.ascaleY-v+this.data.offsetScaleY)*r)/v));var p=h.ashearY;if(0!=n){var g=a.ashearY-p+this.data.offsetShearY;g-=360*(16384-(16384.499999999996-g/360|0)),h.shearY+=g*n}h.updateWorldTransformWith(c,d,l,f,v,h.ashearX,p)}},e.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,r=this.scaleMix,n=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,s=0,o=i.length;s<o;s++){var h=i[s];h.appliedValid||h.updateAppliedTransform();var l=h.arotation;0!=t&&(l+=(a.arotation+this.data.offsetRotation)*t);var u=h.ax,c=h.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=h.ascaleX,f=h.ascaleY;0!=r&&(d>1e-5&&(d*=(a.ascaleX-1+this.data.offsetScaleX)*r+1),f>1e-5&&(f*=(a.ascaleY-1+this.data.offsetScaleY)*r+1));var v=h.ashearY;0!=n&&(v+=(a.ashearY+this.data.offsetShearY)*n),h.updateWorldTransformWith(u,c,l,d,f,h.ashearX,v)}},t}(),j=function(t,e,r){this.name=t,this.order=e,this.skinRequired=r},G=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r}return R(e,t),e}(j);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(B||(B={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(D||(D={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(Y||(Y={}));var z=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},Z=function(t){function e(r){var n;return(n=t.call(this,r)||this).id=(65535&e.nextID++)<<11,n.worldVerticesLength=0,n.deformAttachment=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n),n}R(e,t);var r=e.prototype;return r.computeWorldVertices=function(t,e,r,n,a,i){r=a+(r>>1)*i;var s=t.bone.skeleton,o=t.deform,h=this.vertices,l=this.bones;if(null!=l){for(var u=0,c=0,d=0;d<e;d+=2){var f=l[u];u+=f+1,c+=f}var v=s.bones;if(0==o.length)for(var p=a,g=3*c;p<r;p+=i){var m=0,w=0,E=l[u++];for(E+=u;u<E;u++,g+=3){var x=v[l[u]],y=h[g],b=h[g+1],S=h[g+2];m+=(y*x.a+b*x.b+x.worldX)*S,w+=(y*x.c+b*x.d+x.worldY)*S}n[p]=m,n[p+1]=w}else for(var M=o,A=a,T=3*c,I=c<<1;A<r;A+=i){var R=0,C=0,k=l[u++];for(k+=u;u<k;u++,T+=3,I+=2){var V=v[l[u]],P=h[T]+M[I],_=h[T+1]+M[I+1],F=h[T+2];R+=(P*V.a+_*V.b+V.worldX)*F,C+=(P*V.c+_*V.d+V.worldY)*F}n[A]=R,n[A+1]=C}}else{o.length>0&&(h=o);for(var N=t.bone,O=N.worldX,L=N.worldY,X=N.a,B=N.b,D=N.c,Y=N.d,U=e,W=a;W<r;U+=2,W+=i){var q=h[U],H=h[U+1];n[W]=q*X+H*B+O,n[W+1]=q*D+H*Y+L}}},r.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),F.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=F.newFloatArray(this.vertices.length),F.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(z);Z.nextID=0;var Q=function(t){function e(e){var r;return(r=t.call(this,e)||this).closed=!1,r.constantSpeed=!1,r.color=new P(1,1,1,1),r}return R(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),F.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(Z),J=function(){function t(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=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,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var r=0,n=t.bones.length;r<n;r++)this.bones.push(e.findBone(t.bones[r].name));this.target=e.findSlot(t.target.name),this.position=t.position,this.spacing=t.spacing,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix}var e=t.prototype;return e.isActive=function(){return this.active},e.apply=function(){this.update()},e.update=function(){var e=this.target.getAttachment();if(k(e,Q)){var r=this.rotateMix,n=this.translateMix,a=r>0;if(n>0||a){var i=this.data,s=i.spacingMode==D.Percent,o=i.rotateMode,h=o==Y.Tangent,l=o==Y.ChainScale,u=this.bones.length,c=h?u:u+1,d=this.bones,f=F.setArraySize(this.spaces,c),v=null,p=this.spacing;if(l||!s){l&&(v=F.setArraySize(this.lengths,u));for(var g=i.spacingMode==D.Length,m=0,w=c-1;m<w;){var E=d[m],x=E.data.length;if(x<t.epsilon)l&&(v[m]=0),f[++m]=0;else if(s){if(l){var y=x*E.a,b=x*E.c,S=Math.sqrt(y*y+b*b);v[m]=S}f[++m]=p}else{var M=x*E.a,A=x*E.c,T=Math.sqrt(M*M+A*A);l&&(v[m]=T),f[++m]=(g?x+p:p)*T/x}}}else for(var I=1;I<c;I++)f[I]=p;var R=this.computeWorldPositions(e,c,h,i.positionMode==B.Percent,s),C=R[0],V=R[1],P=i.offsetRotation,N=!1;if(0==P)N=o==Y.Chain;else{N=!1;var O=this.target.bone;P*=O.a*O.d-O.b*O.c>0?_.degRad:-_.degRad}for(var L=0,X=3;L<u;L++,X+=3){var U=d[L];U.worldX+=(C-U.worldX)*n,U.worldY+=(V-U.worldY)*n;var W=R[X],q=R[X+1],H=W-C,j=q-V;if(l){var G=v[L];if(0!=G){var z=(Math.sqrt(H*H+j*j)/G-1)*r+1;U.a*=z,U.c*=z}}if(C=W,V=q,a){var Z=U.a,J=U.b,K=U.c,$=U.d,tt=0,et=0,rt=0;if(tt=h?R[X-1]:0==f[L+1]?R[X+2]:Math.atan2(j,H),tt-=Math.atan2(K,Z),N){et=Math.cos(tt),rt=Math.sin(tt);var nt=U.data.length;C+=(nt*(et*Z-rt*K)-H)*r,V+=(nt*(rt*Z+et*K)-j)*r}else tt+=P;tt>_.PI?tt-=_.PI2:tt<-_.PI&&(tt+=_.PI2),tt*=r,et=Math.cos(tt),rt=Math.sin(tt),U.a=et*Z-rt*K,U.b=et*J-rt*$,U.c=rt*Z+et*K,U.d=rt*J+et*$}U.appliedValid=!1}}}},e.computeWorldPositions=function(e,r,n,a,i){var s=this.target,o=this.position,h=this.spaces,l=F.setArraySize(this.positions,3*r+2),u=null,c=e.closed,d=e.worldVerticesLength,f=d/6,v=t.NONE;if(!e.constantSpeed){var p=e.lengths,g=p[f-=c?1:2];if(a&&(o*=g),i)for(var m=1;m<r;m++)h[m]*=g;u=F.setArraySize(this.world,8);for(var w=0,E=0,x=0;w<r;w++,E+=3){var y=h[w],b=o+=y;if(c)(b%=g)<0&&(b+=g),x=0;else{if(b<0){v!=t.BEFORE&&(v=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(b,u,0,l,E);continue}if(b>g){v!=t.AFTER&&(v=t.AFTER,e.computeWorldVertices(s,d-6,4,u,0,2)),this.addAfterPosition(b-g,u,0,l,E);continue}}for(;;x++){var S=p[x];if(!(b>S)){if(0==x)b/=S;else{var M=p[x-1];b=(b-M)/(S-M)}break}}x!=v&&(v=x,c&&x==f?(e.computeWorldVertices(s,d-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*x+2,8,u,0,2)),this.addCurvePosition(b,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],l,E,n||w>0&&0==y)}return l}c?(d+=2,u=F.setArraySize(this.world,d),e.computeWorldVertices(s,2,d-4,u,0,2),e.computeWorldVertices(s,0,2,u,d-4,2),u[d-2]=u[0],u[d-1]=u[1]):(f--,d-=4,u=F.setArraySize(this.world,d),e.computeWorldVertices(s,2,d,u,0,2));for(var A=F.setArraySize(this.curves,f),T=0,I=u[0],R=u[1],C=0,k=0,V=0,P=0,_=0,N=0,O=0,L=0,X=0,B=0,D=0,Y=0,U=0,W=0,q=0,H=2;q<f;q++,H+=6)C=u[H],k=u[H+1],V=u[H+2],P=u[H+3],D=2*(O=.1875*(I-2*C+V))+(X=.09375*(3*(C-V)-I+(_=u[H+4]))),Y=2*(L=.1875*(R-2*k+P))+(B=.09375*(3*(k-P)-R+(N=u[H+5]))),U=.75*(C-I)+O+.16666667*X,W=.75*(k-R)+L+.16666667*B,T+=Math.sqrt(U*U+W*W),U+=D,W+=Y,D+=X,Y+=B,T+=Math.sqrt(U*U+W*W),U+=D,W+=Y,T+=Math.sqrt(U*U+W*W),U+=D+X,W+=Y+B,T+=Math.sqrt(U*U+W*W),A[q]=T,I=_,R=N;if(o*=a?T:T/e.lengths[f-1],i)for(var j=1;j<r;j++)h[j]*=T;for(var G=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<r;Z++,Q+=3){var $=h[Z],tt=o+=$;if(c)(tt%=T)<0&&(tt+=T),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,l,Q);continue}if(tt>T){this.addAfterPosition(tt-T,u,d-4,l,Q);continue}}for(;;J++){var et=A[J];if(!(tt>et)){if(0==J)tt/=et;else{var rt=A[J-1];tt=(tt-rt)/(et-rt)}break}}if(J!=v){v=J;var nt=6*J;for(I=u[nt],R=u[nt+1],C=u[nt+2],k=u[nt+3],V=u[nt+4],P=u[nt+5],D=2*(O=.03*(I-2*C+V))+(X=.006*(3*(C-V)-I+(_=u[nt+6]))),Y=2*(L=.03*(R-2*k+P))+(B=.006*(3*(k-P)-R+(N=u[nt+7]))),U=.3*(C-I)+O+.16666667*X,W=.3*(k-R)+L+.16666667*B,z=Math.sqrt(U*U+W*W),G[0]=z,nt=1;nt<8;nt++)U+=D,W+=Y,D+=X,Y+=B,z+=Math.sqrt(U*U+W*W),G[nt]=z;U+=D,W+=Y,z+=Math.sqrt(U*U+W*W),G[8]=z,U+=D+X,W+=Y+B,z+=Math.sqrt(U*U+W*W),G[9]=z,K=0}for(tt*=z;;K++){var at=G[K];if(!(tt>at)){if(0==K)tt/=at;else{var it=G[K-1];tt=K+(tt-it)/(at-it)}break}}this.addCurvePosition(.1*tt,I,R,C,k,V,P,_,N,l,Q,n||Z>0&&0==$)}return l},e.addBeforePosition=function(t,e,r,n,a){var i=e[r],s=e[r+1],o=e[r+2]-i,h=e[r+3]-s,l=Math.atan2(h,o);n[a]=i+t*Math.cos(l),n[a+1]=s+t*Math.sin(l),n[a+2]=l},e.addAfterPosition=function(t,e,r,n,a){var i=e[r+2],s=e[r+3],o=i-e[r],h=s-e[r+1],l=Math.atan2(h,o);n[a]=i+t*Math.cos(l),n[a+1]=s+t*Math.sin(l),n[a+2]=l},e.addCurvePosition=function(t,e,r,n,a,i,s,o,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=r,void(l[u+2]=Math.atan2(a-r,n-e));var d=t*t,f=d*t,v=1-t,p=v*v,g=p*v,m=v*t,w=3*m,E=v*w,x=w*t,y=e*g+n*E+i*x+o*f,b=r*g+a*E+s*x+h*f;l[u]=y,l[u+1]=b,c&&(l[u+2]=t<.001?Math.atan2(a-r,n-e):Math.atan2(b-(r*p+a*m*2+s*d),y-(e*p+n*m*2+i*d)))},t}();J.NONE=-1,J.BEFORE=-2,J.AFTER=-3,J.epsilon=1e-5;var K=function(t){function e(e){var r;return(r=t.call(this,e)||this).x=0,r.y=0,r.scaleX=1,r.scaleY=1,r.rotation=0,r.width=0,r.height=0,r.color=new P(1,1,1,1),r.offset=F.newFloatArray(8),r.uvs=F.newFloatArray(8),r.tempColor=new P(1,1,1,1),r}R(e,t);var r=e.prototype;return r.updateOffset=function(){var t=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,n=-this.width/2*this.scaleX+this.region.offsetX*t,a=-this.height/2*this.scaleY+this.region.offsetY*r,i=n+this.region.width*t,s=a+this.region.height*r,o=this.rotation*Math.PI/180,h=Math.cos(o),l=Math.sin(o),u=n*h+this.x,c=n*l,d=a*h+this.y,f=a*l,v=i*h+this.x,p=i*l,g=s*h+this.y,m=s*l,w=this.offset;w[e.OX1]=u-f,w[e.OY1]=d+c,w[e.OX2]=u-m,w[e.OY2]=g+c,w[e.OX3]=v-m,w[e.OY3]=g+p,w[e.OX4]=v-f,w[e.OY4]=d+p},r.setRegion=function(t){this.region=t;var e=this.uvs;t.rotate?(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.u2,e[1]=t.v2):(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)},r.computeWorldVertices=function(t,r,n,a){var i=this.offset,s=t.worldX,o=t.worldY,h=t.a,l=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],r[n]=d*h+f*l+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX2],f=i[e.OY2],r[n]=d*h+f*l+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX3],f=i[e.OY3],r[n]=d*h+f*l+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX4],f=i[e.OY4],r[n]=d*h+f*l+s,r[n+1]=d*u+f*c+o},r.copy=function(){var t=new e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,F.arrayCopy(this.uvs,0,t.uvs,0,8),F.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(z);K.OX1=0,K.OY1=1,K.OX2=2,K.OY2=3,K.OX3=4,K.OY3=5,K.OX4=6,K.OY4=7,K.X1=0,K.Y1=1,K.C1R=2,K.C1G=3,K.C1B=4,K.C1A=5,K.U1=6,K.V1=7,K.X2=8,K.Y2=9,K.C2R=10,K.C2G=11,K.C2B=12,K.C2A=13,K.U2=14,K.V2=15,K.X3=16,K.Y3=17,K.C3R=18,K.C3G=19,K.C3B=20,K.C3A=21,K.U3=22,K.V3=23,K.X4=24,K.Y4=25,K.C4R=26,K.C4G=27,K.C4B=28,K.C4A=29,K.U4=30,K.V4=31;var $,tt,et=function(){function t(t){this._image=t}return t.prototype.getImage=function(){return this._image},t.filterFromString=function(t){switch(t.toLowerCase()){case"nearest":return 9728;case"linear":return 9729;case"mipmap":case"mipmaplinearlinear":return 9987;case"mipmapnearestnearest":return 9984;case"mipmaplinearnearest":return 9985;case"mipmapnearestlinear":return 9986;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return 33648;case"clamptoedge":return 33071;case"repeat":return 10497;default:throw new Error("Unknown texture wrap "+t)}},t}();!function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"}($||($={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(tt||(tt={}));var rt,nt,at,it=function(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.rotate=!1,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0},st=function(t){function e(){return t.apply(this,arguments)}R(e,t);var r=e.prototype;return r.setFilters=function(t,e){},r.setWraps=function(t,e){},r.dispose=function(){},e}(et),ot=function(){function t(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}var e=t.prototype;return e.load=function(t,e){if(null==e)throw new Error("textureLoader cannot be null.");for(var r=new ht(t),n=new Array(4),a=null;;){var i=r.readLine();if(null==i)break;if(0==(i=i.trim()).length)a=null;else if(a){var s=new ut;s.name=i,s.page=a;var o=r.readValue();"true"==o.toLocaleLowerCase()?s.degrees=90:"false"==o.toLocaleLowerCase()?s.degrees=0:s.degrees=parseFloat(o),s.rotate=90==s.degrees,r.readTuple(n);var h=parseInt(n[0]),l=parseInt(n[1]);r.readTuple(n);var u=parseInt(n[0]),c=parseInt(n[1]);s.u=h/a.width,s.v=l/a.height,s.rotate?(s.u2=(h+c)/a.width,s.v2=(l+u)/a.height):(s.u2=(h+u)/a.width,s.v2=(l+c)/a.height),s.x=h,s.y=l,s.width=Math.abs(u),s.height=Math.abs(c),4==r.readTuple(n)&&4==r.readTuple(n)&&r.readTuple(n),s.originalWidth=parseInt(n[0]),s.originalHeight=parseInt(n[1]),r.readTuple(n),s.offsetX=parseInt(n[0]),s.offsetY=parseInt(n[1]),s.index=parseInt(r.readValue()),s.texture=a.texture,this.regions.push(s)}else{(a=new lt).name=i,2==r.readTuple(n)&&(a.width=parseInt(n[0]),a.height=parseInt(n[1]),r.readTuple(n)),r.readTuple(n),a.minFilter=et.filterFromString(n[0]),a.magFilter=et.filterFromString(n[1]);var d=r.readValue();a.uWrap=tt.ClampToEdge,a.vWrap=tt.ClampToEdge,"x"==d?a.uWrap=tt.Repeat:"y"==d?a.vWrap=tt.Repeat:"xy"==d&&(a.uWrap=a.vWrap=tt.Repeat),a.texture=e(i),a.texture.setFilters(a.minFilter,a.magFilter),a.texture.setWraps(a.uWrap,a.vWrap),a.width=a.texture.getImage().width,a.height=a.texture.getImage().height,this.pages.push(a)}}},e.findRegion=function(t){for(var e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null},e.dispose=function(){for(var t=0;t<this.pages.length;t++)this.pages[t].texture.dispose()},t}(),ht=function(){function t(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}var e=t.prototype;return e.readLine=function(){return this.index>=this.lines.length?null:this.lines[this.index++]},e.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},e.readTuple=function(t){var e=this.readLine(),r=e.indexOf(":");if(-1==r)throw new Error("Invalid line: "+e);for(var n=0,a=r+1;n<3;n++){var i=e.indexOf(",",a);if(-1==i)break;t[n]=e.substr(a,i-a).trim(),a=i+1}return t[n]=e.substring(a).trim(),n+1},t}(),lt=function(){},ut=function(t){function e(){return t.apply(this,arguments)}return R(e,t),e}(it),ct=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new P(1,1,1,1),r.tempColor=new P(0,0,0,0),r}R(e,t);var r=e.prototype;return r.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=F.newFloatArray(t.length));var e=this.uvs,r=this.uvs.length,n=this.region.u,a=this.region.v,i=0,s=0;if(k(this.region,ut)){var o=this.region,h=o.texture.getImage().width,l=o.texture.getImage().height;switch(o.degrees){case 90:n-=(o.originalHeight-o.offsetY-o.height)/h,a-=(o.originalWidth-o.offsetX-o.width)/l,i=o.originalHeight/h,s=o.originalWidth/l;for(var u=0;u<r;u+=2)e[u]=n+t[u+1]*i,e[u+1]=a+(1-t[u])*s;return;case 180:n-=(o.originalWidth-o.offsetX-o.width)/h,a-=o.offsetY/l,i=o.originalWidth/h,s=o.originalHeight/l;for(var c=0;c<r;c+=2)e[c]=n+(1-t[c])*i,e[c+1]=a+(1-t[c+1])*s;return;case 270:n-=o.offsetY/h,a-=o.offsetX/l,i=o.originalHeight/h,s=o.originalWidth/l;for(var d=0;d<r;d+=2)e[d]=n+(1-t[d+1])*i,e[d+1]=a+t[d]*s;return}n-=o.offsetX/h,a-=(o.originalHeight-o.offsetY-o.height)/l,i=o.originalWidth/h,s=o.originalHeight/l}else null==this.region?(n=a=0,i=s=1):(i=this.region.u2-n,s=this.region.v2-a);for(var f=0;f<r;f+=2)e[f]=n+t[f]*i,e[f+1]=a+t[f+1]*s},r.getParentMesh=function(){return this.parentMesh},r.setParentMesh=function(t){this.parentMesh=t,null!=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)},r.copy=function(){if(null!=this.parentMesh)return this.newLinkedMesh();var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),F.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),F.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),F.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),F.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t},r.newLinkedMesh=function(){var t=new e(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(null!=this.parentMesh?this.parentMesh:this),t.updateUVs(),t},e}(Z),dt=function(){function t(t){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==t)throw new Error("data cannot be null.");this.data=t,this.bones=new Array;for(var e=0;e<t.bones.length;e++){var r=t.bones[e],n=void 0;if(null==r.parent)n=new U(r,this,null);else{var a=this.bones[r.parent.index];n=new U(r,this,a),a.children.push(n)}this.bones.push(n)}this.slots=new Array,this.drawOrder=new Array;for(var i=0;i<t.slots.length;i++){var s=t.slots[i],o=this.bones[s.boneData.index],h=new W(s,o);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=new Array;for(var l=0;l<t.ikConstraints.length;l++){var u=t.ikConstraints[l];this.ikConstraints.push(new q(u,this))}this.transformConstraints=new Array;for(var c=0;c<t.transformConstraints.length;c++){var d=t.transformConstraints[c];this.transformConstraints.push(new H(d,this))}this.pathConstraints=new Array;for(var f=0;f<t.pathConstraints.length;f++){var v=t.pathConstraints[f];this.pathConstraints.push(new J(v,this))}this.color=new P(1,1,1,1),this.updateCache()}var e=t.prototype;return e.updateCache=function(){var t=this._updateCache;t.length=0,this.updateCacheReset.length=0;for(var e=this.bones,r=0,n=e.length;r<n;r++){var a=e[r];a.sorted=a.data.skinRequired,a.active=!a.sorted}if(null!=this.skin)for(var i=this.skin.bones,s=0,o=this.skin.bones.length;s<o;s++){var h=this.bones[i[s].index];do{h.sorted=!1,h.active=!0,h=h.parent}while(null!=h)}var l=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=l.length,f=u.length,v=c.length,p=d+f+v;t:for(var g=0;g<p;g++){for(var m=0;m<d;m++){var w=l[m];if(w.data.order==g){this.sortIkConstraint(w);continue t}}for(var E=0;E<f;E++){var x=u[E];if(x.data.order==g){this.sortTransformConstraint(x);continue t}}for(var y=0;y<v;y++){var b=c[y];if(b.data.order==g){this.sortPathConstraint(b);continue t}}}for(var S=0,M=e.length;S<M;S++)this.sortBone(e[S])},e.sortIkConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&F.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target;this.sortBone(e);var r=t.bones,n=r[0];if(this.sortBone(n),r.length>1){var a=r[r.length-1];this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}this._updateCache.push(t),this.sortReset(n.children),r[r.length-1].sorted=!0}},e.sortPathConstraint=function(t){if(t.active=t.target.bone.isActive()&&(!t.data.skinRequired||null!=this.skin&&F.contains(this.skin.constraints,t.data,!0)),t.active){var e=t.target,r=e.data.index,n=e.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,r,n),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,n);for(var a=0,i=this.data.skins.length;a<i;a++)this.sortPathConstraintAttachment(this.data.skins[a],r,n);var s=e.getAttachment();k(s,Q)&&this.sortPathConstraintAttachmentWith(s,n);for(var o=t.bones,h=o.length,l=0;l<h;l++)this.sortBone(o[l]);this._updateCache.push(t);for(var u=0;u<h;u++)this.sortReset(o[u].children);for(var c=0;c<h;c++)o[c].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&F.contains(this.skin.constraints,t.data,!0)),t.active){this.sortBone(t.target);var e=t.bones,r=e.length;if(t.data.local)for(var n=0;n<r;n++){var a=e[n];this.sortBone(a.parent),this._updateCache.indexOf(a)>-1||this.updateCacheReset.push(a)}else for(var i=0;i<r;i++)this.sortBone(e[i]);this._updateCache.push(t);for(var s=0;s<r;s++)this.sortReset(e[s].children);for(var o=0;o<r;o++)e[o].sorted=!0}},e.sortPathConstraintAttachment=function(t,e,r){var n=t.attachments[e];if(n)for(var a in n)this.sortPathConstraintAttachmentWith(n[a],r)},e.sortPathConstraintAttachmentWith=function(t,e){if(k(t,Q)){var r=t.bones;if(null==r)this.sortBone(e);else for(var n=this.bones,a=0;a<r.length;)for(var i=r[a++],s=a+i;a<s;a++){var o=r[a];this.sortBone(n[o])}}},e.sortBone=function(t){if(!t.sorted){var e=t.parent;null!=e&&this.sortBone(e),t.sorted=!0,this._updateCache.push(t)}},e.sortReset=function(t){for(var e=0,r=t.length;e<r;e++){var n=t[e];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}},e.updateWorldTransform=function(){for(var t=this.updateCacheReset,e=0,r=t.length;e<r;e++){var n=t[e];n.ax=n.x,n.ay=n.y,n.arotation=n.rotation,n.ascaleX=n.scaleX,n.ascaleY=n.scaleY,n.ashearX=n.shearX,n.ashearY=n.shearY,n.appliedValid=!0}for(var a=this._updateCache,i=0,s=a.length;i<s;i++)a[i].update()},e.setToSetupPose=function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},e.setBonesToSetupPose=function(){for(var t=this.bones,e=0,r=t.length;e<r;e++)t[e].setToSetupPose();for(var n=this.ikConstraints,a=0,i=n.length;a<i;a++){var s=n[a];s.mix=s.data.mix,s.softness=s.data.softness,s.bendDirection=s.data.bendDirection,s.compress=s.data.compress,s.stretch=s.data.stretch}for(var o=this.transformConstraints,h=0,l=o.length;h<l;h++){var u=o[h],c=u.data;u.rotateMix=c.rotateMix,u.translateMix=c.translateMix,u.scaleMix=c.scaleMix,u.shearMix=c.shearMix}for(var d=this.pathConstraints,f=0,v=d.length;f<v;f++){var p=d[f],g=p.data;p.position=g.position,p.spacing=g.spacing,p.rotateMix=g.rotateMix,p.translateMix=g.translateMix}},e.setSlotsToSetupPose=function(){var t=this.slots;F.arrayCopy(t,0,this.drawOrder,0,t.length);for(var e=0,r=t.length;e<r;e++)t[e].setToSetupPose()},e.getRootBone=function(){return 0==this.bones.length?null:this.bones[0]},e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++)if(e[r].data.name==t)return r;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++)if(e[r].data.name==t)return r;return-1},e.setSkinByName=function(t){var e=this.data.findSkin(t);if(null==e)throw new Error("Skin not found: "+t);this.setSkin(e)},e.setSkin=function(t){if(t!=this.skin){if(null!=t)if(null!=this.skin)t.attachAll(this,this.skin);else for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r],i=a.data.attachmentName;if(null!=i){var s=t.getAttachment(r,i);null!=s&&a.setAttachment(s)}}this.skin=t,this.updateCache()}},e.getAttachmentByName=function(t,e){return this.getAttachment(this.data.findSlotIndex(t),e)},e.getAttachment=function(t,e){if(null==e)throw new Error("attachmentName cannot be null.");if(null!=this.skin){var r=this.skin.getAttachment(t,e);if(null!=r)return r}return null!=this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},e.setAttachment=function(t,e){if(null==t)throw new Error("slotName cannot be null.");for(var r=this.slots,n=0,a=r.length;n<a;n++){var i=r[n];if(i.data.name==t){var s=null;if(null!=e&&null==(s=this.getAttachment(n,e)))throw new Error("Attachment not found: "+e+", for slot: "+t);return void i.setAttachment(s)}}throw new Error("Slot not found: "+t)},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.data.name==t)return a}return null},e.getBounds=function(t,e,r){if(void 0===r&&(r=new Array(2)),null==t)throw new Error("offset cannot be null.");if(null==e)throw new Error("size cannot be null.");for(var n=this.drawOrder,a=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=0,l=n.length;h<l;h++){var u=n[h];if(u.bone.active){var c=0,d=null,f=u.getAttachment();if(k(f,K))c=8,d=F.setArraySize(r,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(k(f,ct)){var v=f;c=v.worldVerticesLength,d=F.setArraySize(r,c,0),v.computeWorldVertices(u,0,c,d,0,2)}if(null!=d)for(var p=0,g=d.length;p<g;p+=2){var m=d[p],w=d[p+1];a=Math.min(a,m),i=Math.min(i,w),s=Math.max(s,m),o=Math.max(o,w)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),ft=function(){function t(t,e,r){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(var n=0;n<e.length;n++)this.timelineIds[e[n].getPropertyId()]=!0;this.duration=r}var e=t.prototype;return e.hasTimeline=function(t){return 1==this.timelineIds[t]},e.apply=function(t,e,r,n,a,i,s,o){if(null==t)throw new Error("skeleton cannot be null.");n&&0!=this.duration&&(r%=this.duration,e>0&&(e%=this.duration));for(var h=this.timelines,l=0,u=h.length;l<u;l++)h[l].apply(t,e,r,a,i,s,o)},t.binarySearch=function(t,e,r){void 0===r&&(r=1);var n=0,a=t.length/r-2;if(0==a)return r;for(var i=a>>>1;;){if(t[(i+1)*r]<=e?n=i+1:a=i,n==a)return(n+1)*r;i=n+a>>>1}},t.linearSearch=function(t,e,r){for(var n=0,a=t.length-r;n<=a;n+=r)if(t[n]>e)return n;return-1},t}();!function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(rt||(rt={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(nt||(nt={})),function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"}(at||(at={}));var vt=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=F.newFloatArray((e-1)*t.BEZIER_SIZE)}var e=t.prototype;return e.getFrameCount=function(){return this.curves.length/t.BEZIER_SIZE+1},e.setLinear=function(e){this.curves[e*t.BEZIER_SIZE]=t.LINEAR},e.setStepped=function(e){this.curves[e*t.BEZIER_SIZE]=t.STEPPED},e.getCurveType=function(e){var r=e*t.BEZIER_SIZE;if(r==this.curves.length)return t.LINEAR;var n=this.curves[r];return n==t.LINEAR?t.LINEAR:n==t.STEPPED?t.STEPPED:t.BEZIER},e.setCurve=function(e,r,n,a,i){var s=.03*(2*-r+a),o=.03*(2*-n+i),h=.006*(3*(r-a)+1),l=.006*(3*(n-i)+1),u=2*s+h,c=2*o+l,d=.3*r+s+.16666667*h,f=.3*n+o+.16666667*l,v=e*t.BEZIER_SIZE,p=this.curves;p[v++]=t.BEZIER;for(var g=d,m=f,w=v+t.BEZIER_SIZE-1;v<w;v+=2)p[v]=g,p[v+1]=m,d+=u,f+=c,u+=h,c+=l,g+=d,m+=f},e.getCurvePercent=function(e,r){r=_.clamp(r,0,1);var n=this.curves,a=e*t.BEZIER_SIZE,i=n[a];if(i==t.LINEAR)return r;if(i==t.STEPPED)return 0;for(var s=0,o=++a,h=a+t.BEZIER_SIZE-1;a<h;a+=2)if((s=n[a])>=r){var l=void 0,u=void 0;return a==o?(l=0,u=0):(l=n[a-2],u=n[a-1]),u+(n[a+1]-u)*(r-l)/(s-l)}var c=n[a-1];return c+(1-c)*(r-s)/(1-s)},t}();vt.LINEAR=0,vt.STEPPED=1,vt.BEZIER=2,vt.BEZIER_SIZE=19;var pt=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=F.newFloatArray(e<<1),r}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return 0+this.boneIndex},r.setFrame=function(t,r,n){t<<=1,this.frames[t]=r,this.frames[t+e.ROTATION]=n},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(n<h[0])switch(s){case 0:return void(l.rotation=l.data.rotation);case 1:var u=l.data.rotation-l.rotation;l.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(n>=h[h.length-e.ENTRIES]){var c=h[h.length+e.PREV_ROTATION];switch(s){case 0:l.rotation=l.data.rotation+c*i;break;case 1:case 2:c+=l.data.rotation-l.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:l.rotation+=c*i}}else{var d=ft.binarySearch(h,n,e.ENTRIES),f=h[d+e.PREV_ROTATION],v=h[d],p=this.getCurvePercent((d>>1)-1,1-(n-v)/(h[d+e.PREV_TIME]-v)),g=h[d+e.ROTATION]-f;switch(g=f+(g-360*(16384-(16384.499999999996-g/360|0)))*p,s){case 0:l.rotation=l.data.rotation+(g-360*(16384-(16384.499999999996-g/360|0)))*i;break;case 1:case 2:g+=l.data.rotation-l.rotation;case 3:l.rotation+=(g-360*(16384-(16384.499999999996-g/360|0)))*i}}},e}(vt);pt.ENTRIES=2,pt.PREV_TIME=-2,pt.PREV_ROTATION=-1,pt.ROTATION=1;var gt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(1<<24)+this.boneIndex},r.setFrame=function(t,r,n,a){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.X]=n,this.frames[t+e.Y]=a},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(n<h[0])switch(s){case 0:return l.x=l.data.x,void(l.y=l.data.y);case 1:l.x+=(l.data.x-l.x)*i,l.y+=(l.data.y-l.y)*i}else{var u=0,c=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X],c=h[h.length+e.PREV_Y];else{var d=ft.binarySearch(h,n,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.X]-u)*v,c+=(h[d+e.Y]-c)*v}switch(s){case 0:l.x=l.data.x+u*i,l.y=l.data.y+c*i;break;case 1:case 2:l.x+=(l.data.x+u-l.x)*i,l.y+=(l.data.y+c-l.y)*i;break;case 3:l.x+=u*i,l.y+=c*i}}},e}(vt);gt.ENTRIES=3,gt.PREV_TIME=-3,gt.PREV_X=-2,gt.PREV_Y=-1,gt.X=1,gt.Y=2;var mt=function(t){function e(e){return t.call(this,e)}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(2<<24)+this.boneIndex},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(n<h[0])switch(s){case 0:return l.scaleX=l.data.scaleX,void(l.scaleY=l.data.scaleY);case 1:l.scaleX+=(l.data.scaleX-l.scaleX)*i,l.scaleY+=(l.data.scaleY-l.scaleY)*i}else{var u=0,c=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X]*l.data.scaleX,c=h[h.length+e.PREV_Y]*l.data.scaleY;else{var d=ft.binarySearch(h,n,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(h[d+e.PREV_TIME]-f));u=(u+(h[d+e.X]-u)*v)*l.data.scaleX,c=(c+(h[d+e.Y]-c)*v)*l.data.scaleY}if(1==i)3==s?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{var p=0,g=0;if(1==o)switch(s){case 0:p=l.data.scaleX,g=l.data.scaleY,l.scaleX=p+(Math.abs(u)*_.signum(p)-p)*i,l.scaleY=g+(Math.abs(c)*_.signum(g)-g)*i;break;case 1:case 2:p=l.scaleX,g=l.scaleY,l.scaleX=p+(Math.abs(u)*_.signum(p)-p)*i,l.scaleY=g+(Math.abs(c)*_.signum(g)-g)*i;break;case 3:p=l.scaleX,g=l.scaleY,l.scaleX=p+(Math.abs(u)*_.signum(p)-l.data.scaleX)*i,l.scaleY=g+(Math.abs(c)*_.signum(g)-l.data.scaleY)*i}else switch(s){case 0:p=Math.abs(l.data.scaleX)*_.signum(u),g=Math.abs(l.data.scaleY)*_.signum(c),l.scaleX=p+(u-p)*i,l.scaleY=g+(c-g)*i;break;case 1:case 2:p=Math.abs(l.scaleX)*_.signum(u),g=Math.abs(l.scaleY)*_.signum(c),l.scaleX=p+(u-p)*i,l.scaleY=g+(c-g)*i;break;case 3:p=_.signum(u),g=_.signum(c),l.scaleX=Math.abs(l.scaleX)*p+(u-Math.abs(l.data.scaleX)*p)*i,l.scaleY=Math.abs(l.scaleY)*g+(c-Math.abs(l.data.scaleY)*g)*i}}}},e}(gt),wt=function(t){function e(e){return t.call(this,e)}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(3<<24)+this.boneIndex},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.bones[this.boneIndex];if(l.active)if(n<h[0])switch(s){case 0:return l.shearX=l.data.shearX,void(l.shearY=l.data.shearY);case 1:l.shearX+=(l.data.shearX-l.shearX)*i,l.shearY+=(l.data.shearY-l.shearY)*i}else{var u=0,c=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_X],c=h[h.length+e.PREV_Y];else{var d=ft.binarySearch(h,n,e.ENTRIES);u=h[d+e.PREV_X],c=h[d+e.PREV_Y];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.X]-u)*v,c+=(h[d+e.Y]-c)*v}switch(s){case 0:l.shearX=l.data.shearX+u*i,l.shearY=l.data.shearY+c*i;break;case 1:case 2:l.shearX+=(l.data.shearX+u-l.shearX)*i,l.shearY+=(l.data.shearY+c-l.shearY)*i;break;case 3:l.shearX+=u*i,l.shearY+=c*i}}},e}(gt),Et=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(5<<24)+this.slotIndex},r.setFrame=function(t,r,n,a,i,s){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.R]=n,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s},r.apply=function(t,r,n,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=this.frames;if(n<l[0])switch(s){case 0:return void h.color.setFromColor(h.data.color);case 1:var u=h.color,c=h.data.color;u.add((c.r-u.r)*i,(c.g-u.g)*i,(c.b-u.b)*i,(c.a-u.a)*i)}else{var d=0,f=0,v=0,p=0;if(n>=l[l.length-e.ENTRIES]){var g=l.length;d=l[g+e.PREV_R],f=l[g+e.PREV_G],v=l[g+e.PREV_B],p=l[g+e.PREV_A]}else{var m=ft.binarySearch(l,n,e.ENTRIES);d=l[m+e.PREV_R],f=l[m+e.PREV_G],v=l[m+e.PREV_B],p=l[m+e.PREV_A];var w=l[m],E=this.getCurvePercent(m/e.ENTRIES-1,1-(n-w)/(l[m+e.PREV_TIME]-w));d+=(l[m+e.R]-d)*E,f+=(l[m+e.G]-f)*E,v+=(l[m+e.B]-v)*E,p+=(l[m+e.A]-p)*E}if(1==i)h.color.set(d,f,v,p);else{var x=h.color;0==s&&x.setFromColor(h.data.color),x.add((d-x.r)*i,(f-x.g)*i,(v-x.b)*i,(p-x.a)*i)}}}},e}(vt);Et.ENTRIES=5,Et.PREV_TIME=-5,Et.PREV_R=-4,Et.PREV_G=-3,Et.PREV_B=-2,Et.PREV_A=-1,Et.R=1,Et.G=2,Et.B=3,Et.A=4;var xt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(14<<24)+this.slotIndex},r.setFrame=function(t,r,n,a,i,s,o,h,l){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.R]=n,this.frames[t+e.G]=a,this.frames[t+e.B]=i,this.frames[t+e.A]=s,this.frames[t+e.R2]=o,this.frames[t+e.G2]=h,this.frames[t+e.B2]=l},r.apply=function(t,r,n,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=this.frames;if(n<l[0])switch(s){case 0:return h.color.setFromColor(h.data.color),void h.darkColor.setFromColor(h.data.darkColor);case 1:var u=h.color,c=h.darkColor,d=h.data.color,f=h.data.darkColor;u.add((d.r-u.r)*i,(d.g-u.g)*i,(d.b-u.b)*i,(d.a-u.a)*i),c.add((f.r-c.r)*i,(f.g-c.g)*i,(f.b-c.b)*i,0)}else{var v=0,p=0,g=0,m=0,w=0,E=0,x=0;if(n>=l[l.length-e.ENTRIES]){var y=l.length;v=l[y+e.PREV_R],p=l[y+e.PREV_G],g=l[y+e.PREV_B],m=l[y+e.PREV_A],w=l[y+e.PREV_R2],E=l[y+e.PREV_G2],x=l[y+e.PREV_B2]}else{var b=ft.binarySearch(l,n,e.ENTRIES);v=l[b+e.PREV_R],p=l[b+e.PREV_G],g=l[b+e.PREV_B],m=l[b+e.PREV_A],w=l[b+e.PREV_R2],E=l[b+e.PREV_G2],x=l[b+e.PREV_B2];var S=l[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(n-S)/(l[b+e.PREV_TIME]-S));v+=(l[b+e.R]-v)*M,p+=(l[b+e.G]-p)*M,g+=(l[b+e.B]-g)*M,m+=(l[b+e.A]-m)*M,w+=(l[b+e.R2]-w)*M,E+=(l[b+e.G2]-E)*M,x+=(l[b+e.B2]-x)*M}if(1==i)h.color.set(v,p,g,m),h.darkColor.set(w,E,x,1);else{var A=h.color,T=h.darkColor;0==s&&(A.setFromColor(h.data.color),T.setFromColor(h.data.darkColor)),A.add((v-A.r)*i,(p-A.g)*i,(g-A.b)*i,(m-A.a)*i),T.add((w-T.r)*i,(E-T.g)*i,(x-T.b)*i,0)}}}},e}(vt);xt.ENTRIES=8,xt.PREV_TIME=-8,xt.PREV_R=-7,xt.PREV_G=-6,xt.PREV_B=-5,xt.PREV_A=-4,xt.PREV_R2=-3,xt.PREV_G2=-2,xt.PREV_B2=-1,xt.R=1,xt.G=2,xt.B=3,xt.A=4,xt.R2=5,xt.G2=6,xt.B2=7;var yt=function(){function t(t){this.frames=F.newFloatArray(t),this.attachmentNames=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return(4<<24)+this.slotIndex},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,r){this.frames[t]=e,this.attachmentNames[t]=r},e.apply=function(t,e,r,n,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active)if(1!=s){var h=this.frames;if(r<h[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var l=0;l=r>=h[h.length-1]?h.length-1:ft.binarySearch(h,r,1)-1;var u=this.attachmentNames[l];t.slots[this.slotIndex].setAttachment(null==u?null:t.getAttachment(this.slotIndex,u))}}else 0==i&&this.setAttachment(t,o,o.data.attachmentName)},e.setAttachment=function(t,e,r){e.attachment=null==r?null:t.getAttachment(this.slotIndex,r)},t}(),bt=null,St=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=F.newFloatArray(e),r.frameVertices=new Array(e),null==bt&&(bt=F.newFloatArray(64)),r}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(6<<27)+ +this.attachment.id+this.slotIndex},r.setFrame=function(t,e,r){this.frames[t]=e,this.frameVertices[t]=r},r.apply=function(t,e,r,n,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=o.getAttachment();if(k(h,Z)&&h.deformAttachment==this.attachment){var l=o.deform;0==l.length&&(i=0);var u=this.frameVertices,c=u[0].length,d=this.frames;if(r<d[0]){var f=h;switch(i){case 0:return void(l.length=0);case 1:if(1==a){l.length=0;break}var v=F.setArraySize(l,c);if(null==f.bones)for(var p=f.vertices,g=0;g<c;g++)v[g]+=(p[g]-v[g])*a;else{a=1-a;for(g=0;g<c;g++)v[g]*=a}}}else{var m=F.setArraySize(l,c);if(r>=d[d.length-1]){var w=u[d.length-1];if(1==a)if(3==i){var E=h;if(null==E.bones)for(var x=E.vertices,y=0;y<c;y++)m[y]+=w[y]-x[y];else for(var b=0;b<c;b++)m[b]+=w[b]}else F.arrayCopy(w,0,m,0,c);else switch(i){case 0:var S=h;if(null==S.bones)for(var M=S.vertices,A=0;A<c;A++){var T=M[A];m[A]=T+(w[A]-T)*a}else for(var I=0;I<c;I++)m[I]=w[I]*a;break;case 1:case 2:for(var R=0;R<c;R++)m[R]+=(w[R]-m[R])*a;break;case 3:var C=h;if(null==C.bones)for(var V=C.vertices,P=0;P<c;P++)m[P]+=(w[P]-V[P])*a;else for(var _=0;_<c;_++)m[_]+=w[_]*a}}else{var N=ft.binarySearch(d,r),O=u[N-1],L=u[N],X=d[N],B=this.getCurvePercent(N-1,1-(r-X)/(d[N-1]-X));if(1==a)if(3==i){var D=h;if(null==D.bones)for(var Y=D.vertices,U=0;U<c;U++){var W=O[U];m[U]+=W+(L[U]-W)*B-Y[U]}else for(var q=0;q<c;q++){var H=O[q];m[q]+=H+(L[q]-H)*B}}else for(var j=0;j<c;j++){var G=O[j];m[j]=G+(L[j]-G)*B}else switch(i){case 0:var z=h;if(null==z.bones)for(var Q=z.vertices,J=0;J<c;J++){var K=O[J],$=Q[J];m[J]=$+(K+(L[J]-K)*B-$)*a}else for(var tt=0;tt<c;tt++){var et=O[tt];m[tt]=(et+(L[tt]-et)*B)*a}break;case 1:case 2:for(var rt=0;rt<c;rt++){var nt=O[rt];m[rt]+=(nt+(L[rt]-nt)*B-m[rt])*a}break;case 3:var at=h;if(null==at.bones)for(var it=at.vertices,st=0;st<c;st++){var ot=O[st];m[st]+=(ot+(L[st]-ot)*B-it[st])*a}else for(var ht=0;ht<c;ht++){var lt=O[ht];m[ht]+=(lt+(L[ht]-lt)*B)*a}}}}}}},e}(vt),Mt=function(){function t(t){this.frames=F.newFloatArray(t),this.events=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 7<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e){this.frames[t]=e.time,this.events[t]=e},e.apply=function(t,e,r,n,a,i,s){if(null!=n){var o=this.frames,h=this.frames.length;if(e>r)this.apply(t,e,Number.MAX_VALUE,n,a,i,s),e=-1;else if(e>=o[h-1])return;if(!(r<o[0])){var l=0;if(e<o[0])l=0;else for(var u=o[l=ft.binarySearch(o,e)];l>0&&o[l-1]==u;)l--;for(;l<h&&r>=o[l];l++)n.push(this.events[l])}}},t}(),At=function(){function t(t){this.frames=F.newFloatArray(t),this.drawOrders=new Array(t)}var e=t.prototype;return e.getPropertyId=function(){return 8<<24},e.getFrameCount=function(){return this.frames.length},e.setFrame=function(t,e,r){this.frames[t]=e,this.drawOrders[t]=r},e.apply=function(t,e,r,n,a,i,s){var o=t.drawOrder,h=t.slots;if(1!=s){var l=this.frames;if(r<l[0])0!=i&&1!=i||F.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=r>=l[l.length-1]?l.length-1:ft.binarySearch(l,r)-1;var c=this.drawOrders[u];if(null==c)F.arrayCopy(h,0,o,0,h.length);else for(var d=0,f=c.length;d<f;d++)o[d]=h[c[d]]}}else 0==i&&F.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),Tt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(9<<24)+this.ikConstraintIndex},r.setFrame=function(t,r,n,a,i,s,o){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.MIX]=n,this.frames[t+e.SOFTNESS]=a,this.frames[t+e.BEND_DIRECTION]=i,this.frames[t+e.COMPRESS]=s?1:0,this.frames[t+e.STRETCH]=o?1:0},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(l.active)if(n<h[0])switch(s){case 0:return l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,void(l.stretch=l.data.stretch);case 1:l.mix+=(l.data.mix-l.mix)*i,l.softness+=(l.data.softness-l.softness)*i,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}else if(n>=h[h.length-e.ENTRIES])0==s?(l.mix=l.data.mix+(h[h.length+e.PREV_MIX]-l.data.mix)*i,l.softness=l.data.softness+(h[h.length+e.PREV_SOFTNESS]-l.data.softness)*i,1==o?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[h.length+e.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+e.PREV_COMPRESS],l.stretch=0!=h[h.length+e.PREV_STRETCH])):(l.mix+=(h[h.length+e.PREV_MIX]-l.mix)*i,l.softness+=(h[h.length+e.PREV_SOFTNESS]-l.softness)*i,0==o&&(l.bendDirection=h[h.length+e.PREV_BEND_DIRECTION],l.compress=0!=h[h.length+e.PREV_COMPRESS],l.stretch=0!=h[h.length+e.PREV_STRETCH]));else{var u=ft.binarySearch(h,n,e.ENTRIES),c=h[u+e.PREV_MIX],d=h[u+e.PREV_SOFTNESS],f=h[u],v=this.getCurvePercent(u/e.ENTRIES-1,1-(n-f)/(h[u+e.PREV_TIME]-f));0==s?(l.mix=l.data.mix+(c+(h[u+e.MIX]-c)*v-l.data.mix)*i,l.softness=l.data.softness+(d+(h[u+e.SOFTNESS]-d)*v-l.data.softness)*i,1==o?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[u+e.PREV_BEND_DIRECTION],l.compress=0!=h[u+e.PREV_COMPRESS],l.stretch=0!=h[u+e.PREV_STRETCH])):(l.mix+=(c+(h[u+e.MIX]-c)*v-l.mix)*i,l.softness+=(d+(h[u+e.SOFTNESS]-d)*v-l.softness)*i,0==o&&(l.bendDirection=h[u+e.PREV_BEND_DIRECTION],l.compress=0!=h[u+e.PREV_COMPRESS],l.stretch=0!=h[u+e.PREV_STRETCH]))}},e}(vt);Tt.ENTRIES=6,Tt.PREV_TIME=-6,Tt.PREV_MIX=-5,Tt.PREV_SOFTNESS=-4,Tt.PREV_BEND_DIRECTION=-3,Tt.PREV_COMPRESS=-2,Tt.PREV_STRETCH=-1,Tt.MIX=1,Tt.SOFTNESS=2,Tt.BEND_DIRECTION=3,Tt.COMPRESS=4,Tt.STRETCH=5;var It=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(10<<24)+this.transformConstraintIndex},r.setFrame=function(t,r,n,a,i,s){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.ROTATE]=n,this.frames[t+e.TRANSLATE]=a,this.frames[t+e.SCALE]=i,this.frames[t+e.SHEAR]=s},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(l.active)if(n<h[0]){var u=l.data;switch(s){case 0:return l.rotateMix=u.rotateMix,l.translateMix=u.translateMix,l.scaleMix=u.scaleMix,void(l.shearMix=u.shearMix);case 1:l.rotateMix+=(u.rotateMix-l.rotateMix)*i,l.translateMix+=(u.translateMix-l.translateMix)*i,l.scaleMix+=(u.scaleMix-l.scaleMix)*i,l.shearMix+=(u.shearMix-l.shearMix)*i}}else{var c=0,d=0,f=0,v=0;if(n>=h[h.length-e.ENTRIES]){var p=h.length;c=h[p+e.PREV_ROTATE],d=h[p+e.PREV_TRANSLATE],f=h[p+e.PREV_SCALE],v=h[p+e.PREV_SHEAR]}else{var g=ft.binarySearch(h,n,e.ENTRIES);c=h[g+e.PREV_ROTATE],d=h[g+e.PREV_TRANSLATE],f=h[g+e.PREV_SCALE],v=h[g+e.PREV_SHEAR];var m=h[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(n-m)/(h[g+e.PREV_TIME]-m));c+=(h[g+e.ROTATE]-c)*w,d+=(h[g+e.TRANSLATE]-d)*w,f+=(h[g+e.SCALE]-f)*w,v+=(h[g+e.SHEAR]-v)*w}if(0==s){var E=l.data;l.rotateMix=E.rotateMix+(c-E.rotateMix)*i,l.translateMix=E.translateMix+(d-E.translateMix)*i,l.scaleMix=E.scaleMix+(f-E.scaleMix)*i,l.shearMix=E.shearMix+(v-E.shearMix)*i}else l.rotateMix+=(c-l.rotateMix)*i,l.translateMix+=(d-l.translateMix)*i,l.scaleMix+=(f-l.scaleMix)*i,l.shearMix+=(v-l.shearMix)*i}},e}(vt);It.ENTRIES=5,It.PREV_TIME=-5,It.PREV_ROTATE=-4,It.PREV_TRANSLATE=-3,It.PREV_SCALE=-2,It.PREV_SHEAR=-1,It.ROTATE=1,It.TRANSLATE=2,It.SCALE=3,It.SHEAR=4;var Rt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(11<<24)+this.pathConstraintIndex},r.setFrame=function(t,r,n){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.VALUE]=n},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(n<h[0])switch(s){case 0:return void(l.position=l.data.position);case 1:l.position+=(l.data.position-l.position)*i}else{var u=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_VALUE];else{var c=ft.binarySearch(h,n,e.ENTRIES);u=h[c+e.PREV_VALUE];var d=h[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-d)/(h[c+e.PREV_TIME]-d));u+=(h[c+e.VALUE]-u)*f}0==s?l.position=l.data.position+(u-l.data.position)*i:l.position+=(u-l.position)*i}},e}(vt);Rt.ENTRIES=2,Rt.PREV_TIME=-2,Rt.PREV_VALUE=-1,Rt.VALUE=1;var Ct=function(t){function e(e){return t.call(this,e)}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(12<<24)+this.pathConstraintIndex},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(n<h[0])switch(s){case 0:return void(l.spacing=l.data.spacing);case 1:l.spacing+=(l.data.spacing-l.spacing)*i}else{var u=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_VALUE];else{var c=ft.binarySearch(h,n,e.ENTRIES);u=h[c+e.PREV_VALUE];var d=h[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-d)/(h[c+e.PREV_TIME]-d));u+=(h[c+e.VALUE]-u)*f}0==s?l.spacing=l.data.spacing+(u-l.data.spacing)*i:l.spacing+=(u-l.spacing)*i}},e}(Rt),kt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=F.newFloatArray(r*e.ENTRIES),n}R(e,t);var r=e.prototype;return r.getPropertyId=function(){return(13<<24)+this.pathConstraintIndex},r.setFrame=function(t,r,n,a){t*=e.ENTRIES,this.frames[t]=r,this.frames[t+e.ROTATE]=n,this.frames[t+e.TRANSLATE]=a},r.apply=function(t,r,n,a,i,s,o){var h=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(n<h[0])switch(s){case 0:return l.rotateMix=l.data.rotateMix,void(l.translateMix=l.data.translateMix);case 1:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*i,l.translateMix+=(l.data.translateMix-l.translateMix)*i}else{var u=0,c=0;if(n>=h[h.length-e.ENTRIES])u=h[h.length+e.PREV_ROTATE],c=h[h.length+e.PREV_TRANSLATE];else{var d=ft.binarySearch(h,n,e.ENTRIES);u=h[d+e.PREV_ROTATE],c=h[d+e.PREV_TRANSLATE];var f=h[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(h[d+e.PREV_TIME]-f));u+=(h[d+e.ROTATE]-u)*v,c+=(h[d+e.TRANSLATE]-c)*v}0==s?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*i,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*i):(l.rotateMix+=(u-l.rotateMix)*i,l.translateMix+=(c-l.translateMix)*i)}},e}(vt);kt.ENTRIES=3,kt.PREV_TIME=-3,kt.PREV_ROTATE=-2,kt.PREV_TRANSLATE=-1,kt.ROTATE=1,kt.TRANSLATE=2;var Vt=function(){function t(t){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Ft(this),this.propertyIDs=new V,this.animationsChanged=!1,this.trackEntryPool=new O((function(){return new _t})),this.data=t}var e=t.prototype;return e.update=function(t){t*=this.timeScale;for(var e=this.tracks,r=0,n=e.length;r<n;r++){var a=e[r];if(null!=a){a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast;var i=t*a.timeScale;if(a.delay>0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(null!=s){var o=a.trackLast-s.delay;if(o>=0){for(s.delay=0,s.trackTime+=0==a.timeScale?0:(o/a.timeScale+t)*s.timeScale,a.trackTime+=i,this.setCurrent(r,s,!0);null!=s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[r]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var h=a.mixingFrom;for(a.mixingFrom=null,null!=h&&(h.mixingTo=null);null!=h;)this.queue.end(h),h=h.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.updateMixingFrom=function(t,e){var r=t.mixingFrom;if(null==r)return!0;var n=this.updateMixingFrom(r,e);return r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=r.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=r.mixingFrom,null!=r.mixingFrom&&(r.mixingFrom.mixingTo=t),t.interruptAlpha=r.interruptAlpha,this.queue.end(r)),n):(r.trackTime+=e*r.timeScale,t.mixTime+=e,!1)},e.apply=function(e){if(null==e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var r=this.events,n=this.tracks,a=!1,i=0,s=n.length;i<s;i++){var o=n[i];if(!(null==o||o.delay>0)){a=!0;var h=0==i?rt.first:o.mixBlend,l=o.alpha;null!=o.mixingFrom?l*=this.applyMixingFrom(o,e,h):o.trackTime>=o.trackEnd&&null==o.next&&(l=0);var u=o.animationLast,c=o.getAnimationTime(),d=o.animation.timelines.length,f=o.animation.timelines;if(0==i&&1==l||h==rt.add)for(var v=0;v<d;v++){F.webkit602BugfixHelper(l,h);var p=f[v];k(p,yt)?this.applyAttachmentTimeline(p,e,c,h,!0):p.apply(e,u,c,r,l,h,nt.mixIn)}else{var g=o.timelineMode,m=0==o.timelinesRotation.length;m&&F.setArraySize(o.timelinesRotation,d<<1,null);for(var w=o.timelinesRotation,E=0;E<d;E++){var x=f[E],y=g[E]==t.SUBSEQUENT?h:rt.setup;k(x,pt)?this.applyRotateTimeline(x,e,c,l,y,w,E<<1,m):k(x,yt)?this.applyAttachmentTimeline(x,e,c,h,!0):(F.webkit602BugfixHelper(l,h),x.apply(e,u,c,r,l,y,nt.mixIn))}}this.queueEvents(o,c),r.length=0,o.nextAnimationLast=c,o.nextTrackLast=o.trackTime}}for(var b=this.unkeyedState+t.SETUP,S=e.slots,M=0,A=e.slots.length;M<A;M++){var T=S[M];if(T.attachmentState==b){var I=T.data.attachmentName;T.attachment=null==I?null:e.getAttachment(T.data.index,I)}}return this.unkeyedState+=2,this.queue.drain(),a},e.applyMixingFrom=function(e,r,n){var a=e.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,r,n);var i=0;0==e.mixDuration?(i=1,n==rt.first&&(n=rt.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),n!=rt.first&&(n=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,h=i<a.drawOrderThreshold,l=a.animationLast,u=a.getAnimationTime(),c=a.animation.timelines.length,d=a.animation.timelines,f=a.alpha*e.interruptAlpha,v=f*(1-i);if(n==rt.add)for(var p=0;p<c;p++)d[p].apply(r,l,u,s,v,n,nt.mixOut);else{var g=a.timelineMode,m=a.timelineHoldMix,w=0==a.timelinesRotation.length;w&&F.setArraySize(a.timelinesRotation,c<<1,null);var E=a.timelinesRotation;a.totalAlpha=0;for(var x=0;x<c;x++){var y=d[x],b=nt.mixOut,S=void 0,M=0;switch(g[x]){case t.SUBSEQUENT:if(!h&&k(y,At))continue;S=n,M=v;break;case t.FIRST:S=rt.setup,M=v;break;case t.HOLD_SUBSEQUENT:S=n,M=f;break;case t.HOLD_FIRST:S=rt.setup,M=f;break;default:S=rt.setup;var A=m[x];M=f*Math.max(0,1-A.mixTime/A.mixDuration)}a.totalAlpha+=M,k(y,pt)?this.applyRotateTimeline(y,r,u,M,S,E,x<<1,w):k(y,yt)?this.applyAttachmentTimeline(y,r,u,S,o):(F.webkit602BugfixHelper(M,n),h&&k(y,At)&&S==rt.setup&&(b=nt.mixIn),y.apply(r,l,u,s,M,S,b))}}return e.mixDuration>0&&this.queueEvents(a,u),this.events.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime,i},e.applyAttachmentTimeline=function(e,r,n,a,i){var s=r.slots[e.slotIndex];if(s.bone.active){var o,h=e.frames;if(n<h[0])a!=rt.setup&&a!=rt.first||this.setAttachment(r,s,s.data.attachmentName,i);else o=n>=h[h.length-1]?h.length-1:ft.binarySearch(h,n)-1,this.setAttachment(r,s,e.attachmentNames[o],i);s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+t.SETUP)}},e.setAttachment=function(e,r,n,a){r.attachment=null==n?null:e.getAttachment(r.data.index,n),a&&(r.attachmentState=this.unkeyedState+t.CURRENT)},e.applyRotateTimeline=function(t,e,r,n,a,i,s,o){if(o&&(i[s]=0),1!=n){var h=t,l=h.frames,u=e.bones[h.boneIndex];if(u.active){var c=0,d=0;if(r<l[0])switch(a){case rt.setup:u.rotation=u.data.rotation;default:return;case rt.first:c=u.rotation,d=u.data.rotation}else if(c=a==rt.setup?u.data.rotation:u.rotation,r>=l[l.length-pt.ENTRIES])d=u.data.rotation+l[l.length+pt.PREV_ROTATION];else{var f=ft.binarySearch(l,r,pt.ENTRIES),v=l[f+pt.PREV_ROTATION],p=l[f],g=h.getCurvePercent((f>>1)-1,1-(r-p)/(l[f+pt.PREV_TIME]-p));d=l[f+pt.ROTATION]-v,d=v+(d-=360*(16384-(16384.499999999996-d/360|0)))*g+u.data.rotation,d-=360*(16384-(16384.499999999996-d/360|0))}var m=0,w=d-c;if(0==(w-=360*(16384-(16384.499999999996-w/360|0))))m=i[s];else{var E=0,x=0;o?(E=0,x=w):(E=i[s],x=i[s+1]);var y=w>0,b=E>=0;_.signum(x)!=_.signum(w)&&Math.abs(x)<=90&&(Math.abs(E)>180&&(E+=360*_.signum(E)),b=y),m=w+E-E%360,b!=y&&(m+=360*_.signum(E)),i[s]=m}i[s+1]=w,c+=m*n,u.rotation=c-360*(16384-(16384.499999999996-c/360|0))}}else t.apply(e,0,r,null,1,a,nt.mixIn)},e.queueEvents=function(t,e){for(var r=t.animationStart,n=t.animationEnd,a=n-r,i=t.trackLast%a,s=this.events,o=0,h=s.length;o<h;o++){var l=s[o];if(l.time<i)break;l.time>n||this.queue.event(t,l)}for((t.loop?0==a||i>t.trackTime%a:e>=n&&t.animationLast<n)&&this.queue.complete(t);o<h;o++){s[o].time<r||this.queue.event(t,s[o])}},e.clearTracks=function(){var t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var e=0,r=this.tracks.length;e<r;e++)this.clearTrack(e);this.tracks.length=0,this.queue.drainDisabled=t,this.queue.drain()},e.clearTrack=function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var r=e;;){var n=r.mixingFrom;if(null==n)break;this.queue.end(n),r.mixingFrom=null,r.mixingTo=null,r=n}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.setCurrent=function(t,e,r){var n=this.expandToIndex(t);this.tracks[t]=e,null!=n&&(r&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,null!=n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)},e.setAnimation=function(t,e,r){var n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,r)},e.setAnimationWith=function(t,e,r){if(null==e)throw new Error("animation cannot be null.");var n=!0,a=this.expandToIndex(t);null!=a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.disposeNext(a),a=a.mixingFrom,n=!1):this.disposeNext(a));var i=this.trackEntry(t,e,r,a);return this.setCurrent(t,i,n),this.queue.drain(),i},e.addAnimation=function(t,e,r,n){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,r,n)},e.addAnimationWith=function(t,e,r,n){if(null==e)throw new Error("animation cannot be null.");var a=this.expandToIndex(t);if(null!=a)for(;null!=a.next;)a=a.next;var i=this.trackEntry(t,e,r,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,n<=0){var s=a.animationEnd-a.animationStart;0!=s?(a.loop?n+=s*(1+(a.trackTime/s|0)):n+=Math.max(s,a.trackTime),n-=this.data.getMix(a.animation,e)):n=a.trackTime}return i.delay=n,i},e.setEmptyAnimation=function(e,r){var n=this.setAnimationWith(e,t.emptyAnimation,!1);return n.mixDuration=r,n.trackEnd=r,n},e.addEmptyAnimation=function(e,r,n){n<=0&&(n-=r);var a=this.addAnimationWith(e,t.emptyAnimation,!1,n);return a.mixDuration=r,a.trackEnd=r,a},e.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var r=0,n=this.tracks.length;r<n;r++){var a=this.tracks[r];null!=a&&this.setEmptyAnimation(a.trackIndex,t)}this.queue.drainDisabled=e,this.queue.drain()},e.expandToIndex=function(t){return t<this.tracks.length?this.tracks[t]:(F.ensureArrayCapacity(this.tracks,t+1,null),this.tracks.length=t+1,null)},e.trackEntry=function(t,e,r,n){var a=this.trackEntryPool.obtain();return a.trackIndex=t,a.animation=e,a.loop=r,a.holdPrevious=!1,a.eventThreshold=0,a.attachmentThreshold=0,a.drawOrderThreshold=0,a.animationStart=0,a.animationEnd=e.duration,a.animationLast=-1,a.nextAnimationLast=-1,a.delay=0,a.trackTime=0,a.trackLast=-1,a.nextTrackLast=-1,a.trackEnd=Number.MAX_VALUE,a.timeScale=1,a.alpha=1,a.interruptAlpha=1,a.mixTime=0,a.mixDuration=null==n?0:this.data.getMix(n.animation,e),a.mixBlend=rt.replace,a},e.disposeNext=function(t){for(var e=t.next;null!=e;)this.queue.dispose(e),e=e.next;t.next=null},e._animationsChanged=function(){this.animationsChanged=!1,this.propertyIDs.clear();for(var t=0,e=this.tracks.length;t<e;t++){var r=this.tracks[t];if(null!=r){for(;null!=r.mixingFrom;)r=r.mixingFrom;do{null!=r.mixingFrom&&r.mixBlend==rt.add||this.computeHold(r),r=r.mixingTo}while(null!=r)}}},e.computeHold=function(e){var r=e.mixingTo,n=e.animation.timelines,a=e.animation.timelines.length,i=F.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=F.setArraySize(e.timelineHoldMix,a),o=this.propertyIDs;if(null!=r&&r.holdPrevious)for(var h=0;h<a;h++)i[h]=o.add(n[h].getPropertyId())?t.HOLD_FIRST:t.HOLD_SUBSEQUENT;else t:for(var l=0;l<a;l++){var u=n[l],c=u.getPropertyId();if(o.add(c))if(null==r||k(u,yt)||k(u,At)||k(u,Mt)||!r.animation.hasTimeline(c))i[l]=t.FIRST;else{for(var d=r.mixingTo;null!=d;d=d.mixingTo)if(!d.animation.hasTimeline(c)){if(e.mixDuration>0){i[l]=t.HOLD_MIX,s[l]=d;continue t}break}i[l]=t.HOLD_FIRST}else i[l]=t.SUBSEQUENT}},e.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.clearListeners=function(){this.listeners.length=0},e.clearListenerNotifications=function(){this.queue.clear()},t}();Vt.emptyAnimation=new ft("<empty>",[],0),Vt.SUBSEQUENT=0,Vt.FIRST=1,Vt.HOLD_SUBSEQUENT=2,Vt.HOLD_FIRST=3,Vt.HOLD_MIX=4,Vt.SETUP=1,Vt.CURRENT=2;var Pt,_t=function(){function t(){this.mixBlend=rt.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}var e=t.prototype;return e.reset=function(){this.next=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},e.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.resetRotationDirections=function(){this.timelinesRotation.length=0},t}(),Ft=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}var e=t.prototype;return e.start=function(t){this.objects.push(0),this.objects.push(t),this.animState.animationsChanged=!0},e.interrupt=function(t){this.objects.push(1),this.objects.push(t)},e.end=function(t){this.objects.push(2),this.objects.push(t),this.animState.animationsChanged=!0},e.dispose=function(t){this.objects.push(3),this.objects.push(t)},e.complete=function(t){this.objects.push(4),this.objects.push(t)},e.event=function(t,e){this.objects.push(5),this.objects.push(t),this.objects.push(e)},e.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,r=0;r<t.length;r+=2){var n=t[r],a=t[r+1];switch(n){case 0:null!=a.listener&&a.listener.start&&a.listener.start(a);for(var i=0;i<e.length;i++)e[i].start&&e[i].start(a);break;case 1:null!=a.listener&&a.listener.interrupt&&a.listener.interrupt(a);for(var s=0;s<e.length;s++)e[s].interrupt&&e[s].interrupt(a);break;case 2:null!=a.listener&&a.listener.end&&a.listener.end(a);for(var o=0;o<e.length;o++)e[o].end&&e[o].end(a);case 3:null!=a.listener&&a.listener.dispose&&a.listener.dispose(a);for(var h=0;h<e.length;h++)e[h].dispose&&e[h].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var l=0;l<e.length;l++)e[l].complete&&e[l].complete(a);break;case 5:var u=t[2+r++];null!=a.listener&&a.listener.event&&a.listener.event(a,u);for(var c=0;c<e.length;c++)e[c].event&&e[c].event(a,u)}}this.clear(),this.drainDisabled=!1}},e.clear=function(){this.objects.length=0},t}();!function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(Pt||(Pt={}));var Nt=function(){function t(t){if(this.animationToMixTime={},this.defaultMix=0,null==t)throw new Error("skeletonData cannot be null.");this.skeletonData=t}var e=t.prototype;return e.setMix=function(t,e,r){var n=this.skeletonData.findAnimation(t);if(null==n)throw new Error("Animation not found: "+t);var a=this.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);this.setMixWith(n,a,r)},e.setMixWith=function(t,e,r){if(null==t)throw new Error("from cannot be null.");if(null==e)throw new Error("to cannot be null.");var n=t.name+"."+e.name;this.animationToMixTime[n]=r},e.getMix=function(t,e){var r=t.name+"."+e.name,n=this.animationToMixTime[r];return void 0===n?this.defaultMix:n},t}(),Ot=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new P(.2275,.2275,.8078,1),r}return R(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t},e}(Z),Lt=function(){function t(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new O((function(){return new Array})),this.polygonIndicesPool=new O((function(){return new Array}))}var e=t.prototype;return e.triangulate=function(e){var r=e,n=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i<n;i++)a[i]=i;var s=this.isConcaveArray;s.length=0;for(var o=0,h=n;o<h;++o)s[o]=t.isConcave(o,n,r,a);var l=this.triangles;for(l.length=0;n>3;){for(var u=n-1,c=0,d=1;;){t:if(!s[c]){for(var f=a[u]<<1,v=a[c]<<1,p=a[d]<<1,g=r[f],m=r[f+1],w=r[v],E=r[v+1],x=r[p],y=r[p+1],b=(d+1)%n;b!=u;b=(b+1)%n)if(s[b]){var S=a[b]<<1,M=r[S],A=r[S+1];if(t.positiveArea(x,y,g,m,M,A)&&t.positiveArea(g,m,w,E,M,A)&&t.positiveArea(w,E,x,y,M,A))break t}break}if(0==d){do{if(!s[c])break;c--}while(c>0);break}u=c,c=d,d=(d+1)%n}l.push(a[(n+c-1)%n]),l.push(a[c]),l.push(a[(c+1)%n]),a.splice(c,1),s.splice(c,1);var T=(--n+c-1)%n,I=c==n?0:c;s[T]=t.isConcave(T,n,r,a),s[I]=t.isConcave(I,n,r,a)}return 3==n&&(l.push(a[2]),l.push(a[0]),l.push(a[1])),l},e.decompose=function(e,r){var n=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var s=this.polygonIndicesPool.obtain();s.length=0;var o=this.polygonPool.obtain();o.length=0;for(var h=-1,l=0,u=0,c=r.length;u<c;u+=3){var d=r[u]<<1,f=r[u+1]<<1,v=r[u+2]<<1,p=n[d],g=n[d+1],m=n[f],w=n[f+1],E=n[v],x=n[v+1],y=!1;if(h==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],E,x),M=t.winding(E,x,o[0],o[1],o[2],o[3]);S==l&&M==l&&(o.push(E),o.push(x),s.push(v),y=!0)}y||(o.length>0?(a.push(o),i.push(s)):(this.polygonPool.free(o),this.polygonIndicesPool.free(s)),(o=this.polygonPool.obtain()).length=0,o.push(p),o.push(g),o.push(m),o.push(w),o.push(E),o.push(x),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(v),l=t.winding(p,g,m,w,E,x),h=d)}o.length>0&&(a.push(o),i.push(s));for(var A=0,T=a.length;A<T;A++)if(0!=(s=i[A]).length)for(var I=s[0],R=s[s.length-1],C=(o=a[A]).length-4,k=o[C],V=o[C+1],P=o[C+2],_=o[C+3],F=o[0],N=o[1],O=o[2],L=o[3],X=t.winding(k,V,P,_,F,N),B=0;B<T;B++)if(B!=A){var D=i[B];if(3==D.length){var Y=D[0],U=D[1],W=D[2],q=a[B],H=q[q.length-2],j=q[q.length-1];if(Y==I&&U==R){var G=t.winding(k,V,P,_,H,j),z=t.winding(H,j,F,N,O,L);G==X&&z==X&&(q.length=0,D.length=0,o.push(H),o.push(j),s.push(W),k=P,V=_,P=H,_=j,B=0)}}}for(var Z=a.length-1;Z>=0;Z--)0==(o=a[Z]).length&&(a.splice(Z,1),this.polygonPool.free(o),s=i[Z],i.splice(Z,1),this.polygonIndicesPool.free(s));return a},t.isConcave=function(t,e,r,n){var a=n[(e+t-1)%e]<<1,i=n[t]<<1,s=n[(t+1)%e]<<1;return!this.positiveArea(r[a],r[a+1],r[i],r[i+1],r[s],r[s+1])},t.positiveArea=function(t,e,r,n,a,i){return t*(i-n)+r*(e-i)+a*(n-e)>=0},t.winding=function(t,e,r,n,a,i){var s=r-t,o=n-e;return a*o-i*s+s*e-t*o>=0?1:-1},t}(),Xt=function(){function t(){this.triangulator=new Lt,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}var e=t.prototype;return e.clipStart=function(e,r){if(null!=this.clipAttachment)return 0;this.clipAttachment=r;var n=r.worldVerticesLength,a=F.setArraySize(this.clippingPolygon,n);r.computeWorldVertices(e,0,n,a,0,2);var i=this.clippingPolygon;t.makeClockwise(i);for(var s=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i)),o=0,h=s.length;o<h;o++){var l=s[o];t.makeClockwise(l),l.push(l[0]),l.push(l[1])}return s.length},e.clipEndWithSlot=function(t){null!=this.clipAttachment&&this.clipAttachment.endSlot==t.data&&this.clipEnd()},e.clipEnd=function(){null!=this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)},e.isClipping=function(){return null!=this.clipAttachment},e.clipTriangles=function(t,e,r,n,a,i,s,o){var h=this.clipOutput,l=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,d=this.clippingPolygons.length,f=o?12:8,v=0;l.length=0,u.length=0;t:for(var p=0;p<n;p+=3)for(var g=r[p]<<1,m=t[g],w=t[g+1],E=a[g],x=a[g+1],y=t[g=r[p+1]<<1],b=t[g+1],S=a[g],M=a[g+1],A=t[g=r[p+2]<<1],T=t[g+1],I=a[g],R=a[g+1],C=0;C<d;C++){var k=l.length;if(!this.clip(m,w,y,b,A,T,c[C],h)){var V=F.setArraySize(l,k+3*f);V[k]=m,V[k+1]=w,V[k+2]=i.r,V[k+3]=i.g,V[k+4]=i.b,V[k+5]=i.a,o?(V[k+6]=E,V[k+7]=x,V[k+8]=s.r,V[k+9]=s.g,V[k+10]=s.b,V[k+11]=s.a,V[k+12]=y,V[k+13]=b,V[k+14]=i.r,V[k+15]=i.g,V[k+16]=i.b,V[k+17]=i.a,V[k+18]=S,V[k+19]=M,V[k+20]=s.r,V[k+21]=s.g,V[k+22]=s.b,V[k+23]=s.a,V[k+24]=A,V[k+25]=T,V[k+26]=i.r,V[k+27]=i.g,V[k+28]=i.b,V[k+29]=i.a,V[k+30]=I,V[k+31]=R,V[k+32]=s.r,V[k+33]=s.g,V[k+34]=s.b,V[k+35]=s.a):(V[k+6]=E,V[k+7]=x,V[k+8]=y,V[k+9]=b,V[k+10]=i.r,V[k+11]=i.g,V[k+12]=i.b,V[k+13]=i.a,V[k+14]=S,V[k+15]=M,V[k+16]=A,V[k+17]=T,V[k+18]=i.r,V[k+19]=i.g,V[k+20]=i.b,V[k+21]=i.a,V[k+22]=I,V[k+23]=R),k=u.length;var P=F.setArraySize(u,k+3);P[k]=v,P[k+1]=v+1,P[k+2]=v+2,v+=3;continue t}var _=h.length;if(0!=_){for(var N=b-T,O=A-y,L=m-A,X=T-w,B=1/(N*L+O*(w-T)),D=_>>1,Y=this.clipOutput,U=F.setArraySize(l,k+D*f),W=0;W<_;W+=2){var q=Y[W],H=Y[W+1];U[k]=q,U[k+1]=H,U[k+2]=i.r,U[k+3]=i.g,U[k+4]=i.b,U[k+5]=i.a;var j=q-A,G=H-T,z=(N*j+O*G)*B,Z=(X*j+L*G)*B,Q=1-z-Z;U[k+6]=E*z+S*Z+I*Q,U[k+7]=x*z+M*Z+R*Q,o&&(U[k+8]=s.r,U[k+9]=s.g,U[k+10]=s.b,U[k+11]=s.a),k+=f}k=u.length;var J=F.setArraySize(u,k+3*(D-2));D--;for(var K=1;K<D;K++)J[k]=v,J[k+1]=v+K,J[k+2]=v+K+1,k+=3;v+=D+1}}},e.clip=function(t,e,r,n,a,i,s,o){var h=o,l=!1,u=null;s.length%4>=2?(u=o,o=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(r),u.push(n),u.push(a),u.push(i),u.push(t),u.push(e),o.length=0;for(var c=s,d=s.length-4,f=0;;f+=2){for(var v=c[f],p=c[f+1],g=c[f+2],m=c[f+3],w=v-g,E=p-m,x=u,y=u.length-2,b=o.length,S=0;S<y;S+=2){var M=x[S],A=x[S+1],T=x[S+2],I=x[S+3],R=w*(I-m)-E*(T-g)>0;if(w*(A-m)-E*(M-g)>0){if(R){o.push(T),o.push(I);continue}var C=I-A,k=T-M,V=C*(g-v)-k*(m-p);if(Math.abs(V)>1e-6){var P=(k*(p-A)-C*(v-M))/V;o.push(v+(g-v)*P),o.push(p+(m-p)*P)}else o.push(v),o.push(p)}else if(R){var _=I-A,F=T-M,N=_*(g-v)-F*(m-p);if(Math.abs(N)>1e-6){var O=(F*(p-A)-_*(v-M))/N;o.push(v+(g-v)*O),o.push(p+(m-p)*O)}else o.push(v),o.push(p);o.push(T),o.push(I)}l=!0}if(b==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var L=o;(o=u).length=0,u=L}if(h!=o){h.length=0;for(var X=0,B=o.length-2;X<B;X++)h[X]=o[X]}else h.length=h.length-2;return l},t.makeClockwise=function(t){for(var e=t,r=t.length,n=e[r-2]*e[1]-e[0]*e[r-1],a=0,i=0,s=0,o=0,h=r-3;o<h;o+=2)a=e[o],i=e[o+1],s=e[o+2],n+=a*e[o+3]-s*i;if(!(n<0))for(var l=0,u=r-2,c=r>>1;l<c;l+=2){var d=e[l],f=e[l+1],v=u-l;e[l]=e[v],e[l+1]=e[v+1],e[v]=d,e[v+1]=f}},t}(),Bt=function(){function o(){}var h=o.prototype;return h.initialize=function(o,h){var l=this._mesh=new t(o),u=[new e("POSITION",0,r.Vector3,0),new e("COLOR_0",12,r.Vector4,0),new e("TEXCOORD_0",28,r.Vector2,0)],c=4*Dt.VERTEX_STRIDE,d=c*h,f=new n(o,a.VertexBuffer,d,i.Dynamic),v=new n(o,a.IndexBuffer,2*h,i.Dynamic);this._indexBuffer=v,this._vertexBuffer=f,l.setVertexBufferBinding(f,c),l.setIndexBufferBinding(v,s.UInt16),l.setVertexElements(u),l.addSubMesh(0,h)},h.changeBuffer=function(t,e){var r=4*Dt.VERTEX_STRIDE,o=r*e,h=new n(t,a.VertexBuffer,o,i.Dynamic),l=new n(t,a.IndexBuffer,2*e,i.Dynamic),u=this._mesh;this._indexBuffer=l,this._vertexBuffer=h,u.setVertexBufferBinding(h,r),u.setIndexBufferBinding(l,s.UInt16)},A(o,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),o}(),Dt=function(){function t(t,e){this._clipper=new Xt,this._spineMesh=new Bt,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this._engine=t,this._entity=e}var e=t.prototype;return e.initialize=function(e,r){if(e){var n=this._entity.getComponent(o);if(n){this._meshRenderer=n,r&&(this._setting=r);for(var a=e.defaultSkin.attachments,i=0,s=t.QUAD_TRIANGLES.length,h=0,l=a.length;h<l;h++){var u=a[h];for(var c in u){var d=u[c];if(d)if(k(d,K))i+=s;else{if(!k(d,ct))continue;i+=d.triangles.length}}}this._vertexCount=i,this._prepareBufferData(this._vertexCount);var f=this._spineMesh;f.initialize(this._engine,this._vertexCount),n.mesh=f.mesh}else console.warn("You need add MeshRenderer component to entity first")}},e.buildMesh=function(e){var r=this._setting||{},n=r.useClipping,a=void 0===n||n,i=r.zSpacing,s=void 0===i?.01:i,o=0,l=0;this._subMeshItems.length=0;for(var u,c,d=this._meshRenderer,f=e.drawOrder,v=f.length,p=this._clipper,g=this._spineMesh,m=g.mesh,w=this._subMeshItems,E=this._vertices,x=0,y=0,b=0;b<v;b+=1){var S=f[b];if(S.bone.active){var M=S.getAttachment(),A=null,T=null,I=s*b,R=0,C=p.isClipping()?2:t.VERTEX_SIZE;if(k(M,K)){var V=M;A=V.color,E=this._vertices,R=4*C,V.computeWorldVertices(S.bone,E,0,C),u=t.QUAD_TRIANGLES,c=V.uvs,T=V.region.renderObject.texture}else if(k(M,ct)){var P=M;A=P.color,E=this._vertices,(R=(P.worldVerticesLength>>1)*C)>E.length&&(E=this._vertices=new Float32Array(R)),P.computeWorldVertices(S,0,P.worldVerticesLength,E,0,C),u=P.triangles,c=P.uvs,T=P.region.renderObject.texture}else if(k(M,Ot)){if(a){var _=M;p.clipStart(S,_);continue}}else if(a){p.clipEndWithSlot(S);continue}if(null!=T){var F=void 0,N=void 0,O=void 0,L=void 0,X=S.bone.skeleton.color,B=S.color,D=X.a*B.a*A.a,Y=t.tempColor;if(Y.set(X.r*B.r*A.r,X.g*B.g*A.g,X.b*B.b*A.b,D),p.isClipping()){p.clipTriangles(E,R,u,u.length,c,Y,null,!1);var U=p.clippedVertices,W=p.clippedTriangles;F=U,N=U.length,O=W,L=W.length}else{for(var q=E,H=2,j=0,G=R;H<G;H+=C,j+=2)q[H]=Y.r,q[H+1]=Y.g,q[H+2]=Y.b,q[H+3]=Y.a,q[H+4]=c[j],q[H+5]=c[j+1];F=E,N=R,O=u,L=u.length}for(var z=o/t.VERTEX_STRIDE,Z=this._verticesWithZ,Q=o,J=0;J<N;)Z[Q++]=F[J++],Z[Q++]=F[J++],Z[Q++]=I,Z[Q++]=F[J++],Z[Q++]=F[J++],Z[Q++]=F[J++],Z[Q++]=F[J++],Z[Q++]=F[J++],Z[Q++]=F[J++];o=Q;var $=this._indices;for(Q=l,J=0;J<L;Q++,J++)$[Q]=O[J]+z;var tt=S.data.name;if(this.separateSlots.includes(tt)){var et=new h(l,L);if(w.push({name:tt,subMesh:et}),y>0){var rt=new h(x,y);w.push({name:"default",subMesh:rt}),y=0}x=l+L}else y+=L;l+=L;for(var nt=d.getMaterials(),at=nt.length,it=0;it<at;it+=1){var st=nt[it];st.shaderData.getTexture("material_SpineTexture")||st.shaderData.setTexture("material_SpineTexture",T.texture)}}p.clipEndWithSlot(S)}else p.clipEndWithSlot(S)}if(p.clipEnd(),y>0){var ot=new h(x,y);w.push({name:"default",subMesh:ot}),y=0}if(w.sort((function(t,e){return t.subMesh.start-e.subMesh.start})),l>0&&l!==this._vertexCount&&l>this._vertexCount)return this._vertexCount=l,this._prepareBufferData(this._vertexCount),void(this._needResize=!0);m.clearSubMesh();for(var ht=w.length,lt=0;lt<ht;lt+=1)m.addSubMesh(w[lt].subMesh);this._needResize&&(g.changeBuffer(this._engine,this._vertexCount),this._needResize=!1),g.vertexBuffer.setData(this._verticesWithZ),g.indexBuffer.setData(this._indices)},e.addSeparateSlot=function(t){this.separateSlots.push(t)},e._prepareBufferData=function(e){this._vertices=new Float32Array(e*t.VERTEX_SIZE),this._verticesWithZ=new Float32Array(e*t.VERTEX_STRIDE),this._indices=new Uint16Array(e)},A(t,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),t}();Dt.QUAD_TRIANGLES=[0,1,2,2,3,0],Dt.VERTEX_SIZE=8,Dt.VERTEX_STRIDE=9,Dt.tempColor=new P;var Yt=function(t){function e(r){var n,a=l.find("galacean-spine-shader")||l.create("galacean-spine-shader",e._spineVS,e._spineFS),i=(n=t.call(this,r,a)||this).renderState,s=i.blendState.targetBlendState;return s.enabled=!0,s.sourceColorBlendFactor=u.SourceAlpha,s.destinationColorBlendFactor=u.OneMinusSourceAlpha,s.sourceAlphaBlendFactor=u.One,s.destinationAlphaBlendFactor=u.OneMinusSourceAlpha,s.colorBlendOperation=s.alphaBlendOperation=c.Add,i.depthState.writeEnabled=!1,i.rasterState.cullMode=d.Off,i.renderQueueType=f.Transparent,n}return R(e,t),e}(v);Yt._spineVS="\n uniform mat4 renderer_MVPMat;\n\n attribute vec3 POSITION;\n attribute vec2 TEXCOORD_0;\n attribute vec4 COLOR_0;\n \n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n gl_Position = renderer_MVPMat * vec4(POSITION, 1.0);\n \n v_uv = TEXCOORD_0;\n v_color = COLOR_0;\n }\n ",Yt._spineFS="\n uniform sampler2D material_SpineTexture;\n\n varying vec2 v_uv;\n varying vec4 v_color;\n \n void main()\n {\n vec4 baseColor = texture2D(material_SpineTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n }\n ";var Ut=function(t){function e(e){var r;return(r=t.call(this,e)||this)._tempOffset=new L,r._tempSize=new L,r._tempArray=[0,0],r.autoUpdate=!0,r.autoUpdateBounds=!1,r._meshGenerator=new Dt(r.engine,e),r}R(e,t);var r=e.prototype;return r.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new dt(t);var r=new Nt(t);this._state=new Vt(r),this._meshGenerator.initialize(t,this.setting)},r.addSeparateSlot=function(t){this.skeleton||console.error("Skeleton not found!");var r=this.entity.getComponent(o);if(r||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(t)){this._meshGenerator.addSeparateSlot(t);var n=e._defaultMaterial.clone(),a=e._defaultMaterial.clone(),i=r.materialCount;r.setMaterial(i,n),r.setMaterial(i+1,a)}else console.warn("Slot: "+t+" not find.")},r.hackSeparateSlotTexture=function(t,e){this._meshGenerator.buildMesh(this._skeleton);var r=this._meshGenerator,n=r.separateSlots,a=r.subMeshItems;if(0!==n.length)if(n.includes(t)){var i=this.entity.getComponent(o),s=a.findIndex((function(e){return e.name===t}));i.getMaterial(s).shaderData.setTexture("material_SpineTexture",e)}else console.warn("Slot "+t+" is not separated. You should use addSeparateSlot to separate it");else console.warn("You need add separate slot")},r.onUpdate=function(t){this.autoUpdate&&this.updateState(t)},r.updateState=function(t){if(this._skeleton&&this.state){var e=this._state,r=this._skeleton;e.update(t),e.apply(r),r.updateWorldTransform(),this.updateGeometry()}},r.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},r.updateBounds=function(){var t,e=this.entity.getComponent(o).bounds,r=this._tempOffset,n=this._tempSize,a=this._tempArray,i=(null==(t=this.setting)?void 0:t.zSpacing)||.01,s=this._skeleton;s.getBounds(r,n,a);var h=s.drawOrder;e.min.set(r.x,r.y,0),e.max.set(r.x+n.x,r.y+n.y,h.length*i)},r._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=T({},this.setting);t.setting=e},r._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},r.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},e.getDefaultMaterial=function(t){return this._defaultMaterial||(this._defaultMaterial=new Yt(t),this._defaultMaterial.isGCIgnored=!0),this._defaultMaterial.clone()},A(e,[{key:"skeletonData",get:function(){return this._skeletonData}},{key:"skeleton",get:function(){return this._skeleton}},{key:"state",get:function(){return this._state}},{key:"mesh",get:function(){return this._meshGenerator.mesh}},{key:"scale",set:function(t){this._skeleton&&(this._skeleton.scaleX=t,this._skeleton.scaleY=t)}}]),e}(g);function Wt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function qt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Wt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Wt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}C([p],Ut.prototype,"_skeletonData",void 0),C([p],Ut.prototype,"_skeleton",void 0),C([p],Ut.prototype,"_state",void 0),C([p],Ut.prototype,"_tempOffset",void 0),C([p],Ut.prototype,"_tempSize",void 0),C([p],Ut.prototype,"_tempArray",void 0),C([p],Ut.prototype,"_meshGenerator",void 0),C([p],Ut.prototype,"setting",void 0);var Ht,jt=function(){function t(t,e){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this.pathPrefix=t||"",this.textureLoader=e}var e=t.prototype;return e.downloadText=function(t,e,r){m(t,{type:"text"}).then((function(t){e(t)})).catch((function(t){r(t)}))},e.downloadBinary=function(t,e,r){var n=new XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status?e(new Uint8Array(n.response)):r(n.status,n.responseText)},n.onerror=function(){r(n.status,n.responseText)},n.send()},e.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},e.loadBinary=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n=this;t=this.pathPrefix+t,this.toLoad++,this.downloadBinary(t,(function(r){n.assets[t]=r,e&&e(t,r),n.onLoad(),n.loaded++}),(function(e,a){n.errors[t]="Couldn't load binary "+t+": status "+status+", "+a,r&&r("Couldn't load binary "+t+": status "+status+", "+a),n.onLoad(),n.loaded++}))},e.loadText=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n=this;t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(r){n.assets[t]=r,e&&e(t,r),n.onLoad(),n.loaded++}),(function(e){n.errors[t]="Couldn't load text "+t+": "+JSON.stringify(e),r&&r("Couldn't load text "+t+": "+JSON.stringify(e)),n.onLoad(),n.loaded++}))},e.loadImage=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n=this,a=t=this.pathPrefix+t;this.toLoad++;var i=new Image;i.crossOrigin="anonymous",i.onload=function(r){n.assets[a]=i,n.onLoad(),n.loaded++,e&&e(t,i)},i.onerror=function(e){n.errors[t]="Couldn't load image "+t,n.onLoad(),n.loaded++,r&&r("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),i.src=t},e.loadTexture=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n=this,a=t=this.pathPrefix+t;this.toLoad++,this.rawDataUris[t]&&(t=this.rawDataUris[t]),m(t,{type:"image"}).then((function(r){var i=n.textureLoader(r);n.assets[a]=i,n.onLoad(),n.loaded++,e&&e(t,i)})).catch((function(t){r(t)}))},e.loadTextureAtlas=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n=this,a=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(i){var s=function(){var s=u.value,l=!1;n.loadTexture(s,(function(s,u){if(o.count++,o.count==h.length)if(l)n.errors[t]="Couldn't load texture atlas page "+s+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+s+" of atlas "+t),n.onLoad(),n.loaded++;else try{var c=new ot(i,(function(t){return n.get(""==a?t:a+"/"+t)}));n.assets[t]=c,e&&e(t,c),n.onLoad(),n.loaded++}catch(e){var d=e;n.errors[t]="Couldn't load texture atlas "+t+": "+d.message,r&&r("Couldn't load texture atlas "+t+": "+d.message),n.onLoad(),n.loaded++}}),(function(e){l=!0,o.count++,o.count==h.length&&(n.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,r&&r("Couldn't load texture atlas page "+e+" of atlas "+t),n.onLoad(),n.loaded++)}))},o={count:0},h=new Array;try{new ot(i,(function(t){h.push(""==a?t:a+"/"+t);var e=document.createElement("img");return e.width=16,e.height=16,new st(e)}))}catch(e){var l=e;return n.errors[t]="Couldn't load texture atlas "+t+": "+l.message,r&&r("Couldn't load texture atlas "+t+": "+l.message),n.onLoad(),void n.loaded++}for(var u,c=qt(h);!(u=c()).done;)s()}),(function(e){n.errors[t]="Couldn't load texture atlas "+t+": "+JSON.stringify(e),r&&r("Couldn't load texture atlas "+t+": "+JSON.stringify(e)),n.onLoad(),n.loaded++}))},e.get=function(t){return t=this.pathPrefix+t,this.assets[t]},e.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},e.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},e.isLoadingComplete=function(){return 0==this.toLoad},e.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},e.getToLoad=function(){return this.toLoad},e.getLoaded=function(){return this.loaded},e.dispose=function(){this.removeAll()},e.hasErrors=function(){return Object.keys(this.errors).length>0},e.getErrors=function(){return this.errors},t}(),Gt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new P(1,1,1,1),r}return R(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(Z),zt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new P(.38,.94,0,1),r.name=e,r}R(e,t);var r=e.prototype;return r.computeWorldPosition=function(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},r.computeWorldRotation=function(t){var e=_.cosDeg(this.rotation),r=_.sinDeg(this.rotation),n=e*t.a+r*t.b,a=e*t.c+r*t.d;return Math.atan2(a,n)*_.radDeg},r.copy=function(){var t=new e(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t},e}(Z),Zt=function(){function t(t){this.atlas=t}var e=t.prototype;return e.newRegionAttachment=function(t,e,r){var n=this.atlas.findRegion(r);if(null==n)throw new Error("Region not found in atlas: "+r+" (region attachment: "+e+")");n.renderObject=n;var a=new K(e);return a.setRegion(n),a},e.newMeshAttachment=function(t,e,r){var n=this.atlas.findRegion(r);if(null==n)throw new Error("Region not found in atlas: "+r+" (mesh attachment: "+e+")");n.renderObject=n;var a=new ct(e);return a.region=n,a},e.newBoundingBoxAttachment=function(t,e){return new Gt(e)},e.newPathAttachment=function(t,e){return new Q(e)},e.newPointAttachment=function(t,e){return new zt(e)},e.newClippingAttachment=function(t,e){return new Ot(e)},t}(),Qt=function(){function t(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}var e=t.prototype;return e.findBone=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findBoneIndex=function(t){if(null==t)throw new Error("boneName cannot be null.");for(var e=this.bones,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},e.findSlot=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findSlotIndex=function(t){if(null==t)throw new Error("slotName cannot be null.");for(var e=this.slots,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},e.findSkin=function(t){if(null==t)throw new Error("skinName cannot be null.");for(var e=this.skins,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findEvent=function(t){if(null==t)throw new Error("eventDataName cannot be null.");for(var e=this.events,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findAnimation=function(t){if(null==t)throw new Error("animationName cannot be null.");for(var e=this.animations,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findIkConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.ikConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findTransformConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.transformConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findPathConstraint=function(t){if(null==t)throw new Error("constraintName cannot be null.");for(var e=this.pathConstraints,r=0,n=e.length;r<n;r++){var a=e[r];if(a.name==t)return a}return null},e.findPathConstraintIndex=function(t){if(null==t)throw new Error("pathConstraintName cannot be null.");for(var e=this.pathConstraints,r=0,n=e.length;r<n;r++)if(e[r].name==t)return r;return-1},t}(),Jt=function(t,e,r){if(this.color=new P(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(null==e)throw new Error("name cannot be null.");if(null==r)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=r},Kt=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r.bendDirection=1,r.compress=!1,r.stretch=!1,r.uniform=!1,r.mix=1,r.softness=0,r}return R(e,t),e}(j),$t=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r.rotateMix=0,r.translateMix=0,r.scaleMix=0,r.shearMix=0,r.offsetRotation=0,r.offsetX=0,r.offsetY=0,r.offsetScaleX=0,r.offsetScaleY=0,r.offsetShearY=0,r.relative=!1,r.local=!1,r}return R(e,t),e}(j),te=function(t,e,r){this.slotIndex=t,this.name=e,this.attachment=r},ee=function(){function t(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,null==t)throw new Error("name cannot be null.");this.name=t}var e=t.prototype;return e.setAttachment=function(t,e,r){if(null==r)throw new Error("attachment cannot be null.");var n=this.attachments;t>=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=r},e.addSkin=function(t){for(var e=0;e<t.bones.length;e++){for(var r=t.bones[e],n=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,h=0;h<this.constraints.length;h++)if(this.constraints[h]==s){o=!0;break}o||this.constraints.push(s)}for(var l=t.getAttachments(),u=0;u<l.length;u++){var c=l[u];this.setAttachment(c.slotIndex,c.name,c.attachment)}},e.copySkin=function(t){for(var e=0;e<t.bones.length;e++){for(var r=t.bones[e],n=!1,a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(var i=0;i<t.constraints.length;i++){for(var s=t.constraints[i],o=!1,h=0;h<this.constraints.length;h++)if(this.constraints[h]==s){o=!0;break}o||this.constraints.push(s)}for(var l=t.getAttachments(),u=0;u<l.length;u++){var c=l[u];null!=c.attachment&&(k(c.attachment,ct)?(c.attachment=c.attachment.newLinkedMesh(),this.setAttachment(c.slotIndex,c.name,c.attachment)):(c.attachment=c.attachment.copy(),this.setAttachment(c.slotIndex,c.name,c.attachment)))}},e.getAttachment=function(t,e){var r=this.attachments[t];return r?r[e]:null},e.removeAttachment=function(t,e){var r=this.attachments[t];r&&(r[e]=null)},e.getAttachments=function(){for(var t=new Array,e=0;e<this.attachments.length;e++){var r=this.attachments[e];if(r)for(var n in r){var a=r[n];a&&t.push(new te(e,n,a))}}return t},e.getAttachmentsForSlot=function(t,e){var r=this.attachments[t];if(r)for(var n in r){var a=r[n];a&&e.push(new te(t,n,a))}},e.clear=function(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0},e.attachAll=function(t,e){for(var r=0,n=0;n<t.slots.length;n++){var a=t.slots[n],i=a.getAttachment();if(i&&r<e.attachments.length){var s=e.attachments[r];for(var o in s){if(i==s[o]){var h=this.getAttachment(r,o);null!=h&&a.setAttachment(h);break}}}r++}},t}(),re=function(t){this.name=t};!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(Ht||(Ht={}));var ne,ae=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},ie=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var r=this.scale,n=new Qt,a="string"==typeof e?JSON.parse(e):e,i=a.skeleton;if(null!=i){if(n.hash=i.hash,n.version=i.spine,"3.8.75"==n.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");n.x=i.x,n.y=i.y,n.width=i.width,n.height=i.height,n.fps=i.fps,n.imagesPath=i.images}if(a.bones)for(var s=0;s<a.bones.length;s++){var o=a.bones[s],h=null,l=this.getValue(o,"parent",null);if(null!=l&&null==(h=n.findBone(l)))throw new Error("Parent bone not found: "+l);var u=new X(n.bones.length,o.name,h);u.length=this.getValue(o,"length",0)*r,u.x=this.getValue(o,"x",0)*r,u.y=this.getValue(o,"y",0)*r,u.rotation=this.getValue(o,"rotation",0),u.scaleX=this.getValue(o,"scaleX",1),u.scaleY=this.getValue(o,"scaleY",1),u.shearX=this.getValue(o,"shearX",0),u.shearY=this.getValue(o,"shearY",0),u.transformMode=t.transformModeFromString(this.getValue(o,"transform","normal")),u.skinRequired=this.getValue(o,"skin",!1),n.bones.push(u)}if(a.slots)for(var c=0;c<a.slots.length;c++){var d=a.slots[c],f=d.name,v=d.bone,p=n.findBone(v);if(null==p)throw new Error("Slot bone not found: "+v);var g=new Jt(n.slots.length,f,p),m=this.getValue(d,"color",null);null!=m&&g.color.setFromString(m);var w=this.getValue(d,"dark",null);null!=w&&(g.darkColor=new P(1,1,1,1),g.darkColor.setFromString(w)),g.attachmentName=this.getValue(d,"attachment",null),g.blendMode=t.blendModeFromString(this.getValue(d,"blend","normal")),n.slots.push(g)}if(a.ik)for(var E=0;E<a.ik.length;E++){var x=a.ik[E],y=new Kt(x.name);y.order=this.getValue(x,"order",0),y.skinRequired=this.getValue(x,"skin",!1);for(var b=0;b<x.bones.length;b++){var S=x.bones[b],M=n.findBone(S);if(null==M)throw new Error("IK bone not found: "+S);y.bones.push(M)}var A=x.target;if(y.target=n.findBone(A),null==y.target)throw new Error("IK target bone not found: "+A);y.mix=this.getValue(x,"mix",1),y.softness=this.getValue(x,"softness",0)*r,y.bendDirection=this.getValue(x,"bendPositive",!0)?1:-1,y.compress=this.getValue(x,"compress",!1),y.stretch=this.getValue(x,"stretch",!1),y.uniform=this.getValue(x,"uniform",!1),n.ikConstraints.push(y)}if(a.transform)for(var T=0;T<a.transform.length;T++){var I=a.transform[T],R=new $t(I.name);R.order=this.getValue(I,"order",0),R.skinRequired=this.getValue(I,"skin",!1);for(var C=0;C<I.bones.length;C++){var k=I.bones[C],V=n.findBone(k);if(null==V)throw new Error("Transform constraint bone not found: "+k);R.bones.push(V)}var _=I.target;if(R.target=n.findBone(_),null==R.target)throw new Error("Transform constraint target bone not found: "+_);R.local=this.getValue(I,"local",!1),R.relative=this.getValue(I,"relative",!1),R.offsetRotation=this.getValue(I,"rotation",0),R.offsetX=this.getValue(I,"x",0)*r,R.offsetY=this.getValue(I,"y",0)*r,R.offsetScaleX=this.getValue(I,"scaleX",0),R.offsetScaleY=this.getValue(I,"scaleY",0),R.offsetShearY=this.getValue(I,"shearY",0),R.rotateMix=this.getValue(I,"rotateMix",1),R.translateMix=this.getValue(I,"translateMix",1),R.scaleMix=this.getValue(I,"scaleMix",1),R.shearMix=this.getValue(I,"shearMix",1),n.transformConstraints.push(R)}if(a.path)for(var F=0;F<a.path.length;F++){var N=a.path[F],O=new G(N.name);O.order=this.getValue(N,"order",0),O.skinRequired=this.getValue(N,"skin",!1);for(var L=0;L<N.bones.length;L++){var Y=N.bones[L],U=n.findBone(Y);if(null==U)throw new Error("Transform constraint bone not found: "+Y);O.bones.push(U)}var W=N.target;if(O.target=n.findSlot(W),null==O.target)throw new Error("Path target slot not found: "+W);O.positionMode=t.positionModeFromString(this.getValue(N,"positionMode","percent")),O.spacingMode=t.spacingModeFromString(this.getValue(N,"spacingMode","length")),O.rotateMode=t.rotateModeFromString(this.getValue(N,"rotateMode","tangent")),O.offsetRotation=this.getValue(N,"rotation",0),O.position=this.getValue(N,"position",0),O.positionMode==B.Fixed&&(O.position*=r),O.spacing=this.getValue(N,"spacing",0),O.spacingMode!=D.Length&&O.spacingMode!=D.Fixed||(O.spacing*=r),O.rotateMix=this.getValue(N,"rotateMix",1),O.translateMix=this.getValue(N,"translateMix",1),n.pathConstraints.push(O)}if(a.skins)for(var q=0;q<a.skins.length;q++){var H=a.skins[q],j=new ee(H.name);if(H.bones)for(var z=0;z<H.bones.length;z++){var Z=n.findBone(H.bones[z]);if(null==Z)throw new Error("Skin bone not found: "+H.bones[q]);j.bones.push(Z)}if(H.ik)for(var Q=0;Q<H.ik.length;Q++){var J=n.findIkConstraint(H.ik[Q]);if(null==J)throw new Error("Skin IK constraint not found: "+H.ik[q]);j.constraints.push(J)}if(H.transform)for(var K=0;K<H.transform.length;K++){var $=n.findTransformConstraint(H.transform[K]);if(null==$)throw new Error("Skin transform constraint not found: "+H.transform[q]);j.constraints.push($)}if(H.path)for(var tt=0;tt<H.path.length;tt++){var et=n.findPathConstraint(H.path[tt]);if(null==et)throw new Error("Skin path constraint not found: "+H.path[q]);j.constraints.push(et)}for(var rt in H.attachments){var nt=n.findSlot(rt);if(null==nt)throw new Error("Slot not found: "+rt);var at=H.attachments[rt];for(var it in at){var st=this.readAttachment(at[it],j,nt.index,it,n);null!=st&&j.setAttachment(nt.index,it,st)}}n.skins.push(j),"default"==j.name&&(n.defaultSkin=j)}for(var ot=0,ht=this.linkedMeshes.length;ot<ht;ot++){var lt=this.linkedMeshes[ot],ut=null==lt.skin?n.defaultSkin:n.findSkin(lt.skin);if(null==ut)throw new Error("Skin not found: "+lt.skin);var ct=ut.getAttachment(lt.slotIndex,lt.parent);if(null==ct)throw new Error("Parent mesh not found: "+lt.parent);lt.mesh.deformAttachment=lt.inheritDeform?ct:lt.mesh,lt.mesh.setParentMesh(ct),lt.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var dt in a.events){var ft=a.events[dt],vt=new re(dt);vt.intValue=this.getValue(ft,"int",0),vt.floatValue=this.getValue(ft,"float",0),vt.stringValue=this.getValue(ft,"string",""),vt.audioPath=this.getValue(ft,"audio",null),null!=vt.audioPath&&(vt.volume=this.getValue(ft,"volume",1),vt.balance=this.getValue(ft,"balance",0)),n.events.push(vt)}if(a.animations)for(var pt in a.animations){var gt=a.animations[pt];this.readAnimation(gt,pt,n)}return n},e.readAttachment=function(t,e,r,n,a){var i=this.scale;switch(n=this.getValue(t,"name",n),this.getValue(t,"type","region")){case"region":var s=this.getValue(t,"path",n),o=this.attachmentLoader.newRegionAttachment(e,n,s);if(null==o)return null;o.path=s,o.x=this.getValue(t,"x",0)*i,o.y=this.getValue(t,"y",0)*i,o.scaleX=this.getValue(t,"scaleX",1),o.scaleY=this.getValue(t,"scaleY",1),o.rotation=this.getValue(t,"rotation",0),o.width=t.width*i,o.height=t.height*i;var h=this.getValue(t,"color",null);return null!=h&&o.color.setFromString(h),o.updateOffset(),o;case"boundingbox":var l=this.attachmentLoader.newBoundingBoxAttachment(e,n);if(null==l)return null;this.readVertices(t,l,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&l.color.setFromString(u),l;case"mesh":case"linkedmesh":var c=this.getValue(t,"path",n),d=this.attachmentLoader.newMeshAttachment(e,n,c);if(null==d)return null;d.path=c;var f=this.getValue(t,"color",null);null!=f&&d.color.setFromString(f),d.width=this.getValue(t,"width",0)*i,d.height=this.getValue(t,"height",0)*i;var v=this.getValue(t,"parent",null);if(null!=v)return this.linkedMeshes.push(new se(d,this.getValue(t,"skin",null),r,v,this.getValue(t,"deform",!0))),d;var p=t.uvs;return this.readVertices(t,d,p.length),d.triangles=t.triangles,d.regionUVs=p,d.updateUVs(),d.edges=this.getValue(t,"edges",null),d.hullLength=2*this.getValue(t,"hull",0),d;case"path":var g=this.attachmentLoader.newPathAttachment(e,n);if(null==g)return null;g.closed=this.getValue(t,"closed",!1),g.constantSpeed=this.getValue(t,"constantSpeed",!0);var m=t.vertexCount;this.readVertices(t,g,m<<1);for(var w=F.newArray(m/3,0),E=0;E<t.lengths.length;E++)w[E]=t.lengths[E]*i;g.lengths=w;var x=this.getValue(t,"color",null);return null!=x&&g.color.setFromString(x),g;case"point":var y=this.attachmentLoader.newPointAttachment(e,n);if(null==y)return null;y.x=this.getValue(t,"x",0)*i,y.y=this.getValue(t,"y",0)*i,y.rotation=this.getValue(t,"rotation",0);var b=this.getValue(t,"color",null);return null!=b&&y.color.setFromString(b),y;case"clipping":var S=this.attachmentLoader.newClippingAttachment(e,n);if(null==S)return null;var M=this.getValue(t,"end",null);if(null!=M){var A=a.findSlot(M);if(null==A)throw new Error("Clipping end slot not found: "+M);S.endSlot=A}var T=t.vertexCount;this.readVertices(t,S,T<<1);var I=this.getValue(t,"color",null);return null!=I&&S.color.setFromString(I),S}return null},e.readVertices=function(t,e,r){var n=this.scale;e.worldVerticesLength=r;var a=t.vertices;if(r!=a.length){for(var i=new Array,s=new Array,o=0,h=a.length;o<h;){var l=a[o++];s.push(l);for(var u=o+4*l;o<u;o+=4)s.push(a[o]),i.push(a[o+1]*n),i.push(a[o+2]*n),i.push(a[o+3])}e.bones=s,e.vertices=F.toFloatArray(i)}else{var c=F.toFloatArray(a);if(1!=n)for(var d=0,f=a.length;d<f;d++)c[d]*=n;e.vertices=c}},e.readAnimation=function(t,e,r){var n=this.scale,a=new Array,i=0;if(t.slots)for(var s in t.slots){var o=t.slots[s],h=r.findSlotIndex(s);if(-1==h)throw new Error("Slot not found: "+s);for(var l in o){var u=o[l];if("attachment"==l){var c=new yt(u.length);c.slotIndex=h;for(var d=0,f=0;f<u.length;f++){var v=u[f];c.setFrame(d++,this.getValue(v,"time",0),v.name)}a.push(c),i=Math.max(i,c.frames[c.getFrameCount()-1])}else if("color"==l){var p=new Et(u.length);p.slotIndex=h;for(var g=0,m=0;m<u.length;m++){var w=u[m],E=new P;E.setFromString(w.color),p.setFrame(g,this.getValue(w,"time",0),E.r,E.g,E.b,E.a),this.readCurve(w,p,g),g++}a.push(p),i=Math.max(i,p.frames[(p.getFrameCount()-1)*Et.ENTRIES])}else{if("twoColor"!=l)throw new Error("Invalid timeline type for a slot: "+l+" ("+s+")");var x=new xt(u.length);x.slotIndex=h;for(var y=0,b=0;b<u.length;b++){var S=u[b],M=new P,A=new P;M.setFromString(S.light),A.setFromString(S.dark),x.setFrame(y,this.getValue(S,"time",0),M.r,M.g,M.b,M.a,A.r,A.g,A.b),this.readCurve(S,x,y),y++}a.push(x),i=Math.max(i,x.frames[(x.getFrameCount()-1)*xt.ENTRIES])}}}if(t.bones)for(var T in t.bones){var I=t.bones[T],R=r.findBoneIndex(T);if(-1==R)throw new Error("Bone not found: "+T);for(var C in I){var k=I[C];if("rotate"===C){var V=new pt(k.length);V.boneIndex=R;for(var _=0,N=0;N<k.length;N++){var O=k[N];V.setFrame(_,this.getValue(O,"time",0),this.getValue(O,"angle",0)),this.readCurve(O,V,_),_++}a.push(V),i=Math.max(i,V.frames[(V.getFrameCount()-1)*pt.ENTRIES])}else{if("translate"!==C&&"scale"!==C&&"shear"!==C)throw new Error("Invalid timeline type for a bone: "+C+" ("+T+")");var L=null,X=1,Y=0;"scale"===C?(L=new mt(k.length),Y=1):"shear"===C?L=new wt(k.length):(L=new gt(k.length),X=n),L.boneIndex=R;for(var U=0,W=0;W<k.length;W++){var q=k[W],H=this.getValue(q,"x",Y),j=this.getValue(q,"y",Y);L.setFrame(U,this.getValue(q,"time",0),H*X,j*X),this.readCurve(q,L,U),U++}a.push(L),i=Math.max(i,L.frames[(L.getFrameCount()-1)*gt.ENTRIES])}}}if(t.ik)for(var G in t.ik){var z=t.ik[G],Z=r.findIkConstraint(G),Q=new Tt(z.length);Q.ikConstraintIndex=r.ikConstraints.indexOf(Z);for(var J=0,K=0;K<z.length;K++){var $=z[K];Q.setFrame(J,this.getValue($,"time",0),this.getValue($,"mix",1),this.getValue($,"softness",0)*n,this.getValue($,"bendPositive",!0)?1:-1,this.getValue($,"compress",!1),this.getValue($,"stretch",!1)),this.readCurve($,Q,J),J++}a.push(Q),i=Math.max(i,Q.frames[(Q.getFrameCount()-1)*Tt.ENTRIES])}if(t.transform)for(var tt in t.transform){var et=t.transform[tt],rt=r.findTransformConstraint(tt),nt=new It(et.length);nt.transformConstraintIndex=r.transformConstraints.indexOf(rt);for(var at=0,it=0;it<et.length;it++){var st=et[it];nt.setFrame(at,this.getValue(st,"time",0),this.getValue(st,"rotateMix",1),this.getValue(st,"translateMix",1),this.getValue(st,"scaleMix",1),this.getValue(st,"shearMix",1)),this.readCurve(st,nt,at),at++}a.push(nt),i=Math.max(i,nt.frames[(nt.getFrameCount()-1)*It.ENTRIES])}if(t.path)for(var ot in t.path){var ht=t.path[ot],lt=r.findPathConstraintIndex(ot);if(-1==lt)throw new Error("Path constraint not found: "+ot);var ut=r.pathConstraints[lt];for(var ct in ht){var dt=ht[ct];if("position"===ct||"spacing"===ct){var vt=null,bt=1;"spacing"===ct?(vt=new Ct(dt.length),ut.spacingMode!=D.Length&&ut.spacingMode!=D.Fixed||(bt=n)):(vt=new Rt(dt.length),ut.positionMode==B.Fixed&&(bt=n)),vt.pathConstraintIndex=lt;for(var Vt=0,Pt=0;Pt<dt.length;Pt++){var _t=dt[Pt];vt.setFrame(Vt,this.getValue(_t,"time",0),this.getValue(_t,ct,0)*bt),this.readCurve(_t,vt,Vt),Vt++}a.push(vt),i=Math.max(i,vt.frames[(vt.getFrameCount()-1)*Rt.ENTRIES])}else if("mix"===ct){var Ft=new kt(dt.length);Ft.pathConstraintIndex=lt;for(var Nt=0,Ot=0;Ot<dt.length;Ot++){var Lt=dt[Ot];Ft.setFrame(Nt,this.getValue(Lt,"time",0),this.getValue(Lt,"rotateMix",1),this.getValue(Lt,"translateMix",1)),this.readCurve(Lt,Ft,Nt),Nt++}a.push(Ft),i=Math.max(i,Ft.frames[(Ft.getFrameCount()-1)*kt.ENTRIES])}}}if(t.deform)for(var Xt in t.deform){var Bt=t.deform[Xt],Dt=r.findSkin(Xt);if(null==Dt)throw new Error("Skin not found: "+Xt);for(var Yt in Bt){var Ut=Bt[Yt],Wt=r.findSlotIndex(Yt);if(-1==Wt)throw new Error("Slot not found: "+Ut.name);for(var qt in Ut){var Ht=Ut[qt],jt=Dt.getAttachment(Wt,qt);if(null==jt)throw new Error("Deform attachment not found: "+Ht.name);var Gt=null!=jt.bones,zt=jt.vertices,Zt=Gt?zt.length/3*2:zt.length,Qt=new St(Ht.length);Qt.slotIndex=Wt,Qt.attachment=jt;for(var Jt=0,Kt=0;Kt<Ht.length;Kt++){var $t=Ht[Kt],te=void 0,ee=this.getValue($t,"vertices",null);if(null==ee)te=Gt?F.newFloatArray(Zt):zt;else{te=F.newFloatArray(Zt);var re=this.getValue($t,"offset",0);if(F.arrayCopy(ee,0,te,re,ee.length),1!=n)for(var ne=re,ie=ne+ee.length;ne<ie;ne++)te[ne]*=n;if(!Gt)for(var se=0;se<Zt;se++)te[se]+=zt[se]}Qt.setFrame(Jt,this.getValue($t,"time",0),te),this.readCurve($t,Qt,Jt),Jt++}a.push(Qt),i=Math.max(i,Qt.frames[Qt.getFrameCount()-1])}}}var oe=t.drawOrder;if(null==oe&&(oe=t.draworder),null!=oe){for(var he=new At(oe.length),le=r.slots.length,ue=0,ce=0;ce<oe.length;ce++){var de=oe[ce],fe=null,ve=this.getValue(de,"offsets",null);if(null!=ve){fe=F.newArray(le,-1);for(var pe=F.newArray(le-ve.length,0),ge=0,me=0,we=0;we<ve.length;we++){var Ee=ve[we],xe=r.findSlotIndex(Ee.slot);if(-1==xe)throw new Error("Slot not found: "+Ee.slot);for(;ge!=xe;)pe[me++]=ge++;fe[ge+Ee.offset]=ge++}for(;ge<le;)pe[me++]=ge++;for(var ye=le-1;ye>=0;ye--)-1==fe[ye]&&(fe[ye]=pe[--me])}he.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(he),i=Math.max(i,he.frames[he.getFrameCount()-1])}if(t.events){for(var be=new Mt(t.events.length),Se=0,Me=0;Me<t.events.length;Me++){var Ae=t.events[Me],Te=r.findEvent(Ae.name);if(null==Te)throw new Error("Event not found: "+Ae.name);var Ie=new ae(F.toSinglePrecision(this.getValue(Ae,"time",0)),Te);Ie.intValue=this.getValue(Ae,"int",Te.intValue),Ie.floatValue=this.getValue(Ae,"float",Te.floatValue),Ie.stringValue=this.getValue(Ae,"string",Te.stringValue),null!=Ie.data.audioPath&&(Ie.volume=this.getValue(Ae,"volume",1),Ie.balance=this.getValue(Ae,"balance",0)),be.setFrame(Se++,Ie)}a.push(be),i=Math.max(i,be.frames[be.getFrameCount()-1])}if(isNaN(i))throw new Error("Error while parsing animation, duration is NaN");r.animations.push(new ft(e,a,i))},e.readCurve=function(t,e,r){if(t.hasOwnProperty("curve"))if("stepped"==t.curve)e.setStepped(r);else{var n=t.curve;e.setCurve(r,n,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}},e.getValue=function(t,e,r){return void 0!==t[e]?t[e]:r},t.blendModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return Ht.Normal;if("additive"==t)return Ht.Additive;if("multiply"==t)return Ht.Multiply;if("screen"==t)return Ht.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return B.Fixed;if("percent"==t)return B.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return D.Length;if("fixed"==t)return D.Fixed;if("percent"==t)return D.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return Y.Tangent;if("chain"==t)return Y.Chain;if("chainscale"==t)return Y.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return N.Normal;if("onlytranslation"==t)return N.OnlyTranslation;if("norotationorreflection"==t)return N.NoRotationOrReflection;if("noscale"==t)return N.NoScale;if("noscaleorreflection"==t)return N.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),se=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,this.inheritDeform=a};!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(ne||(ne={}));var oe=function(){function t(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}var e=t.prototype;return e.readSkeletonData=function(e){var r=this.scale,n=new Qt;n.name="";var a=new he(e);if(n.hash=a.readString(),n.version=a.readString(),"3.8.75"==n.version)throw new Error("Unsupported skeleton data, please export with a newer version of Spine.");n.x=a.readFloat(),n.y=a.readFloat(),n.width=a.readFloat(),n.height=a.readFloat();var i=a.readBoolean();i&&(n.fps=a.readFloat(),n.imagesPath=a.readString(),n.audioPath=a.readString());var s=0;s=a.readInt(!0);for(var o=0;o<s;o++)a.strings.push(a.readString());s=a.readInt(!0);for(var h=0;h<s;h++){var l=a.readString(),u=0==h?null:n.bones[a.readInt(!0)],c=new X(h,l,u);c.rotation=a.readFloat(),c.x=a.readFloat()*r,c.y=a.readFloat()*r,c.scaleX=a.readFloat(),c.scaleY=a.readFloat(),c.shearX=a.readFloat(),c.shearY=a.readFloat(),c.length=a.readFloat()*r,c.transformMode=t.TransformModeValues[a.readInt(!0)],c.skinRequired=a.readBoolean(),i&&P.rgba8888ToColor(c.color,a.readInt32()),n.bones.push(c)}s=a.readInt(!0);for(var d=0;d<s;d++){var f=a.readString(),v=n.bones[a.readInt(!0)],p=new Jt(d,f,v);P.rgba8888ToColor(p.color,a.readInt32());var g=a.readInt32();-1!=g&&P.rgb888ToColor(p.darkColor=new P,g),p.attachmentName=a.readStringRef(),p.blendMode=t.BlendModeValues[a.readInt(!0)],n.slots.push(p)}s=a.readInt(!0);for(var m,w=0;w<s;w++){var E=new Kt(a.readString());E.order=a.readInt(!0),E.skinRequired=a.readBoolean(),m=a.readInt(!0);for(var x=0;x<m;x++)E.bones.push(n.bones[a.readInt(!0)]);E.target=n.bones[a.readInt(!0)],E.mix=a.readFloat(),E.softness=a.readFloat()*r,E.bendDirection=a.readByte(),E.compress=a.readBoolean(),E.stretch=a.readBoolean(),E.uniform=a.readBoolean(),n.ikConstraints.push(E)}s=a.readInt(!0);for(var y,b=0;b<s;b++){var S=new $t(a.readString());S.order=a.readInt(!0),S.skinRequired=a.readBoolean(),y=a.readInt(!0);for(var M=0;M<y;M++)S.bones.push(n.bones[a.readInt(!0)]);S.target=n.bones[a.readInt(!0)],S.local=a.readBoolean(),S.relative=a.readBoolean(),S.offsetRotation=a.readFloat(),S.offsetX=a.readFloat()*r,S.offsetY=a.readFloat()*r,S.offsetScaleX=a.readFloat(),S.offsetScaleY=a.readFloat(),S.offsetShearY=a.readFloat(),S.rotateMix=a.readFloat(),S.translateMix=a.readFloat(),S.scaleMix=a.readFloat(),S.shearMix=a.readFloat(),n.transformConstraints.push(S)}s=a.readInt(!0);for(var A,T=0;T<s;T++){var I=new G(a.readString());I.order=a.readInt(!0),I.skinRequired=a.readBoolean(),A=a.readInt(!0);for(var R=0;R<A;R++)I.bones.push(n.bones[a.readInt(!0)]);I.target=n.slots[a.readInt(!0)],I.positionMode=t.PositionModeValues[a.readInt(!0)],I.spacingMode=t.SpacingModeValues[a.readInt(!0)],I.rotateMode=t.RotateModeValues[a.readInt(!0)],I.offsetRotation=a.readFloat(),I.position=a.readFloat(),I.positionMode==B.Fixed&&(I.position*=r),I.spacing=a.readFloat(),I.spacingMode!=D.Length&&I.spacingMode!=D.Fixed||(I.spacing*=r),I.rotateMix=a.readFloat(),I.translateMix=a.readFloat(),n.pathConstraints.push(I)}var C=this.readSkin(a,n,!0,i);null!=C&&(n.defaultSkin=C,n.skins.push(C));var k=n.skins.length;for(F.setArraySize(n.skins,s=k+a.readInt(!0));k<s;k++)n.skins[k]=this.readSkin(a,n,!1,i);s=this.linkedMeshes.length;for(var V=0;V<s;V++){var _=this.linkedMeshes[V],N=null==_.skin?n.defaultSkin:n.findSkin(_.skin);if(null==N)throw new Error("Skin not found: "+_.skin);var O=N.getAttachment(_.slotIndex,_.parent);if(null==O)throw new Error("Parent mesh not found: "+_.parent);_.mesh.deformAttachment=_.inheritDeform?O:_.mesh,_.mesh.setParentMesh(O),_.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var L=0;L<s;L++){var Y=new re(a.readStringRef());Y.intValue=a.readInt(!1),Y.floatValue=a.readFloat(),Y.stringValue=a.readString(),Y.audioPath=a.readString(),null!=Y.audioPath&&(Y.volume=a.readFloat(),Y.balance=a.readFloat()),n.events.push(Y)}s=a.readInt(!0);for(var U=0;U<s;U++)n.animations.push(this.readAnimation(a,a.readString(),n));return n},e.readSkin=function(t,e,r,n){var a=null,i=0;if(r){if(0==(i=t.readInt(!0)))return null;a=new ee("default")}else{(a=new ee(t.readStringRef())).bones.length=t.readInt(!0);for(var s=0,o=a.bones.length;s<o;s++)a.bones[s]=e.bones[t.readInt(!0)];for(var h=0,l=t.readInt(!0);h<l;h++)a.constraints.push(e.ikConstraints[t.readInt(!0)]);for(var u=0,c=t.readInt(!0);u<c;u++)a.constraints.push(e.transformConstraints[t.readInt(!0)]);for(var d=0,f=t.readInt(!0);d<f;d++)a.constraints.push(e.pathConstraints[t.readInt(!0)]);i=t.readInt(!0)}for(var v=0;v<i;v++)for(var p=t.readInt(!0),g=0,m=t.readInt(!0);g<m;g++){var w=t.readStringRef(),E=this.readAttachment(t,e,a,p,w,n);null!=E&&a.setAttachment(p,w,E)}return a},e.readAttachment=function(e,r,n,a,i,s){var o=this.scale,h=e.readStringRef();null==h&&(h=i);var l=e.readByte();switch(t.AttachmentTypeValues[l]){case ne.Region:var u=e.readStringRef(),c=e.readFloat(),d=e.readFloat(),f=e.readFloat(),v=e.readFloat(),p=e.readFloat(),g=e.readFloat(),m=e.readFloat(),w=e.readInt32();null==u&&(u=h);var E=this.attachmentLoader.newRegionAttachment(n,h,u);return null==E?null:(E.path=u,E.x=d*o,E.y=f*o,E.scaleX=v,E.scaleY=p,E.rotation=c,E.width=g*o,E.height=m*o,P.rgba8888ToColor(E.color,w),E.updateOffset(),E);case ne.BoundingBox:var x=e.readInt(!0),y=this.readVertices(e,x),b=s?e.readInt32():0,S=this.attachmentLoader.newBoundingBoxAttachment(n,h);return null==S?null:(S.worldVerticesLength=x<<1,S.vertices=y.vertices,S.bones=y.bones,s&&P.rgba8888ToColor(S.color,b),S);case ne.Mesh:var M=e.readStringRef(),A=e.readInt32(),T=e.readInt(!0),I=this.readFloatArray(e,T<<1,1),R=this.readShortArray(e),C=this.readVertices(e,T),k=e.readInt(!0),V=null,_=0,N=0;s&&(V=this.readShortArray(e),_=e.readFloat(),N=e.readFloat()),null==M&&(M=h);var O=this.attachmentLoader.newMeshAttachment(n,h,M);return null==O?null:(O.path=M,P.rgba8888ToColor(O.color,A),O.bones=C.bones,O.vertices=C.vertices,O.worldVerticesLength=T<<1,O.triangles=R,O.regionUVs=I,O.updateUVs(),O.hullLength=k<<1,s&&(O.edges=V,O.width=_*o,O.height=N*o),O);case ne.LinkedMesh:var L=e.readStringRef(),X=e.readInt32(),B=e.readStringRef(),D=e.readStringRef(),Y=e.readBoolean(),U=0,W=0;s&&(U=e.readFloat(),W=e.readFloat()),null==L&&(L=h);var q=this.attachmentLoader.newMeshAttachment(n,h,L);return null==q?null:(q.path=L,P.rgba8888ToColor(q.color,X),s&&(q.width=U*o,q.height=W*o),this.linkedMeshes.push(new le(q,B,a,D,Y)),q);case ne.Path:for(var H=e.readBoolean(),j=e.readBoolean(),G=e.readInt(!0),z=this.readVertices(e,G),Z=F.newArray(G/3,0),Q=0,J=Z.length;Q<J;Q++)Z[Q]=e.readFloat()*o;var K=s?e.readInt32():0,$=this.attachmentLoader.newPathAttachment(n,h);return null==$?null:($.closed=H,$.constantSpeed=j,$.worldVerticesLength=G<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&P.rgba8888ToColor($.color,K),$);case ne.Point:var tt=e.readFloat(),et=e.readFloat(),rt=e.readFloat(),nt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(n,h);return null==at?null:(at.x=et*o,at.y=rt*o,at.rotation=tt,s&&P.rgba8888ToColor(at.color,nt),at);case ne.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),ht=s?e.readInt32():0,lt=this.attachmentLoader.newClippingAttachment(n,h);return null==lt?null:(lt.endSlot=r.slots[it],lt.worldVerticesLength=st<<1,lt.vertices=ot.vertices,lt.bones=ot.bones,s&&P.rgba8888ToColor(lt.color,ht),lt)}return null},e.readVertices=function(t,e){var r=e<<1,n=new ue,a=this.scale;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,a),n;for(var i=new Array,s=new Array,o=0;o<e;o++){var h=t.readInt(!0);s.push(h);for(var l=0;l<h;l++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return n.vertices=F.toFloatArray(i),n.bones=s,n},e.readFloatArray=function(t,e,r){var n=new Array(e);if(1==r)for(var a=0;a<e;a++)n[a]=t.readFloat();else for(var i=0;i<e;i++)n[i]=t.readFloat()*r;return n},e.readShortArray=function(t){for(var e=t.readInt(!0),r=new Array(e),n=0;n<e;n++)r[n]=t.readShort();return r},e.readAnimation=function(e,r,n){for(var a=new Array,i=this.scale,s=0,o=new P,h=new P,l=0,u=e.readInt(!0);l<u;l++)for(var c=e.readInt(!0),d=0,f=e.readInt(!0);d<f;d++){var v=e.readByte(),p=e.readInt(!0);switch(v){case t.SLOT_ATTACHMENT:var g=new yt(p);g.slotIndex=c;for(var m=0;m<p;m++)g.setFrame(m,e.readFloat(),e.readStringRef());a.push(g),s=Math.max(s,g.frames[p-1]);break;case t.SLOT_COLOR:var w=new Et(p);w.slotIndex=c;for(var E=0;E<p;E++){var x=e.readFloat();P.rgba8888ToColor(o,e.readInt32()),w.setFrame(E,x,o.r,o.g,o.b,o.a),E<p-1&&this.readCurve(e,E,w)}a.push(w),s=Math.max(s,w.frames[(p-1)*Et.ENTRIES]);break;case t.SLOT_TWO_COLOR:var y=new xt(p);y.slotIndex=c;for(var b=0;b<p;b++){var S=e.readFloat();P.rgba8888ToColor(o,e.readInt32()),P.rgb888ToColor(h,e.readInt32()),y.setFrame(b,S,o.r,o.g,o.b,o.a,h.r,h.g,h.b),b<p-1&&this.readCurve(e,b,y)}a.push(y),s=Math.max(s,y.frames[(p-1)*xt.ENTRIES])}}for(var M=0,A=e.readInt(!0);M<A;M++)for(var T=e.readInt(!0),I=0,R=e.readInt(!0);I<R;I++){var C=e.readByte(),k=e.readInt(!0);switch(C){case t.BONE_ROTATE:var V=new pt(k);V.boneIndex=T;for(var _=0;_<k;_++)V.setFrame(_,e.readFloat(),e.readFloat()),_<k-1&&this.readCurve(e,_,V);a.push(V),s=Math.max(s,V.frames[(k-1)*pt.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var N=void 0,O=1;C==t.BONE_SCALE?N=new mt(k):C==t.BONE_SHEAR?N=new wt(k):(N=new gt(k),O=i),N.boneIndex=T;for(var L=0;L<k;L++)N.setFrame(L,e.readFloat(),e.readFloat()*O,e.readFloat()*O),L<k-1&&this.readCurve(e,L,N);a.push(N),s=Math.max(s,N.frames[(k-1)*gt.ENTRIES])}}for(var X=0,Y=e.readInt(!0);X<Y;X++){var U=e.readInt(!0),W=e.readInt(!0),q=new Tt(W);q.ikConstraintIndex=U;for(var H=0;H<W;H++)q.setFrame(H,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),H<W-1&&this.readCurve(e,H,q);a.push(q),s=Math.max(s,q.frames[(W-1)*Tt.ENTRIES])}for(var j=0,G=e.readInt(!0);j<G;j++){var z=e.readInt(!0),Z=e.readInt(!0),Q=new It(Z);Q.transformConstraintIndex=z;for(var J=0;J<Z;J++)Q.setFrame(J,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),J<Z-1&&this.readCurve(e,J,Q);a.push(Q),s=Math.max(s,Q.frames[(Z-1)*It.ENTRIES])}for(var K=0,$=e.readInt(!0);K<$;K++)for(var tt=e.readInt(!0),et=n.pathConstraints[tt],rt=0,nt=e.readInt(!0);rt<nt;rt++){var at=e.readByte(),it=e.readInt(!0);switch(at){case t.PATH_POSITION:case t.PATH_SPACING:var st=void 0,ot=1;at==t.PATH_SPACING?(st=new Ct(it),et.spacingMode!=D.Length&&et.spacingMode!=D.Fixed||(ot=i)):(st=new Rt(it),et.positionMode==B.Fixed&&(ot=i)),st.pathConstraintIndex=tt;for(var ht=0;ht<it;ht++)st.setFrame(ht,e.readFloat(),e.readFloat()*ot),ht<it-1&&this.readCurve(e,ht,st);a.push(st),s=Math.max(s,st.frames[(it-1)*Rt.ENTRIES]);break;case t.PATH_MIX:var lt=new kt(it);lt.pathConstraintIndex=tt;for(var ut=0;ut<it;ut++)lt.setFrame(ut,e.readFloat(),e.readFloat(),e.readFloat()),ut<it-1&&this.readCurve(e,ut,lt);a.push(lt),s=Math.max(s,lt.frames[(it-1)*kt.ENTRIES])}}for(var ct=0,dt=e.readInt(!0);ct<dt;ct++)for(var vt=n.skins[e.readInt(!0)],bt=0,Vt=e.readInt(!0);bt<Vt;bt++)for(var Pt=e.readInt(!0),_t=0,Ft=e.readInt(!0);_t<Ft;_t++){var Nt=vt.getAttachment(Pt,e.readStringRef()),Ot=null!=Nt.bones,Lt=Nt.vertices,Xt=Ot?Lt.length/3*2:Lt.length,Bt=e.readInt(!0),Dt=new St(Bt);Dt.slotIndex=Pt,Dt.attachment=Nt;for(var Yt=0;Yt<Bt;Yt++){var Ut=e.readFloat(),Wt=void 0,qt=e.readInt(!0);if(0==qt)Wt=Ot?F.newFloatArray(Xt):Lt;else{Wt=F.newFloatArray(Xt);var Ht=e.readInt(!0);if(qt+=Ht,1==i)for(var jt=Ht;jt<qt;jt++)Wt[jt]=e.readFloat();else for(var Gt=Ht;Gt<qt;Gt++)Wt[Gt]=e.readFloat()*i;if(!Ot)for(var zt=0,Zt=Wt.length;zt<Zt;zt++)Wt[zt]+=Lt[zt]}Dt.setFrame(Yt,Ut,Wt),Yt<Bt-1&&this.readCurve(e,Yt,Dt)}a.push(Dt),s=Math.max(s,Dt.frames[Bt-1])}var Qt=e.readInt(!0);if(Qt>0){for(var Jt=new At(Qt),Kt=n.slots.length,$t=0;$t<Qt;$t++){for(var te=e.readFloat(),ee=e.readInt(!0),re=F.newArray(Kt,0),ne=Kt-1;ne>=0;ne--)re[ne]=-1;for(var ie=F.newArray(Kt-ee,0),se=0,oe=0,he=0;he<ee;he++){for(var le=e.readInt(!0);se!=le;)ie[oe++]=se++;re[se+e.readInt(!0)]=se++}for(;se<Kt;)ie[oe++]=se++;for(var ue=Kt-1;ue>=0;ue--)-1==re[ue]&&(re[ue]=ie[--oe]);Jt.setFrame($t,te,re)}a.push(Jt),s=Math.max(s,Jt.frames[Qt-1])}var ce=e.readInt(!0);if(ce>0){for(var de=new Mt(ce),fe=0;fe<ce;fe++){var ve=e.readFloat(),pe=n.events[e.readInt(!0)],ge=new ae(ve,pe);ge.intValue=e.readInt(!1),ge.floatValue=e.readFloat(),ge.stringValue=e.readBoolean()?e.readString():pe.stringValue,null!=ge.data.audioPath&&(ge.volume=e.readFloat(),ge.balance=e.readFloat()),de.setFrame(fe,ge)}a.push(de),s=Math.max(s,de.frames[ce-1])}return new ft(r,a,s)},e.readCurve=function(e,r,n){switch(e.readByte()){case t.CURVE_STEPPED:n.setStepped(r);break;case t.CURVE_BEZIER:this.setCurve(n,r,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat())}},e.setCurve=function(t,e,r,n,a,i){t.setCurve(e,r,n,a,i)},t}();oe.AttachmentTypeValues=[0,1,2,3,4,5,6],oe.TransformModeValues=[N.Normal,N.OnlyTranslation,N.NoRotationOrReflection,N.NoScale,N.NoScaleOrReflection],oe.PositionModeValues=[B.Fixed,B.Percent],oe.SpacingModeValues=[D.Length,D.Fixed,D.Percent],oe.RotateModeValues=[Y.Tangent,Y.Chain,Y.ChainScale],oe.BlendModeValues=[Ht.Normal,Ht.Additive,Ht.Multiply,Ht.Screen],oe.BONE_ROTATE=0,oe.BONE_TRANSLATE=1,oe.BONE_SCALE=2,oe.BONE_SHEAR=3,oe.SLOT_ATTACHMENT=0,oe.SLOT_COLOR=1,oe.SLOT_TWO_COLOR=2,oe.PATH_POSITION=0,oe.PATH_SPACING=1,oe.PATH_MIX=2,oe.CURVE_LINEAR=0,oe.CURVE_STEPPED=1,oe.CURVE_BEZIER=2;var he=function(){function t(t,e,r,n){void 0===e&&(e=new Array),void 0===r&&(r=0),void 0===n&&(n=new DataView(t.buffer)),this.strings=e,this.index=r,this.buffer=n}var e=t.prototype;return e.readByte=function(){return this.buffer.getInt8(this.index++)},e.readShort=function(){var t=this.buffer.getInt16(this.index);return this.index+=2,t},e.readInt32=function(){var t=this.buffer.getInt32(this.index);return this.index+=4,t},e.readInt=function(t){var e=this.readByte(),r=127&e;return 0!=(128&e)&&(r|=(127&(e=this.readByte()))<<7,0!=(128&e)&&(r|=(127&(e=this.readByte()))<<14,0!=(128&e)&&(r|=(127&(e=this.readByte()))<<21,0!=(128&e)&&(r|=(127&(e=this.readByte()))<<28)))),t?r:r>>>1^-(1&r)},e.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},e.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",r=0;r<t;){var n=this.readByte();switch(n>>4){case 12:case 13:e+=String.fromCharCode((31&n)<<6|63&this.readByte()),r+=2;break;case 14:e+=String.fromCharCode((15&n)<<12|(63&this.readByte())<<6|63&this.readByte()),r+=3;break;default:e+=String.fromCharCode(n),r++}}return e},e.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},e.readBoolean=function(){return 0!=this.readByte()},t}(),le=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,this.inheritDeform=a},ue=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e},ce=function(t){function e(){return t.apply(this,arguments)}R(e,t);var r=e.prototype;return r.load=function(t,e){var r=this;return new E((function(n,a){var i,s=e.engine;"spine"!==t.type&&a("Asset type must be spine."),!t.urls&&t.url&&r.checkUrl(t.url)&&(i=r.getResouceFromUrl(t.url)),t.urls&&r.checkUrls(t.urls)&&(i=r.getResouceFromUrls(t.urls));var h,l=!1;h=new jt(null,(function(t){return r.createAdaptiveTexture(t,s)}));var u=i.skeletonFile,c=i.atlasFile,d=i.textureFile;h.onLoadComplete=function(){try{var t;if(l)t=h.get(c);else{var e=h.get(c);t=new ot(e,r.textureAssetPicker.bind(r,h,d))}var i=new Zt(t),f=(r.isBinFile(u)?new oe(i):new ie(i)).readSkeletonData(h.get(u)),v=new x(s),p=v.addComponent(o),g=Ut.getDefaultMaterial(s);p.setMaterial(g),v.addComponent(Ut).setSkeletonData(f),n(v)}catch(t){a(t)}};var f=r.isBinFile(u);u&&c&&d?(f?h.loadBinary(u,null,a):h.loadText(u,null,a),h.loadText(c,null,a),h.loadTexture(d,null,a)):u&&c&&!d?(l=!0,f?h.loadBinary(u,null,a):h.loadText(u,null,a),h.loadTextureAtlas(c,null,a)):a("Resouce param error")}))},r.textureAssetPicker=function(t,e){return t.get(e)},r.createAdaptiveTexture=function(t,e){return new de(t,e)},r.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},r.checkUrl=function(t){var e=this.getExtFromUrl(t);return"json"===e||"bin"===e||(console.error("When use url as params, url must be json or bin file"),!1)},r.getResouceFromUrl=function(t){var e=t,r=t,n=r.indexOf("?");return n>0&&(r=r.substr(0,n)),{skeletonFile:e,atlasFile:r=r.substr(0,r.lastIndexOf("."))+".atlas"}},r.checkUrls=function(t){if(t.length<2)return console.error("When use urls as params, urls should at least contain: json/bin and atlas"),!1;if(t.length>3)return console.error("Spine runtime dont support multiple texture now"),!1;var e=this.getResouceFromUrls(t),r=e.skeletonFile,n=e.atlasFile;return e.textureFile,!(!r||!n)||(console.error("Lack "+(r?"":"skeletonFile")+(n?" atlasFile":"")),!1)},r.getResouceFromUrls=function(t){for(var e,r,n,a=0;a<t.length;a+=1){var i=t[a],s=this.getExtFromUrl(i);"json"!==s&&"bin"!==s||(e=i),"atlas"===s&&(r=i);["png","jpg","webp","jpeg"].includes(s)&&(n=i)}return{skeletonFile:e,atlasFile:r,textureFile:n}},r.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},e}(y);ce=C([w("spine",["json","bin"])],ce);var de=function(t){function e(e,r){var n;return(n=t.call(this,e)||this).texture=new b(r,e.width,e.height),n.texture.setImageSource(e),n.texture.generateMipmaps(),n}R(e,t);var r=e.prototype;return r.setFilters=function(t,e){t===$.Nearest?this.texture.filterMode=S.Point:e===$.MipMapLinearLinear?this.texture.filterMode=S.Trilinear:this.texture.filterMode=S.Bilinear},r.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},r.dispose=function(){},e}(et),fe=function(t){function e(){return t.apply(this,arguments)}R(e,t);var r=e.prototype;return r.load=function(t,e){var r=this;return new E((function(n,a){var i=e.engine;if(t.url)if(r.checkUrl(t.url)){var s,h,l,u,c,d=t.url;u=new jt(null,(function(t){return r.createAdaptiveTexture(t,i)})),(c=d,new Promise((function(t,e){var r=new XMLHttpRequest;r.responseType="json",r.open("GET",c,!0),r.onload=function(){200==r.status?t(r.response):e("status:"+r.status+", "+r.responseText)},r.onerror=function(){e("status:"+r.status+", "+r.responseText)},r.send()}))).then((function(t){if(l=t,t._ext){var e=t._ext,r=e.atlas,n=e.images,i=n[Object.keys(n)[0]];s=r,h=i,u.loadText(r),u.loadTexture(i)}else a("AntG spine json must have ext data")})).catch((function(){a("Resouce json load fail")})),u.onLoadComplete=function(){var t,e=u.get(s);t=new ot(e,r.textureAssetPicker.bind(r,u,h));var a=new Zt(t),c=new ie(a).readSkeletonData(l),d=new x(i),f=d.addComponent(o);f.shaderData.enableMacro("USE_MODEL_MATRIX"),f.shaderData.enableMacro("USE_CUSTOM_TEXTURE");var v=i._spriteDefaultMaterial.clone();f.setMaterial(v),d.addComponent(Ut).setSkeletonData(c),n(d)}}else a("AntG asset must be a json url.");else a("AntG asset must be a json url.")}))},r.textureAssetPicker=function(t,e){return t.get(e)},r.createAdaptiveTexture=function(t,e){return new ve(t,e)},r.checkUrl=function(t){return"json"===this.getExtFromUrl(t)||(console.error("When use url as params, url must be a json file"),!1)},r.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},e}(y);fe=C([w("antg_spine",["json","bin"])],fe);var ve=function(t){function e(e,r){var n;return(n=t.call(this,e)||this).texture=new b(r,e.width,e.height),n.texture.setImageSource(e),n.texture.generateMipmaps(),n}R(e,t);var r=e.prototype;return r.setFilters=function(t,e){t===$.Nearest?this.texture.filterMode=S.Point:e===$.MipMapLinearLinear?this.texture.filterMode=S.Trilinear:this.texture.filterMode=S.Bilinear},r.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},r.dispose=function(){},e}(et);var pe="1.1.0-beta.0";console.log("Galacean spine version :"+pe);export{jt as AssetManager,Zt as AtlasAttachmentLoader,oe as SkeletonBinary,ie as SkeletonJson,Ut as SpineAnimation,et as Texture,ot as TextureAtlas,pe as version};
2
2
  //# sourceMappingURL=module.js.map