@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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@galacean/engine/dist/miniprogram"),e=require("@galacean/engine-miniprogram-adapter");function r(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 n(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function a(){return a=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},a.apply(this,arguments)}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}function s(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 o(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 l(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}"function"==typeof SuppressedError&&SuppressedError;var h=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}(),u=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}();u.WHITE=new u(1,1,1,1),u.RED=new u(1,0,0,1),u.GREEN=new u(0,1,0,1),u.BLUE=new u(0,0,1,1),u.MAGENTA=new u(1,0,1,1);var c=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}();c.PI=3.1415927,c.PI2=2*c.PI,c.radiansToDegrees=180/c.PI,c.radDeg=c.radiansToDegrees,c.degreesToRadians=c.PI/180,c.degRad=c.degreesToRadians;var d=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}();d.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var f,v=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}(),p=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}(),g=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 u,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"}(f||(f={}));var m,w,x,E=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 l=this.skeleton,h=r+90+s,u=l.scaleX,d=l.scaleY;return this.a=c.cosDeg(r+i)*n*u,this.b=c.cosDeg(h)*a*u,this.c=c.sinDeg(r+i)*n*d,this.d=c.sinDeg(h)*a*d,this.worldX=t*u+l.x,void(this.worldY=e*d+l.y)}var v=o.a,p=o.b,g=o.c,m=o.d;switch(this.worldX=v*t+p*e+o.worldX,this.worldY=g*t+m*e+o.worldY,this.data.transformMode){case f.Normal:var w=r+90+s,x=c.cosDeg(r+i)*n,E=c.cosDeg(w)*a,y=c.sinDeg(r+i)*n,b=c.sinDeg(w)*a;return this.a=v*x+p*y,this.b=v*E+p*b,this.c=g*x+m*y,void(this.d=g*E+m*b);case f.OnlyTranslation:var S=r+90+s;this.a=c.cosDeg(r+i)*n,this.b=c.cosDeg(S)*a,this.c=c.sinDeg(r+i)*n,this.d=c.sinDeg(S)*a;break;case f.NoRotationOrReflection:var M=v*v+g*g,T=0;M>1e-4?(M=Math.abs(v*m-p*g)/M,v/=this.skeleton.scaleX,p=(g/=this.skeleton.scaleY)*M,m=v*M,T=Math.atan2(g,v)*c.radDeg):(v=0,g=0,T=90-Math.atan2(m,p)*c.radDeg);var A=r+i-T,I=r+s-T+90,R=c.cosDeg(A)*n,C=c.cosDeg(I)*a,k=c.sinDeg(A)*n,V=c.sinDeg(I)*a;this.a=v*R-p*k,this.b=v*C-p*V,this.c=g*R+m*k,this.d=g*C+m*V;break;case f.NoScale:case f.NoScaleOrReflection:var P=c.cosDeg(r),_=c.sinDeg(r),F=(v*P+p*_)/this.skeleton.scaleX,N=(g*P+m*_)/this.skeleton.scaleY,O=Math.sqrt(F*F+N*N);O>1e-5&&(O=1/O),F*=O,N*=O,O=Math.sqrt(F*F+N*N),this.data.transformMode==f.NoScale&&v*m-p*g<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(O=-O);var B=Math.PI/2+Math.atan2(N,F),L=Math.cos(B)*O,X=Math.sin(B)*O,D=c.cosDeg(i)*n,Y=c.cosDeg(90+s)*a,U=c.sinDeg(i)*n,W=c.sinDeg(90+s)*a;this.a=F*D+L*U,this.b=F*Y+L*W,this.c=N*D+X*U,this.d=N*Y+X*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)*c.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*c.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)*c.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)*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 l=i*a,h=i*e,u=i*r,d=i*n,f=l*this.a-u*this.c,v=l*this.b-u*this.d,p=h*this.c-d*this.a,g=h*this.d-d*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+p*p),this.ascaleX>1e-4){var m=f*g-v*p;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(f*v+p*g,m)*c.radDeg,this.arotation=Math.atan2(p,f)*c.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(v*v+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,v)*c.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=c.sinDeg(t),r=c.cosDeg(t);return Math.atan2(this.a*e-this.c*r,this.d*r-this.b*e)*c.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=c.sinDeg(t),r=c.cosDeg(t);return Math.atan2(r*this.c+e*this.d,r*this.a+e*this.b)*c.radDeg},e.rotateWorld=function(t){var e=this.a,r=this.b,n=this.c,a=this.d,i=c.cosDeg(t),s=c.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}(),y=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 u,this.darkColor=null==t.darkColor?null:new u,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}(),b=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,l=o.a,h=o.b,u=o.c,d=o.d,v=-t.ashearX-t.arotation,p=0,g=0;switch(t.data.transformMode){case f.OnlyTranslation:p=e-t.worldX,g=r-t.worldY;break;case f.NoRotationOrReflection:var m=Math.abs(l*d-h*u)/(l*l+u*u),w=l/t.skeleton.scaleX,x=u/t.skeleton.scaleY;h=-x*m*t.skeleton.scaleX,d=w*m*t.skeleton.scaleY,v+=Math.atan2(x,w)*c.radDeg;default:var E=e-o.worldX,y=r-o.worldY,b=l*d-h*u;p=(E*d-y*h)/b-t.ax,g=(y*l-E*u)/b-t.ay}v+=Math.atan2(g,p)*c.radDeg,t.ascaleX<0&&(v+=180),v>180?v-=360:v<-180&&(v+=360);var S=t.ascaleX,M=t.ascaleY;if(n||a){switch(t.data.transformMode){case f.NoScale:case f.NoScaleOrReflection:p=e-t.worldX,g=r-t.worldY}var T=t.data.length*S,A=Math.sqrt(p*p+g*g);if(n&&A<T||a&&A>T&&T>1e-4){var I=(A/T-1)*s+1;S*=I,i&&(M*=I)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+v*s,S,M,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 l=t.ax,h=t.ay,u=t.ascaleX,d=u,f=t.ascaleY,v=e.ascaleX,p=0,g=0,m=0;u<0?(u=-u,p=180,m=-1):(p=0,m=1),f<0&&(f=-f,m=-m),v<0?(v=-v,g=180):g=0;var w=e.ax,x=0,E=0,y=0,b=t.a,S=t.b,M=t.c,T=t.d,A=Math.abs(u-f)<=1e-4;A?(E=b*w+S*(x=e.ay)+t.worldX,y=M*w+T*x+t.worldY):(x=0,E=b*w+t.worldX,y=M*w+t.worldY);var I=t.parent;b=I.a,S=I.b,M=I.c;var R,C,k=1/(b*(T=I.d)-S*M),V=E-I.worldX,P=y-I.worldY,_=(V*T-P*S)*k-l,F=(P*b-V*M)*k-h,N=Math.sqrt(_*_+F*F),O=e.data.length*v;if(N<1e-4)return this.apply1(t,r,n,!1,i,!1,o),void e.updateWorldTransformWith(w,x,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var B=((V=r-I.worldX)*T-(P=n-I.worldY)*S)*k-l,L=(P*b-V*M)*k-h,X=B*B+L*L;if(0!=s){s*=u*(v+1)/2;var D=Math.sqrt(X),Y=D-N-O*u+s;if(Y>0){var U=Math.min(1,Y/(2*s))-1;X=(B-=(U=(Y-s*(1-U*U))/D)*B)*B+(L-=U*L)*L}}t:if(A){var W=(X-N*N-(O*=u)*O)/(2*N*O);W<-1?W=-1:W>1&&(W=1,i&&(d*=(Math.sqrt(X)/(N+O)-1)*o+1)),C=Math.acos(W)*a,b=N+O*W,S=O*Math.sin(C),R=Math.atan2(L*b-B*S,B*b+L*S)}else{var q=(b=u*O)*b,H=(S=f*O)*S,j=Math.atan2(L,B),G=-2*H*N,z=H-q;if((T=G*G-4*z*(M=H*N*N+q*X-q*H))>=0){var Z=Math.sqrt(T);G<0&&(Z=-Z);var Q=(Z=-(G+Z)/2)/z,J=M/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=X){P=Math.sqrt(X-K*K)*a,R=j-Math.atan2(P,K),C=Math.atan2(P/f,(K-N)/u);break t}}var $=c.PI,tt=N-b,et=tt*tt,rt=0,nt=0,at=N+b,it=at*at,st=0;(M=-b*N/(q-H))>=-1&&M<=1&&(M=Math.acos(M),(T=(V=b*Math.cos(M)+N)*V+(P=S*Math.sin(M))*P)<et&&($=M,et=T,tt=V,rt=P),T>it&&(nt=M,it=T,at=V,st=P)),X<=(et+it)/2?(R=j-Math.atan2(rt*a,tt),C=$*a):(R=j-Math.atan2(st*a,at),C=nt*a)}var ot=Math.atan2(x,w)*m,lt=t.arotation;(R=(R-ot)*c.radDeg+p-lt)>180?R-=360:R<-180&&(R+=360),t.updateWorldTransformWith(l,h,lt+R*o,d,t.ascaleY,0,0),lt=e.arotation,(C=((C+ot)*c.radDeg-e.ashearX)*m+g-lt)>180?C-=360:C<-180&&(C+=360),e.updateWorldTransformWith(w,x,lt+C*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),S=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new p,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,l=a.d,h=i*l-s*o>0?c.degRad:-c.degRad,u=this.data.offsetRotation*h,d=this.data.offsetShearY*h,f=this.bones,v=0,p=f.length;v<p;v++){var g=f[v],m=!1;if(0!=t){var w=g.a,x=g.b,E=g.c,y=g.d,b=Math.atan2(o,i)-Math.atan2(E,w)+u;b>c.PI?b-=c.PI2:b<-c.PI&&(b+=c.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);g.a=S*w-M*E,g.b=S*x-M*y,g.c=M*w+S*E,g.d=M*x+S*y,m=!0}if(0!=e){var T=this.temp;a.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(T.x-g.worldX)*e,g.worldY+=(T.y-g.worldY)*e,m=!0}if(r>0){var A=Math.sqrt(g.a*g.a+g.c*g.c),I=Math.sqrt(i*i+o*o);A>1e-5&&(A=(A+(I-A+this.data.offsetScaleX)*r)/A),g.a*=A,g.c*=A,A=Math.sqrt(g.b*g.b+g.d*g.d),I=Math.sqrt(s*s+l*l),A>1e-5&&(A=(A+(I-A+this.data.offsetScaleY)*r)/A),g.b*=A,g.d*=A,m=!0}if(n>0){var R=g.b,C=g.d,k=Math.atan2(C,R),V=Math.atan2(l,s)-Math.atan2(o,i)-(k-Math.atan2(g.c,g.a));V>c.PI?V-=c.PI2:V<-c.PI&&(V+=c.PI2),V=k+(V+d)*n;var P=Math.sqrt(R*R+C*C);g.b=Math.cos(V)*P,g.d=Math.sin(V)*P,m=!0}m&&(g.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,l=a.d,h=i*l-s*o>0?c.degRad:-c.degRad,u=this.data.offsetRotation*h,d=this.data.offsetShearY*h,f=this.bones,v=0,p=f.length;v<p;v++){var g=f[v],m=!1;if(0!=t){var w=g.a,x=g.b,E=g.c,y=g.d,b=Math.atan2(o,i)+u;b>c.PI?b-=c.PI2:b<-c.PI&&(b+=c.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);g.a=S*w-M*E,g.b=S*x-M*y,g.c=M*w+S*E,g.d=M*x+S*y,m=!0}if(0!=e){var T=this.temp;a.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),g.worldX+=T.x*e,g.worldY+=T.y*e,m=!0}if(r>0){var A=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*r+1;g.a*=A,g.c*=A,A=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*r+1,g.b*=A,g.d*=A,m=!0}if(n>0){var I=Math.atan2(l,s)-Math.atan2(o,i);I>c.PI?I-=c.PI2:I<-c.PI&&(I+=c.PI2);var R=g.b,C=g.d;I=Math.atan2(C,R)+(I-c.PI/2+d)*n;var k=Math.sqrt(R*R+C*C);g.b=Math.cos(I)*k,g.d=Math.sin(I)*k,m=!0}m&&(g.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 l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;if(0!=t){var u=a.arotation-h+this.data.offsetRotation;h+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=l.ax,d=l.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=l.ascaleX,v=l.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=l.ashearY;if(0!=n){var g=a.ashearY-p+this.data.offsetShearY;g-=360*(16384-(16384.499999999996-g/360|0)),l.shearY+=g*n}l.updateWorldTransformWith(c,d,h,f,v,l.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 l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;0!=t&&(h+=(a.arotation+this.data.offsetRotation)*t);var u=l.ax,c=l.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=l.ascaleX,f=l.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=l.ashearY;0!=n&&(v+=(a.ashearY+this.data.offsetShearY)*n),l.updateWorldTransformWith(u,c,h,d,f,l.ashearX,v)}},t}(),M=function(t,e,r){this.name=t,this.order=e,this.skinRequired=r},T=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r}return s(e,t),e}(M);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(m||(m={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(w||(w={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(x||(x={}));var A=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},I=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}s(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,l=this.vertices,h=this.bones;if(null!=h){for(var u=0,c=0,d=0;d<e;d+=2){var f=h[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,x=h[u++];for(x+=u;u<x;u++,g+=3){var E=v[h[u]],y=l[g],b=l[g+1],S=l[g+2];m+=(y*E.a+b*E.b+E.worldX)*S,w+=(y*E.c+b*E.d+E.worldY)*S}n[p]=m,n[p+1]=w}else for(var M=o,T=a,A=3*c,I=c<<1;T<r;T+=i){var R=0,C=0,k=h[u++];for(k+=u;u<k;u++,A+=3,I+=2){var V=v[h[u]],P=l[A]+M[I],_=l[A+1]+M[I+1],F=l[A+2];R+=(P*V.a+_*V.b+V.worldX)*F,C+=(P*V.c+_*V.d+V.worldY)*F}n[T]=R,n[T+1]=C}}else{o.length>0&&(l=o);for(var N=t.bone,O=N.worldX,B=N.worldY,L=N.a,X=N.b,D=N.c,Y=N.d,U=e,W=a;W<r;U+=2,W+=i){var q=l[U],H=l[U+1];n[W]=q*L+H*X+O,n[W+1]=q*D+H*Y+B}}},r.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),d.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=d.newFloatArray(this.vertices.length),d.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(A);I.nextID=0;var R=function(t){function e(e){var r;return(r=t.call(this,e)||this).closed=!1,r.constantSpeed=!1,r.color=new u(1,1,1,1),r}return s(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),d.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(I),C=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(l(e,R)){var r=this.rotateMix,n=this.translateMix,a=r>0;if(n>0||a){var i=this.data,s=i.spacingMode==w.Percent,o=i.rotateMode,h=o==x.Tangent,u=o==x.ChainScale,f=this.bones.length,v=h?f:f+1,p=this.bones,g=d.setArraySize(this.spaces,v),E=null,y=this.spacing;if(u||!s){u&&(E=d.setArraySize(this.lengths,f));for(var b=i.spacingMode==w.Length,S=0,M=v-1;S<M;){var T=p[S],A=T.data.length;if(A<t.epsilon)u&&(E[S]=0),g[++S]=0;else if(s){if(u){var I=A*T.a,C=A*T.c,k=Math.sqrt(I*I+C*C);E[S]=k}g[++S]=y}else{var V=A*T.a,P=A*T.c,_=Math.sqrt(V*V+P*P);u&&(E[S]=_),g[++S]=(b?A+y:y)*_/A}}}else for(var F=1;F<v;F++)g[F]=y;var N=this.computeWorldPositions(e,v,h,i.positionMode==m.Percent,s),O=N[0],B=N[1],L=i.offsetRotation,X=!1;if(0==L)X=o==x.Chain;else{X=!1;var D=this.target.bone;L*=D.a*D.d-D.b*D.c>0?c.degRad:-c.degRad}for(var Y=0,U=3;Y<f;Y++,U+=3){var W=p[Y];W.worldX+=(O-W.worldX)*n,W.worldY+=(B-W.worldY)*n;var q=N[U],H=N[U+1],j=q-O,G=H-B;if(u){var z=E[Y];if(0!=z){var Z=(Math.sqrt(j*j+G*G)/z-1)*r+1;W.a*=Z,W.c*=Z}}if(O=q,B=H,a){var Q=W.a,J=W.b,K=W.c,$=W.d,tt=0,et=0,rt=0;if(tt=h?N[U-1]:0==g[Y+1]?N[U+2]:Math.atan2(G,j),tt-=Math.atan2(K,Q),X){et=Math.cos(tt),rt=Math.sin(tt);var nt=W.data.length;O+=(nt*(et*Q-rt*K)-j)*r,B+=(nt*(rt*Q+et*K)-G)*r}else tt+=L;tt>c.PI?tt-=c.PI2:tt<-c.PI&&(tt+=c.PI2),tt*=r,et=Math.cos(tt),rt=Math.sin(tt),W.a=et*Q-rt*K,W.b=et*J-rt*$,W.c=rt*Q+et*K,W.d=rt*J+et*$}W.appliedValid=!1}}}},e.computeWorldPositions=function(e,r,n,a,i){var s=this.target,o=this.position,l=this.spaces,h=d.setArraySize(this.positions,3*r+2),u=null,c=e.closed,f=e.worldVerticesLength,v=f/6,p=t.NONE;if(!e.constantSpeed){var g=e.lengths,m=g[v-=c?1:2];if(a&&(o*=m),i)for(var w=1;w<r;w++)l[w]*=m;u=d.setArraySize(this.world,8);for(var x=0,E=0,y=0;x<r;x++,E+=3){var b=l[x],S=o+=b;if(c)(S%=m)<0&&(S+=m),y=0;else{if(S<0){p!=t.BEFORE&&(p=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(S,u,0,h,E);continue}if(S>m){p!=t.AFTER&&(p=t.AFTER,e.computeWorldVertices(s,f-6,4,u,0,2)),this.addAfterPosition(S-m,u,0,h,E);continue}}for(;;y++){var M=g[y];if(!(S>M)){if(0==y)S/=M;else{var T=g[y-1];S=(S-T)/(M-T)}break}}y!=p&&(p=y,c&&y==v?(e.computeWorldVertices(s,f-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*y+2,8,u,0,2)),this.addCurvePosition(S,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],h,E,n||x>0&&0==b)}return h}c?(f+=2,u=d.setArraySize(this.world,f),e.computeWorldVertices(s,2,f-4,u,0,2),e.computeWorldVertices(s,0,2,u,f-4,2),u[f-2]=u[0],u[f-1]=u[1]):(v--,f-=4,u=d.setArraySize(this.world,f),e.computeWorldVertices(s,2,f,u,0,2));for(var A=d.setArraySize(this.curves,v),I=0,R=u[0],C=u[1],k=0,V=0,P=0,_=0,F=0,N=0,O=0,B=0,L=0,X=0,D=0,Y=0,U=0,W=0,q=0,H=2;q<v;q++,H+=6)k=u[H],V=u[H+1],P=u[H+2],_=u[H+3],D=2*(O=.1875*(R-2*k+P))+(L=.09375*(3*(k-P)-R+(F=u[H+4]))),Y=2*(B=.1875*(C-2*V+_))+(X=.09375*(3*(V-_)-C+(N=u[H+5]))),U=.75*(k-R)+O+.16666667*L,W=.75*(V-C)+B+.16666667*X,I+=Math.sqrt(U*U+W*W),U+=D,W+=Y,D+=L,Y+=X,I+=Math.sqrt(U*U+W*W),U+=D,W+=Y,I+=Math.sqrt(U*U+W*W),U+=D+L,W+=Y+X,I+=Math.sqrt(U*U+W*W),A[q]=I,R=F,C=N;if(o*=a?I:I/e.lengths[v-1],i)for(var j=1;j<r;j++)l[j]*=I;for(var G=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<r;Z++,Q+=3){var $=l[Z],tt=o+=$;if(c)(tt%=I)<0&&(tt+=I),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,h,Q);continue}if(tt>I){this.addAfterPosition(tt-I,u,f-4,h,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!=p){p=J;var nt=6*J;for(R=u[nt],C=u[nt+1],k=u[nt+2],V=u[nt+3],P=u[nt+4],_=u[nt+5],D=2*(O=.03*(R-2*k+P))+(L=.006*(3*(k-P)-R+(F=u[nt+6]))),Y=2*(B=.03*(C-2*V+_))+(X=.006*(3*(V-_)-C+(N=u[nt+7]))),U=.3*(k-R)+O+.16666667*L,W=.3*(V-C)+B+.16666667*X,z=Math.sqrt(U*U+W*W),G[0]=z,nt=1;nt<8;nt++)U+=D,W+=Y,D+=L,Y+=X,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+L,W+=Y+X,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,R,C,k,V,P,_,F,N,h,Q,n||Z>0&&0==$)}return h},e.addBeforePosition=function(t,e,r,n,a){var i=e[r],s=e[r+1],o=e[r+2]-i,l=e[r+3]-s,h=Math.atan2(l,o);n[a]=i+t*Math.cos(h),n[a+1]=s+t*Math.sin(h),n[a+2]=h},e.addAfterPosition=function(t,e,r,n,a){var i=e[r+2],s=e[r+3],o=i-e[r],l=s-e[r+1],h=Math.atan2(l,o);n[a]=i+t*Math.cos(h),n[a+1]=s+t*Math.sin(h),n[a+2]=h},e.addCurvePosition=function(t,e,r,n,a,i,s,o,l,h,u,c){if(0==t||isNaN(t))return h[u]=e,h[u+1]=r,void(h[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,x=v*w,E=w*t,y=e*g+n*x+i*E+o*f,b=r*g+a*x+s*E+l*f;h[u]=y,h[u+1]=b,c&&(h[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}();C.NONE=-1,C.BEFORE=-2,C.AFTER=-3,C.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 u(1,1,1,1),r.offset=d.newFloatArray(8),r.uvs=d.newFloatArray(8),r.tempColor=new u(1,1,1,1),r}s(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,l=Math.cos(o),h=Math.sin(o),u=n*l+this.x,c=n*h,d=a*l+this.y,f=a*h,v=i*l+this.x,p=i*h,g=s*l+this.y,m=s*h,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,l=t.a,h=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX2],f=i[e.OY2],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX3],f=i[e.OY3],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX4],f=i[e.OY4],r[n]=d*l+f*h+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,d.arrayCopy(this.uvs,0,t.uvs,0,8),d.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(A);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 V,P,_=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"}(V||(V={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(P||(P={}));var F,N,O,B=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},L=function(t){function e(){return t.apply(this,arguments)}s(e,t);var r=e.prototype;return r.setFilters=function(t,e){},r.setWraps=function(t,e){},r.dispose=function(){},e}(_),X=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 D(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 U;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 l=parseInt(n[0]),h=parseInt(n[1]);r.readTuple(n);var u=parseInt(n[0]),c=parseInt(n[1]);s.u=l/a.width,s.v=h/a.height,s.rotate?(s.u2=(l+c)/a.width,s.v2=(h+u)/a.height):(s.u2=(l+u)/a.width,s.v2=(h+c)/a.height),s.x=l,s.y=h,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 Y).name=i,2==r.readTuple(n)&&(a.width=parseInt(n[0]),a.height=parseInt(n[1]),r.readTuple(n)),r.readTuple(n),a.minFilter=_.filterFromString(n[0]),a.magFilter=_.filterFromString(n[1]);var d=r.readValue();a.uWrap=P.ClampToEdge,a.vWrap=P.ClampToEdge,"x"==d?a.uWrap=P.Repeat:"y"==d?a.vWrap=P.Repeat:"xy"==d&&(a.uWrap=a.vWrap=P.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}(),D=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}(),Y=function(){},U=function(t){function e(){return t.apply(this,arguments)}return s(e,t),e}(B),W=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new u(1,1,1,1),r.tempColor=new u(0,0,0,0),r}s(e,t);var r=e.prototype;return r.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=d.newFloatArray(t.length));var e=this.uvs,r=this.uvs.length,n=this.region.u,a=this.region.v,i=0,s=0;if(l(this.region,U)){var o=this.region,h=o.texture.getImage().width,u=o.texture.getImage().height;switch(o.degrees){case 90:n-=(o.originalHeight-o.offsetY-o.height)/h,a-=(o.originalWidth-o.offsetX-o.width)/u,i=o.originalHeight/h,s=o.originalWidth/u;for(var c=0;c<r;c+=2)e[c]=n+t[c+1]*i,e[c+1]=a+(1-t[c])*s;return;case 180:n-=(o.originalWidth-o.offsetX-o.width)/h,a-=o.offsetY/u,i=o.originalWidth/h,s=o.originalHeight/u;for(var f=0;f<r;f+=2)e[f]=n+(1-t[f])*i,e[f+1]=a+(1-t[f+1])*s;return;case 270:n-=o.offsetY/h,a-=o.offsetX/u,i=o.originalHeight/h,s=o.originalWidth/u;for(var v=0;v<r;v+=2)e[v]=n+(1-t[v+1])*i,e[v+1]=a+t[v]*s;return}n-=o.offsetX/h,a-=(o.originalHeight-o.offsetY-o.height)/u,i=o.originalWidth/h,s=o.originalHeight/u}else null==this.region?(n=a=0,i=s=1):(i=this.region.u2-n,s=this.region.v2-a);for(var p=0;p<r;p+=2)e[p]=n+t[p]*i,e[p+1]=a+t[p+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),d.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),d.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),d.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),d.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}(I),q=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 E(r,this,null);else{var a=this.bones[r.parent.index];n=new E(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],l=new y(s,o);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(var h=0;h<t.ikConstraints.length;h++){var c=t.ikConstraints[h];this.ikConstraints.push(new b(c,this))}this.transformConstraints=new Array;for(var d=0;d<t.transformConstraints.length;d++){var f=t.transformConstraints[d];this.transformConstraints.push(new S(f,this))}this.pathConstraints=new Array;for(var v=0;v<t.pathConstraints.length;v++){var p=t.pathConstraints[v];this.pathConstraints.push(new C(p,this))}this.color=new u(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 l=this.bones[i[s].index];do{l.sorted=!1,l.active=!0,l=l.parent}while(null!=l)}var h=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=h.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=h[m];if(w.data.order==g){this.sortIkConstraint(w);continue t}}for(var x=0;x<f;x++){var E=u[x];if(E.data.order==g){this.sortTransformConstraint(E);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&&d.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&&d.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();l(s,R)&&this.sortPathConstraintAttachmentWith(s,n);for(var o=t.bones,h=o.length,u=0;u<h;u++)this.sortBone(o[u]);this._updateCache.push(t);for(var c=0;c<h;c++)this.sortReset(o[c].children);for(var f=0;f<h;f++)o[f].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&d.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(l(t,R)){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,l=0,h=o.length;l<h;l++){var u=o[l],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;d.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,u=n.length;h<u;h++){var c=n[h];if(c.bone.active){var f=0,v=null,p=c.getAttachment();if(l(p,k))f=8,v=d.setArraySize(r,f,0),p.computeWorldVertices(c.bone,v,0,2);else if(l(p,W)){var g=p;f=g.worldVerticesLength,v=d.setArraySize(r,f,0),g.computeWorldVertices(c,0,f,v,0,2)}if(null!=v)for(var m=0,w=v.length;m<w;m+=2){var x=v[m],E=v[m+1];a=Math.min(a,x),i=Math.min(i,E),s=Math.max(s,x),o=Math.max(o,E)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),H=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 l=this.timelines,h=0,u=l.length;h<u;h++)l[h].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"}(F||(F={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(N||(N={})),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"}(O||(O={}));var j=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=d.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),l=.006*(3*(r-a)+1),h=.006*(3*(n-i)+1),u=2*s+l,c=2*o+h,d=.3*r+s+.16666667*l,f=.3*n+o+.16666667*h,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+=l,c+=h,g+=d,m+=f},e.getCurvePercent=function(e,r){r=c.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,l=a+t.BEZIER_SIZE-1;a<l;a+=2)if((s=n[a])>=r){var h=void 0,u=void 0;return a==o?(h=0,u=0):(h=n[a-2],u=n[a-1]),u+(n[a+1]-u)*(r-h)/(s-h)}var d=n[a-1];return d+(1-d)*(r-s)/(1-s)},t}();j.LINEAR=0,j.STEPPED=1,j.BEZIER=2,j.BEZIER_SIZE=19;var G=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=d.newFloatArray(e<<1),r}s(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 l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return void(h.rotation=h.data.rotation);case 1:var u=h.data.rotation-h.rotation;h.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(n>=l[l.length-e.ENTRIES]){var c=l[l.length+e.PREV_ROTATION];switch(s){case 0:h.rotation=h.data.rotation+c*i;break;case 1:case 2:c+=h.data.rotation-h.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:h.rotation+=c*i}}else{var d=H.binarySearch(l,n,e.ENTRIES),f=l[d+e.PREV_ROTATION],v=l[d],p=this.getCurvePercent((d>>1)-1,1-(n-v)/(l[d+e.PREV_TIME]-v)),g=l[d+e.ROTATION]-f;switch(g=f+(g-360*(16384-(16384.499999999996-g/360|0)))*p,s){case 0:h.rotation=h.data.rotation+(g-360*(16384-(16384.499999999996-g/360|0)))*i;break;case 1:case 2:g+=h.data.rotation-h.rotation;case 3:h.rotation+=(g-360*(16384-(16384.499999999996-g/360|0)))*i}}},e}(j);G.ENTRIES=2,G.PREV_TIME=-2,G.PREV_ROTATION=-1,G.ROTATION=1;var z=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.x=h.data.x,void(h.y=h.data.y);case 1:h.x+=(h.data.x-h.x)*i,h.y+=(h.data.y-h.y)*i}else{var u=0,c=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=H.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*v,c+=(l[d+e.Y]-c)*v}switch(s){case 0:h.x=h.data.x+u*i,h.y=h.data.y+c*i;break;case 1:case 2:h.x+=(h.data.x+u-h.x)*i,h.y+=(h.data.y+c-h.y)*i;break;case 3:h.x+=u*i,h.y+=c*i}}},e}(j);z.ENTRIES=3,z.PREV_TIME=-3,z.PREV_X=-2,z.PREV_Y=-1,z.X=1,z.Y=2;var Z=function(t){function e(e){return t.call(this,e)}s(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 l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.scaleX=h.data.scaleX,void(h.scaleY=h.data.scaleY);case 1:h.scaleX+=(h.data.scaleX-h.scaleX)*i,h.scaleY+=(h.data.scaleY-h.scaleY)*i}else{var u=0,d=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X]*h.data.scaleX,d=l[l.length+e.PREV_Y]*h.data.scaleY;else{var f=H.binarySearch(l,n,e.ENTRIES);u=l[f+e.PREV_X],d=l[f+e.PREV_Y];var v=l[f],p=this.getCurvePercent(f/e.ENTRIES-1,1-(n-v)/(l[f+e.PREV_TIME]-v));u=(u+(l[f+e.X]-u)*p)*h.data.scaleX,d=(d+(l[f+e.Y]-d)*p)*h.data.scaleY}if(1==i)3==s?(h.scaleX+=u-h.data.scaleX,h.scaleY+=d-h.data.scaleY):(h.scaleX=u,h.scaleY=d);else{var g=0,m=0;if(1==o)switch(s){case 0:g=h.data.scaleX,m=h.data.scaleY,h.scaleX=g+(Math.abs(u)*c.signum(g)-g)*i,h.scaleY=m+(Math.abs(d)*c.signum(m)-m)*i;break;case 1:case 2:g=h.scaleX,m=h.scaleY,h.scaleX=g+(Math.abs(u)*c.signum(g)-g)*i,h.scaleY=m+(Math.abs(d)*c.signum(m)-m)*i;break;case 3:g=h.scaleX,m=h.scaleY,h.scaleX=g+(Math.abs(u)*c.signum(g)-h.data.scaleX)*i,h.scaleY=m+(Math.abs(d)*c.signum(m)-h.data.scaleY)*i}else switch(s){case 0:g=Math.abs(h.data.scaleX)*c.signum(u),m=Math.abs(h.data.scaleY)*c.signum(d),h.scaleX=g+(u-g)*i,h.scaleY=m+(d-m)*i;break;case 1:case 2:g=Math.abs(h.scaleX)*c.signum(u),m=Math.abs(h.scaleY)*c.signum(d),h.scaleX=g+(u-g)*i,h.scaleY=m+(d-m)*i;break;case 3:g=c.signum(u),m=c.signum(d),h.scaleX=Math.abs(h.scaleX)*g+(u-Math.abs(h.data.scaleX)*g)*i,h.scaleY=Math.abs(h.scaleY)*m+(d-Math.abs(h.data.scaleY)*m)*i}}}},e}(z),Q=function(t){function e(e){return t.call(this,e)}s(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 l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.shearX=h.data.shearX,void(h.shearY=h.data.shearY);case 1:h.shearX+=(h.data.shearX-h.shearX)*i,h.shearY+=(h.data.shearY-h.shearY)*i}else{var u=0,c=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=H.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*v,c+=(l[d+e.Y]-c)*v}switch(s){case 0:h.shearX=h.data.shearX+u*i,h.shearY=h.data.shearY+c*i;break;case 1:case 2:h.shearX+=(h.data.shearX+u-h.shearX)*i,h.shearY+=(h.data.shearY+c-h.shearY)*i;break;case 3:h.shearX+=u*i,h.shearY+=c*i}}},e}(z),J=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(n<h[0])switch(s){case 0:return void l.color.setFromColor(l.data.color);case 1:var u=l.color,c=l.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>=h[h.length-e.ENTRIES]){var g=h.length;d=h[g+e.PREV_R],f=h[g+e.PREV_G],v=h[g+e.PREV_B],p=h[g+e.PREV_A]}else{var m=H.binarySearch(h,n,e.ENTRIES);d=h[m+e.PREV_R],f=h[m+e.PREV_G],v=h[m+e.PREV_B],p=h[m+e.PREV_A];var w=h[m],x=this.getCurvePercent(m/e.ENTRIES-1,1-(n-w)/(h[m+e.PREV_TIME]-w));d+=(h[m+e.R]-d)*x,f+=(h[m+e.G]-f)*x,v+=(h[m+e.B]-v)*x,p+=(h[m+e.A]-p)*x}if(1==i)l.color.set(d,f,v,p);else{var E=l.color;0==s&&E.setFromColor(l.data.color),E.add((d-E.r)*i,(f-E.g)*i,(v-E.b)*i,(p-E.a)*i)}}}},e}(j);J.ENTRIES=5,J.PREV_TIME=-5,J.PREV_R=-4,J.PREV_G=-3,J.PREV_B=-2,J.PREV_A=-1,J.R=1,J.G=2,J.B=3,J.A=4;var K=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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,l,h){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]=l,this.frames[t+e.B2]=h},r.apply=function(t,r,n,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(n<h[0])switch(s){case 0:return l.color.setFromColor(l.data.color),void l.darkColor.setFromColor(l.data.darkColor);case 1:var u=l.color,c=l.darkColor,d=l.data.color,f=l.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,x=0,E=0;if(n>=h[h.length-e.ENTRIES]){var y=h.length;v=h[y+e.PREV_R],p=h[y+e.PREV_G],g=h[y+e.PREV_B],m=h[y+e.PREV_A],w=h[y+e.PREV_R2],x=h[y+e.PREV_G2],E=h[y+e.PREV_B2]}else{var b=H.binarySearch(h,n,e.ENTRIES);v=h[b+e.PREV_R],p=h[b+e.PREV_G],g=h[b+e.PREV_B],m=h[b+e.PREV_A],w=h[b+e.PREV_R2],x=h[b+e.PREV_G2],E=h[b+e.PREV_B2];var S=h[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(n-S)/(h[b+e.PREV_TIME]-S));v+=(h[b+e.R]-v)*M,p+=(h[b+e.G]-p)*M,g+=(h[b+e.B]-g)*M,m+=(h[b+e.A]-m)*M,w+=(h[b+e.R2]-w)*M,x+=(h[b+e.G2]-x)*M,E+=(h[b+e.B2]-E)*M}if(1==i)l.color.set(v,p,g,m),l.darkColor.set(w,x,E,1);else{var T=l.color,A=l.darkColor;0==s&&(T.setFromColor(l.data.color),A.setFromColor(l.data.darkColor)),T.add((v-T.r)*i,(p-T.g)*i,(g-T.b)*i,(m-T.a)*i),A.add((w-A.r)*i,(x-A.g)*i,(E-A.b)*i,0)}}}},e}(j);K.ENTRIES=8,K.PREV_TIME=-8,K.PREV_R=-7,K.PREV_G=-6,K.PREV_B=-5,K.PREV_A=-4,K.PREV_R2=-3,K.PREV_G2=-2,K.PREV_B2=-1,K.R=1,K.G=2,K.B=3,K.A=4,K.R2=5,K.G2=6,K.B2=7;var $=function(){function t(t){this.frames=d.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 l=this.frames;if(r<l[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var h=0;h=r>=l[l.length-1]?l.length-1:H.binarySearch(l,r,1)-1;var u=this.attachmentNames[h];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}(),tt=null,et=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=d.newFloatArray(e),r.frameVertices=new Array(e),null==tt&&(tt=d.newFloatArray(64)),r}s(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(l(h,I)&&h.deformAttachment==this.attachment){var u=o.deform;0==u.length&&(i=0);var c=this.frameVertices,f=c[0].length,v=this.frames;if(r<v[0]){var p=h;switch(i){case 0:return void(u.length=0);case 1:if(1==a){u.length=0;break}var g=d.setArraySize(u,f);if(null==p.bones)for(var m=p.vertices,w=0;w<f;w++)g[w]+=(m[w]-g[w])*a;else{a=1-a;for(w=0;w<f;w++)g[w]*=a}}}else{var x=d.setArraySize(u,f);if(r>=v[v.length-1]){var E=c[v.length-1];if(1==a)if(3==i){var y=h;if(null==y.bones)for(var b=y.vertices,S=0;S<f;S++)x[S]+=E[S]-b[S];else for(var M=0;M<f;M++)x[M]+=E[M]}else d.arrayCopy(E,0,x,0,f);else switch(i){case 0:var T=h;if(null==T.bones)for(var A=T.vertices,R=0;R<f;R++){var C=A[R];x[R]=C+(E[R]-C)*a}else for(var k=0;k<f;k++)x[k]=E[k]*a;break;case 1:case 2:for(var V=0;V<f;V++)x[V]+=(E[V]-x[V])*a;break;case 3:var P=h;if(null==P.bones)for(var _=P.vertices,F=0;F<f;F++)x[F]+=(E[F]-_[F])*a;else for(var N=0;N<f;N++)x[N]+=E[N]*a}}else{var O=H.binarySearch(v,r),B=c[O-1],L=c[O],X=v[O],D=this.getCurvePercent(O-1,1-(r-X)/(v[O-1]-X));if(1==a)if(3==i){var Y=h;if(null==Y.bones)for(var U=Y.vertices,W=0;W<f;W++){var q=B[W];x[W]+=q+(L[W]-q)*D-U[W]}else for(var j=0;j<f;j++){var G=B[j];x[j]+=G+(L[j]-G)*D}}else for(var z=0;z<f;z++){var Z=B[z];x[z]=Z+(L[z]-Z)*D}else switch(i){case 0:var Q=h;if(null==Q.bones)for(var J=Q.vertices,K=0;K<f;K++){var $=B[K],tt=J[K];x[K]=tt+($+(L[K]-$)*D-tt)*a}else for(var et=0;et<f;et++){var rt=B[et];x[et]=(rt+(L[et]-rt)*D)*a}break;case 1:case 2:for(var nt=0;nt<f;nt++){var at=B[nt];x[nt]+=(at+(L[nt]-at)*D-x[nt])*a}break;case 3:var it=h;if(null==it.bones)for(var st=it.vertices,ot=0;ot<f;ot++){var lt=B[ot];x[ot]+=(lt+(L[ot]-lt)*D-st[ot])*a}else for(var ht=0;ht<f;ht++){var ut=B[ht];x[ht]+=(ut+(L[ht]-ut)*D)*a}}}}}}},e}(j),rt=function(){function t(t){this.frames=d.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,l=this.frames.length;if(e>r)this.apply(t,e,Number.MAX_VALUE,n,a,i,s),e=-1;else if(e>=o[l-1])return;if(!(r<o[0])){var h=0;if(e<o[0])h=0;else for(var u=o[h=H.binarySearch(o,e)];h>0&&o[h-1]==u;)h--;for(;h<l&&r>=o[h];h++)n.push(this.events[h])}}},t}(),nt=function(){function t(t){this.frames=d.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,l=t.slots;if(1!=s){var h=this.frames;if(r<h[0])0!=i&&1!=i||d.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=r>=h[h.length-1]?h.length-1:H.binarySearch(h,r)-1;var c=this.drawOrders[u];if(null==c)d.arrayCopy(l,0,o,0,l.length);else for(var f=0,v=c.length;f<v;f++)o[f]=l[c[f]]}}else 0==i&&d.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),at=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=this.frames,h=t.ikConstraints[this.ikConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,void(h.stretch=h.data.stretch);case 1:h.mix+=(h.data.mix-h.mix)*i,h.softness+=(h.data.softness-h.softness)*i,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}else if(n>=l[l.length-e.ENTRIES])0==s?(h.mix=h.data.mix+(l[l.length+e.PREV_MIX]-h.data.mix)*i,h.softness=h.data.softness+(l[l.length+e.PREV_SOFTNESS]-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH])):(h.mix+=(l[l.length+e.PREV_MIX]-h.mix)*i,h.softness+=(l[l.length+e.PREV_SOFTNESS]-h.softness)*i,0==o&&(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH]));else{var u=H.binarySearch(l,n,e.ENTRIES),c=l[u+e.PREV_MIX],d=l[u+e.PREV_SOFTNESS],f=l[u],v=this.getCurvePercent(u/e.ENTRIES-1,1-(n-f)/(l[u+e.PREV_TIME]-f));0==s?(h.mix=h.data.mix+(c+(l[u+e.MIX]-c)*v-h.data.mix)*i,h.softness=h.data.softness+(d+(l[u+e.SOFTNESS]-d)*v-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH])):(h.mix+=(c+(l[u+e.MIX]-c)*v-h.mix)*i,h.softness+=(d+(l[u+e.SOFTNESS]-d)*v-h.softness)*i,0==o&&(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH]))}},e}(j);at.ENTRIES=6,at.PREV_TIME=-6,at.PREV_MIX=-5,at.PREV_SOFTNESS=-4,at.PREV_BEND_DIRECTION=-3,at.PREV_COMPRESS=-2,at.PREV_STRETCH=-1,at.MIX=1,at.SOFTNESS=2,at.BEND_DIRECTION=3,at.COMPRESS=4,at.STRETCH=5;var it=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(h.active)if(n<l[0]){var u=h.data;switch(s){case 0:return h.rotateMix=u.rotateMix,h.translateMix=u.translateMix,h.scaleMix=u.scaleMix,void(h.shearMix=u.shearMix);case 1:h.rotateMix+=(u.rotateMix-h.rotateMix)*i,h.translateMix+=(u.translateMix-h.translateMix)*i,h.scaleMix+=(u.scaleMix-h.scaleMix)*i,h.shearMix+=(u.shearMix-h.shearMix)*i}}else{var c=0,d=0,f=0,v=0;if(n>=l[l.length-e.ENTRIES]){var p=l.length;c=l[p+e.PREV_ROTATE],d=l[p+e.PREV_TRANSLATE],f=l[p+e.PREV_SCALE],v=l[p+e.PREV_SHEAR]}else{var g=H.binarySearch(l,n,e.ENTRIES);c=l[g+e.PREV_ROTATE],d=l[g+e.PREV_TRANSLATE],f=l[g+e.PREV_SCALE],v=l[g+e.PREV_SHEAR];var m=l[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(n-m)/(l[g+e.PREV_TIME]-m));c+=(l[g+e.ROTATE]-c)*w,d+=(l[g+e.TRANSLATE]-d)*w,f+=(l[g+e.SCALE]-f)*w,v+=(l[g+e.SHEAR]-v)*w}if(0==s){var x=h.data;h.rotateMix=x.rotateMix+(c-x.rotateMix)*i,h.translateMix=x.translateMix+(d-x.translateMix)*i,h.scaleMix=x.scaleMix+(f-x.scaleMix)*i,h.shearMix=x.shearMix+(v-x.shearMix)*i}else h.rotateMix+=(c-h.rotateMix)*i,h.translateMix+=(d-h.translateMix)*i,h.scaleMix+=(f-h.scaleMix)*i,h.shearMix+=(v-h.shearMix)*i}},e}(j);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 st=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return void(h.position=h.data.position);case 1:h.position+=(h.data.position-h.position)*i}else{var u=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=H.binarySearch(l,n,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.position=h.data.position+(u-h.data.position)*i:h.position+=(u-h.position)*i}},e}(j);st.ENTRIES=2,st.PREV_TIME=-2,st.PREV_VALUE=-1,st.VALUE=1;var ot=function(t){function e(e){return t.call(this,e)}s(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 l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return void(h.spacing=h.data.spacing);case 1:h.spacing+=(h.data.spacing-h.spacing)*i}else{var u=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=H.binarySearch(l,n,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.spacing=h.data.spacing+(u-h.data.spacing)*i:h.spacing+=(u-h.spacing)*i}},e}(st),lt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.rotateMix=h.data.rotateMix,void(h.translateMix=h.data.translateMix);case 1:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*i,h.translateMix+=(h.data.translateMix-h.translateMix)*i}else{var u=0,c=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_ROTATE],c=l[l.length+e.PREV_TRANSLATE];else{var d=H.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_ROTATE],c=l[d+e.PREV_TRANSLATE];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.ROTATE]-u)*v,c+=(l[d+e.TRANSLATE]-c)*v}0==s?(h.rotateMix=h.data.rotateMix+(u-h.data.rotateMix)*i,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*i):(h.rotateMix+=(u-h.rotateMix)*i,h.translateMix+=(c-h.translateMix)*i)}},e}(j);lt.ENTRIES=3,lt.PREV_TIME=-3,lt.PREV_ROTATE=-2,lt.PREV_TRANSLATE=-1,lt.ROTATE=1,lt.TRANSLATE=2;var ht=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 dt(this),this.propertyIDs=new h,this.animationsChanged=!1,this.trackEntryPool=new v((function(){return new ct})),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 l=a.mixingFrom;for(a.mixingFrom=null,null!=l&&(l.mixingTo=null);null!=l;)this.queue.end(l),l=l.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?F.first:o.mixBlend,u=o.alpha;null!=o.mixingFrom?u*=this.applyMixingFrom(o,e,h):o.trackTime>=o.trackEnd&&null==o.next&&(u=0);var c=o.animationLast,f=o.getAnimationTime(),v=o.animation.timelines.length,p=o.animation.timelines;if(0==i&&1==u||h==F.add)for(var g=0;g<v;g++){d.webkit602BugfixHelper(u,h);var m=p[g];l(m,$)?this.applyAttachmentTimeline(m,e,f,h,!0):m.apply(e,c,f,r,u,h,N.mixIn)}else{var w=o.timelineMode,x=0==o.timelinesRotation.length;x&&d.setArraySize(o.timelinesRotation,v<<1,null);for(var E=o.timelinesRotation,y=0;y<v;y++){var b=p[y],S=w[y]==t.SUBSEQUENT?h:F.setup;l(b,G)?this.applyRotateTimeline(b,e,f,u,S,E,y<<1,x):l(b,$)?this.applyAttachmentTimeline(b,e,f,h,!0):(d.webkit602BugfixHelper(u,h),b.apply(e,c,f,r,u,S,N.mixIn))}}this.queueEvents(o,f),r.length=0,o.nextAnimationLast=f,o.nextTrackLast=o.trackTime}}for(var M=this.unkeyedState+t.SETUP,T=e.slots,A=0,I=e.slots.length;A<I;A++){var R=T[A];if(R.attachmentState==M){var C=R.data.attachmentName;R.attachment=null==C?null:e.getAttachment(R.data.index,C)}}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==F.first&&(n=F.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),n!=F.first&&(n=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,h=i<a.drawOrderThreshold,u=a.animationLast,c=a.getAnimationTime(),f=a.animation.timelines.length,v=a.animation.timelines,p=a.alpha*e.interruptAlpha,g=p*(1-i);if(n==F.add)for(var m=0;m<f;m++)v[m].apply(r,u,c,s,g,n,N.mixOut);else{var w=a.timelineMode,x=a.timelineHoldMix,E=0==a.timelinesRotation.length;E&&d.setArraySize(a.timelinesRotation,f<<1,null);var y=a.timelinesRotation;a.totalAlpha=0;for(var b=0;b<f;b++){var S=v[b],M=N.mixOut,T=void 0,A=0;switch(w[b]){case t.SUBSEQUENT:if(!h&&l(S,nt))continue;T=n,A=g;break;case t.FIRST:T=F.setup,A=g;break;case t.HOLD_SUBSEQUENT:T=n,A=p;break;case t.HOLD_FIRST:T=F.setup,A=p;break;default:T=F.setup;var I=x[b];A=p*Math.max(0,1-I.mixTime/I.mixDuration)}a.totalAlpha+=A,l(S,G)?this.applyRotateTimeline(S,r,c,A,T,y,b<<1,E):l(S,$)?this.applyAttachmentTimeline(S,r,c,T,o):(d.webkit602BugfixHelper(A,n),h&&l(S,nt)&&T==F.setup&&(M=N.mixIn),S.apply(r,u,c,s,A,T,M))}}return e.mixDuration>0&&this.queueEvents(a,c),this.events.length=0,a.nextAnimationLast=c,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,l=e.frames;if(n<l[0])a!=F.setup&&a!=F.first||this.setAttachment(r,s,s.data.attachmentName,i);else o=n>=l[l.length-1]?l.length-1:H.binarySearch(l,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 l=t,h=l.frames,u=e.bones[l.boneIndex];if(u.active){var d=0,f=0;if(r<h[0])switch(a){case F.setup:u.rotation=u.data.rotation;default:return;case F.first:d=u.rotation,f=u.data.rotation}else if(d=a==F.setup?u.data.rotation:u.rotation,r>=h[h.length-G.ENTRIES])f=u.data.rotation+h[h.length+G.PREV_ROTATION];else{var v=H.binarySearch(h,r,G.ENTRIES),p=h[v+G.PREV_ROTATION],g=h[v],m=l.getCurvePercent((v>>1)-1,1-(r-g)/(h[v+G.PREV_TIME]-g));f=h[v+G.ROTATION]-p,f=p+(f-=360*(16384-(16384.499999999996-f/360|0)))*m+u.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}var w=0,x=f-d;if(0==(x-=360*(16384-(16384.499999999996-x/360|0))))w=i[s];else{var E=0,y=0;o?(E=0,y=x):(E=i[s],y=i[s+1]);var b=x>0,S=E>=0;c.signum(y)!=c.signum(x)&&Math.abs(y)<=90&&(Math.abs(E)>180&&(E+=360*c.signum(E)),S=b),w=x+E-E%360,S!=b&&(w+=360*c.signum(E)),i[s]=w}i[s+1]=x,d+=w*n,u.rotation=d-360*(16384-(16384.499999999996-d/360|0))}}else t.apply(e,0,r,null,1,a,N.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,l=s.length;o<l;o++){var h=s[o];if(h.time<i)break;h.time>n||this.queue.event(t,h)}for((t.loop?0==a||i>t.trackTime%a:e>=n&&t.animationLast<n)&&this.queue.complete(t);o<l;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]:(d.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=F.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==F.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=d.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=d.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 u=0;u<a;u++){var c=n[u],f=c.getPropertyId();if(o.add(f))if(null==r||l(c,$)||l(c,nt)||l(c,rt)||!r.animation.hasTimeline(f))i[u]=t.FIRST;else{for(var v=r.mixingTo;null!=v;v=v.mixingTo)if(!v.animation.hasTimeline(f)){if(e.mixDuration>0){i[u]=t.HOLD_MIX,s[u]=v;continue t}break}i[u]=t.HOLD_FIRST}else i[u]=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}();ht.emptyAnimation=new H("<empty>",[],0),ht.SUBSEQUENT=0,ht.FIRST=1,ht.HOLD_SUBSEQUENT=2,ht.HOLD_FIRST=3,ht.HOLD_MIX=4,ht.SETUP=1,ht.CURRENT=2;var ut,ct=function(){function t(){this.mixBlend=F.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}(),dt=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 l=0;l<e.length;l++)e[l].dispose&&e[l].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var h=0;h<e.length;h++)e[h].complete&&e[h].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"}(ut||(ut={}));var ft=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}(),vt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new u(.2275,.2275,.8078,1),r}return s(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}(I),pt=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 v((function(){return new Array})),this.polygonIndicesPool=new v((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,l=n;o<l;++o)s[o]=t.isConcave(o,n,r,a);var h=this.triangles;for(h.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],x=r[v+1],E=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],T=r[S+1];if(t.positiveArea(E,y,g,m,M,T)&&t.positiveArea(g,m,w,x,M,T)&&t.positiveArea(w,x,E,y,M,T))break t}break}if(0==d){do{if(!s[c])break;c--}while(c>0);break}u=c,c=d,d=(d+1)%n}h.push(a[(n+c-1)%n]),h.push(a[c]),h.push(a[(c+1)%n]),a.splice(c,1),s.splice(c,1);var A=(--n+c-1)%n,I=c==n?0:c;s[A]=t.isConcave(A,n,r,a),s[I]=t.isConcave(I,n,r,a)}return 3==n&&(h.push(a[2]),h.push(a[0]),h.push(a[1])),h},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 l=-1,h=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],x=n[v],E=n[v+1],y=!1;if(l==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],x,E),M=t.winding(x,E,o[0],o[1],o[2],o[3]);S==h&&M==h&&(o.push(x),o.push(E),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(x),o.push(E),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(v),h=t.winding(p,g,m,w,x,E),l=d)}o.length>0&&(a.push(o),i.push(s));for(var T=0,A=a.length;T<A;T++)if(0!=(s=i[T]).length)for(var I=s[0],R=s[s.length-1],C=(o=a[T]).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],B=o[3],L=t.winding(k,V,P,_,F,N),X=0;X<A;X++)if(X!=T){var D=i[X];if(3==D.length){var Y=D[0],U=D[1],W=D[2],q=a[X],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,B);G==L&&z==L&&(q.length=0,D.length=0,o.push(H),o.push(j),s.push(W),k=P,V=_,P=H,_=j,X=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}(),gt=function(){function t(){this.triangulator=new pt,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=d.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,l=s.length;o<l;o++){var h=s[o];t.makeClockwise(h),h.push(h[0]),h.push(h[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 l=this.clipOutput,h=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,f=this.clippingPolygons.length,v=o?12:8,p=0;h.length=0,u.length=0;t:for(var g=0;g<n;g+=3)for(var m=r[g]<<1,w=t[m],x=t[m+1],E=a[m],y=a[m+1],b=t[m=r[g+1]<<1],S=t[m+1],M=a[m],T=a[m+1],A=t[m=r[g+2]<<1],I=t[m+1],R=a[m],C=a[m+1],k=0;k<f;k++){var V=h.length;if(!this.clip(w,x,b,S,A,I,c[k],l)){var P=d.setArraySize(h,V+3*v);P[V]=w,P[V+1]=x,P[V+2]=i.r,P[V+3]=i.g,P[V+4]=i.b,P[V+5]=i.a,o?(P[V+6]=E,P[V+7]=y,P[V+8]=s.r,P[V+9]=s.g,P[V+10]=s.b,P[V+11]=s.a,P[V+12]=b,P[V+13]=S,P[V+14]=i.r,P[V+15]=i.g,P[V+16]=i.b,P[V+17]=i.a,P[V+18]=M,P[V+19]=T,P[V+20]=s.r,P[V+21]=s.g,P[V+22]=s.b,P[V+23]=s.a,P[V+24]=A,P[V+25]=I,P[V+26]=i.r,P[V+27]=i.g,P[V+28]=i.b,P[V+29]=i.a,P[V+30]=R,P[V+31]=C,P[V+32]=s.r,P[V+33]=s.g,P[V+34]=s.b,P[V+35]=s.a):(P[V+6]=E,P[V+7]=y,P[V+8]=b,P[V+9]=S,P[V+10]=i.r,P[V+11]=i.g,P[V+12]=i.b,P[V+13]=i.a,P[V+14]=M,P[V+15]=T,P[V+16]=A,P[V+17]=I,P[V+18]=i.r,P[V+19]=i.g,P[V+20]=i.b,P[V+21]=i.a,P[V+22]=R,P[V+23]=C),V=u.length;var _=d.setArraySize(u,V+3);_[V]=p,_[V+1]=p+1,_[V+2]=p+2,p+=3;continue t}var F=l.length;if(0!=F){for(var N=S-I,O=A-b,B=w-A,L=I-x,X=1/(N*B+O*(x-I)),D=F>>1,Y=this.clipOutput,U=d.setArraySize(h,V+D*v),W=0;W<F;W+=2){var q=Y[W],H=Y[W+1];U[V]=q,U[V+1]=H,U[V+2]=i.r,U[V+3]=i.g,U[V+4]=i.b,U[V+5]=i.a;var j=q-A,G=H-I,z=(N*j+O*G)*X,Z=(L*j+B*G)*X,Q=1-z-Z;U[V+6]=E*z+M*Z+R*Q,U[V+7]=y*z+T*Z+C*Q,o&&(U[V+8]=s.r,U[V+9]=s.g,U[V+10]=s.b,U[V+11]=s.a),V+=v}V=u.length;var J=d.setArraySize(u,V+3*(D-2));D--;for(var K=1;K<D;K++)J[V]=p,J[V+1]=p+K,J[V+2]=p+K+1,V+=3;p+=D+1}}},e.clip=function(t,e,r,n,a,i,s,o){var l=o,h=!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,x=p-m,E=u,y=u.length-2,b=o.length,S=0;S<y;S+=2){var M=E[S],T=E[S+1],A=E[S+2],I=E[S+3],R=w*(I-m)-x*(A-g)>0;if(w*(T-m)-x*(M-g)>0){if(R){o.push(A),o.push(I);continue}var C=I-T,k=A-M,V=C*(g-v)-k*(m-p);if(Math.abs(V)>1e-6){var P=(k*(p-T)-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-T,F=A-M,N=_*(g-v)-F*(m-p);if(Math.abs(N)>1e-6){var O=(F*(p-T)-_*(v-M))/N;o.push(v+(g-v)*O),o.push(p+(m-p)*O)}else o.push(v),o.push(p);o.push(A),o.push(I)}h=!0}if(b==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var B=o;(o=u).length=0,u=B}if(l!=o){l.length=0;for(var L=0,X=o.length-2;L<X;L++)l[L]=o[L]}else l.length=l.length-2;return h},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,l=r-3;o<l;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 h=0,u=r-2,c=r>>1;h<c;h+=2){var d=e[h],f=e[h+1],v=u-h;e[h]=e[v],e[h+1]=e[v+1],e[v]=d,e[v+1]=f}},t}(),mt=function(){function e(){}var r=e.prototype;return r.initialize=function(e,r){var n=this._mesh=new t.BufferMesh(e),a=[new t.VertexElement("POSITION",0,t.VertexElementFormat.Vector3,0),new t.VertexElement("COLOR_0",12,t.VertexElementFormat.Vector4,0),new t.VertexElement("TEXCOORD_0",28,t.VertexElementFormat.Vector2,0)],i=4*wt.VERTEX_STRIDE,s=i*r,o=new t.Buffer(e,t.BufferBindFlag.VertexBuffer,s,t.BufferUsage.Dynamic),l=new t.Buffer(e,t.BufferBindFlag.IndexBuffer,2*r,t.BufferUsage.Dynamic);this._indexBuffer=l,this._vertexBuffer=o,n.setVertexBufferBinding(o,i),n.setIndexBufferBinding(l,t.IndexFormat.UInt16),n.setVertexElements(a),n.addSubMesh(0,r)},r.changeBuffer=function(e,r){var n=4*wt.VERTEX_STRIDE,a=n*r,i=new t.Buffer(e,t.BufferBindFlag.VertexBuffer,a,t.BufferUsage.Dynamic),s=new t.Buffer(e,t.BufferBindFlag.IndexBuffer,2*r,t.BufferUsage.Dynamic),o=this._mesh;this._indexBuffer=s,this._vertexBuffer=i,o.setVertexBufferBinding(i,n),o.setIndexBufferBinding(s,t.IndexFormat.UInt16)},n(e,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),e}(),wt=function(){function e(t,e){this._clipper=new gt,this._spineMesh=new mt,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this._engine=t,this._entity=e}var r=e.prototype;return r.initialize=function(r,n){if(r){var a=this._entity.getComponent(t.MeshRenderer);if(a){this._meshRenderer=a,n&&(this._setting=n);for(var i=r.defaultSkin.attachments,s=0,o=e.QUAD_TRIANGLES.length,h=0,u=i.length;h<u;h++){var c=i[h];for(var d in c){var f=c[d];if(f)if(l(f,k))s+=o;else{if(!l(f,W))continue;s+=f.triangles.length}}}this._vertexCount=s,this._prepareBufferData(this._vertexCount);var v=this._spineMesh;v.initialize(this._engine,this._vertexCount),a.mesh=v.mesh}else console.warn("You need add MeshRenderer component to entity first")}},r.buildMesh=function(r){var n=this._setting||{},a=n.useClipping,i=void 0===a||a,s=n.zSpacing,o=void 0===s?.01:s,h=0,u=0;this._subMeshItems.length=0;for(var c,d,f=this._meshRenderer,v=r.drawOrder,p=v.length,g=this._clipper,m=this._spineMesh,w=m.mesh,x=this._subMeshItems,E=this._vertices,y=0,b=0,S=0;S<p;S+=1){var M=v[S];if(M.bone.active){var T=M.getAttachment(),A=null,I=null,R=o*S,C=0,V=g.isClipping()?2:e.VERTEX_SIZE;if(l(T,k)){var P=T;A=P.color,E=this._vertices,C=4*V,P.computeWorldVertices(M.bone,E,0,V),c=e.QUAD_TRIANGLES,d=P.uvs,I=P.region.renderObject.texture}else if(l(T,W)){var _=T;A=_.color,E=this._vertices,(C=(_.worldVerticesLength>>1)*V)>E.length&&(E=this._vertices=new Float32Array(C)),_.computeWorldVertices(M,0,_.worldVerticesLength,E,0,V),c=_.triangles,d=_.uvs,I=_.region.renderObject.texture}else if(l(T,vt)){if(i){var F=T;g.clipStart(M,F);continue}}else if(i){g.clipEndWithSlot(M);continue}if(null!=I){var N=void 0,O=void 0,B=void 0,L=void 0,X=M.bone.skeleton.color,D=M.color,Y=X.a*D.a*A.a,U=e.tempColor;if(U.set(X.r*D.r*A.r,X.g*D.g*A.g,X.b*D.b*A.b,Y),g.isClipping()){g.clipTriangles(E,C,c,c.length,d,U,null,!1);var q=g.clippedVertices,H=g.clippedTriangles;N=q,O=q.length,B=H,L=H.length}else{for(var j=E,G=2,z=0,Z=C;G<Z;G+=V,z+=2)j[G]=U.r,j[G+1]=U.g,j[G+2]=U.b,j[G+3]=U.a,j[G+4]=d[z],j[G+5]=d[z+1];N=E,O=C,B=c,L=c.length}for(var Q=h/e.VERTEX_STRIDE,J=this._verticesWithZ,K=h,$=0;$<O;)J[K++]=N[$++],J[K++]=N[$++],J[K++]=R,J[K++]=N[$++],J[K++]=N[$++],J[K++]=N[$++],J[K++]=N[$++],J[K++]=N[$++],J[K++]=N[$++];h=K;var tt=this._indices;for(K=u,$=0;$<L;K++,$++)tt[K]=B[$]+Q;var et=M.data.name;if(this.separateSlots.includes(et)){var rt=new t.SubMesh(u,L);if(x.push({name:et,subMesh:rt}),b>0){var nt=new t.SubMesh(y,b);x.push({name:"default",subMesh:nt}),b=0}y=u+L}else b+=L;u+=L;for(var at=f.getMaterials(),it=at.length,st=0;st<it;st+=1){var ot=at[st];ot.shaderData.getTexture("material_SpineTexture")||ot.shaderData.setTexture("material_SpineTexture",I.texture)}}g.clipEndWithSlot(M)}else g.clipEndWithSlot(M)}if(g.clipEnd(),b>0){var lt=new t.SubMesh(y,b);x.push({name:"default",subMesh:lt}),b=0}if(x.sort((function(t,e){return t.subMesh.start-e.subMesh.start})),u>0&&u!==this._vertexCount&&u>this._vertexCount)return this._vertexCount=u,this._prepareBufferData(this._vertexCount),void(this._needResize=!0);w.clearSubMesh();for(var ht=x.length,ut=0;ut<ht;ut+=1)w.addSubMesh(x[ut].subMesh);this._needResize&&(m.vertexBuffer.resize(this._verticesWithZ.byteLength),m.indexBuffer.resize(this._indices.byteLength),this._needResize=!1),m.vertexBuffer.setData(this._verticesWithZ),m.indexBuffer.setData(this._indices)},r.addSeparateSlot=function(t){this.separateSlots.push(t)},r._prepareBufferData=function(t){this._vertices=new Float32Array(t*e.VERTEX_SIZE),this._verticesWithZ=new Float32Array(t*e.VERTEX_STRIDE),this._indices=new Uint16Array(t)},n(e,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),e}();wt.QUAD_TRIANGLES=[0,1,2,2,3,0],wt.VERTEX_SIZE=8,wt.VERTEX_STRIDE=9,wt.tempColor=new u;var xt=function(e){function r(n){var a,i=t.Shader.find("galacean-spine-shader")||t.Shader.create("galacean-spine-shader",r._spineVS,r._spineFS),s=(a=e.call(this,n,i)||this).renderState,o=s.blendState.targetBlendState;return o.enabled=!0,o.sourceColorBlendFactor=t.BlendFactor.SourceAlpha,o.destinationColorBlendFactor=t.BlendFactor.OneMinusSourceAlpha,o.sourceAlphaBlendFactor=t.BlendFactor.One,o.destinationAlphaBlendFactor=t.BlendFactor.OneMinusSourceAlpha,o.colorBlendOperation=o.alphaBlendOperation=t.BlendOperation.Add,s.depthState.writeEnabled=!1,s.rasterState.cullMode=t.CullMode.Off,s.renderQueueType=t.RenderQueueType.Transparent,a}return s(r,e),r}(t.Material);xt._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 ",xt._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 Et=function(e){function r(t){var r;return(r=e.call(this,t)||this)._tempOffset=new p,r._tempSize=new p,r._tempArray=[0,0],r.autoUpdate=!0,r.autoUpdateBounds=!1,r._meshGenerator=new wt(r.engine,t),r}s(r,e);var i=r.prototype;return i.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new q(t);var r=new ft(t);this._state=new ht(r),this._meshGenerator.initialize(t,this.setting)},i.addSeparateSlot=function(e){this.skeleton||console.error("Skeleton not found!");var n=this.entity.getComponent(t.MeshRenderer);if(n||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(e)){this._meshGenerator.addSeparateSlot(e);var a=r._defaultMaterial.clone(),i=r._defaultMaterial.clone(),s=n.materialCount;n.setMaterial(s,a),n.setMaterial(s+1,i)}else console.warn("Slot: "+e+" not find.")},i.hackSeparateSlotTexture=function(e,r){this._meshGenerator.buildMesh(this._skeleton);var n=this._meshGenerator,a=n.separateSlots,i=n.subMeshItems;if(0!==a.length)if(a.includes(e)){var s=this.entity.getComponent(t.MeshRenderer),o=i.findIndex((function(t){return t.name===e}));s.getMaterial(o).shaderData.setTexture("material_SpineTexture",r)}else console.warn("Slot "+e+" is not separated. You should use addSeparateSlot to separate it");else console.warn("You need add separate slot")},i.onUpdate=function(t){this.autoUpdate&&this.updateState(t)},i.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()}},i.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},i.updateBounds=function(){var e,r=this.entity.getComponent(t.MeshRenderer).bounds,n=this._tempOffset,a=this._tempSize,i=this._tempArray,s=(null==(e=this.setting)?void 0:e.zSpacing)||.01,o=this._skeleton;o.getBounds(n,a,i);var l=o.drawOrder;r.min.set(n.x,n.y,0),r.max.set(n.x+a.x,n.y+a.y,l.length*s)},i._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=a({},this.setting);t.setting=e},i._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},i.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},r.getDefaultMaterial=function(t){return this._defaultMaterial||(this._defaultMaterial=new xt(t),this._defaultMaterial.isGCIgnored=!0),this._defaultMaterial.clone()},n(r,[{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)}}]),r}(t.Script);function yt(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 bt(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 yt(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)?yt(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.")}o([t.ignoreClone],Et.prototype,"_skeletonData",void 0),o([t.ignoreClone],Et.prototype,"_skeleton",void 0),o([t.ignoreClone],Et.prototype,"_state",void 0),o([t.ignoreClone],Et.prototype,"_tempOffset",void 0),o([t.ignoreClone],Et.prototype,"_tempSize",void 0),o([t.ignoreClone],Et.prototype,"_tempArray",void 0),o([t.ignoreClone],Et.prototype,"_meshGenerator",void 0),o([t.ignoreClone],Et.prototype,"setting",void 0);var St,Mt=function(){function r(t,e){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this.pathPrefix=t||"",this.textureLoader=e}var n=r.prototype;return n.downloadText=function(e,r,n){t.request(e,{type:"text"}).then((function(t){r(t)})).catch((function(t){n(t)}))},n.downloadBinary=function(t,r,n){var a=new e.XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),a.open("GET",t,!0),a.responseType="arraybuffer",a.onload=function(){200==a.status?r(new Uint8Array(a.response)):n(a.status,a.responseText)},a.onerror=function(){n(a.status,a.responseText)},a.send()},n.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},n.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++}))},n.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++}))},n.loadImage=function(t,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var a=this,i=t=this.pathPrefix+t;this.toLoad++;var s=new e.Image;s.crossOrigin="anonymous",s.onload=function(e){a.assets[i]=s,a.onLoad(),a.loaded++,r&&r(t,s)},s.onerror=function(e){a.errors[t]="Couldn't load image "+t,a.onLoad(),a.loaded++,n&&n("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),s.src=t},n.loadTexture=function(e,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var a=this,i=e=this.pathPrefix+e;this.toLoad++,this.rawDataUris[e]&&(e=this.rawDataUris[e]),t.request(e,{type:"image"}).then((function(t){var n=a.textureLoader(t);a.assets[i]=n,a.onLoad(),a.loaded++,r&&r(e,n)})).catch((function(t){n(t)}))},n.loadTextureAtlas=function(t,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var a=this,i=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(s){var o=function(){var e=c.value,o=!1;a.loadTexture(e,(function(e,u){if(l.count++,l.count==h.length)if(o)a.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,n&&n("Couldn't load texture atlas page "+e+" of atlas "+t),a.onLoad(),a.loaded++;else try{var c=new X(s,(function(t){return a.get(""==i?t:i+"/"+t)}));a.assets[t]=c,r&&r(t,c),a.onLoad(),a.loaded++}catch(e){var d=e;a.errors[t]="Couldn't load texture atlas "+t+": "+d.message,n&&n("Couldn't load texture atlas "+t+": "+d.message),a.onLoad(),a.loaded++}}),(function(e){o=!0,l.count++,l.count==h.length&&(a.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,n&&n("Couldn't load texture atlas page "+e+" of atlas "+t),a.onLoad(),a.loaded++)}))},l={count:0},h=new Array;try{new X(s,(function(t){h.push(""==i?t:i+"/"+t);var r=e.document.createElement("img");return r.width=16,r.height=16,new L(r)}))}catch(e){var u=e;return a.errors[t]="Couldn't load texture atlas "+t+": "+u.message,n&&n("Couldn't load texture atlas "+t+": "+u.message),a.onLoad(),void a.loaded++}for(var c,d=bt(h);!(c=d()).done;)o()}),(function(e){a.errors[t]="Couldn't load texture atlas "+t+": "+JSON.stringify(e),n&&n("Couldn't load texture atlas "+t+": "+JSON.stringify(e)),a.onLoad(),a.loaded++}))},n.get=function(t){return t=this.pathPrefix+t,this.assets[t]},n.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},n.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},n.isLoadingComplete=function(){return 0==this.toLoad},n.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},n.getToLoad=function(){return this.toLoad},n.getLoaded=function(){return this.loaded},n.dispose=function(){this.removeAll()},n.hasErrors=function(){return Object.keys(this.errors).length>0},n.getErrors=function(){return this.errors},r}(),Tt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new u(1,1,1,1),r}return s(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(I),At=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new u(.38,.94,0,1),r.name=e,r}s(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=c.cosDeg(this.rotation),r=c.sinDeg(this.rotation),n=e*t.a+r*t.b,a=e*t.c+r*t.d;return Math.atan2(a,n)*c.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}(I),It=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 W(e);return a.region=n,a},e.newBoundingBoxAttachment=function(t,e){return new Tt(e)},e.newPathAttachment=function(t,e){return new R(e)},e.newPointAttachment=function(t,e){return new At(e)},e.newClippingAttachment=function(t,e){return new vt(e)},t}(),Rt=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}(),Ct=function(t,e,r){if(this.color=new u(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 s(e,t),e}(M),Vt=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 s(e,t),e}(M),Pt=function(t,e,r){this.slotIndex=t,this.name=e,this.attachment=r},_t=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,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[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 u=t.getAttachments(),c=0;c<u.length;c++){var d=u[c];null!=d.attachment&&(l(d.attachment,W)?(d.attachment=d.attachment.newLinkedMesh(),this.setAttachment(d.slotIndex,d.name,d.attachment)):(d.attachment=d.attachment.copy(),this.setAttachment(d.slotIndex,d.name,d.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 Pt(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 Pt(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 l=this.getAttachment(r,o);null!=l&&a.setAttachment(l);break}}}r++}},t}(),Ft=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"}(St||(St={}));var Nt,Ot=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},Bt=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 Rt,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],l=null,h=this.getValue(o,"parent",null);if(null!=h&&null==(l=n.findBone(h)))throw new Error("Parent bone not found: "+h);var c=new g(n.bones.length,o.name,l);c.length=this.getValue(o,"length",0)*r,c.x=this.getValue(o,"x",0)*r,c.y=this.getValue(o,"y",0)*r,c.rotation=this.getValue(o,"rotation",0),c.scaleX=this.getValue(o,"scaleX",1),c.scaleY=this.getValue(o,"scaleY",1),c.shearX=this.getValue(o,"shearX",0),c.shearY=this.getValue(o,"shearY",0),c.transformMode=t.transformModeFromString(this.getValue(o,"transform","normal")),c.skinRequired=this.getValue(o,"skin",!1),n.bones.push(c)}if(a.slots)for(var d=0;d<a.slots.length;d++){var f=a.slots[d],v=f.name,p=f.bone,x=n.findBone(p);if(null==x)throw new Error("Slot bone not found: "+p);var E=new Ct(n.slots.length,v,x),y=this.getValue(f,"color",null);null!=y&&E.color.setFromString(y);var b=this.getValue(f,"dark",null);null!=b&&(E.darkColor=new u(1,1,1,1),E.darkColor.setFromString(b)),E.attachmentName=this.getValue(f,"attachment",null),E.blendMode=t.blendModeFromString(this.getValue(f,"blend","normal")),n.slots.push(E)}if(a.ik)for(var S=0;S<a.ik.length;S++){var M=a.ik[S],A=new kt(M.name);A.order=this.getValue(M,"order",0),A.skinRequired=this.getValue(M,"skin",!1);for(var I=0;I<M.bones.length;I++){var R=M.bones[I],C=n.findBone(R);if(null==C)throw new Error("IK bone not found: "+R);A.bones.push(C)}var k=M.target;if(A.target=n.findBone(k),null==A.target)throw new Error("IK target bone not found: "+k);A.mix=this.getValue(M,"mix",1),A.softness=this.getValue(M,"softness",0)*r,A.bendDirection=this.getValue(M,"bendPositive",!0)?1:-1,A.compress=this.getValue(M,"compress",!1),A.stretch=this.getValue(M,"stretch",!1),A.uniform=this.getValue(M,"uniform",!1),n.ikConstraints.push(A)}if(a.transform)for(var V=0;V<a.transform.length;V++){var P=a.transform[V],_=new Vt(P.name);_.order=this.getValue(P,"order",0),_.skinRequired=this.getValue(P,"skin",!1);for(var F=0;F<P.bones.length;F++){var N=P.bones[F],O=n.findBone(N);if(null==O)throw new Error("Transform constraint bone not found: "+N);_.bones.push(O)}var B=P.target;if(_.target=n.findBone(B),null==_.target)throw new Error("Transform constraint target bone not found: "+B);_.local=this.getValue(P,"local",!1),_.relative=this.getValue(P,"relative",!1),_.offsetRotation=this.getValue(P,"rotation",0),_.offsetX=this.getValue(P,"x",0)*r,_.offsetY=this.getValue(P,"y",0)*r,_.offsetScaleX=this.getValue(P,"scaleX",0),_.offsetScaleY=this.getValue(P,"scaleY",0),_.offsetShearY=this.getValue(P,"shearY",0),_.rotateMix=this.getValue(P,"rotateMix",1),_.translateMix=this.getValue(P,"translateMix",1),_.scaleMix=this.getValue(P,"scaleMix",1),_.shearMix=this.getValue(P,"shearMix",1),n.transformConstraints.push(_)}if(a.path)for(var L=0;L<a.path.length;L++){var X=a.path[L],D=new T(X.name);D.order=this.getValue(X,"order",0),D.skinRequired=this.getValue(X,"skin",!1);for(var Y=0;Y<X.bones.length;Y++){var U=X.bones[Y],W=n.findBone(U);if(null==W)throw new Error("Transform constraint bone not found: "+U);D.bones.push(W)}var q=X.target;if(D.target=n.findSlot(q),null==D.target)throw new Error("Path target slot not found: "+q);D.positionMode=t.positionModeFromString(this.getValue(X,"positionMode","percent")),D.spacingMode=t.spacingModeFromString(this.getValue(X,"spacingMode","length")),D.rotateMode=t.rotateModeFromString(this.getValue(X,"rotateMode","tangent")),D.offsetRotation=this.getValue(X,"rotation",0),D.position=this.getValue(X,"position",0),D.positionMode==m.Fixed&&(D.position*=r),D.spacing=this.getValue(X,"spacing",0),D.spacingMode!=w.Length&&D.spacingMode!=w.Fixed||(D.spacing*=r),D.rotateMix=this.getValue(X,"rotateMix",1),D.translateMix=this.getValue(X,"translateMix",1),n.pathConstraints.push(D)}if(a.skins)for(var H=0;H<a.skins.length;H++){var j=a.skins[H],G=new _t(j.name);if(j.bones)for(var z=0;z<j.bones.length;z++){var Z=n.findBone(j.bones[z]);if(null==Z)throw new Error("Skin bone not found: "+j.bones[H]);G.bones.push(Z)}if(j.ik)for(var Q=0;Q<j.ik.length;Q++){var J=n.findIkConstraint(j.ik[Q]);if(null==J)throw new Error("Skin IK constraint not found: "+j.ik[H]);G.constraints.push(J)}if(j.transform)for(var K=0;K<j.transform.length;K++){var $=n.findTransformConstraint(j.transform[K]);if(null==$)throw new Error("Skin transform constraint not found: "+j.transform[H]);G.constraints.push($)}if(j.path)for(var tt=0;tt<j.path.length;tt++){var et=n.findPathConstraint(j.path[tt]);if(null==et)throw new Error("Skin path constraint not found: "+j.path[H]);G.constraints.push(et)}for(var rt in j.attachments){var nt=n.findSlot(rt);if(null==nt)throw new Error("Slot not found: "+rt);var at=j.attachments[rt];for(var it in at){var st=this.readAttachment(at[it],G,nt.index,it,n);null!=st&&G.setAttachment(nt.index,it,st)}}n.skins.push(G),"default"==G.name&&(n.defaultSkin=G)}for(var ot=0,lt=this.linkedMeshes.length;ot<lt;ot++){var ht=this.linkedMeshes[ot],ut=null==ht.skin?n.defaultSkin:n.findSkin(ht.skin);if(null==ut)throw new Error("Skin not found: "+ht.skin);var ct=ut.getAttachment(ht.slotIndex,ht.parent);if(null==ct)throw new Error("Parent mesh not found: "+ht.parent);ht.mesh.deformAttachment=ht.inheritDeform?ct:ht.mesh,ht.mesh.setParentMesh(ct),ht.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var dt in a.events){var ft=a.events[dt],vt=new Ft(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 l=this.getValue(t,"color",null);return null!=l&&o.color.setFromString(l),o.updateOffset(),o;case"boundingbox":var h=this.attachmentLoader.newBoundingBoxAttachment(e,n);if(null==h)return null;this.readVertices(t,h,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&h.color.setFromString(u),h;case"mesh":case"linkedmesh":var c=this.getValue(t,"path",n),f=this.attachmentLoader.newMeshAttachment(e,n,c);if(null==f)return null;f.path=c;var v=this.getValue(t,"color",null);null!=v&&f.color.setFromString(v),f.width=this.getValue(t,"width",0)*i,f.height=this.getValue(t,"height",0)*i;var p=this.getValue(t,"parent",null);if(null!=p)return this.linkedMeshes.push(new Lt(f,this.getValue(t,"skin",null),r,p,this.getValue(t,"deform",!0))),f;var g=t.uvs;return this.readVertices(t,f,g.length),f.triangles=t.triangles,f.regionUVs=g,f.updateUVs(),f.edges=this.getValue(t,"edges",null),f.hullLength=2*this.getValue(t,"hull",0),f;case"path":var m=this.attachmentLoader.newPathAttachment(e,n);if(null==m)return null;m.closed=this.getValue(t,"closed",!1),m.constantSpeed=this.getValue(t,"constantSpeed",!0);var w=t.vertexCount;this.readVertices(t,m,w<<1);for(var x=d.newArray(w/3,0),E=0;E<t.lengths.length;E++)x[E]=t.lengths[E]*i;m.lengths=x;var y=this.getValue(t,"color",null);return null!=y&&m.color.setFromString(y),m;case"point":var b=this.attachmentLoader.newPointAttachment(e,n);if(null==b)return null;b.x=this.getValue(t,"x",0)*i,b.y=this.getValue(t,"y",0)*i,b.rotation=this.getValue(t,"rotation",0);var S=this.getValue(t,"color",null);return null!=S&&b.color.setFromString(S),b;case"clipping":var M=this.attachmentLoader.newClippingAttachment(e,n);if(null==M)return null;var T=this.getValue(t,"end",null);if(null!=T){var A=a.findSlot(T);if(null==A)throw new Error("Clipping end slot not found: "+T);M.endSlot=A}var I=t.vertexCount;this.readVertices(t,M,I<<1);var R=this.getValue(t,"color",null);return null!=R&&M.color.setFromString(R),M}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,l=a.length;o<l;){var h=a[o++];s.push(h);for(var u=o+4*h;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=d.toFloatArray(i)}else{var c=d.toFloatArray(a);if(1!=n)for(var f=0,v=a.length;f<v;f++)c[f]*=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],l=r.findSlotIndex(s);if(-1==l)throw new Error("Slot not found: "+s);for(var h in o){var c=o[h];if("attachment"==h){var f=new $(c.length);f.slotIndex=l;for(var v=0,p=0;p<c.length;p++){var g=c[p];f.setFrame(v++,this.getValue(g,"time",0),g.name)}a.push(f),i=Math.max(i,f.frames[f.getFrameCount()-1])}else if("color"==h){var x=new J(c.length);x.slotIndex=l;for(var E=0,y=0;y<c.length;y++){var b=c[y],S=new u;S.setFromString(b.color),x.setFrame(E,this.getValue(b,"time",0),S.r,S.g,S.b,S.a),this.readCurve(b,x,E),E++}a.push(x),i=Math.max(i,x.frames[(x.getFrameCount()-1)*J.ENTRIES])}else{if("twoColor"!=h)throw new Error("Invalid timeline type for a slot: "+h+" ("+s+")");var M=new K(c.length);M.slotIndex=l;for(var T=0,A=0;A<c.length;A++){var I=c[A],R=new u,C=new u;R.setFromString(I.light),C.setFromString(I.dark),M.setFrame(T,this.getValue(I,"time",0),R.r,R.g,R.b,R.a,C.r,C.g,C.b),this.readCurve(I,M,T),T++}a.push(M),i=Math.max(i,M.frames[(M.getFrameCount()-1)*K.ENTRIES])}}}if(t.bones)for(var k in t.bones){var V=t.bones[k],P=r.findBoneIndex(k);if(-1==P)throw new Error("Bone not found: "+k);for(var _ in V){var F=V[_];if("rotate"===_){var N=new G(F.length);N.boneIndex=P;for(var O=0,B=0;B<F.length;B++){var L=F[B];N.setFrame(O,this.getValue(L,"time",0),this.getValue(L,"angle",0)),this.readCurve(L,N,O),O++}a.push(N),i=Math.max(i,N.frames[(N.getFrameCount()-1)*G.ENTRIES])}else{if("translate"!==_&&"scale"!==_&&"shear"!==_)throw new Error("Invalid timeline type for a bone: "+_+" ("+k+")");var X=null,D=1,Y=0;"scale"===_?(X=new Z(F.length),Y=1):"shear"===_?X=new Q(F.length):(X=new z(F.length),D=n),X.boneIndex=P;for(var U=0,W=0;W<F.length;W++){var q=F[W],j=this.getValue(q,"x",Y),tt=this.getValue(q,"y",Y);X.setFrame(U,this.getValue(q,"time",0),j*D,tt*D),this.readCurve(q,X,U),U++}a.push(X),i=Math.max(i,X.frames[(X.getFrameCount()-1)*z.ENTRIES])}}}if(t.ik)for(var ht in t.ik){var ut=t.ik[ht],ct=r.findIkConstraint(ht),dt=new at(ut.length);dt.ikConstraintIndex=r.ikConstraints.indexOf(ct);for(var ft=0,vt=0;vt<ut.length;vt++){var pt=ut[vt];dt.setFrame(ft,this.getValue(pt,"time",0),this.getValue(pt,"mix",1),this.getValue(pt,"softness",0)*n,this.getValue(pt,"bendPositive",!0)?1:-1,this.getValue(pt,"compress",!1),this.getValue(pt,"stretch",!1)),this.readCurve(pt,dt,ft),ft++}a.push(dt),i=Math.max(i,dt.frames[(dt.getFrameCount()-1)*at.ENTRIES])}if(t.transform)for(var gt in t.transform){var mt=t.transform[gt],wt=r.findTransformConstraint(gt),xt=new it(mt.length);xt.transformConstraintIndex=r.transformConstraints.indexOf(wt);for(var Et=0,yt=0;yt<mt.length;yt++){var bt=mt[yt];xt.setFrame(Et,this.getValue(bt,"time",0),this.getValue(bt,"rotateMix",1),this.getValue(bt,"translateMix",1),this.getValue(bt,"scaleMix",1),this.getValue(bt,"shearMix",1)),this.readCurve(bt,xt,Et),Et++}a.push(xt),i=Math.max(i,xt.frames[(xt.getFrameCount()-1)*it.ENTRIES])}if(t.path)for(var St in t.path){var Mt=t.path[St],Tt=r.findPathConstraintIndex(St);if(-1==Tt)throw new Error("Path constraint not found: "+St);var At=r.pathConstraints[Tt];for(var It in Mt){var Rt=Mt[It];if("position"===It||"spacing"===It){var Ct=null,kt=1;"spacing"===It?(Ct=new ot(Rt.length),At.spacingMode!=w.Length&&At.spacingMode!=w.Fixed||(kt=n)):(Ct=new st(Rt.length),At.positionMode==m.Fixed&&(kt=n)),Ct.pathConstraintIndex=Tt;for(var Vt=0,Pt=0;Pt<Rt.length;Pt++){var _t=Rt[Pt];Ct.setFrame(Vt,this.getValue(_t,"time",0),this.getValue(_t,It,0)*kt),this.readCurve(_t,Ct,Vt),Vt++}a.push(Ct),i=Math.max(i,Ct.frames[(Ct.getFrameCount()-1)*st.ENTRIES])}else if("mix"===It){var Ft=new lt(Rt.length);Ft.pathConstraintIndex=Tt;for(var Nt=0,Bt=0;Bt<Rt.length;Bt++){var Lt=Rt[Bt];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)*lt.ENTRIES])}}}if(t.deform)for(var Xt in t.deform){var Dt=t.deform[Xt],Yt=r.findSkin(Xt);if(null==Yt)throw new Error("Skin not found: "+Xt);for(var Ut in Dt){var Wt=Dt[Ut],qt=r.findSlotIndex(Ut);if(-1==qt)throw new Error("Slot not found: "+Wt.name);for(var Ht in Wt){var jt=Wt[Ht],Gt=Yt.getAttachment(qt,Ht);if(null==Gt)throw new Error("Deform attachment not found: "+jt.name);var zt=null!=Gt.bones,Zt=Gt.vertices,Qt=zt?Zt.length/3*2:Zt.length,Jt=new et(jt.length);Jt.slotIndex=qt,Jt.attachment=Gt;for(var Kt=0,$t=0;$t<jt.length;$t++){var te=jt[$t],ee=void 0,re=this.getValue(te,"vertices",null);if(null==re)ee=zt?d.newFloatArray(Qt):Zt;else{ee=d.newFloatArray(Qt);var ne=this.getValue(te,"offset",0);if(d.arrayCopy(re,0,ee,ne,re.length),1!=n)for(var ae=ne,ie=ae+re.length;ae<ie;ae++)ee[ae]*=n;if(!zt)for(var se=0;se<Qt;se++)ee[se]+=Zt[se]}Jt.setFrame(Kt,this.getValue(te,"time",0),ee),this.readCurve(te,Jt,Kt),Kt++}a.push(Jt),i=Math.max(i,Jt.frames[Jt.getFrameCount()-1])}}}var oe=t.drawOrder;if(null==oe&&(oe=t.draworder),null!=oe){for(var le=new nt(oe.length),he=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=d.newArray(he,-1);for(var pe=d.newArray(he-ve.length,0),ge=0,me=0,we=0;we<ve.length;we++){var xe=ve[we],Ee=r.findSlotIndex(xe.slot);if(-1==Ee)throw new Error("Slot not found: "+xe.slot);for(;ge!=Ee;)pe[me++]=ge++;fe[ge+xe.offset]=ge++}for(;ge<he;)pe[me++]=ge++;for(var ye=he-1;ye>=0;ye--)-1==fe[ye]&&(fe[ye]=pe[--me])}le.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(le),i=Math.max(i,le.frames[le.getFrameCount()-1])}if(t.events){for(var be=new rt(t.events.length),Se=0,Me=0;Me<t.events.length;Me++){var Te=t.events[Me],Ae=r.findEvent(Te.name);if(null==Ae)throw new Error("Event not found: "+Te.name);var Ie=new Ot(d.toSinglePrecision(this.getValue(Te,"time",0)),Ae);Ie.intValue=this.getValue(Te,"int",Ae.intValue),Ie.floatValue=this.getValue(Te,"float",Ae.floatValue),Ie.stringValue=this.getValue(Te,"string",Ae.stringValue),null!=Ie.data.audioPath&&(Ie.volume=this.getValue(Te,"volume",1),Ie.balance=this.getValue(Te,"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 H(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 St.Normal;if("additive"==t)return St.Additive;if("multiply"==t)return St.Multiply;if("screen"==t)return St.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return m.Fixed;if("percent"==t)return m.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return w.Length;if("fixed"==t)return w.Fixed;if("percent"==t)return w.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return x.Tangent;if("chain"==t)return x.Chain;if("chainscale"==t)return x.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return f.Normal;if("onlytranslation"==t)return f.OnlyTranslation;if("norotationorreflection"==t)return f.NoRotationOrReflection;if("noscale"==t)return f.NoScale;if("noscaleorreflection"==t)return f.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),Lt=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"}(Nt||(Nt={}));var Xt=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 Rt;n.name="";var a=new Dt(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 l=0;l<s;l++){var h=a.readString(),c=0==l?null:n.bones[a.readInt(!0)],f=new g(l,h,c);f.rotation=a.readFloat(),f.x=a.readFloat()*r,f.y=a.readFloat()*r,f.scaleX=a.readFloat(),f.scaleY=a.readFloat(),f.shearX=a.readFloat(),f.shearY=a.readFloat(),f.length=a.readFloat()*r,f.transformMode=t.TransformModeValues[a.readInt(!0)],f.skinRequired=a.readBoolean(),i&&u.rgba8888ToColor(f.color,a.readInt32()),n.bones.push(f)}s=a.readInt(!0);for(var v=0;v<s;v++){var p=a.readString(),x=n.bones[a.readInt(!0)],E=new Ct(v,p,x);u.rgba8888ToColor(E.color,a.readInt32());var y=a.readInt32();-1!=y&&u.rgb888ToColor(E.darkColor=new u,y),E.attachmentName=a.readStringRef(),E.blendMode=t.BlendModeValues[a.readInt(!0)],n.slots.push(E)}s=a.readInt(!0);for(var b,S=0;S<s;S++){var M=new kt(a.readString());M.order=a.readInt(!0),M.skinRequired=a.readBoolean(),b=a.readInt(!0);for(var A=0;A<b;A++)M.bones.push(n.bones[a.readInt(!0)]);M.target=n.bones[a.readInt(!0)],M.mix=a.readFloat(),M.softness=a.readFloat()*r,M.bendDirection=a.readByte(),M.compress=a.readBoolean(),M.stretch=a.readBoolean(),M.uniform=a.readBoolean(),n.ikConstraints.push(M)}s=a.readInt(!0);for(var I,R=0;R<s;R++){var C=new Vt(a.readString());C.order=a.readInt(!0),C.skinRequired=a.readBoolean(),I=a.readInt(!0);for(var k=0;k<I;k++)C.bones.push(n.bones[a.readInt(!0)]);C.target=n.bones[a.readInt(!0)],C.local=a.readBoolean(),C.relative=a.readBoolean(),C.offsetRotation=a.readFloat(),C.offsetX=a.readFloat()*r,C.offsetY=a.readFloat()*r,C.offsetScaleX=a.readFloat(),C.offsetScaleY=a.readFloat(),C.offsetShearY=a.readFloat(),C.rotateMix=a.readFloat(),C.translateMix=a.readFloat(),C.scaleMix=a.readFloat(),C.shearMix=a.readFloat(),n.transformConstraints.push(C)}s=a.readInt(!0);for(var V,P=0;P<s;P++){var _=new T(a.readString());_.order=a.readInt(!0),_.skinRequired=a.readBoolean(),V=a.readInt(!0);for(var F=0;F<V;F++)_.bones.push(n.bones[a.readInt(!0)]);_.target=n.slots[a.readInt(!0)],_.positionMode=t.PositionModeValues[a.readInt(!0)],_.spacingMode=t.SpacingModeValues[a.readInt(!0)],_.rotateMode=t.RotateModeValues[a.readInt(!0)],_.offsetRotation=a.readFloat(),_.position=a.readFloat(),_.positionMode==m.Fixed&&(_.position*=r),_.spacing=a.readFloat(),_.spacingMode!=w.Length&&_.spacingMode!=w.Fixed||(_.spacing*=r),_.rotateMix=a.readFloat(),_.translateMix=a.readFloat(),n.pathConstraints.push(_)}var N=this.readSkin(a,n,!0,i);null!=N&&(n.defaultSkin=N,n.skins.push(N));var O=n.skins.length;for(d.setArraySize(n.skins,s=O+a.readInt(!0));O<s;O++)n.skins[O]=this.readSkin(a,n,!1,i);s=this.linkedMeshes.length;for(var B=0;B<s;B++){var L=this.linkedMeshes[B],X=null==L.skin?n.defaultSkin:n.findSkin(L.skin);if(null==X)throw new Error("Skin not found: "+L.skin);var D=X.getAttachment(L.slotIndex,L.parent);if(null==D)throw new Error("Parent mesh not found: "+L.parent);L.mesh.deformAttachment=L.inheritDeform?D:L.mesh,L.mesh.setParentMesh(D),L.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var Y=0;Y<s;Y++){var U=new Ft(a.readStringRef());U.intValue=a.readInt(!1),U.floatValue=a.readFloat(),U.stringValue=a.readString(),U.audioPath=a.readString(),null!=U.audioPath&&(U.volume=a.readFloat(),U.balance=a.readFloat()),n.events.push(U)}s=a.readInt(!0);for(var W=0;W<s;W++)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 _t("default")}else{(a=new _t(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 l=0,h=t.readInt(!0);l<h;l++)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(),x=this.readAttachment(t,e,a,p,w,n);null!=x&&a.setAttachment(p,w,x)}return a},e.readAttachment=function(e,r,n,a,i,s){var o=this.scale,l=e.readStringRef();null==l&&(l=i);var h=e.readByte();switch(t.AttachmentTypeValues[h]){case Nt.Region:var c=e.readStringRef(),f=e.readFloat(),v=e.readFloat(),p=e.readFloat(),g=e.readFloat(),m=e.readFloat(),w=e.readFloat(),x=e.readFloat(),E=e.readInt32();null==c&&(c=l);var y=this.attachmentLoader.newRegionAttachment(n,l,c);return null==y?null:(y.path=c,y.x=v*o,y.y=p*o,y.scaleX=g,y.scaleY=m,y.rotation=f,y.width=w*o,y.height=x*o,u.rgba8888ToColor(y.color,E),y.updateOffset(),y);case Nt.BoundingBox:var b=e.readInt(!0),S=this.readVertices(e,b),M=s?e.readInt32():0,T=this.attachmentLoader.newBoundingBoxAttachment(n,l);return null==T?null:(T.worldVerticesLength=b<<1,T.vertices=S.vertices,T.bones=S.bones,s&&u.rgba8888ToColor(T.color,M),T);case Nt.Mesh:var A=e.readStringRef(),I=e.readInt32(),R=e.readInt(!0),C=this.readFloatArray(e,R<<1,1),k=this.readShortArray(e),V=this.readVertices(e,R),P=e.readInt(!0),_=null,F=0,N=0;s&&(_=this.readShortArray(e),F=e.readFloat(),N=e.readFloat()),null==A&&(A=l);var O=this.attachmentLoader.newMeshAttachment(n,l,A);return null==O?null:(O.path=A,u.rgba8888ToColor(O.color,I),O.bones=V.bones,O.vertices=V.vertices,O.worldVerticesLength=R<<1,O.triangles=k,O.regionUVs=C,O.updateUVs(),O.hullLength=P<<1,s&&(O.edges=_,O.width=F*o,O.height=N*o),O);case Nt.LinkedMesh:var B=e.readStringRef(),L=e.readInt32(),X=e.readStringRef(),D=e.readStringRef(),Y=e.readBoolean(),U=0,W=0;s&&(U=e.readFloat(),W=e.readFloat()),null==B&&(B=l);var q=this.attachmentLoader.newMeshAttachment(n,l,B);return null==q?null:(q.path=B,u.rgba8888ToColor(q.color,L),s&&(q.width=U*o,q.height=W*o),this.linkedMeshes.push(new Yt(q,X,a,D,Y)),q);case Nt.Path:for(var H=e.readBoolean(),j=e.readBoolean(),G=e.readInt(!0),z=this.readVertices(e,G),Z=d.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,l);return null==$?null:($.closed=H,$.constantSpeed=j,$.worldVerticesLength=G<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&u.rgba8888ToColor($.color,K),$);case Nt.Point:var tt=e.readFloat(),et=e.readFloat(),rt=e.readFloat(),nt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(n,l);return null==at?null:(at.x=et*o,at.y=rt*o,at.rotation=tt,s&&u.rgba8888ToColor(at.color,nt),at);case Nt.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),lt=s?e.readInt32():0,ht=this.attachmentLoader.newClippingAttachment(n,l);return null==ht?null:(ht.endSlot=r.slots[it],ht.worldVerticesLength=st<<1,ht.vertices=ot.vertices,ht.bones=ot.bones,s&&u.rgba8888ToColor(ht.color,lt),ht)}return null},e.readVertices=function(t,e){var r=e<<1,n=new Ut,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 l=t.readInt(!0);s.push(l);for(var h=0;h<l;h++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return n.vertices=d.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 u,l=new u,h=0,c=e.readInt(!0);h<c;h++)for(var f=e.readInt(!0),v=0,p=e.readInt(!0);v<p;v++){var g=e.readByte(),x=e.readInt(!0);switch(g){case t.SLOT_ATTACHMENT:var E=new $(x);E.slotIndex=f;for(var y=0;y<x;y++)E.setFrame(y,e.readFloat(),e.readStringRef());a.push(E),s=Math.max(s,E.frames[x-1]);break;case t.SLOT_COLOR:var b=new J(x);b.slotIndex=f;for(var S=0;S<x;S++){var M=e.readFloat();u.rgba8888ToColor(o,e.readInt32()),b.setFrame(S,M,o.r,o.g,o.b,o.a),S<x-1&&this.readCurve(e,S,b)}a.push(b),s=Math.max(s,b.frames[(x-1)*J.ENTRIES]);break;case t.SLOT_TWO_COLOR:var T=new K(x);T.slotIndex=f;for(var A=0;A<x;A++){var I=e.readFloat();u.rgba8888ToColor(o,e.readInt32()),u.rgb888ToColor(l,e.readInt32()),T.setFrame(A,I,o.r,o.g,o.b,o.a,l.r,l.g,l.b),A<x-1&&this.readCurve(e,A,T)}a.push(T),s=Math.max(s,T.frames[(x-1)*K.ENTRIES])}}for(var R=0,C=e.readInt(!0);R<C;R++)for(var k=e.readInt(!0),V=0,P=e.readInt(!0);V<P;V++){var _=e.readByte(),F=e.readInt(!0);switch(_){case t.BONE_ROTATE:var N=new G(F);N.boneIndex=k;for(var O=0;O<F;O++)N.setFrame(O,e.readFloat(),e.readFloat()),O<F-1&&this.readCurve(e,O,N);a.push(N),s=Math.max(s,N.frames[(F-1)*G.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var B=void 0,L=1;_==t.BONE_SCALE?B=new Z(F):_==t.BONE_SHEAR?B=new Q(F):(B=new z(F),L=i),B.boneIndex=k;for(var X=0;X<F;X++)B.setFrame(X,e.readFloat(),e.readFloat()*L,e.readFloat()*L),X<F-1&&this.readCurve(e,X,B);a.push(B),s=Math.max(s,B.frames[(F-1)*z.ENTRIES])}}for(var D=0,Y=e.readInt(!0);D<Y;D++){var U=e.readInt(!0),W=e.readInt(!0),q=new at(W);q.ikConstraintIndex=U;for(var j=0;j<W;j++)q.setFrame(j,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),j<W-1&&this.readCurve(e,j,q);a.push(q),s=Math.max(s,q.frames[(W-1)*at.ENTRIES])}for(var tt=0,ht=e.readInt(!0);tt<ht;tt++){var ut=e.readInt(!0),ct=e.readInt(!0),dt=new it(ct);dt.transformConstraintIndex=ut;for(var ft=0;ft<ct;ft++)dt.setFrame(ft,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),ft<ct-1&&this.readCurve(e,ft,dt);a.push(dt),s=Math.max(s,dt.frames[(ct-1)*it.ENTRIES])}for(var vt=0,pt=e.readInt(!0);vt<pt;vt++)for(var gt=e.readInt(!0),mt=n.pathConstraints[gt],wt=0,xt=e.readInt(!0);wt<xt;wt++){var Et=e.readByte(),yt=e.readInt(!0);switch(Et){case t.PATH_POSITION:case t.PATH_SPACING:var bt=void 0,St=1;Et==t.PATH_SPACING?(bt=new ot(yt),mt.spacingMode!=w.Length&&mt.spacingMode!=w.Fixed||(St=i)):(bt=new st(yt),mt.positionMode==m.Fixed&&(St=i)),bt.pathConstraintIndex=gt;for(var Mt=0;Mt<yt;Mt++)bt.setFrame(Mt,e.readFloat(),e.readFloat()*St),Mt<yt-1&&this.readCurve(e,Mt,bt);a.push(bt),s=Math.max(s,bt.frames[(yt-1)*st.ENTRIES]);break;case t.PATH_MIX:var Tt=new lt(yt);Tt.pathConstraintIndex=gt;for(var At=0;At<yt;At++)Tt.setFrame(At,e.readFloat(),e.readFloat(),e.readFloat()),At<yt-1&&this.readCurve(e,At,Tt);a.push(Tt),s=Math.max(s,Tt.frames[(yt-1)*lt.ENTRIES])}}for(var It=0,Rt=e.readInt(!0);It<Rt;It++)for(var Ct=n.skins[e.readInt(!0)],kt=0,Vt=e.readInt(!0);kt<Vt;kt++)for(var Pt=e.readInt(!0),_t=0,Ft=e.readInt(!0);_t<Ft;_t++){var Nt=Ct.getAttachment(Pt,e.readStringRef()),Bt=null!=Nt.bones,Lt=Nt.vertices,Xt=Bt?Lt.length/3*2:Lt.length,Dt=e.readInt(!0),Yt=new et(Dt);Yt.slotIndex=Pt,Yt.attachment=Nt;for(var Ut=0;Ut<Dt;Ut++){var Wt=e.readFloat(),qt=void 0,Ht=e.readInt(!0);if(0==Ht)qt=Bt?d.newFloatArray(Xt):Lt;else{qt=d.newFloatArray(Xt);var jt=e.readInt(!0);if(Ht+=jt,1==i)for(var Gt=jt;Gt<Ht;Gt++)qt[Gt]=e.readFloat();else for(var zt=jt;zt<Ht;zt++)qt[zt]=e.readFloat()*i;if(!Bt)for(var Zt=0,Qt=qt.length;Zt<Qt;Zt++)qt[Zt]+=Lt[Zt]}Yt.setFrame(Ut,Wt,qt),Ut<Dt-1&&this.readCurve(e,Ut,Yt)}a.push(Yt),s=Math.max(s,Yt.frames[Dt-1])}var Jt=e.readInt(!0);if(Jt>0){for(var Kt=new nt(Jt),$t=n.slots.length,te=0;te<Jt;te++){for(var ee=e.readFloat(),re=e.readInt(!0),ne=d.newArray($t,0),ae=$t-1;ae>=0;ae--)ne[ae]=-1;for(var ie=d.newArray($t-re,0),se=0,oe=0,le=0;le<re;le++){for(var he=e.readInt(!0);se!=he;)ie[oe++]=se++;ne[se+e.readInt(!0)]=se++}for(;se<$t;)ie[oe++]=se++;for(var ue=$t-1;ue>=0;ue--)-1==ne[ue]&&(ne[ue]=ie[--oe]);Kt.setFrame(te,ee,ne)}a.push(Kt),s=Math.max(s,Kt.frames[Jt-1])}var ce=e.readInt(!0);if(ce>0){for(var de=new rt(ce),fe=0;fe<ce;fe++){var ve=e.readFloat(),pe=n.events[e.readInt(!0)],ge=new Ot(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 H(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}();Xt.AttachmentTypeValues=[0,1,2,3,4,5,6],Xt.TransformModeValues=[f.Normal,f.OnlyTranslation,f.NoRotationOrReflection,f.NoScale,f.NoScaleOrReflection],Xt.PositionModeValues=[m.Fixed,m.Percent],Xt.SpacingModeValues=[w.Length,w.Fixed,w.Percent],Xt.RotateModeValues=[x.Tangent,x.Chain,x.ChainScale],Xt.BlendModeValues=[St.Normal,St.Additive,St.Multiply,St.Screen],Xt.BONE_ROTATE=0,Xt.BONE_TRANSLATE=1,Xt.BONE_SCALE=2,Xt.BONE_SHEAR=3,Xt.SLOT_ATTACHMENT=0,Xt.SLOT_COLOR=1,Xt.SLOT_TWO_COLOR=2,Xt.PATH_POSITION=0,Xt.PATH_SPACING=1,Xt.PATH_MIX=2,Xt.CURVE_LINEAR=0,Xt.CURVE_STEPPED=1,Xt.CURVE_BEZIER=2;var Dt=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}(),Yt=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,this.inheritDeform=a},Ut=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e},Wt=function(e){function r(){return e.apply(this,arguments)}s(r,e);var n=r.prototype;return n.load=function(e,r){var n=this;return new t.AssetPromise((function(a,i){var s,o=r.engine;"spine"!==e.type&&i("Asset type must be spine."),!e.urls&&e.url&&n.checkUrl(e.url)&&(s=n.getResouceFromUrl(e.url)),e.urls&&n.checkUrls(e.urls)&&(s=n.getResouceFromUrls(e.urls));var l,h=!1;l=new Mt(null,(function(t){return n.createAdaptiveTexture(t,o)}));var u=s.skeletonFile,c=s.atlasFile,d=s.textureFile;l.onLoadComplete=function(){try{var e;if(h)e=l.get(c);else{var r=l.get(c);e=new X(r,n.textureAssetPicker.bind(n,l,d))}var s=new It(e),f=(n.isBinFile(u)?new Xt(s):new Bt(s)).readSkeletonData(l.get(u)),v=new t.Entity(o),p=v.addComponent(t.MeshRenderer),g=Et.getDefaultMaterial(o);p.setMaterial(g),v.addComponent(Et).setSkeletonData(f),a(v)}catch(t){i(t)}};var f=n.isBinFile(u);u&&c&&d?(f?l.loadBinary(u,null,i):l.loadText(u,null,i),l.loadText(c,null,i),l.loadTexture(d,null,i)):u&&c&&!d?(h=!0,f?l.loadBinary(u,null,i):l.loadText(u,null,i),l.loadTextureAtlas(c,null,i)):i("Resouce param error")}))},n.textureAssetPicker=function(t,e){return t.get(e)},n.createAdaptiveTexture=function(t,e){return new qt(t,e)},n.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},n.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)},n.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"}},n.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)},n.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}},n.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},r}(t.Loader);Wt=o([t.resourceLoader("spine",["json","bin"])],Wt);var qt=function(e){function r(r,n){var a;return(a=e.call(this,r)||this).texture=new t.Texture2D(n,r.width,r.height),a.texture.setImageSource(r),a.texture.generateMipmaps(),a}s(r,e);var n=r.prototype;return n.setFilters=function(e,r){e===V.Nearest?this.texture.filterMode=t.TextureFilterMode.Point:r===V.MipMapLinearLinear?this.texture.filterMode=t.TextureFilterMode.Trilinear:this.texture.filterMode=t.TextureFilterMode.Bilinear},n.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},n.dispose=function(){},r}(_),Ht=function(r){function n(){return r.apply(this,arguments)}s(n,r);var a=n.prototype;return a.load=function(r,n){var a=this;return new t.AssetPromise((function(i,s){var o=n.engine;if(r.url)if(a.checkUrl(r.url)){var l,h,u,c,d,f=r.url;c=new Mt(null,(function(t){return a.createAdaptiveTexture(t,o)})),(d=f,new Promise((function(t,r){var n=new e.XMLHttpRequest;n.responseType="json",n.open("GET",d,!0),n.onload=function(){200==n.status?t(n.response):r("status:"+n.status+", "+n.responseText)},n.onerror=function(){r("status:"+n.status+", "+n.responseText)},n.send()}))).then((function(t){if(u=t,t._ext){var e=t._ext,r=e.atlas,n=e.images,a=n[Object.keys(n)[0]];l=r,h=a,c.loadText(r),c.loadTexture(a)}else s("AntG spine json must have ext data")})).catch((function(){s("Resouce json load fail")})),c.onLoadComplete=function(){var e,r=c.get(l);e=new X(r,a.textureAssetPicker.bind(a,c,h));var n=new It(e),s=new Bt(n).readSkeletonData(u),d=new t.Entity(o),f=d.addComponent(t.MeshRenderer);f.shaderData.enableMacro("USE_MODEL_MATRIX"),f.shaderData.enableMacro("USE_CUSTOM_TEXTURE");var v=o._spriteDefaultMaterial.clone();f.setMaterial(v),d.addComponent(Et).setSkeletonData(s),i(d)}}else s("AntG asset must be a json url.");else s("AntG asset must be a json url.")}))},a.textureAssetPicker=function(t,e){return t.get(e)},a.createAdaptiveTexture=function(t,e){return new jt(t,e)},a.checkUrl=function(t){return"json"===this.getExtFromUrl(t)||(console.error("When use url as params, url must be a json file"),!1)},a.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},n}(t.Loader);Ht=o([t.resourceLoader("antg_spine",["json","bin"])],Ht);var jt=function(e){function r(r,n){var a;return(a=e.call(this,r)||this).texture=new t.Texture2D(n,r.width,r.height),a.texture.setImageSource(r),a.texture.generateMipmaps(),a}s(r,e);var n=r.prototype;return n.setFilters=function(e,r){e===V.Nearest?this.texture.filterMode=t.TextureFilterMode.Point:r===V.MipMapLinearLinear?this.texture.filterMode=t.TextureFilterMode.Trilinear:this.texture.filterMode=t.TextureFilterMode.Bilinear},n.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},n.dispose=function(){},r}(_);var Gt="1.0.0-test.5";console.log("Galacean spine version :"+Gt),exports.AssetManager=Mt,exports.AtlasAttachmentLoader=It,exports.SkeletonBinary=Xt,exports.SkeletonJson=Bt,exports.SpineAnimation=Et,exports.Texture=_,exports.TextureAtlas=X,exports.version=Gt;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@galacean/engine/dist/miniprogram"),e=require("@galacean/engine-miniprogram-adapter");function r(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 n(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function a(){return a=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},a.apply(this,arguments)}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}function s(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 o(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 l(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}"function"==typeof SuppressedError&&SuppressedError;var h=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}(),u=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}();u.WHITE=new u(1,1,1,1),u.RED=new u(1,0,0,1),u.GREEN=new u(0,1,0,1),u.BLUE=new u(0,0,1,1),u.MAGENTA=new u(1,0,1,1);var c=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}();c.PI=3.1415927,c.PI2=2*c.PI,c.radiansToDegrees=180/c.PI,c.radDeg=c.radiansToDegrees,c.degreesToRadians=c.PI/180,c.degRad=c.degreesToRadians;var d=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}();d.SUPPORTS_TYPED_ARRAYS="undefined"!=typeof Float32Array;var f,v=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}(),p=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}(),g=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 u,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"}(f||(f={}));var m,w,x,E=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 l=this.skeleton,h=r+90+s,u=l.scaleX,d=l.scaleY;return this.a=c.cosDeg(r+i)*n*u,this.b=c.cosDeg(h)*a*u,this.c=c.sinDeg(r+i)*n*d,this.d=c.sinDeg(h)*a*d,this.worldX=t*u+l.x,void(this.worldY=e*d+l.y)}var v=o.a,p=o.b,g=o.c,m=o.d;switch(this.worldX=v*t+p*e+o.worldX,this.worldY=g*t+m*e+o.worldY,this.data.transformMode){case f.Normal:var w=r+90+s,x=c.cosDeg(r+i)*n,E=c.cosDeg(w)*a,y=c.sinDeg(r+i)*n,b=c.sinDeg(w)*a;return this.a=v*x+p*y,this.b=v*E+p*b,this.c=g*x+m*y,void(this.d=g*E+m*b);case f.OnlyTranslation:var S=r+90+s;this.a=c.cosDeg(r+i)*n,this.b=c.cosDeg(S)*a,this.c=c.sinDeg(r+i)*n,this.d=c.sinDeg(S)*a;break;case f.NoRotationOrReflection:var M=v*v+g*g,T=0;M>1e-4?(M=Math.abs(v*m-p*g)/M,v/=this.skeleton.scaleX,p=(g/=this.skeleton.scaleY)*M,m=v*M,T=Math.atan2(g,v)*c.radDeg):(v=0,g=0,T=90-Math.atan2(m,p)*c.radDeg);var A=r+i-T,I=r+s-T+90,R=c.cosDeg(A)*n,C=c.cosDeg(I)*a,k=c.sinDeg(A)*n,V=c.sinDeg(I)*a;this.a=v*R-p*k,this.b=v*C-p*V,this.c=g*R+m*k,this.d=g*C+m*V;break;case f.NoScale:case f.NoScaleOrReflection:var P=c.cosDeg(r),_=c.sinDeg(r),F=(v*P+p*_)/this.skeleton.scaleX,N=(g*P+m*_)/this.skeleton.scaleY,O=Math.sqrt(F*F+N*N);O>1e-5&&(O=1/O),F*=O,N*=O,O=Math.sqrt(F*F+N*N),this.data.transformMode==f.NoScale&&v*m-p*g<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(O=-O);var B=Math.PI/2+Math.atan2(N,F),L=Math.cos(B)*O,X=Math.sin(B)*O,D=c.cosDeg(i)*n,Y=c.cosDeg(90+s)*a,U=c.sinDeg(i)*n,W=c.sinDeg(90+s)*a;this.a=F*D+L*U,this.b=F*Y+L*W,this.c=N*D+X*U,this.d=N*Y+X*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)*c.radDeg},e.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*c.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)*c.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)*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 l=i*a,h=i*e,u=i*r,d=i*n,f=l*this.a-u*this.c,v=l*this.b-u*this.d,p=h*this.c-d*this.a,g=h*this.d-d*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+p*p),this.ascaleX>1e-4){var m=f*g-v*p;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(f*v+p*g,m)*c.radDeg,this.arotation=Math.atan2(p,f)*c.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(v*v+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,v)*c.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=c.sinDeg(t),r=c.cosDeg(t);return Math.atan2(this.a*e-this.c*r,this.d*r-this.b*e)*c.radDeg+this.rotation-this.shearX},e.localToWorldRotation=function(t){t-=this.rotation-this.shearX;var e=c.sinDeg(t),r=c.cosDeg(t);return Math.atan2(r*this.c+e*this.d,r*this.a+e*this.b)*c.radDeg},e.rotateWorld=function(t){var e=this.a,r=this.b,n=this.c,a=this.d,i=c.cosDeg(t),s=c.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}(),y=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 u,this.darkColor=null==t.darkColor?null:new u,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}(),b=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,l=o.a,h=o.b,u=o.c,d=o.d,v=-t.ashearX-t.arotation,p=0,g=0;switch(t.data.transformMode){case f.OnlyTranslation:p=e-t.worldX,g=r-t.worldY;break;case f.NoRotationOrReflection:var m=Math.abs(l*d-h*u)/(l*l+u*u),w=l/t.skeleton.scaleX,x=u/t.skeleton.scaleY;h=-x*m*t.skeleton.scaleX,d=w*m*t.skeleton.scaleY,v+=Math.atan2(x,w)*c.radDeg;default:var E=e-o.worldX,y=r-o.worldY,b=l*d-h*u;p=(E*d-y*h)/b-t.ax,g=(y*l-E*u)/b-t.ay}v+=Math.atan2(g,p)*c.radDeg,t.ascaleX<0&&(v+=180),v>180?v-=360:v<-180&&(v+=360);var S=t.ascaleX,M=t.ascaleY;if(n||a){switch(t.data.transformMode){case f.NoScale:case f.NoScaleOrReflection:p=e-t.worldX,g=r-t.worldY}var T=t.data.length*S,A=Math.sqrt(p*p+g*g);if(n&&A<T||a&&A>T&&T>1e-4){var I=(A/T-1)*s+1;S*=I,i&&(M*=I)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+v*s,S,M,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 l=t.ax,h=t.ay,u=t.ascaleX,d=u,f=t.ascaleY,v=e.ascaleX,p=0,g=0,m=0;u<0?(u=-u,p=180,m=-1):(p=0,m=1),f<0&&(f=-f,m=-m),v<0?(v=-v,g=180):g=0;var w=e.ax,x=0,E=0,y=0,b=t.a,S=t.b,M=t.c,T=t.d,A=Math.abs(u-f)<=1e-4;A?(E=b*w+S*(x=e.ay)+t.worldX,y=M*w+T*x+t.worldY):(x=0,E=b*w+t.worldX,y=M*w+t.worldY);var I=t.parent;b=I.a,S=I.b,M=I.c;var R,C,k=1/(b*(T=I.d)-S*M),V=E-I.worldX,P=y-I.worldY,_=(V*T-P*S)*k-l,F=(P*b-V*M)*k-h,N=Math.sqrt(_*_+F*F),O=e.data.length*v;if(N<1e-4)return this.apply1(t,r,n,!1,i,!1,o),void e.updateWorldTransformWith(w,x,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var B=((V=r-I.worldX)*T-(P=n-I.worldY)*S)*k-l,L=(P*b-V*M)*k-h,X=B*B+L*L;if(0!=s){s*=u*(v+1)/2;var D=Math.sqrt(X),Y=D-N-O*u+s;if(Y>0){var U=Math.min(1,Y/(2*s))-1;X=(B-=(U=(Y-s*(1-U*U))/D)*B)*B+(L-=U*L)*L}}t:if(A){var W=(X-N*N-(O*=u)*O)/(2*N*O);W<-1?W=-1:W>1&&(W=1,i&&(d*=(Math.sqrt(X)/(N+O)-1)*o+1)),C=Math.acos(W)*a,b=N+O*W,S=O*Math.sin(C),R=Math.atan2(L*b-B*S,B*b+L*S)}else{var q=(b=u*O)*b,H=(S=f*O)*S,j=Math.atan2(L,B),G=-2*H*N,z=H-q;if((T=G*G-4*z*(M=H*N*N+q*X-q*H))>=0){var Z=Math.sqrt(T);G<0&&(Z=-Z);var Q=(Z=-(G+Z)/2)/z,J=M/Z,K=Math.abs(Q)<Math.abs(J)?Q:J;if(K*K<=X){P=Math.sqrt(X-K*K)*a,R=j-Math.atan2(P,K),C=Math.atan2(P/f,(K-N)/u);break t}}var $=c.PI,tt=N-b,et=tt*tt,rt=0,nt=0,at=N+b,it=at*at,st=0;(M=-b*N/(q-H))>=-1&&M<=1&&(M=Math.acos(M),(T=(V=b*Math.cos(M)+N)*V+(P=S*Math.sin(M))*P)<et&&($=M,et=T,tt=V,rt=P),T>it&&(nt=M,it=T,at=V,st=P)),X<=(et+it)/2?(R=j-Math.atan2(rt*a,tt),C=$*a):(R=j-Math.atan2(st*a,at),C=nt*a)}var ot=Math.atan2(x,w)*m,lt=t.arotation;(R=(R-ot)*c.radDeg+p-lt)>180?R-=360:R<-180&&(R+=360),t.updateWorldTransformWith(l,h,lt+R*o,d,t.ascaleY,0,0),lt=e.arotation,(C=((C+ot)*c.radDeg-e.ashearX)*m+g-lt)>180?C-=360:C<-180&&(C+=360),e.updateWorldTransformWith(w,x,lt+C*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}else e.updateWorldTransform()},t}(),S=function(){function t(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new p,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,l=a.d,h=i*l-s*o>0?c.degRad:-c.degRad,u=this.data.offsetRotation*h,d=this.data.offsetShearY*h,f=this.bones,v=0,p=f.length;v<p;v++){var g=f[v],m=!1;if(0!=t){var w=g.a,x=g.b,E=g.c,y=g.d,b=Math.atan2(o,i)-Math.atan2(E,w)+u;b>c.PI?b-=c.PI2:b<-c.PI&&(b+=c.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);g.a=S*w-M*E,g.b=S*x-M*y,g.c=M*w+S*E,g.d=M*x+S*y,m=!0}if(0!=e){var T=this.temp;a.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(T.x-g.worldX)*e,g.worldY+=(T.y-g.worldY)*e,m=!0}if(r>0){var A=Math.sqrt(g.a*g.a+g.c*g.c),I=Math.sqrt(i*i+o*o);A>1e-5&&(A=(A+(I-A+this.data.offsetScaleX)*r)/A),g.a*=A,g.c*=A,A=Math.sqrt(g.b*g.b+g.d*g.d),I=Math.sqrt(s*s+l*l),A>1e-5&&(A=(A+(I-A+this.data.offsetScaleY)*r)/A),g.b*=A,g.d*=A,m=!0}if(n>0){var R=g.b,C=g.d,k=Math.atan2(C,R),V=Math.atan2(l,s)-Math.atan2(o,i)-(k-Math.atan2(g.c,g.a));V>c.PI?V-=c.PI2:V<-c.PI&&(V+=c.PI2),V=k+(V+d)*n;var P=Math.sqrt(R*R+C*C);g.b=Math.cos(V)*P,g.d=Math.sin(V)*P,m=!0}m&&(g.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,l=a.d,h=i*l-s*o>0?c.degRad:-c.degRad,u=this.data.offsetRotation*h,d=this.data.offsetShearY*h,f=this.bones,v=0,p=f.length;v<p;v++){var g=f[v],m=!1;if(0!=t){var w=g.a,x=g.b,E=g.c,y=g.d,b=Math.atan2(o,i)+u;b>c.PI?b-=c.PI2:b<-c.PI&&(b+=c.PI2),b*=t;var S=Math.cos(b),M=Math.sin(b);g.a=S*w-M*E,g.b=S*x-M*y,g.c=M*w+S*E,g.d=M*x+S*y,m=!0}if(0!=e){var T=this.temp;a.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),g.worldX+=T.x*e,g.worldY+=T.y*e,m=!0}if(r>0){var A=(Math.sqrt(i*i+o*o)-1+this.data.offsetScaleX)*r+1;g.a*=A,g.c*=A,A=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*r+1,g.b*=A,g.d*=A,m=!0}if(n>0){var I=Math.atan2(l,s)-Math.atan2(o,i);I>c.PI?I-=c.PI2:I<-c.PI&&(I+=c.PI2);var R=g.b,C=g.d;I=Math.atan2(C,R)+(I-c.PI/2+d)*n;var k=Math.sqrt(R*R+C*C);g.b=Math.cos(I)*k,g.d=Math.sin(I)*k,m=!0}m&&(g.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 l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;if(0!=t){var u=a.arotation-h+this.data.offsetRotation;h+=(u-=360*(16384-(16384.499999999996-u/360|0)))*t}var c=l.ax,d=l.ay;0!=e&&(c+=(a.ax-c+this.data.offsetX)*e,d+=(a.ay-d+this.data.offsetY)*e);var f=l.ascaleX,v=l.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=l.ashearY;if(0!=n){var g=a.ashearY-p+this.data.offsetShearY;g-=360*(16384-(16384.499999999996-g/360|0)),l.shearY+=g*n}l.updateWorldTransformWith(c,d,h,f,v,l.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 l=i[s];l.appliedValid||l.updateAppliedTransform();var h=l.arotation;0!=t&&(h+=(a.arotation+this.data.offsetRotation)*t);var u=l.ax,c=l.ay;0!=e&&(u+=(a.ax+this.data.offsetX)*e,c+=(a.ay+this.data.offsetY)*e);var d=l.ascaleX,f=l.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=l.ashearY;0!=n&&(v+=(a.ashearY+this.data.offsetShearY)*n),l.updateWorldTransformWith(u,c,h,d,f,l.ashearX,v)}},t}(),M=function(t,e,r){this.name=t,this.order=e,this.skinRequired=r},T=function(t){function e(e){var r;return(r=t.call(this,e,0,!1)||this).bones=new Array,r}return s(e,t),e}(M);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(m||(m={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent"}(w||(w={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(x||(x={}));var A=function(t){if(null==t)throw new Error("name cannot be null.");this.name=t},I=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}s(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,l=this.vertices,h=this.bones;if(null!=h){for(var u=0,c=0,d=0;d<e;d+=2){var f=h[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,x=h[u++];for(x+=u;u<x;u++,g+=3){var E=v[h[u]],y=l[g],b=l[g+1],S=l[g+2];m+=(y*E.a+b*E.b+E.worldX)*S,w+=(y*E.c+b*E.d+E.worldY)*S}n[p]=m,n[p+1]=w}else for(var M=o,T=a,A=3*c,I=c<<1;T<r;T+=i){var R=0,C=0,k=h[u++];for(k+=u;u<k;u++,A+=3,I+=2){var V=v[h[u]],P=l[A]+M[I],_=l[A+1]+M[I+1],F=l[A+2];R+=(P*V.a+_*V.b+V.worldX)*F,C+=(P*V.c+_*V.d+V.worldY)*F}n[T]=R,n[T+1]=C}}else{o.length>0&&(l=o);for(var N=t.bone,O=N.worldX,B=N.worldY,L=N.a,X=N.b,D=N.c,Y=N.d,U=e,W=a;W<r;U+=2,W+=i){var q=l[U],H=l[U+1];n[W]=q*L+H*X+O,n[W+1]=q*D+H*Y+B}}},r.copyTo=function(t){null!=this.bones?(t.bones=new Array(this.bones.length),d.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,null!=this.vertices?(t.vertices=d.newFloatArray(this.vertices.length),d.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment},e}(A);I.nextID=0;var R=function(t){function e(e){var r;return(r=t.call(this,e)||this).closed=!1,r.constantSpeed=!1,r.color=new u(1,1,1,1),r}return s(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),d.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t},e}(I),C=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(l(e,R)){var r=this.rotateMix,n=this.translateMix,a=r>0;if(n>0||a){var i=this.data,s=i.spacingMode==w.Percent,o=i.rotateMode,h=o==x.Tangent,u=o==x.ChainScale,f=this.bones.length,v=h?f:f+1,p=this.bones,g=d.setArraySize(this.spaces,v),E=null,y=this.spacing;if(u||!s){u&&(E=d.setArraySize(this.lengths,f));for(var b=i.spacingMode==w.Length,S=0,M=v-1;S<M;){var T=p[S],A=T.data.length;if(A<t.epsilon)u&&(E[S]=0),g[++S]=0;else if(s){if(u){var I=A*T.a,C=A*T.c,k=Math.sqrt(I*I+C*C);E[S]=k}g[++S]=y}else{var V=A*T.a,P=A*T.c,_=Math.sqrt(V*V+P*P);u&&(E[S]=_),g[++S]=(b?A+y:y)*_/A}}}else for(var F=1;F<v;F++)g[F]=y;var N=this.computeWorldPositions(e,v,h,i.positionMode==m.Percent,s),O=N[0],B=N[1],L=i.offsetRotation,X=!1;if(0==L)X=o==x.Chain;else{X=!1;var D=this.target.bone;L*=D.a*D.d-D.b*D.c>0?c.degRad:-c.degRad}for(var Y=0,U=3;Y<f;Y++,U+=3){var W=p[Y];W.worldX+=(O-W.worldX)*n,W.worldY+=(B-W.worldY)*n;var q=N[U],H=N[U+1],j=q-O,G=H-B;if(u){var z=E[Y];if(0!=z){var Z=(Math.sqrt(j*j+G*G)/z-1)*r+1;W.a*=Z,W.c*=Z}}if(O=q,B=H,a){var Q=W.a,J=W.b,K=W.c,$=W.d,tt=0,et=0,rt=0;if(tt=h?N[U-1]:0==g[Y+1]?N[U+2]:Math.atan2(G,j),tt-=Math.atan2(K,Q),X){et=Math.cos(tt),rt=Math.sin(tt);var nt=W.data.length;O+=(nt*(et*Q-rt*K)-j)*r,B+=(nt*(rt*Q+et*K)-G)*r}else tt+=L;tt>c.PI?tt-=c.PI2:tt<-c.PI&&(tt+=c.PI2),tt*=r,et=Math.cos(tt),rt=Math.sin(tt),W.a=et*Q-rt*K,W.b=et*J-rt*$,W.c=rt*Q+et*K,W.d=rt*J+et*$}W.appliedValid=!1}}}},e.computeWorldPositions=function(e,r,n,a,i){var s=this.target,o=this.position,l=this.spaces,h=d.setArraySize(this.positions,3*r+2),u=null,c=e.closed,f=e.worldVerticesLength,v=f/6,p=t.NONE;if(!e.constantSpeed){var g=e.lengths,m=g[v-=c?1:2];if(a&&(o*=m),i)for(var w=1;w<r;w++)l[w]*=m;u=d.setArraySize(this.world,8);for(var x=0,E=0,y=0;x<r;x++,E+=3){var b=l[x],S=o+=b;if(c)(S%=m)<0&&(S+=m),y=0;else{if(S<0){p!=t.BEFORE&&(p=t.BEFORE,e.computeWorldVertices(s,2,4,u,0,2)),this.addBeforePosition(S,u,0,h,E);continue}if(S>m){p!=t.AFTER&&(p=t.AFTER,e.computeWorldVertices(s,f-6,4,u,0,2)),this.addAfterPosition(S-m,u,0,h,E);continue}}for(;;y++){var M=g[y];if(!(S>M)){if(0==y)S/=M;else{var T=g[y-1];S=(S-T)/(M-T)}break}}y!=p&&(p=y,c&&y==v?(e.computeWorldVertices(s,f-4,4,u,0,2),e.computeWorldVertices(s,0,4,u,4,2)):e.computeWorldVertices(s,6*y+2,8,u,0,2)),this.addCurvePosition(S,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],h,E,n||x>0&&0==b)}return h}c?(f+=2,u=d.setArraySize(this.world,f),e.computeWorldVertices(s,2,f-4,u,0,2),e.computeWorldVertices(s,0,2,u,f-4,2),u[f-2]=u[0],u[f-1]=u[1]):(v--,f-=4,u=d.setArraySize(this.world,f),e.computeWorldVertices(s,2,f,u,0,2));for(var A=d.setArraySize(this.curves,v),I=0,R=u[0],C=u[1],k=0,V=0,P=0,_=0,F=0,N=0,O=0,B=0,L=0,X=0,D=0,Y=0,U=0,W=0,q=0,H=2;q<v;q++,H+=6)k=u[H],V=u[H+1],P=u[H+2],_=u[H+3],D=2*(O=.1875*(R-2*k+P))+(L=.09375*(3*(k-P)-R+(F=u[H+4]))),Y=2*(B=.1875*(C-2*V+_))+(X=.09375*(3*(V-_)-C+(N=u[H+5]))),U=.75*(k-R)+O+.16666667*L,W=.75*(V-C)+B+.16666667*X,I+=Math.sqrt(U*U+W*W),U+=D,W+=Y,D+=L,Y+=X,I+=Math.sqrt(U*U+W*W),U+=D,W+=Y,I+=Math.sqrt(U*U+W*W),U+=D+L,W+=Y+X,I+=Math.sqrt(U*U+W*W),A[q]=I,R=F,C=N;if(o*=a?I:I/e.lengths[v-1],i)for(var j=1;j<r;j++)l[j]*=I;for(var G=this.segments,z=0,Z=0,Q=0,J=0,K=0;Z<r;Z++,Q+=3){var $=l[Z],tt=o+=$;if(c)(tt%=I)<0&&(tt+=I),J=0;else{if(tt<0){this.addBeforePosition(tt,u,0,h,Q);continue}if(tt>I){this.addAfterPosition(tt-I,u,f-4,h,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!=p){p=J;var nt=6*J;for(R=u[nt],C=u[nt+1],k=u[nt+2],V=u[nt+3],P=u[nt+4],_=u[nt+5],D=2*(O=.03*(R-2*k+P))+(L=.006*(3*(k-P)-R+(F=u[nt+6]))),Y=2*(B=.03*(C-2*V+_))+(X=.006*(3*(V-_)-C+(N=u[nt+7]))),U=.3*(k-R)+O+.16666667*L,W=.3*(V-C)+B+.16666667*X,z=Math.sqrt(U*U+W*W),G[0]=z,nt=1;nt<8;nt++)U+=D,W+=Y,D+=L,Y+=X,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+L,W+=Y+X,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,R,C,k,V,P,_,F,N,h,Q,n||Z>0&&0==$)}return h},e.addBeforePosition=function(t,e,r,n,a){var i=e[r],s=e[r+1],o=e[r+2]-i,l=e[r+3]-s,h=Math.atan2(l,o);n[a]=i+t*Math.cos(h),n[a+1]=s+t*Math.sin(h),n[a+2]=h},e.addAfterPosition=function(t,e,r,n,a){var i=e[r+2],s=e[r+3],o=i-e[r],l=s-e[r+1],h=Math.atan2(l,o);n[a]=i+t*Math.cos(h),n[a+1]=s+t*Math.sin(h),n[a+2]=h},e.addCurvePosition=function(t,e,r,n,a,i,s,o,l,h,u,c){if(0==t||isNaN(t))return h[u]=e,h[u+1]=r,void(h[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,x=v*w,E=w*t,y=e*g+n*x+i*E+o*f,b=r*g+a*x+s*E+l*f;h[u]=y,h[u+1]=b,c&&(h[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}();C.NONE=-1,C.BEFORE=-2,C.AFTER=-3,C.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 u(1,1,1,1),r.offset=d.newFloatArray(8),r.uvs=d.newFloatArray(8),r.tempColor=new u(1,1,1,1),r}s(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,l=Math.cos(o),h=Math.sin(o),u=n*l+this.x,c=n*h,d=a*l+this.y,f=a*h,v=i*l+this.x,p=i*h,g=s*l+this.y,m=s*h,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,l=t.a,h=t.b,u=t.c,c=t.d,d=0,f=0;d=i[e.OX1],f=i[e.OY1],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX2],f=i[e.OY2],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX3],f=i[e.OY3],r[n]=d*l+f*h+s,r[n+1]=d*u+f*c+o,n+=a,d=i[e.OX4],f=i[e.OY4],r[n]=d*l+f*h+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,d.arrayCopy(this.uvs,0,t.uvs,0,8),d.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t},e}(A);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 V,P,_=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"}(V||(V={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(P||(P={}));var F,N,O,B=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},L=function(t){function e(){return t.apply(this,arguments)}s(e,t);var r=e.prototype;return r.setFilters=function(t,e){},r.setWraps=function(t,e){},r.dispose=function(){},e}(_),X=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 D(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 U;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 l=parseInt(n[0]),h=parseInt(n[1]);r.readTuple(n);var u=parseInt(n[0]),c=parseInt(n[1]);s.u=l/a.width,s.v=h/a.height,s.rotate?(s.u2=(l+c)/a.width,s.v2=(h+u)/a.height):(s.u2=(l+u)/a.width,s.v2=(h+c)/a.height),s.x=l,s.y=h,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 Y).name=i,2==r.readTuple(n)&&(a.width=parseInt(n[0]),a.height=parseInt(n[1]),r.readTuple(n)),r.readTuple(n),a.minFilter=_.filterFromString(n[0]),a.magFilter=_.filterFromString(n[1]);var d=r.readValue();a.uWrap=P.ClampToEdge,a.vWrap=P.ClampToEdge,"x"==d?a.uWrap=P.Repeat:"y"==d?a.vWrap=P.Repeat:"xy"==d&&(a.uWrap=a.vWrap=P.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}(),D=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}(),Y=function(){},U=function(t){function e(){return t.apply(this,arguments)}return s(e,t),e}(B),W=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new u(1,1,1,1),r.tempColor=new u(0,0,0,0),r}s(e,t);var r=e.prototype;return r.updateUVs=function(){var t=this.regionUVs;null!=this.uvs&&this.uvs.length==t.length||(this.uvs=d.newFloatArray(t.length));var e=this.uvs,r=this.uvs.length,n=this.region.u,a=this.region.v,i=0,s=0;if(l(this.region,U)){var o=this.region,h=o.texture.getImage().width,u=o.texture.getImage().height;switch(o.degrees){case 90:n-=(o.originalHeight-o.offsetY-o.height)/h,a-=(o.originalWidth-o.offsetX-o.width)/u,i=o.originalHeight/h,s=o.originalWidth/u;for(var c=0;c<r;c+=2)e[c]=n+t[c+1]*i,e[c+1]=a+(1-t[c])*s;return;case 180:n-=(o.originalWidth-o.offsetX-o.width)/h,a-=o.offsetY/u,i=o.originalWidth/h,s=o.originalHeight/u;for(var f=0;f<r;f+=2)e[f]=n+(1-t[f])*i,e[f+1]=a+(1-t[f+1])*s;return;case 270:n-=o.offsetY/h,a-=o.offsetX/u,i=o.originalHeight/h,s=o.originalWidth/u;for(var v=0;v<r;v+=2)e[v]=n+(1-t[v+1])*i,e[v+1]=a+t[v]*s;return}n-=o.offsetX/h,a-=(o.originalHeight-o.offsetY-o.height)/u,i=o.originalWidth/h,s=o.originalHeight/u}else null==this.region?(n=a=0,i=s=1):(i=this.region.u2-n,s=this.region.v2-a);for(var p=0;p<r;p+=2)e[p]=n+t[p]*i,e[p+1]=a+t[p+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),d.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=new Array(this.uvs.length),d.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),d.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,null!=this.edges&&(t.edges=new Array(this.edges.length),d.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}(I),q=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 E(r,this,null);else{var a=this.bones[r.parent.index];n=new E(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],l=new y(s,o);this.slots.push(l),this.drawOrder.push(l)}this.ikConstraints=new Array;for(var h=0;h<t.ikConstraints.length;h++){var c=t.ikConstraints[h];this.ikConstraints.push(new b(c,this))}this.transformConstraints=new Array;for(var d=0;d<t.transformConstraints.length;d++){var f=t.transformConstraints[d];this.transformConstraints.push(new S(f,this))}this.pathConstraints=new Array;for(var v=0;v<t.pathConstraints.length;v++){var p=t.pathConstraints[v];this.pathConstraints.push(new C(p,this))}this.color=new u(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 l=this.bones[i[s].index];do{l.sorted=!1,l.active=!0,l=l.parent}while(null!=l)}var h=this.ikConstraints,u=this.transformConstraints,c=this.pathConstraints,d=h.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=h[m];if(w.data.order==g){this.sortIkConstraint(w);continue t}}for(var x=0;x<f;x++){var E=u[x];if(E.data.order==g){this.sortTransformConstraint(E);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&&d.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&&d.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();l(s,R)&&this.sortPathConstraintAttachmentWith(s,n);for(var o=t.bones,h=o.length,u=0;u<h;u++)this.sortBone(o[u]);this._updateCache.push(t);for(var c=0;c<h;c++)this.sortReset(o[c].children);for(var f=0;f<h;f++)o[f].sorted=!0}},e.sortTransformConstraint=function(t){if(t.active=t.target.isActive()&&(!t.data.skinRequired||null!=this.skin&&d.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(l(t,R)){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,l=0,h=o.length;l<h;l++){var u=o[l],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;d.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,u=n.length;h<u;h++){var c=n[h];if(c.bone.active){var f=0,v=null,p=c.getAttachment();if(l(p,k))f=8,v=d.setArraySize(r,f,0),p.computeWorldVertices(c.bone,v,0,2);else if(l(p,W)){var g=p;f=g.worldVerticesLength,v=d.setArraySize(r,f,0),g.computeWorldVertices(c,0,f,v,0,2)}if(null!=v)for(var m=0,w=v.length;m<w;m+=2){var x=v[m],E=v[m+1];a=Math.min(a,x),i=Math.min(i,E),s=Math.max(s,x),o=Math.max(o,E)}}}t.set(a,i),e.set(s-a,o-i)},e.update=function(t){this.time+=t},t}(),H=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 l=this.timelines,h=0,u=l.length;h<u;h++)l[h].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"}(F||(F={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(N||(N={})),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"}(O||(O={}));var j=function(){function t(e){if(e<=0)throw new Error("frameCount must be > 0: "+e);this.curves=d.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),l=.006*(3*(r-a)+1),h=.006*(3*(n-i)+1),u=2*s+l,c=2*o+h,d=.3*r+s+.16666667*l,f=.3*n+o+.16666667*h,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+=l,c+=h,g+=d,m+=f},e.getCurvePercent=function(e,r){r=c.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,l=a+t.BEZIER_SIZE-1;a<l;a+=2)if((s=n[a])>=r){var h=void 0,u=void 0;return a==o?(h=0,u=0):(h=n[a-2],u=n[a-1]),u+(n[a+1]-u)*(r-h)/(s-h)}var d=n[a-1];return d+(1-d)*(r-s)/(1-s)},t}();j.LINEAR=0,j.STEPPED=1,j.BEZIER=2,j.BEZIER_SIZE=19;var G=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=d.newFloatArray(e<<1),r}s(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 l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return void(h.rotation=h.data.rotation);case 1:var u=h.data.rotation-h.rotation;h.rotation+=(u-360*(16384-(16384.499999999996-u/360|0)))*i}else if(n>=l[l.length-e.ENTRIES]){var c=l[l.length+e.PREV_ROTATION];switch(s){case 0:h.rotation=h.data.rotation+c*i;break;case 1:case 2:c+=h.data.rotation-h.rotation,c-=360*(16384-(16384.499999999996-c/360|0));case 3:h.rotation+=c*i}}else{var d=H.binarySearch(l,n,e.ENTRIES),f=l[d+e.PREV_ROTATION],v=l[d],p=this.getCurvePercent((d>>1)-1,1-(n-v)/(l[d+e.PREV_TIME]-v)),g=l[d+e.ROTATION]-f;switch(g=f+(g-360*(16384-(16384.499999999996-g/360|0)))*p,s){case 0:h.rotation=h.data.rotation+(g-360*(16384-(16384.499999999996-g/360|0)))*i;break;case 1:case 2:g+=h.data.rotation-h.rotation;case 3:h.rotation+=(g-360*(16384-(16384.499999999996-g/360|0)))*i}}},e}(j);G.ENTRIES=2,G.PREV_TIME=-2,G.PREV_ROTATION=-1,G.ROTATION=1;var z=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.x=h.data.x,void(h.y=h.data.y);case 1:h.x+=(h.data.x-h.x)*i,h.y+=(h.data.y-h.y)*i}else{var u=0,c=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=H.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*v,c+=(l[d+e.Y]-c)*v}switch(s){case 0:h.x=h.data.x+u*i,h.y=h.data.y+c*i;break;case 1:case 2:h.x+=(h.data.x+u-h.x)*i,h.y+=(h.data.y+c-h.y)*i;break;case 3:h.x+=u*i,h.y+=c*i}}},e}(j);z.ENTRIES=3,z.PREV_TIME=-3,z.PREV_X=-2,z.PREV_Y=-1,z.X=1,z.Y=2;var Z=function(t){function e(e){return t.call(this,e)}s(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 l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.scaleX=h.data.scaleX,void(h.scaleY=h.data.scaleY);case 1:h.scaleX+=(h.data.scaleX-h.scaleX)*i,h.scaleY+=(h.data.scaleY-h.scaleY)*i}else{var u=0,d=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X]*h.data.scaleX,d=l[l.length+e.PREV_Y]*h.data.scaleY;else{var f=H.binarySearch(l,n,e.ENTRIES);u=l[f+e.PREV_X],d=l[f+e.PREV_Y];var v=l[f],p=this.getCurvePercent(f/e.ENTRIES-1,1-(n-v)/(l[f+e.PREV_TIME]-v));u=(u+(l[f+e.X]-u)*p)*h.data.scaleX,d=(d+(l[f+e.Y]-d)*p)*h.data.scaleY}if(1==i)3==s?(h.scaleX+=u-h.data.scaleX,h.scaleY+=d-h.data.scaleY):(h.scaleX=u,h.scaleY=d);else{var g=0,m=0;if(1==o)switch(s){case 0:g=h.data.scaleX,m=h.data.scaleY,h.scaleX=g+(Math.abs(u)*c.signum(g)-g)*i,h.scaleY=m+(Math.abs(d)*c.signum(m)-m)*i;break;case 1:case 2:g=h.scaleX,m=h.scaleY,h.scaleX=g+(Math.abs(u)*c.signum(g)-g)*i,h.scaleY=m+(Math.abs(d)*c.signum(m)-m)*i;break;case 3:g=h.scaleX,m=h.scaleY,h.scaleX=g+(Math.abs(u)*c.signum(g)-h.data.scaleX)*i,h.scaleY=m+(Math.abs(d)*c.signum(m)-h.data.scaleY)*i}else switch(s){case 0:g=Math.abs(h.data.scaleX)*c.signum(u),m=Math.abs(h.data.scaleY)*c.signum(d),h.scaleX=g+(u-g)*i,h.scaleY=m+(d-m)*i;break;case 1:case 2:g=Math.abs(h.scaleX)*c.signum(u),m=Math.abs(h.scaleY)*c.signum(d),h.scaleX=g+(u-g)*i,h.scaleY=m+(d-m)*i;break;case 3:g=c.signum(u),m=c.signum(d),h.scaleX=Math.abs(h.scaleX)*g+(u-Math.abs(h.data.scaleX)*g)*i,h.scaleY=Math.abs(h.scaleY)*m+(d-Math.abs(h.data.scaleY)*m)*i}}}},e}(z),Q=function(t){function e(e){return t.call(this,e)}s(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 l=this.frames,h=t.bones[this.boneIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.shearX=h.data.shearX,void(h.shearY=h.data.shearY);case 1:h.shearX+=(h.data.shearX-h.shearX)*i,h.shearY+=(h.data.shearY-h.shearY)*i}else{var u=0,c=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_X],c=l[l.length+e.PREV_Y];else{var d=H.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_X],c=l[d+e.PREV_Y];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.X]-u)*v,c+=(l[d+e.Y]-c)*v}switch(s){case 0:h.shearX=h.data.shearX+u*i,h.shearY=h.data.shearY+c*i;break;case 1:case 2:h.shearX+=(h.data.shearX+u-h.shearX)*i,h.shearY+=(h.data.shearY+c-h.shearY)*i;break;case 3:h.shearX+=u*i,h.shearY+=c*i}}},e}(z),J=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(n<h[0])switch(s){case 0:return void l.color.setFromColor(l.data.color);case 1:var u=l.color,c=l.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>=h[h.length-e.ENTRIES]){var g=h.length;d=h[g+e.PREV_R],f=h[g+e.PREV_G],v=h[g+e.PREV_B],p=h[g+e.PREV_A]}else{var m=H.binarySearch(h,n,e.ENTRIES);d=h[m+e.PREV_R],f=h[m+e.PREV_G],v=h[m+e.PREV_B],p=h[m+e.PREV_A];var w=h[m],x=this.getCurvePercent(m/e.ENTRIES-1,1-(n-w)/(h[m+e.PREV_TIME]-w));d+=(h[m+e.R]-d)*x,f+=(h[m+e.G]-f)*x,v+=(h[m+e.B]-v)*x,p+=(h[m+e.A]-p)*x}if(1==i)l.color.set(d,f,v,p);else{var E=l.color;0==s&&E.setFromColor(l.data.color),E.add((d-E.r)*i,(f-E.g)*i,(v-E.b)*i,(p-E.a)*i)}}}},e}(j);J.ENTRIES=5,J.PREV_TIME=-5,J.PREV_R=-4,J.PREV_G=-3,J.PREV_B=-2,J.PREV_A=-1,J.R=1,J.G=2,J.B=3,J.A=4;var K=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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,l,h){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]=l,this.frames[t+e.B2]=h},r.apply=function(t,r,n,a,i,s,o){var l=t.slots[this.slotIndex];if(l.bone.active){var h=this.frames;if(n<h[0])switch(s){case 0:return l.color.setFromColor(l.data.color),void l.darkColor.setFromColor(l.data.darkColor);case 1:var u=l.color,c=l.darkColor,d=l.data.color,f=l.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,x=0,E=0;if(n>=h[h.length-e.ENTRIES]){var y=h.length;v=h[y+e.PREV_R],p=h[y+e.PREV_G],g=h[y+e.PREV_B],m=h[y+e.PREV_A],w=h[y+e.PREV_R2],x=h[y+e.PREV_G2],E=h[y+e.PREV_B2]}else{var b=H.binarySearch(h,n,e.ENTRIES);v=h[b+e.PREV_R],p=h[b+e.PREV_G],g=h[b+e.PREV_B],m=h[b+e.PREV_A],w=h[b+e.PREV_R2],x=h[b+e.PREV_G2],E=h[b+e.PREV_B2];var S=h[b],M=this.getCurvePercent(b/e.ENTRIES-1,1-(n-S)/(h[b+e.PREV_TIME]-S));v+=(h[b+e.R]-v)*M,p+=(h[b+e.G]-p)*M,g+=(h[b+e.B]-g)*M,m+=(h[b+e.A]-m)*M,w+=(h[b+e.R2]-w)*M,x+=(h[b+e.G2]-x)*M,E+=(h[b+e.B2]-E)*M}if(1==i)l.color.set(v,p,g,m),l.darkColor.set(w,x,E,1);else{var T=l.color,A=l.darkColor;0==s&&(T.setFromColor(l.data.color),A.setFromColor(l.data.darkColor)),T.add((v-T.r)*i,(p-T.g)*i,(g-T.b)*i,(m-T.a)*i),A.add((w-A.r)*i,(x-A.g)*i,(E-A.b)*i,0)}}}},e}(j);K.ENTRIES=8,K.PREV_TIME=-8,K.PREV_R=-7,K.PREV_G=-6,K.PREV_B=-5,K.PREV_A=-4,K.PREV_R2=-3,K.PREV_G2=-2,K.PREV_B2=-1,K.R=1,K.G=2,K.B=3,K.A=4,K.R2=5,K.G2=6,K.B2=7;var $=function(){function t(t){this.frames=d.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 l=this.frames;if(r<l[0])0!=i&&1!=i||this.setAttachment(t,o,o.data.attachmentName);else{var h=0;h=r>=l[l.length-1]?l.length-1:H.binarySearch(l,r,1)-1;var u=this.attachmentNames[h];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}(),tt=null,et=function(t){function e(e){var r;return(r=t.call(this,e)||this).frames=d.newFloatArray(e),r.frameVertices=new Array(e),null==tt&&(tt=d.newFloatArray(64)),r}s(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(l(h,I)&&h.deformAttachment==this.attachment){var u=o.deform;0==u.length&&(i=0);var c=this.frameVertices,f=c[0].length,v=this.frames;if(r<v[0]){var p=h;switch(i){case 0:return void(u.length=0);case 1:if(1==a){u.length=0;break}var g=d.setArraySize(u,f);if(null==p.bones)for(var m=p.vertices,w=0;w<f;w++)g[w]+=(m[w]-g[w])*a;else{a=1-a;for(w=0;w<f;w++)g[w]*=a}}}else{var x=d.setArraySize(u,f);if(r>=v[v.length-1]){var E=c[v.length-1];if(1==a)if(3==i){var y=h;if(null==y.bones)for(var b=y.vertices,S=0;S<f;S++)x[S]+=E[S]-b[S];else for(var M=0;M<f;M++)x[M]+=E[M]}else d.arrayCopy(E,0,x,0,f);else switch(i){case 0:var T=h;if(null==T.bones)for(var A=T.vertices,R=0;R<f;R++){var C=A[R];x[R]=C+(E[R]-C)*a}else for(var k=0;k<f;k++)x[k]=E[k]*a;break;case 1:case 2:for(var V=0;V<f;V++)x[V]+=(E[V]-x[V])*a;break;case 3:var P=h;if(null==P.bones)for(var _=P.vertices,F=0;F<f;F++)x[F]+=(E[F]-_[F])*a;else for(var N=0;N<f;N++)x[N]+=E[N]*a}}else{var O=H.binarySearch(v,r),B=c[O-1],L=c[O],X=v[O],D=this.getCurvePercent(O-1,1-(r-X)/(v[O-1]-X));if(1==a)if(3==i){var Y=h;if(null==Y.bones)for(var U=Y.vertices,W=0;W<f;W++){var q=B[W];x[W]+=q+(L[W]-q)*D-U[W]}else for(var j=0;j<f;j++){var G=B[j];x[j]+=G+(L[j]-G)*D}}else for(var z=0;z<f;z++){var Z=B[z];x[z]=Z+(L[z]-Z)*D}else switch(i){case 0:var Q=h;if(null==Q.bones)for(var J=Q.vertices,K=0;K<f;K++){var $=B[K],tt=J[K];x[K]=tt+($+(L[K]-$)*D-tt)*a}else for(var et=0;et<f;et++){var rt=B[et];x[et]=(rt+(L[et]-rt)*D)*a}break;case 1:case 2:for(var nt=0;nt<f;nt++){var at=B[nt];x[nt]+=(at+(L[nt]-at)*D-x[nt])*a}break;case 3:var it=h;if(null==it.bones)for(var st=it.vertices,ot=0;ot<f;ot++){var lt=B[ot];x[ot]+=(lt+(L[ot]-lt)*D-st[ot])*a}else for(var ht=0;ht<f;ht++){var ut=B[ht];x[ht]+=(ut+(L[ht]-ut)*D)*a}}}}}}},e}(j),rt=function(){function t(t){this.frames=d.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,l=this.frames.length;if(e>r)this.apply(t,e,Number.MAX_VALUE,n,a,i,s),e=-1;else if(e>=o[l-1])return;if(!(r<o[0])){var h=0;if(e<o[0])h=0;else for(var u=o[h=H.binarySearch(o,e)];h>0&&o[h-1]==u;)h--;for(;h<l&&r>=o[h];h++)n.push(this.events[h])}}},t}(),nt=function(){function t(t){this.frames=d.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,l=t.slots;if(1!=s){var h=this.frames;if(r<h[0])0!=i&&1!=i||d.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{var u=0;u=r>=h[h.length-1]?h.length-1:H.binarySearch(h,r)-1;var c=this.drawOrders[u];if(null==c)d.arrayCopy(l,0,o,0,l.length);else for(var f=0,v=c.length;f<v;f++)o[f]=l[c[f]]}}else 0==i&&d.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length)},t}(),at=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=this.frames,h=t.ikConstraints[this.ikConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,void(h.stretch=h.data.stretch);case 1:h.mix+=(h.data.mix-h.mix)*i,h.softness+=(h.data.softness-h.softness)*i,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}else if(n>=l[l.length-e.ENTRIES])0==s?(h.mix=h.data.mix+(l[l.length+e.PREV_MIX]-h.data.mix)*i,h.softness=h.data.softness+(l[l.length+e.PREV_SOFTNESS]-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH])):(h.mix+=(l[l.length+e.PREV_MIX]-h.mix)*i,h.softness+=(l[l.length+e.PREV_SOFTNESS]-h.softness)*i,0==o&&(h.bendDirection=l[l.length+e.PREV_BEND_DIRECTION],h.compress=0!=l[l.length+e.PREV_COMPRESS],h.stretch=0!=l[l.length+e.PREV_STRETCH]));else{var u=H.binarySearch(l,n,e.ENTRIES),c=l[u+e.PREV_MIX],d=l[u+e.PREV_SOFTNESS],f=l[u],v=this.getCurvePercent(u/e.ENTRIES-1,1-(n-f)/(l[u+e.PREV_TIME]-f));0==s?(h.mix=h.data.mix+(c+(l[u+e.MIX]-c)*v-h.data.mix)*i,h.softness=h.data.softness+(d+(l[u+e.SOFTNESS]-d)*v-h.data.softness)*i,1==o?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH])):(h.mix+=(c+(l[u+e.MIX]-c)*v-h.mix)*i,h.softness+=(d+(l[u+e.SOFTNESS]-d)*v-h.softness)*i,0==o&&(h.bendDirection=l[u+e.PREV_BEND_DIRECTION],h.compress=0!=l[u+e.PREV_COMPRESS],h.stretch=0!=l[u+e.PREV_STRETCH]))}},e}(j);at.ENTRIES=6,at.PREV_TIME=-6,at.PREV_MIX=-5,at.PREV_SOFTNESS=-4,at.PREV_BEND_DIRECTION=-3,at.PREV_COMPRESS=-2,at.PREV_STRETCH=-1,at.MIX=1,at.SOFTNESS=2,at.BEND_DIRECTION=3,at.COMPRESS=4,at.STRETCH=5;var it=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=this.frames,h=t.transformConstraints[this.transformConstraintIndex];if(h.active)if(n<l[0]){var u=h.data;switch(s){case 0:return h.rotateMix=u.rotateMix,h.translateMix=u.translateMix,h.scaleMix=u.scaleMix,void(h.shearMix=u.shearMix);case 1:h.rotateMix+=(u.rotateMix-h.rotateMix)*i,h.translateMix+=(u.translateMix-h.translateMix)*i,h.scaleMix+=(u.scaleMix-h.scaleMix)*i,h.shearMix+=(u.shearMix-h.shearMix)*i}}else{var c=0,d=0,f=0,v=0;if(n>=l[l.length-e.ENTRIES]){var p=l.length;c=l[p+e.PREV_ROTATE],d=l[p+e.PREV_TRANSLATE],f=l[p+e.PREV_SCALE],v=l[p+e.PREV_SHEAR]}else{var g=H.binarySearch(l,n,e.ENTRIES);c=l[g+e.PREV_ROTATE],d=l[g+e.PREV_TRANSLATE],f=l[g+e.PREV_SCALE],v=l[g+e.PREV_SHEAR];var m=l[g],w=this.getCurvePercent(g/e.ENTRIES-1,1-(n-m)/(l[g+e.PREV_TIME]-m));c+=(l[g+e.ROTATE]-c)*w,d+=(l[g+e.TRANSLATE]-d)*w,f+=(l[g+e.SCALE]-f)*w,v+=(l[g+e.SHEAR]-v)*w}if(0==s){var x=h.data;h.rotateMix=x.rotateMix+(c-x.rotateMix)*i,h.translateMix=x.translateMix+(d-x.translateMix)*i,h.scaleMix=x.scaleMix+(f-x.scaleMix)*i,h.shearMix=x.shearMix+(v-x.shearMix)*i}else h.rotateMix+=(c-h.rotateMix)*i,h.translateMix+=(d-h.translateMix)*i,h.scaleMix+=(f-h.scaleMix)*i,h.shearMix+=(v-h.shearMix)*i}},e}(j);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 st=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return void(h.position=h.data.position);case 1:h.position+=(h.data.position-h.position)*i}else{var u=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=H.binarySearch(l,n,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.position=h.data.position+(u-h.data.position)*i:h.position+=(u-h.position)*i}},e}(j);st.ENTRIES=2,st.PREV_TIME=-2,st.PREV_VALUE=-1,st.VALUE=1;var ot=function(t){function e(e){return t.call(this,e)}s(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 l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return void(h.spacing=h.data.spacing);case 1:h.spacing+=(h.data.spacing-h.spacing)*i}else{var u=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_VALUE];else{var c=H.binarySearch(l,n,e.ENTRIES);u=l[c+e.PREV_VALUE];var d=l[c],f=this.getCurvePercent(c/e.ENTRIES-1,1-(n-d)/(l[c+e.PREV_TIME]-d));u+=(l[c+e.VALUE]-u)*f}0==s?h.spacing=h.data.spacing+(u-h.data.spacing)*i:h.spacing+=(u-h.spacing)*i}},e}(st),lt=function(t){function e(r){var n;return(n=t.call(this,r)||this).frames=d.newFloatArray(r*e.ENTRIES),n}s(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 l=this.frames,h=t.pathConstraints[this.pathConstraintIndex];if(h.active)if(n<l[0])switch(s){case 0:return h.rotateMix=h.data.rotateMix,void(h.translateMix=h.data.translateMix);case 1:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*i,h.translateMix+=(h.data.translateMix-h.translateMix)*i}else{var u=0,c=0;if(n>=l[l.length-e.ENTRIES])u=l[l.length+e.PREV_ROTATE],c=l[l.length+e.PREV_TRANSLATE];else{var d=H.binarySearch(l,n,e.ENTRIES);u=l[d+e.PREV_ROTATE],c=l[d+e.PREV_TRANSLATE];var f=l[d],v=this.getCurvePercent(d/e.ENTRIES-1,1-(n-f)/(l[d+e.PREV_TIME]-f));u+=(l[d+e.ROTATE]-u)*v,c+=(l[d+e.TRANSLATE]-c)*v}0==s?(h.rotateMix=h.data.rotateMix+(u-h.data.rotateMix)*i,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*i):(h.rotateMix+=(u-h.rotateMix)*i,h.translateMix+=(c-h.translateMix)*i)}},e}(j);lt.ENTRIES=3,lt.PREV_TIME=-3,lt.PREV_ROTATE=-2,lt.PREV_TRANSLATE=-1,lt.ROTATE=1,lt.TRANSLATE=2;var ht=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 dt(this),this.propertyIDs=new h,this.animationsChanged=!1,this.trackEntryPool=new v((function(){return new ct})),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 l=a.mixingFrom;for(a.mixingFrom=null,null!=l&&(l.mixingTo=null);null!=l;)this.queue.end(l),l=l.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?F.first:o.mixBlend,u=o.alpha;null!=o.mixingFrom?u*=this.applyMixingFrom(o,e,h):o.trackTime>=o.trackEnd&&null==o.next&&(u=0);var c=o.animationLast,f=o.getAnimationTime(),v=o.animation.timelines.length,p=o.animation.timelines;if(0==i&&1==u||h==F.add)for(var g=0;g<v;g++){d.webkit602BugfixHelper(u,h);var m=p[g];l(m,$)?this.applyAttachmentTimeline(m,e,f,h,!0):m.apply(e,c,f,r,u,h,N.mixIn)}else{var w=o.timelineMode,x=0==o.timelinesRotation.length;x&&d.setArraySize(o.timelinesRotation,v<<1,null);for(var E=o.timelinesRotation,y=0;y<v;y++){var b=p[y],S=w[y]==t.SUBSEQUENT?h:F.setup;l(b,G)?this.applyRotateTimeline(b,e,f,u,S,E,y<<1,x):l(b,$)?this.applyAttachmentTimeline(b,e,f,h,!0):(d.webkit602BugfixHelper(u,h),b.apply(e,c,f,r,u,S,N.mixIn))}}this.queueEvents(o,f),r.length=0,o.nextAnimationLast=f,o.nextTrackLast=o.trackTime}}for(var M=this.unkeyedState+t.SETUP,T=e.slots,A=0,I=e.slots.length;A<I;A++){var R=T[A];if(R.attachmentState==M){var C=R.data.attachmentName;R.attachment=null==C?null:e.getAttachment(R.data.index,C)}}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==F.first&&(n=F.setup)):((i=e.mixTime/e.mixDuration)>1&&(i=1),n!=F.first&&(n=a.mixBlend));var s=i<a.eventThreshold?this.events:null,o=i<a.attachmentThreshold,h=i<a.drawOrderThreshold,u=a.animationLast,c=a.getAnimationTime(),f=a.animation.timelines.length,v=a.animation.timelines,p=a.alpha*e.interruptAlpha,g=p*(1-i);if(n==F.add)for(var m=0;m<f;m++)v[m].apply(r,u,c,s,g,n,N.mixOut);else{var w=a.timelineMode,x=a.timelineHoldMix,E=0==a.timelinesRotation.length;E&&d.setArraySize(a.timelinesRotation,f<<1,null);var y=a.timelinesRotation;a.totalAlpha=0;for(var b=0;b<f;b++){var S=v[b],M=N.mixOut,T=void 0,A=0;switch(w[b]){case t.SUBSEQUENT:if(!h&&l(S,nt))continue;T=n,A=g;break;case t.FIRST:T=F.setup,A=g;break;case t.HOLD_SUBSEQUENT:T=n,A=p;break;case t.HOLD_FIRST:T=F.setup,A=p;break;default:T=F.setup;var I=x[b];A=p*Math.max(0,1-I.mixTime/I.mixDuration)}a.totalAlpha+=A,l(S,G)?this.applyRotateTimeline(S,r,c,A,T,y,b<<1,E):l(S,$)?this.applyAttachmentTimeline(S,r,c,T,o):(d.webkit602BugfixHelper(A,n),h&&l(S,nt)&&T==F.setup&&(M=N.mixIn),S.apply(r,u,c,s,A,T,M))}}return e.mixDuration>0&&this.queueEvents(a,c),this.events.length=0,a.nextAnimationLast=c,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,l=e.frames;if(n<l[0])a!=F.setup&&a!=F.first||this.setAttachment(r,s,s.data.attachmentName,i);else o=n>=l[l.length-1]?l.length-1:H.binarySearch(l,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 l=t,h=l.frames,u=e.bones[l.boneIndex];if(u.active){var d=0,f=0;if(r<h[0])switch(a){case F.setup:u.rotation=u.data.rotation;default:return;case F.first:d=u.rotation,f=u.data.rotation}else if(d=a==F.setup?u.data.rotation:u.rotation,r>=h[h.length-G.ENTRIES])f=u.data.rotation+h[h.length+G.PREV_ROTATION];else{var v=H.binarySearch(h,r,G.ENTRIES),p=h[v+G.PREV_ROTATION],g=h[v],m=l.getCurvePercent((v>>1)-1,1-(r-g)/(h[v+G.PREV_TIME]-g));f=h[v+G.ROTATION]-p,f=p+(f-=360*(16384-(16384.499999999996-f/360|0)))*m+u.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}var w=0,x=f-d;if(0==(x-=360*(16384-(16384.499999999996-x/360|0))))w=i[s];else{var E=0,y=0;o?(E=0,y=x):(E=i[s],y=i[s+1]);var b=x>0,S=E>=0;c.signum(y)!=c.signum(x)&&Math.abs(y)<=90&&(Math.abs(E)>180&&(E+=360*c.signum(E)),S=b),w=x+E-E%360,S!=b&&(w+=360*c.signum(E)),i[s]=w}i[s+1]=x,d+=w*n,u.rotation=d-360*(16384-(16384.499999999996-d/360|0))}}else t.apply(e,0,r,null,1,a,N.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,l=s.length;o<l;o++){var h=s[o];if(h.time<i)break;h.time>n||this.queue.event(t,h)}for((t.loop?0==a||i>t.trackTime%a:e>=n&&t.animationLast<n)&&this.queue.complete(t);o<l;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]:(d.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=F.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==F.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=d.setArraySize(e.timelineMode,a);e.timelineHoldMix.length=0;var s=d.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 u=0;u<a;u++){var c=n[u],f=c.getPropertyId();if(o.add(f))if(null==r||l(c,$)||l(c,nt)||l(c,rt)||!r.animation.hasTimeline(f))i[u]=t.FIRST;else{for(var v=r.mixingTo;null!=v;v=v.mixingTo)if(!v.animation.hasTimeline(f)){if(e.mixDuration>0){i[u]=t.HOLD_MIX,s[u]=v;continue t}break}i[u]=t.HOLD_FIRST}else i[u]=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}();ht.emptyAnimation=new H("<empty>",[],0),ht.SUBSEQUENT=0,ht.FIRST=1,ht.HOLD_SUBSEQUENT=2,ht.HOLD_FIRST=3,ht.HOLD_MIX=4,ht.SETUP=1,ht.CURRENT=2;var ut,ct=function(){function t(){this.mixBlend=F.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}(),dt=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 l=0;l<e.length;l++)e[l].dispose&&e[l].dispose(a);this.animState.trackEntryPool.free(a);break;case 4:null!=a.listener&&a.listener.complete&&a.listener.complete(a);for(var h=0;h<e.length;h++)e[h].complete&&e[h].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"}(ut||(ut={}));var ft=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}(),vt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new u(.2275,.2275,.8078,1),r}return s(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}(I),pt=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 v((function(){return new Array})),this.polygonIndicesPool=new v((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,l=n;o<l;++o)s[o]=t.isConcave(o,n,r,a);var h=this.triangles;for(h.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],x=r[v+1],E=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],T=r[S+1];if(t.positiveArea(E,y,g,m,M,T)&&t.positiveArea(g,m,w,x,M,T)&&t.positiveArea(w,x,E,y,M,T))break t}break}if(0==d){do{if(!s[c])break;c--}while(c>0);break}u=c,c=d,d=(d+1)%n}h.push(a[(n+c-1)%n]),h.push(a[c]),h.push(a[(c+1)%n]),a.splice(c,1),s.splice(c,1);var A=(--n+c-1)%n,I=c==n?0:c;s[A]=t.isConcave(A,n,r,a),s[I]=t.isConcave(I,n,r,a)}return 3==n&&(h.push(a[2]),h.push(a[0]),h.push(a[1])),h},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 l=-1,h=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],x=n[v],E=n[v+1],y=!1;if(l==d){var b=o.length-4,S=t.winding(o[b],o[b+1],o[b+2],o[b+3],x,E),M=t.winding(x,E,o[0],o[1],o[2],o[3]);S==h&&M==h&&(o.push(x),o.push(E),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(x),o.push(E),(s=this.polygonIndicesPool.obtain()).length=0,s.push(d),s.push(f),s.push(v),h=t.winding(p,g,m,w,x,E),l=d)}o.length>0&&(a.push(o),i.push(s));for(var T=0,A=a.length;T<A;T++)if(0!=(s=i[T]).length)for(var I=s[0],R=s[s.length-1],C=(o=a[T]).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],B=o[3],L=t.winding(k,V,P,_,F,N),X=0;X<A;X++)if(X!=T){var D=i[X];if(3==D.length){var Y=D[0],U=D[1],W=D[2],q=a[X],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,B);G==L&&z==L&&(q.length=0,D.length=0,o.push(H),o.push(j),s.push(W),k=P,V=_,P=H,_=j,X=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}(),gt=function(){function t(){this.triangulator=new pt,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=d.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,l=s.length;o<l;o++){var h=s[o];t.makeClockwise(h),h.push(h[0]),h.push(h[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 l=this.clipOutput,h=this.clippedVertices,u=this.clippedTriangles,c=this.clippingPolygons,f=this.clippingPolygons.length,v=o?12:8,p=0;h.length=0,u.length=0;t:for(var g=0;g<n;g+=3)for(var m=r[g]<<1,w=t[m],x=t[m+1],E=a[m],y=a[m+1],b=t[m=r[g+1]<<1],S=t[m+1],M=a[m],T=a[m+1],A=t[m=r[g+2]<<1],I=t[m+1],R=a[m],C=a[m+1],k=0;k<f;k++){var V=h.length;if(!this.clip(w,x,b,S,A,I,c[k],l)){var P=d.setArraySize(h,V+3*v);P[V]=w,P[V+1]=x,P[V+2]=i.r,P[V+3]=i.g,P[V+4]=i.b,P[V+5]=i.a,o?(P[V+6]=E,P[V+7]=y,P[V+8]=s.r,P[V+9]=s.g,P[V+10]=s.b,P[V+11]=s.a,P[V+12]=b,P[V+13]=S,P[V+14]=i.r,P[V+15]=i.g,P[V+16]=i.b,P[V+17]=i.a,P[V+18]=M,P[V+19]=T,P[V+20]=s.r,P[V+21]=s.g,P[V+22]=s.b,P[V+23]=s.a,P[V+24]=A,P[V+25]=I,P[V+26]=i.r,P[V+27]=i.g,P[V+28]=i.b,P[V+29]=i.a,P[V+30]=R,P[V+31]=C,P[V+32]=s.r,P[V+33]=s.g,P[V+34]=s.b,P[V+35]=s.a):(P[V+6]=E,P[V+7]=y,P[V+8]=b,P[V+9]=S,P[V+10]=i.r,P[V+11]=i.g,P[V+12]=i.b,P[V+13]=i.a,P[V+14]=M,P[V+15]=T,P[V+16]=A,P[V+17]=I,P[V+18]=i.r,P[V+19]=i.g,P[V+20]=i.b,P[V+21]=i.a,P[V+22]=R,P[V+23]=C),V=u.length;var _=d.setArraySize(u,V+3);_[V]=p,_[V+1]=p+1,_[V+2]=p+2,p+=3;continue t}var F=l.length;if(0!=F){for(var N=S-I,O=A-b,B=w-A,L=I-x,X=1/(N*B+O*(x-I)),D=F>>1,Y=this.clipOutput,U=d.setArraySize(h,V+D*v),W=0;W<F;W+=2){var q=Y[W],H=Y[W+1];U[V]=q,U[V+1]=H,U[V+2]=i.r,U[V+3]=i.g,U[V+4]=i.b,U[V+5]=i.a;var j=q-A,G=H-I,z=(N*j+O*G)*X,Z=(L*j+B*G)*X,Q=1-z-Z;U[V+6]=E*z+M*Z+R*Q,U[V+7]=y*z+T*Z+C*Q,o&&(U[V+8]=s.r,U[V+9]=s.g,U[V+10]=s.b,U[V+11]=s.a),V+=v}V=u.length;var J=d.setArraySize(u,V+3*(D-2));D--;for(var K=1;K<D;K++)J[V]=p,J[V+1]=p+K,J[V+2]=p+K+1,V+=3;p+=D+1}}},e.clip=function(t,e,r,n,a,i,s,o){var l=o,h=!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,x=p-m,E=u,y=u.length-2,b=o.length,S=0;S<y;S+=2){var M=E[S],T=E[S+1],A=E[S+2],I=E[S+3],R=w*(I-m)-x*(A-g)>0;if(w*(T-m)-x*(M-g)>0){if(R){o.push(A),o.push(I);continue}var C=I-T,k=A-M,V=C*(g-v)-k*(m-p);if(Math.abs(V)>1e-6){var P=(k*(p-T)-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-T,F=A-M,N=_*(g-v)-F*(m-p);if(Math.abs(N)>1e-6){var O=(F*(p-T)-_*(v-M))/N;o.push(v+(g-v)*O),o.push(p+(m-p)*O)}else o.push(v),o.push(p);o.push(A),o.push(I)}h=!0}if(b==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==d)break;var B=o;(o=u).length=0,u=B}if(l!=o){l.length=0;for(var L=0,X=o.length-2;L<X;L++)l[L]=o[L]}else l.length=l.length-2;return h},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,l=r-3;o<l;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 h=0,u=r-2,c=r>>1;h<c;h+=2){var d=e[h],f=e[h+1],v=u-h;e[h]=e[v],e[h+1]=e[v+1],e[v]=d,e[v+1]=f}},t}(),mt=function(){function e(){}var r=e.prototype;return r.initialize=function(e,r){var n=this._mesh=new t.BufferMesh(e),a=[new t.VertexElement("POSITION",0,t.VertexElementFormat.Vector3,0),new t.VertexElement("COLOR_0",12,t.VertexElementFormat.Vector4,0),new t.VertexElement("TEXCOORD_0",28,t.VertexElementFormat.Vector2,0)],i=4*wt.VERTEX_STRIDE,s=i*r,o=new t.Buffer(e,t.BufferBindFlag.VertexBuffer,s,t.BufferUsage.Dynamic),l=new t.Buffer(e,t.BufferBindFlag.IndexBuffer,2*r,t.BufferUsage.Dynamic);this._indexBuffer=l,this._vertexBuffer=o,n.setVertexBufferBinding(o,i),n.setIndexBufferBinding(l,t.IndexFormat.UInt16),n.setVertexElements(a),n.addSubMesh(0,r)},r.changeBuffer=function(e,r){var n=4*wt.VERTEX_STRIDE,a=n*r,i=new t.Buffer(e,t.BufferBindFlag.VertexBuffer,a,t.BufferUsage.Dynamic),s=new t.Buffer(e,t.BufferBindFlag.IndexBuffer,2*r,t.BufferUsage.Dynamic),o=this._mesh;this._indexBuffer=s,this._vertexBuffer=i,o.setVertexBufferBinding(i,n),o.setIndexBufferBinding(s,t.IndexFormat.UInt16)},n(e,[{key:"mesh",get:function(){return this._mesh}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"vertexBuffer",get:function(){return this._vertexBuffer}}]),e}(),wt=function(){function e(t,e){this._clipper=new gt,this._spineMesh=new mt,this._needResize=!1,this._subMeshItems=[],this.separateSlots=[],this._engine=t,this._entity=e}var r=e.prototype;return r.initialize=function(r,n){if(r){var a=this._entity.getComponent(t.MeshRenderer);if(a){this._meshRenderer=a,n&&(this._setting=n);for(var i=r.defaultSkin.attachments,s=0,o=e.QUAD_TRIANGLES.length,h=0,u=i.length;h<u;h++){var c=i[h];for(var d in c){var f=c[d];if(f)if(l(f,k))s+=o;else{if(!l(f,W))continue;s+=f.triangles.length}}}this._vertexCount=s,this._prepareBufferData(this._vertexCount);var v=this._spineMesh;v.initialize(this._engine,this._vertexCount),a.mesh=v.mesh}else console.warn("You need add MeshRenderer component to entity first")}},r.buildMesh=function(r){var n=this._setting||{},a=n.useClipping,i=void 0===a||a,s=n.zSpacing,o=void 0===s?.01:s,h=0,u=0;this._subMeshItems.length=0;for(var c,d,f=this._meshRenderer,v=r.drawOrder,p=v.length,g=this._clipper,m=this._spineMesh,w=m.mesh,x=this._subMeshItems,E=this._vertices,y=0,b=0,S=0;S<p;S+=1){var M=v[S];if(M.bone.active){var T=M.getAttachment(),A=null,I=null,R=o*S,C=0,V=g.isClipping()?2:e.VERTEX_SIZE;if(l(T,k)){var P=T;A=P.color,E=this._vertices,C=4*V,P.computeWorldVertices(M.bone,E,0,V),c=e.QUAD_TRIANGLES,d=P.uvs,I=P.region.renderObject.texture}else if(l(T,W)){var _=T;A=_.color,E=this._vertices,(C=(_.worldVerticesLength>>1)*V)>E.length&&(E=this._vertices=new Float32Array(C)),_.computeWorldVertices(M,0,_.worldVerticesLength,E,0,V),c=_.triangles,d=_.uvs,I=_.region.renderObject.texture}else if(l(T,vt)){if(i){var F=T;g.clipStart(M,F);continue}}else if(i){g.clipEndWithSlot(M);continue}if(null!=I){var N=void 0,O=void 0,B=void 0,L=void 0,X=M.bone.skeleton.color,D=M.color,Y=X.a*D.a*A.a,U=e.tempColor;if(U.set(X.r*D.r*A.r,X.g*D.g*A.g,X.b*D.b*A.b,Y),g.isClipping()){g.clipTriangles(E,C,c,c.length,d,U,null,!1);var q=g.clippedVertices,H=g.clippedTriangles;N=q,O=q.length,B=H,L=H.length}else{for(var j=E,G=2,z=0,Z=C;G<Z;G+=V,z+=2)j[G]=U.r,j[G+1]=U.g,j[G+2]=U.b,j[G+3]=U.a,j[G+4]=d[z],j[G+5]=d[z+1];N=E,O=C,B=c,L=c.length}for(var Q=h/e.VERTEX_STRIDE,J=this._verticesWithZ,K=h,$=0;$<O;)J[K++]=N[$++],J[K++]=N[$++],J[K++]=R,J[K++]=N[$++],J[K++]=N[$++],J[K++]=N[$++],J[K++]=N[$++],J[K++]=N[$++],J[K++]=N[$++];h=K;var tt=this._indices;for(K=u,$=0;$<L;K++,$++)tt[K]=B[$]+Q;var et=M.data.name;if(this.separateSlots.includes(et)){var rt=new t.SubMesh(u,L);if(x.push({name:et,subMesh:rt}),b>0){var nt=new t.SubMesh(y,b);x.push({name:"default",subMesh:nt}),b=0}y=u+L}else b+=L;u+=L;for(var at=f.getMaterials(),it=at.length,st=0;st<it;st+=1){var ot=at[st];ot.shaderData.getTexture("material_SpineTexture")||ot.shaderData.setTexture("material_SpineTexture",I.texture)}}g.clipEndWithSlot(M)}else g.clipEndWithSlot(M)}if(g.clipEnd(),b>0){var lt=new t.SubMesh(y,b);x.push({name:"default",subMesh:lt}),b=0}if(x.sort((function(t,e){return t.subMesh.start-e.subMesh.start})),u>0&&u!==this._vertexCount&&u>this._vertexCount)return this._vertexCount=u,this._prepareBufferData(this._vertexCount),void(this._needResize=!0);w.clearSubMesh();for(var ht=x.length,ut=0;ut<ht;ut+=1)w.addSubMesh(x[ut].subMesh);this._needResize&&(m.changeBuffer(this._engine,this._vertexCount),this._needResize=!1),m.vertexBuffer.setData(this._verticesWithZ),m.indexBuffer.setData(this._indices)},r.addSeparateSlot=function(t){this.separateSlots.push(t)},r._prepareBufferData=function(t){this._vertices=new Float32Array(t*e.VERTEX_SIZE),this._verticesWithZ=new Float32Array(t*e.VERTEX_STRIDE),this._indices=new Uint16Array(t)},n(e,[{key:"mesh",get:function(){return this._spineMesh.mesh}},{key:"subMeshItems",get:function(){return this._subMeshItems}}]),e}();wt.QUAD_TRIANGLES=[0,1,2,2,3,0],wt.VERTEX_SIZE=8,wt.VERTEX_STRIDE=9,wt.tempColor=new u;var xt=function(e){function r(n){var a,i=t.Shader.find("galacean-spine-shader")||t.Shader.create("galacean-spine-shader",r._spineVS,r._spineFS),s=(a=e.call(this,n,i)||this).renderState,o=s.blendState.targetBlendState;return o.enabled=!0,o.sourceColorBlendFactor=t.BlendFactor.SourceAlpha,o.destinationColorBlendFactor=t.BlendFactor.OneMinusSourceAlpha,o.sourceAlphaBlendFactor=t.BlendFactor.One,o.destinationAlphaBlendFactor=t.BlendFactor.OneMinusSourceAlpha,o.colorBlendOperation=o.alphaBlendOperation=t.BlendOperation.Add,s.depthState.writeEnabled=!1,s.rasterState.cullMode=t.CullMode.Off,s.renderQueueType=t.RenderQueueType.Transparent,a}return s(r,e),r}(t.Material);xt._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 ",xt._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 Et=function(e){function r(t){var r;return(r=e.call(this,t)||this)._tempOffset=new p,r._tempSize=new p,r._tempArray=[0,0],r.autoUpdate=!0,r.autoUpdateBounds=!1,r._meshGenerator=new wt(r.engine,t),r}s(r,e);var i=r.prototype;return i.setSkeletonData=function(t,e){t||console.error("SkeletonData is undefined"),this.setting=e,this._skeletonData=t,this._skeleton=new q(t);var r=new ft(t);this._state=new ht(r),this._meshGenerator.initialize(t,this.setting)},i.addSeparateSlot=function(e){this.skeleton||console.error("Skeleton not found!");var n=this.entity.getComponent(t.MeshRenderer);if(n||console.warn("You need add MeshRenderer component to entity first"),this.skeleton.findSlot(e)){this._meshGenerator.addSeparateSlot(e);var a=r._defaultMaterial.clone(),i=r._defaultMaterial.clone(),s=n.materialCount;n.setMaterial(s,a),n.setMaterial(s+1,i)}else console.warn("Slot: "+e+" not find.")},i.hackSeparateSlotTexture=function(e,r){this._meshGenerator.buildMesh(this._skeleton);var n=this._meshGenerator,a=n.separateSlots,i=n.subMeshItems;if(0!==a.length)if(a.includes(e)){var s=this.entity.getComponent(t.MeshRenderer),o=i.findIndex((function(t){return t.name===e}));s.getMaterial(o).shaderData.setTexture("material_SpineTexture",r)}else console.warn("Slot "+e+" is not separated. You should use addSeparateSlot to separate it");else console.warn("You need add separate slot")},i.onUpdate=function(t){this.autoUpdate&&this.updateState(t)},i.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()}},i.updateGeometry=function(){this._skeleton&&(this._meshGenerator.buildMesh(this._skeleton),this.autoUpdateBounds&&this.updateBounds())},i.updateBounds=function(){var e,r=this.entity.getComponent(t.MeshRenderer).bounds,n=this._tempOffset,a=this._tempSize,i=this._tempArray,s=(null==(e=this.setting)?void 0:e.zSpacing)||.01,o=this._skeleton;o.getBounds(n,a,i);var l=o.drawOrder;r.min.set(n.x,n.y,0),r.max.set(n.x+a.x,n.y+a.y,l.length*s)},i._cloneTo=function(t){t.setSkeletonData(this.skeletonData);var e=a({},this.setting);t.setting=e},i._disposeCurrentSkeleton=function(){this._skeletonData=null,this._skeleton=null,this._state=null},i.onDestroy=function(){this._disposeCurrentSkeleton(),this._meshGenerator=null,this.setting=null},r.getDefaultMaterial=function(t){return this._defaultMaterial||(this._defaultMaterial=new xt(t),this._defaultMaterial.isGCIgnored=!0),this._defaultMaterial.clone()},n(r,[{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)}}]),r}(t.Script);function yt(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 bt(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 yt(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)?yt(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.")}o([t.ignoreClone],Et.prototype,"_skeletonData",void 0),o([t.ignoreClone],Et.prototype,"_skeleton",void 0),o([t.ignoreClone],Et.prototype,"_state",void 0),o([t.ignoreClone],Et.prototype,"_tempOffset",void 0),o([t.ignoreClone],Et.prototype,"_tempSize",void 0),o([t.ignoreClone],Et.prototype,"_tempArray",void 0),o([t.ignoreClone],Et.prototype,"_meshGenerator",void 0),o([t.ignoreClone],Et.prototype,"setting",void 0);var St,Mt=function(){function r(t,e){this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.rawDataUris={},this.pathPrefix=t||"",this.textureLoader=e}var n=r.prototype;return n.downloadText=function(e,r,n){t.request(e,{type:"text"}).then((function(t){r(t)})).catch((function(t){n(t)}))},n.downloadBinary=function(t,r,n){var a=new e.XMLHttpRequest;this.rawDataUris[t]&&(t=this.rawDataUris[t]),a.open("GET",t,!0),a.responseType="arraybuffer",a.onload=function(){200==a.status?r(new Uint8Array(a.response)):n(a.status,a.responseText)},a.onerror=function(){n(a.status,a.responseText)},a.send()},n.setRawDataURI=function(t,e){this.rawDataUris[this.pathPrefix+t]=e},n.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++}))},n.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++}))},n.loadImage=function(t,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var a=this,i=t=this.pathPrefix+t;this.toLoad++;var s=new e.Image;s.crossOrigin="anonymous",s.onload=function(e){a.assets[i]=s,a.onLoad(),a.loaded++,r&&r(t,s)},s.onerror=function(e){a.errors[t]="Couldn't load image "+t,a.onLoad(),a.loaded++,n&&n("Couldn't load image "+t)},this.rawDataUris[t]&&(t=this.rawDataUris[t]),s.src=t},n.loadTexture=function(e,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var a=this,i=e=this.pathPrefix+e;this.toLoad++,this.rawDataUris[e]&&(e=this.rawDataUris[e]),t.request(e,{type:"image"}).then((function(t){var n=a.textureLoader(t);a.assets[i]=n,a.onLoad(),a.loaded++,r&&r(e,n)})).catch((function(t){n(t)}))},n.loadTextureAtlas=function(t,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var a=this,i=t.lastIndexOf("/")>=0?t.substring(0,t.lastIndexOf("/")):"";t=this.pathPrefix+t,this.toLoad++,this.downloadText(t,(function(s){var o=function(){var e=c.value,o=!1;a.loadTexture(e,(function(e,u){if(l.count++,l.count==h.length)if(o)a.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,n&&n("Couldn't load texture atlas page "+e+" of atlas "+t),a.onLoad(),a.loaded++;else try{var c=new X(s,(function(t){return a.get(""==i?t:i+"/"+t)}));a.assets[t]=c,r&&r(t,c),a.onLoad(),a.loaded++}catch(e){var d=e;a.errors[t]="Couldn't load texture atlas "+t+": "+d.message,n&&n("Couldn't load texture atlas "+t+": "+d.message),a.onLoad(),a.loaded++}}),(function(e){o=!0,l.count++,l.count==h.length&&(a.errors[t]="Couldn't load texture atlas page "+e+"} of atlas "+t,n&&n("Couldn't load texture atlas page "+e+" of atlas "+t),a.onLoad(),a.loaded++)}))},l={count:0},h=new Array;try{new X(s,(function(t){h.push(""==i?t:i+"/"+t);var r=e.document.createElement("img");return r.width=16,r.height=16,new L(r)}))}catch(e){var u=e;return a.errors[t]="Couldn't load texture atlas "+t+": "+u.message,n&&n("Couldn't load texture atlas "+t+": "+u.message),a.onLoad(),void a.loaded++}for(var c,d=bt(h);!(c=d()).done;)o()}),(function(e){a.errors[t]="Couldn't load texture atlas "+t+": "+JSON.stringify(e),n&&n("Couldn't load texture atlas "+t+": "+JSON.stringify(e)),a.onLoad(),a.loaded++}))},n.get=function(t){return t=this.pathPrefix+t,this.assets[t]},n.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},n.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},n.isLoadingComplete=function(){return 0==this.toLoad},n.onLoad=function(){this.toLoad--,0===this.toLoad&&this.onLoadComplete()},n.getToLoad=function(){return this.toLoad},n.getLoaded=function(){return this.loaded},n.dispose=function(){this.removeAll()},n.hasErrors=function(){return Object.keys(this.errors).length>0},n.getErrors=function(){return this.errors},r}(),Tt=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new u(1,1,1,1),r}return s(e,t),e.prototype.copy=function(){var t=new e(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t},e}(I),At=function(t){function e(e){var r;return(r=t.call(this,e)||this).color=new u(.38,.94,0,1),r.name=e,r}s(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=c.cosDeg(this.rotation),r=c.sinDeg(this.rotation),n=e*t.a+r*t.b,a=e*t.c+r*t.d;return Math.atan2(a,n)*c.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}(I),It=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 W(e);return a.region=n,a},e.newBoundingBoxAttachment=function(t,e){return new Tt(e)},e.newPathAttachment=function(t,e){return new R(e)},e.newPointAttachment=function(t,e){return new At(e)},e.newClippingAttachment=function(t,e){return new vt(e)},t}(),Rt=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}(),Ct=function(t,e,r){if(this.color=new u(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 s(e,t),e}(M),Vt=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 s(e,t),e}(M),Pt=function(t,e,r){this.slotIndex=t,this.name=e,this.attachment=r},_t=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,l=0;l<this.constraints.length;l++)if(this.constraints[l]==s){o=!0;break}o||this.constraints.push(s)}for(var h=t.getAttachments(),u=0;u<h.length;u++){var c=h[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 u=t.getAttachments(),c=0;c<u.length;c++){var d=u[c];null!=d.attachment&&(l(d.attachment,W)?(d.attachment=d.attachment.newLinkedMesh(),this.setAttachment(d.slotIndex,d.name,d.attachment)):(d.attachment=d.attachment.copy(),this.setAttachment(d.slotIndex,d.name,d.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 Pt(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 Pt(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 l=this.getAttachment(r,o);null!=l&&a.setAttachment(l);break}}}r++}},t}(),Ft=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"}(St||(St={}));var Nt,Ot=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e},Bt=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 Rt,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],l=null,h=this.getValue(o,"parent",null);if(null!=h&&null==(l=n.findBone(h)))throw new Error("Parent bone not found: "+h);var c=new g(n.bones.length,o.name,l);c.length=this.getValue(o,"length",0)*r,c.x=this.getValue(o,"x",0)*r,c.y=this.getValue(o,"y",0)*r,c.rotation=this.getValue(o,"rotation",0),c.scaleX=this.getValue(o,"scaleX",1),c.scaleY=this.getValue(o,"scaleY",1),c.shearX=this.getValue(o,"shearX",0),c.shearY=this.getValue(o,"shearY",0),c.transformMode=t.transformModeFromString(this.getValue(o,"transform","normal")),c.skinRequired=this.getValue(o,"skin",!1),n.bones.push(c)}if(a.slots)for(var d=0;d<a.slots.length;d++){var f=a.slots[d],v=f.name,p=f.bone,x=n.findBone(p);if(null==x)throw new Error("Slot bone not found: "+p);var E=new Ct(n.slots.length,v,x),y=this.getValue(f,"color",null);null!=y&&E.color.setFromString(y);var b=this.getValue(f,"dark",null);null!=b&&(E.darkColor=new u(1,1,1,1),E.darkColor.setFromString(b)),E.attachmentName=this.getValue(f,"attachment",null),E.blendMode=t.blendModeFromString(this.getValue(f,"blend","normal")),n.slots.push(E)}if(a.ik)for(var S=0;S<a.ik.length;S++){var M=a.ik[S],A=new kt(M.name);A.order=this.getValue(M,"order",0),A.skinRequired=this.getValue(M,"skin",!1);for(var I=0;I<M.bones.length;I++){var R=M.bones[I],C=n.findBone(R);if(null==C)throw new Error("IK bone not found: "+R);A.bones.push(C)}var k=M.target;if(A.target=n.findBone(k),null==A.target)throw new Error("IK target bone not found: "+k);A.mix=this.getValue(M,"mix",1),A.softness=this.getValue(M,"softness",0)*r,A.bendDirection=this.getValue(M,"bendPositive",!0)?1:-1,A.compress=this.getValue(M,"compress",!1),A.stretch=this.getValue(M,"stretch",!1),A.uniform=this.getValue(M,"uniform",!1),n.ikConstraints.push(A)}if(a.transform)for(var V=0;V<a.transform.length;V++){var P=a.transform[V],_=new Vt(P.name);_.order=this.getValue(P,"order",0),_.skinRequired=this.getValue(P,"skin",!1);for(var F=0;F<P.bones.length;F++){var N=P.bones[F],O=n.findBone(N);if(null==O)throw new Error("Transform constraint bone not found: "+N);_.bones.push(O)}var B=P.target;if(_.target=n.findBone(B),null==_.target)throw new Error("Transform constraint target bone not found: "+B);_.local=this.getValue(P,"local",!1),_.relative=this.getValue(P,"relative",!1),_.offsetRotation=this.getValue(P,"rotation",0),_.offsetX=this.getValue(P,"x",0)*r,_.offsetY=this.getValue(P,"y",0)*r,_.offsetScaleX=this.getValue(P,"scaleX",0),_.offsetScaleY=this.getValue(P,"scaleY",0),_.offsetShearY=this.getValue(P,"shearY",0),_.rotateMix=this.getValue(P,"rotateMix",1),_.translateMix=this.getValue(P,"translateMix",1),_.scaleMix=this.getValue(P,"scaleMix",1),_.shearMix=this.getValue(P,"shearMix",1),n.transformConstraints.push(_)}if(a.path)for(var L=0;L<a.path.length;L++){var X=a.path[L],D=new T(X.name);D.order=this.getValue(X,"order",0),D.skinRequired=this.getValue(X,"skin",!1);for(var Y=0;Y<X.bones.length;Y++){var U=X.bones[Y],W=n.findBone(U);if(null==W)throw new Error("Transform constraint bone not found: "+U);D.bones.push(W)}var q=X.target;if(D.target=n.findSlot(q),null==D.target)throw new Error("Path target slot not found: "+q);D.positionMode=t.positionModeFromString(this.getValue(X,"positionMode","percent")),D.spacingMode=t.spacingModeFromString(this.getValue(X,"spacingMode","length")),D.rotateMode=t.rotateModeFromString(this.getValue(X,"rotateMode","tangent")),D.offsetRotation=this.getValue(X,"rotation",0),D.position=this.getValue(X,"position",0),D.positionMode==m.Fixed&&(D.position*=r),D.spacing=this.getValue(X,"spacing",0),D.spacingMode!=w.Length&&D.spacingMode!=w.Fixed||(D.spacing*=r),D.rotateMix=this.getValue(X,"rotateMix",1),D.translateMix=this.getValue(X,"translateMix",1),n.pathConstraints.push(D)}if(a.skins)for(var H=0;H<a.skins.length;H++){var j=a.skins[H],G=new _t(j.name);if(j.bones)for(var z=0;z<j.bones.length;z++){var Z=n.findBone(j.bones[z]);if(null==Z)throw new Error("Skin bone not found: "+j.bones[H]);G.bones.push(Z)}if(j.ik)for(var Q=0;Q<j.ik.length;Q++){var J=n.findIkConstraint(j.ik[Q]);if(null==J)throw new Error("Skin IK constraint not found: "+j.ik[H]);G.constraints.push(J)}if(j.transform)for(var K=0;K<j.transform.length;K++){var $=n.findTransformConstraint(j.transform[K]);if(null==$)throw new Error("Skin transform constraint not found: "+j.transform[H]);G.constraints.push($)}if(j.path)for(var tt=0;tt<j.path.length;tt++){var et=n.findPathConstraint(j.path[tt]);if(null==et)throw new Error("Skin path constraint not found: "+j.path[H]);G.constraints.push(et)}for(var rt in j.attachments){var nt=n.findSlot(rt);if(null==nt)throw new Error("Slot not found: "+rt);var at=j.attachments[rt];for(var it in at){var st=this.readAttachment(at[it],G,nt.index,it,n);null!=st&&G.setAttachment(nt.index,it,st)}}n.skins.push(G),"default"==G.name&&(n.defaultSkin=G)}for(var ot=0,lt=this.linkedMeshes.length;ot<lt;ot++){var ht=this.linkedMeshes[ot],ut=null==ht.skin?n.defaultSkin:n.findSkin(ht.skin);if(null==ut)throw new Error("Skin not found: "+ht.skin);var ct=ut.getAttachment(ht.slotIndex,ht.parent);if(null==ct)throw new Error("Parent mesh not found: "+ht.parent);ht.mesh.deformAttachment=ht.inheritDeform?ct:ht.mesh,ht.mesh.setParentMesh(ct),ht.mesh.updateUVs()}if(this.linkedMeshes.length=0,a.events)for(var dt in a.events){var ft=a.events[dt],vt=new Ft(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 l=this.getValue(t,"color",null);return null!=l&&o.color.setFromString(l),o.updateOffset(),o;case"boundingbox":var h=this.attachmentLoader.newBoundingBoxAttachment(e,n);if(null==h)return null;this.readVertices(t,h,t.vertexCount<<1);var u=this.getValue(t,"color",null);return null!=u&&h.color.setFromString(u),h;case"mesh":case"linkedmesh":var c=this.getValue(t,"path",n),f=this.attachmentLoader.newMeshAttachment(e,n,c);if(null==f)return null;f.path=c;var v=this.getValue(t,"color",null);null!=v&&f.color.setFromString(v),f.width=this.getValue(t,"width",0)*i,f.height=this.getValue(t,"height",0)*i;var p=this.getValue(t,"parent",null);if(null!=p)return this.linkedMeshes.push(new Lt(f,this.getValue(t,"skin",null),r,p,this.getValue(t,"deform",!0))),f;var g=t.uvs;return this.readVertices(t,f,g.length),f.triangles=t.triangles,f.regionUVs=g,f.updateUVs(),f.edges=this.getValue(t,"edges",null),f.hullLength=2*this.getValue(t,"hull",0),f;case"path":var m=this.attachmentLoader.newPathAttachment(e,n);if(null==m)return null;m.closed=this.getValue(t,"closed",!1),m.constantSpeed=this.getValue(t,"constantSpeed",!0);var w=t.vertexCount;this.readVertices(t,m,w<<1);for(var x=d.newArray(w/3,0),E=0;E<t.lengths.length;E++)x[E]=t.lengths[E]*i;m.lengths=x;var y=this.getValue(t,"color",null);return null!=y&&m.color.setFromString(y),m;case"point":var b=this.attachmentLoader.newPointAttachment(e,n);if(null==b)return null;b.x=this.getValue(t,"x",0)*i,b.y=this.getValue(t,"y",0)*i,b.rotation=this.getValue(t,"rotation",0);var S=this.getValue(t,"color",null);return null!=S&&b.color.setFromString(S),b;case"clipping":var M=this.attachmentLoader.newClippingAttachment(e,n);if(null==M)return null;var T=this.getValue(t,"end",null);if(null!=T){var A=a.findSlot(T);if(null==A)throw new Error("Clipping end slot not found: "+T);M.endSlot=A}var I=t.vertexCount;this.readVertices(t,M,I<<1);var R=this.getValue(t,"color",null);return null!=R&&M.color.setFromString(R),M}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,l=a.length;o<l;){var h=a[o++];s.push(h);for(var u=o+4*h;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=d.toFloatArray(i)}else{var c=d.toFloatArray(a);if(1!=n)for(var f=0,v=a.length;f<v;f++)c[f]*=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],l=r.findSlotIndex(s);if(-1==l)throw new Error("Slot not found: "+s);for(var h in o){var c=o[h];if("attachment"==h){var f=new $(c.length);f.slotIndex=l;for(var v=0,p=0;p<c.length;p++){var g=c[p];f.setFrame(v++,this.getValue(g,"time",0),g.name)}a.push(f),i=Math.max(i,f.frames[f.getFrameCount()-1])}else if("color"==h){var x=new J(c.length);x.slotIndex=l;for(var E=0,y=0;y<c.length;y++){var b=c[y],S=new u;S.setFromString(b.color),x.setFrame(E,this.getValue(b,"time",0),S.r,S.g,S.b,S.a),this.readCurve(b,x,E),E++}a.push(x),i=Math.max(i,x.frames[(x.getFrameCount()-1)*J.ENTRIES])}else{if("twoColor"!=h)throw new Error("Invalid timeline type for a slot: "+h+" ("+s+")");var M=new K(c.length);M.slotIndex=l;for(var T=0,A=0;A<c.length;A++){var I=c[A],R=new u,C=new u;R.setFromString(I.light),C.setFromString(I.dark),M.setFrame(T,this.getValue(I,"time",0),R.r,R.g,R.b,R.a,C.r,C.g,C.b),this.readCurve(I,M,T),T++}a.push(M),i=Math.max(i,M.frames[(M.getFrameCount()-1)*K.ENTRIES])}}}if(t.bones)for(var k in t.bones){var V=t.bones[k],P=r.findBoneIndex(k);if(-1==P)throw new Error("Bone not found: "+k);for(var _ in V){var F=V[_];if("rotate"===_){var N=new G(F.length);N.boneIndex=P;for(var O=0,B=0;B<F.length;B++){var L=F[B];N.setFrame(O,this.getValue(L,"time",0),this.getValue(L,"angle",0)),this.readCurve(L,N,O),O++}a.push(N),i=Math.max(i,N.frames[(N.getFrameCount()-1)*G.ENTRIES])}else{if("translate"!==_&&"scale"!==_&&"shear"!==_)throw new Error("Invalid timeline type for a bone: "+_+" ("+k+")");var X=null,D=1,Y=0;"scale"===_?(X=new Z(F.length),Y=1):"shear"===_?X=new Q(F.length):(X=new z(F.length),D=n),X.boneIndex=P;for(var U=0,W=0;W<F.length;W++){var q=F[W],j=this.getValue(q,"x",Y),tt=this.getValue(q,"y",Y);X.setFrame(U,this.getValue(q,"time",0),j*D,tt*D),this.readCurve(q,X,U),U++}a.push(X),i=Math.max(i,X.frames[(X.getFrameCount()-1)*z.ENTRIES])}}}if(t.ik)for(var ht in t.ik){var ut=t.ik[ht],ct=r.findIkConstraint(ht),dt=new at(ut.length);dt.ikConstraintIndex=r.ikConstraints.indexOf(ct);for(var ft=0,vt=0;vt<ut.length;vt++){var pt=ut[vt];dt.setFrame(ft,this.getValue(pt,"time",0),this.getValue(pt,"mix",1),this.getValue(pt,"softness",0)*n,this.getValue(pt,"bendPositive",!0)?1:-1,this.getValue(pt,"compress",!1),this.getValue(pt,"stretch",!1)),this.readCurve(pt,dt,ft),ft++}a.push(dt),i=Math.max(i,dt.frames[(dt.getFrameCount()-1)*at.ENTRIES])}if(t.transform)for(var gt in t.transform){var mt=t.transform[gt],wt=r.findTransformConstraint(gt),xt=new it(mt.length);xt.transformConstraintIndex=r.transformConstraints.indexOf(wt);for(var Et=0,yt=0;yt<mt.length;yt++){var bt=mt[yt];xt.setFrame(Et,this.getValue(bt,"time",0),this.getValue(bt,"rotateMix",1),this.getValue(bt,"translateMix",1),this.getValue(bt,"scaleMix",1),this.getValue(bt,"shearMix",1)),this.readCurve(bt,xt,Et),Et++}a.push(xt),i=Math.max(i,xt.frames[(xt.getFrameCount()-1)*it.ENTRIES])}if(t.path)for(var St in t.path){var Mt=t.path[St],Tt=r.findPathConstraintIndex(St);if(-1==Tt)throw new Error("Path constraint not found: "+St);var At=r.pathConstraints[Tt];for(var It in Mt){var Rt=Mt[It];if("position"===It||"spacing"===It){var Ct=null,kt=1;"spacing"===It?(Ct=new ot(Rt.length),At.spacingMode!=w.Length&&At.spacingMode!=w.Fixed||(kt=n)):(Ct=new st(Rt.length),At.positionMode==m.Fixed&&(kt=n)),Ct.pathConstraintIndex=Tt;for(var Vt=0,Pt=0;Pt<Rt.length;Pt++){var _t=Rt[Pt];Ct.setFrame(Vt,this.getValue(_t,"time",0),this.getValue(_t,It,0)*kt),this.readCurve(_t,Ct,Vt),Vt++}a.push(Ct),i=Math.max(i,Ct.frames[(Ct.getFrameCount()-1)*st.ENTRIES])}else if("mix"===It){var Ft=new lt(Rt.length);Ft.pathConstraintIndex=Tt;for(var Nt=0,Bt=0;Bt<Rt.length;Bt++){var Lt=Rt[Bt];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)*lt.ENTRIES])}}}if(t.deform)for(var Xt in t.deform){var Dt=t.deform[Xt],Yt=r.findSkin(Xt);if(null==Yt)throw new Error("Skin not found: "+Xt);for(var Ut in Dt){var Wt=Dt[Ut],qt=r.findSlotIndex(Ut);if(-1==qt)throw new Error("Slot not found: "+Wt.name);for(var Ht in Wt){var jt=Wt[Ht],Gt=Yt.getAttachment(qt,Ht);if(null==Gt)throw new Error("Deform attachment not found: "+jt.name);var zt=null!=Gt.bones,Zt=Gt.vertices,Qt=zt?Zt.length/3*2:Zt.length,Jt=new et(jt.length);Jt.slotIndex=qt,Jt.attachment=Gt;for(var Kt=0,$t=0;$t<jt.length;$t++){var te=jt[$t],ee=void 0,re=this.getValue(te,"vertices",null);if(null==re)ee=zt?d.newFloatArray(Qt):Zt;else{ee=d.newFloatArray(Qt);var ne=this.getValue(te,"offset",0);if(d.arrayCopy(re,0,ee,ne,re.length),1!=n)for(var ae=ne,ie=ae+re.length;ae<ie;ae++)ee[ae]*=n;if(!zt)for(var se=0;se<Qt;se++)ee[se]+=Zt[se]}Jt.setFrame(Kt,this.getValue(te,"time",0),ee),this.readCurve(te,Jt,Kt),Kt++}a.push(Jt),i=Math.max(i,Jt.frames[Jt.getFrameCount()-1])}}}var oe=t.drawOrder;if(null==oe&&(oe=t.draworder),null!=oe){for(var le=new nt(oe.length),he=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=d.newArray(he,-1);for(var pe=d.newArray(he-ve.length,0),ge=0,me=0,we=0;we<ve.length;we++){var xe=ve[we],Ee=r.findSlotIndex(xe.slot);if(-1==Ee)throw new Error("Slot not found: "+xe.slot);for(;ge!=Ee;)pe[me++]=ge++;fe[ge+xe.offset]=ge++}for(;ge<he;)pe[me++]=ge++;for(var ye=he-1;ye>=0;ye--)-1==fe[ye]&&(fe[ye]=pe[--me])}le.setFrame(ue++,this.getValue(de,"time",0),fe)}a.push(le),i=Math.max(i,le.frames[le.getFrameCount()-1])}if(t.events){for(var be=new rt(t.events.length),Se=0,Me=0;Me<t.events.length;Me++){var Te=t.events[Me],Ae=r.findEvent(Te.name);if(null==Ae)throw new Error("Event not found: "+Te.name);var Ie=new Ot(d.toSinglePrecision(this.getValue(Te,"time",0)),Ae);Ie.intValue=this.getValue(Te,"int",Ae.intValue),Ie.floatValue=this.getValue(Te,"float",Ae.floatValue),Ie.stringValue=this.getValue(Te,"string",Ae.stringValue),null!=Ie.data.audioPath&&(Ie.volume=this.getValue(Te,"volume",1),Ie.balance=this.getValue(Te,"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 H(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 St.Normal;if("additive"==t)return St.Additive;if("multiply"==t)return St.Multiply;if("screen"==t)return St.Screen;throw new Error("Unknown blend mode: "+t)},t.positionModeFromString=function(t){if("fixed"==(t=t.toLowerCase()))return m.Fixed;if("percent"==t)return m.Percent;throw new Error("Unknown position mode: "+t)},t.spacingModeFromString=function(t){if("length"==(t=t.toLowerCase()))return w.Length;if("fixed"==t)return w.Fixed;if("percent"==t)return w.Percent;throw new Error("Unknown position mode: "+t)},t.rotateModeFromString=function(t){if("tangent"==(t=t.toLowerCase()))return x.Tangent;if("chain"==t)return x.Chain;if("chainscale"==t)return x.ChainScale;throw new Error("Unknown rotate mode: "+t)},t.transformModeFromString=function(t){if("normal"==(t=t.toLowerCase()))return f.Normal;if("onlytranslation"==t)return f.OnlyTranslation;if("norotationorreflection"==t)return f.NoRotationOrReflection;if("noscale"==t)return f.NoScale;if("noscaleorreflection"==t)return f.NoScaleOrReflection;throw new Error("Unknown transform mode: "+t)},t}(),Lt=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"}(Nt||(Nt={}));var Xt=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 Rt;n.name="";var a=new Dt(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 l=0;l<s;l++){var h=a.readString(),c=0==l?null:n.bones[a.readInt(!0)],f=new g(l,h,c);f.rotation=a.readFloat(),f.x=a.readFloat()*r,f.y=a.readFloat()*r,f.scaleX=a.readFloat(),f.scaleY=a.readFloat(),f.shearX=a.readFloat(),f.shearY=a.readFloat(),f.length=a.readFloat()*r,f.transformMode=t.TransformModeValues[a.readInt(!0)],f.skinRequired=a.readBoolean(),i&&u.rgba8888ToColor(f.color,a.readInt32()),n.bones.push(f)}s=a.readInt(!0);for(var v=0;v<s;v++){var p=a.readString(),x=n.bones[a.readInt(!0)],E=new Ct(v,p,x);u.rgba8888ToColor(E.color,a.readInt32());var y=a.readInt32();-1!=y&&u.rgb888ToColor(E.darkColor=new u,y),E.attachmentName=a.readStringRef(),E.blendMode=t.BlendModeValues[a.readInt(!0)],n.slots.push(E)}s=a.readInt(!0);for(var b,S=0;S<s;S++){var M=new kt(a.readString());M.order=a.readInt(!0),M.skinRequired=a.readBoolean(),b=a.readInt(!0);for(var A=0;A<b;A++)M.bones.push(n.bones[a.readInt(!0)]);M.target=n.bones[a.readInt(!0)],M.mix=a.readFloat(),M.softness=a.readFloat()*r,M.bendDirection=a.readByte(),M.compress=a.readBoolean(),M.stretch=a.readBoolean(),M.uniform=a.readBoolean(),n.ikConstraints.push(M)}s=a.readInt(!0);for(var I,R=0;R<s;R++){var C=new Vt(a.readString());C.order=a.readInt(!0),C.skinRequired=a.readBoolean(),I=a.readInt(!0);for(var k=0;k<I;k++)C.bones.push(n.bones[a.readInt(!0)]);C.target=n.bones[a.readInt(!0)],C.local=a.readBoolean(),C.relative=a.readBoolean(),C.offsetRotation=a.readFloat(),C.offsetX=a.readFloat()*r,C.offsetY=a.readFloat()*r,C.offsetScaleX=a.readFloat(),C.offsetScaleY=a.readFloat(),C.offsetShearY=a.readFloat(),C.rotateMix=a.readFloat(),C.translateMix=a.readFloat(),C.scaleMix=a.readFloat(),C.shearMix=a.readFloat(),n.transformConstraints.push(C)}s=a.readInt(!0);for(var V,P=0;P<s;P++){var _=new T(a.readString());_.order=a.readInt(!0),_.skinRequired=a.readBoolean(),V=a.readInt(!0);for(var F=0;F<V;F++)_.bones.push(n.bones[a.readInt(!0)]);_.target=n.slots[a.readInt(!0)],_.positionMode=t.PositionModeValues[a.readInt(!0)],_.spacingMode=t.SpacingModeValues[a.readInt(!0)],_.rotateMode=t.RotateModeValues[a.readInt(!0)],_.offsetRotation=a.readFloat(),_.position=a.readFloat(),_.positionMode==m.Fixed&&(_.position*=r),_.spacing=a.readFloat(),_.spacingMode!=w.Length&&_.spacingMode!=w.Fixed||(_.spacing*=r),_.rotateMix=a.readFloat(),_.translateMix=a.readFloat(),n.pathConstraints.push(_)}var N=this.readSkin(a,n,!0,i);null!=N&&(n.defaultSkin=N,n.skins.push(N));var O=n.skins.length;for(d.setArraySize(n.skins,s=O+a.readInt(!0));O<s;O++)n.skins[O]=this.readSkin(a,n,!1,i);s=this.linkedMeshes.length;for(var B=0;B<s;B++){var L=this.linkedMeshes[B],X=null==L.skin?n.defaultSkin:n.findSkin(L.skin);if(null==X)throw new Error("Skin not found: "+L.skin);var D=X.getAttachment(L.slotIndex,L.parent);if(null==D)throw new Error("Parent mesh not found: "+L.parent);L.mesh.deformAttachment=L.inheritDeform?D:L.mesh,L.mesh.setParentMesh(D),L.mesh.updateUVs()}this.linkedMeshes.length=0,s=a.readInt(!0);for(var Y=0;Y<s;Y++){var U=new Ft(a.readStringRef());U.intValue=a.readInt(!1),U.floatValue=a.readFloat(),U.stringValue=a.readString(),U.audioPath=a.readString(),null!=U.audioPath&&(U.volume=a.readFloat(),U.balance=a.readFloat()),n.events.push(U)}s=a.readInt(!0);for(var W=0;W<s;W++)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 _t("default")}else{(a=new _t(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 l=0,h=t.readInt(!0);l<h;l++)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(),x=this.readAttachment(t,e,a,p,w,n);null!=x&&a.setAttachment(p,w,x)}return a},e.readAttachment=function(e,r,n,a,i,s){var o=this.scale,l=e.readStringRef();null==l&&(l=i);var h=e.readByte();switch(t.AttachmentTypeValues[h]){case Nt.Region:var c=e.readStringRef(),f=e.readFloat(),v=e.readFloat(),p=e.readFloat(),g=e.readFloat(),m=e.readFloat(),w=e.readFloat(),x=e.readFloat(),E=e.readInt32();null==c&&(c=l);var y=this.attachmentLoader.newRegionAttachment(n,l,c);return null==y?null:(y.path=c,y.x=v*o,y.y=p*o,y.scaleX=g,y.scaleY=m,y.rotation=f,y.width=w*o,y.height=x*o,u.rgba8888ToColor(y.color,E),y.updateOffset(),y);case Nt.BoundingBox:var b=e.readInt(!0),S=this.readVertices(e,b),M=s?e.readInt32():0,T=this.attachmentLoader.newBoundingBoxAttachment(n,l);return null==T?null:(T.worldVerticesLength=b<<1,T.vertices=S.vertices,T.bones=S.bones,s&&u.rgba8888ToColor(T.color,M),T);case Nt.Mesh:var A=e.readStringRef(),I=e.readInt32(),R=e.readInt(!0),C=this.readFloatArray(e,R<<1,1),k=this.readShortArray(e),V=this.readVertices(e,R),P=e.readInt(!0),_=null,F=0,N=0;s&&(_=this.readShortArray(e),F=e.readFloat(),N=e.readFloat()),null==A&&(A=l);var O=this.attachmentLoader.newMeshAttachment(n,l,A);return null==O?null:(O.path=A,u.rgba8888ToColor(O.color,I),O.bones=V.bones,O.vertices=V.vertices,O.worldVerticesLength=R<<1,O.triangles=k,O.regionUVs=C,O.updateUVs(),O.hullLength=P<<1,s&&(O.edges=_,O.width=F*o,O.height=N*o),O);case Nt.LinkedMesh:var B=e.readStringRef(),L=e.readInt32(),X=e.readStringRef(),D=e.readStringRef(),Y=e.readBoolean(),U=0,W=0;s&&(U=e.readFloat(),W=e.readFloat()),null==B&&(B=l);var q=this.attachmentLoader.newMeshAttachment(n,l,B);return null==q?null:(q.path=B,u.rgba8888ToColor(q.color,L),s&&(q.width=U*o,q.height=W*o),this.linkedMeshes.push(new Yt(q,X,a,D,Y)),q);case Nt.Path:for(var H=e.readBoolean(),j=e.readBoolean(),G=e.readInt(!0),z=this.readVertices(e,G),Z=d.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,l);return null==$?null:($.closed=H,$.constantSpeed=j,$.worldVerticesLength=G<<1,$.vertices=z.vertices,$.bones=z.bones,$.lengths=Z,s&&u.rgba8888ToColor($.color,K),$);case Nt.Point:var tt=e.readFloat(),et=e.readFloat(),rt=e.readFloat(),nt=s?e.readInt32():0,at=this.attachmentLoader.newPointAttachment(n,l);return null==at?null:(at.x=et*o,at.y=rt*o,at.rotation=tt,s&&u.rgba8888ToColor(at.color,nt),at);case Nt.Clipping:var it=e.readInt(!0),st=e.readInt(!0),ot=this.readVertices(e,st),lt=s?e.readInt32():0,ht=this.attachmentLoader.newClippingAttachment(n,l);return null==ht?null:(ht.endSlot=r.slots[it],ht.worldVerticesLength=st<<1,ht.vertices=ot.vertices,ht.bones=ot.bones,s&&u.rgba8888ToColor(ht.color,lt),ht)}return null},e.readVertices=function(t,e){var r=e<<1,n=new Ut,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 l=t.readInt(!0);s.push(l);for(var h=0;h<l;h++)s.push(t.readInt(!0)),i.push(t.readFloat()*a),i.push(t.readFloat()*a),i.push(t.readFloat())}return n.vertices=d.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 u,l=new u,h=0,c=e.readInt(!0);h<c;h++)for(var f=e.readInt(!0),v=0,p=e.readInt(!0);v<p;v++){var g=e.readByte(),x=e.readInt(!0);switch(g){case t.SLOT_ATTACHMENT:var E=new $(x);E.slotIndex=f;for(var y=0;y<x;y++)E.setFrame(y,e.readFloat(),e.readStringRef());a.push(E),s=Math.max(s,E.frames[x-1]);break;case t.SLOT_COLOR:var b=new J(x);b.slotIndex=f;for(var S=0;S<x;S++){var M=e.readFloat();u.rgba8888ToColor(o,e.readInt32()),b.setFrame(S,M,o.r,o.g,o.b,o.a),S<x-1&&this.readCurve(e,S,b)}a.push(b),s=Math.max(s,b.frames[(x-1)*J.ENTRIES]);break;case t.SLOT_TWO_COLOR:var T=new K(x);T.slotIndex=f;for(var A=0;A<x;A++){var I=e.readFloat();u.rgba8888ToColor(o,e.readInt32()),u.rgb888ToColor(l,e.readInt32()),T.setFrame(A,I,o.r,o.g,o.b,o.a,l.r,l.g,l.b),A<x-1&&this.readCurve(e,A,T)}a.push(T),s=Math.max(s,T.frames[(x-1)*K.ENTRIES])}}for(var R=0,C=e.readInt(!0);R<C;R++)for(var k=e.readInt(!0),V=0,P=e.readInt(!0);V<P;V++){var _=e.readByte(),F=e.readInt(!0);switch(_){case t.BONE_ROTATE:var N=new G(F);N.boneIndex=k;for(var O=0;O<F;O++)N.setFrame(O,e.readFloat(),e.readFloat()),O<F-1&&this.readCurve(e,O,N);a.push(N),s=Math.max(s,N.frames[(F-1)*G.ENTRIES]);break;case t.BONE_TRANSLATE:case t.BONE_SCALE:case t.BONE_SHEAR:var B=void 0,L=1;_==t.BONE_SCALE?B=new Z(F):_==t.BONE_SHEAR?B=new Q(F):(B=new z(F),L=i),B.boneIndex=k;for(var X=0;X<F;X++)B.setFrame(X,e.readFloat(),e.readFloat()*L,e.readFloat()*L),X<F-1&&this.readCurve(e,X,B);a.push(B),s=Math.max(s,B.frames[(F-1)*z.ENTRIES])}}for(var D=0,Y=e.readInt(!0);D<Y;D++){var U=e.readInt(!0),W=e.readInt(!0),q=new at(W);q.ikConstraintIndex=U;for(var j=0;j<W;j++)q.setFrame(j,e.readFloat(),e.readFloat(),e.readFloat()*i,e.readByte(),e.readBoolean(),e.readBoolean()),j<W-1&&this.readCurve(e,j,q);a.push(q),s=Math.max(s,q.frames[(W-1)*at.ENTRIES])}for(var tt=0,ht=e.readInt(!0);tt<ht;tt++){var ut=e.readInt(!0),ct=e.readInt(!0),dt=new it(ct);dt.transformConstraintIndex=ut;for(var ft=0;ft<ct;ft++)dt.setFrame(ft,e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat(),e.readFloat()),ft<ct-1&&this.readCurve(e,ft,dt);a.push(dt),s=Math.max(s,dt.frames[(ct-1)*it.ENTRIES])}for(var vt=0,pt=e.readInt(!0);vt<pt;vt++)for(var gt=e.readInt(!0),mt=n.pathConstraints[gt],wt=0,xt=e.readInt(!0);wt<xt;wt++){var Et=e.readByte(),yt=e.readInt(!0);switch(Et){case t.PATH_POSITION:case t.PATH_SPACING:var bt=void 0,St=1;Et==t.PATH_SPACING?(bt=new ot(yt),mt.spacingMode!=w.Length&&mt.spacingMode!=w.Fixed||(St=i)):(bt=new st(yt),mt.positionMode==m.Fixed&&(St=i)),bt.pathConstraintIndex=gt;for(var Mt=0;Mt<yt;Mt++)bt.setFrame(Mt,e.readFloat(),e.readFloat()*St),Mt<yt-1&&this.readCurve(e,Mt,bt);a.push(bt),s=Math.max(s,bt.frames[(yt-1)*st.ENTRIES]);break;case t.PATH_MIX:var Tt=new lt(yt);Tt.pathConstraintIndex=gt;for(var At=0;At<yt;At++)Tt.setFrame(At,e.readFloat(),e.readFloat(),e.readFloat()),At<yt-1&&this.readCurve(e,At,Tt);a.push(Tt),s=Math.max(s,Tt.frames[(yt-1)*lt.ENTRIES])}}for(var It=0,Rt=e.readInt(!0);It<Rt;It++)for(var Ct=n.skins[e.readInt(!0)],kt=0,Vt=e.readInt(!0);kt<Vt;kt++)for(var Pt=e.readInt(!0),_t=0,Ft=e.readInt(!0);_t<Ft;_t++){var Nt=Ct.getAttachment(Pt,e.readStringRef()),Bt=null!=Nt.bones,Lt=Nt.vertices,Xt=Bt?Lt.length/3*2:Lt.length,Dt=e.readInt(!0),Yt=new et(Dt);Yt.slotIndex=Pt,Yt.attachment=Nt;for(var Ut=0;Ut<Dt;Ut++){var Wt=e.readFloat(),qt=void 0,Ht=e.readInt(!0);if(0==Ht)qt=Bt?d.newFloatArray(Xt):Lt;else{qt=d.newFloatArray(Xt);var jt=e.readInt(!0);if(Ht+=jt,1==i)for(var Gt=jt;Gt<Ht;Gt++)qt[Gt]=e.readFloat();else for(var zt=jt;zt<Ht;zt++)qt[zt]=e.readFloat()*i;if(!Bt)for(var Zt=0,Qt=qt.length;Zt<Qt;Zt++)qt[Zt]+=Lt[Zt]}Yt.setFrame(Ut,Wt,qt),Ut<Dt-1&&this.readCurve(e,Ut,Yt)}a.push(Yt),s=Math.max(s,Yt.frames[Dt-1])}var Jt=e.readInt(!0);if(Jt>0){for(var Kt=new nt(Jt),$t=n.slots.length,te=0;te<Jt;te++){for(var ee=e.readFloat(),re=e.readInt(!0),ne=d.newArray($t,0),ae=$t-1;ae>=0;ae--)ne[ae]=-1;for(var ie=d.newArray($t-re,0),se=0,oe=0,le=0;le<re;le++){for(var he=e.readInt(!0);se!=he;)ie[oe++]=se++;ne[se+e.readInt(!0)]=se++}for(;se<$t;)ie[oe++]=se++;for(var ue=$t-1;ue>=0;ue--)-1==ne[ue]&&(ne[ue]=ie[--oe]);Kt.setFrame(te,ee,ne)}a.push(Kt),s=Math.max(s,Kt.frames[Jt-1])}var ce=e.readInt(!0);if(ce>0){for(var de=new rt(ce),fe=0;fe<ce;fe++){var ve=e.readFloat(),pe=n.events[e.readInt(!0)],ge=new Ot(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 H(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}();Xt.AttachmentTypeValues=[0,1,2,3,4,5,6],Xt.TransformModeValues=[f.Normal,f.OnlyTranslation,f.NoRotationOrReflection,f.NoScale,f.NoScaleOrReflection],Xt.PositionModeValues=[m.Fixed,m.Percent],Xt.SpacingModeValues=[w.Length,w.Fixed,w.Percent],Xt.RotateModeValues=[x.Tangent,x.Chain,x.ChainScale],Xt.BlendModeValues=[St.Normal,St.Additive,St.Multiply,St.Screen],Xt.BONE_ROTATE=0,Xt.BONE_TRANSLATE=1,Xt.BONE_SCALE=2,Xt.BONE_SHEAR=3,Xt.SLOT_ATTACHMENT=0,Xt.SLOT_COLOR=1,Xt.SLOT_TWO_COLOR=2,Xt.PATH_POSITION=0,Xt.PATH_SPACING=1,Xt.PATH_MIX=2,Xt.CURVE_LINEAR=0,Xt.CURVE_STEPPED=1,Xt.CURVE_BEZIER=2;var Dt=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}(),Yt=function(t,e,r,n,a){this.mesh=t,this.skin=e,this.slotIndex=r,this.parent=n,this.inheritDeform=a},Ut=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e},Wt=function(e){function r(){return e.apply(this,arguments)}s(r,e);var n=r.prototype;return n.load=function(e,r){var n=this;return new t.AssetPromise((function(a,i){var s,o=r.engine;"spine"!==e.type&&i("Asset type must be spine."),!e.urls&&e.url&&n.checkUrl(e.url)&&(s=n.getResouceFromUrl(e.url)),e.urls&&n.checkUrls(e.urls)&&(s=n.getResouceFromUrls(e.urls));var l,h=!1;l=new Mt(null,(function(t){return n.createAdaptiveTexture(t,o)}));var u=s.skeletonFile,c=s.atlasFile,d=s.textureFile;l.onLoadComplete=function(){try{var e;if(h)e=l.get(c);else{var r=l.get(c);e=new X(r,n.textureAssetPicker.bind(n,l,d))}var s=new It(e),f=(n.isBinFile(u)?new Xt(s):new Bt(s)).readSkeletonData(l.get(u)),v=new t.Entity(o),p=v.addComponent(t.MeshRenderer),g=Et.getDefaultMaterial(o);p.setMaterial(g),v.addComponent(Et).setSkeletonData(f),a(v)}catch(t){i(t)}};var f=n.isBinFile(u);u&&c&&d?(f?l.loadBinary(u,null,i):l.loadText(u,null,i),l.loadText(c,null,i),l.loadTexture(d,null,i)):u&&c&&!d?(h=!0,f?l.loadBinary(u,null,i):l.loadText(u,null,i),l.loadTextureAtlas(c,null,i)):i("Resouce param error")}))},n.textureAssetPicker=function(t,e){return t.get(e)},n.createAdaptiveTexture=function(t,e){return new qt(t,e)},n.isBinFile=function(t){return"bin"===this.getExtFromUrl(t)},n.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)},n.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"}},n.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)},n.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}},n.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},r}(t.Loader);Wt=o([t.resourceLoader("spine",["json","bin"])],Wt);var qt=function(e){function r(r,n){var a;return(a=e.call(this,r)||this).texture=new t.Texture2D(n,r.width,r.height),a.texture.setImageSource(r),a.texture.generateMipmaps(),a}s(r,e);var n=r.prototype;return n.setFilters=function(e,r){e===V.Nearest?this.texture.filterMode=t.TextureFilterMode.Point:r===V.MipMapLinearLinear?this.texture.filterMode=t.TextureFilterMode.Trilinear:this.texture.filterMode=t.TextureFilterMode.Bilinear},n.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},n.dispose=function(){},r}(_),Ht=function(r){function n(){return r.apply(this,arguments)}s(n,r);var a=n.prototype;return a.load=function(r,n){var a=this;return new t.AssetPromise((function(i,s){var o=n.engine;if(r.url)if(a.checkUrl(r.url)){var l,h,u,c,d,f=r.url;c=new Mt(null,(function(t){return a.createAdaptiveTexture(t,o)})),(d=f,new Promise((function(t,r){var n=new e.XMLHttpRequest;n.responseType="json",n.open("GET",d,!0),n.onload=function(){200==n.status?t(n.response):r("status:"+n.status+", "+n.responseText)},n.onerror=function(){r("status:"+n.status+", "+n.responseText)},n.send()}))).then((function(t){if(u=t,t._ext){var e=t._ext,r=e.atlas,n=e.images,a=n[Object.keys(n)[0]];l=r,h=a,c.loadText(r),c.loadTexture(a)}else s("AntG spine json must have ext data")})).catch((function(){s("Resouce json load fail")})),c.onLoadComplete=function(){var e,r=c.get(l);e=new X(r,a.textureAssetPicker.bind(a,c,h));var n=new It(e),s=new Bt(n).readSkeletonData(u),d=new t.Entity(o),f=d.addComponent(t.MeshRenderer);f.shaderData.enableMacro("USE_MODEL_MATRIX"),f.shaderData.enableMacro("USE_CUSTOM_TEXTURE");var v=o._spriteDefaultMaterial.clone();f.setMaterial(v),d.addComponent(Et).setSkeletonData(s),i(d)}}else s("AntG asset must be a json url.");else s("AntG asset must be a json url.")}))},a.textureAssetPicker=function(t,e){return t.get(e)},a.createAdaptiveTexture=function(t,e){return new jt(t,e)},a.checkUrl=function(t){return"json"===this.getExtFromUrl(t)||(console.error("When use url as params, url must be a json file"),!1)},a.getExtFromUrl=function(t){return t.split(/[#?]/)[0].split(".").pop().trim()},n}(t.Loader);Ht=o([t.resourceLoader("antg_spine",["json","bin"])],Ht);var jt=function(e){function r(r,n){var a;return(a=e.call(this,r)||this).texture=new t.Texture2D(n,r.width,r.height),a.texture.setImageSource(r),a.texture.generateMipmaps(),a}s(r,e);var n=r.prototype;return n.setFilters=function(e,r){e===V.Nearest?this.texture.filterMode=t.TextureFilterMode.Point:r===V.MipMapLinearLinear?this.texture.filterMode=t.TextureFilterMode.Trilinear:this.texture.filterMode=t.TextureFilterMode.Bilinear},n.setWraps=function(t,e){this.texture.wrapModeU=t,this.texture.wrapModeV=e},n.dispose=function(){},r}(_);var Gt="1.1.0-beta.0";console.log("Galacean spine version :"+Gt),exports.AssetManager=Mt,exports.AtlasAttachmentLoader=It,exports.SkeletonBinary=Xt,exports.SkeletonJson=Bt,exports.SpineAnimation=Et,exports.Texture=_,exports.TextureAtlas=X,exports.version=Gt;