diff --git a/README.md b/README.md index ee0a86f..9328153 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,23 @@ Examples such as the Hero above can be found in the `examples` folder. To run th ## Usage -### Editor +### Versions -Add the plugin matching the Spine version used to export the animations, i.e `build/playcanvas-spine.X.X.min.js` and the PlayCanvas script `build/spine.js` to your project. The following plugins are available: +The following plugins are available: | Spine Editor | PlayCanvas Engine | | ------------ | ----------------- | | 3.6 | Up to 1.65 | | 3.8 | Up to 1.65 | +| 4.0 | 1.27 and later | | 4.1 | 1.27 and later | +Each plugin provides both a Component System to PlayCanvas Engine and the corresponding `spine-core` runtime to your scripts as global variable called `spine`. This allows developers to leverage the full spine library. + +### Editor + +Add the plugin matching the Spine version used to export the animations, i.e `build/playcanvas-spine.X.X.min.js` and the PlayCanvas script `build/spine.js` to your project. + Create an entity with a script component and add the script `spine` to it. Upload your exported spine resources (atlas, skeleton json file, textures) and attach them to the spine script on your entity. Ensure the plugin file is listed before the PlayCanvas script in the [Scripts Loading Order](https://developer.playcanvas.com/en/user-manual/scripting/loading-order/). diff --git a/build/playcanvas-spine.3.6.js b/build/playcanvas-spine.3.6.js index bcaf26b..7a1ce94 100644 --- a/build/playcanvas-spine.3.6.js +++ b/build/playcanvas-spine.3.6.js @@ -8797,6 +8797,7 @@ var spine = (function (pc) { this.skeletonVersion = semver.valid(semver.coerce(_skeletonData.version)); this._spine_3_6_0 = semver.satisfies(this.skeletonVersion, '<=3.6.0'); this._spine_3_7_99 = semver.satisfies(this.skeletonVersion, '<=3.7.99'); + this._spine_4_0_X = semver.satisfies(this.skeletonVersion, '~4.0.0'); this._spine_4_1_X = semver.satisfies(this.skeletonVersion, '~4.1.23'); this.skeleton = new spine$1.Skeleton(_skeletonData); this.skeleton.updateWorldTransform(); @@ -8935,26 +8936,32 @@ var spine = (function (pc) { } else if (attachment instanceof spine$1.MeshAttachment) { slot._active.type = ATTACHMENT_TYPE.MESH; } - if (attachment.region && attachment.region.texture) { - var texture = attachment.region.texture.pcTexture; - if (texture) { - if (texture instanceof pc__namespace.StandardMaterial) { - this._materials[texture.name] = texture; - slot.material = texture.name; - } else { - var key = null; - if (texture.name) { - key = texture.name; - } else if (texture.getSource() instanceof Image) { - key = texture.getSource().getAttribute('src'); - } - if (key) { - if (this._materials[key] === undefined) { - var material = this.createMaterial(texture); - this._materials[key] = material; - } - slot.material = key; + var texture = null; + if (attachment.region) { + if (attachment.region.texture) { + texture = attachment.region.texture.pcTexture; + } + if (attachment.region.page && attachment.region.page.texture) { + texture = attachment.region.page.texture.pcTexture; + } + } + if (texture) { + if (texture instanceof pc__namespace.StandardMaterial) { + this._materials[texture.name] = texture; + slot.material = texture.name; + } else { + var key = null; + if (texture.name) { + key = texture.name; + } else if (texture.getSource() instanceof Image) { + key = texture.getSource().getAttribute('src'); + } + if (key) { + if (this._materials[key] === undefined) { + var material = this.createMaterial(texture); + this._materials[key] = material; } + slot.material = key; } } } diff --git a/build/playcanvas-spine.3.6.min.js b/build/playcanvas-spine.3.6.min.js index 12b01fa..accdf90 100644 --- a/build/playcanvas-spine.3.6.min.js +++ b/build/playcanvas-spine.3.6.min.js @@ -1 +1 @@ -var spine=function(t){"use strict";function e(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var n,r,i,a=e(t),o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});function s(){s=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",h=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var a=e&&e.prototype instanceof y?e:y,o=Object.create(a.prototype),s=new N(r||[]);return i(o,"_invoke",{value:b(t,n,s)}),o}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var p="suspendedStart",d="suspendedYield",m="executing",v="completed",g={};function y(){}function E(){}function w(){}var x={};u(x,o,(function(){return this}));var A=Object.getPrototypeOf,T=A&&A(A(_([])));T&&T!==n&&r.call(T,o)&&(x=T);var M=w.prototype=y.prototype=Object.create(x);function R(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function n(i,a,o,s){var h=f(t[i],t,a);if("throw"!==h.type){var l=h.arg,u=l.value;return u&&"object"==typeof u&&r.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,o,s)}),(function(t){n("throw",t,o,s)})):e.resolve(u).then((function(t){l.value=t,o(l)}),(function(t){return n("throw",t,o,s)}))}s(h.arg)}var a;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return a=a?a.then(i,i):i()}})}function b(e,n,r){var i=p;return function(a,o){if(i===m)throw new Error("Generator is already running");if(i===v){if("throw"===a)throw o;return{value:t,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var h=S(s,r);if(h){if(h===g)continue;return h}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var l=f(e,n,r);if("normal"===l.type){if(i=r.done?v:d,l.arg===g)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function S(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=f(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function _(e){if(e||""===e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var h=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(h&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:_(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function M(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}!function(t){var e,n,r,i=function(){function t(t,e,n){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.duration=n}return t.prototype.apply=function(t,e,n,r,i,a,o,s){if(null==t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(n%=this.duration,e>0&&(e%=this.duration));for(var h=this.timelines,l=0,u=h.length;l>>1;;){if(t[(a+1)*n]<=e?r=a+1:i=a,r==i)return(r+1)*n;a=r+i>>>1}},t.linearSearch=function(t,e,n){for(var r=0,i=t.length-n;r<=i;r+=n)if(t[r]>e)return r;return-1},t}();t.Animation=i,function(t){t[t.setup=0]="setup",t[t.current=1]="current",t[t.currentLayered=2]="currentLayered"}(e=t.MixPose||(t.MixPose={})),function(t){t[t.in=0]="in",t[t.out=1]="out"}(n=t.MixDirection||(t.MixDirection={})),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"}(r=t.TimelineType||(t.TimelineType={}));var a=function(){function e(n){if(n<=0)throw new Error("frameCount must be > 0: "+n);this.curves=t.Utils.newFloatArray((n-1)*e.BEZIER_SIZE)}return e.prototype.getFrameCount=function(){return this.curves.length/e.BEZIER_SIZE+1},e.prototype.setLinear=function(t){this.curves[t*e.BEZIER_SIZE]=e.LINEAR},e.prototype.setStepped=function(t){this.curves[t*e.BEZIER_SIZE]=e.STEPPED},e.prototype.getCurveType=function(t){var n=t*e.BEZIER_SIZE;if(n==this.curves.length)return e.LINEAR;var r=this.curves[n];return r==e.LINEAR?e.LINEAR:r==e.STEPPED?e.STEPPED:e.BEZIER},e.prototype.setCurve=function(t,n,r,i,a){var o=.03*(2*-n+i),s=.03*(2*-r+a),h=.006*(3*(n-i)+1),l=.006*(3*(r-a)+1),u=2*o+h,c=2*s+l,f=.3*n+o+.16666667*h,p=.3*r+s+.16666667*l,d=t*e.BEZIER_SIZE,m=this.curves;m[d++]=e.BEZIER;for(var v=f,g=p,y=d+e.BEZIER_SIZE-1;d=r){var u=void 0,c=void 0;return a==h?(u=0,c=0):(u=i[a-2],c=i[a-1]),c+(i[a+1]-c)*(r-u)/(s-u)}var f=i[a-1];return f+(1-f)*(r-s)/(1-s)},e.LINEAR=0,e.STEPPED=1,e.BEZIER=2,e.BEZIER_SIZE=19,e}();t.CurveTimeline=a;var s=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e<<1),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.rotate<<24)+this.boneIndex},a.prototype.setFrame=function(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+a.ROTATION]=n},a.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(r=u[u.length-a.ENTRIES])if(h==e.setup)c.rotation=c.data.rotation+u[u.length+a.PREV_ROTATION]*s;else{var p=c.data.rotation+u[u.length+a.PREV_ROTATION]-c.rotation;p-=360*(16384-(16384.499999999996-p/360|0)),c.rotation+=p*s}else{var d=i.binarySearch(u,r,a.ENTRIES),m=u[d+a.PREV_ROTATION],v=u[d],g=this.getCurvePercent((d>>1)-1,1-(r-v)/(u[d+a.PREV_TIME]-v)),y=u[d+a.ROTATION]-m;y=m+(y-=360*(16384-(16384.499999999996-y/360|0)))*g,h==e.setup?(y-=360*(16384-(16384.499999999996-y/360|0)),c.rotation=c.data.rotation+y*s):(y=c.data.rotation+y-c.rotation,y-=360*(16384-(16384.499999999996-y/360|0)),c.rotation+=y*s)}},a.ENTRIES=2,a.PREV_TIME=-2,a.PREV_ROTATION=-1,a.ROTATION=1,a}(a);t.RotateTimeline=s;var h=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.translate<<24)+this.boneIndex},a.prototype.setFrame=function(t,e,n,r){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.X]=n,this.frames[t+a.Y]=r},a.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(r=u[u.length-a.ENTRIES])f=u[u.length+a.PREV_X],p=u[u.length+a.PREV_Y];else{var d=i.binarySearch(u,r,a.ENTRIES);f=u[d+a.PREV_X],p=u[d+a.PREV_Y];var m=u[d],v=this.getCurvePercent(d/a.ENTRIES-1,1-(r-m)/(u[d+a.PREV_TIME]-m));f+=(u[d+a.X]-f)*v,p+=(u[d+a.Y]-p)*v}h==e.setup?(c.x=c.data.x+f*s,c.y=c.data.y+p*s):(c.x+=(c.data.x+f-c.x)*s,c.y+=(c.data.y+p-c.y)*s)}},a.ENTRIES=3,a.PREV_TIME=-3,a.PREV_X=-2,a.PREV_Y=-1,a.X=1,a.Y=2,a}(a);t.TranslateTimeline=h;var l=function(a){function s(t){return a.call(this,t)||this}return o(s,a),s.prototype.getPropertyId=function(){return(r.scale<<24)+this.boneIndex},s.prototype.apply=function(r,a,o,h,l,u,c){var f=this.frames,p=r.bones[this.boneIndex];if(o=f[f.length-s.ENTRIES])d=f[f.length+s.PREV_X]*p.data.scaleX,m=f[f.length+s.PREV_Y]*p.data.scaleY;else{var v=i.binarySearch(f,o,s.ENTRIES);d=f[v+s.PREV_X],m=f[v+s.PREV_Y];var g=f[v],y=this.getCurvePercent(v/s.ENTRIES-1,1-(o-g)/(f[v+s.PREV_TIME]-g));d=(d+(f[v+s.X]-d)*y)*p.data.scaleX,m=(m+(f[v+s.Y]-m)*y)*p.data.scaleY}if(1==l)p.scaleX=d,p.scaleY=m;else{var E=0,w=0;u==e.setup?(E=p.data.scaleX,w=p.data.scaleY):(E=p.scaleX,w=p.scaleY),c==n.out?(d=Math.abs(d)*t.MathUtils.signum(E),m=Math.abs(m)*t.MathUtils.signum(w)):(E=Math.abs(E)*t.MathUtils.signum(d),w=Math.abs(w)*t.MathUtils.signum(m)),p.scaleX=E+(d-E)*l,p.scaleY=w+(m-w)*l}}},s}(h);t.ScaleTimeline=l;var u=function(t){function n(e){return t.call(this,e)||this}return o(n,t),n.prototype.getPropertyId=function(){return(r.shear<<24)+this.boneIndex},n.prototype.apply=function(t,r,a,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(a=u[u.length-n.ENTRIES])f=u[u.length+n.PREV_X],p=u[u.length+n.PREV_Y];else{var d=i.binarySearch(u,a,n.ENTRIES);f=u[d+n.PREV_X],p=u[d+n.PREV_Y];var m=u[d],v=this.getCurvePercent(d/n.ENTRIES-1,1-(a-m)/(u[d+n.PREV_TIME]-m));f+=(u[d+n.X]-f)*v,p+=(u[d+n.Y]-p)*v}h==e.setup?(c.shearX=c.data.shearX+f*s,c.shearY=c.data.shearY+p*s):(c.shearX+=(c.data.shearX+f-c.shearX)*s,c.shearY+=(c.data.shearY+p-c.shearY)*s)}},n}(h);t.ShearTimeline=u;var c=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.color<<24)+this.slotIndex},a.prototype.setFrame=function(t,e,n,r,i,o){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.R]=n,this.frames[t+a.G]=r,this.frames[t+a.B]=i,this.frames[t+a.A]=o},a.prototype.apply=function(t,n,r,o,s,h,l){var u=t.slots[this.slotIndex],c=this.frames;if(r=c[c.length-a.ENTRIES]){var y=c.length;d=c[y+a.PREV_R],m=c[y+a.PREV_G],v=c[y+a.PREV_B],g=c[y+a.PREV_A]}else{var E=i.binarySearch(c,r,a.ENTRIES);d=c[E+a.PREV_R],m=c[E+a.PREV_G],v=c[E+a.PREV_B],g=c[E+a.PREV_A];var w=c[E],x=this.getCurvePercent(E/a.ENTRIES-1,1-(r-w)/(c[E+a.PREV_TIME]-w));d+=(c[E+a.R]-d)*x,m+=(c[E+a.G]-m)*x,v+=(c[E+a.B]-v)*x,g+=(c[E+a.A]-g)*x}if(1==s)u.color.set(d,m,v,g);else{f=u.color;h==e.setup&&f.setFromColor(u.data.color),f.add((d-f.r)*s,(m-f.g)*s,(v-f.b)*s,(g-f.a)*s)}}},a.ENTRIES=5,a.PREV_TIME=-5,a.PREV_R=-4,a.PREV_G=-3,a.PREV_B=-2,a.PREV_A=-1,a.R=1,a.G=2,a.B=3,a.A=4,a}(a);t.ColorTimeline=c;var f=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.twoColor<<24)+this.slotIndex},a.prototype.setFrame=function(t,e,n,r,i,o,s,h,l){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.R]=n,this.frames[t+a.G]=r,this.frames[t+a.B]=i,this.frames[t+a.A]=o,this.frames[t+a.R2]=s,this.frames[t+a.G2]=h,this.frames[t+a.B2]=l},a.prototype.apply=function(t,n,r,o,s,h,l){var u=t.slots[this.slotIndex],c=this.frames;if(r=c[c.length-a.ENTRIES]){var T=c.length;v=c[T+a.PREV_R],g=c[T+a.PREV_G],y=c[T+a.PREV_B],E=c[T+a.PREV_A],w=c[T+a.PREV_R2],x=c[T+a.PREV_G2],A=c[T+a.PREV_B2]}else{var M=i.binarySearch(c,r,a.ENTRIES);v=c[M+a.PREV_R],g=c[M+a.PREV_G],y=c[M+a.PREV_B],E=c[M+a.PREV_A],w=c[M+a.PREV_R2],x=c[M+a.PREV_G2],A=c[M+a.PREV_B2];var R=c[M],I=this.getCurvePercent(M/a.ENTRIES-1,1-(r-R)/(c[M+a.PREV_TIME]-R));v+=(c[M+a.R]-v)*I,g+=(c[M+a.G]-g)*I,y+=(c[M+a.B]-y)*I,E+=(c[M+a.A]-E)*I,w+=(c[M+a.R2]-w)*I,x+=(c[M+a.G2]-x)*I,A+=(c[M+a.B2]-A)*I}if(1==s)u.color.set(v,g,y,E),u.darkColor.set(w,x,A,1);else{f=u.color,p=u.darkColor;h==e.setup&&(f.setFromColor(u.data.color),p.setFromColor(u.data.darkColor)),f.add((v-f.r)*s,(g-f.g)*s,(y-f.b)*s,(E-f.a)*s),p.add((w-p.r)*s,(x-p.g)*s,(A-p.b)*s,0)}}},a.ENTRIES=8,a.PREV_TIME=-8,a.PREV_R=-7,a.PREV_G=-6,a.PREV_B=-5,a.PREV_A=-4,a.PREV_R2=-3,a.PREV_G2=-2,a.PREV_B2=-1,a.R=1,a.G=2,a.B=3,a.A=4,a.R2=5,a.G2=6,a.B2=7,a}(a);t.TwoColorTimeline=f;var p=function(){function a(e){this.frames=t.Utils.newFloatArray(e),this.attachmentNames=new Array(e)}return a.prototype.getPropertyId=function(){return(r.attachment<<24)+this.slotIndex},a.prototype.getFrameCount=function(){return this.frames.length},a.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n},a.prototype.apply=function(t,r,a,o,s,h,l){var u=t.slots[this.slotIndex];if(l!=n.out||h!=e.setup){var c=this.frames;if(a=c[c.length-1]?c.length-1:i.binarySearch(c,a,1)-1;var d=this.attachmentNames[p];t.slots[this.slotIndex].setAttachment(null==d?null:t.getAttachment(this.slotIndex,d))}}else{var m=u.data.attachmentName;u.setAttachment(null==m?null:t.getAttachment(this.slotIndex,m))}},a}();t.AttachmentTimeline=p;var d=null,m=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e),r.frameVertices=new Array(e),null==d&&(d=t.Utils.newFloatArray(64)),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.deform<<27)+ +this.attachment.id+this.slotIndex},a.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},a.prototype.apply=function(n,r,a,o,s,h,l){var u=n.slots[this.slotIndex],c=u.getAttachment();if(c instanceof t.VertexAttachment&&c.applyDeform(this.attachment)){var f=u.attachmentVertices;0==f.length&&(s=1);var p=this.frameVertices,d=p[0].length,m=this.frames;if(a=m[m.length-1]){var x=p[m.length-1];if(1==s)t.Utils.arrayCopy(x,0,w,0,d);else if(h==e.setup){if(null==(v=c).bones)for(var A=v.vertices,T=0;Tn)this.apply(t,e,Number.MAX_VALUE,r,a,o,s),e=-1;else if(e>=h[l-1])return;if(!(n0&&h[u-1]==c;)u--;for(;u=h[u];u++)r.push(this.events[u])}}},e}();t.EventTimeline=v;var g=function(){function a(e){this.frames=t.Utils.newFloatArray(e),this.drawOrders=new Array(e)}return a.prototype.getPropertyId=function(){return r.drawOrder<<24},a.prototype.getFrameCount=function(){return this.frames.length},a.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n},a.prototype.apply=function(r,a,o,s,h,l,u){var c=r.drawOrder,f=r.slots;if(u!=n.out||l!=e.setup){var p=this.frames;if(o=p[p.length-1]?p.length-1:i.binarySearch(p,o)-1;var m=this.drawOrders[d];if(null==m)t.Utils.arrayCopy(f,0,c,0,f.length);else for(var v=0,g=m.length;v=c[c.length-s.ENTRIES])l==e.setup?(f.mix=f.data.mix+(c[c.length+s.PREV_MIX]-f.data.mix)*h,f.bendDirection=u==n.out?f.data.bendDirection:c[c.length+s.PREV_BEND_DIRECTION]):(f.mix+=(c[c.length+s.PREV_MIX]-f.mix)*h,u==n.in&&(f.bendDirection=c[c.length+s.PREV_BEND_DIRECTION]));else{var p=i.binarySearch(c,a,s.ENTRIES),d=c[p+s.PREV_MIX],m=c[p],v=this.getCurvePercent(p/s.ENTRIES-1,1-(a-m)/(c[p+s.PREV_TIME]-m));l==e.setup?(f.mix=f.data.mix+(d+(c[p+s.MIX]-d)*v-f.data.mix)*h,f.bendDirection=u==n.out?f.data.bendDirection:c[p+s.PREV_BEND_DIRECTION]):(f.mix+=(d+(c[p+s.MIX]-d)*v-f.mix)*h,u==n.in&&(f.bendDirection=c[p+s.PREV_BEND_DIRECTION]))}},s.ENTRIES=3,s.PREV_TIME=-3,s.PREV_MIX=-2,s.PREV_BEND_DIRECTION=-1,s.MIX=1,s.BEND_DIRECTION=2,s}(a);t.IkConstraintTimeline=y;var E=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.transformConstraint<<24)+this.transformConstraintIndex},a.prototype.setFrame=function(t,e,n,r,i,o){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.ROTATE]=n,this.frames[t+a.TRANSLATE]=r,this.frames[t+a.SCALE]=i,this.frames[t+a.SHEAR]=o},a.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.transformConstraints[this.transformConstraintIndex];if(r=u[u.length-a.ENTRIES]){var g=u.length;p=u[g+a.PREV_ROTATE],d=u[g+a.PREV_TRANSLATE],m=u[g+a.PREV_SCALE],v=u[g+a.PREV_SHEAR]}else{var y=i.binarySearch(u,r,a.ENTRIES);p=u[y+a.PREV_ROTATE],d=u[y+a.PREV_TRANSLATE],m=u[y+a.PREV_SCALE],v=u[y+a.PREV_SHEAR];var E=u[y],w=this.getCurvePercent(y/a.ENTRIES-1,1-(r-E)/(u[y+a.PREV_TIME]-E));p+=(u[y+a.ROTATE]-p)*w,d+=(u[y+a.TRANSLATE]-d)*w,m+=(u[y+a.SCALE]-m)*w,v+=(u[y+a.SHEAR]-v)*w}if(h==e.setup){f=c.data;c.rotateMix=f.rotateMix+(p-f.rotateMix)*s,c.translateMix=f.translateMix+(d-f.translateMix)*s,c.scaleMix=f.scaleMix+(m-f.scaleMix)*s,c.shearMix=f.shearMix+(v-f.shearMix)*s}else c.rotateMix+=(p-c.rotateMix)*s,c.translateMix+=(d-c.translateMix)*s,c.scaleMix+=(m-c.scaleMix)*s,c.shearMix+=(v-c.shearMix)*s}},a.ENTRIES=5,a.PREV_TIME=-5,a.PREV_ROTATE=-4,a.PREV_TRANSLATE=-3,a.PREV_SCALE=-2,a.PREV_SHEAR=-1,a.ROTATE=1,a.TRANSLATE=2,a.SCALE=3,a.SHEAR=4,a}(a);t.TransformConstraintTimeline=E;var w=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.pathConstraintPosition<<24)+this.pathConstraintIndex},a.prototype.setFrame=function(t,e,n){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.VALUE]=n},a.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(r=u[u.length-a.ENTRIES])f=u[u.length+a.PREV_VALUE];else{var p=i.binarySearch(u,r,a.ENTRIES);f=u[p+a.PREV_VALUE];var d=u[p],m=this.getCurvePercent(p/a.ENTRIES-1,1-(r-d)/(u[p+a.PREV_TIME]-d));f+=(u[p+a.VALUE]-f)*m}h==e.setup?c.position=c.data.position+(f-c.data.position)*s:c.position+=(f-c.position)*s}},a.ENTRIES=2,a.PREV_TIME=-2,a.PREV_VALUE=-1,a.VALUE=1,a}(a);t.PathConstraintPositionTimeline=w;var x=function(t){function n(e){return t.call(this,e)||this}return o(n,t),n.prototype.getPropertyId=function(){return(r.pathConstraintSpacing<<24)+this.pathConstraintIndex},n.prototype.apply=function(t,r,a,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(a=u[u.length-n.ENTRIES])f=u[u.length+n.PREV_VALUE];else{var p=i.binarySearch(u,a,n.ENTRIES);f=u[p+n.PREV_VALUE];var d=u[p],m=this.getCurvePercent(p/n.ENTRIES-1,1-(a-d)/(u[p+n.PREV_TIME]-d));f+=(u[p+n.VALUE]-f)*m}h==e.setup?c.spacing=c.data.spacing+(f-c.data.spacing)*s:c.spacing+=(f-c.spacing)*s}},n}(w);t.PathConstraintSpacingTimeline=x;var A=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.pathConstraintMix<<24)+this.pathConstraintIndex},a.prototype.setFrame=function(t,e,n,r){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.ROTATE]=n,this.frames[t+a.TRANSLATE]=r},a.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(r=u[u.length-a.ENTRIES])f=u[u.length+a.PREV_ROTATE],p=u[u.length+a.PREV_TRANSLATE];else{var d=i.binarySearch(u,r,a.ENTRIES);f=u[d+a.PREV_ROTATE],p=u[d+a.PREV_TRANSLATE];var m=u[d],v=this.getCurvePercent(d/a.ENTRIES-1,1-(r-m)/(u[d+a.PREV_TIME]-m));f+=(u[d+a.ROTATE]-f)*v,p+=(u[d+a.TRANSLATE]-p)*v}h==e.setup?(c.rotateMix=c.data.rotateMix+(f-c.data.rotateMix)*s,c.translateMix=c.data.translateMix+(p-c.data.translateMix)*s):(c.rotateMix+=(f-c.rotateMix)*s,c.translateMix+=(p-c.translateMix)*s)}},a.ENTRIES=3,a.PREV_TIME=-3,a.PREV_ROTATE=-2,a.PREV_TRANSLATE=-1,a.ROTATE=1,a.TRANSLATE=2,a}(a);t.PathConstraintMixTimeline=A}(i||(i={})),function(t){var e=function(){function e(e){this.tracks=new Array,this.events=new Array,this.listeners=new Array,this.queue=new i(this),this.propertyIDs=new t.IntSet,this.mixingTo=new Array,this.animationsChanged=!1,this.timeScale=1,this.trackEntryPool=new t.Pool((function(){return new n})),this.data=e}return e.prototype.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n0){if(i.delay-=a,i.delay>0)continue;a=-i.delay,i.delay=0}var o=i.next;if(null!=o){var s=i.trackLast-o.delay;if(s>=0){for(o.delay=0,o.trackTime=s+t*o.timeScale,i.trackTime+=a,this.setCurrent(n,o,!0);null!=o.mixingFrom;)o.mixTime+=a,o=o.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&null==i.mixingFrom){e[n]=null,this.queue.end(i),this.disposeNext(i);continue}if(null!=i.mixingFrom&&this.updateMixingFrom(i,t)){var h=i.mixingFrom;for(i.mixingFrom=null;null!=h;)this.queue.end(h),h=h.mixingFrom}i.trackTime+=a}}this.queue.drain()},e.prototype.updateMixingFrom=function(t,e){var n=t.mixingFrom;if(null==n)return!0;var r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&(t.mixTime>=t.mixDuration||0==t.timeScale)?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e*t.timeScale,!1)},e.prototype.apply=function(n){if(null==n)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var r=this.events,i=this.tracks,a=!1,o=0,s=i.length;o0)){a=!0;var l=0==o?t.MixPose.current:t.MixPose.currentLayered,u=h.alpha;null!=h.mixingFrom?u*=this.applyMixingFrom(h,n,l):h.trackTime>=h.trackEnd&&null==h.next&&(u=0);var c=h.animationLast,f=h.getAnimationTime(),p=h.animation.timelines.length,d=h.animation.timelines;if(1==u)for(var m=0;m=e.FIRST?t.MixPose.setup:l;E instanceof t.RotateTimeline?this.applyRotateTimeline(E,n,f,u,w,y,m<<1,g):(t.Utils.webkit602BugfixHelper(u,w),E.apply(n,c,f,r,u,w,t.MixDirection.in))}}this.queueEvents(h,f),r.length=0,h.nextAnimationLast=f,h.nextTrackLast=h.trackTime}}return this.queue.drain(),a},e.prototype.applyMixingFrom=function(n,r,i){var a=n.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,r,i);var o=0;0==n.mixDuration?(o=1,i=t.MixPose.setup):(o=n.mixTime/n.mixDuration)>1&&(o=1);var s=o0&&this.queueEvents(a,c),this.events.length=0,a.nextAnimationLast=c,a.nextTrackLast=a.trackTime,o},e.prototype.applyRotateTimeline=function(e,n,r,i,a,o,s,h){if(h&&(o[s]=0),1!=i){var l=e,u=l.frames,c=n.bones[l.boneIndex];if(r=u[u.length-t.RotateTimeline.ENTRIES])f=c.data.rotation+u[u.length+t.RotateTimeline.PREV_ROTATION];else{var p=t.Animation.binarySearch(u,r,t.RotateTimeline.ENTRIES),d=u[p+t.RotateTimeline.PREV_ROTATION],m=u[p],v=l.getCurvePercent((p>>1)-1,1-(r-m)/(u[p+t.RotateTimeline.PREV_TIME]-m));f=u[p+t.RotateTimeline.ROTATION]-d,f=d+(f-=360*(16384-(16384.499999999996-f/360|0)))*v+c.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}var g=a==t.MixPose.setup?c.data.rotation:c.rotation,y=0,E=f-g;if(0==E)y=o[s];else{E-=360*(16384-(16384.499999999996-E/360|0));var w=0,x=0;h?(w=0,x=E):(w=o[s],x=o[s+1]);var A=E>0,T=w>=0;t.MathUtils.signum(x)!=t.MathUtils.signum(E)&&Math.abs(x)<=90&&(Math.abs(w)>180&&(w+=360*t.MathUtils.signum(w)),T=A),y=E+w-w%360,T!=A&&(y+=360*t.MathUtils.signum(w)),o[s]=y}o[s+1]=E,g+=y*i,c.rotation=g-360*(16384-(16384.499999999996-g/360|0))}}else e.apply(n,0,r,null,1,a,t.MixDirection.in)},e.prototype.queueEvents=function(t,e){for(var n=t.animationStart,r=t.animationEnd,i=r-n,a=t.trackLast%i,o=this.events,s=0,h=o.length;sr||this.queue.event(t,l)}for((t.loop?0==i||a>t.trackTime%i:e>=r&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var n=e;;){var r=n.mixingFrom;if(null==r)break;this.queue.end(r),n.mixingFrom=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.prototype.setCurrent=function(t,e,n){var r=this.expandToIndex(t);this.tracks[t]=e,null!=r&&(n&&this.queue.interrupt(r),e.mixingFrom=r,e.mixTime=0,null!=r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)},e.prototype.setAnimation=function(t,e,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,n)},e.prototype.setAnimationWith=function(t,e,n){if(null==e)throw new Error("animation cannot be null.");var r=!0,i=this.expandToIndex(t);null!=i&&(-1==i.nextTrackLast?(this.tracks[t]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.disposeNext(i),i=i.mixingFrom,r=!1):this.disposeNext(i));var a=this.trackEntry(t,e,n,i);return this.setCurrent(t,a,r),this.queue.drain(),a},e.prototype.addAnimation=function(t,e,n,r){var i=this.data.skeletonData.findAnimation(e);if(null==i)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,i,n,r)},e.prototype.addAnimationWith=function(t,e,n,r){if(null==e)throw new Error("animation cannot be null.");var i=this.expandToIndex(t);if(null!=i)for(;null!=i.next;)i=i.next;var a=this.trackEntry(t,e,n,i);if(null==i)this.setCurrent(t,a,!0),this.queue.drain();else if(i.next=a,r<=0){var o=i.animationEnd-i.animationStart;0!=o?(i.loop?r+=o*(1+(i.trackTime/o|0)):r+=o,r-=this.data.getMix(i.animation,e)):r=0}return a.delay=r,a},e.prototype.setEmptyAnimation=function(t,n){var r=this.setAnimationWith(t,e.emptyAnimation,!1);return r.mixDuration=n,r.trackEnd=n,r},e.prototype.addEmptyAnimation=function(t,n,r){r<=0&&(r-=n);var i=this.addAnimationWith(t,e.emptyAnimation,!1,r);return i.mixDuration=n,i.trackEnd=n,i},e.prototype.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n=this.tracks.length?null:this.tracks[t]},e.prototype.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.prototype.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.prototype.clearListeners=function(){this.listeners.length=0},e.prototype.clearListenerNotifications=function(){this.queue.clear()},e.emptyAnimation=new t.Animation("",[],0),e.SUBSEQUENT=0,e.FIRST=1,e.DIP=2,e.DIP_MIX=3,e}();t.AnimationState=e;var n=function(){function n(){this.timelineData=new Array,this.timelineDipMix=new Array,this.timelinesRotation=new Array}return n.prototype.reset=function(){this.next=null,this.mixingFrom=null,this.animation=null,this.listener=null,this.timelineData.length=0,this.timelineDipMix.length=0,this.timelinesRotation.length=0},n.prototype.setTimelineData=function(n,r,i){null!=n&&r.push(n);var a=null!=this.mixingFrom?this.mixingFrom.setTimelineData(this,r,i):this;null!=n&&r.pop();var o=r,s=r.length-1,h=this.animation.timelines,l=this.animation.timelines.length,u=t.Utils.setArraySize(this.timelineData,l);this.timelineDipMix.length=0;var c=t.Utils.setArraySize(this.timelineDipMix,l);t:for(var f=0;f=0;d--){var m=o[d];if(!m.hasTimeline(p)&&m.mixDuration>0){u[f]=e.DIP_MIX,c[f]=m;continue t}}u[f]=e.DIP}else u[f]=e.FIRST;else u[f]=e.SUBSEQUENT}return a},n.prototype.hasTimeline=function(t){for(var e=this.animation.timelines,n=0,r=e.length;n=this.animationEnd-this.animationStart},n.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0},n}();t.TrackEntry=n;var r,i=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}return t.prototype.start=function(t){this.objects.push(r.start),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.interrupt=function(t){this.objects.push(r.interrupt),this.objects.push(t)},t.prototype.end=function(t){this.objects.push(r.end),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.dispose=function(t){this.objects.push(r.dispose),this.objects.push(t)},t.prototype.complete=function(t){this.objects.push(r.complete),this.objects.push(t)},t.prototype.event=function(t,e){this.objects.push(r.event),this.objects.push(t),this.objects.push(e)},t.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,n=0;n=0?n.substring(0,n.lastIndexOf("/")):"";n=this.pathPrefix+n,this.toLoad++,e.downloadText(n,(function(e){var s={count:0},h=new Array;try{new t.TextureAtlas(e,(function(e){h.push(o+"/"+e);var n=document.createElement("img");return n.width=16,n.height=16,new t.FakeTexture(n)}))}catch(t){var l=t;return a.errors[n]="Couldn't load texture atlas "+n+": "+l.message,i&&i(n,"Couldn't load texture atlas "+n+": "+l.message),a.toLoad--,void a.loaded++}for(var u=function(l){var u=!1;a.loadTexture(l,(function(l,c){if(s.count++,s.count==h.length)if(u)a.errors[n]="Couldn't load texture atlas page "+l+"} of atlas "+n,i&&i(n,"Couldn't load texture atlas page "+l+" of atlas "+n),a.toLoad--,a.loaded++;else try{var f=new t.TextureAtlas(e,(function(t){return a.get(o+"/"+t)}));a.assets[n]=f,r&&r(n,f),a.toLoad--,a.loaded++}catch(t){var p=t;a.errors[n]="Couldn't load texture atlas "+n+": "+p.message,i&&i(n,"Couldn't load texture atlas "+n+": "+p.message),a.toLoad--,a.loaded++}}),(function(t,e){u=!0,s.count++,s.count==h.length&&(a.errors[n]="Couldn't load texture atlas page "+t+"} of atlas "+n,i&&i(n,"Couldn't load texture atlas page "+t+" of atlas "+n),a.toLoad--,a.loaded++)}))},c=0,f=h;c0},e.prototype.getErrors=function(){return this.errors},e}();t.AssetManager=e}(i||(i={})),function(t){var e=function(){function e(t){this.atlas=t}return e.prototype.newRegionAttachment=function(e,n,r){var i=this.atlas.findRegion(r);if(null==i)throw new Error("Region not found in atlas: "+r+" (region attachment: "+n+")");i.renderObject=i;var a=new t.RegionAttachment(n);return a.setRegion(i),a},e.prototype.newMeshAttachment=function(e,n,r){var i=this.atlas.findRegion(r);if(null==i)throw new Error("Region not found in atlas: "+r+" (mesh attachment: "+n+")");i.renderObject=i;var a=new t.MeshAttachment(n);return a.region=i,a},e.prototype.newBoundingBoxAttachment=function(e,n){return new t.BoundingBoxAttachment(n)},e.prototype.newPathAttachment=function(e,n){return new t.PathAttachment(n)},e.prototype.newPointAttachment=function(e,n){return new t.PointAttachment(n)},e.prototype.newClippingAttachment=function(e,n){return new t.ClippingAttachment(n)},e}();t.AtlasAttachmentLoader=e}(i||(i={})),function(t){var e;(e=t.BlendMode||(t.BlendMode={}))[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen"}(i||(i={})),function(t){var e=function(){function e(t,e,n){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.worldX=0,this.c=0,this.d=0,this.worldY=0,this.sorted=!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=n,this.setToSetupPose()}return e.prototype.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransformWith=function(e,n,r,i,a,o,s){this.ax=e,this.ay=n,this.arotation=r,this.ascaleX=i,this.ascaleY=a,this.ashearX=o,this.ashearY=s,this.appliedValid=!0;var h=this.parent;if(null==h){var l=r+90+s,u=t.MathUtils.cosDeg(r+o)*i,c=t.MathUtils.cosDeg(l)*a,f=t.MathUtils.sinDeg(r+o)*i,p=t.MathUtils.sinDeg(l)*a,d=this.skeleton;return d.flipX&&(e=-e,u=-u,c=-c),d.flipY&&(n=-n,f=-f,p=-p),this.a=u,this.b=c,this.c=f,this.d=p,this.worldX=e+d.x,void(this.worldY=n+d.y)}var m=h.a,v=h.b,g=h.c,y=h.d;switch(this.worldX=m*e+v*n+h.worldX,this.worldY=g*e+y*n+h.worldY,this.data.transformMode){case t.TransformMode.Normal:l=r+90+s,u=t.MathUtils.cosDeg(r+o)*i,c=t.MathUtils.cosDeg(l)*a,f=t.MathUtils.sinDeg(r+o)*i,p=t.MathUtils.sinDeg(l)*a;return this.a=m*u+v*f,this.b=m*c+v*p,this.c=g*u+y*f,void(this.d=g*c+y*p);case t.TransformMode.OnlyTranslation:l=r+90+s;this.a=t.MathUtils.cosDeg(r+o)*i,this.b=t.MathUtils.cosDeg(l)*a,this.c=t.MathUtils.sinDeg(r+o)*i,this.d=t.MathUtils.sinDeg(l)*a;break;case t.TransformMode.NoRotationOrReflection:var E=0;(A=m*m+g*g)>1e-4?(v=g*(A=Math.abs(m*y-v*g)/A),y=m*A,E=Math.atan2(g,m)*t.MathUtils.radDeg):(m=0,g=0,E=90-Math.atan2(y,v)*t.MathUtils.radDeg);var w=r+o-E,x=r+s-E+90;u=t.MathUtils.cosDeg(w)*i,c=t.MathUtils.cosDeg(x)*a,f=t.MathUtils.sinDeg(w)*i,p=t.MathUtils.sinDeg(x)*a;this.a=m*u-v*f,this.b=m*c-v*p,this.c=g*u+y*f,this.d=g*c+y*p;break;case t.TransformMode.NoScale:case t.TransformMode.NoScaleOrReflection:var A,T=t.MathUtils.cosDeg(r),M=t.MathUtils.sinDeg(r),R=m*T+v*M,I=g*T+y*M;(A=Math.sqrt(R*R+I*I))>1e-5&&(A=1/A),R*=A,I*=A,A=Math.sqrt(R*R+I*I);var b=Math.PI/2+Math.atan2(I,R),S=Math.cos(b)*A,P=Math.sin(b)*A;u=t.MathUtils.cosDeg(o)*i,c=t.MathUtils.cosDeg(90+s)*a,f=t.MathUtils.sinDeg(o)*i,p=t.MathUtils.sinDeg(90+s)*a;return(this.data.transformMode!=t.TransformMode.NoScaleOrReflection?m*y-v*g<0:this.skeleton.flipX!=this.skeleton.flipY)&&(S=-S,P=-P),this.a=R*u+S*f,this.b=R*c+S*p,this.c=I*u+P*f,void(this.d=I*c+P*p)}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b),this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)},e.prototype.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.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*t.MathUtils.radDeg},e.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*t.MathUtils.radDeg},e.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var e=this.parent;if(null==e)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*t.MathUtils.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)*t.MathUtils.radDeg);var n=e.a,r=e.b,i=e.c,a=e.d,o=1/(n*a-r*i),s=this.worldX-e.worldX,h=this.worldY-e.worldY;this.ax=s*a*o-h*r*o,this.ay=h*n*o-s*i*o;var l=o*a,u=o*n,c=o*r,f=o*i,p=l*this.a-c*this.c,d=l*this.b-c*this.d,m=u*this.c-f*this.a,v=u*this.d-f*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(p*p+m*m),this.ascaleX>1e-4){var g=p*v-d*m;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(p*d+m*v,g)*t.MathUtils.radDeg,this.arotation=Math.atan2(m,p)*t.MathUtils.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+v*v),this.ashearY=0,this.arotation=90-Math.atan2(v,d)*t.MathUtils.radDeg},e.prototype.worldToLocal=function(t){var e=this.a,n=this.b,r=this.c,i=this.d,a=1/(e*i-n*r),o=t.x-this.worldX,s=t.y-this.worldY;return t.x=o*i*a-s*n*a,t.y=s*e*a-o*r*a,t},e.prototype.localToWorld=function(t){var e=t.x,n=t.y;return t.x=e*this.a+n*this.b+this.worldX,t.y=e*this.c+n*this.d+this.worldY,t},e.prototype.worldToLocalRotation=function(e){var n=t.MathUtils.sinDeg(e),r=t.MathUtils.cosDeg(e);return Math.atan2(this.a*n-this.c*r,this.d*r-this.b*n)*t.MathUtils.radDeg},e.prototype.localToWorldRotation=function(e){var n=t.MathUtils.sinDeg(e),r=t.MathUtils.cosDeg(e);return Math.atan2(r*this.c+n*this.d,r*this.a+n*this.b)*t.MathUtils.radDeg},e.prototype.rotateWorld=function(e){var n=this.a,r=this.b,i=this.c,a=this.d,o=t.MathUtils.cosDeg(e),s=t.MathUtils.sinDeg(e);this.a=o*n-s*i,this.b=o*r-s*a,this.c=s*n+o*i,this.d=s*r+o*a,this.appliedValid=!1},e}();t.Bone=e}(i||(i={})),function(t){var e,n=function(t,n,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=e.Normal,t<0)throw new Error("index must be >= 0.");if(null==n)throw new Error("name cannot be null.");this.index=t,this.name=n,this.parent=r};t.BoneData=n,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"}(e=t.TransformMode||(t.TransformMode={}))}(i||(i={})),function(t){var e=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e};t.Event=e}(i||(i={})),function(t){var e=function(t){this.name=t};t.EventData=e}(i||(i={})),function(t){var e=function(){function e(t,e){if(this.mix=1,this.bendDirection=0,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.bendDirection=t.bendDirection,this.bones=new Array;for(var n=0;n180?c-=360:c<-180&&(c+=360),e.updateWorldTransformWith(e.ax,e.ay,e.arotation+c*i,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)},e.prototype.apply2=function(e,n,r,i,a,o){if(0!=o){e.appliedValid||e.updateAppliedTransform(),n.appliedValid||n.updateAppliedTransform();var s=e.ax,h=e.ay,l=e.ascaleX,u=e.ascaleY,c=n.ascaleX,f=0,p=0,d=0;l<0?(l=-l,f=180,d=-1):(f=0,d=1),u<0&&(u=-u,d=-d),c<0?(c=-c,p=180):p=0;var m=n.ax,v=0,g=0,y=0,E=e.a,w=e.b,x=e.c,A=e.d,T=Math.abs(l-u)<=1e-4;T?(g=E*m+w*(v=n.ay)+e.worldX,y=x*m+A*v+e.worldY):(v=0,g=E*m+e.worldX,y=x*m+e.worldY);var M=e.parent;E=M.a,w=M.b,x=M.c;var R=1/(E*(A=M.d)-w*x),I=r-M.worldX,b=i-M.worldY,S=(I*A-b*w)*R-s,P=(b*E-I*x)*R-h,C=((I=g-M.worldX)*A-(b=y-M.worldY)*w)*R-s,N=(b*E-I*x)*R-h,_=Math.sqrt(C*C+N*N),k=n.data.length*c,L=0,O=0;t:if(T){var V=(S*S+P*P-_*_-(k*=l)*k)/(2*_*k);V<-1?V=-1:V>1&&(V=1),O=Math.acos(V)*a,E=_+k*V,w=k*Math.sin(O),L=Math.atan2(P*E-S*w,S*E+P*w)}else{var D=(E=l*k)*E,F=(w=u*k)*w,X=S*S+P*P,U=Math.atan2(P,S),Y=-2*F*_,B=F-D;if((A=Y*Y-4*B*(x=F*_*_+D*X-D*F))>=0){var j=Math.sqrt(A);Y<0&&(j=-j);var W=(j=-(Y+j)/2)/B,G=x/j,q=Math.abs(W)=-1&&x<=1&&(x=Math.acos(x),(A=(I=E*Math.cos(x)+_)*I+(b=w*Math.sin(x))*b)K&&(J=x,K=A,Q=I,tt=b)),X<=(Z+K)/2?(L=U-Math.atan2($*a,H),O=z*a):(L=U-Math.atan2(tt*a,Q),O=J*a)}var et=Math.atan2(v,m)*d,nt=e.arotation;(L=(L-et)*t.MathUtils.radDeg+f-nt)>180?L-=360:L<-180&&(L+=360),e.updateWorldTransformWith(s,h,nt+L*o,e.ascaleX,e.ascaleY,0,0),nt=n.arotation,(O=((O+et)*t.MathUtils.radDeg-n.ashearX)*d+p-nt)>180?O-=360:O<-180&&(O+=360),n.updateWorldTransformWith(m,v,nt+O*o,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY)}else n.updateWorldTransform()},e}();t.IkConstraint=e}(i||(i={})),function(t){var e=function(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.mix=1,this.name=t};t.IkConstraintData=e}(i||(i={})),function(t){var e=function(){function e(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,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 n=0,r=t.bones.length;n0;if(i>0||a){var o=this.data,s=o.spacingMode,h=s==t.SpacingMode.Length,l=o.rotateMode,u=l==t.RotateMode.Tangent,c=l==t.RotateMode.ChainScale,f=this.bones.length,p=u?f:f+1,d=this.bones,m=t.Utils.setArraySize(this.spaces,p),v=null,g=this.spacing;if(c||h){c&&(v=t.Utils.setArraySize(this.lengths,f));for(var y=0,E=p-1;y0?t.MathUtils.degRad:-t.MathUtils.degRad;y=0;for(var P=3;yt.MathUtils.PI?X-=t.MathUtils.PI2:X<-t.MathUtils.PI&&(X+=t.MathUtils.PI2),X*=r,U=Math.cos(X),Y=Math.sin(X),C.a=U*O-Y*D,C.b=U*V-Y*F,C.c=Y*O+U*D,C.d=Y*V+U*F}C.appliedValid=!1}}}},e.prototype.computeWorldPositions=function(n,r,i,a,o){var s=this.target,h=this.position,l=this.spaces,u=t.Utils.setArraySize(this.positions,3*r+2),c=null,f=n.closed,p=n.worldVerticesLength,d=p/6,m=e.NONE;if(!n.constantSpeed){var v=n.lengths,g=v[d-=f?1:2];if(a&&(h*=g),o)for(var y=0;yg){m!=e.AFTER&&(m=e.AFTER,n.computeWorldVertices(s,p-6,4,c,0,2)),this.addAfterPosition(x-g,c,0,u,E);continue}}for(;;w++){var A=v[w];if(!(x>A)){if(0==w)x/=A;else x=(x-(Z=v[w-1]))/(A-Z);break}}w!=m&&(m=w,f&&w==d?(n.computeWorldVertices(s,p-4,4,c,0,2),n.computeWorldVertices(s,0,4,c,4,2)):n.computeWorldVertices(s,6*w+2,8,c,0,2)),this.addCurvePosition(x,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],u,E,i||y>0&&0==G)}return u}f?(p+=2,c=t.Utils.setArraySize(this.world,p),n.computeWorldVertices(s,2,p-4,c,0,2),n.computeWorldVertices(s,0,2,c,p-4,2),c[p-2]=c[0],c[p-1]=c[1]):(d--,p-=4,c=t.Utils.setArraySize(this.world,p),n.computeWorldVertices(s,2,p,c,0,2));for(var T=t.Utils.setArraySize(this.curves,d),M=0,R=c[0],I=c[1],b=0,S=0,P=0,C=0,N=0,_=0,k=0,L=0,O=0,V=0,D=0,F=0,X=0,U=0,Y=(y=0,2);yM){this.addAfterPosition(x-M,c,p-4,u,E);continue}}for(;;w++){var q=T[w];if(!(x>q)){if(0==w)x/=q;else x=(x-(Z=T[w-1]))/(q-Z);break}}if(w!=m){m=w;var z=6*w;for(R=c[z],I=c[z+1],b=c[z+2],S=c[z+3],P=c[z+4],C=c[z+5],D=2*(k=.03*(R-2*b+P))+(O=.006*(3*(b-P)-R+(N=c[z+6]))),F=2*(L=.03*(I-2*S+C))+(V=.006*(3*(S-C)-I+(_=c[z+7]))),X=.3*(b-R)+k+.16666667*O,U=.3*(S-I)+L+.16666667*V,j=Math.sqrt(X*X+U*U),B[0]=j,z=1;z<8;z++)X+=D,U+=F,D+=O,F+=V,j+=Math.sqrt(X*X+U*U),B[z]=j;X+=D,U+=F,j+=Math.sqrt(X*X+U*U),B[8]=j,X+=D+O,U+=F+V,j+=Math.sqrt(X*X+U*U),B[9]=j,W=0}for(x*=j;;W++){var H=B[W];if(!(x>H)){var Z;if(0==W)x/=H;else x=W+(x-(Z=B[W-1]))/(H-Z);break}}this.addCurvePosition(.1*x,R,I,b,S,P,C,N,_,u,E,i||y>0&&0==G)}return u},e.prototype.addBeforePosition=function(t,e,n,r,i){var a=e[n],o=e[n+1],s=e[n+2]-a,h=e[n+3]-o,l=Math.atan2(h,s);r[i]=a+t*Math.cos(l),r[i+1]=o+t*Math.sin(l),r[i+2]=l},e.prototype.addAfterPosition=function(t,e,n,r,i){var a=e[n+2],o=e[n+3],s=a-e[n],h=o-e[n+1],l=Math.atan2(h,s);r[i]=a+t*Math.cos(l),r[i+1]=o+t*Math.sin(l),r[i+2]=l},e.prototype.addCurvePosition=function(t,e,n,r,i,a,o,s,h,l,u,c){(0==t||isNaN(t))&&(t=1e-4);var f=t*t,p=f*t,d=1-t,m=d*d,v=m*d,g=d*t,y=3*g,E=d*y,w=y*t,x=e*v+r*E+a*w+s*p,A=n*v+i*E+o*w+h*p;l[u]=x,l[u+1]=A,c&&(l[u+2]=Math.atan2(A-(n*m+i*g*2+o*f),x-(e*m+r*g*2+a*f)))},e.prototype.getOrder=function(){return this.data.order},e.NONE=-1,e.BEFORE=-2,e.AFTER=-3,e.epsilon=1e-5,e}();t.PathConstraint=e}(i||(i={})),function(t){var e,n,r,i=function(t){this.order=0,this.bones=new Array,this.name=t};t.PathConstraintData=i,(e=t.PositionMode||(t.PositionMode={}))[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",(n=t.SpacingMode||(t.SpacingMode={}))[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",(r=t.RotateMode||(t.RotateMode={}))[r.Tangent=0]="Tangent",r[r.Chain=1]="Chain",r[r.ChainScale=2]="ChainScale"}(i||(i={})),function(t){var e=function(){function t(t){this.toLoad=new Array,this.assets={},this.clientId=t}return t.prototype.loaded=function(){var t=0;for(var e in this.assets)t++;return t},t}(),n=function(){function t(t){void 0===t&&(t=""),this.clientAssets={},this.queuedAssets={},this.rawAssets={},this.errors={},this.pathPrefix=t}return t.prototype.queueAsset=function(t,n,r){var i=this.clientAssets[t];return null==i&&(i=new e(t),this.clientAssets[t]=i),null!==n&&(i.textureLoader=n),i.toLoad.push(r),this.queuedAssets[r]!==r&&(this.queuedAssets[r]=r,!0)},t.prototype.loadText=function(t,e){var n=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var r=new XMLHttpRequest;r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?n.rawAssets[e]=r.responseText:n.errors[e]="Couldn't load text "+e+": status "+r.status+", "+r.responseText)},r.open("GET",e,!0),r.send()}},t.prototype.loadJson=function(t,e){var n=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var r=new XMLHttpRequest;r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?n.rawAssets[e]=JSON.parse(r.responseText):n.errors[e]="Couldn't load text "+e+": status "+r.status+", "+r.responseText)},r.open("GET",e,!0),r.send()}},t.prototype.loadTexture=function(t,e,n){var r=this;if(n=this.pathPrefix+n,this.queueAsset(t,e,n)){var i=new Image;i.src=n,i.crossOrigin="anonymous",i.onload=function(t){r.rawAssets[n]=i},i.onerror=function(t){r.errors[n]="Couldn't load image "+n}}},t.prototype.get=function(t,e){e=this.pathPrefix+e;var n=this.clientAssets[t];return null==n||n.assets[e]},t.prototype.updateClientAssets=function(t){for(var e=0;e0},t.prototype.getErrors=function(){return this.errors},t}();t.SharedAssetManager=n}(i||(i={})),function(t){var e=function(){function e(e){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.flipX=!1,this.flipY=!1,this.x=0,this.y=0,null==e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(var n=0;n1){var i=n[n.length-1];this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}this._updateCache.push(t),this.sortReset(r.children),n[n.length-1].sorted=!0},e.prototype.sortPathConstraint=function(e){var n=e.target,r=n.data.index,i=n.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(var a=0,o=this.data.skins.length;a-1||this.updateCacheReset.push(i)}else for(r=0;r=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},e.prototype.aabbIntersectsSegment=function(t,e,n,r){var i=this.minX,a=this.minY,o=this.maxX,s=this.maxY;if(t<=i&&n<=i||e<=a&&r<=a||t>=o&&n>=o||e>=s&&r>=s)return!1;var h=(r-e)/(n-t),l=h*(i-t)+e;if(l>a&&la&&li&&ui&&ut.minX&&this.minYt.minY},e.prototype.containsPoint=function(t,e){for(var n=this.polygons,r=0,i=n.length;r=n||l=n){var u=r[s];u+(n-h)/(l-h)*(r[a]-u)=u&&E<=p||E>=p&&E<=u)&&(E>=e&&E<=r||E>=r&&E<=e)){var w=(l*g-h*m)/y;if((w>=c&&w<=d||w>=d&&w<=c)&&(w>=n&&w<=i||w>=i&&w<=n))return!0}u=p,c=d}return!1},e.prototype.getPolygon=function(t){if(null==t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},e.prototype.getWidth=function(){return this.maxX-this.minX},e.prototype.getHeight=function(){return this.maxY-this.minY},e}();t.SkeletonBounds=e}(i||(i={})),function(t){var e=function(){function e(){this.triangulator=new t.Triangulator,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}return e.prototype.clipStart=function(n,r){if(null!=this.clipAttachment)return 0;this.clipAttachment=r;var i=r.worldVerticesLength,a=t.Utils.setArraySize(this.clippingPolygon,i);r.computeWorldVertices(n,0,i,a,0,2);var o=this.clippingPolygon;e.makeClockwise(o);for(var s=this.clippingPolygons=this.triangulator.decompose(o,this.triangulator.triangulate(o)),h=0,l=s.length;h>1,X=this.clipOutput,U=t.Utils.setArraySize(u,N+F*d),Y=0;Y<_;Y+=2){var B=X[Y],j=X[Y+1];U[N]=B,U[N+1]=j,U[N+2]=o.r,U[N+3]=o.g,U[N+4]=o.b,U[N+5]=o.a;var W=B-I,G=j-b,q=(k*W+L*G)*D,z=(V*W+O*G)*D,H=1-q-z;U[N+6]=w*q+M*z+S*H,U[N+7]=x*q+R*z+P*H,h&&(U[N+8]=s.r,U[N+9]=s.g,U[N+10]=s.b,U[N+11]=s.a),N+=d}N=c.length;var Z=t.Utils.setArraySize(c,N+3*(F-2));F--;for(Y=1;Y=2?(u=s,s=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(n),u.push(r),u.push(i),u.push(a),u.push(t),u.push(e),s.length=0;for(var c=o,f=o.length-4,p=0;;p+=2){for(var d=c[p],m=c[p+1],v=c[p+2],g=c[p+3],y=d-v,E=m-g,w=u,x=u.length-2,A=s.length,T=0;T0;if(y*(R-g)-E*(M-v)>0){if(S){s.push(I),s.push(b);continue}var P=((N=I-M)*(m-R)-(C=b-R)*(d-M))/(C*(v-d)-N*(g-m));s.push(d+(v-d)*P),s.push(m+(g-m)*P)}else if(S){var C,N;P=((N=I-M)*(m-R)-(C=b-R)*(d-M))/(C*(v-d)-N*(g-m));s.push(d+(v-d)*P),s.push(m+(g-m)*P),s.push(I),s.push(b)}l=!0}if(A==s.length)return h.length=0,!0;if(s.push(s[0]),s.push(s[1]),p==f)break;var _=s;(s=u).length=0,u=_}if(h!=s){h.length=0;p=0;for(var k=s.length-2;p>1;s=0;f--)-1==W[f]&&(W[f]=q[--H])}w.setFrame(c++,j.time,W)}a.push(w),o=Math.max(o,w.frames[w.getFrameCount()-1])}if(e.events){for(w=new t.EventTimeline(e.events.length),c=0,f=0;f=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=n},t.prototype.getAttachment=function(t,e){var n=this.attachments[t];return n?n[e]:null},t.prototype.attachAll=function(t,e){for(var n=0,r=0;r= 0.");if(null==n)throw new Error("name cannot be null.");if(null==r)throw new Error("boneData cannot be null.");this.index=e,this.name=n,this.boneData=r};t.SlotData=e}(i||(i={})),function(t){var e,n,r=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 e.Nearest;case"linear":return e.Linear;case"mipmap":return e.MipMap;case"mipmapnearestnearest":return e.MipMapNearestNearest;case"mipmaplinearnearest":return e.MipMapLinearNearest;case"mipmapnearestlinear":return e.MipMapNearestLinear;case"mipmaplinearlinear":return e.MipMapLinearLinear;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return n.MirroredRepeat;case"clamptoedge":return n.ClampToEdge;case"repeat":return n.Repeat;default:throw new Error("Unknown texture wrap "+t)}},t}();t.Texture=r,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"}(e=t.TextureFilter||(t.TextureFilter={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(n=t.TextureWrap||(t.TextureWrap={}));var i=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};t.TextureRegion=i;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.setFilters=function(t,e){},e.prototype.setWraps=function(t,e){},e.prototype.dispose=function(){},e}(t.Texture);t.FakeTexture=a}(i||(i={})),function(t){var e=function(){function e(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}return e.prototype.load=function(e,a){if(null==a)throw new Error("textureLoader cannot be null.");for(var o=new n(e),s=new Array(4),h=null;;){var l=o.readLine();if(null==l)break;if(0==(l=l.trim()).length)h=null;else if(h){var u=new i;u.name=l,u.page=h,u.rotate="true"==o.readValue(),o.readTuple(s);var c=parseInt(s[0]),f=parseInt(s[1]);o.readTuple(s);var p=parseInt(s[0]),d=parseInt(s[1]);u.u=c/h.width,u.v=f/h.height,u.rotate?(u.u2=(c+d)/h.width,u.v2=(f+p)/h.height):(u.u2=(c+p)/h.width,u.v2=(f+d)/h.height),u.x=c,u.y=f,u.width=Math.abs(p),u.height=Math.abs(d),4==o.readTuple(s)&&4==o.readTuple(s)&&o.readTuple(s),u.originalWidth=parseInt(s[0]),u.originalHeight=parseInt(s[1]),o.readTuple(s),u.offsetX=parseInt(s[0]),u.offsetY=parseInt(s[1]),u.index=parseInt(o.readValue()),u.texture=h.texture,this.regions.push(u)}else{(h=new r).name=l,2==o.readTuple(s)&&(h.width=parseInt(s[0]),h.height=parseInt(s[1]),o.readTuple(s)),o.readTuple(s),h.minFilter=t.Texture.filterFromString(s[0]),h.magFilter=t.Texture.filterFromString(s[1]);var m=o.readValue();h.uWrap=t.TextureWrap.ClampToEdge,h.vWrap=t.TextureWrap.ClampToEdge,"x"==m?h.uWrap=t.TextureWrap.Repeat:"y"==m?h.vWrap=t.TextureWrap.Repeat:"xy"==m&&(h.uWrap=h.vWrap=t.TextureWrap.Repeat),h.texture=a(l),h.texture.setFilters(h.minFilter,h.magFilter),h.texture.setWraps(h.uWrap,h.vWrap),h.width=h.texture.getImage().width,h.height=h.texture.getImage().height,this.pages.push(h)}}},e.prototype.findRegion=function(t){for(var e=0;e=this.lines.length?null:this.lines[this.index++]},t.prototype.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},t.prototype.readTuple=function(t){var e=this.readLine(),n=e.indexOf(":");if(-1==n)throw new Error("Invalid line: "+e);for(var r=0,i=n+1;r<3;r++){var a=e.indexOf(",",i);if(-1==a)break;t[r]=e.substr(i,a-i).trim(),i=a+1}return t[r]=e.substring(i).trim(),r+1},t}(),r=function(){};t.TextureAtlasPage=r;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(t.TextureRegion);t.TextureAtlasRegion=i}(i||(i={})),function(t){var e=function(){function e(e,n){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new t.Vector2,null==e)throw new Error("data cannot be null.");if(null==n)throw new Error("skeleton cannot be null.");this.data=e,this.rotateMix=e.rotateMix,this.translateMix=e.translateMix,this.scaleMix=e.scaleMix,this.shearMix=e.shearMix,this.bones=new Array;for(var r=0;r0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones,d=0,m=p.length;dt.MathUtils.PI?b-=t.MathUtils.PI2:b<-t.MathUtils.PI&&(b+=t.MathUtils.PI2),b*=e;var A=Math.cos(b),T=Math.sin(b);v.a=A*y-T*w,v.b=A*E-T*x,v.c=T*y+A*w,v.d=T*E+A*x,g=!0}if(0!=n){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(M.x-v.worldX)*n,v.worldY+=(M.y-v.worldY)*n,g=!0}if(r>0){var R=Math.sqrt(v.a*v.a+v.c*v.c),I=Math.sqrt(o*o+h*h);R>1e-5&&(R=(R+(I-R+this.data.offsetScaleX)*r)/R),v.a*=R,v.c*=R,R=Math.sqrt(v.b*v.b+v.d*v.d),I=Math.sqrt(s*s+l*l),R>1e-5&&(R=(R+(I-R+this.data.offsetScaleY)*r)/R),v.b*=R,v.d*=R,g=!0}if(i>0){E=v.b,x=v.d;var b,S=Math.atan2(x,E);(b=Math.atan2(l,s)-Math.atan2(h,o)-(S-Math.atan2(v.c,v.a)))>t.MathUtils.PI?b-=t.MathUtils.PI2:b<-t.MathUtils.PI&&(b+=t.MathUtils.PI2),b=S+(b+f)*i;R=Math.sqrt(E*E+x*x);v.b=Math.cos(b)*R,v.d=Math.sin(b)*R,g=!0}g&&(v.appliedValid=!1)}},e.prototype.applyRelativeWorld=function(){for(var e=this.rotateMix,n=this.translateMix,r=this.scaleMix,i=this.shearMix,a=this.target,o=a.a,s=a.b,h=a.c,l=a.d,u=o*l-s*h>0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones,d=0,m=p.length;dt.MathUtils.PI?I-=t.MathUtils.PI2:I<-t.MathUtils.PI&&(I+=t.MathUtils.PI2),I*=e;var A=Math.cos(I),T=Math.sin(I);v.a=A*y-T*w,v.b=A*E-T*x,v.c=T*y+A*w,v.d=T*E+A*x,g=!0}if(0!=n){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),v.worldX+=M.x*n,v.worldY+=M.y*n,g=!0}if(r>0){var R=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleX)*r+1;v.a*=R,v.c*=R,R=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*r+1,v.b*=R,v.d*=R,g=!0}if(i>0){var I;(I=Math.atan2(l,s)-Math.atan2(h,o))>t.MathUtils.PI?I-=t.MathUtils.PI2:I<-t.MathUtils.PI&&(I+=t.MathUtils.PI2);E=v.b,x=v.d;I=Math.atan2(x,E)+(I-t.MathUtils.PI/2+f)*i;R=Math.sqrt(E*E+x*x);v.b=Math.cos(I)*R,v.d=Math.sin(I)*R,g=!0}g&&(v.appliedValid=!1)}},e.prototype.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,i=this.target;i.appliedValid||i.updateAppliedTransform();for(var a=this.bones,o=0,s=a.length;o0&&(p>1e-5&&(p=(p+(i.ascaleX-p+this.data.offsetScaleX)*n)/p),d>1e-5&&(d=(d+(i.ascaleY-d+this.data.offsetScaleY)*n)/d));var m=h.ashearY;if(r>0){u=i.ashearY-m+this.data.offsetShearY;u-=360*(16384-(16384.499999999996-u/360|0)),h.shearY+=u*r}h.updateWorldTransformWith(c,f,l,p,d,h.ashearX,m)}},e.prototype.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,i=this.target;i.appliedValid||i.updateAppliedTransform();for(var a=this.bones,o=0,s=a.length;o0&&(f>1e-5&&(f*=(i.ascaleX-1+this.data.offsetScaleX)*n+1),p>1e-5&&(p*=(i.ascaleY-1+this.data.offsetScaleY)*n+1));var d=h.ashearY;r>0&&(d+=(i.ashearY+this.data.offsetShearY)*r),h.updateWorldTransformWith(u,c,l,f,p,h.ashearX,d)}},e.prototype.getOrder=function(){return this.data.order},e}();t.TransformConstraint=e}(i||(i={})),function(t){var e=function(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,null==t)throw new Error("name cannot be null.");this.name=t};t.TransformConstraintData=e}(i||(i={})),function(t){var e=function(){function e(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new t.Pool((function(){return new Array})),this.polygonIndicesPool=new t.Pool((function(){return new Array}))}return e.prototype.triangulate=function(t){var n=t,r=t.length>>1,i=this.indicesArray;i.length=0;for(var a=0;a3;){for(var l=r-1,u=(a=0,1);;){t:if(!o[a]){for(var c=i[l]<<1,f=i[a]<<1,p=i[u]<<1,d=n[c],m=n[c+1],v=n[f],g=n[f+1],y=n[p],E=n[p+1],w=(u+1)%r;w!=l;w=(w+1)%r)if(o[w]){var x=i[w]<<1,A=n[x],T=n[x+1];if(e.positiveArea(y,E,d,m,A,T)&&e.positiveArea(d,m,v,g,A,T)&&e.positiveArea(v,g,y,E,A,T))break t}break}if(0==u){do{if(!o[a])break;a--}while(a>0);break}l=a,a=u,u=(u+1)%r}h.push(i[(r+a-1)%r]),h.push(i[a]),h.push(i[(a+1)%r]),i.splice(a,1),o.splice(a,1);var M=(--r+a-1)%r,R=a==r?0:a;o[M]=e.isConcave(M,r,n,i),o[R]=e.isConcave(R,r,n,i)}return 3==r&&(h.push(i[2]),h.push(i[0]),h.push(i[1])),h},e.prototype.decompose=function(t,n){var r=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;var a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;var o=this.polygonIndicesPool.obtain();o.length=0;var s=this.polygonPool.obtain();s.length=0;for(var h=-1,l=0,u=0,c=n.length;u0?(i.push(s),a.push(o)):(this.polygonPool.free(s),this.polygonIndicesPool.free(o)),(s=this.polygonPool.obtain()).length=0,s.push(m),s.push(v),s.push(g),s.push(y),s.push(E),s.push(w),(o=this.polygonIndicesPool.obtain()).length=0,o.push(f),o.push(p),o.push(d),l=e.winding(m,v,g,y,E,w),h=f)}s.length>0&&(i.push(s),a.push(o));for(u=0,c=i.length;u=0;u--)0==(s=i[u]).length&&(i.splice(u,1),this.polygonPool.free(s),o=a[u],a.splice(u,1),this.polygonIndicesPool.free(o));return i},e.isConcave=function(t,e,n,r){var i=r[(e+t-1)%e]<<1,a=r[t]<<1,o=r[(t+1)%e]<<1;return!this.positiveArea(n[i],n[i+1],n[a],n[a+1],n[o],n[o+1])},e.positiveArea=function(t,e,n,r,i,a){return t*(a-r)+n*(e-a)+i*(r-e)>=0},e.winding=function(t,e,n,r,i,a){var o=n-t,s=r-e;return i*s-a*o+o*e-t*s>=0?1:-1},e}();t.Triangulator=e}(i||(i={})),function(t){var e=function(){function t(){this.array=new Array}return t.prototype.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},t.prototype.contains=function(t){return null!=this.array[0|t]},t.prototype.remove=function(t){this.array[0|t]=void 0},t.prototype.clear=function(){this.array.length=0},t}();t.IntSet=e;var n=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=n,this.a=r}return t.prototype.set=function(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this.clamp(),this},t.prototype.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.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},t.prototype.add=function(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,this.a+=r,this.clamp(),this},t.prototype.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.WHITE=new t(1,1,1,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.MAGENTA=new t(1,0,1,1),t}();t.Color=n;var r=function(){function t(){}return t.clamp=function(t,e,n){return tn?n: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,n){return t.randomTriangularWith(e,n,.5*(e+n))},t.randomTriangularWith=function(t,e,n){var r=Math.random(),i=e-t;return r<=(n-t)/i?t+Math.sqrt(r*i*(n-t)):e-Math.sqrt((1-r)*i*(e-n))},t.PI=3.1415927,t.PI2=2*t.PI,t.radiansToDegrees=180/t.PI,t.radDeg=t.radiansToDegrees,t.degreesToRadians=t.PI/180,t.degRad=t.degreesToRadians,t}();t.MathUtils=r;var i=function(){function t(){}return t.prototype.apply=function(t,e,n){return t+(e-t)*this.applyInternal(n)},t}();t.Interpolation=i;var a=function(t){function e(e){var n=t.call(this)||this;return n.power=2,n.power=e,n}return o(e,t),e.prototype.applyInternal=function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1},e}(i);t.Pow=a;var s=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e}(a);t.PowOut=s;var h=function(){function t(){}return t.arrayCopy=function(t,e,n,r,i){for(var a=e,o=r;a=n?e:t.setArraySize(e,n,r)},t.newArray=function(t,e){for(var n=new Array(t),r=0;r0?this.items.pop():this.instantiator()},t.prototype.free=function(t){t.reset&&t.reset(),this.items.push(t)},t.prototype.freeAll=function(t){for(var e=0;ethis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)},t}();t.TimeKeeper=f;var p=function(){function t(t){void 0===t&&(t=32),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}return t.prototype.hasEnoughData=function(){return this.addedValues>=this.values.length},t.prototype.addValue=function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0},t.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*a;var o=t.bone.skeleton,s=t.attachmentVertices,h=this.vertices,l=this.bones;if(null!=l){for(var u=0,c=0,f=0;f0&&(h=s);for(var w,x=(w=t.bone).worldX,A=w.worldY,T=w.a,M=w.b,R=w.c,I=w.d,b=e,S=i;S)?=?)"),p("XRANGEIDENTIFIERLOOSE","".concat(h[l.NUMERICIDENTIFIERLOOSE],"|x|X|\\*")),p("XRANGEIDENTIFIER","".concat(h[l.NUMERICIDENTIFIER],"|x|X|\\*")),p("XRANGEPLAIN","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:".concat(h[l.PRERELEASE],")?").concat(h[l.BUILD],"?")+")?)?"),p("XRANGEPLAINLOOSE","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:".concat(h[l.PRERELEASELOOSE],")?").concat(h[l.BUILD],"?")+")?)?"),p("XRANGE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAIN],"$")),p("XRANGELOOSE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAINLOOSE],"$")),p("COERCE","".concat("(^|[^\\d])(\\d{1,").concat(n,"})")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:$|[^\\d])"),p("COERCERTL",h[l.COERCE],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM","(\\s*)".concat(h[l.LONETILDE],"\\s+"),!0),e.tildeTrimReplace="$1~",p("TILDE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAIN],"$")),p("TILDELOOSE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAINLOOSE],"$")),p("LONECARET","(?:\\^)"),p("CARETTRIM","(\\s*)".concat(h[l.LONECARET],"\\s+"),!0),e.caretTrimReplace="$1^",p("CARET","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAIN],"$")),p("CARETLOOSE","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAINLOOSE],"$")),p("COMPARATORLOOSE","^".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],")$|^$")),p("COMPARATOR","^".concat(h[l.GTLT],"\\s*(").concat(h[l.FULLPLAIN],")$|^$")),p("COMPARATORTRIM","(\\s*)".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],"|").concat(h[l.XRANGEPLAIN],")"),!0),e.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE","^\\s*(".concat(h[l.XRANGEPLAIN],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAIN],")")+"\\s*$"),p("HYPHENRANGELOOSE","^\\s*(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s*$"),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(k,k.exports);var L=k.exports;S(L);var O=Object.freeze({loose:!0}),V=Object.freeze({}),D=function(t){return t?"object"!==h(t)?O:t:V};S(D);var F=/^[0-9]+$/,X=function(t,e){var n=F.test(t),r=F.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:tB)throw new TypeError("version is longer than ".concat(B," characters"));Y("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;var r=e.trim().match(n.loose?W[G.LOOSE]:W[G.FULL]);if(!r)throw new TypeError("Invalid Version: ".concat(e));if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>j||this.major<0)throw new TypeError("Invalid major version");if(this.minor>j||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>j||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(e===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(r)}}if(e){var a=[e,r];!1===n&&(a=[e]),0===z(this.prerelease[0],e)?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break;default:throw new Error("invalid increment argument: ".concat(t))}return this.raw=this.format(),this.build.length&&(this.raw+="+".concat(this.build.join("."))),this}}]),t}(),Z=H;S(Z);var $=Z,J=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t instanceof $)return t;try{return new $(t,e)}catch(t){if(!n)return null;throw t}};S(J);var Q,K,tt=J,et=S((function(t,e){var n=tt(t,e);return n?n.version:null})),nt=Z,rt=J,it=L.safeRe,at=L.t,ot=S((function(t,e){if(t instanceof nt)return t;if("number"==typeof t&&(t=String(t)),"string"!=typeof t)return null;var n=null;if((e=e||{}).rtl){for(var r;(r=it[at.COERCERTL].exec(t))&&(!n||n.index+n[0].length!==t.length);)n&&r.index+r[0].length===n.index+n[0].length||(n=r),it[at.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;it[at.COERCERTL].lastIndex=-1}else n=t.match(it[at.COERCE]);return null===n?null:rt("".concat(n[2],".").concat(n[3]||"0",".").concat(n[4]||"0"),e)}));var st=ht;function ht(t){var e=this;if(e instanceof ht||(e=new ht),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var n=0,r=arguments.length;n1)n=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=t(n,r.value,i),r=r.next;return n},ht.prototype.reduceReverse=function(t,e){var n,r=this.tail;if(arguments.length>1)n=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=t(n,r.value,i),r=r.prev;return n},ht.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;null!==n;e++)t[e]=n.value,n=n.next;return t},ht.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;null!==n;e++)t[e]=n.value,n=n.prev;return t},ht.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var n=new ht;if(ethis.length&&(e=this.length);for(var r=0,i=this.head;null!==i&&rthis.length&&(e=this.length);for(var r=this.length,i=this.tail;null!==i&&r>e;r--)i=i.prev;for(;null!==i&&r>t;r--,i=i.prev)n.push(i.value);return n},ht.prototype.splice=function(t,e){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,r=this.head;null!==r&&nthis[dt])return Pt(this,this[At].get(t)),!1;var a=this[At].get(t).value;return this[Et]&&(this[wt]||this[Et](t,a.value)),a.now=r,a.maxAge=n,a.value=e,this[mt]+=i-a.length,a.length=i,this.get(t),St(this),!0}var o=new Ct(t,e,i,r,n);return o.length>this[dt]?(this[Et]&&this[Et](t,e),!1):(this[mt]+=o.length,this[xt].unshift(o),this[At].set(t,this[xt].head),St(this),!0)}},{key:"has",value:function(t){if(!this[At].has(t))return!1;var e=this[At].get(t).value;return!bt(this,e)}},{key:"get",value:function(t){return It(this,t,!0)}},{key:"peek",value:function(t){return It(this,t,!1)}},{key:"pop",value:function(){var t=this[xt].tail;return t?(Pt(this,t),t.value):null}},{key:"del",value:function(t){Pt(this,this[At].get(t))}},{key:"load",value:function(t){this.reset();for(var e=Date.now(),n=t.length-1;n>=0;n--){var r=t[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{var a=i-e;a>0&&this.set(r.k,r.v,a)}}}},{key:"prune",value:function(){var t=this;this[At].forEach((function(e,n){return It(t,n,!1)}))}}]),t}(),It=function(t,e,n){var r=t[At].get(e);if(r){var i=r.value;if(bt(t,i)){if(Pt(t,r),!t[gt])return}else n&&(t[Tt]&&(r.value.now=Date.now()),t[xt].unshiftNode(r));return i.value}},bt=function(t,e){if(!e||!e.maxAge&&!t[yt])return!1;var n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[yt]&&n>t[yt]},St=function(t){if(t[mt]>t[dt])for(var e=t[xt].tail;t[mt]>t[dt]&&null!==e;){var n=e.prev;Pt(t,e),e=n}},Pt=function(t,e){if(e){var n=e.value;t[Et]&&t[Et](n.key,n.value),t[mt]-=n.length,t[At].delete(n.key),t[xt].removeNode(e)}},Ct=c((function t(e,n,r,i,a){l(this,t),this.key=e,this.value=n,this.length=r,this.now=i,this.maxAge=a||0})),Nt=function(t,e,n,r){var i=n.value;bt(t,i)&&(Pt(t,n),t[gt]||(i=void 0)),i&&e.call(r,i.value,i.key,t)},_t=Rt;S(_t);var kt=Z,Lt=function(t,e,n){return new kt(t,n).compare(new kt(e,n))};S(Lt);var Ot=Lt,Vt=function(t,e,n){return 0===Ot(t,e,n)};S(Vt);var Dt=Lt,Ft=function(t,e,n){return 0!==Dt(t,e,n)};S(Ft);var Xt=Lt,Ut=function(t,e,n){return Xt(t,e,n)>0};S(Ut);var Yt=Lt,Bt=function(t,e,n){return Yt(t,e,n)>=0};S(Bt);var jt=Lt,Wt=function(t,e,n){return jt(t,e,n)<0};S(Wt);var Gt=Lt,qt=function(t,e,n){return Gt(t,e,n)<=0};S(qt);var zt,Ht,Zt,$t,Jt=Vt,Qt=Ft,Kt=Ut,te=Bt,ee=Wt,ne=qt,re=function(t,e,n,r){switch(e){case"===":return"object"===h(t)&&(t=t.version),"object"===h(n)&&(n=n.version),t===n;case"!==":return"object"===h(t)&&(t=t.version),"object"===h(n)&&(n=n.version),t!==n;case"":case"=":case"==":return Jt(t,n,r);case"!=":return Qt(t,n,r);case">":return Kt(t,n,r);case">=":return te(t,n,r);case"<":return ee(t,n,r);case"<=":return ne(t,n,r);default:throw new TypeError("Invalid operator: ".concat(e))}};function ie(){if($t)return Zt;$t=1;var t=function(){function t(e,i){var a=this;if(l(this,t),i=n(i),e instanceof t)return e.loose===!!i.loose&&e.includePrerelease===!!i.includePrerelease?e:new t(e.raw,i);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((function(t){return a.parseRange(t.trim())})).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: ".concat(this.raw));if(this.set.length>1){var o=this.set[0];if(this.set=this.set.filter((function(t){return!m(t[0])})),0===this.set.length)this.set=[o];else if(this.set.length>1){var s,h=T(this.set);try{for(h.s();!(s=h.n()).done;){var u=s.value;if(1===u.length&&v(u[0])){this.set=[u];break}}}catch(t){h.e(t)}finally{h.f()}}}this.format()}return c(t,[{key:"format",value:function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range}},{key:"toString",value:function(){return this.range}},{key:"parseRange",value:function(t){var n=this,a=((this.options.includePrerelease&&p)|(this.options.loose&&d))+":"+t,l=e.get(a);if(l)return l;var c=this.options.loose,v=c?o[s.HYPHENRANGELOOSE]:o[s.HYPHENRANGE];t=t.replace(v,N(this.options.includePrerelease)),i("hyphen replace",t),t=t.replace(o[s.COMPARATORTRIM],h),i("comparator trim",t),t=t.replace(o[s.TILDETRIM],u),i("tilde trim",t),t=t.replace(o[s.CARETTRIM],f),i("caret trim",t);var g=t.split(" ").map((function(t){return y(t,n.options)})).join(" ").split(/\s+/).map((function(t){return C(t,n.options)}));c&&(g=g.filter((function(t){return i("loose invalid filter",t,n.options),!!t.match(o[s.COMPARATORLOOSE])}))),i("range list",g);var E,x=new Map,A=g.map((function(t){return new r(t,n.options)})),M=T(A);try{for(M.s();!(E=M.n()).done;){var R=E.value;if(m(R))return[R];x.set(R.value,R)}}catch(t){M.e(t)}finally{M.f()}x.size>1&&x.has("")&&x.delete("");var I=w(x.values());return e.set(a,I),I}},{key:"intersects",value:function(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((function(t){return g(t,n)&&e.set.some((function(e){return g(e,n)&&t.every((function(t){return e.every((function(e){return t.intersects(e,n)}))}))}))}))}},{key:"test",value:function(t){if(!t)return!1;if("string"==typeof t)try{t=new a(t,this.options)}catch(t){return!1}for(var e=0;e")||!t.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!t.operator.startsWith("<"))&&(this.semver.version!==t.semver.version||!this.operator.includes("=")||!t.operator.includes("="))&&!(a(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<"))&&!(a(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}}],[{key:"ANY",get:function(){return t}}]),e}();zt=e;var n=D,r=L.safeRe,i=L.t,a=re,o=_,s=Z,h=ie();return zt}(),i=_,a=Z,o=L.safeRe,s=L.t,h=L.comparatorTrimReplace,u=L.tildeTrimReplace,f=L.caretTrimReplace,p=P.FLAG_INCLUDE_PRERELEASE,d=P.FLAG_LOOSE,m=function(t){return"<0.0.0-0"===t.value},v=function(t){return""===t.value},g=function(t,e){for(var n=!0,r=t.slice(),i=r.pop();n&&r.length;)n=r.every((function(t){return i.intersects(t,e)})),i=r.pop();return n},y=function(t,e){return i("comp",t,e),t=M(t,e),i("caret",t),t=x(t,e),i("tildes",t),t=I(t,e),i("xrange",t),t=S(t,e),i("stars",t),t},E=function(t){return!t||"x"===t.toLowerCase()||"*"===t},x=function(t,e){return t.trim().split(/\s+/).map((function(t){return A(t,e)})).join(" ")},A=function(t,e){var n=e.loose?o[s.TILDELOOSE]:o[s.TILDE];return t.replace(n,(function(e,n,r,a,o){var s;return i("tilde",t,e,n,r,a,o),E(n)?s="":E(r)?s=">=".concat(n,".0.0 <").concat(+n+1,".0.0-0"):E(a)?s=">=".concat(n,".").concat(r,".0 <").concat(n,".").concat(+r+1,".0-0"):o?(i("replaceTilde pr",o),s=">=".concat(n,".").concat(r,".").concat(a,"-").concat(o," <").concat(n,".").concat(+r+1,".0-0")):s=">=".concat(n,".").concat(r,".").concat(a," <").concat(n,".").concat(+r+1,".0-0"),i("tilde return",s),s}))},M=function(t,e){return t.trim().split(/\s+/).map((function(t){return R(t,e)})).join(" ")},R=function(t,e){i("caret",t,e);var n=e.loose?o[s.CARETLOOSE]:o[s.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(function(e,n,a,o,s){var h;return i("caret",t,e,n,a,o,s),E(n)?h="":E(a)?h=">=".concat(n,".0.0").concat(r," <").concat(+n+1,".0.0-0"):E(o)?h="0"===n?">=".concat(n,".").concat(a,".0").concat(r," <").concat(n,".").concat(+a+1,".0-0"):">=".concat(n,".").concat(a,".0").concat(r," <").concat(+n+1,".0.0-0"):s?(i("replaceCaret pr",s),h="0"===n?"0"===a?">=".concat(n,".").concat(a,".").concat(o,"-").concat(s," <").concat(n,".").concat(a,".").concat(+o+1,"-0"):">=".concat(n,".").concat(a,".").concat(o,"-").concat(s," <").concat(n,".").concat(+a+1,".0-0"):">=".concat(n,".").concat(a,".").concat(o,"-").concat(s," <").concat(+n+1,".0.0-0")):(i("no pr"),h="0"===n?"0"===a?">=".concat(n,".").concat(a,".").concat(o).concat(r," <").concat(n,".").concat(a,".").concat(+o+1,"-0"):">=".concat(n,".").concat(a,".").concat(o).concat(r," <").concat(n,".").concat(+a+1,".0-0"):">=".concat(n,".").concat(a,".").concat(o," <").concat(+n+1,".0.0-0")),i("caret return",h),h}))},I=function(t,e){return i("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return b(t,e)})).join(" ")},b=function(t,e){t=t.trim();var n=e.loose?o[s.XRANGELOOSE]:o[s.XRANGE];return t.replace(n,(function(n,r,a,o,s,h){i("xRange",t,n,r,a,o,s,h);var l=E(a),u=l||E(o),c=u||E(s),f=c;return"="===r&&f&&(r=""),h=e.includePrerelease?"-0":"",l?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&f?(u&&(o=0),s=0,">"===r?(r=">=",u?(a=+a+1,o=0,s=0):(o=+o+1,s=0)):"<="===r&&(r="<",u?a=+a+1:o=+o+1),"<"===r&&(h="-0"),n="".concat(r+a,".").concat(o,".").concat(s).concat(h)):u?n=">=".concat(a,".0.0").concat(h," <").concat(+a+1,".0.0-0"):c&&(n=">=".concat(a,".").concat(o,".0").concat(h," <").concat(a,".").concat(+o+1,".0-0")),i("xRange return",n),n}))},S=function(t,e){return i("replaceStars",t,e),t.trim().replace(o[s.STAR],"")},C=function(t,e){return i("replaceGTE0",t,e),t.trim().replace(o[e.includePrerelease?s.GTE0PRE:s.GTE0],"")},N=function(t){return function(e,n,r,i,a,o,s,h,l,u,c,f,p){return n=E(r)?"":E(i)?">=".concat(r,".0.0").concat(t?"-0":""):E(a)?">=".concat(r,".").concat(i,".0").concat(t?"-0":""):o?">=".concat(n):">=".concat(n).concat(t?"-0":""),h=E(l)?"":E(u)?"<".concat(+l+1,".0.0-0"):E(c)?"<".concat(l,".").concat(+u+1,".0-0"):f?"<=".concat(l,".").concat(u,".").concat(c,"-").concat(f):t?"<".concat(l,".").concat(u,".").concat(+c+1,"-0"):"<=".concat(h),"".concat(n," ").concat(h).trim()}},k=function(t,e,n){for(var a=0;a0){var s=t[o].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0};return Zt}S(re);var ae,oe,se=ie(),he=function(t,e,n){try{e=new se(e,n)}catch(t){return!1}return e.test(t)},le={valid:et,coerce:ot,satisfies:S(he),SEMVER_SPEC_VERSION:C.SEMVER_SPEC_VERSION},ue=0,ce=1,fe=2,pe=[0,1,2,2,3,0],de=function(){function t(e,n,r,o){var s;if(l(this,t),f(this,"autoUpdate",!0),f(this,"skeleton",void 0),f(this,"states",void 0),this._app=e,this._position=new a.Vec3,1===i.TextureAtlas.length){var h,u=T((s=new i.TextureAtlas(n)).pages);try{for(u.s();!(h=u.n()).done;){var c=h.value;c.setTexture(new b(o[c.name]))}}catch(t){u.e(t)}finally{u.f()}}else s=new i.TextureAtlas(n,(function(t){return new b(o[t])}));var p=new i.SkeletonJson(new i.AtlasAttachmentLoader(s));p.scale*=.01;var d=p.readSkeletonData(r);this.skeletonVersion=le.valid(le.coerce(d.version)),this._spine_3_6_0=le.satisfies(this.skeletonVersion,"<=3.6.0"),this._spine_3_7_99=le.satisfies(this.skeletonVersion,"<=3.7.99"),this._spine_4_1_X=le.satisfies(this.skeletonVersion,"~4.1.23"),this.skeleton=new i.Skeleton(d),this.skeleton.updateWorldTransform(),this.stateData=new i.AnimationStateData(this.skeleton.data),this.states=[new i.AnimationState(this.stateData)],this.clipper=new i.SkeletonClipping,this._node=new a.GraphNode,this._meshes=[],this._meshInstances=[],this._materials={},this._tint={},this._aabb=new a.BoundingBox,this._aabbTempArray=[],this._aabbTempOffset=new a.Vec2,this._aabbTempSize=new a.Vec2,this._renderCounts={vertexCount:0,indexCount:0},this._vertexFormat=null,this._vertexBuffer=null,this._indexBuffer=null,this._priority=0,this._timeScale=1,this._layers=[a.LAYERID_UI],this.init(),this._hidden=!1}return c(t,[{key:"destroy",value:function(){this.removeFromLayers();for(var t=0;t0&&this._renderCounts.vertexCount>0){this.skeleton.getBounds(this._aabbTempOffset,this._aabbTempSize,this._aabbTempArray),this._aabb.center=new a.Vec3(this._aabbTempOffset.x,this._aabbTempOffset.y,0),this._aabb.halfExtents=new a.Vec3(.5*this._aabbTempSize.x,.5*this._aabbTempSize.y,0),(!this._vertexBuffer||this._vertexBuffer.getNumVertices()0&&c.indices.length>0){t&&t!==c.material&&(this.SubmitBatch(e,n,t),t=c.material,e=o,n=0),t=c.material;var f=c.positions,p=c.vertexColor.r,d=c.vertexColor.g,m=c.vertexColor.b,v=c.vertexColor.a,g=c.uvs,y=void 0,E=f.length/2;for(y=0;y0){var r=new a.Mesh(this._app.graphicsDevice);r.vertexBuffer=this._vertexBuffer,r.indexBuffer[0]=this._indexBuffer,r.primitive[0].type=a.PRIMITIVE_TRIANGLES,r.primitive[0].base=t,r.primitive[0].count=e,r.primitive[0].indexed=!0,r.aabb=this._aabb,this._meshes.push(r);var i=new a.MeshInstance(r,this._materials[n],this._node);i.drawOrder=this.priority+this._meshInstances.length,i.visible=!this._hidden,this._meshInstances.push(i)}}},{key:"update",value:function(t){if(!this._hidden){var e;t*=this._timeScale;var n=this.states.length;for(e=0;e=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var h=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(h&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:_(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function M(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}!function(t){var e,n,r,i=function(){function t(t,e,n){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.duration=n}return t.prototype.apply=function(t,e,n,r,i,a,o,s){if(null==t)throw new Error("skeleton cannot be null.");r&&0!=this.duration&&(n%=this.duration,e>0&&(e%=this.duration));for(var h=this.timelines,l=0,u=h.length;l>>1;;){if(t[(a+1)*n]<=e?r=a+1:i=a,r==i)return(r+1)*n;a=r+i>>>1}},t.linearSearch=function(t,e,n){for(var r=0,i=t.length-n;r<=i;r+=n)if(t[r]>e)return r;return-1},t}();t.Animation=i,function(t){t[t.setup=0]="setup",t[t.current=1]="current",t[t.currentLayered=2]="currentLayered"}(e=t.MixPose||(t.MixPose={})),function(t){t[t.in=0]="in",t[t.out=1]="out"}(n=t.MixDirection||(t.MixDirection={})),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"}(r=t.TimelineType||(t.TimelineType={}));var a=function(){function e(n){if(n<=0)throw new Error("frameCount must be > 0: "+n);this.curves=t.Utils.newFloatArray((n-1)*e.BEZIER_SIZE)}return e.prototype.getFrameCount=function(){return this.curves.length/e.BEZIER_SIZE+1},e.prototype.setLinear=function(t){this.curves[t*e.BEZIER_SIZE]=e.LINEAR},e.prototype.setStepped=function(t){this.curves[t*e.BEZIER_SIZE]=e.STEPPED},e.prototype.getCurveType=function(t){var n=t*e.BEZIER_SIZE;if(n==this.curves.length)return e.LINEAR;var r=this.curves[n];return r==e.LINEAR?e.LINEAR:r==e.STEPPED?e.STEPPED:e.BEZIER},e.prototype.setCurve=function(t,n,r,i,a){var o=.03*(2*-n+i),s=.03*(2*-r+a),h=.006*(3*(n-i)+1),l=.006*(3*(r-a)+1),u=2*o+h,c=2*s+l,f=.3*n+o+.16666667*h,p=.3*r+s+.16666667*l,d=t*e.BEZIER_SIZE,m=this.curves;m[d++]=e.BEZIER;for(var v=f,g=p,y=d+e.BEZIER_SIZE-1;d=r){var u=void 0,c=void 0;return a==h?(u=0,c=0):(u=i[a-2],c=i[a-1]),c+(i[a+1]-c)*(r-u)/(s-u)}var f=i[a-1];return f+(1-f)*(r-s)/(1-s)},e.LINEAR=0,e.STEPPED=1,e.BEZIER=2,e.BEZIER_SIZE=19,e}();t.CurveTimeline=a;var s=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e<<1),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.rotate<<24)+this.boneIndex},a.prototype.setFrame=function(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+a.ROTATION]=n},a.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(r=u[u.length-a.ENTRIES])if(h==e.setup)c.rotation=c.data.rotation+u[u.length+a.PREV_ROTATION]*s;else{var p=c.data.rotation+u[u.length+a.PREV_ROTATION]-c.rotation;p-=360*(16384-(16384.499999999996-p/360|0)),c.rotation+=p*s}else{var d=i.binarySearch(u,r,a.ENTRIES),m=u[d+a.PREV_ROTATION],v=u[d],g=this.getCurvePercent((d>>1)-1,1-(r-v)/(u[d+a.PREV_TIME]-v)),y=u[d+a.ROTATION]-m;y=m+(y-=360*(16384-(16384.499999999996-y/360|0)))*g,h==e.setup?(y-=360*(16384-(16384.499999999996-y/360|0)),c.rotation=c.data.rotation+y*s):(y=c.data.rotation+y-c.rotation,y-=360*(16384-(16384.499999999996-y/360|0)),c.rotation+=y*s)}},a.ENTRIES=2,a.PREV_TIME=-2,a.PREV_ROTATION=-1,a.ROTATION=1,a}(a);t.RotateTimeline=s;var h=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.translate<<24)+this.boneIndex},a.prototype.setFrame=function(t,e,n,r){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.X]=n,this.frames[t+a.Y]=r},a.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(r=u[u.length-a.ENTRIES])f=u[u.length+a.PREV_X],p=u[u.length+a.PREV_Y];else{var d=i.binarySearch(u,r,a.ENTRIES);f=u[d+a.PREV_X],p=u[d+a.PREV_Y];var m=u[d],v=this.getCurvePercent(d/a.ENTRIES-1,1-(r-m)/(u[d+a.PREV_TIME]-m));f+=(u[d+a.X]-f)*v,p+=(u[d+a.Y]-p)*v}h==e.setup?(c.x=c.data.x+f*s,c.y=c.data.y+p*s):(c.x+=(c.data.x+f-c.x)*s,c.y+=(c.data.y+p-c.y)*s)}},a.ENTRIES=3,a.PREV_TIME=-3,a.PREV_X=-2,a.PREV_Y=-1,a.X=1,a.Y=2,a}(a);t.TranslateTimeline=h;var l=function(a){function s(t){return a.call(this,t)||this}return o(s,a),s.prototype.getPropertyId=function(){return(r.scale<<24)+this.boneIndex},s.prototype.apply=function(r,a,o,h,l,u,c){var f=this.frames,p=r.bones[this.boneIndex];if(o=f[f.length-s.ENTRIES])d=f[f.length+s.PREV_X]*p.data.scaleX,m=f[f.length+s.PREV_Y]*p.data.scaleY;else{var v=i.binarySearch(f,o,s.ENTRIES);d=f[v+s.PREV_X],m=f[v+s.PREV_Y];var g=f[v],y=this.getCurvePercent(v/s.ENTRIES-1,1-(o-g)/(f[v+s.PREV_TIME]-g));d=(d+(f[v+s.X]-d)*y)*p.data.scaleX,m=(m+(f[v+s.Y]-m)*y)*p.data.scaleY}if(1==l)p.scaleX=d,p.scaleY=m;else{var E=0,w=0;u==e.setup?(E=p.data.scaleX,w=p.data.scaleY):(E=p.scaleX,w=p.scaleY),c==n.out?(d=Math.abs(d)*t.MathUtils.signum(E),m=Math.abs(m)*t.MathUtils.signum(w)):(E=Math.abs(E)*t.MathUtils.signum(d),w=Math.abs(w)*t.MathUtils.signum(m)),p.scaleX=E+(d-E)*l,p.scaleY=w+(m-w)*l}}},s}(h);t.ScaleTimeline=l;var u=function(t){function n(e){return t.call(this,e)||this}return o(n,t),n.prototype.getPropertyId=function(){return(r.shear<<24)+this.boneIndex},n.prototype.apply=function(t,r,a,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(a=u[u.length-n.ENTRIES])f=u[u.length+n.PREV_X],p=u[u.length+n.PREV_Y];else{var d=i.binarySearch(u,a,n.ENTRIES);f=u[d+n.PREV_X],p=u[d+n.PREV_Y];var m=u[d],v=this.getCurvePercent(d/n.ENTRIES-1,1-(a-m)/(u[d+n.PREV_TIME]-m));f+=(u[d+n.X]-f)*v,p+=(u[d+n.Y]-p)*v}h==e.setup?(c.shearX=c.data.shearX+f*s,c.shearY=c.data.shearY+p*s):(c.shearX+=(c.data.shearX+f-c.shearX)*s,c.shearY+=(c.data.shearY+p-c.shearY)*s)}},n}(h);t.ShearTimeline=u;var c=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.color<<24)+this.slotIndex},a.prototype.setFrame=function(t,e,n,r,i,o){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.R]=n,this.frames[t+a.G]=r,this.frames[t+a.B]=i,this.frames[t+a.A]=o},a.prototype.apply=function(t,n,r,o,s,h,l){var u=t.slots[this.slotIndex],c=this.frames;if(r=c[c.length-a.ENTRIES]){var y=c.length;d=c[y+a.PREV_R],m=c[y+a.PREV_G],v=c[y+a.PREV_B],g=c[y+a.PREV_A]}else{var E=i.binarySearch(c,r,a.ENTRIES);d=c[E+a.PREV_R],m=c[E+a.PREV_G],v=c[E+a.PREV_B],g=c[E+a.PREV_A];var w=c[E],x=this.getCurvePercent(E/a.ENTRIES-1,1-(r-w)/(c[E+a.PREV_TIME]-w));d+=(c[E+a.R]-d)*x,m+=(c[E+a.G]-m)*x,v+=(c[E+a.B]-v)*x,g+=(c[E+a.A]-g)*x}if(1==s)u.color.set(d,m,v,g);else{f=u.color;h==e.setup&&f.setFromColor(u.data.color),f.add((d-f.r)*s,(m-f.g)*s,(v-f.b)*s,(g-f.a)*s)}}},a.ENTRIES=5,a.PREV_TIME=-5,a.PREV_R=-4,a.PREV_G=-3,a.PREV_B=-2,a.PREV_A=-1,a.R=1,a.G=2,a.B=3,a.A=4,a}(a);t.ColorTimeline=c;var f=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.twoColor<<24)+this.slotIndex},a.prototype.setFrame=function(t,e,n,r,i,o,s,h,l){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.R]=n,this.frames[t+a.G]=r,this.frames[t+a.B]=i,this.frames[t+a.A]=o,this.frames[t+a.R2]=s,this.frames[t+a.G2]=h,this.frames[t+a.B2]=l},a.prototype.apply=function(t,n,r,o,s,h,l){var u=t.slots[this.slotIndex],c=this.frames;if(r=c[c.length-a.ENTRIES]){var T=c.length;v=c[T+a.PREV_R],g=c[T+a.PREV_G],y=c[T+a.PREV_B],E=c[T+a.PREV_A],w=c[T+a.PREV_R2],x=c[T+a.PREV_G2],A=c[T+a.PREV_B2]}else{var M=i.binarySearch(c,r,a.ENTRIES);v=c[M+a.PREV_R],g=c[M+a.PREV_G],y=c[M+a.PREV_B],E=c[M+a.PREV_A],w=c[M+a.PREV_R2],x=c[M+a.PREV_G2],A=c[M+a.PREV_B2];var R=c[M],I=this.getCurvePercent(M/a.ENTRIES-1,1-(r-R)/(c[M+a.PREV_TIME]-R));v+=(c[M+a.R]-v)*I,g+=(c[M+a.G]-g)*I,y+=(c[M+a.B]-y)*I,E+=(c[M+a.A]-E)*I,w+=(c[M+a.R2]-w)*I,x+=(c[M+a.G2]-x)*I,A+=(c[M+a.B2]-A)*I}if(1==s)u.color.set(v,g,y,E),u.darkColor.set(w,x,A,1);else{f=u.color,p=u.darkColor;h==e.setup&&(f.setFromColor(u.data.color),p.setFromColor(u.data.darkColor)),f.add((v-f.r)*s,(g-f.g)*s,(y-f.b)*s,(E-f.a)*s),p.add((w-p.r)*s,(x-p.g)*s,(A-p.b)*s,0)}}},a.ENTRIES=8,a.PREV_TIME=-8,a.PREV_R=-7,a.PREV_G=-6,a.PREV_B=-5,a.PREV_A=-4,a.PREV_R2=-3,a.PREV_G2=-2,a.PREV_B2=-1,a.R=1,a.G=2,a.B=3,a.A=4,a.R2=5,a.G2=6,a.B2=7,a}(a);t.TwoColorTimeline=f;var p=function(){function a(e){this.frames=t.Utils.newFloatArray(e),this.attachmentNames=new Array(e)}return a.prototype.getPropertyId=function(){return(r.attachment<<24)+this.slotIndex},a.prototype.getFrameCount=function(){return this.frames.length},a.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n},a.prototype.apply=function(t,r,a,o,s,h,l){var u=t.slots[this.slotIndex];if(l!=n.out||h!=e.setup){var c=this.frames;if(a=c[c.length-1]?c.length-1:i.binarySearch(c,a,1)-1;var d=this.attachmentNames[p];t.slots[this.slotIndex].setAttachment(null==d?null:t.getAttachment(this.slotIndex,d))}}else{var m=u.data.attachmentName;u.setAttachment(null==m?null:t.getAttachment(this.slotIndex,m))}},a}();t.AttachmentTimeline=p;var d=null,m=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e),r.frameVertices=new Array(e),null==d&&(d=t.Utils.newFloatArray(64)),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.deform<<27)+ +this.attachment.id+this.slotIndex},a.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},a.prototype.apply=function(n,r,a,o,s,h,l){var u=n.slots[this.slotIndex],c=u.getAttachment();if(c instanceof t.VertexAttachment&&c.applyDeform(this.attachment)){var f=u.attachmentVertices;0==f.length&&(s=1);var p=this.frameVertices,d=p[0].length,m=this.frames;if(a=m[m.length-1]){var x=p[m.length-1];if(1==s)t.Utils.arrayCopy(x,0,w,0,d);else if(h==e.setup){if(null==(v=c).bones)for(var A=v.vertices,T=0;Tn)this.apply(t,e,Number.MAX_VALUE,r,a,o,s),e=-1;else if(e>=h[l-1])return;if(!(n0&&h[u-1]==c;)u--;for(;u=h[u];u++)r.push(this.events[u])}}},e}();t.EventTimeline=v;var g=function(){function a(e){this.frames=t.Utils.newFloatArray(e),this.drawOrders=new Array(e)}return a.prototype.getPropertyId=function(){return r.drawOrder<<24},a.prototype.getFrameCount=function(){return this.frames.length},a.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n},a.prototype.apply=function(r,a,o,s,h,l,u){var c=r.drawOrder,f=r.slots;if(u!=n.out||l!=e.setup){var p=this.frames;if(o=p[p.length-1]?p.length-1:i.binarySearch(p,o)-1;var m=this.drawOrders[d];if(null==m)t.Utils.arrayCopy(f,0,c,0,f.length);else for(var v=0,g=m.length;v=c[c.length-s.ENTRIES])l==e.setup?(f.mix=f.data.mix+(c[c.length+s.PREV_MIX]-f.data.mix)*h,f.bendDirection=u==n.out?f.data.bendDirection:c[c.length+s.PREV_BEND_DIRECTION]):(f.mix+=(c[c.length+s.PREV_MIX]-f.mix)*h,u==n.in&&(f.bendDirection=c[c.length+s.PREV_BEND_DIRECTION]));else{var p=i.binarySearch(c,a,s.ENTRIES),d=c[p+s.PREV_MIX],m=c[p],v=this.getCurvePercent(p/s.ENTRIES-1,1-(a-m)/(c[p+s.PREV_TIME]-m));l==e.setup?(f.mix=f.data.mix+(d+(c[p+s.MIX]-d)*v-f.data.mix)*h,f.bendDirection=u==n.out?f.data.bendDirection:c[p+s.PREV_BEND_DIRECTION]):(f.mix+=(d+(c[p+s.MIX]-d)*v-f.mix)*h,u==n.in&&(f.bendDirection=c[p+s.PREV_BEND_DIRECTION]))}},s.ENTRIES=3,s.PREV_TIME=-3,s.PREV_MIX=-2,s.PREV_BEND_DIRECTION=-1,s.MIX=1,s.BEND_DIRECTION=2,s}(a);t.IkConstraintTimeline=y;var E=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.transformConstraint<<24)+this.transformConstraintIndex},a.prototype.setFrame=function(t,e,n,r,i,o){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.ROTATE]=n,this.frames[t+a.TRANSLATE]=r,this.frames[t+a.SCALE]=i,this.frames[t+a.SHEAR]=o},a.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.transformConstraints[this.transformConstraintIndex];if(r=u[u.length-a.ENTRIES]){var g=u.length;p=u[g+a.PREV_ROTATE],d=u[g+a.PREV_TRANSLATE],m=u[g+a.PREV_SCALE],v=u[g+a.PREV_SHEAR]}else{var y=i.binarySearch(u,r,a.ENTRIES);p=u[y+a.PREV_ROTATE],d=u[y+a.PREV_TRANSLATE],m=u[y+a.PREV_SCALE],v=u[y+a.PREV_SHEAR];var E=u[y],w=this.getCurvePercent(y/a.ENTRIES-1,1-(r-E)/(u[y+a.PREV_TIME]-E));p+=(u[y+a.ROTATE]-p)*w,d+=(u[y+a.TRANSLATE]-d)*w,m+=(u[y+a.SCALE]-m)*w,v+=(u[y+a.SHEAR]-v)*w}if(h==e.setup){f=c.data;c.rotateMix=f.rotateMix+(p-f.rotateMix)*s,c.translateMix=f.translateMix+(d-f.translateMix)*s,c.scaleMix=f.scaleMix+(m-f.scaleMix)*s,c.shearMix=f.shearMix+(v-f.shearMix)*s}else c.rotateMix+=(p-c.rotateMix)*s,c.translateMix+=(d-c.translateMix)*s,c.scaleMix+=(m-c.scaleMix)*s,c.shearMix+=(v-c.shearMix)*s}},a.ENTRIES=5,a.PREV_TIME=-5,a.PREV_ROTATE=-4,a.PREV_TRANSLATE=-3,a.PREV_SCALE=-2,a.PREV_SHEAR=-1,a.ROTATE=1,a.TRANSLATE=2,a.SCALE=3,a.SHEAR=4,a}(a);t.TransformConstraintTimeline=E;var w=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.pathConstraintPosition<<24)+this.pathConstraintIndex},a.prototype.setFrame=function(t,e,n){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.VALUE]=n},a.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(r=u[u.length-a.ENTRIES])f=u[u.length+a.PREV_VALUE];else{var p=i.binarySearch(u,r,a.ENTRIES);f=u[p+a.PREV_VALUE];var d=u[p],m=this.getCurvePercent(p/a.ENTRIES-1,1-(r-d)/(u[p+a.PREV_TIME]-d));f+=(u[p+a.VALUE]-f)*m}h==e.setup?c.position=c.data.position+(f-c.data.position)*s:c.position+=(f-c.position)*s}},a.ENTRIES=2,a.PREV_TIME=-2,a.PREV_VALUE=-1,a.VALUE=1,a}(a);t.PathConstraintPositionTimeline=w;var x=function(t){function n(e){return t.call(this,e)||this}return o(n,t),n.prototype.getPropertyId=function(){return(r.pathConstraintSpacing<<24)+this.pathConstraintIndex},n.prototype.apply=function(t,r,a,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(a=u[u.length-n.ENTRIES])f=u[u.length+n.PREV_VALUE];else{var p=i.binarySearch(u,a,n.ENTRIES);f=u[p+n.PREV_VALUE];var d=u[p],m=this.getCurvePercent(p/n.ENTRIES-1,1-(a-d)/(u[p+n.PREV_TIME]-d));f+=(u[p+n.VALUE]-f)*m}h==e.setup?c.spacing=c.data.spacing+(f-c.data.spacing)*s:c.spacing+=(f-c.spacing)*s}},n}(w);t.PathConstraintSpacingTimeline=x;var A=function(n){function a(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*a.ENTRIES),r}return o(a,n),a.prototype.getPropertyId=function(){return(r.pathConstraintMix<<24)+this.pathConstraintIndex},a.prototype.setFrame=function(t,e,n,r){t*=a.ENTRIES,this.frames[t]=e,this.frames[t+a.ROTATE]=n,this.frames[t+a.TRANSLATE]=r},a.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(r=u[u.length-a.ENTRIES])f=u[u.length+a.PREV_ROTATE],p=u[u.length+a.PREV_TRANSLATE];else{var d=i.binarySearch(u,r,a.ENTRIES);f=u[d+a.PREV_ROTATE],p=u[d+a.PREV_TRANSLATE];var m=u[d],v=this.getCurvePercent(d/a.ENTRIES-1,1-(r-m)/(u[d+a.PREV_TIME]-m));f+=(u[d+a.ROTATE]-f)*v,p+=(u[d+a.TRANSLATE]-p)*v}h==e.setup?(c.rotateMix=c.data.rotateMix+(f-c.data.rotateMix)*s,c.translateMix=c.data.translateMix+(p-c.data.translateMix)*s):(c.rotateMix+=(f-c.rotateMix)*s,c.translateMix+=(p-c.translateMix)*s)}},a.ENTRIES=3,a.PREV_TIME=-3,a.PREV_ROTATE=-2,a.PREV_TRANSLATE=-1,a.ROTATE=1,a.TRANSLATE=2,a}(a);t.PathConstraintMixTimeline=A}(i||(i={})),function(t){var e=function(){function e(e){this.tracks=new Array,this.events=new Array,this.listeners=new Array,this.queue=new i(this),this.propertyIDs=new t.IntSet,this.mixingTo=new Array,this.animationsChanged=!1,this.timeScale=1,this.trackEntryPool=new t.Pool((function(){return new n})),this.data=e}return e.prototype.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n0){if(i.delay-=a,i.delay>0)continue;a=-i.delay,i.delay=0}var o=i.next;if(null!=o){var s=i.trackLast-o.delay;if(s>=0){for(o.delay=0,o.trackTime=s+t*o.timeScale,i.trackTime+=a,this.setCurrent(n,o,!0);null!=o.mixingFrom;)o.mixTime+=a,o=o.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&null==i.mixingFrom){e[n]=null,this.queue.end(i),this.disposeNext(i);continue}if(null!=i.mixingFrom&&this.updateMixingFrom(i,t)){var h=i.mixingFrom;for(i.mixingFrom=null;null!=h;)this.queue.end(h),h=h.mixingFrom}i.trackTime+=a}}this.queue.drain()},e.prototype.updateMixingFrom=function(t,e){var n=t.mixingFrom;if(null==n)return!0;var r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&(t.mixTime>=t.mixDuration||0==t.timeScale)?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e*t.timeScale,!1)},e.prototype.apply=function(n){if(null==n)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var r=this.events,i=this.tracks,a=!1,o=0,s=i.length;o0)){a=!0;var l=0==o?t.MixPose.current:t.MixPose.currentLayered,u=h.alpha;null!=h.mixingFrom?u*=this.applyMixingFrom(h,n,l):h.trackTime>=h.trackEnd&&null==h.next&&(u=0);var c=h.animationLast,f=h.getAnimationTime(),p=h.animation.timelines.length,d=h.animation.timelines;if(1==u)for(var m=0;m=e.FIRST?t.MixPose.setup:l;E instanceof t.RotateTimeline?this.applyRotateTimeline(E,n,f,u,w,y,m<<1,g):(t.Utils.webkit602BugfixHelper(u,w),E.apply(n,c,f,r,u,w,t.MixDirection.in))}}this.queueEvents(h,f),r.length=0,h.nextAnimationLast=f,h.nextTrackLast=h.trackTime}}return this.queue.drain(),a},e.prototype.applyMixingFrom=function(n,r,i){var a=n.mixingFrom;null!=a.mixingFrom&&this.applyMixingFrom(a,r,i);var o=0;0==n.mixDuration?(o=1,i=t.MixPose.setup):(o=n.mixTime/n.mixDuration)>1&&(o=1);var s=o0&&this.queueEvents(a,c),this.events.length=0,a.nextAnimationLast=c,a.nextTrackLast=a.trackTime,o},e.prototype.applyRotateTimeline=function(e,n,r,i,a,o,s,h){if(h&&(o[s]=0),1!=i){var l=e,u=l.frames,c=n.bones[l.boneIndex];if(r=u[u.length-t.RotateTimeline.ENTRIES])f=c.data.rotation+u[u.length+t.RotateTimeline.PREV_ROTATION];else{var p=t.Animation.binarySearch(u,r,t.RotateTimeline.ENTRIES),d=u[p+t.RotateTimeline.PREV_ROTATION],m=u[p],v=l.getCurvePercent((p>>1)-1,1-(r-m)/(u[p+t.RotateTimeline.PREV_TIME]-m));f=u[p+t.RotateTimeline.ROTATION]-d,f=d+(f-=360*(16384-(16384.499999999996-f/360|0)))*v+c.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}var g=a==t.MixPose.setup?c.data.rotation:c.rotation,y=0,E=f-g;if(0==E)y=o[s];else{E-=360*(16384-(16384.499999999996-E/360|0));var w=0,x=0;h?(w=0,x=E):(w=o[s],x=o[s+1]);var A=E>0,T=w>=0;t.MathUtils.signum(x)!=t.MathUtils.signum(E)&&Math.abs(x)<=90&&(Math.abs(w)>180&&(w+=360*t.MathUtils.signum(w)),T=A),y=E+w-w%360,T!=A&&(y+=360*t.MathUtils.signum(w)),o[s]=y}o[s+1]=E,g+=y*i,c.rotation=g-360*(16384-(16384.499999999996-g/360|0))}}else e.apply(n,0,r,null,1,a,t.MixDirection.in)},e.prototype.queueEvents=function(t,e){for(var n=t.animationStart,r=t.animationEnd,i=r-n,a=t.trackLast%i,o=this.events,s=0,h=o.length;sr||this.queue.event(t,l)}for((t.loop?0==i||a>t.trackTime%i:e>=r&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var n=e;;){var r=n.mixingFrom;if(null==r)break;this.queue.end(r),n.mixingFrom=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.prototype.setCurrent=function(t,e,n){var r=this.expandToIndex(t);this.tracks[t]=e,null!=r&&(n&&this.queue.interrupt(r),e.mixingFrom=r,e.mixTime=0,null!=r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)},e.prototype.setAnimation=function(t,e,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,n)},e.prototype.setAnimationWith=function(t,e,n){if(null==e)throw new Error("animation cannot be null.");var r=!0,i=this.expandToIndex(t);null!=i&&(-1==i.nextTrackLast?(this.tracks[t]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.disposeNext(i),i=i.mixingFrom,r=!1):this.disposeNext(i));var a=this.trackEntry(t,e,n,i);return this.setCurrent(t,a,r),this.queue.drain(),a},e.prototype.addAnimation=function(t,e,n,r){var i=this.data.skeletonData.findAnimation(e);if(null==i)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,i,n,r)},e.prototype.addAnimationWith=function(t,e,n,r){if(null==e)throw new Error("animation cannot be null.");var i=this.expandToIndex(t);if(null!=i)for(;null!=i.next;)i=i.next;var a=this.trackEntry(t,e,n,i);if(null==i)this.setCurrent(t,a,!0),this.queue.drain();else if(i.next=a,r<=0){var o=i.animationEnd-i.animationStart;0!=o?(i.loop?r+=o*(1+(i.trackTime/o|0)):r+=o,r-=this.data.getMix(i.animation,e)):r=0}return a.delay=r,a},e.prototype.setEmptyAnimation=function(t,n){var r=this.setAnimationWith(t,e.emptyAnimation,!1);return r.mixDuration=n,r.trackEnd=n,r},e.prototype.addEmptyAnimation=function(t,n,r){r<=0&&(r-=n);var i=this.addAnimationWith(t,e.emptyAnimation,!1,r);return i.mixDuration=n,i.trackEnd=n,i},e.prototype.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n=this.tracks.length?null:this.tracks[t]},e.prototype.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.prototype.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.prototype.clearListeners=function(){this.listeners.length=0},e.prototype.clearListenerNotifications=function(){this.queue.clear()},e.emptyAnimation=new t.Animation("",[],0),e.SUBSEQUENT=0,e.FIRST=1,e.DIP=2,e.DIP_MIX=3,e}();t.AnimationState=e;var n=function(){function n(){this.timelineData=new Array,this.timelineDipMix=new Array,this.timelinesRotation=new Array}return n.prototype.reset=function(){this.next=null,this.mixingFrom=null,this.animation=null,this.listener=null,this.timelineData.length=0,this.timelineDipMix.length=0,this.timelinesRotation.length=0},n.prototype.setTimelineData=function(n,r,i){null!=n&&r.push(n);var a=null!=this.mixingFrom?this.mixingFrom.setTimelineData(this,r,i):this;null!=n&&r.pop();var o=r,s=r.length-1,h=this.animation.timelines,l=this.animation.timelines.length,u=t.Utils.setArraySize(this.timelineData,l);this.timelineDipMix.length=0;var c=t.Utils.setArraySize(this.timelineDipMix,l);t:for(var f=0;f=0;d--){var m=o[d];if(!m.hasTimeline(p)&&m.mixDuration>0){u[f]=e.DIP_MIX,c[f]=m;continue t}}u[f]=e.DIP}else u[f]=e.FIRST;else u[f]=e.SUBSEQUENT}return a},n.prototype.hasTimeline=function(t){for(var e=this.animation.timelines,n=0,r=e.length;n=this.animationEnd-this.animationStart},n.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0},n}();t.TrackEntry=n;var r,i=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}return t.prototype.start=function(t){this.objects.push(r.start),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.interrupt=function(t){this.objects.push(r.interrupt),this.objects.push(t)},t.prototype.end=function(t){this.objects.push(r.end),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.dispose=function(t){this.objects.push(r.dispose),this.objects.push(t)},t.prototype.complete=function(t){this.objects.push(r.complete),this.objects.push(t)},t.prototype.event=function(t,e){this.objects.push(r.event),this.objects.push(t),this.objects.push(e)},t.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,n=0;n=0?n.substring(0,n.lastIndexOf("/")):"";n=this.pathPrefix+n,this.toLoad++,e.downloadText(n,(function(e){var s={count:0},h=new Array;try{new t.TextureAtlas(e,(function(e){h.push(o+"/"+e);var n=document.createElement("img");return n.width=16,n.height=16,new t.FakeTexture(n)}))}catch(t){var l=t;return a.errors[n]="Couldn't load texture atlas "+n+": "+l.message,i&&i(n,"Couldn't load texture atlas "+n+": "+l.message),a.toLoad--,void a.loaded++}for(var u=function(l){var u=!1;a.loadTexture(l,(function(l,c){if(s.count++,s.count==h.length)if(u)a.errors[n]="Couldn't load texture atlas page "+l+"} of atlas "+n,i&&i(n,"Couldn't load texture atlas page "+l+" of atlas "+n),a.toLoad--,a.loaded++;else try{var f=new t.TextureAtlas(e,(function(t){return a.get(o+"/"+t)}));a.assets[n]=f,r&&r(n,f),a.toLoad--,a.loaded++}catch(t){var p=t;a.errors[n]="Couldn't load texture atlas "+n+": "+p.message,i&&i(n,"Couldn't load texture atlas "+n+": "+p.message),a.toLoad--,a.loaded++}}),(function(t,e){u=!0,s.count++,s.count==h.length&&(a.errors[n]="Couldn't load texture atlas page "+t+"} of atlas "+n,i&&i(n,"Couldn't load texture atlas page "+t+" of atlas "+n),a.toLoad--,a.loaded++)}))},c=0,f=h;c0},e.prototype.getErrors=function(){return this.errors},e}();t.AssetManager=e}(i||(i={})),function(t){var e=function(){function e(t){this.atlas=t}return e.prototype.newRegionAttachment=function(e,n,r){var i=this.atlas.findRegion(r);if(null==i)throw new Error("Region not found in atlas: "+r+" (region attachment: "+n+")");i.renderObject=i;var a=new t.RegionAttachment(n);return a.setRegion(i),a},e.prototype.newMeshAttachment=function(e,n,r){var i=this.atlas.findRegion(r);if(null==i)throw new Error("Region not found in atlas: "+r+" (mesh attachment: "+n+")");i.renderObject=i;var a=new t.MeshAttachment(n);return a.region=i,a},e.prototype.newBoundingBoxAttachment=function(e,n){return new t.BoundingBoxAttachment(n)},e.prototype.newPathAttachment=function(e,n){return new t.PathAttachment(n)},e.prototype.newPointAttachment=function(e,n){return new t.PointAttachment(n)},e.prototype.newClippingAttachment=function(e,n){return new t.ClippingAttachment(n)},e}();t.AtlasAttachmentLoader=e}(i||(i={})),function(t){var e;(e=t.BlendMode||(t.BlendMode={}))[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen"}(i||(i={})),function(t){var e=function(){function e(t,e,n){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.worldX=0,this.c=0,this.d=0,this.worldY=0,this.sorted=!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=n,this.setToSetupPose()}return e.prototype.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransformWith=function(e,n,r,i,a,o,s){this.ax=e,this.ay=n,this.arotation=r,this.ascaleX=i,this.ascaleY=a,this.ashearX=o,this.ashearY=s,this.appliedValid=!0;var h=this.parent;if(null==h){var l=r+90+s,u=t.MathUtils.cosDeg(r+o)*i,c=t.MathUtils.cosDeg(l)*a,f=t.MathUtils.sinDeg(r+o)*i,p=t.MathUtils.sinDeg(l)*a,d=this.skeleton;return d.flipX&&(e=-e,u=-u,c=-c),d.flipY&&(n=-n,f=-f,p=-p),this.a=u,this.b=c,this.c=f,this.d=p,this.worldX=e+d.x,void(this.worldY=n+d.y)}var m=h.a,v=h.b,g=h.c,y=h.d;switch(this.worldX=m*e+v*n+h.worldX,this.worldY=g*e+y*n+h.worldY,this.data.transformMode){case t.TransformMode.Normal:l=r+90+s,u=t.MathUtils.cosDeg(r+o)*i,c=t.MathUtils.cosDeg(l)*a,f=t.MathUtils.sinDeg(r+o)*i,p=t.MathUtils.sinDeg(l)*a;return this.a=m*u+v*f,this.b=m*c+v*p,this.c=g*u+y*f,void(this.d=g*c+y*p);case t.TransformMode.OnlyTranslation:l=r+90+s;this.a=t.MathUtils.cosDeg(r+o)*i,this.b=t.MathUtils.cosDeg(l)*a,this.c=t.MathUtils.sinDeg(r+o)*i,this.d=t.MathUtils.sinDeg(l)*a;break;case t.TransformMode.NoRotationOrReflection:var E=0;(A=m*m+g*g)>1e-4?(v=g*(A=Math.abs(m*y-v*g)/A),y=m*A,E=Math.atan2(g,m)*t.MathUtils.radDeg):(m=0,g=0,E=90-Math.atan2(y,v)*t.MathUtils.radDeg);var w=r+o-E,x=r+s-E+90;u=t.MathUtils.cosDeg(w)*i,c=t.MathUtils.cosDeg(x)*a,f=t.MathUtils.sinDeg(w)*i,p=t.MathUtils.sinDeg(x)*a;this.a=m*u-v*f,this.b=m*c-v*p,this.c=g*u+y*f,this.d=g*c+y*p;break;case t.TransformMode.NoScale:case t.TransformMode.NoScaleOrReflection:var A,T=t.MathUtils.cosDeg(r),M=t.MathUtils.sinDeg(r),R=m*T+v*M,I=g*T+y*M;(A=Math.sqrt(R*R+I*I))>1e-5&&(A=1/A),R*=A,I*=A,A=Math.sqrt(R*R+I*I);var b=Math.PI/2+Math.atan2(I,R),S=Math.cos(b)*A,P=Math.sin(b)*A;u=t.MathUtils.cosDeg(o)*i,c=t.MathUtils.cosDeg(90+s)*a,f=t.MathUtils.sinDeg(o)*i,p=t.MathUtils.sinDeg(90+s)*a;return(this.data.transformMode!=t.TransformMode.NoScaleOrReflection?m*y-v*g<0:this.skeleton.flipX!=this.skeleton.flipY)&&(S=-S,P=-P),this.a=R*u+S*f,this.b=R*c+S*p,this.c=I*u+P*f,void(this.d=I*c+P*p)}this.skeleton.flipX&&(this.a=-this.a,this.b=-this.b),this.skeleton.flipY&&(this.c=-this.c,this.d=-this.d)},e.prototype.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.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*t.MathUtils.radDeg},e.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*t.MathUtils.radDeg},e.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var e=this.parent;if(null==e)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*t.MathUtils.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)*t.MathUtils.radDeg);var n=e.a,r=e.b,i=e.c,a=e.d,o=1/(n*a-r*i),s=this.worldX-e.worldX,h=this.worldY-e.worldY;this.ax=s*a*o-h*r*o,this.ay=h*n*o-s*i*o;var l=o*a,u=o*n,c=o*r,f=o*i,p=l*this.a-c*this.c,d=l*this.b-c*this.d,m=u*this.c-f*this.a,v=u*this.d-f*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(p*p+m*m),this.ascaleX>1e-4){var g=p*v-d*m;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(p*d+m*v,g)*t.MathUtils.radDeg,this.arotation=Math.atan2(m,p)*t.MathUtils.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+v*v),this.ashearY=0,this.arotation=90-Math.atan2(v,d)*t.MathUtils.radDeg},e.prototype.worldToLocal=function(t){var e=this.a,n=this.b,r=this.c,i=this.d,a=1/(e*i-n*r),o=t.x-this.worldX,s=t.y-this.worldY;return t.x=o*i*a-s*n*a,t.y=s*e*a-o*r*a,t},e.prototype.localToWorld=function(t){var e=t.x,n=t.y;return t.x=e*this.a+n*this.b+this.worldX,t.y=e*this.c+n*this.d+this.worldY,t},e.prototype.worldToLocalRotation=function(e){var n=t.MathUtils.sinDeg(e),r=t.MathUtils.cosDeg(e);return Math.atan2(this.a*n-this.c*r,this.d*r-this.b*n)*t.MathUtils.radDeg},e.prototype.localToWorldRotation=function(e){var n=t.MathUtils.sinDeg(e),r=t.MathUtils.cosDeg(e);return Math.atan2(r*this.c+n*this.d,r*this.a+n*this.b)*t.MathUtils.radDeg},e.prototype.rotateWorld=function(e){var n=this.a,r=this.b,i=this.c,a=this.d,o=t.MathUtils.cosDeg(e),s=t.MathUtils.sinDeg(e);this.a=o*n-s*i,this.b=o*r-s*a,this.c=s*n+o*i,this.d=s*r+o*a,this.appliedValid=!1},e}();t.Bone=e}(i||(i={})),function(t){var e,n=function(t,n,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=e.Normal,t<0)throw new Error("index must be >= 0.");if(null==n)throw new Error("name cannot be null.");this.index=t,this.name=n,this.parent=r};t.BoneData=n,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"}(e=t.TransformMode||(t.TransformMode={}))}(i||(i={})),function(t){var e=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e};t.Event=e}(i||(i={})),function(t){var e=function(t){this.name=t};t.EventData=e}(i||(i={})),function(t){var e=function(){function e(t,e){if(this.mix=1,this.bendDirection=0,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.bendDirection=t.bendDirection,this.bones=new Array;for(var n=0;n180?c-=360:c<-180&&(c+=360),e.updateWorldTransformWith(e.ax,e.ay,e.arotation+c*i,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)},e.prototype.apply2=function(e,n,r,i,a,o){if(0!=o){e.appliedValid||e.updateAppliedTransform(),n.appliedValid||n.updateAppliedTransform();var s=e.ax,h=e.ay,l=e.ascaleX,u=e.ascaleY,c=n.ascaleX,f=0,p=0,d=0;l<0?(l=-l,f=180,d=-1):(f=0,d=1),u<0&&(u=-u,d=-d),c<0?(c=-c,p=180):p=0;var m=n.ax,v=0,g=0,y=0,E=e.a,w=e.b,x=e.c,A=e.d,T=Math.abs(l-u)<=1e-4;T?(g=E*m+w*(v=n.ay)+e.worldX,y=x*m+A*v+e.worldY):(v=0,g=E*m+e.worldX,y=x*m+e.worldY);var M=e.parent;E=M.a,w=M.b,x=M.c;var R=1/(E*(A=M.d)-w*x),I=r-M.worldX,b=i-M.worldY,S=(I*A-b*w)*R-s,P=(b*E-I*x)*R-h,C=((I=g-M.worldX)*A-(b=y-M.worldY)*w)*R-s,N=(b*E-I*x)*R-h,_=Math.sqrt(C*C+N*N),k=n.data.length*c,L=0,O=0;t:if(T){var V=(S*S+P*P-_*_-(k*=l)*k)/(2*_*k);V<-1?V=-1:V>1&&(V=1),O=Math.acos(V)*a,E=_+k*V,w=k*Math.sin(O),L=Math.atan2(P*E-S*w,S*E+P*w)}else{var D=(E=l*k)*E,F=(w=u*k)*w,X=S*S+P*P,U=Math.atan2(P,S),Y=-2*F*_,B=F-D;if((A=Y*Y-4*B*(x=F*_*_+D*X-D*F))>=0){var j=Math.sqrt(A);Y<0&&(j=-j);var W=(j=-(Y+j)/2)/B,G=x/j,q=Math.abs(W)=-1&&x<=1&&(x=Math.acos(x),(A=(I=E*Math.cos(x)+_)*I+(b=w*Math.sin(x))*b)K&&(J=x,K=A,Q=I,tt=b)),X<=(Z+K)/2?(L=U-Math.atan2($*a,H),O=z*a):(L=U-Math.atan2(tt*a,Q),O=J*a)}var et=Math.atan2(v,m)*d,nt=e.arotation;(L=(L-et)*t.MathUtils.radDeg+f-nt)>180?L-=360:L<-180&&(L+=360),e.updateWorldTransformWith(s,h,nt+L*o,e.ascaleX,e.ascaleY,0,0),nt=n.arotation,(O=((O+et)*t.MathUtils.radDeg-n.ashearX)*d+p-nt)>180?O-=360:O<-180&&(O+=360),n.updateWorldTransformWith(m,v,nt+O*o,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY)}else n.updateWorldTransform()},e}();t.IkConstraint=e}(i||(i={})),function(t){var e=function(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.mix=1,this.name=t};t.IkConstraintData=e}(i||(i={})),function(t){var e=function(){function e(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,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 n=0,r=t.bones.length;n0;if(i>0||a){var o=this.data,s=o.spacingMode,h=s==t.SpacingMode.Length,l=o.rotateMode,u=l==t.RotateMode.Tangent,c=l==t.RotateMode.ChainScale,f=this.bones.length,p=u?f:f+1,d=this.bones,m=t.Utils.setArraySize(this.spaces,p),v=null,g=this.spacing;if(c||h){c&&(v=t.Utils.setArraySize(this.lengths,f));for(var y=0,E=p-1;y0?t.MathUtils.degRad:-t.MathUtils.degRad;y=0;for(var P=3;yt.MathUtils.PI?X-=t.MathUtils.PI2:X<-t.MathUtils.PI&&(X+=t.MathUtils.PI2),X*=r,U=Math.cos(X),Y=Math.sin(X),C.a=U*O-Y*D,C.b=U*V-Y*F,C.c=Y*O+U*D,C.d=Y*V+U*F}C.appliedValid=!1}}}},e.prototype.computeWorldPositions=function(n,r,i,a,o){var s=this.target,h=this.position,l=this.spaces,u=t.Utils.setArraySize(this.positions,3*r+2),c=null,f=n.closed,p=n.worldVerticesLength,d=p/6,m=e.NONE;if(!n.constantSpeed){var v=n.lengths,g=v[d-=f?1:2];if(a&&(h*=g),o)for(var y=0;yg){m!=e.AFTER&&(m=e.AFTER,n.computeWorldVertices(s,p-6,4,c,0,2)),this.addAfterPosition(x-g,c,0,u,E);continue}}for(;;w++){var A=v[w];if(!(x>A)){if(0==w)x/=A;else x=(x-(Z=v[w-1]))/(A-Z);break}}w!=m&&(m=w,f&&w==d?(n.computeWorldVertices(s,p-4,4,c,0,2),n.computeWorldVertices(s,0,4,c,4,2)):n.computeWorldVertices(s,6*w+2,8,c,0,2)),this.addCurvePosition(x,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],u,E,i||y>0&&0==G)}return u}f?(p+=2,c=t.Utils.setArraySize(this.world,p),n.computeWorldVertices(s,2,p-4,c,0,2),n.computeWorldVertices(s,0,2,c,p-4,2),c[p-2]=c[0],c[p-1]=c[1]):(d--,p-=4,c=t.Utils.setArraySize(this.world,p),n.computeWorldVertices(s,2,p,c,0,2));for(var T=t.Utils.setArraySize(this.curves,d),M=0,R=c[0],I=c[1],b=0,S=0,P=0,C=0,N=0,_=0,k=0,L=0,O=0,V=0,D=0,F=0,X=0,U=0,Y=(y=0,2);yM){this.addAfterPosition(x-M,c,p-4,u,E);continue}}for(;;w++){var q=T[w];if(!(x>q)){if(0==w)x/=q;else x=(x-(Z=T[w-1]))/(q-Z);break}}if(w!=m){m=w;var z=6*w;for(R=c[z],I=c[z+1],b=c[z+2],S=c[z+3],P=c[z+4],C=c[z+5],D=2*(k=.03*(R-2*b+P))+(O=.006*(3*(b-P)-R+(N=c[z+6]))),F=2*(L=.03*(I-2*S+C))+(V=.006*(3*(S-C)-I+(_=c[z+7]))),X=.3*(b-R)+k+.16666667*O,U=.3*(S-I)+L+.16666667*V,j=Math.sqrt(X*X+U*U),B[0]=j,z=1;z<8;z++)X+=D,U+=F,D+=O,F+=V,j+=Math.sqrt(X*X+U*U),B[z]=j;X+=D,U+=F,j+=Math.sqrt(X*X+U*U),B[8]=j,X+=D+O,U+=F+V,j+=Math.sqrt(X*X+U*U),B[9]=j,W=0}for(x*=j;;W++){var H=B[W];if(!(x>H)){var Z;if(0==W)x/=H;else x=W+(x-(Z=B[W-1]))/(H-Z);break}}this.addCurvePosition(.1*x,R,I,b,S,P,C,N,_,u,E,i||y>0&&0==G)}return u},e.prototype.addBeforePosition=function(t,e,n,r,i){var a=e[n],o=e[n+1],s=e[n+2]-a,h=e[n+3]-o,l=Math.atan2(h,s);r[i]=a+t*Math.cos(l),r[i+1]=o+t*Math.sin(l),r[i+2]=l},e.prototype.addAfterPosition=function(t,e,n,r,i){var a=e[n+2],o=e[n+3],s=a-e[n],h=o-e[n+1],l=Math.atan2(h,s);r[i]=a+t*Math.cos(l),r[i+1]=o+t*Math.sin(l),r[i+2]=l},e.prototype.addCurvePosition=function(t,e,n,r,i,a,o,s,h,l,u,c){(0==t||isNaN(t))&&(t=1e-4);var f=t*t,p=f*t,d=1-t,m=d*d,v=m*d,g=d*t,y=3*g,E=d*y,w=y*t,x=e*v+r*E+a*w+s*p,A=n*v+i*E+o*w+h*p;l[u]=x,l[u+1]=A,c&&(l[u+2]=Math.atan2(A-(n*m+i*g*2+o*f),x-(e*m+r*g*2+a*f)))},e.prototype.getOrder=function(){return this.data.order},e.NONE=-1,e.BEFORE=-2,e.AFTER=-3,e.epsilon=1e-5,e}();t.PathConstraint=e}(i||(i={})),function(t){var e,n,r,i=function(t){this.order=0,this.bones=new Array,this.name=t};t.PathConstraintData=i,(e=t.PositionMode||(t.PositionMode={}))[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",(n=t.SpacingMode||(t.SpacingMode={}))[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",(r=t.RotateMode||(t.RotateMode={}))[r.Tangent=0]="Tangent",r[r.Chain=1]="Chain",r[r.ChainScale=2]="ChainScale"}(i||(i={})),function(t){var e=function(){function t(t){this.toLoad=new Array,this.assets={},this.clientId=t}return t.prototype.loaded=function(){var t=0;for(var e in this.assets)t++;return t},t}(),n=function(){function t(t){void 0===t&&(t=""),this.clientAssets={},this.queuedAssets={},this.rawAssets={},this.errors={},this.pathPrefix=t}return t.prototype.queueAsset=function(t,n,r){var i=this.clientAssets[t];return null==i&&(i=new e(t),this.clientAssets[t]=i),null!==n&&(i.textureLoader=n),i.toLoad.push(r),this.queuedAssets[r]!==r&&(this.queuedAssets[r]=r,!0)},t.prototype.loadText=function(t,e){var n=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var r=new XMLHttpRequest;r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?n.rawAssets[e]=r.responseText:n.errors[e]="Couldn't load text "+e+": status "+r.status+", "+r.responseText)},r.open("GET",e,!0),r.send()}},t.prototype.loadJson=function(t,e){var n=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var r=new XMLHttpRequest;r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?n.rawAssets[e]=JSON.parse(r.responseText):n.errors[e]="Couldn't load text "+e+": status "+r.status+", "+r.responseText)},r.open("GET",e,!0),r.send()}},t.prototype.loadTexture=function(t,e,n){var r=this;if(n=this.pathPrefix+n,this.queueAsset(t,e,n)){var i=new Image;i.src=n,i.crossOrigin="anonymous",i.onload=function(t){r.rawAssets[n]=i},i.onerror=function(t){r.errors[n]="Couldn't load image "+n}}},t.prototype.get=function(t,e){e=this.pathPrefix+e;var n=this.clientAssets[t];return null==n||n.assets[e]},t.prototype.updateClientAssets=function(t){for(var e=0;e0},t.prototype.getErrors=function(){return this.errors},t}();t.SharedAssetManager=n}(i||(i={})),function(t){var e=function(){function e(e){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.flipX=!1,this.flipY=!1,this.x=0,this.y=0,null==e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(var n=0;n1){var i=n[n.length-1];this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}this._updateCache.push(t),this.sortReset(r.children),n[n.length-1].sorted=!0},e.prototype.sortPathConstraint=function(e){var n=e.target,r=n.data.index,i=n.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,r,i),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,i);for(var a=0,o=this.data.skins.length;a-1||this.updateCacheReset.push(i)}else for(r=0;r=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},e.prototype.aabbIntersectsSegment=function(t,e,n,r){var i=this.minX,a=this.minY,o=this.maxX,s=this.maxY;if(t<=i&&n<=i||e<=a&&r<=a||t>=o&&n>=o||e>=s&&r>=s)return!1;var h=(r-e)/(n-t),l=h*(i-t)+e;if(l>a&&la&&li&&ui&&ut.minX&&this.minYt.minY},e.prototype.containsPoint=function(t,e){for(var n=this.polygons,r=0,i=n.length;r=n||l=n){var u=r[s];u+(n-h)/(l-h)*(r[a]-u)=u&&E<=p||E>=p&&E<=u)&&(E>=e&&E<=r||E>=r&&E<=e)){var w=(l*g-h*m)/y;if((w>=c&&w<=d||w>=d&&w<=c)&&(w>=n&&w<=i||w>=i&&w<=n))return!0}u=p,c=d}return!1},e.prototype.getPolygon=function(t){if(null==t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},e.prototype.getWidth=function(){return this.maxX-this.minX},e.prototype.getHeight=function(){return this.maxY-this.minY},e}();t.SkeletonBounds=e}(i||(i={})),function(t){var e=function(){function e(){this.triangulator=new t.Triangulator,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}return e.prototype.clipStart=function(n,r){if(null!=this.clipAttachment)return 0;this.clipAttachment=r;var i=r.worldVerticesLength,a=t.Utils.setArraySize(this.clippingPolygon,i);r.computeWorldVertices(n,0,i,a,0,2);var o=this.clippingPolygon;e.makeClockwise(o);for(var s=this.clippingPolygons=this.triangulator.decompose(o,this.triangulator.triangulate(o)),h=0,l=s.length;h>1,X=this.clipOutput,U=t.Utils.setArraySize(u,N+F*d),Y=0;Y<_;Y+=2){var B=X[Y],j=X[Y+1];U[N]=B,U[N+1]=j,U[N+2]=o.r,U[N+3]=o.g,U[N+4]=o.b,U[N+5]=o.a;var W=B-I,G=j-b,q=(k*W+L*G)*D,z=(V*W+O*G)*D,H=1-q-z;U[N+6]=w*q+M*z+S*H,U[N+7]=x*q+R*z+P*H,h&&(U[N+8]=s.r,U[N+9]=s.g,U[N+10]=s.b,U[N+11]=s.a),N+=d}N=c.length;var Z=t.Utils.setArraySize(c,N+3*(F-2));F--;for(Y=1;Y=2?(u=s,s=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(n),u.push(r),u.push(i),u.push(a),u.push(t),u.push(e),s.length=0;for(var c=o,f=o.length-4,p=0;;p+=2){for(var d=c[p],m=c[p+1],v=c[p+2],g=c[p+3],y=d-v,E=m-g,w=u,x=u.length-2,A=s.length,T=0;T0;if(y*(R-g)-E*(M-v)>0){if(S){s.push(I),s.push(b);continue}var P=((N=I-M)*(m-R)-(C=b-R)*(d-M))/(C*(v-d)-N*(g-m));s.push(d+(v-d)*P),s.push(m+(g-m)*P)}else if(S){var C,N;P=((N=I-M)*(m-R)-(C=b-R)*(d-M))/(C*(v-d)-N*(g-m));s.push(d+(v-d)*P),s.push(m+(g-m)*P),s.push(I),s.push(b)}l=!0}if(A==s.length)return h.length=0,!0;if(s.push(s[0]),s.push(s[1]),p==f)break;var _=s;(s=u).length=0,u=_}if(h!=s){h.length=0;p=0;for(var k=s.length-2;p>1;s=0;f--)-1==W[f]&&(W[f]=q[--H])}w.setFrame(c++,j.time,W)}a.push(w),o=Math.max(o,w.frames[w.getFrameCount()-1])}if(e.events){for(w=new t.EventTimeline(e.events.length),c=0,f=0;f=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=n},t.prototype.getAttachment=function(t,e){var n=this.attachments[t];return n?n[e]:null},t.prototype.attachAll=function(t,e){for(var n=0,r=0;r= 0.");if(null==n)throw new Error("name cannot be null.");if(null==r)throw new Error("boneData cannot be null.");this.index=e,this.name=n,this.boneData=r};t.SlotData=e}(i||(i={})),function(t){var e,n,r=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 e.Nearest;case"linear":return e.Linear;case"mipmap":return e.MipMap;case"mipmapnearestnearest":return e.MipMapNearestNearest;case"mipmaplinearnearest":return e.MipMapLinearNearest;case"mipmapnearestlinear":return e.MipMapNearestLinear;case"mipmaplinearlinear":return e.MipMapLinearLinear;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return n.MirroredRepeat;case"clamptoedge":return n.ClampToEdge;case"repeat":return n.Repeat;default:throw new Error("Unknown texture wrap "+t)}},t}();t.Texture=r,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"}(e=t.TextureFilter||(t.TextureFilter={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(n=t.TextureWrap||(t.TextureWrap={}));var i=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};t.TextureRegion=i;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.setFilters=function(t,e){},e.prototype.setWraps=function(t,e){},e.prototype.dispose=function(){},e}(t.Texture);t.FakeTexture=a}(i||(i={})),function(t){var e=function(){function e(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}return e.prototype.load=function(e,a){if(null==a)throw new Error("textureLoader cannot be null.");for(var o=new n(e),s=new Array(4),h=null;;){var l=o.readLine();if(null==l)break;if(0==(l=l.trim()).length)h=null;else if(h){var u=new i;u.name=l,u.page=h,u.rotate="true"==o.readValue(),o.readTuple(s);var c=parseInt(s[0]),f=parseInt(s[1]);o.readTuple(s);var p=parseInt(s[0]),d=parseInt(s[1]);u.u=c/h.width,u.v=f/h.height,u.rotate?(u.u2=(c+d)/h.width,u.v2=(f+p)/h.height):(u.u2=(c+p)/h.width,u.v2=(f+d)/h.height),u.x=c,u.y=f,u.width=Math.abs(p),u.height=Math.abs(d),4==o.readTuple(s)&&4==o.readTuple(s)&&o.readTuple(s),u.originalWidth=parseInt(s[0]),u.originalHeight=parseInt(s[1]),o.readTuple(s),u.offsetX=parseInt(s[0]),u.offsetY=parseInt(s[1]),u.index=parseInt(o.readValue()),u.texture=h.texture,this.regions.push(u)}else{(h=new r).name=l,2==o.readTuple(s)&&(h.width=parseInt(s[0]),h.height=parseInt(s[1]),o.readTuple(s)),o.readTuple(s),h.minFilter=t.Texture.filterFromString(s[0]),h.magFilter=t.Texture.filterFromString(s[1]);var m=o.readValue();h.uWrap=t.TextureWrap.ClampToEdge,h.vWrap=t.TextureWrap.ClampToEdge,"x"==m?h.uWrap=t.TextureWrap.Repeat:"y"==m?h.vWrap=t.TextureWrap.Repeat:"xy"==m&&(h.uWrap=h.vWrap=t.TextureWrap.Repeat),h.texture=a(l),h.texture.setFilters(h.minFilter,h.magFilter),h.texture.setWraps(h.uWrap,h.vWrap),h.width=h.texture.getImage().width,h.height=h.texture.getImage().height,this.pages.push(h)}}},e.prototype.findRegion=function(t){for(var e=0;e=this.lines.length?null:this.lines[this.index++]},t.prototype.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},t.prototype.readTuple=function(t){var e=this.readLine(),n=e.indexOf(":");if(-1==n)throw new Error("Invalid line: "+e);for(var r=0,i=n+1;r<3;r++){var a=e.indexOf(",",i);if(-1==a)break;t[r]=e.substr(i,a-i).trim(),i=a+1}return t[r]=e.substring(i).trim(),r+1},t}(),r=function(){};t.TextureAtlasPage=r;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(t.TextureRegion);t.TextureAtlasRegion=i}(i||(i={})),function(t){var e=function(){function e(e,n){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new t.Vector2,null==e)throw new Error("data cannot be null.");if(null==n)throw new Error("skeleton cannot be null.");this.data=e,this.rotateMix=e.rotateMix,this.translateMix=e.translateMix,this.scaleMix=e.scaleMix,this.shearMix=e.shearMix,this.bones=new Array;for(var r=0;r0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones,d=0,m=p.length;dt.MathUtils.PI?b-=t.MathUtils.PI2:b<-t.MathUtils.PI&&(b+=t.MathUtils.PI2),b*=e;var A=Math.cos(b),T=Math.sin(b);v.a=A*y-T*w,v.b=A*E-T*x,v.c=T*y+A*w,v.d=T*E+A*x,g=!0}if(0!=n){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(M.x-v.worldX)*n,v.worldY+=(M.y-v.worldY)*n,g=!0}if(r>0){var R=Math.sqrt(v.a*v.a+v.c*v.c),I=Math.sqrt(o*o+h*h);R>1e-5&&(R=(R+(I-R+this.data.offsetScaleX)*r)/R),v.a*=R,v.c*=R,R=Math.sqrt(v.b*v.b+v.d*v.d),I=Math.sqrt(s*s+l*l),R>1e-5&&(R=(R+(I-R+this.data.offsetScaleY)*r)/R),v.b*=R,v.d*=R,g=!0}if(i>0){E=v.b,x=v.d;var b,S=Math.atan2(x,E);(b=Math.atan2(l,s)-Math.atan2(h,o)-(S-Math.atan2(v.c,v.a)))>t.MathUtils.PI?b-=t.MathUtils.PI2:b<-t.MathUtils.PI&&(b+=t.MathUtils.PI2),b=S+(b+f)*i;R=Math.sqrt(E*E+x*x);v.b=Math.cos(b)*R,v.d=Math.sin(b)*R,g=!0}g&&(v.appliedValid=!1)}},e.prototype.applyRelativeWorld=function(){for(var e=this.rotateMix,n=this.translateMix,r=this.scaleMix,i=this.shearMix,a=this.target,o=a.a,s=a.b,h=a.c,l=a.d,u=o*l-s*h>0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*u,f=this.data.offsetShearY*u,p=this.bones,d=0,m=p.length;dt.MathUtils.PI?I-=t.MathUtils.PI2:I<-t.MathUtils.PI&&(I+=t.MathUtils.PI2),I*=e;var A=Math.cos(I),T=Math.sin(I);v.a=A*y-T*w,v.b=A*E-T*x,v.c=T*y+A*w,v.d=T*E+A*x,g=!0}if(0!=n){var M=this.temp;a.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),v.worldX+=M.x*n,v.worldY+=M.y*n,g=!0}if(r>0){var R=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleX)*r+1;v.a*=R,v.c*=R,R=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*r+1,v.b*=R,v.d*=R,g=!0}if(i>0){var I;(I=Math.atan2(l,s)-Math.atan2(h,o))>t.MathUtils.PI?I-=t.MathUtils.PI2:I<-t.MathUtils.PI&&(I+=t.MathUtils.PI2);E=v.b,x=v.d;I=Math.atan2(x,E)+(I-t.MathUtils.PI/2+f)*i;R=Math.sqrt(E*E+x*x);v.b=Math.cos(I)*R,v.d=Math.sin(I)*R,g=!0}g&&(v.appliedValid=!1)}},e.prototype.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,i=this.target;i.appliedValid||i.updateAppliedTransform();for(var a=this.bones,o=0,s=a.length;o0&&(p>1e-5&&(p=(p+(i.ascaleX-p+this.data.offsetScaleX)*n)/p),d>1e-5&&(d=(d+(i.ascaleY-d+this.data.offsetScaleY)*n)/d));var m=h.ashearY;if(r>0){u=i.ashearY-m+this.data.offsetShearY;u-=360*(16384-(16384.499999999996-u/360|0)),h.shearY+=u*r}h.updateWorldTransformWith(c,f,l,p,d,h.ashearX,m)}},e.prototype.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,i=this.target;i.appliedValid||i.updateAppliedTransform();for(var a=this.bones,o=0,s=a.length;o0&&(f>1e-5&&(f*=(i.ascaleX-1+this.data.offsetScaleX)*n+1),p>1e-5&&(p*=(i.ascaleY-1+this.data.offsetScaleY)*n+1));var d=h.ashearY;r>0&&(d+=(i.ashearY+this.data.offsetShearY)*r),h.updateWorldTransformWith(u,c,l,f,p,h.ashearX,d)}},e.prototype.getOrder=function(){return this.data.order},e}();t.TransformConstraint=e}(i||(i={})),function(t){var e=function(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,null==t)throw new Error("name cannot be null.");this.name=t};t.TransformConstraintData=e}(i||(i={})),function(t){var e=function(){function e(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new t.Pool((function(){return new Array})),this.polygonIndicesPool=new t.Pool((function(){return new Array}))}return e.prototype.triangulate=function(t){var n=t,r=t.length>>1,i=this.indicesArray;i.length=0;for(var a=0;a3;){for(var l=r-1,u=(a=0,1);;){t:if(!o[a]){for(var c=i[l]<<1,f=i[a]<<1,p=i[u]<<1,d=n[c],m=n[c+1],v=n[f],g=n[f+1],y=n[p],E=n[p+1],w=(u+1)%r;w!=l;w=(w+1)%r)if(o[w]){var x=i[w]<<1,A=n[x],T=n[x+1];if(e.positiveArea(y,E,d,m,A,T)&&e.positiveArea(d,m,v,g,A,T)&&e.positiveArea(v,g,y,E,A,T))break t}break}if(0==u){do{if(!o[a])break;a--}while(a>0);break}l=a,a=u,u=(u+1)%r}h.push(i[(r+a-1)%r]),h.push(i[a]),h.push(i[(a+1)%r]),i.splice(a,1),o.splice(a,1);var M=(--r+a-1)%r,R=a==r?0:a;o[M]=e.isConcave(M,r,n,i),o[R]=e.isConcave(R,r,n,i)}return 3==r&&(h.push(i[2]),h.push(i[0]),h.push(i[1])),h},e.prototype.decompose=function(t,n){var r=t,i=this.convexPolygons;this.polygonPool.freeAll(i),i.length=0;var a=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(a),a.length=0;var o=this.polygonIndicesPool.obtain();o.length=0;var s=this.polygonPool.obtain();s.length=0;for(var h=-1,l=0,u=0,c=n.length;u0?(i.push(s),a.push(o)):(this.polygonPool.free(s),this.polygonIndicesPool.free(o)),(s=this.polygonPool.obtain()).length=0,s.push(m),s.push(v),s.push(g),s.push(y),s.push(E),s.push(w),(o=this.polygonIndicesPool.obtain()).length=0,o.push(f),o.push(p),o.push(d),l=e.winding(m,v,g,y,E,w),h=f)}s.length>0&&(i.push(s),a.push(o));for(u=0,c=i.length;u=0;u--)0==(s=i[u]).length&&(i.splice(u,1),this.polygonPool.free(s),o=a[u],a.splice(u,1),this.polygonIndicesPool.free(o));return i},e.isConcave=function(t,e,n,r){var i=r[(e+t-1)%e]<<1,a=r[t]<<1,o=r[(t+1)%e]<<1;return!this.positiveArea(n[i],n[i+1],n[a],n[a+1],n[o],n[o+1])},e.positiveArea=function(t,e,n,r,i,a){return t*(a-r)+n*(e-a)+i*(r-e)>=0},e.winding=function(t,e,n,r,i,a){var o=n-t,s=r-e;return i*s-a*o+o*e-t*s>=0?1:-1},e}();t.Triangulator=e}(i||(i={})),function(t){var e=function(){function t(){this.array=new Array}return t.prototype.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},t.prototype.contains=function(t){return null!=this.array[0|t]},t.prototype.remove=function(t){this.array[0|t]=void 0},t.prototype.clear=function(){this.array.length=0},t}();t.IntSet=e;var n=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=n,this.a=r}return t.prototype.set=function(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this.clamp(),this},t.prototype.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.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},t.prototype.add=function(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,this.a+=r,this.clamp(),this},t.prototype.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.WHITE=new t(1,1,1,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.MAGENTA=new t(1,0,1,1),t}();t.Color=n;var r=function(){function t(){}return t.clamp=function(t,e,n){return tn?n: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,n){return t.randomTriangularWith(e,n,.5*(e+n))},t.randomTriangularWith=function(t,e,n){var r=Math.random(),i=e-t;return r<=(n-t)/i?t+Math.sqrt(r*i*(n-t)):e-Math.sqrt((1-r)*i*(e-n))},t.PI=3.1415927,t.PI2=2*t.PI,t.radiansToDegrees=180/t.PI,t.radDeg=t.radiansToDegrees,t.degreesToRadians=t.PI/180,t.degRad=t.degreesToRadians,t}();t.MathUtils=r;var i=function(){function t(){}return t.prototype.apply=function(t,e,n){return t+(e-t)*this.applyInternal(n)},t}();t.Interpolation=i;var a=function(t){function e(e){var n=t.call(this)||this;return n.power=2,n.power=e,n}return o(e,t),e.prototype.applyInternal=function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1},e}(i);t.Pow=a;var s=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e}(a);t.PowOut=s;var h=function(){function t(){}return t.arrayCopy=function(t,e,n,r,i){for(var a=e,o=r;a=n?e:t.setArraySize(e,n,r)},t.newArray=function(t,e){for(var n=new Array(t),r=0;r0?this.items.pop():this.instantiator()},t.prototype.free=function(t){t.reset&&t.reset(),this.items.push(t)},t.prototype.freeAll=function(t){for(var e=0;ethis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)},t}();t.TimeKeeper=f;var p=function(){function t(t){void 0===t&&(t=32),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}return t.prototype.hasEnoughData=function(){return this.addedValues>=this.values.length},t.prototype.addValue=function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0},t.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*a;var o=t.bone.skeleton,s=t.attachmentVertices,h=this.vertices,l=this.bones;if(null!=l){for(var u=0,c=0,f=0;f0&&(h=s);for(var w,x=(w=t.bone).worldX,A=w.worldY,T=w.a,M=w.b,R=w.c,I=w.d,b=e,S=i;S)?=?)"),p("XRANGEIDENTIFIERLOOSE","".concat(h[l.NUMERICIDENTIFIERLOOSE],"|x|X|\\*")),p("XRANGEIDENTIFIER","".concat(h[l.NUMERICIDENTIFIER],"|x|X|\\*")),p("XRANGEPLAIN","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:".concat(h[l.PRERELEASE],")?").concat(h[l.BUILD],"?")+")?)?"),p("XRANGEPLAINLOOSE","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:".concat(h[l.PRERELEASELOOSE],")?").concat(h[l.BUILD],"?")+")?)?"),p("XRANGE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAIN],"$")),p("XRANGELOOSE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAINLOOSE],"$")),p("COERCE","".concat("(^|[^\\d])(\\d{1,").concat(n,"})")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:$|[^\\d])"),p("COERCERTL",h[l.COERCE],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM","(\\s*)".concat(h[l.LONETILDE],"\\s+"),!0),e.tildeTrimReplace="$1~",p("TILDE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAIN],"$")),p("TILDELOOSE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAINLOOSE],"$")),p("LONECARET","(?:\\^)"),p("CARETTRIM","(\\s*)".concat(h[l.LONECARET],"\\s+"),!0),e.caretTrimReplace="$1^",p("CARET","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAIN],"$")),p("CARETLOOSE","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAINLOOSE],"$")),p("COMPARATORLOOSE","^".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],")$|^$")),p("COMPARATOR","^".concat(h[l.GTLT],"\\s*(").concat(h[l.FULLPLAIN],")$|^$")),p("COMPARATORTRIM","(\\s*)".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],"|").concat(h[l.XRANGEPLAIN],")"),!0),e.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE","^\\s*(".concat(h[l.XRANGEPLAIN],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAIN],")")+"\\s*$"),p("HYPHENRANGELOOSE","^\\s*(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s*$"),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(k,k.exports);var L=k.exports;S(L);var O=Object.freeze({loose:!0}),V=Object.freeze({}),D=function(t){return t?"object"!==h(t)?O:t:V};S(D);var F=/^[0-9]+$/,X=function(t,e){var n=F.test(t),r=F.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:tB)throw new TypeError("version is longer than ".concat(B," characters"));Y("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;var r=e.trim().match(n.loose?W[G.LOOSE]:W[G.FULL]);if(!r)throw new TypeError("Invalid Version: ".concat(e));if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>j||this.major<0)throw new TypeError("Invalid major version");if(this.minor>j||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>j||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(e===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(r)}}if(e){var a=[e,r];!1===n&&(a=[e]),0===z(this.prerelease[0],e)?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break;default:throw new Error("invalid increment argument: ".concat(t))}return this.raw=this.format(),this.build.length&&(this.raw+="+".concat(this.build.join("."))),this}}]),t}(),Z=H;S(Z);var $=Z,J=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t instanceof $)return t;try{return new $(t,e)}catch(t){if(!n)return null;throw t}};S(J);var Q,K,tt=J,et=S((function(t,e){var n=tt(t,e);return n?n.version:null})),nt=Z,rt=J,it=L.safeRe,at=L.t,ot=S((function(t,e){if(t instanceof nt)return t;if("number"==typeof t&&(t=String(t)),"string"!=typeof t)return null;var n=null;if((e=e||{}).rtl){for(var r;(r=it[at.COERCERTL].exec(t))&&(!n||n.index+n[0].length!==t.length);)n&&r.index+r[0].length===n.index+n[0].length||(n=r),it[at.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;it[at.COERCERTL].lastIndex=-1}else n=t.match(it[at.COERCE]);return null===n?null:rt("".concat(n[2],".").concat(n[3]||"0",".").concat(n[4]||"0"),e)}));var st=ht;function ht(t){var e=this;if(e instanceof ht||(e=new ht),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var n=0,r=arguments.length;n1)n=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=t(n,r.value,i),r=r.next;return n},ht.prototype.reduceReverse=function(t,e){var n,r=this.tail;if(arguments.length>1)n=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=t(n,r.value,i),r=r.prev;return n},ht.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;null!==n;e++)t[e]=n.value,n=n.next;return t},ht.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;null!==n;e++)t[e]=n.value,n=n.prev;return t},ht.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var n=new ht;if(ethis.length&&(e=this.length);for(var r=0,i=this.head;null!==i&&rthis.length&&(e=this.length);for(var r=this.length,i=this.tail;null!==i&&r>e;r--)i=i.prev;for(;null!==i&&r>t;r--,i=i.prev)n.push(i.value);return n},ht.prototype.splice=function(t,e){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,r=this.head;null!==r&&nthis[dt])return Pt(this,this[At].get(t)),!1;var a=this[At].get(t).value;return this[Et]&&(this[wt]||this[Et](t,a.value)),a.now=r,a.maxAge=n,a.value=e,this[mt]+=i-a.length,a.length=i,this.get(t),St(this),!0}var o=new Ct(t,e,i,r,n);return o.length>this[dt]?(this[Et]&&this[Et](t,e),!1):(this[mt]+=o.length,this[xt].unshift(o),this[At].set(t,this[xt].head),St(this),!0)}},{key:"has",value:function(t){if(!this[At].has(t))return!1;var e=this[At].get(t).value;return!bt(this,e)}},{key:"get",value:function(t){return It(this,t,!0)}},{key:"peek",value:function(t){return It(this,t,!1)}},{key:"pop",value:function(){var t=this[xt].tail;return t?(Pt(this,t),t.value):null}},{key:"del",value:function(t){Pt(this,this[At].get(t))}},{key:"load",value:function(t){this.reset();for(var e=Date.now(),n=t.length-1;n>=0;n--){var r=t[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{var a=i-e;a>0&&this.set(r.k,r.v,a)}}}},{key:"prune",value:function(){var t=this;this[At].forEach((function(e,n){return It(t,n,!1)}))}}]),t}(),It=function(t,e,n){var r=t[At].get(e);if(r){var i=r.value;if(bt(t,i)){if(Pt(t,r),!t[gt])return}else n&&(t[Tt]&&(r.value.now=Date.now()),t[xt].unshiftNode(r));return i.value}},bt=function(t,e){if(!e||!e.maxAge&&!t[yt])return!1;var n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[yt]&&n>t[yt]},St=function(t){if(t[mt]>t[dt])for(var e=t[xt].tail;t[mt]>t[dt]&&null!==e;){var n=e.prev;Pt(t,e),e=n}},Pt=function(t,e){if(e){var n=e.value;t[Et]&&t[Et](n.key,n.value),t[mt]-=n.length,t[At].delete(n.key),t[xt].removeNode(e)}},Ct=c((function t(e,n,r,i,a){l(this,t),this.key=e,this.value=n,this.length=r,this.now=i,this.maxAge=a||0})),Nt=function(t,e,n,r){var i=n.value;bt(t,i)&&(Pt(t,n),t[gt]||(i=void 0)),i&&e.call(r,i.value,i.key,t)},_t=Rt;S(_t);var kt=Z,Lt=function(t,e,n){return new kt(t,n).compare(new kt(e,n))};S(Lt);var Ot=Lt,Vt=function(t,e,n){return 0===Ot(t,e,n)};S(Vt);var Dt=Lt,Ft=function(t,e,n){return 0!==Dt(t,e,n)};S(Ft);var Xt=Lt,Ut=function(t,e,n){return Xt(t,e,n)>0};S(Ut);var Yt=Lt,Bt=function(t,e,n){return Yt(t,e,n)>=0};S(Bt);var jt=Lt,Wt=function(t,e,n){return jt(t,e,n)<0};S(Wt);var Gt=Lt,qt=function(t,e,n){return Gt(t,e,n)<=0};S(qt);var zt,Ht,Zt,$t,Jt=Vt,Qt=Ft,Kt=Ut,te=Bt,ee=Wt,ne=qt,re=function(t,e,n,r){switch(e){case"===":return"object"===h(t)&&(t=t.version),"object"===h(n)&&(n=n.version),t===n;case"!==":return"object"===h(t)&&(t=t.version),"object"===h(n)&&(n=n.version),t!==n;case"":case"=":case"==":return Jt(t,n,r);case"!=":return Qt(t,n,r);case">":return Kt(t,n,r);case">=":return te(t,n,r);case"<":return ee(t,n,r);case"<=":return ne(t,n,r);default:throw new TypeError("Invalid operator: ".concat(e))}};function ie(){if($t)return Zt;$t=1;var t=function(){function t(e,i){var a=this;if(l(this,t),i=n(i),e instanceof t)return e.loose===!!i.loose&&e.includePrerelease===!!i.includePrerelease?e:new t(e.raw,i);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((function(t){return a.parseRange(t.trim())})).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: ".concat(this.raw));if(this.set.length>1){var o=this.set[0];if(this.set=this.set.filter((function(t){return!m(t[0])})),0===this.set.length)this.set=[o];else if(this.set.length>1){var s,h=T(this.set);try{for(h.s();!(s=h.n()).done;){var u=s.value;if(1===u.length&&v(u[0])){this.set=[u];break}}}catch(t){h.e(t)}finally{h.f()}}}this.format()}return c(t,[{key:"format",value:function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range}},{key:"toString",value:function(){return this.range}},{key:"parseRange",value:function(t){var n=this,a=((this.options.includePrerelease&&p)|(this.options.loose&&d))+":"+t,l=e.get(a);if(l)return l;var c=this.options.loose,v=c?o[s.HYPHENRANGELOOSE]:o[s.HYPHENRANGE];t=t.replace(v,N(this.options.includePrerelease)),i("hyphen replace",t),t=t.replace(o[s.COMPARATORTRIM],h),i("comparator trim",t),t=t.replace(o[s.TILDETRIM],u),i("tilde trim",t),t=t.replace(o[s.CARETTRIM],f),i("caret trim",t);var g=t.split(" ").map((function(t){return y(t,n.options)})).join(" ").split(/\s+/).map((function(t){return C(t,n.options)}));c&&(g=g.filter((function(t){return i("loose invalid filter",t,n.options),!!t.match(o[s.COMPARATORLOOSE])}))),i("range list",g);var E,x=new Map,A=g.map((function(t){return new r(t,n.options)})),M=T(A);try{for(M.s();!(E=M.n()).done;){var R=E.value;if(m(R))return[R];x.set(R.value,R)}}catch(t){M.e(t)}finally{M.f()}x.size>1&&x.has("")&&x.delete("");var I=w(x.values());return e.set(a,I),I}},{key:"intersects",value:function(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((function(t){return g(t,n)&&e.set.some((function(e){return g(e,n)&&t.every((function(t){return e.every((function(e){return t.intersects(e,n)}))}))}))}))}},{key:"test",value:function(t){if(!t)return!1;if("string"==typeof t)try{t=new a(t,this.options)}catch(t){return!1}for(var e=0;e")||!t.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!t.operator.startsWith("<"))&&(this.semver.version!==t.semver.version||!this.operator.includes("=")||!t.operator.includes("="))&&!(a(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<"))&&!(a(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}}],[{key:"ANY",get:function(){return t}}]),e}();zt=e;var n=D,r=L.safeRe,i=L.t,a=re,o=_,s=Z,h=ie();return zt}(),i=_,a=Z,o=L.safeRe,s=L.t,h=L.comparatorTrimReplace,u=L.tildeTrimReplace,f=L.caretTrimReplace,p=P.FLAG_INCLUDE_PRERELEASE,d=P.FLAG_LOOSE,m=function(t){return"<0.0.0-0"===t.value},v=function(t){return""===t.value},g=function(t,e){for(var n=!0,r=t.slice(),i=r.pop();n&&r.length;)n=r.every((function(t){return i.intersects(t,e)})),i=r.pop();return n},y=function(t,e){return i("comp",t,e),t=M(t,e),i("caret",t),t=x(t,e),i("tildes",t),t=I(t,e),i("xrange",t),t=S(t,e),i("stars",t),t},E=function(t){return!t||"x"===t.toLowerCase()||"*"===t},x=function(t,e){return t.trim().split(/\s+/).map((function(t){return A(t,e)})).join(" ")},A=function(t,e){var n=e.loose?o[s.TILDELOOSE]:o[s.TILDE];return t.replace(n,(function(e,n,r,a,o){var s;return i("tilde",t,e,n,r,a,o),E(n)?s="":E(r)?s=">=".concat(n,".0.0 <").concat(+n+1,".0.0-0"):E(a)?s=">=".concat(n,".").concat(r,".0 <").concat(n,".").concat(+r+1,".0-0"):o?(i("replaceTilde pr",o),s=">=".concat(n,".").concat(r,".").concat(a,"-").concat(o," <").concat(n,".").concat(+r+1,".0-0")):s=">=".concat(n,".").concat(r,".").concat(a," <").concat(n,".").concat(+r+1,".0-0"),i("tilde return",s),s}))},M=function(t,e){return t.trim().split(/\s+/).map((function(t){return R(t,e)})).join(" ")},R=function(t,e){i("caret",t,e);var n=e.loose?o[s.CARETLOOSE]:o[s.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(function(e,n,a,o,s){var h;return i("caret",t,e,n,a,o,s),E(n)?h="":E(a)?h=">=".concat(n,".0.0").concat(r," <").concat(+n+1,".0.0-0"):E(o)?h="0"===n?">=".concat(n,".").concat(a,".0").concat(r," <").concat(n,".").concat(+a+1,".0-0"):">=".concat(n,".").concat(a,".0").concat(r," <").concat(+n+1,".0.0-0"):s?(i("replaceCaret pr",s),h="0"===n?"0"===a?">=".concat(n,".").concat(a,".").concat(o,"-").concat(s," <").concat(n,".").concat(a,".").concat(+o+1,"-0"):">=".concat(n,".").concat(a,".").concat(o,"-").concat(s," <").concat(n,".").concat(+a+1,".0-0"):">=".concat(n,".").concat(a,".").concat(o,"-").concat(s," <").concat(+n+1,".0.0-0")):(i("no pr"),h="0"===n?"0"===a?">=".concat(n,".").concat(a,".").concat(o).concat(r," <").concat(n,".").concat(a,".").concat(+o+1,"-0"):">=".concat(n,".").concat(a,".").concat(o).concat(r," <").concat(n,".").concat(+a+1,".0-0"):">=".concat(n,".").concat(a,".").concat(o," <").concat(+n+1,".0.0-0")),i("caret return",h),h}))},I=function(t,e){return i("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return b(t,e)})).join(" ")},b=function(t,e){t=t.trim();var n=e.loose?o[s.XRANGELOOSE]:o[s.XRANGE];return t.replace(n,(function(n,r,a,o,s,h){i("xRange",t,n,r,a,o,s,h);var l=E(a),u=l||E(o),c=u||E(s),f=c;return"="===r&&f&&(r=""),h=e.includePrerelease?"-0":"",l?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&f?(u&&(o=0),s=0,">"===r?(r=">=",u?(a=+a+1,o=0,s=0):(o=+o+1,s=0)):"<="===r&&(r="<",u?a=+a+1:o=+o+1),"<"===r&&(h="-0"),n="".concat(r+a,".").concat(o,".").concat(s).concat(h)):u?n=">=".concat(a,".0.0").concat(h," <").concat(+a+1,".0.0-0"):c&&(n=">=".concat(a,".").concat(o,".0").concat(h," <").concat(a,".").concat(+o+1,".0-0")),i("xRange return",n),n}))},S=function(t,e){return i("replaceStars",t,e),t.trim().replace(o[s.STAR],"")},C=function(t,e){return i("replaceGTE0",t,e),t.trim().replace(o[e.includePrerelease?s.GTE0PRE:s.GTE0],"")},N=function(t){return function(e,n,r,i,a,o,s,h,l,u,c,f,p){return n=E(r)?"":E(i)?">=".concat(r,".0.0").concat(t?"-0":""):E(a)?">=".concat(r,".").concat(i,".0").concat(t?"-0":""):o?">=".concat(n):">=".concat(n).concat(t?"-0":""),h=E(l)?"":E(u)?"<".concat(+l+1,".0.0-0"):E(c)?"<".concat(l,".").concat(+u+1,".0-0"):f?"<=".concat(l,".").concat(u,".").concat(c,"-").concat(f):t?"<".concat(l,".").concat(u,".").concat(+c+1,"-0"):"<=".concat(h),"".concat(n," ").concat(h).trim()}},k=function(t,e,n){for(var a=0;a0){var s=t[o].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0};return Zt}S(re);var ae,oe,se=ie(),he=function(t,e,n){try{e=new se(e,n)}catch(t){return!1}return e.test(t)},le={valid:et,coerce:ot,satisfies:S(he),SEMVER_SPEC_VERSION:C.SEMVER_SPEC_VERSION},ue=0,ce=1,fe=2,pe=[0,1,2,2,3,0],de=function(){function t(e,n,r,o){var s;if(l(this,t),f(this,"autoUpdate",!0),f(this,"skeleton",void 0),f(this,"states",void 0),this._app=e,this._position=new a.Vec3,1===i.TextureAtlas.length){var h,u=T((s=new i.TextureAtlas(n)).pages);try{for(u.s();!(h=u.n()).done;){var c=h.value;c.setTexture(new b(o[c.name]))}}catch(t){u.e(t)}finally{u.f()}}else s=new i.TextureAtlas(n,(function(t){return new b(o[t])}));var p=new i.SkeletonJson(new i.AtlasAttachmentLoader(s));p.scale*=.01;var d=p.readSkeletonData(r);this.skeletonVersion=le.valid(le.coerce(d.version)),this._spine_3_6_0=le.satisfies(this.skeletonVersion,"<=3.6.0"),this._spine_3_7_99=le.satisfies(this.skeletonVersion,"<=3.7.99"),this._spine_4_0_X=le.satisfies(this.skeletonVersion,"~4.0.0"),this._spine_4_1_X=le.satisfies(this.skeletonVersion,"~4.1.23"),this.skeleton=new i.Skeleton(d),this.skeleton.updateWorldTransform(),this.stateData=new i.AnimationStateData(this.skeleton.data),this.states=[new i.AnimationState(this.stateData)],this.clipper=new i.SkeletonClipping,this._node=new a.GraphNode,this._meshes=[],this._meshInstances=[],this._materials={},this._tint={},this._aabb=new a.BoundingBox,this._aabbTempArray=[],this._aabbTempOffset=new a.Vec2,this._aabbTempSize=new a.Vec2,this._renderCounts={vertexCount:0,indexCount:0},this._vertexFormat=null,this._vertexBuffer=null,this._indexBuffer=null,this._priority=0,this._timeScale=1,this._layers=[a.LAYERID_UI],this.init(),this._hidden=!1}return c(t,[{key:"destroy",value:function(){this.removeFromLayers();for(var t=0;t0&&this._renderCounts.vertexCount>0){this.skeleton.getBounds(this._aabbTempOffset,this._aabbTempSize,this._aabbTempArray),this._aabb.center=new a.Vec3(this._aabbTempOffset.x,this._aabbTempOffset.y,0),this._aabb.halfExtents=new a.Vec3(.5*this._aabbTempSize.x,.5*this._aabbTempSize.y,0),(!this._vertexBuffer||this._vertexBuffer.getNumVertices()0&&c.indices.length>0){t&&t!==c.material&&(this.SubmitBatch(e,n,t),t=c.material,e=o,n=0),t=c.material;var f=c.positions,p=c.vertexColor.r,d=c.vertexColor.g,m=c.vertexColor.b,v=c.vertexColor.a,g=c.uvs,y=void 0,E=f.length/2;for(y=0;y0){var r=new a.Mesh(this._app.graphicsDevice);r.vertexBuffer=this._vertexBuffer,r.indexBuffer[0]=this._indexBuffer,r.primitive[0].type=a.PRIMITIVE_TRIANGLES,r.primitive[0].base=t,r.primitive[0].count=e,r.primitive[0].indexed=!0,r.aabb=this._aabb,this._meshes.push(r);var i=new a.MeshInstance(r,this._materials[n],this._node);i.drawOrder=this.priority+this._meshInstances.length,i.visible=!this._hidden,this._meshInstances.push(i)}}},{key:"update",value:function(t){if(!this._hidden){var e;t*=this._timeScale;var n=this.states.length;for(e=0;e=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return a("end");if(o.tryLoc<=this.prev){var h=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(h&&l){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,i=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function M(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}!function(t){var e,n,r,a=function(){function t(t,e,n){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 r=0;r0&&(e%=this.duration));for(var h=this.timelines,l=0,u=h.length;l>>1;;){if(t[(i+1)*n]<=e?r=i+1:a=i,r==a)return(r+1)*n;i=r+a>>>1}},t.linearSearch=function(t,e,n){for(var r=0,a=t.length-n;r<=a;r+=n)if(t[r]>e)return r;return-1},t}();t.Animation=a,function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(e=t.MixBlend||(t.MixBlend={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(n=t.MixDirection||(t.MixDirection={})),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"}(r=t.TimelineType||(t.TimelineType={}));var i=function(){function e(n){if(n<=0)throw new Error("frameCount must be > 0: "+n);this.curves=t.Utils.newFloatArray((n-1)*e.BEZIER_SIZE)}return e.prototype.getFrameCount=function(){return this.curves.length/e.BEZIER_SIZE+1},e.prototype.setLinear=function(t){this.curves[t*e.BEZIER_SIZE]=e.LINEAR},e.prototype.setStepped=function(t){this.curves[t*e.BEZIER_SIZE]=e.STEPPED},e.prototype.getCurveType=function(t){var n=t*e.BEZIER_SIZE;if(n==this.curves.length)return e.LINEAR;var r=this.curves[n];return r==e.LINEAR?e.LINEAR:r==e.STEPPED?e.STEPPED:e.BEZIER},e.prototype.setCurve=function(t,n,r,a,i){var o=.03*(2*-n+a),s=.03*(2*-r+i),h=.006*(3*(n-a)+1),l=.006*(3*(r-i)+1),u=2*o+h,c=2*s+l,f=.3*n+o+.16666667*h,d=.3*r+s+.16666667*l,p=t*e.BEZIER_SIZE,m=this.curves;m[p++]=e.BEZIER;for(var v=f,g=d,y=p+e.BEZIER_SIZE-1;p=r){var u=void 0,c=void 0;return i==h?(u=0,c=0):(u=a[i-2],c=a[i-1]),c+(a[i+1]-c)*(r-u)/(s-u)}var f=a[i-1];return f+(1-f)*(r-s)/(1-s)},e.LINEAR=0,e.STEPPED=1,e.BEZIER=2,e.BEZIER_SIZE=19,e}();t.CurveTimeline=i;var s=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e<<1),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.rotate<<24)+this.boneIndex},i.prototype.setFrame=function(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+i.ROTATION]=n},i.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(c.active)if(r=u[u.length-i.ENTRIES]){var d=u[u.length+i.PREV_ROTATION];switch(h){case e.setup:c.rotation=c.data.rotation+d*s;break;case e.first:case e.replace:d+=c.data.rotation-c.rotation,d-=360*(16384-(16384.499999999996-d/360|0));case e.add:c.rotation+=d*s}}else{var p=a.binarySearch(u,r,i.ENTRIES),m=u[p+i.PREV_ROTATION],v=u[p],g=this.getCurvePercent((p>>1)-1,1-(r-v)/(u[p+i.PREV_TIME]-v)),y=u[p+i.ROTATION]-m;switch(y=m+(y-360*(16384-(16384.499999999996-y/360|0)))*g,h){case e.setup:c.rotation=c.data.rotation+(y-360*(16384-(16384.499999999996-y/360|0)))*s;break;case e.first:case e.replace:y+=c.data.rotation-c.rotation;case e.add:c.rotation+=(y-360*(16384-(16384.499999999996-y/360|0)))*s}}},i.ENTRIES=2,i.PREV_TIME=-2,i.PREV_ROTATION=-1,i.ROTATION=1,i}(i);t.RotateTimeline=s;var h=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.translate<<24)+this.boneIndex},i.prototype.setFrame=function(t,e,n,r){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.X]=n,this.frames[t+i.Y]=r},i.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(c.active)if(r=u[u.length-i.ENTRIES])f=u[u.length+i.PREV_X],d=u[u.length+i.PREV_Y];else{var p=a.binarySearch(u,r,i.ENTRIES);f=u[p+i.PREV_X],d=u[p+i.PREV_Y];var m=u[p],v=this.getCurvePercent(p/i.ENTRIES-1,1-(r-m)/(u[p+i.PREV_TIME]-m));f+=(u[p+i.X]-f)*v,d+=(u[p+i.Y]-d)*v}switch(h){case e.setup:c.x=c.data.x+f*s,c.y=c.data.y+d*s;break;case e.first:case e.replace:c.x+=(c.data.x+f-c.x)*s,c.y+=(c.data.y+d-c.y)*s;break;case e.add:c.x+=f*s,c.y+=d*s}}},i.ENTRIES=3,i.PREV_TIME=-3,i.PREV_X=-2,i.PREV_Y=-1,i.X=1,i.Y=2,i}(i);t.TranslateTimeline=h;var l=function(i){function s(t){return i.call(this,t)||this}return o(s,i),s.prototype.getPropertyId=function(){return(r.scale<<24)+this.boneIndex},s.prototype.apply=function(r,i,o,h,l,u,c){var f=this.frames,d=r.bones[this.boneIndex];if(d.active)if(o=f[f.length-s.ENTRIES])p=f[f.length+s.PREV_X]*d.data.scaleX,m=f[f.length+s.PREV_Y]*d.data.scaleY;else{var v=a.binarySearch(f,o,s.ENTRIES);p=f[v+s.PREV_X],m=f[v+s.PREV_Y];var g=f[v],y=this.getCurvePercent(v/s.ENTRIES-1,1-(o-g)/(f[v+s.PREV_TIME]-g));p=(p+(f[v+s.X]-p)*y)*d.data.scaleX,m=(m+(f[v+s.Y]-m)*y)*d.data.scaleY}if(1==l)u==e.add?(d.scaleX+=p-d.data.scaleX,d.scaleY+=m-d.data.scaleY):(d.scaleX=p,d.scaleY=m);else{var E=0,w=0;if(c==n.mixOut)switch(u){case e.setup:E=d.data.scaleX,w=d.data.scaleY,d.scaleX=E+(Math.abs(p)*t.MathUtils.signum(E)-E)*l,d.scaleY=w+(Math.abs(m)*t.MathUtils.signum(w)-w)*l;break;case e.first:case e.replace:E=d.scaleX,w=d.scaleY,d.scaleX=E+(Math.abs(p)*t.MathUtils.signum(E)-E)*l,d.scaleY=w+(Math.abs(m)*t.MathUtils.signum(w)-w)*l;break;case e.add:E=d.scaleX,w=d.scaleY,d.scaleX=E+(Math.abs(p)*t.MathUtils.signum(E)-d.data.scaleX)*l,d.scaleY=w+(Math.abs(m)*t.MathUtils.signum(w)-d.data.scaleY)*l}else switch(u){case e.setup:E=Math.abs(d.data.scaleX)*t.MathUtils.signum(p),w=Math.abs(d.data.scaleY)*t.MathUtils.signum(m),d.scaleX=E+(p-E)*l,d.scaleY=w+(m-w)*l;break;case e.first:case e.replace:E=Math.abs(d.scaleX)*t.MathUtils.signum(p),w=Math.abs(d.scaleY)*t.MathUtils.signum(m),d.scaleX=E+(p-E)*l,d.scaleY=w+(m-w)*l;break;case e.add:E=t.MathUtils.signum(p),w=t.MathUtils.signum(m),d.scaleX=Math.abs(d.scaleX)*E+(p-Math.abs(d.data.scaleX)*E)*l,d.scaleY=Math.abs(d.scaleY)*w+(m-Math.abs(d.data.scaleY)*w)*l}}}},s}(h);t.ScaleTimeline=l;var u=function(t){function n(e){return t.call(this,e)||this}return o(n,t),n.prototype.getPropertyId=function(){return(r.shear<<24)+this.boneIndex},n.prototype.apply=function(t,r,i,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(c.active)if(i=u[u.length-n.ENTRIES])f=u[u.length+n.PREV_X],d=u[u.length+n.PREV_Y];else{var p=a.binarySearch(u,i,n.ENTRIES);f=u[p+n.PREV_X],d=u[p+n.PREV_Y];var m=u[p],v=this.getCurvePercent(p/n.ENTRIES-1,1-(i-m)/(u[p+n.PREV_TIME]-m));f+=(u[p+n.X]-f)*v,d+=(u[p+n.Y]-d)*v}switch(h){case e.setup:c.shearX=c.data.shearX+f*s,c.shearY=c.data.shearY+d*s;break;case e.first:case e.replace:c.shearX+=(c.data.shearX+f-c.shearX)*s,c.shearY+=(c.data.shearY+d-c.shearY)*s;break;case e.add:c.shearX+=f*s,c.shearY+=d*s}}},n}(h);t.ShearTimeline=u;var c=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.color<<24)+this.slotIndex},i.prototype.setFrame=function(t,e,n,r,a,o){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.R]=n,this.frames[t+i.G]=r,this.frames[t+i.B]=a,this.frames[t+i.A]=o},i.prototype.apply=function(t,n,r,o,s,h,l){var u=t.slots[this.slotIndex];if(u.bone.active){var c=this.frames;if(r=c[c.length-i.ENTRIES]){var y=c.length;p=c[y+i.PREV_R],m=c[y+i.PREV_G],v=c[y+i.PREV_B],g=c[y+i.PREV_A]}else{var E=a.binarySearch(c,r,i.ENTRIES);p=c[E+i.PREV_R],m=c[E+i.PREV_G],v=c[E+i.PREV_B],g=c[E+i.PREV_A];var w=c[E],x=this.getCurvePercent(E/i.ENTRIES-1,1-(r-w)/(c[E+i.PREV_TIME]-w));p+=(c[E+i.R]-p)*x,m+=(c[E+i.G]-m)*x,v+=(c[E+i.B]-v)*x,g+=(c[E+i.A]-g)*x}if(1==s)u.color.set(p,m,v,g);else{f=u.color;h==e.setup&&f.setFromColor(u.data.color),f.add((p-f.r)*s,(m-f.g)*s,(v-f.b)*s,(g-f.a)*s)}}}},i.ENTRIES=5,i.PREV_TIME=-5,i.PREV_R=-4,i.PREV_G=-3,i.PREV_B=-2,i.PREV_A=-1,i.R=1,i.G=2,i.B=3,i.A=4,i}(i);t.ColorTimeline=c;var f=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.twoColor<<24)+this.slotIndex},i.prototype.setFrame=function(t,e,n,r,a,o,s,h,l){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.R]=n,this.frames[t+i.G]=r,this.frames[t+i.B]=a,this.frames[t+i.A]=o,this.frames[t+i.R2]=s,this.frames[t+i.G2]=h,this.frames[t+i.B2]=l},i.prototype.apply=function(t,n,r,o,s,h,l){var u=t.slots[this.slotIndex];if(u.bone.active){var c=this.frames;if(r=c[c.length-i.ENTRIES]){var A=c.length;v=c[A+i.PREV_R],g=c[A+i.PREV_G],y=c[A+i.PREV_B],E=c[A+i.PREV_A],w=c[A+i.PREV_R2],x=c[A+i.PREV_G2],T=c[A+i.PREV_B2]}else{var M=a.binarySearch(c,r,i.ENTRIES);v=c[M+i.PREV_R],g=c[M+i.PREV_G],y=c[M+i.PREV_B],E=c[M+i.PREV_A],w=c[M+i.PREV_R2],x=c[M+i.PREV_G2],T=c[M+i.PREV_B2];var I=c[M],b=this.getCurvePercent(M/i.ENTRIES-1,1-(r-I)/(c[M+i.PREV_TIME]-I));v+=(c[M+i.R]-v)*b,g+=(c[M+i.G]-g)*b,y+=(c[M+i.B]-y)*b,E+=(c[M+i.A]-E)*b,w+=(c[M+i.R2]-w)*b,x+=(c[M+i.G2]-x)*b,T+=(c[M+i.B2]-T)*b}if(1==s)u.color.set(v,g,y,E),u.darkColor.set(w,x,T,1);else{f=u.color,d=u.darkColor;h==e.setup&&(f.setFromColor(u.data.color),d.setFromColor(u.data.darkColor)),f.add((v-f.r)*s,(g-f.g)*s,(y-f.b)*s,(E-f.a)*s),d.add((w-d.r)*s,(x-d.g)*s,(T-d.b)*s,0)}}}},i.ENTRIES=8,i.PREV_TIME=-8,i.PREV_R=-7,i.PREV_G=-6,i.PREV_B=-5,i.PREV_A=-4,i.PREV_R2=-3,i.PREV_G2=-2,i.PREV_B2=-1,i.R=1,i.G=2,i.B=3,i.A=4,i.R2=5,i.G2=6,i.B2=7,i}(i);t.TwoColorTimeline=f;var d=function(){function i(e){this.frames=t.Utils.newFloatArray(e),this.attachmentNames=new Array(e)}return i.prototype.getPropertyId=function(){return(r.attachment<<24)+this.slotIndex},i.prototype.getFrameCount=function(){return this.frames.length},i.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n},i.prototype.apply=function(t,r,i,o,s,h,l){var u=t.slots[this.slotIndex];if(u.bone.active)if(l!=n.mixOut){var c=this.frames;if(i=c[c.length-1]?c.length-1:a.binarySearch(c,i,1)-1;var d=this.attachmentNames[f];t.slots[this.slotIndex].setAttachment(null==d?null:t.getAttachment(this.slotIndex,d))}}else h==e.setup&&this.setAttachment(t,u,u.data.attachmentName)},i.prototype.setAttachment=function(t,e,n){e.setAttachment(null==n?null:t.getAttachment(this.slotIndex,n))},i}();t.AttachmentTimeline=d;var p=null,m=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e),r.frameVertices=new Array(e),null==p&&(p=t.Utils.newFloatArray(64)),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.deform<<27)+ +this.attachment.id+this.slotIndex},i.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},i.prototype.apply=function(n,r,i,o,s,h,l){var u=n.slots[this.slotIndex];if(u.bone.active){var c=u.getAttachment();if(c instanceof t.VertexAttachment&&c.deformAttachment==this.attachment){var f=u.deform;0==f.length&&(h=e.setup);var d=this.frameVertices,p=d[0].length,m=this.frames;if(i=m[m.length-1]){var x=d[m.length-1];if(1==s)if(h==e.add)if(null==(v=c).bones){y=v.vertices;for(var T=0;Tn)this.apply(t,e,Number.MAX_VALUE,r,i,o,s),e=-1;else if(e>=h[l-1])return;if(!(n0&&h[u-1]==c;)u--;for(;u=h[u];u++)r.push(this.events[u])}}},e}();t.EventTimeline=v;var g=function(){function i(e){this.frames=t.Utils.newFloatArray(e),this.drawOrders=new Array(e)}return i.prototype.getPropertyId=function(){return r.drawOrder<<24},i.prototype.getFrameCount=function(){return this.frames.length},i.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n},i.prototype.apply=function(r,i,o,s,h,l,u){var c=r.drawOrder,f=r.slots;if(u!=n.mixOut){var d=this.frames;if(o=d[d.length-1]?d.length-1:a.binarySearch(d,o)-1;var m=this.drawOrders[p];if(null==m)t.Utils.arrayCopy(f,0,c,0,f.length);else for(var v=0,g=m.length;v=c[c.length-s.ENTRIES])l==e.setup?(f.mix=f.data.mix+(c[c.length+s.PREV_MIX]-f.data.mix)*h,f.softness=f.data.softness+(c[c.length+s.PREV_SOFTNESS]-f.data.softness)*h,u==n.mixOut?(f.bendDirection=f.data.bendDirection,f.compress=f.data.compress,f.stretch=f.data.stretch):(f.bendDirection=c[c.length+s.PREV_BEND_DIRECTION],f.compress=0!=c[c.length+s.PREV_COMPRESS],f.stretch=0!=c[c.length+s.PREV_STRETCH])):(f.mix+=(c[c.length+s.PREV_MIX]-f.mix)*h,f.softness+=(c[c.length+s.PREV_SOFTNESS]-f.softness)*h,u==n.mixIn&&(f.bendDirection=c[c.length+s.PREV_BEND_DIRECTION],f.compress=0!=c[c.length+s.PREV_COMPRESS],f.stretch=0!=c[c.length+s.PREV_STRETCH]));else{var d=a.binarySearch(c,i,s.ENTRIES),p=c[d+s.PREV_MIX],m=c[d+s.PREV_SOFTNESS],v=c[d],g=this.getCurvePercent(d/s.ENTRIES-1,1-(i-v)/(c[d+s.PREV_TIME]-v));l==e.setup?(f.mix=f.data.mix+(p+(c[d+s.MIX]-p)*g-f.data.mix)*h,f.softness=f.data.softness+(m+(c[d+s.SOFTNESS]-m)*g-f.data.softness)*h,u==n.mixOut?(f.bendDirection=f.data.bendDirection,f.compress=f.data.compress,f.stretch=f.data.stretch):(f.bendDirection=c[d+s.PREV_BEND_DIRECTION],f.compress=0!=c[d+s.PREV_COMPRESS],f.stretch=0!=c[d+s.PREV_STRETCH])):(f.mix+=(p+(c[d+s.MIX]-p)*g-f.mix)*h,f.softness+=(m+(c[d+s.SOFTNESS]-m)*g-f.softness)*h,u==n.mixIn&&(f.bendDirection=c[d+s.PREV_BEND_DIRECTION],f.compress=0!=c[d+s.PREV_COMPRESS],f.stretch=0!=c[d+s.PREV_STRETCH]))}},s.ENTRIES=6,s.PREV_TIME=-6,s.PREV_MIX=-5,s.PREV_SOFTNESS=-4,s.PREV_BEND_DIRECTION=-3,s.PREV_COMPRESS=-2,s.PREV_STRETCH=-1,s.MIX=1,s.SOFTNESS=2,s.BEND_DIRECTION=3,s.COMPRESS=4,s.STRETCH=5,s}(i);t.IkConstraintTimeline=y;var E=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.transformConstraint<<24)+this.transformConstraintIndex},i.prototype.setFrame=function(t,e,n,r,a,o){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.ROTATE]=n,this.frames[t+i.TRANSLATE]=r,this.frames[t+i.SCALE]=a,this.frames[t+i.SHEAR]=o},i.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.transformConstraints[this.transformConstraintIndex];if(c.active)if(r=u[u.length-i.ENTRIES]){var g=u.length;d=u[g+i.PREV_ROTATE],p=u[g+i.PREV_TRANSLATE],m=u[g+i.PREV_SCALE],v=u[g+i.PREV_SHEAR]}else{var y=a.binarySearch(u,r,i.ENTRIES);d=u[y+i.PREV_ROTATE],p=u[y+i.PREV_TRANSLATE],m=u[y+i.PREV_SCALE],v=u[y+i.PREV_SHEAR];var E=u[y],w=this.getCurvePercent(y/i.ENTRIES-1,1-(r-E)/(u[y+i.PREV_TIME]-E));d+=(u[y+i.ROTATE]-d)*w,p+=(u[y+i.TRANSLATE]-p)*w,m+=(u[y+i.SCALE]-m)*w,v+=(u[y+i.SHEAR]-v)*w}if(h==e.setup){f=c.data;c.rotateMix=f.rotateMix+(d-f.rotateMix)*s,c.translateMix=f.translateMix+(p-f.translateMix)*s,c.scaleMix=f.scaleMix+(m-f.scaleMix)*s,c.shearMix=f.shearMix+(v-f.shearMix)*s}else c.rotateMix+=(d-c.rotateMix)*s,c.translateMix+=(p-c.translateMix)*s,c.scaleMix+=(m-c.scaleMix)*s,c.shearMix+=(v-c.shearMix)*s}},i.ENTRIES=5,i.PREV_TIME=-5,i.PREV_ROTATE=-4,i.PREV_TRANSLATE=-3,i.PREV_SCALE=-2,i.PREV_SHEAR=-1,i.ROTATE=1,i.TRANSLATE=2,i.SCALE=3,i.SHEAR=4,i}(i);t.TransformConstraintTimeline=E;var w=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.pathConstraintPosition<<24)+this.pathConstraintIndex},i.prototype.setFrame=function(t,e,n){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.VALUE]=n},i.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(c.active)if(r=u[u.length-i.ENTRIES])f=u[u.length+i.PREV_VALUE];else{var d=a.binarySearch(u,r,i.ENTRIES);f=u[d+i.PREV_VALUE];var p=u[d],m=this.getCurvePercent(d/i.ENTRIES-1,1-(r-p)/(u[d+i.PREV_TIME]-p));f+=(u[d+i.VALUE]-f)*m}h==e.setup?c.position=c.data.position+(f-c.data.position)*s:c.position+=(f-c.position)*s}},i.ENTRIES=2,i.PREV_TIME=-2,i.PREV_VALUE=-1,i.VALUE=1,i}(i);t.PathConstraintPositionTimeline=w;var x=function(t){function n(e){return t.call(this,e)||this}return o(n,t),n.prototype.getPropertyId=function(){return(r.pathConstraintSpacing<<24)+this.pathConstraintIndex},n.prototype.apply=function(t,r,i,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(c.active)if(i=u[u.length-n.ENTRIES])f=u[u.length+n.PREV_VALUE];else{var d=a.binarySearch(u,i,n.ENTRIES);f=u[d+n.PREV_VALUE];var p=u[d],m=this.getCurvePercent(d/n.ENTRIES-1,1-(i-p)/(u[d+n.PREV_TIME]-p));f+=(u[d+n.VALUE]-f)*m}h==e.setup?c.spacing=c.data.spacing+(f-c.data.spacing)*s:c.spacing+=(f-c.spacing)*s}},n}(w);t.PathConstraintSpacingTimeline=x;var T=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.pathConstraintMix<<24)+this.pathConstraintIndex},i.prototype.setFrame=function(t,e,n,r){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.ROTATE]=n,this.frames[t+i.TRANSLATE]=r},i.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(c.active)if(r=u[u.length-i.ENTRIES])f=u[u.length+i.PREV_ROTATE],d=u[u.length+i.PREV_TRANSLATE];else{var p=a.binarySearch(u,r,i.ENTRIES);f=u[p+i.PREV_ROTATE],d=u[p+i.PREV_TRANSLATE];var m=u[p],v=this.getCurvePercent(p/i.ENTRIES-1,1-(r-m)/(u[p+i.PREV_TIME]-m));f+=(u[p+i.ROTATE]-f)*v,d+=(u[p+i.TRANSLATE]-d)*v}h==e.setup?(c.rotateMix=c.data.rotateMix+(f-c.data.rotateMix)*s,c.translateMix=c.data.translateMix+(d-c.data.translateMix)*s):(c.rotateMix+=(f-c.rotateMix)*s,c.translateMix+=(d-c.translateMix)*s)}},i.ENTRIES=3,i.PREV_TIME=-3,i.PREV_ROTATE=-2,i.PREV_TRANSLATE=-1,i.ROTATE=1,i.TRANSLATE=2,i}(i);t.PathConstraintMixTimeline=T}(a||(a={})),function(t){var e=function(){function e(e){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new a(this),this.propertyIDs=new t.IntSet,this.animationsChanged=!1,this.trackEntryPool=new t.Pool((function(){return new n})),this.data=e}return e.prototype.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var o=a.next;if(null!=o){var s=a.trackLast-o.delay;if(s>=0){for(o.delay=0,o.trackTime+=0==a.timeScale?0:(s/a.timeScale+t)*o.timeScale,a.trackTime+=i,this.setCurrent(n,o,!0);null!=o.mixingFrom;)o.mixTime+=t,o=o.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[n]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var h=a.mixingFrom;for(a.mixingFrom=null,null!=h&&(h.mixingTo=null);null!=h;)this.queue.end(h),h=h.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.prototype.updateMixingFrom=function(t,e){var n=t.mixingFrom;if(null==n)return!0;var r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,null!=n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)},e.prototype.apply=function(n){if(null==n)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var r=this.events,a=this.tracks,i=!1,o=0,s=a.length;o0)){i=!0;var l=0==o?t.MixBlend.first:h.mixBlend,u=h.alpha;null!=h.mixingFrom?u*=this.applyMixingFrom(h,n,l):h.trackTime>=h.trackEnd&&null==h.next&&(u=0);var c=h.animationLast,f=h.getAnimationTime(),d=h.animation.timelines.length,p=h.animation.timelines;if(0==o&&1==u||l==t.MixBlend.add)for(var m=0;m1&&(o=1),a!=t.MixBlend.first&&(a=i.mixBlend));var s=o0&&this.queueEvents(i,c),this.events.length=0,i.nextAnimationLast=c,i.nextTrackLast=i.trackTime,o},e.prototype.applyAttachmentTimeline=function(n,r,a,i,o){var s=r.slots[n.slotIndex];if(s.bone.active){var h,l=n.frames;if(a=l[l.length-1]?l.length-1:t.Animation.binarySearch(l,a)-1,this.setAttachment(r,s,n.attachmentNames[h],o);s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+e.SETUP)}},e.prototype.setAttachment=function(t,n,r,a){n.setAttachment(null==r?null:t.getAttachment(n.data.index,r)),a&&(n.attachmentState=this.unkeyedState+e.CURRENT)},e.prototype.applyRotateTimeline=function(e,n,r,a,i,o,s,h){if(h&&(o[s]=0),1!=a){var l=e,u=l.frames,c=n.bones[l.boneIndex];if(c.active){var f=0,d=0;if(r=u[u.length-t.RotateTimeline.ENTRIES])d=c.data.rotation+u[u.length+t.RotateTimeline.PREV_ROTATION];else{var p=t.Animation.binarySearch(u,r,t.RotateTimeline.ENTRIES),m=u[p+t.RotateTimeline.PREV_ROTATION],v=u[p],g=l.getCurvePercent((p>>1)-1,1-(r-v)/(u[p+t.RotateTimeline.PREV_TIME]-v));d=u[p+t.RotateTimeline.ROTATION]-m,d=m+(d-=360*(16384-(16384.499999999996-d/360|0)))*g+c.data.rotation,d-=360*(16384-(16384.499999999996-d/360|0))}var y=0,E=d-f;if(0==(E-=360*(16384-(16384.499999999996-E/360|0))))y=o[s];else{var w=0,x=0;h?(w=0,x=E):(w=o[s],x=o[s+1]);var T=E>0,A=w>=0;t.MathUtils.signum(x)!=t.MathUtils.signum(E)&&Math.abs(x)<=90&&(Math.abs(w)>180&&(w+=360*t.MathUtils.signum(w)),A=T),y=E+w-w%360,A!=T&&(y+=360*t.MathUtils.signum(w)),o[s]=y}o[s+1]=E,f+=y*a,c.rotation=f-360*(16384-(16384.499999999996-f/360|0))}}else e.apply(n,0,r,null,1,i,t.MixDirection.mixIn)},e.prototype.queueEvents=function(t,e){for(var n=t.animationStart,r=t.animationEnd,a=r-n,i=t.trackLast%a,o=this.events,s=0,h=o.length;sr||this.queue.event(t,l)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var n=e;;){var r=n.mixingFrom;if(null==r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.prototype.setCurrent=function(t,e,n){var r=this.expandToIndex(t);this.tracks[t]=e,null!=r&&(n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,null!=r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)},e.prototype.setAnimation=function(t,e,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,n)},e.prototype.setAnimationWith=function(t,e,n){if(null==e)throw new Error("animation cannot be null.");var r=!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,r=!1):this.disposeNext(a));var i=this.trackEntry(t,e,n,a);return this.setCurrent(t,i,r),this.queue.drain(),i},e.prototype.addAnimation=function(t,e,n,r){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,n,r)},e.prototype.addAnimationWith=function(t,e,n,r){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,n,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,r<=0){var o=a.animationEnd-a.animationStart;0!=o?(a.loop?r+=o*(1+(a.trackTime/o|0)):r+=Math.max(o,a.trackTime),r-=this.data.getMix(a.animation,e)):r=a.trackTime}return i.delay=r,i},e.prototype.setEmptyAnimation=function(t,n){var r=this.setAnimationWith(t,e.emptyAnimation,!1);return r.mixDuration=n,r.trackEnd=n,r},e.prototype.addEmptyAnimation=function(t,n,r){r<=0&&(r-=n);var a=this.addAnimationWith(t,e.emptyAnimation,!1,r);return a.mixDuration=n,a.trackEnd=n,a},e.prototype.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n0){o[l]=e.HOLD_MIX,s[l]=f;continue t}break}o[l]=e.HOLD_FIRST}else o[l]=e.SUBSEQUENT}},e.prototype.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.prototype.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.prototype.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.prototype.clearListeners=function(){this.listeners.length=0},e.prototype.clearListenerNotifications=function(){this.queue.clear()},e.emptyAnimation=new t.Animation("",[],0),e.SUBSEQUENT=0,e.FIRST=1,e.HOLD_SUBSEQUENT=2,e.HOLD_FIRST=3,e.HOLD_MIX=4,e.SETUP=1,e.CURRENT=2,e}();t.AnimationState=e;var n=function(){function e(){this.mixBlend=t.MixBlend.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}return e.prototype.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.prototype.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.prototype.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.prototype.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0},e}();t.TrackEntry=n;var r,a=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}return t.prototype.start=function(t){this.objects.push(r.start),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.interrupt=function(t){this.objects.push(r.interrupt),this.objects.push(t)},t.prototype.end=function(t){this.objects.push(r.end),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.dispose=function(t){this.objects.push(r.dispose),this.objects.push(t)},t.prototype.complete=function(t){this.objects.push(r.complete),this.objects.push(t)},t.prototype.event=function(t,e){this.objects.push(r.event),this.objects.push(t),this.objects.push(e)},t.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,n=0;n=0?e.substring(0,e.lastIndexOf("/")):"";e=this.pathPrefix+e,this.toLoad++,this.downloadText(e,(function(o){var s={count:0},h=new Array;try{new t.TextureAtlas(o,(function(e){h.push(""==i?e:i+"/"+e);var n=document.createElement("img");return n.width=16,n.height=16,new t.FakeTexture(n)}))}catch(t){var l=t;return a.errors[e]="Couldn't load texture atlas "+e+": "+l.message,r&&r(e,"Couldn't load texture atlas "+e+": "+l.message),a.toLoad--,void a.loaded++}for(var u=function(l){var u=!1;a.loadTexture(l,(function(l,c){if(s.count++,s.count==h.length)if(u)a.errors[e]="Couldn't load texture atlas page "+l+"} of atlas "+e,r&&r(e,"Couldn't load texture atlas page "+l+" of atlas "+e),a.toLoad--,a.loaded++;else try{var f=new t.TextureAtlas(o,(function(t){return a.get(""==i?t:i+"/"+t)}));a.assets[e]=f,n&&n(e,f),a.toLoad--,a.loaded++}catch(t){var d=t;a.errors[e]="Couldn't load texture atlas "+e+": "+d.message,r&&r(e,"Couldn't load texture atlas "+e+": "+d.message),a.toLoad--,a.loaded++}}),(function(t,n){u=!0,s.count++,s.count==h.length&&(a.errors[e]="Couldn't load texture atlas page "+t+"} of atlas "+e,r&&r(e,"Couldn't load texture atlas page "+t+" of atlas "+e),a.toLoad--,a.loaded++)}))},c=0,f=h;c0},e.prototype.getErrors=function(){return this.errors},e}();t.AssetManager=e}(a||(a={})),function(t){var e=function(){function e(t){this.atlas=t}return e.prototype.newRegionAttachment=function(e,n,r){var a=this.atlas.findRegion(r);if(null==a)throw new Error("Region not found in atlas: "+r+" (region attachment: "+n+")");a.renderObject=a;var i=new t.RegionAttachment(n);return i.setRegion(a),i},e.prototype.newMeshAttachment=function(e,n,r){var a=this.atlas.findRegion(r);if(null==a)throw new Error("Region not found in atlas: "+r+" (mesh attachment: "+n+")");a.renderObject=a;var i=new t.MeshAttachment(n);return i.region=a,i},e.prototype.newBoundingBoxAttachment=function(e,n){return new t.BoundingBoxAttachment(n)},e.prototype.newPathAttachment=function(e,n){return new t.PathAttachment(n)},e.prototype.newPointAttachment=function(e,n){return new t.PointAttachment(n)},e.prototype.newClippingAttachment=function(e,n){return new t.ClippingAttachment(n)},e}();t.AtlasAttachmentLoader=e}(a||(a={})),function(t){var e;(e=t.BlendMode||(t.BlendMode={}))[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen"}(a||(a={})),function(t){var e=function(){function e(t,e,n){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=n,this.setToSetupPose()}return e.prototype.isActive=function(){return this.active},e.prototype.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransformWith=function(e,n,r,a,i,o,s){this.ax=e,this.ay=n,this.arotation=r,this.ascaleX=a,this.ascaleY=i,this.ashearX=o,this.ashearY=s,this.appliedValid=!0;var h=this.parent;if(null==h){var l=this.skeleton,u=r+90+s,c=l.scaleX,f=l.scaleY;return this.a=t.MathUtils.cosDeg(r+o)*a*c,this.b=t.MathUtils.cosDeg(u)*i*c,this.c=t.MathUtils.sinDeg(r+o)*a*f,this.d=t.MathUtils.sinDeg(u)*i*f,this.worldX=e*c+l.x,void(this.worldY=n*f+l.y)}var d=h.a,p=h.b,m=h.c,v=h.d;switch(this.worldX=d*e+p*n+h.worldX,this.worldY=m*e+v*n+h.worldY,this.data.transformMode){case t.TransformMode.Normal:u=r+90+s;var g=t.MathUtils.cosDeg(r+o)*a,y=t.MathUtils.cosDeg(u)*i,E=t.MathUtils.sinDeg(r+o)*a,w=t.MathUtils.sinDeg(u)*i;return this.a=d*g+p*E,this.b=d*y+p*w,this.c=m*g+v*E,void(this.d=m*y+v*w);case t.TransformMode.OnlyTranslation:u=r+90+s;this.a=t.MathUtils.cosDeg(r+o)*a,this.b=t.MathUtils.cosDeg(u)*i,this.c=t.MathUtils.sinDeg(r+o)*a,this.d=t.MathUtils.sinDeg(u)*i;break;case t.TransformMode.NoRotationOrReflection:var x=0;(M=d*d+m*m)>1e-4?(M=Math.abs(d*v-p*m)/M,d/=this.skeleton.scaleX,p=(m/=this.skeleton.scaleY)*M,v=d*M,x=Math.atan2(m,d)*t.MathUtils.radDeg):(d=0,m=0,x=90-Math.atan2(v,p)*t.MathUtils.radDeg);var T=r+o-x,A=r+s-x+90;g=t.MathUtils.cosDeg(T)*a,y=t.MathUtils.cosDeg(A)*i,E=t.MathUtils.sinDeg(T)*a,w=t.MathUtils.sinDeg(A)*i;this.a=d*g-p*E,this.b=d*y-p*w,this.c=m*g+v*E,this.d=m*y+v*w;break;case t.TransformMode.NoScale:case t.TransformMode.NoScaleOrReflection:var M,I=t.MathUtils.cosDeg(r),b=t.MathUtils.sinDeg(r),R=(d*I+p*b)/this.skeleton.scaleX,S=(m*I+v*b)/this.skeleton.scaleY;(M=Math.sqrt(R*R+S*S))>1e-5&&(M=1/M),R*=M,S*=M,M=Math.sqrt(R*R+S*S),this.data.transformMode==t.TransformMode.NoScale&&d*v-p*m<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(M=-M);var C=Math.PI/2+Math.atan2(S,R),P=Math.cos(C)*M,k=Math.sin(C)*M;g=t.MathUtils.cosDeg(o)*a,y=t.MathUtils.cosDeg(90+s)*i,E=t.MathUtils.sinDeg(o)*a,w=t.MathUtils.sinDeg(90+s)*i;this.a=R*g+P*E,this.b=R*y+P*w,this.c=S*g+k*E,this.d=S*y+k*w}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.prototype.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.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*t.MathUtils.radDeg},e.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*t.MathUtils.radDeg},e.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var e=this.parent;if(null==e)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*t.MathUtils.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)*t.MathUtils.radDeg);var n=e.a,r=e.b,a=e.c,i=e.d,o=1/(n*i-r*a),s=this.worldX-e.worldX,h=this.worldY-e.worldY;this.ax=s*i*o-h*r*o,this.ay=h*n*o-s*a*o;var l=o*i,u=o*n,c=o*r,f=o*a,d=l*this.a-c*this.c,p=l*this.b-c*this.d,m=u*this.c-f*this.a,v=u*this.d-f*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){var g=d*v-p*m;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*p+m*v,g)*t.MathUtils.radDeg,this.arotation=Math.atan2(m,d)*t.MathUtils.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(p*p+v*v),this.ashearY=0,this.arotation=90-Math.atan2(v,p)*t.MathUtils.radDeg},e.prototype.worldToLocal=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=1/(e*a-n*r),o=t.x-this.worldX,s=t.y-this.worldY;return t.x=o*a*i-s*n*i,t.y=s*e*i-o*r*i,t},e.prototype.localToWorld=function(t){var e=t.x,n=t.y;return t.x=e*this.a+n*this.b+this.worldX,t.y=e*this.c+n*this.d+this.worldY,t},e.prototype.worldToLocalRotation=function(e){var n=t.MathUtils.sinDeg(e),r=t.MathUtils.cosDeg(e);return Math.atan2(this.a*n-this.c*r,this.d*r-this.b*n)*t.MathUtils.radDeg+this.rotation-this.shearX},e.prototype.localToWorldRotation=function(e){e-=this.rotation-this.shearX;var n=t.MathUtils.sinDeg(e),r=t.MathUtils.cosDeg(e);return Math.atan2(r*this.c+n*this.d,r*this.a+n*this.b)*t.MathUtils.radDeg},e.prototype.rotateWorld=function(e){var n=this.a,r=this.b,a=this.c,i=this.d,o=t.MathUtils.cosDeg(e),s=t.MathUtils.sinDeg(e);this.a=o*n-s*a,this.b=o*r-s*i,this.c=s*n+o*a,this.d=s*r+o*i,this.appliedValid=!1},e}();t.Bone=e}(a||(a={})),function(t){var e,n=function(n,r,a){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=e.Normal,this.skinRequired=!1,this.color=new t.Color,n<0)throw new Error("index must be >= 0.");if(null==r)throw new Error("name cannot be null.");this.index=n,this.name=r,this.parent=a};t.BoneData=n,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"}(e=t.TransformMode||(t.TransformMode={}))}(a||(a={})),function(t){var e=function(t,e,n){this.name=t,this.order=e,this.skinRequired=n};t.ConstraintData=e}(a||(a={})),function(t){var e=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e};t.Event=e}(a||(a={})),function(t){var e=function(t){this.name=t};t.EventData=e}(a||(a={})),function(t){var e=function(){function e(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 n=0;n180?d-=360:d<-180&&(d+=360);var T=e.ascaleX,A=e.ascaleY;if(a||i){switch(e.data.transformMode){case t.TransformMode.NoScale:case t.TransformMode.NoScaleOrReflection:p=n-e.worldX,m=r-e.worldY}var M=e.data.length*T,I=Math.sqrt(p*p+m*m);if(a&&IM&&M>1e-4)T*=v=(I/M-1)*s+1,o&&(A*=v)}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*s,T,A,e.ashearX,e.ashearY)},e.prototype.apply2=function(e,n,r,a,i,o,s,h){if(0!=h){e.appliedValid||e.updateAppliedTransform(),n.appliedValid||n.updateAppliedTransform();var l=e.ax,u=e.ay,c=e.ascaleX,f=c,d=e.ascaleY,p=n.ascaleX,m=0,v=0,g=0;c<0?(c=-c,m=180,g=-1):(m=0,g=1),d<0&&(d=-d,g=-g),p<0?(p=-p,v=180):v=0;var y=n.ax,E=0,w=0,x=0,T=e.a,A=e.b,M=e.c,I=e.d,b=Math.abs(c-d)<=1e-4;b?(w=T*y+A*(E=n.ay)+e.worldX,x=M*y+I*E+e.worldY):(E=0,w=T*y+e.worldX,x=M*y+e.worldY);var R=e.parent;T=R.a,A=R.b,M=R.c;var S,C,P=1/(T*(I=R.d)-A*M),k=w-R.worldX,N=x-R.worldY,_=(k*I-N*A)*P-l,V=(N*T-k*M)*P-u,L=Math.sqrt(_*_+V*V),O=n.data.length*p;if(L<1e-4)return this.apply1(e,r,a,!1,o,!1,h),void n.updateWorldTransformWith(y,E,0,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY);var F=((k=r-R.worldX)*I-(N=a-R.worldY)*A)*P-l,D=(N*T-k*M)*P-u,U=F*F+D*D;if(0!=s){s*=c*(p+1)/2;var B=Math.sqrt(U),X=B-L-O*c+s;if(X>0){var Y=Math.min(1,X/(2*s))-1;U=(F-=(Y=(X-s*(1-Y*Y))/B)*F)*F+(D-=Y*D)*D}}t:if(b){var W=(U-L*L-(O*=c)*O)/(2*L*O);W<-1?W=-1:W>1&&(W=1,o&&(f*=(Math.sqrt(U)/(L+O)-1)*h+1)),C=Math.acos(W)*i,T=L+O*W,A=O*Math.sin(C),S=Math.atan2(D*T-F*A,F*T+D*A)}else{var j=(T=c*O)*T,G=(A=d*O)*A,q=Math.atan2(D,F),H=-2*G*L,z=G-j;if((I=H*H-4*z*(M=G*L*L+j*U-j*G))>=0){var Z=Math.sqrt(I);H<0&&(Z=-Z);var $=(Z=-(H+Z)/2)/z,Q=M/Z,J=Math.abs($)=-1&&M<=1&&(M=Math.acos(M),(I=(k=T*Math.cos(M)+L)*k+(N=A*Math.sin(M))*N)it&&(rt=M,it=I,at=k,ot=N)),U<=(et+it)/2?(S=q-Math.atan2(nt*i,tt),C=K*i):(S=q-Math.atan2(ot*i,at),C=rt*i)}var st=Math.atan2(E,y)*g,ht=e.arotation;(S=(S-st)*t.MathUtils.radDeg+m-ht)>180?S-=360:S<-180&&(S+=360),e.updateWorldTransformWith(l,u,ht+S*h,f,e.ascaleY,0,0),ht=n.arotation,(C=((C+st)*t.MathUtils.radDeg-n.ashearX)*g+v-ht)>180?C-=360:C<-180&&(C+=360),n.updateWorldTransformWith(y,E,ht+C*h,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY)}else n.updateWorldTransform()},e}();t.IkConstraint=e}(a||(a={})),function(t){var e=function(t){function e(e){var n=t.call(this,e,0,!1)||this;return n.bones=new Array,n.bendDirection=1,n.compress=!1,n.stretch=!1,n.uniform=!1,n.mix=1,n.softness=0,n}return o(e,t),e}(t.ConstraintData);t.IkConstraintData=e}(a||(a={})),function(t){var e=function(){function e(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 n=0,r=t.bones.length;n0;if(a>0||i){var o=this.data,s=o.spacingMode==t.SpacingMode.Percent,h=o.rotateMode,l=h==t.RotateMode.Tangent,u=h==t.RotateMode.ChainScale,c=this.bones.length,f=l?c:c+1,d=this.bones,p=t.Utils.setArraySize(this.spaces,f),m=null,v=this.spacing;if(u||!s){u&&(m=t.Utils.setArraySize(this.lengths,c));for(var g=o.spacingMode==t.SpacingMode.Length,y=0,E=f-1;y0?t.MathUtils.degRad:-t.MathUtils.degRad;y=0;for(var P=3;yt.MathUtils.PI?B-=t.MathUtils.PI2:B<-t.MathUtils.PI&&(B+=t.MathUtils.PI2),B*=r,X=Math.cos(B),Y=Math.sin(B),k.a=X*O-Y*D,k.b=X*F-Y*U,k.c=Y*O+X*D,k.d=Y*F+X*U}k.appliedValid=!1}}}},e.prototype.computeWorldPositions=function(n,r,a,i,o){var s=this.target,h=this.position,l=this.spaces,u=t.Utils.setArraySize(this.positions,3*r+2),c=null,f=n.closed,d=n.worldVerticesLength,p=d/6,m=e.NONE;if(!n.constantSpeed){var v=n.lengths,g=v[p-=f?1:2];if(i&&(h*=g),o)for(var y=1;yg){m!=e.AFTER&&(m=e.AFTER,n.computeWorldVertices(s,d-6,4,c,0,2)),this.addAfterPosition(x-g,c,0,u,E);continue}}for(;;w++){var T=v[w];if(!(x>T)){if(0==w)x/=T;else x=(x-(Z=v[w-1]))/(T-Z);break}}w!=m&&(m=w,f&&w==p?(n.computeWorldVertices(s,d-4,4,c,0,2),n.computeWorldVertices(s,0,4,c,4,2)):n.computeWorldVertices(s,6*w+2,8,c,0,2)),this.addCurvePosition(x,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],u,E,a||y>0&&0==G)}return u}f?(d+=2,c=t.Utils.setArraySize(this.world,d),n.computeWorldVertices(s,2,d-4,c,0,2),n.computeWorldVertices(s,0,2,c,d-4,2),c[d-2]=c[0],c[d-1]=c[1]):(p--,d-=4,c=t.Utils.setArraySize(this.world,d),n.computeWorldVertices(s,2,d,c,0,2));for(var A=t.Utils.setArraySize(this.curves,p),M=0,I=c[0],b=c[1],R=0,S=0,C=0,P=0,k=0,N=0,_=0,V=0,L=0,O=0,F=0,D=0,U=0,B=0,X=(y=0,2);yM){this.addAfterPosition(x-M,c,d-4,u,E);continue}}for(;;w++){var q=A[w];if(!(x>q)){if(0==w)x/=q;else x=(x-(Z=A[w-1]))/(q-Z);break}}if(w!=m){m=w;var H=6*w;for(I=c[H],b=c[H+1],R=c[H+2],S=c[H+3],C=c[H+4],P=c[H+5],F=2*(_=.03*(I-2*R+C))+(L=.006*(3*(R-C)-I+(k=c[H+6]))),D=2*(V=.03*(b-2*S+P))+(O=.006*(3*(S-P)-b+(N=c[H+7]))),U=.3*(R-I)+_+.16666667*L,B=.3*(S-b)+V+.16666667*O,W=Math.sqrt(U*U+B*B),Y[0]=W,H=1;H<8;H++)U+=F,B+=D,F+=L,D+=O,W+=Math.sqrt(U*U+B*B),Y[H]=W;U+=F,B+=D,W+=Math.sqrt(U*U+B*B),Y[8]=W,U+=F+L,B+=D+O,W+=Math.sqrt(U*U+B*B),Y[9]=W,j=0}for(x*=W;;j++){var z=Y[j];if(!(x>z)){var Z;if(0==j)x/=z;else x=j+(x-(Z=Y[j-1]))/(z-Z);break}}this.addCurvePosition(.1*x,I,b,R,S,C,P,k,N,u,E,a||y>0&&0==G)}return u},e.prototype.addBeforePosition=function(t,e,n,r,a){var i=e[n],o=e[n+1],s=e[n+2]-i,h=e[n+3]-o,l=Math.atan2(h,s);r[a]=i+t*Math.cos(l),r[a+1]=o+t*Math.sin(l),r[a+2]=l},e.prototype.addAfterPosition=function(t,e,n,r,a){var i=e[n+2],o=e[n+3],s=i-e[n],h=o-e[n+1],l=Math.atan2(h,s);r[a]=i+t*Math.cos(l),r[a+1]=o+t*Math.sin(l),r[a+2]=l},e.prototype.addCurvePosition=function(t,e,n,r,a,i,o,s,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=n,void(l[u+2]=Math.atan2(a-n,r-e));var f=t*t,d=f*t,p=1-t,m=p*p,v=m*p,g=p*t,y=3*g,E=p*y,w=y*t,x=e*v+r*E+i*w+s*d,T=n*v+a*E+o*w+h*d;l[u]=x,l[u+1]=T,c&&(l[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(T-(n*m+a*g*2+o*f),x-(e*m+r*g*2+i*f)))},e.NONE=-1,e.BEFORE=-2,e.AFTER=-3,e.epsilon=1e-5,e}();t.PathConstraint=e}(a||(a={})),function(t){var e,n,r,a=function(t){function e(e){var n=t.call(this,e,0,!1)||this;return n.bones=new Array,n}return o(e,t),e}(t.ConstraintData);t.PathConstraintData=a,(e=t.PositionMode||(t.PositionMode={}))[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",(n=t.SpacingMode||(t.SpacingMode={}))[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",(r=t.RotateMode||(t.RotateMode={}))[r.Tangent=0]="Tangent",r[r.Chain=1]="Chain",r[r.ChainScale=2]="ChainScale"}(a||(a={})),function(t){var e=function(){function t(t){this.toLoad=new Array,this.assets={},this.clientId=t}return t.prototype.loaded=function(){var t=0;for(var e in this.assets)t++;return t},t}(),n=function(){function t(t){void 0===t&&(t=""),this.clientAssets={},this.queuedAssets={},this.rawAssets={},this.errors={},this.pathPrefix=t}return t.prototype.queueAsset=function(t,n,r){var a=this.clientAssets[t];return null==a&&(a=new e(t),this.clientAssets[t]=a),null!==n&&(a.textureLoader=n),a.toLoad.push(r),this.queuedAssets[r]!==r&&(this.queuedAssets[r]=r,!0)},t.prototype.loadText=function(t,e){var n=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?n.rawAssets[e]=r.responseText:n.errors[e]="Couldn't load text "+e+": status "+r.status+", "+r.responseText)},r.open("GET",e,!0),r.send()}},t.prototype.loadJson=function(t,e){var n=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?n.rawAssets[e]=JSON.parse(r.responseText):n.errors[e]="Couldn't load text "+e+": status "+r.status+", "+r.responseText)},r.open("GET",e,!0),r.send()}},t.prototype.loadTexture=function(t,e,n){var r=this;if(n=this.pathPrefix+n,this.queueAsset(t,e,n))if(!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)&&"undefined"!=typeof importScripts){fetch(n,{mode:"cors"}).then((function(t){return t.ok||(r.errors[n]="Couldn't load image "+n),t.blob()})).then((function(t){return createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"})})).then((function(t){r.rawAssets[n]=t}))}else{var a=new Image;a.crossOrigin="anonymous",a.onload=function(t){r.rawAssets[n]=a},a.onerror=function(t){r.errors[n]="Couldn't load image "+n},a.src=n}},t.prototype.get=function(t,e){e=this.pathPrefix+e;var n=this.clientAssets[t];return null==n||n.assets[e]},t.prototype.updateClientAssets=function(t){for(var e=!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)&&"undefined"!=typeof importScripts,n=0;n0},t.prototype.getErrors=function(){return this.errors},t}();t.SharedAssetManager=n}(a||(a={})),function(t){var e=function(){function e(e){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==e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(var n=0;n1){var i=r[r.length-1];this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}this._updateCache.push(e),this.sortReset(a.children),r[r.length-1].sorted=!0}},e.prototype.sortPathConstraint=function(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||null!=this.skin&&t.Utils.contains(this.skin.constraints,e.data,!0)),e.active){var n=e.target,r=n.data.index,a=n.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,r,a),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,a);for(var i=0,o=this.data.skins.length;i-1||this.updateCacheReset.push(i)}else for(a=0;a0){w=new t.DrawOrderTimeline(O);var F=a.slots.length;for(u=0;u=0;d--)U[d]=-1;var B=t.Utils.newArray(F-D,0),X=0,Y=0;for(d=0;d=0;d--)-1==U[d]&&(U[d]=B[--Y]);w.setFrame(u,y,U)}i.push(w),s=Math.max(s,w.frames[O-1])}var W=n.readInt(!0);if(W>0){for(w=new t.EventTimeline(W),u=0;u>>1^-(1&n)},t.prototype.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},t.prototype.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",n=0;n>4){case 12:case 13:e+=String.fromCharCode((31&r)<<6|63&this.readByte()),n+=2;break;case 14:e+=String.fromCharCode((15&r)<<12|(63&this.readByte())<<6|63&this.readByte()),n+=3;break;default:e+=String.fromCharCode(r),n++}}return e},t.prototype.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},t.prototype.readBoolean=function(){return 0!=this.readByte()},t}(),r=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},a=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e}}(a||(a={})),function(t){var e=function(){function e(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new t.Pool((function(){return t.Utils.newFloatArray(16)}))}return e.prototype.update=function(e,n){if(null==e)throw new Error("skeleton cannot be null.");var r=this.boundingBoxes,a=this.polygons,i=this.polygonPool,o=e.slots,s=o.length;r.length=0,i.freeAll(a),a.length=0;for(var h=0;h=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},e.prototype.aabbIntersectsSegment=function(t,e,n,r){var a=this.minX,i=this.minY,o=this.maxX,s=this.maxY;if(t<=a&&n<=a||e<=i&&r<=i||t>=o&&n>=o||e>=s&&r>=s)return!1;var h=(r-e)/(n-t),l=h*(a-t)+e;if(l>i&&li&&la&&ua&&ut.minX&&this.minYt.minY},e.prototype.containsPoint=function(t,e){for(var n=this.polygons,r=0,a=n.length;r=n||l=n){var u=r[s];u+(n-h)/(l-h)*(r[i]-u)=u&&E<=d||E>=d&&E<=u)&&(E>=e&&E<=r||E>=r&&E<=e)){var w=(l*g-h*m)/y;if((w>=c&&w<=p||w>=p&&w<=c)&&(w>=n&&w<=a||w>=a&&w<=n))return!0}u=d,c=p}return!1},e.prototype.getPolygon=function(t){if(null==t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},e.prototype.getWidth=function(){return this.maxX-this.minX},e.prototype.getHeight=function(){return this.maxY-this.minY},e}();t.SkeletonBounds=e}(a||(a={})),function(t){var e=function(){function e(){this.triangulator=new t.Triangulator,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}return e.prototype.clipStart=function(n,r){if(null!=this.clipAttachment)return 0;this.clipAttachment=r;var a=r.worldVerticesLength,i=t.Utils.setArraySize(this.clippingPolygon,a);r.computeWorldVertices(n,0,a,i,0,2);var o=this.clippingPolygon;e.makeClockwise(o);for(var s=this.clippingPolygons=this.triangulator.decompose(o,this.triangulator.triangulate(o)),h=0,l=s.length;h>1,U=this.clipOutput,B=t.Utils.setArraySize(u,k+D*p),X=0;X=2?(u=s,s=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(n),u.push(r),u.push(a),u.push(i),u.push(t),u.push(e),s.length=0;for(var c=o,f=o.length-4,d=0;;d+=2){for(var p=c[d],m=c[d+1],v=c[d+2],g=c[d+3],y=p-v,E=m-g,w=u,x=u.length-2,T=s.length,A=0;A0;if(y*(I-g)-E*(M-v)>0){if(S){s.push(b),s.push(R);continue}var C=(k=R-I)*(v-p)-(N=b-M)*(g-m);if(Math.abs(C)>1e-6){var P=(N*(m-I)-k*(p-M))/C;s.push(p+(v-p)*P),s.push(m+(g-m)*P)}else s.push(p),s.push(m)}else if(S){var k,N;C=(k=R-I)*(v-p)-(N=b-M)*(g-m);if(Math.abs(C)>1e-6){P=(N*(m-I)-k*(p-M))/C;s.push(p+(v-p)*P),s.push(m+(g-m)*P)}else s.push(p),s.push(m);s.push(b),s.push(R)}l=!0}if(T==s.length)return h.length=0,!0;if(s.push(s[0]),s.push(s[1]),d==f)break;var _=s;(s=u).length=0,u=_}if(h!=s){h.length=0;d=0;for(var V=s.length-2;d>1;s=0;f--)-1==G[f]&&(G[f]=H[--Z])}w.setFrame(c++,this.getValue(j,"time",0),G)}i.push(w),o=Math.max(o,w.frames[w.getFrameCount()-1])}if(e.events){for(w=new t.EventTimeline(e.events.length),c=0,f=0;f=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=n},n.prototype.addSkin=function(t){for(var e=0;e= 0.");if(null==n)throw new Error("name cannot be null.");if(null==r)throw new Error("boneData cannot be null.");this.index=e,this.name=n,this.boneData=r};t.SlotData=e}(a||(a={})),function(t){var e,n,r=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 e.Nearest;case"linear":return e.Linear;case"mipmap":return e.MipMap;case"mipmapnearestnearest":return e.MipMapNearestNearest;case"mipmaplinearnearest":return e.MipMapLinearNearest;case"mipmapnearestlinear":return e.MipMapNearestLinear;case"mipmaplinearlinear":return e.MipMapLinearLinear;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return n.MirroredRepeat;case"clamptoedge":return n.ClampToEdge;case"repeat":return n.Repeat;default:throw new Error("Unknown texture wrap "+t)}},t}();t.Texture=r,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"}(e=t.TextureFilter||(t.TextureFilter={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(n=t.TextureWrap||(t.TextureWrap={}));var a=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};t.TextureRegion=a;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.setFilters=function(t,e){},e.prototype.setWraps=function(t,e){},e.prototype.dispose=function(){},e}(r);t.FakeTexture=i}(a||(a={})),function(t){var e=function(){function e(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}return e.prototype.load=function(e,i){if(null==i)throw new Error("textureLoader cannot be null.");for(var o=new n(e),s=new Array(4),h=null;;){var l=o.readLine();if(null==l)break;if(0==(l=l.trim()).length)h=null;else if(h){var u=new a;u.name=l,u.page=h;var c=o.readValue();"true"==c.toLocaleLowerCase()?u.degrees=90:"false"==c.toLocaleLowerCase()?u.degrees=0:u.degrees=parseFloat(c),u.rotate=90==u.degrees,o.readTuple(s);var f=parseInt(s[0]),d=parseInt(s[1]);o.readTuple(s);var p=parseInt(s[0]),m=parseInt(s[1]);u.u=f/h.width,u.v=d/h.height,u.rotate?(u.u2=(f+m)/h.width,u.v2=(d+p)/h.height):(u.u2=(f+p)/h.width,u.v2=(d+m)/h.height),u.x=f,u.y=d,u.width=Math.abs(p),u.height=Math.abs(m),4==o.readTuple(s)&&4==o.readTuple(s)&&o.readTuple(s),u.originalWidth=parseInt(s[0]),u.originalHeight=parseInt(s[1]),o.readTuple(s),u.offsetX=parseInt(s[0]),u.offsetY=parseInt(s[1]),u.index=parseInt(o.readValue()),u.texture=h.texture,this.regions.push(u)}else{(h=new r).name=l,2==o.readTuple(s)&&(h.width=parseInt(s[0]),h.height=parseInt(s[1]),o.readTuple(s)),o.readTuple(s),h.minFilter=t.Texture.filterFromString(s[0]),h.magFilter=t.Texture.filterFromString(s[1]);var v=o.readValue();h.uWrap=t.TextureWrap.ClampToEdge,h.vWrap=t.TextureWrap.ClampToEdge,"x"==v?h.uWrap=t.TextureWrap.Repeat:"y"==v?h.vWrap=t.TextureWrap.Repeat:"xy"==v&&(h.uWrap=h.vWrap=t.TextureWrap.Repeat),h.texture=i(l),h.texture.setFilters(h.minFilter,h.magFilter),h.texture.setWraps(h.uWrap,h.vWrap),h.width=h.texture.getImage().width,h.height=h.texture.getImage().height,this.pages.push(h)}}},e.prototype.findRegion=function(t){for(var e=0;e=this.lines.length?null:this.lines[this.index++]},t.prototype.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},t.prototype.readTuple=function(t){var e=this.readLine(),n=e.indexOf(":");if(-1==n)throw new Error("Invalid line: "+e);for(var r=0,a=n+1;r<3;r++){var i=e.indexOf(",",a);if(-1==i)break;t[r]=e.substr(a,i-a).trim(),a=i+1}return t[r]=e.substring(a).trim(),r+1},t}(),r=function(){};t.TextureAtlasPage=r;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(t.TextureRegion);t.TextureAtlasRegion=a}(a||(a={})),function(t){var e=function(){function e(e,n){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new t.Vector2,this.active=!1,null==e)throw new Error("data cannot be null.");if(null==n)throw new Error("skeleton cannot be null.");this.data=e,this.rotateMix=e.rotateMix,this.translateMix=e.translateMix,this.scaleMix=e.scaleMix,this.shearMix=e.shearMix,this.bones=new Array;for(var r=0;r0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*u,f=this.data.offsetShearY*u,d=this.bones,p=0,m=d.length;pt.MathUtils.PI?R-=t.MathUtils.PI2:R<-t.MathUtils.PI&&(R+=t.MathUtils.PI2),R*=e;var T=Math.cos(R),A=Math.sin(R);v.a=T*y-A*w,v.b=T*E-A*x,v.c=A*y+T*w,v.d=A*E+T*x,g=!0}if(0!=n){var M=this.temp;i.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(M.x-v.worldX)*n,v.worldY+=(M.y-v.worldY)*n,g=!0}if(r>0){var I=Math.sqrt(v.a*v.a+v.c*v.c),b=Math.sqrt(o*o+h*h);I>1e-5&&(I=(I+(b-I+this.data.offsetScaleX)*r)/I),v.a*=I,v.c*=I,I=Math.sqrt(v.b*v.b+v.d*v.d),b=Math.sqrt(s*s+l*l),I>1e-5&&(I=(I+(b-I+this.data.offsetScaleY)*r)/I),v.b*=I,v.d*=I,g=!0}if(a>0){E=v.b,x=v.d;var R,S=Math.atan2(x,E);(R=Math.atan2(l,s)-Math.atan2(h,o)-(S-Math.atan2(v.c,v.a)))>t.MathUtils.PI?R-=t.MathUtils.PI2:R<-t.MathUtils.PI&&(R+=t.MathUtils.PI2),R=S+(R+f)*a;I=Math.sqrt(E*E+x*x);v.b=Math.cos(R)*I,v.d=Math.sin(R)*I,g=!0}g&&(v.appliedValid=!1)}},e.prototype.applyRelativeWorld=function(){for(var e=this.rotateMix,n=this.translateMix,r=this.scaleMix,a=this.shearMix,i=this.target,o=i.a,s=i.b,h=i.c,l=i.d,u=o*l-s*h>0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*u,f=this.data.offsetShearY*u,d=this.bones,p=0,m=d.length;pt.MathUtils.PI?b-=t.MathUtils.PI2:b<-t.MathUtils.PI&&(b+=t.MathUtils.PI2),b*=e;var T=Math.cos(b),A=Math.sin(b);v.a=T*y-A*w,v.b=T*E-A*x,v.c=A*y+T*w,v.d=A*E+T*x,g=!0}if(0!=n){var M=this.temp;i.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),v.worldX+=M.x*n,v.worldY+=M.y*n,g=!0}if(r>0){var I=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleX)*r+1;v.a*=I,v.c*=I,I=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*r+1,v.b*=I,v.d*=I,g=!0}if(a>0){var b;(b=Math.atan2(l,s)-Math.atan2(h,o))>t.MathUtils.PI?b-=t.MathUtils.PI2:b<-t.MathUtils.PI&&(b+=t.MathUtils.PI2);E=v.b,x=v.d;b=Math.atan2(x,E)+(b-t.MathUtils.PI/2+f)*a;I=Math.sqrt(E*E+x*x);v.b=Math.cos(b)*I,v.d=Math.sin(b)*I,g=!0}g&&(v.appliedValid=!1)}},e.prototype.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,o=0,s=i.length;o1e-5&&(d=(d+(a.ascaleX-d+this.data.offsetScaleX)*n)/d),p>1e-5&&(p=(p+(a.ascaleY-p+this.data.offsetScaleY)*n)/p));var m=h.ashearY;if(0!=r){u=a.ashearY-m+this.data.offsetShearY;u-=360*(16384-(16384.499999999996-u/360|0)),h.shearY+=u*r}h.updateWorldTransformWith(c,f,l,d,p,h.ashearX,m)}},e.prototype.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,o=0,s=i.length;o1e-5&&(f*=(a.ascaleX-1+this.data.offsetScaleX)*n+1),d>1e-5&&(d*=(a.ascaleY-1+this.data.offsetScaleY)*n+1));var p=h.ashearY;0!=r&&(p+=(a.ashearY+this.data.offsetShearY)*r),h.updateWorldTransformWith(u,c,l,f,d,h.ashearX,p)}},e}();t.TransformConstraint=e}(a||(a={})),function(t){var e=function(t){function e(e){var n=t.call(this,e,0,!1)||this;return n.bones=new Array,n.rotateMix=0,n.translateMix=0,n.scaleMix=0,n.shearMix=0,n.offsetRotation=0,n.offsetX=0,n.offsetY=0,n.offsetScaleX=0,n.offsetScaleY=0,n.offsetShearY=0,n.relative=!1,n.local=!1,n}return o(e,t),e}(t.ConstraintData);t.TransformConstraintData=e}(a||(a={})),function(t){var e=function(){function e(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new t.Pool((function(){return new Array})),this.polygonIndicesPool=new t.Pool((function(){return new Array}))}return e.prototype.triangulate=function(t){var n=t,r=t.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i3;){for(var l=r-1,u=(i=0,1);;){t:if(!o[i]){for(var c=a[l]<<1,f=a[i]<<1,d=a[u]<<1,p=n[c],m=n[c+1],v=n[f],g=n[f+1],y=n[d],E=n[d+1],w=(u+1)%r;w!=l;w=(w+1)%r)if(o[w]){var x=a[w]<<1,T=n[x],A=n[x+1];if(e.positiveArea(y,E,p,m,T,A)&&e.positiveArea(p,m,v,g,T,A)&&e.positiveArea(v,g,y,E,T,A))break t}break}if(0==u){do{if(!o[i])break;i--}while(i>0);break}l=i,i=u,u=(u+1)%r}h.push(a[(r+i-1)%r]),h.push(a[i]),h.push(a[(i+1)%r]),a.splice(i,1),o.splice(i,1);var M=(--r+i-1)%r,I=i==r?0:i;o[M]=e.isConcave(M,r,n,a),o[I]=e.isConcave(I,r,n,a)}return 3==r&&(h.push(a[2]),h.push(a[0]),h.push(a[1])),h},e.prototype.decompose=function(t,n){var r=t,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var o=this.polygonIndicesPool.obtain();o.length=0;var s=this.polygonPool.obtain();s.length=0;for(var h=-1,l=0,u=0,c=n.length;u0?(a.push(s),i.push(o)):(this.polygonPool.free(s),this.polygonIndicesPool.free(o)),(s=this.polygonPool.obtain()).length=0,s.push(m),s.push(v),s.push(g),s.push(y),s.push(E),s.push(w),(o=this.polygonIndicesPool.obtain()).length=0,o.push(f),o.push(d),o.push(p),l=e.winding(m,v,g,y,E,w),h=f)}s.length>0&&(a.push(s),i.push(o));for(u=0,c=a.length;u=0;u--)0==(s=a[u]).length&&(a.splice(u,1),this.polygonPool.free(s),o=i[u],i.splice(u,1),this.polygonIndicesPool.free(o));return a},e.isConcave=function(t,e,n,r){var a=r[(e+t-1)%e]<<1,i=r[t]<<1,o=r[(t+1)%e]<<1;return!this.positiveArea(n[a],n[a+1],n[i],n[i+1],n[o],n[o+1])},e.positiveArea=function(t,e,n,r,a,i){return t*(i-r)+n*(e-i)+a*(r-e)>=0},e.winding=function(t,e,n,r,a,i){var o=n-t,s=r-e;return a*s-i*o+o*e-t*s>=0?1:-1},e}();t.Triangulator=e}(a||(a={})),function(t){var e=function(){function t(){this.array=new Array}return t.prototype.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},t.prototype.contains=function(t){return null!=this.array[0|t]},t.prototype.remove=function(t){this.array[0|t]=void 0},t.prototype.clear=function(){this.array.length=0},t}();t.IntSet=e;var n=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=n,this.a=r}return t.prototype.set=function(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this.clamp(),this},t.prototype.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.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},t.prototype.add=function(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,this.a+=r,this.clamp(),this},t.prototype.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.WHITE=new t(1,1,1,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.MAGENTA=new t(1,0,1,1),t}();t.Color=n;var r=function(){function t(){}return t.clamp=function(t,e,n){return tn?n: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,n){return t.randomTriangularWith(e,n,.5*(e+n))},t.randomTriangularWith=function(t,e,n){var r=Math.random(),a=e-t;return r<=(n-t)/a?t+Math.sqrt(r*a*(n-t)):e-Math.sqrt((1-r)*a*(e-n))},t.PI=3.1415927,t.PI2=2*t.PI,t.radiansToDegrees=180/t.PI,t.radDeg=t.radiansToDegrees,t.degreesToRadians=t.PI/180,t.degRad=t.degreesToRadians,t}();t.MathUtils=r;var a=function(){function t(){}return t.prototype.apply=function(t,e,n){return t+(e-t)*this.applyInternal(n)},t}();t.Interpolation=a;var i=function(t){function e(e){var n=t.call(this)||this;return n.power=2,n.power=e,n}return o(e,t),e.prototype.applyInternal=function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1},e}(a);t.Pow=i;var s=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e}(i);t.PowOut=s;var h=function(){function t(){}return t.arrayCopy=function(t,e,n,r,a){for(var i=e,o=r;i=n?e:t.setArraySize(e,n,r)},t.newArray=function(t,e){for(var n=new Array(t),r=0;r0?this.items.pop():this.instantiator()},t.prototype.free=function(t){t.reset&&t.reset(),this.items.push(t)},t.prototype.freeAll=function(t){for(var e=0;ethis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)},t}();t.TimeKeeper=f;var d=function(){function t(t){void 0===t&&(t=32),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}return t.prototype.hasEnoughData=function(){return this.addedValues>=this.values.length},t.prototype.addValue=function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0},t.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*i;var o=t.bone.skeleton,s=t.deform,h=this.vertices,l=this.bones;if(null!=l){for(var u=0,c=0,f=0;f0&&(h=s);for(var w,x=(w=t.bone).worldX,T=w.worldY,A=w.a,M=w.b,I=w.c,b=w.d,R=e,S=a;S)?=?)"),d("XRANGEIDENTIFIERLOOSE","".concat(h[l.NUMERICIDENTIFIERLOOSE],"|x|X|\\*")),d("XRANGEIDENTIFIER","".concat(h[l.NUMERICIDENTIFIER],"|x|X|\\*")),d("XRANGEPLAIN","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:".concat(h[l.PRERELEASE],")?").concat(h[l.BUILD],"?")+")?)?"),d("XRANGEPLAINLOOSE","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:".concat(h[l.PRERELEASELOOSE],")?").concat(h[l.BUILD],"?")+")?)?"),d("XRANGE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAIN],"$")),d("XRANGELOOSE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAINLOOSE],"$")),d("COERCE","".concat("(^|[^\\d])(\\d{1,").concat(n,"})")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:$|[^\\d])"),d("COERCERTL",h[l.COERCE],!0),d("LONETILDE","(?:~>?)"),d("TILDETRIM","(\\s*)".concat(h[l.LONETILDE],"\\s+"),!0),e.tildeTrimReplace="$1~",d("TILDE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAIN],"$")),d("TILDELOOSE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAINLOOSE],"$")),d("LONECARET","(?:\\^)"),d("CARETTRIM","(\\s*)".concat(h[l.LONECARET],"\\s+"),!0),e.caretTrimReplace="$1^",d("CARET","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAIN],"$")),d("CARETLOOSE","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAINLOOSE],"$")),d("COMPARATORLOOSE","^".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],")$|^$")),d("COMPARATOR","^".concat(h[l.GTLT],"\\s*(").concat(h[l.FULLPLAIN],")$|^$")),d("COMPARATORTRIM","(\\s*)".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],"|").concat(h[l.XRANGEPLAIN],")"),!0),e.comparatorTrimReplace="$1$2$3",d("HYPHENRANGE","^\\s*(".concat(h[l.XRANGEPLAIN],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAIN],")")+"\\s*$"),d("HYPHENRANGELOOSE","^\\s*(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s*$"),d("STAR","(<|>)?=?\\s*\\*"),d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),d("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(_,_.exports);var V=_.exports;S(V);var L=Object.freeze({loose:!0}),O=Object.freeze({}),F=function(t){return t?"object"!==h(t)?L:t:O};S(F);var D=/^[0-9]+$/,U=function(t,e){var n=D.test(t),r=D.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:tY)throw new TypeError("version is longer than ".concat(Y," characters"));X("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;var r=e.trim().match(n.loose?j[G.LOOSE]:j[G.FULL]);if(!r)throw new TypeError("Invalid Version: ".concat(e));if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>W||this.major<0)throw new TypeError("Invalid major version");if(this.minor>W||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>W||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e=0;)"number"==typeof this.prerelease[a]&&(this.prerelease[a]++,a=-2);if(-1===a){if(e===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(r)}}if(e){var i=[e,r];!1===n&&(i=[e]),0===H(this.prerelease[0],e)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break;default:throw new Error("invalid increment argument: ".concat(t))}return this.raw=this.format(),this.build.length&&(this.raw+="+".concat(this.build.join("."))),this}}]),t}(),Z=z;S(Z);var $=Z,Q=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t instanceof $)return t;try{return new $(t,e)}catch(t){if(!n)return null;throw t}};S(Q);var J,K,tt=Q,et=S((function(t,e){var n=tt(t,e);return n?n.version:null})),nt=Z,rt=Q,at=V.safeRe,it=V.t,ot=S((function(t,e){if(t instanceof nt)return t;if("number"==typeof t&&(t=String(t)),"string"!=typeof t)return null;var n=null;if((e=e||{}).rtl){for(var r;(r=at[it.COERCERTL].exec(t))&&(!n||n.index+n[0].length!==t.length);)n&&r.index+r[0].length===n.index+n[0].length||(n=r),at[it.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;at[it.COERCERTL].lastIndex=-1}else n=t.match(at[it.COERCE]);return null===n?null:rt("".concat(n[2],".").concat(n[3]||"0",".").concat(n[4]||"0"),e)}));var st=ht;function ht(t){var e=this;if(e instanceof ht||(e=new ht),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var n=0,r=arguments.length;n1)n=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var a=0;null!==r;a++)n=t(n,r.value,a),r=r.next;return n},ht.prototype.reduceReverse=function(t,e){var n,r=this.tail;if(arguments.length>1)n=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var a=this.length-1;null!==r;a--)n=t(n,r.value,a),r=r.prev;return n},ht.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;null!==n;e++)t[e]=n.value,n=n.next;return t},ht.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;null!==n;e++)t[e]=n.value,n=n.prev;return t},ht.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var n=new ht;if(ethis.length&&(e=this.length);for(var r=0,a=this.head;null!==a&&rthis.length&&(e=this.length);for(var r=this.length,a=this.tail;null!==a&&r>e;r--)a=a.prev;for(;null!==a&&r>t;r--,a=a.prev)n.push(a.value);return n},ht.prototype.splice=function(t,e){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,r=this.head;null!==r&&nthis[pt])return Ct(this,this[Tt].get(t)),!1;var i=this[Tt].get(t).value;return this[Et]&&(this[wt]||this[Et](t,i.value)),i.now=r,i.maxAge=n,i.value=e,this[mt]+=a-i.length,i.length=a,this.get(t),St(this),!0}var o=new Pt(t,e,a,r,n);return o.length>this[pt]?(this[Et]&&this[Et](t,e),!1):(this[mt]+=o.length,this[xt].unshift(o),this[Tt].set(t,this[xt].head),St(this),!0)}},{key:"has",value:function(t){if(!this[Tt].has(t))return!1;var e=this[Tt].get(t).value;return!Rt(this,e)}},{key:"get",value:function(t){return bt(this,t,!0)}},{key:"peek",value:function(t){return bt(this,t,!1)}},{key:"pop",value:function(){var t=this[xt].tail;return t?(Ct(this,t),t.value):null}},{key:"del",value:function(t){Ct(this,this[Tt].get(t))}},{key:"load",value:function(t){this.reset();for(var e=Date.now(),n=t.length-1;n>=0;n--){var r=t[n],a=r.e||0;if(0===a)this.set(r.k,r.v);else{var i=a-e;i>0&&this.set(r.k,r.v,i)}}}},{key:"prune",value:function(){var t=this;this[Tt].forEach((function(e,n){return bt(t,n,!1)}))}}]),t}(),bt=function(t,e,n){var r=t[Tt].get(e);if(r){var a=r.value;if(Rt(t,a)){if(Ct(t,r),!t[gt])return}else n&&(t[At]&&(r.value.now=Date.now()),t[xt].unshiftNode(r));return a.value}},Rt=function(t,e){if(!e||!e.maxAge&&!t[yt])return!1;var n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[yt]&&n>t[yt]},St=function(t){if(t[mt]>t[pt])for(var e=t[xt].tail;t[mt]>t[pt]&&null!==e;){var n=e.prev;Ct(t,e),e=n}},Ct=function(t,e){if(e){var n=e.value;t[Et]&&t[Et](n.key,n.value),t[mt]-=n.length,t[Tt].delete(n.key),t[xt].removeNode(e)}},Pt=c((function t(e,n,r,a,i){l(this,t),this.key=e,this.value=n,this.length=r,this.now=a,this.maxAge=i||0})),kt=function(t,e,n,r){var a=n.value;Rt(t,a)&&(Ct(t,n),t[gt]||(a=void 0)),a&&e.call(r,a.value,a.key,t)},Nt=It;S(Nt);var _t=Z,Vt=function(t,e,n){return new _t(t,n).compare(new _t(e,n))};S(Vt);var Lt=Vt,Ot=function(t,e,n){return 0===Lt(t,e,n)};S(Ot);var Ft=Vt,Dt=function(t,e,n){return 0!==Ft(t,e,n)};S(Dt);var Ut=Vt,Bt=function(t,e,n){return Ut(t,e,n)>0};S(Bt);var Xt=Vt,Yt=function(t,e,n){return Xt(t,e,n)>=0};S(Yt);var Wt=Vt,jt=function(t,e,n){return Wt(t,e,n)<0};S(jt);var Gt=Vt,qt=function(t,e,n){return Gt(t,e,n)<=0};S(qt);var Ht,zt,Zt,$t,Qt=Ot,Jt=Dt,Kt=Bt,te=Yt,ee=jt,ne=qt,re=function(t,e,n,r){switch(e){case"===":return"object"===h(t)&&(t=t.version),"object"===h(n)&&(n=n.version),t===n;case"!==":return"object"===h(t)&&(t=t.version),"object"===h(n)&&(n=n.version),t!==n;case"":case"=":case"==":return Qt(t,n,r);case"!=":return Jt(t,n,r);case">":return Kt(t,n,r);case">=":return te(t,n,r);case"<":return ee(t,n,r);case"<=":return ne(t,n,r);default:throw new TypeError("Invalid operator: ".concat(e))}};function ae(){if($t)return Zt;$t=1;var t=function(){function t(e,a){var i=this;if(l(this,t),a=n(a),e instanceof t)return e.loose===!!a.loose&&e.includePrerelease===!!a.includePrerelease?e:new t(e.raw,a);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((function(t){return i.parseRange(t.trim())})).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: ".concat(this.raw));if(this.set.length>1){var o=this.set[0];if(this.set=this.set.filter((function(t){return!m(t[0])})),0===this.set.length)this.set=[o];else if(this.set.length>1){var s,h=A(this.set);try{for(h.s();!(s=h.n()).done;){var u=s.value;if(1===u.length&&v(u[0])){this.set=[u];break}}}catch(t){h.e(t)}finally{h.f()}}}this.format()}return c(t,[{key:"format",value:function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range}},{key:"toString",value:function(){return this.range}},{key:"parseRange",value:function(t){var n=this,i=((this.options.includePrerelease&&d)|(this.options.loose&&p))+":"+t,l=e.get(i);if(l)return l;var c=this.options.loose,v=c?o[s.HYPHENRANGELOOSE]:o[s.HYPHENRANGE];t=t.replace(v,k(this.options.includePrerelease)),a("hyphen replace",t),t=t.replace(o[s.COMPARATORTRIM],h),a("comparator trim",t),t=t.replace(o[s.TILDETRIM],u),a("tilde trim",t),t=t.replace(o[s.CARETTRIM],f),a("caret trim",t);var g=t.split(" ").map((function(t){return y(t,n.options)})).join(" ").split(/\s+/).map((function(t){return P(t,n.options)}));c&&(g=g.filter((function(t){return a("loose invalid filter",t,n.options),!!t.match(o[s.COMPARATORLOOSE])}))),a("range list",g);var E,x=new Map,T=g.map((function(t){return new r(t,n.options)})),M=A(T);try{for(M.s();!(E=M.n()).done;){var I=E.value;if(m(I))return[I];x.set(I.value,I)}}catch(t){M.e(t)}finally{M.f()}x.size>1&&x.has("")&&x.delete("");var b=w(x.values());return e.set(i,b),b}},{key:"intersects",value:function(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((function(t){return g(t,n)&&e.set.some((function(e){return g(e,n)&&t.every((function(t){return e.every((function(e){return t.intersects(e,n)}))}))}))}))}},{key:"test",value:function(t){if(!t)return!1;if("string"==typeof t)try{t=new i(t,this.options)}catch(t){return!1}for(var e=0;e")||!t.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!t.operator.startsWith("<"))&&(this.semver.version!==t.semver.version||!this.operator.includes("=")||!t.operator.includes("="))&&!(i(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<"))&&!(i(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}}],[{key:"ANY",get:function(){return t}}]),e}();Ht=e;var n=F,r=V.safeRe,a=V.t,i=re,o=N,s=Z,h=ae();return Ht}(),a=N,i=Z,o=V.safeRe,s=V.t,h=V.comparatorTrimReplace,u=V.tildeTrimReplace,f=V.caretTrimReplace,d=C.FLAG_INCLUDE_PRERELEASE,p=C.FLAG_LOOSE,m=function(t){return"<0.0.0-0"===t.value},v=function(t){return""===t.value},g=function(t,e){for(var n=!0,r=t.slice(),a=r.pop();n&&r.length;)n=r.every((function(t){return a.intersects(t,e)})),a=r.pop();return n},y=function(t,e){return a("comp",t,e),t=M(t,e),a("caret",t),t=x(t,e),a("tildes",t),t=b(t,e),a("xrange",t),t=S(t,e),a("stars",t),t},E=function(t){return!t||"x"===t.toLowerCase()||"*"===t},x=function(t,e){return t.trim().split(/\s+/).map((function(t){return T(t,e)})).join(" ")},T=function(t,e){var n=e.loose?o[s.TILDELOOSE]:o[s.TILDE];return t.replace(n,(function(e,n,r,i,o){var s;return a("tilde",t,e,n,r,i,o),E(n)?s="":E(r)?s=">=".concat(n,".0.0 <").concat(+n+1,".0.0-0"):E(i)?s=">=".concat(n,".").concat(r,".0 <").concat(n,".").concat(+r+1,".0-0"):o?(a("replaceTilde pr",o),s=">=".concat(n,".").concat(r,".").concat(i,"-").concat(o," <").concat(n,".").concat(+r+1,".0-0")):s=">=".concat(n,".").concat(r,".").concat(i," <").concat(n,".").concat(+r+1,".0-0"),a("tilde return",s),s}))},M=function(t,e){return t.trim().split(/\s+/).map((function(t){return I(t,e)})).join(" ")},I=function(t,e){a("caret",t,e);var n=e.loose?o[s.CARETLOOSE]:o[s.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(function(e,n,i,o,s){var h;return a("caret",t,e,n,i,o,s),E(n)?h="":E(i)?h=">=".concat(n,".0.0").concat(r," <").concat(+n+1,".0.0-0"):E(o)?h="0"===n?">=".concat(n,".").concat(i,".0").concat(r," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".0").concat(r," <").concat(+n+1,".0.0-0"):s?(a("replaceCaret pr",s),h="0"===n?"0"===i?">=".concat(n,".").concat(i,".").concat(o,"-").concat(s," <").concat(n,".").concat(i,".").concat(+o+1,"-0"):">=".concat(n,".").concat(i,".").concat(o,"-").concat(s," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".").concat(o,"-").concat(s," <").concat(+n+1,".0.0-0")):(a("no pr"),h="0"===n?"0"===i?">=".concat(n,".").concat(i,".").concat(o).concat(r," <").concat(n,".").concat(i,".").concat(+o+1,"-0"):">=".concat(n,".").concat(i,".").concat(o).concat(r," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".").concat(o," <").concat(+n+1,".0.0-0")),a("caret return",h),h}))},b=function(t,e){return a("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return R(t,e)})).join(" ")},R=function(t,e){t=t.trim();var n=e.loose?o[s.XRANGELOOSE]:o[s.XRANGE];return t.replace(n,(function(n,r,i,o,s,h){a("xRange",t,n,r,i,o,s,h);var l=E(i),u=l||E(o),c=u||E(s),f=c;return"="===r&&f&&(r=""),h=e.includePrerelease?"-0":"",l?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&f?(u&&(o=0),s=0,">"===r?(r=">=",u?(i=+i+1,o=0,s=0):(o=+o+1,s=0)):"<="===r&&(r="<",u?i=+i+1:o=+o+1),"<"===r&&(h="-0"),n="".concat(r+i,".").concat(o,".").concat(s).concat(h)):u?n=">=".concat(i,".0.0").concat(h," <").concat(+i+1,".0.0-0"):c&&(n=">=".concat(i,".").concat(o,".0").concat(h," <").concat(i,".").concat(+o+1,".0-0")),a("xRange return",n),n}))},S=function(t,e){return a("replaceStars",t,e),t.trim().replace(o[s.STAR],"")},P=function(t,e){return a("replaceGTE0",t,e),t.trim().replace(o[e.includePrerelease?s.GTE0PRE:s.GTE0],"")},k=function(t){return function(e,n,r,a,i,o,s,h,l,u,c,f,d){return n=E(r)?"":E(a)?">=".concat(r,".0.0").concat(t?"-0":""):E(i)?">=".concat(r,".").concat(a,".0").concat(t?"-0":""):o?">=".concat(n):">=".concat(n).concat(t?"-0":""),h=E(l)?"":E(u)?"<".concat(+l+1,".0.0-0"):E(c)?"<".concat(l,".").concat(+u+1,".0-0"):f?"<=".concat(l,".").concat(u,".").concat(c,"-").concat(f):t?"<".concat(l,".").concat(u,".").concat(+c+1,"-0"):"<=".concat(h),"".concat(n," ").concat(h).trim()}},_=function(t,e,n){for(var i=0;i0){var s=t[o].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0};return Zt}S(re);var ie,oe,se=ae(),he=function(t,e,n){try{e=new se(e,n)}catch(t){return!1}return e.test(t)},le={valid:et,coerce:ot,satisfies:S(he),SEMVER_SPEC_VERSION:P.SEMVER_SPEC_VERSION},ue=0,ce=1,fe=2,de=[0,1,2,2,3,0],pe=function(){function t(e,n,r,o){var s;if(l(this,t),f(this,"autoUpdate",!0),f(this,"skeleton",void 0),f(this,"states",void 0),this._app=e,this._position=new i.Vec3,1===a.TextureAtlas.length){var h,u=A((s=new a.TextureAtlas(n)).pages);try{for(u.s();!(h=u.n()).done;){var c=h.value;c.setTexture(new R(o[c.name]))}}catch(t){u.e(t)}finally{u.f()}}else s=new a.TextureAtlas(n,(function(t){return new R(o[t])}));var d=new a.SkeletonJson(new a.AtlasAttachmentLoader(s));d.scale*=.01;var p=d.readSkeletonData(r);this.skeletonVersion=le.valid(le.coerce(p.version)),this._spine_3_6_0=le.satisfies(this.skeletonVersion,"<=3.6.0"),this._spine_3_7_99=le.satisfies(this.skeletonVersion,"<=3.7.99"),this._spine_4_1_X=le.satisfies(this.skeletonVersion,"~4.1.23"),this.skeleton=new a.Skeleton(p),this.skeleton.updateWorldTransform(),this.stateData=new a.AnimationStateData(this.skeleton.data),this.states=[new a.AnimationState(this.stateData)],this.clipper=new a.SkeletonClipping,this._node=new i.GraphNode,this._meshes=[],this._meshInstances=[],this._materials={},this._tint={},this._aabb=new i.BoundingBox,this._aabbTempArray=[],this._aabbTempOffset=new i.Vec2,this._aabbTempSize=new i.Vec2,this._renderCounts={vertexCount:0,indexCount:0},this._vertexFormat=null,this._vertexBuffer=null,this._indexBuffer=null,this._priority=0,this._timeScale=1,this._layers=[i.LAYERID_UI],this.init(),this._hidden=!1}return c(t,[{key:"destroy",value:function(){this.removeFromLayers();for(var t=0;t0&&this._renderCounts.vertexCount>0){this.skeleton.getBounds(this._aabbTempOffset,this._aabbTempSize,this._aabbTempArray),this._aabb.center=new i.Vec3(this._aabbTempOffset.x,this._aabbTempOffset.y,0),this._aabb.halfExtents=new i.Vec3(.5*this._aabbTempSize.x,.5*this._aabbTempSize.y,0),(!this._vertexBuffer||this._vertexBuffer.getNumVertices()0&&c.indices.length>0){t&&t!==c.material&&(this.SubmitBatch(e,n,t),t=c.material,e=o,n=0),t=c.material;var f=c.positions,d=c.vertexColor.r,p=c.vertexColor.g,m=c.vertexColor.b,v=c.vertexColor.a,g=c.uvs,y=void 0,E=f.length/2;for(y=0;y0){var r=new i.Mesh(this._app.graphicsDevice);r.vertexBuffer=this._vertexBuffer,r.indexBuffer[0]=this._indexBuffer,r.primitive[0].type=i.PRIMITIVE_TRIANGLES,r.primitive[0].base=t,r.primitive[0].count=e,r.primitive[0].indexed=!0,r.aabb=this._aabb,this._meshes.push(r);var a=new i.MeshInstance(r,this._materials[n],this._node);a.drawOrder=this.priority+this._meshInstances.length,a.visible=!this._hidden,this._meshInstances.push(a)}}},{key:"update",value:function(t){if(!this._hidden){var e;t*=this._timeScale;var n=this.states.length;for(e=0;e=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return a("end");if(o.tryLoc<=this.prev){var h=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(h&&l){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;P(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,i=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function M(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}!function(t){var e,n,r,a=function(){function t(t,e,n){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 r=0;r0&&(e%=this.duration));for(var h=this.timelines,l=0,u=h.length;l>>1;;){if(t[(i+1)*n]<=e?r=i+1:a=i,r==a)return(r+1)*n;i=r+a>>>1}},t.linearSearch=function(t,e,n){for(var r=0,a=t.length-n;r<=a;r+=n)if(t[r]>e)return r;return-1},t}();t.Animation=a,function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(e=t.MixBlend||(t.MixBlend={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(n=t.MixDirection||(t.MixDirection={})),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"}(r=t.TimelineType||(t.TimelineType={}));var i=function(){function e(n){if(n<=0)throw new Error("frameCount must be > 0: "+n);this.curves=t.Utils.newFloatArray((n-1)*e.BEZIER_SIZE)}return e.prototype.getFrameCount=function(){return this.curves.length/e.BEZIER_SIZE+1},e.prototype.setLinear=function(t){this.curves[t*e.BEZIER_SIZE]=e.LINEAR},e.prototype.setStepped=function(t){this.curves[t*e.BEZIER_SIZE]=e.STEPPED},e.prototype.getCurveType=function(t){var n=t*e.BEZIER_SIZE;if(n==this.curves.length)return e.LINEAR;var r=this.curves[n];return r==e.LINEAR?e.LINEAR:r==e.STEPPED?e.STEPPED:e.BEZIER},e.prototype.setCurve=function(t,n,r,a,i){var o=.03*(2*-n+a),s=.03*(2*-r+i),h=.006*(3*(n-a)+1),l=.006*(3*(r-i)+1),u=2*o+h,c=2*s+l,f=.3*n+o+.16666667*h,d=.3*r+s+.16666667*l,p=t*e.BEZIER_SIZE,m=this.curves;m[p++]=e.BEZIER;for(var v=f,g=d,y=p+e.BEZIER_SIZE-1;p=r){var u=void 0,c=void 0;return i==h?(u=0,c=0):(u=a[i-2],c=a[i-1]),c+(a[i+1]-c)*(r-u)/(s-u)}var f=a[i-1];return f+(1-f)*(r-s)/(1-s)},e.LINEAR=0,e.STEPPED=1,e.BEZIER=2,e.BEZIER_SIZE=19,e}();t.CurveTimeline=i;var s=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e<<1),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.rotate<<24)+this.boneIndex},i.prototype.setFrame=function(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+i.ROTATION]=n},i.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(c.active)if(r=u[u.length-i.ENTRIES]){var d=u[u.length+i.PREV_ROTATION];switch(h){case e.setup:c.rotation=c.data.rotation+d*s;break;case e.first:case e.replace:d+=c.data.rotation-c.rotation,d-=360*(16384-(16384.499999999996-d/360|0));case e.add:c.rotation+=d*s}}else{var p=a.binarySearch(u,r,i.ENTRIES),m=u[p+i.PREV_ROTATION],v=u[p],g=this.getCurvePercent((p>>1)-1,1-(r-v)/(u[p+i.PREV_TIME]-v)),y=u[p+i.ROTATION]-m;switch(y=m+(y-360*(16384-(16384.499999999996-y/360|0)))*g,h){case e.setup:c.rotation=c.data.rotation+(y-360*(16384-(16384.499999999996-y/360|0)))*s;break;case e.first:case e.replace:y+=c.data.rotation-c.rotation;case e.add:c.rotation+=(y-360*(16384-(16384.499999999996-y/360|0)))*s}}},i.ENTRIES=2,i.PREV_TIME=-2,i.PREV_ROTATION=-1,i.ROTATION=1,i}(i);t.RotateTimeline=s;var h=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.translate<<24)+this.boneIndex},i.prototype.setFrame=function(t,e,n,r){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.X]=n,this.frames[t+i.Y]=r},i.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(c.active)if(r=u[u.length-i.ENTRIES])f=u[u.length+i.PREV_X],d=u[u.length+i.PREV_Y];else{var p=a.binarySearch(u,r,i.ENTRIES);f=u[p+i.PREV_X],d=u[p+i.PREV_Y];var m=u[p],v=this.getCurvePercent(p/i.ENTRIES-1,1-(r-m)/(u[p+i.PREV_TIME]-m));f+=(u[p+i.X]-f)*v,d+=(u[p+i.Y]-d)*v}switch(h){case e.setup:c.x=c.data.x+f*s,c.y=c.data.y+d*s;break;case e.first:case e.replace:c.x+=(c.data.x+f-c.x)*s,c.y+=(c.data.y+d-c.y)*s;break;case e.add:c.x+=f*s,c.y+=d*s}}},i.ENTRIES=3,i.PREV_TIME=-3,i.PREV_X=-2,i.PREV_Y=-1,i.X=1,i.Y=2,i}(i);t.TranslateTimeline=h;var l=function(i){function s(t){return i.call(this,t)||this}return o(s,i),s.prototype.getPropertyId=function(){return(r.scale<<24)+this.boneIndex},s.prototype.apply=function(r,i,o,h,l,u,c){var f=this.frames,d=r.bones[this.boneIndex];if(d.active)if(o=f[f.length-s.ENTRIES])p=f[f.length+s.PREV_X]*d.data.scaleX,m=f[f.length+s.PREV_Y]*d.data.scaleY;else{var v=a.binarySearch(f,o,s.ENTRIES);p=f[v+s.PREV_X],m=f[v+s.PREV_Y];var g=f[v],y=this.getCurvePercent(v/s.ENTRIES-1,1-(o-g)/(f[v+s.PREV_TIME]-g));p=(p+(f[v+s.X]-p)*y)*d.data.scaleX,m=(m+(f[v+s.Y]-m)*y)*d.data.scaleY}if(1==l)u==e.add?(d.scaleX+=p-d.data.scaleX,d.scaleY+=m-d.data.scaleY):(d.scaleX=p,d.scaleY=m);else{var E=0,w=0;if(c==n.mixOut)switch(u){case e.setup:E=d.data.scaleX,w=d.data.scaleY,d.scaleX=E+(Math.abs(p)*t.MathUtils.signum(E)-E)*l,d.scaleY=w+(Math.abs(m)*t.MathUtils.signum(w)-w)*l;break;case e.first:case e.replace:E=d.scaleX,w=d.scaleY,d.scaleX=E+(Math.abs(p)*t.MathUtils.signum(E)-E)*l,d.scaleY=w+(Math.abs(m)*t.MathUtils.signum(w)-w)*l;break;case e.add:E=d.scaleX,w=d.scaleY,d.scaleX=E+(Math.abs(p)*t.MathUtils.signum(E)-d.data.scaleX)*l,d.scaleY=w+(Math.abs(m)*t.MathUtils.signum(w)-d.data.scaleY)*l}else switch(u){case e.setup:E=Math.abs(d.data.scaleX)*t.MathUtils.signum(p),w=Math.abs(d.data.scaleY)*t.MathUtils.signum(m),d.scaleX=E+(p-E)*l,d.scaleY=w+(m-w)*l;break;case e.first:case e.replace:E=Math.abs(d.scaleX)*t.MathUtils.signum(p),w=Math.abs(d.scaleY)*t.MathUtils.signum(m),d.scaleX=E+(p-E)*l,d.scaleY=w+(m-w)*l;break;case e.add:E=t.MathUtils.signum(p),w=t.MathUtils.signum(m),d.scaleX=Math.abs(d.scaleX)*E+(p-Math.abs(d.data.scaleX)*E)*l,d.scaleY=Math.abs(d.scaleY)*w+(m-Math.abs(d.data.scaleY)*w)*l}}}},s}(h);t.ScaleTimeline=l;var u=function(t){function n(e){return t.call(this,e)||this}return o(n,t),n.prototype.getPropertyId=function(){return(r.shear<<24)+this.boneIndex},n.prototype.apply=function(t,r,i,o,s,h,l){var u=this.frames,c=t.bones[this.boneIndex];if(c.active)if(i=u[u.length-n.ENTRIES])f=u[u.length+n.PREV_X],d=u[u.length+n.PREV_Y];else{var p=a.binarySearch(u,i,n.ENTRIES);f=u[p+n.PREV_X],d=u[p+n.PREV_Y];var m=u[p],v=this.getCurvePercent(p/n.ENTRIES-1,1-(i-m)/(u[p+n.PREV_TIME]-m));f+=(u[p+n.X]-f)*v,d+=(u[p+n.Y]-d)*v}switch(h){case e.setup:c.shearX=c.data.shearX+f*s,c.shearY=c.data.shearY+d*s;break;case e.first:case e.replace:c.shearX+=(c.data.shearX+f-c.shearX)*s,c.shearY+=(c.data.shearY+d-c.shearY)*s;break;case e.add:c.shearX+=f*s,c.shearY+=d*s}}},n}(h);t.ShearTimeline=u;var c=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.color<<24)+this.slotIndex},i.prototype.setFrame=function(t,e,n,r,a,o){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.R]=n,this.frames[t+i.G]=r,this.frames[t+i.B]=a,this.frames[t+i.A]=o},i.prototype.apply=function(t,n,r,o,s,h,l){var u=t.slots[this.slotIndex];if(u.bone.active){var c=this.frames;if(r=c[c.length-i.ENTRIES]){var y=c.length;p=c[y+i.PREV_R],m=c[y+i.PREV_G],v=c[y+i.PREV_B],g=c[y+i.PREV_A]}else{var E=a.binarySearch(c,r,i.ENTRIES);p=c[E+i.PREV_R],m=c[E+i.PREV_G],v=c[E+i.PREV_B],g=c[E+i.PREV_A];var w=c[E],x=this.getCurvePercent(E/i.ENTRIES-1,1-(r-w)/(c[E+i.PREV_TIME]-w));p+=(c[E+i.R]-p)*x,m+=(c[E+i.G]-m)*x,v+=(c[E+i.B]-v)*x,g+=(c[E+i.A]-g)*x}if(1==s)u.color.set(p,m,v,g);else{f=u.color;h==e.setup&&f.setFromColor(u.data.color),f.add((p-f.r)*s,(m-f.g)*s,(v-f.b)*s,(g-f.a)*s)}}}},i.ENTRIES=5,i.PREV_TIME=-5,i.PREV_R=-4,i.PREV_G=-3,i.PREV_B=-2,i.PREV_A=-1,i.R=1,i.G=2,i.B=3,i.A=4,i}(i);t.ColorTimeline=c;var f=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.twoColor<<24)+this.slotIndex},i.prototype.setFrame=function(t,e,n,r,a,o,s,h,l){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.R]=n,this.frames[t+i.G]=r,this.frames[t+i.B]=a,this.frames[t+i.A]=o,this.frames[t+i.R2]=s,this.frames[t+i.G2]=h,this.frames[t+i.B2]=l},i.prototype.apply=function(t,n,r,o,s,h,l){var u=t.slots[this.slotIndex];if(u.bone.active){var c=this.frames;if(r=c[c.length-i.ENTRIES]){var A=c.length;v=c[A+i.PREV_R],g=c[A+i.PREV_G],y=c[A+i.PREV_B],E=c[A+i.PREV_A],w=c[A+i.PREV_R2],x=c[A+i.PREV_G2],T=c[A+i.PREV_B2]}else{var M=a.binarySearch(c,r,i.ENTRIES);v=c[M+i.PREV_R],g=c[M+i.PREV_G],y=c[M+i.PREV_B],E=c[M+i.PREV_A],w=c[M+i.PREV_R2],x=c[M+i.PREV_G2],T=c[M+i.PREV_B2];var I=c[M],b=this.getCurvePercent(M/i.ENTRIES-1,1-(r-I)/(c[M+i.PREV_TIME]-I));v+=(c[M+i.R]-v)*b,g+=(c[M+i.G]-g)*b,y+=(c[M+i.B]-y)*b,E+=(c[M+i.A]-E)*b,w+=(c[M+i.R2]-w)*b,x+=(c[M+i.G2]-x)*b,T+=(c[M+i.B2]-T)*b}if(1==s)u.color.set(v,g,y,E),u.darkColor.set(w,x,T,1);else{f=u.color,d=u.darkColor;h==e.setup&&(f.setFromColor(u.data.color),d.setFromColor(u.data.darkColor)),f.add((v-f.r)*s,(g-f.g)*s,(y-f.b)*s,(E-f.a)*s),d.add((w-d.r)*s,(x-d.g)*s,(T-d.b)*s,0)}}}},i.ENTRIES=8,i.PREV_TIME=-8,i.PREV_R=-7,i.PREV_G=-6,i.PREV_B=-5,i.PREV_A=-4,i.PREV_R2=-3,i.PREV_G2=-2,i.PREV_B2=-1,i.R=1,i.G=2,i.B=3,i.A=4,i.R2=5,i.G2=6,i.B2=7,i}(i);t.TwoColorTimeline=f;var d=function(){function i(e){this.frames=t.Utils.newFloatArray(e),this.attachmentNames=new Array(e)}return i.prototype.getPropertyId=function(){return(r.attachment<<24)+this.slotIndex},i.prototype.getFrameCount=function(){return this.frames.length},i.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.attachmentNames[t]=n},i.prototype.apply=function(t,r,i,o,s,h,l){var u=t.slots[this.slotIndex];if(u.bone.active)if(l!=n.mixOut){var c=this.frames;if(i=c[c.length-1]?c.length-1:a.binarySearch(c,i,1)-1;var d=this.attachmentNames[f];t.slots[this.slotIndex].setAttachment(null==d?null:t.getAttachment(this.slotIndex,d))}}else h==e.setup&&this.setAttachment(t,u,u.data.attachmentName)},i.prototype.setAttachment=function(t,e,n){e.setAttachment(null==n?null:t.getAttachment(this.slotIndex,n))},i}();t.AttachmentTimeline=d;var p=null,m=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e),r.frameVertices=new Array(e),null==p&&(p=t.Utils.newFloatArray(64)),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.deform<<27)+ +this.attachment.id+this.slotIndex},i.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.frameVertices[t]=n},i.prototype.apply=function(n,r,i,o,s,h,l){var u=n.slots[this.slotIndex];if(u.bone.active){var c=u.getAttachment();if(c instanceof t.VertexAttachment&&c.deformAttachment==this.attachment){var f=u.deform;0==f.length&&(h=e.setup);var d=this.frameVertices,p=d[0].length,m=this.frames;if(i=m[m.length-1]){var x=d[m.length-1];if(1==s)if(h==e.add)if(null==(v=c).bones){y=v.vertices;for(var T=0;Tn)this.apply(t,e,Number.MAX_VALUE,r,i,o,s),e=-1;else if(e>=h[l-1])return;if(!(n0&&h[u-1]==c;)u--;for(;u=h[u];u++)r.push(this.events[u])}}},e}();t.EventTimeline=v;var g=function(){function i(e){this.frames=t.Utils.newFloatArray(e),this.drawOrders=new Array(e)}return i.prototype.getPropertyId=function(){return r.drawOrder<<24},i.prototype.getFrameCount=function(){return this.frames.length},i.prototype.setFrame=function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n},i.prototype.apply=function(r,i,o,s,h,l,u){var c=r.drawOrder,f=r.slots;if(u!=n.mixOut){var d=this.frames;if(o=d[d.length-1]?d.length-1:a.binarySearch(d,o)-1;var m=this.drawOrders[p];if(null==m)t.Utils.arrayCopy(f,0,c,0,f.length);else for(var v=0,g=m.length;v=c[c.length-s.ENTRIES])l==e.setup?(f.mix=f.data.mix+(c[c.length+s.PREV_MIX]-f.data.mix)*h,f.softness=f.data.softness+(c[c.length+s.PREV_SOFTNESS]-f.data.softness)*h,u==n.mixOut?(f.bendDirection=f.data.bendDirection,f.compress=f.data.compress,f.stretch=f.data.stretch):(f.bendDirection=c[c.length+s.PREV_BEND_DIRECTION],f.compress=0!=c[c.length+s.PREV_COMPRESS],f.stretch=0!=c[c.length+s.PREV_STRETCH])):(f.mix+=(c[c.length+s.PREV_MIX]-f.mix)*h,f.softness+=(c[c.length+s.PREV_SOFTNESS]-f.softness)*h,u==n.mixIn&&(f.bendDirection=c[c.length+s.PREV_BEND_DIRECTION],f.compress=0!=c[c.length+s.PREV_COMPRESS],f.stretch=0!=c[c.length+s.PREV_STRETCH]));else{var d=a.binarySearch(c,i,s.ENTRIES),p=c[d+s.PREV_MIX],m=c[d+s.PREV_SOFTNESS],v=c[d],g=this.getCurvePercent(d/s.ENTRIES-1,1-(i-v)/(c[d+s.PREV_TIME]-v));l==e.setup?(f.mix=f.data.mix+(p+(c[d+s.MIX]-p)*g-f.data.mix)*h,f.softness=f.data.softness+(m+(c[d+s.SOFTNESS]-m)*g-f.data.softness)*h,u==n.mixOut?(f.bendDirection=f.data.bendDirection,f.compress=f.data.compress,f.stretch=f.data.stretch):(f.bendDirection=c[d+s.PREV_BEND_DIRECTION],f.compress=0!=c[d+s.PREV_COMPRESS],f.stretch=0!=c[d+s.PREV_STRETCH])):(f.mix+=(p+(c[d+s.MIX]-p)*g-f.mix)*h,f.softness+=(m+(c[d+s.SOFTNESS]-m)*g-f.softness)*h,u==n.mixIn&&(f.bendDirection=c[d+s.PREV_BEND_DIRECTION],f.compress=0!=c[d+s.PREV_COMPRESS],f.stretch=0!=c[d+s.PREV_STRETCH]))}},s.ENTRIES=6,s.PREV_TIME=-6,s.PREV_MIX=-5,s.PREV_SOFTNESS=-4,s.PREV_BEND_DIRECTION=-3,s.PREV_COMPRESS=-2,s.PREV_STRETCH=-1,s.MIX=1,s.SOFTNESS=2,s.BEND_DIRECTION=3,s.COMPRESS=4,s.STRETCH=5,s}(i);t.IkConstraintTimeline=y;var E=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.transformConstraint<<24)+this.transformConstraintIndex},i.prototype.setFrame=function(t,e,n,r,a,o){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.ROTATE]=n,this.frames[t+i.TRANSLATE]=r,this.frames[t+i.SCALE]=a,this.frames[t+i.SHEAR]=o},i.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.transformConstraints[this.transformConstraintIndex];if(c.active)if(r=u[u.length-i.ENTRIES]){var g=u.length;d=u[g+i.PREV_ROTATE],p=u[g+i.PREV_TRANSLATE],m=u[g+i.PREV_SCALE],v=u[g+i.PREV_SHEAR]}else{var y=a.binarySearch(u,r,i.ENTRIES);d=u[y+i.PREV_ROTATE],p=u[y+i.PREV_TRANSLATE],m=u[y+i.PREV_SCALE],v=u[y+i.PREV_SHEAR];var E=u[y],w=this.getCurvePercent(y/i.ENTRIES-1,1-(r-E)/(u[y+i.PREV_TIME]-E));d+=(u[y+i.ROTATE]-d)*w,p+=(u[y+i.TRANSLATE]-p)*w,m+=(u[y+i.SCALE]-m)*w,v+=(u[y+i.SHEAR]-v)*w}if(h==e.setup){f=c.data;c.rotateMix=f.rotateMix+(d-f.rotateMix)*s,c.translateMix=f.translateMix+(p-f.translateMix)*s,c.scaleMix=f.scaleMix+(m-f.scaleMix)*s,c.shearMix=f.shearMix+(v-f.shearMix)*s}else c.rotateMix+=(d-c.rotateMix)*s,c.translateMix+=(p-c.translateMix)*s,c.scaleMix+=(m-c.scaleMix)*s,c.shearMix+=(v-c.shearMix)*s}},i.ENTRIES=5,i.PREV_TIME=-5,i.PREV_ROTATE=-4,i.PREV_TRANSLATE=-3,i.PREV_SCALE=-2,i.PREV_SHEAR=-1,i.ROTATE=1,i.TRANSLATE=2,i.SCALE=3,i.SHEAR=4,i}(i);t.TransformConstraintTimeline=E;var w=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.pathConstraintPosition<<24)+this.pathConstraintIndex},i.prototype.setFrame=function(t,e,n){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.VALUE]=n},i.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(c.active)if(r=u[u.length-i.ENTRIES])f=u[u.length+i.PREV_VALUE];else{var d=a.binarySearch(u,r,i.ENTRIES);f=u[d+i.PREV_VALUE];var p=u[d],m=this.getCurvePercent(d/i.ENTRIES-1,1-(r-p)/(u[d+i.PREV_TIME]-p));f+=(u[d+i.VALUE]-f)*m}h==e.setup?c.position=c.data.position+(f-c.data.position)*s:c.position+=(f-c.position)*s}},i.ENTRIES=2,i.PREV_TIME=-2,i.PREV_VALUE=-1,i.VALUE=1,i}(i);t.PathConstraintPositionTimeline=w;var x=function(t){function n(e){return t.call(this,e)||this}return o(n,t),n.prototype.getPropertyId=function(){return(r.pathConstraintSpacing<<24)+this.pathConstraintIndex},n.prototype.apply=function(t,r,i,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(c.active)if(i=u[u.length-n.ENTRIES])f=u[u.length+n.PREV_VALUE];else{var d=a.binarySearch(u,i,n.ENTRIES);f=u[d+n.PREV_VALUE];var p=u[d],m=this.getCurvePercent(d/n.ENTRIES-1,1-(i-p)/(u[d+n.PREV_TIME]-p));f+=(u[d+n.VALUE]-f)*m}h==e.setup?c.spacing=c.data.spacing+(f-c.data.spacing)*s:c.spacing+=(f-c.spacing)*s}},n}(w);t.PathConstraintSpacingTimeline=x;var T=function(n){function i(e){var r=n.call(this,e)||this;return r.frames=t.Utils.newFloatArray(e*i.ENTRIES),r}return o(i,n),i.prototype.getPropertyId=function(){return(r.pathConstraintMix<<24)+this.pathConstraintIndex},i.prototype.setFrame=function(t,e,n,r){t*=i.ENTRIES,this.frames[t]=e,this.frames[t+i.ROTATE]=n,this.frames[t+i.TRANSLATE]=r},i.prototype.apply=function(t,n,r,o,s,h,l){var u=this.frames,c=t.pathConstraints[this.pathConstraintIndex];if(c.active)if(r=u[u.length-i.ENTRIES])f=u[u.length+i.PREV_ROTATE],d=u[u.length+i.PREV_TRANSLATE];else{var p=a.binarySearch(u,r,i.ENTRIES);f=u[p+i.PREV_ROTATE],d=u[p+i.PREV_TRANSLATE];var m=u[p],v=this.getCurvePercent(p/i.ENTRIES-1,1-(r-m)/(u[p+i.PREV_TIME]-m));f+=(u[p+i.ROTATE]-f)*v,d+=(u[p+i.TRANSLATE]-d)*v}h==e.setup?(c.rotateMix=c.data.rotateMix+(f-c.data.rotateMix)*s,c.translateMix=c.data.translateMix+(d-c.data.translateMix)*s):(c.rotateMix+=(f-c.rotateMix)*s,c.translateMix+=(d-c.translateMix)*s)}},i.ENTRIES=3,i.PREV_TIME=-3,i.PREV_ROTATE=-2,i.PREV_TRANSLATE=-1,i.ROTATE=1,i.TRANSLATE=2,i}(i);t.PathConstraintMixTimeline=T}(a||(a={})),function(t){var e=function(){function e(e){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new a(this),this.propertyIDs=new t.IntSet,this.animationsChanged=!1,this.trackEntryPool=new t.Pool((function(){return new n})),this.data=e}return e.prototype.update=function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var o=a.next;if(null!=o){var s=a.trackLast-o.delay;if(s>=0){for(o.delay=0,o.trackTime+=0==a.timeScale?0:(s/a.timeScale+t)*o.timeScale,a.trackTime+=i,this.setCurrent(n,o,!0);null!=o.mixingFrom;)o.mixTime+=t,o=o.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&null==a.mixingFrom){e[n]=null,this.queue.end(a),this.disposeNext(a);continue}if(null!=a.mixingFrom&&this.updateMixingFrom(a,t)){var h=a.mixingFrom;for(a.mixingFrom=null,null!=h&&(h.mixingTo=null);null!=h;)this.queue.end(h),h=h.mixingFrom}a.trackTime+=i}}this.queue.drain()},e.prototype.updateMixingFrom=function(t,e){var n=t.mixingFrom;if(null==n)return!0;var r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,null!=n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)},e.prototype.apply=function(n){if(null==n)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var r=this.events,a=this.tracks,i=!1,o=0,s=a.length;o0)){i=!0;var l=0==o?t.MixBlend.first:h.mixBlend,u=h.alpha;null!=h.mixingFrom?u*=this.applyMixingFrom(h,n,l):h.trackTime>=h.trackEnd&&null==h.next&&(u=0);var c=h.animationLast,f=h.getAnimationTime(),d=h.animation.timelines.length,p=h.animation.timelines;if(0==o&&1==u||l==t.MixBlend.add)for(var m=0;m1&&(o=1),a!=t.MixBlend.first&&(a=i.mixBlend));var s=o0&&this.queueEvents(i,c),this.events.length=0,i.nextAnimationLast=c,i.nextTrackLast=i.trackTime,o},e.prototype.applyAttachmentTimeline=function(n,r,a,i,o){var s=r.slots[n.slotIndex];if(s.bone.active){var h,l=n.frames;if(a=l[l.length-1]?l.length-1:t.Animation.binarySearch(l,a)-1,this.setAttachment(r,s,n.attachmentNames[h],o);s.attachmentState<=this.unkeyedState&&(s.attachmentState=this.unkeyedState+e.SETUP)}},e.prototype.setAttachment=function(t,n,r,a){n.setAttachment(null==r?null:t.getAttachment(n.data.index,r)),a&&(n.attachmentState=this.unkeyedState+e.CURRENT)},e.prototype.applyRotateTimeline=function(e,n,r,a,i,o,s,h){if(h&&(o[s]=0),1!=a){var l=e,u=l.frames,c=n.bones[l.boneIndex];if(c.active){var f=0,d=0;if(r=u[u.length-t.RotateTimeline.ENTRIES])d=c.data.rotation+u[u.length+t.RotateTimeline.PREV_ROTATION];else{var p=t.Animation.binarySearch(u,r,t.RotateTimeline.ENTRIES),m=u[p+t.RotateTimeline.PREV_ROTATION],v=u[p],g=l.getCurvePercent((p>>1)-1,1-(r-v)/(u[p+t.RotateTimeline.PREV_TIME]-v));d=u[p+t.RotateTimeline.ROTATION]-m,d=m+(d-=360*(16384-(16384.499999999996-d/360|0)))*g+c.data.rotation,d-=360*(16384-(16384.499999999996-d/360|0))}var y=0,E=d-f;if(0==(E-=360*(16384-(16384.499999999996-E/360|0))))y=o[s];else{var w=0,x=0;h?(w=0,x=E):(w=o[s],x=o[s+1]);var T=E>0,A=w>=0;t.MathUtils.signum(x)!=t.MathUtils.signum(E)&&Math.abs(x)<=90&&(Math.abs(w)>180&&(w+=360*t.MathUtils.signum(w)),A=T),y=E+w-w%360,A!=T&&(y+=360*t.MathUtils.signum(w)),o[s]=y}o[s+1]=E,f+=y*a,c.rotation=f-360*(16384-(16384.499999999996-f/360|0))}}else e.apply(n,0,r,null,1,i,t.MixDirection.mixIn)},e.prototype.queueEvents=function(t,e){for(var n=t.animationStart,r=t.animationEnd,a=r-n,i=t.trackLast%a,o=this.events,s=0,h=o.length;sr||this.queue.event(t,l)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var n=e;;){var r=n.mixingFrom;if(null==r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.prototype.setCurrent=function(t,e,n){var r=this.expandToIndex(t);this.tracks[t]=e,null!=r&&(n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,null!=r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)},e.prototype.setAnimation=function(t,e,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,n)},e.prototype.setAnimationWith=function(t,e,n){if(null==e)throw new Error("animation cannot be null.");var r=!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,r=!1):this.disposeNext(a));var i=this.trackEntry(t,e,n,a);return this.setCurrent(t,i,r),this.queue.drain(),i},e.prototype.addAnimation=function(t,e,n,r){var a=this.data.skeletonData.findAnimation(e);if(null==a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,n,r)},e.prototype.addAnimationWith=function(t,e,n,r){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,n,a);if(null==a)this.setCurrent(t,i,!0),this.queue.drain();else if(a.next=i,r<=0){var o=a.animationEnd-a.animationStart;0!=o?(a.loop?r+=o*(1+(a.trackTime/o|0)):r+=Math.max(o,a.trackTime),r-=this.data.getMix(a.animation,e)):r=a.trackTime}return i.delay=r,i},e.prototype.setEmptyAnimation=function(t,n){var r=this.setAnimationWith(t,e.emptyAnimation,!1);return r.mixDuration=n,r.trackEnd=n,r},e.prototype.addEmptyAnimation=function(t,n,r){r<=0&&(r-=n);var a=this.addAnimationWith(t,e.emptyAnimation,!1,r);return a.mixDuration=n,a.trackEnd=n,a},e.prototype.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n0){o[l]=e.HOLD_MIX,s[l]=f;continue t}break}o[l]=e.HOLD_FIRST}else o[l]=e.SUBSEQUENT}},e.prototype.getCurrent=function(t){return t>=this.tracks.length?null:this.tracks[t]},e.prototype.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.prototype.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.prototype.clearListeners=function(){this.listeners.length=0},e.prototype.clearListenerNotifications=function(){this.queue.clear()},e.emptyAnimation=new t.Animation("",[],0),e.SUBSEQUENT=0,e.FIRST=1,e.HOLD_SUBSEQUENT=2,e.HOLD_FIRST=3,e.HOLD_MIX=4,e.SETUP=1,e.CURRENT=2,e}();t.AnimationState=e;var n=function(){function e(){this.mixBlend=t.MixBlend.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}return e.prototype.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.prototype.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.prototype.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.prototype.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0},e}();t.TrackEntry=n;var r,a=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}return t.prototype.start=function(t){this.objects.push(r.start),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.interrupt=function(t){this.objects.push(r.interrupt),this.objects.push(t)},t.prototype.end=function(t){this.objects.push(r.end),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.dispose=function(t){this.objects.push(r.dispose),this.objects.push(t)},t.prototype.complete=function(t){this.objects.push(r.complete),this.objects.push(t)},t.prototype.event=function(t,e){this.objects.push(r.event),this.objects.push(t),this.objects.push(e)},t.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,n=0;n=0?e.substring(0,e.lastIndexOf("/")):"";e=this.pathPrefix+e,this.toLoad++,this.downloadText(e,(function(o){var s={count:0},h=new Array;try{new t.TextureAtlas(o,(function(e){h.push(""==i?e:i+"/"+e);var n=document.createElement("img");return n.width=16,n.height=16,new t.FakeTexture(n)}))}catch(t){var l=t;return a.errors[e]="Couldn't load texture atlas "+e+": "+l.message,r&&r(e,"Couldn't load texture atlas "+e+": "+l.message),a.toLoad--,void a.loaded++}for(var u=function(l){var u=!1;a.loadTexture(l,(function(l,c){if(s.count++,s.count==h.length)if(u)a.errors[e]="Couldn't load texture atlas page "+l+"} of atlas "+e,r&&r(e,"Couldn't load texture atlas page "+l+" of atlas "+e),a.toLoad--,a.loaded++;else try{var f=new t.TextureAtlas(o,(function(t){return a.get(""==i?t:i+"/"+t)}));a.assets[e]=f,n&&n(e,f),a.toLoad--,a.loaded++}catch(t){var d=t;a.errors[e]="Couldn't load texture atlas "+e+": "+d.message,r&&r(e,"Couldn't load texture atlas "+e+": "+d.message),a.toLoad--,a.loaded++}}),(function(t,n){u=!0,s.count++,s.count==h.length&&(a.errors[e]="Couldn't load texture atlas page "+t+"} of atlas "+e,r&&r(e,"Couldn't load texture atlas page "+t+" of atlas "+e),a.toLoad--,a.loaded++)}))},c=0,f=h;c0},e.prototype.getErrors=function(){return this.errors},e}();t.AssetManager=e}(a||(a={})),function(t){var e=function(){function e(t){this.atlas=t}return e.prototype.newRegionAttachment=function(e,n,r){var a=this.atlas.findRegion(r);if(null==a)throw new Error("Region not found in atlas: "+r+" (region attachment: "+n+")");a.renderObject=a;var i=new t.RegionAttachment(n);return i.setRegion(a),i},e.prototype.newMeshAttachment=function(e,n,r){var a=this.atlas.findRegion(r);if(null==a)throw new Error("Region not found in atlas: "+r+" (mesh attachment: "+n+")");a.renderObject=a;var i=new t.MeshAttachment(n);return i.region=a,i},e.prototype.newBoundingBoxAttachment=function(e,n){return new t.BoundingBoxAttachment(n)},e.prototype.newPathAttachment=function(e,n){return new t.PathAttachment(n)},e.prototype.newPointAttachment=function(e,n){return new t.PointAttachment(n)},e.prototype.newClippingAttachment=function(e,n){return new t.ClippingAttachment(n)},e}();t.AtlasAttachmentLoader=e}(a||(a={})),function(t){var e;(e=t.BlendMode||(t.BlendMode={}))[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen"}(a||(a={})),function(t){var e=function(){function e(t,e,n){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=n,this.setToSetupPose()}return e.prototype.isActive=function(){return this.active},e.prototype.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransformWith=function(e,n,r,a,i,o,s){this.ax=e,this.ay=n,this.arotation=r,this.ascaleX=a,this.ascaleY=i,this.ashearX=o,this.ashearY=s,this.appliedValid=!0;var h=this.parent;if(null==h){var l=this.skeleton,u=r+90+s,c=l.scaleX,f=l.scaleY;return this.a=t.MathUtils.cosDeg(r+o)*a*c,this.b=t.MathUtils.cosDeg(u)*i*c,this.c=t.MathUtils.sinDeg(r+o)*a*f,this.d=t.MathUtils.sinDeg(u)*i*f,this.worldX=e*c+l.x,void(this.worldY=n*f+l.y)}var d=h.a,p=h.b,m=h.c,v=h.d;switch(this.worldX=d*e+p*n+h.worldX,this.worldY=m*e+v*n+h.worldY,this.data.transformMode){case t.TransformMode.Normal:u=r+90+s;var g=t.MathUtils.cosDeg(r+o)*a,y=t.MathUtils.cosDeg(u)*i,E=t.MathUtils.sinDeg(r+o)*a,w=t.MathUtils.sinDeg(u)*i;return this.a=d*g+p*E,this.b=d*y+p*w,this.c=m*g+v*E,void(this.d=m*y+v*w);case t.TransformMode.OnlyTranslation:u=r+90+s;this.a=t.MathUtils.cosDeg(r+o)*a,this.b=t.MathUtils.cosDeg(u)*i,this.c=t.MathUtils.sinDeg(r+o)*a,this.d=t.MathUtils.sinDeg(u)*i;break;case t.TransformMode.NoRotationOrReflection:var x=0;(M=d*d+m*m)>1e-4?(M=Math.abs(d*v-p*m)/M,d/=this.skeleton.scaleX,p=(m/=this.skeleton.scaleY)*M,v=d*M,x=Math.atan2(m,d)*t.MathUtils.radDeg):(d=0,m=0,x=90-Math.atan2(v,p)*t.MathUtils.radDeg);var T=r+o-x,A=r+s-x+90;g=t.MathUtils.cosDeg(T)*a,y=t.MathUtils.cosDeg(A)*i,E=t.MathUtils.sinDeg(T)*a,w=t.MathUtils.sinDeg(A)*i;this.a=d*g-p*E,this.b=d*y-p*w,this.c=m*g+v*E,this.d=m*y+v*w;break;case t.TransformMode.NoScale:case t.TransformMode.NoScaleOrReflection:var M,I=t.MathUtils.cosDeg(r),b=t.MathUtils.sinDeg(r),R=(d*I+p*b)/this.skeleton.scaleX,S=(m*I+v*b)/this.skeleton.scaleY;(M=Math.sqrt(R*R+S*S))>1e-5&&(M=1/M),R*=M,S*=M,M=Math.sqrt(R*R+S*S),this.data.transformMode==t.TransformMode.NoScale&&d*v-p*m<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(M=-M);var C=Math.PI/2+Math.atan2(S,R),P=Math.cos(C)*M,k=Math.sin(C)*M;g=t.MathUtils.cosDeg(o)*a,y=t.MathUtils.cosDeg(90+s)*i,E=t.MathUtils.sinDeg(o)*a,w=t.MathUtils.sinDeg(90+s)*i;this.a=R*g+P*E,this.b=R*y+P*w,this.c=S*g+k*E,this.d=S*y+k*w}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.prototype.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.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*t.MathUtils.radDeg},e.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*t.MathUtils.radDeg},e.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var e=this.parent;if(null==e)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*t.MathUtils.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)*t.MathUtils.radDeg);var n=e.a,r=e.b,a=e.c,i=e.d,o=1/(n*i-r*a),s=this.worldX-e.worldX,h=this.worldY-e.worldY;this.ax=s*i*o-h*r*o,this.ay=h*n*o-s*a*o;var l=o*i,u=o*n,c=o*r,f=o*a,d=l*this.a-c*this.c,p=l*this.b-c*this.d,m=u*this.c-f*this.a,v=u*this.d-f*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+m*m),this.ascaleX>1e-4){var g=d*v-p*m;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(d*p+m*v,g)*t.MathUtils.radDeg,this.arotation=Math.atan2(m,d)*t.MathUtils.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(p*p+v*v),this.ashearY=0,this.arotation=90-Math.atan2(v,p)*t.MathUtils.radDeg},e.prototype.worldToLocal=function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=1/(e*a-n*r),o=t.x-this.worldX,s=t.y-this.worldY;return t.x=o*a*i-s*n*i,t.y=s*e*i-o*r*i,t},e.prototype.localToWorld=function(t){var e=t.x,n=t.y;return t.x=e*this.a+n*this.b+this.worldX,t.y=e*this.c+n*this.d+this.worldY,t},e.prototype.worldToLocalRotation=function(e){var n=t.MathUtils.sinDeg(e),r=t.MathUtils.cosDeg(e);return Math.atan2(this.a*n-this.c*r,this.d*r-this.b*n)*t.MathUtils.radDeg+this.rotation-this.shearX},e.prototype.localToWorldRotation=function(e){e-=this.rotation-this.shearX;var n=t.MathUtils.sinDeg(e),r=t.MathUtils.cosDeg(e);return Math.atan2(r*this.c+n*this.d,r*this.a+n*this.b)*t.MathUtils.radDeg},e.prototype.rotateWorld=function(e){var n=this.a,r=this.b,a=this.c,i=this.d,o=t.MathUtils.cosDeg(e),s=t.MathUtils.sinDeg(e);this.a=o*n-s*a,this.b=o*r-s*i,this.c=s*n+o*a,this.d=s*r+o*i,this.appliedValid=!1},e}();t.Bone=e}(a||(a={})),function(t){var e,n=function(n,r,a){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=e.Normal,this.skinRequired=!1,this.color=new t.Color,n<0)throw new Error("index must be >= 0.");if(null==r)throw new Error("name cannot be null.");this.index=n,this.name=r,this.parent=a};t.BoneData=n,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"}(e=t.TransformMode||(t.TransformMode={}))}(a||(a={})),function(t){var e=function(t,e,n){this.name=t,this.order=e,this.skinRequired=n};t.ConstraintData=e}(a||(a={})),function(t){var e=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e};t.Event=e}(a||(a={})),function(t){var e=function(t){this.name=t};t.EventData=e}(a||(a={})),function(t){var e=function(){function e(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 n=0;n180?d-=360:d<-180&&(d+=360);var T=e.ascaleX,A=e.ascaleY;if(a||i){switch(e.data.transformMode){case t.TransformMode.NoScale:case t.TransformMode.NoScaleOrReflection:p=n-e.worldX,m=r-e.worldY}var M=e.data.length*T,I=Math.sqrt(p*p+m*m);if(a&&IM&&M>1e-4)T*=v=(I/M-1)*s+1,o&&(A*=v)}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*s,T,A,e.ashearX,e.ashearY)},e.prototype.apply2=function(e,n,r,a,i,o,s,h){if(0!=h){e.appliedValid||e.updateAppliedTransform(),n.appliedValid||n.updateAppliedTransform();var l=e.ax,u=e.ay,c=e.ascaleX,f=c,d=e.ascaleY,p=n.ascaleX,m=0,v=0,g=0;c<0?(c=-c,m=180,g=-1):(m=0,g=1),d<0&&(d=-d,g=-g),p<0?(p=-p,v=180):v=0;var y=n.ax,E=0,w=0,x=0,T=e.a,A=e.b,M=e.c,I=e.d,b=Math.abs(c-d)<=1e-4;b?(w=T*y+A*(E=n.ay)+e.worldX,x=M*y+I*E+e.worldY):(E=0,w=T*y+e.worldX,x=M*y+e.worldY);var R=e.parent;T=R.a,A=R.b,M=R.c;var S,C,P=1/(T*(I=R.d)-A*M),k=w-R.worldX,N=x-R.worldY,_=(k*I-N*A)*P-l,V=(N*T-k*M)*P-u,L=Math.sqrt(_*_+V*V),O=n.data.length*p;if(L<1e-4)return this.apply1(e,r,a,!1,o,!1,h),void n.updateWorldTransformWith(y,E,0,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY);var F=((k=r-R.worldX)*I-(N=a-R.worldY)*A)*P-l,D=(N*T-k*M)*P-u,U=F*F+D*D;if(0!=s){s*=c*(p+1)/2;var B=Math.sqrt(U),X=B-L-O*c+s;if(X>0){var Y=Math.min(1,X/(2*s))-1;U=(F-=(Y=(X-s*(1-Y*Y))/B)*F)*F+(D-=Y*D)*D}}t:if(b){var W=(U-L*L-(O*=c)*O)/(2*L*O);W<-1?W=-1:W>1&&(W=1,o&&(f*=(Math.sqrt(U)/(L+O)-1)*h+1)),C=Math.acos(W)*i,T=L+O*W,A=O*Math.sin(C),S=Math.atan2(D*T-F*A,F*T+D*A)}else{var j=(T=c*O)*T,G=(A=d*O)*A,q=Math.atan2(D,F),H=-2*G*L,z=G-j;if((I=H*H-4*z*(M=G*L*L+j*U-j*G))>=0){var Z=Math.sqrt(I);H<0&&(Z=-Z);var $=(Z=-(H+Z)/2)/z,Q=M/Z,J=Math.abs($)=-1&&M<=1&&(M=Math.acos(M),(I=(k=T*Math.cos(M)+L)*k+(N=A*Math.sin(M))*N)it&&(rt=M,it=I,at=k,ot=N)),U<=(et+it)/2?(S=q-Math.atan2(nt*i,tt),C=K*i):(S=q-Math.atan2(ot*i,at),C=rt*i)}var st=Math.atan2(E,y)*g,ht=e.arotation;(S=(S-st)*t.MathUtils.radDeg+m-ht)>180?S-=360:S<-180&&(S+=360),e.updateWorldTransformWith(l,u,ht+S*h,f,e.ascaleY,0,0),ht=n.arotation,(C=((C+st)*t.MathUtils.radDeg-n.ashearX)*g+v-ht)>180?C-=360:C<-180&&(C+=360),n.updateWorldTransformWith(y,E,ht+C*h,n.ascaleX,n.ascaleY,n.ashearX,n.ashearY)}else n.updateWorldTransform()},e}();t.IkConstraint=e}(a||(a={})),function(t){var e=function(t){function e(e){var n=t.call(this,e,0,!1)||this;return n.bones=new Array,n.bendDirection=1,n.compress=!1,n.stretch=!1,n.uniform=!1,n.mix=1,n.softness=0,n}return o(e,t),e}(t.ConstraintData);t.IkConstraintData=e}(a||(a={})),function(t){var e=function(){function e(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 n=0,r=t.bones.length;n0;if(a>0||i){var o=this.data,s=o.spacingMode==t.SpacingMode.Percent,h=o.rotateMode,l=h==t.RotateMode.Tangent,u=h==t.RotateMode.ChainScale,c=this.bones.length,f=l?c:c+1,d=this.bones,p=t.Utils.setArraySize(this.spaces,f),m=null,v=this.spacing;if(u||!s){u&&(m=t.Utils.setArraySize(this.lengths,c));for(var g=o.spacingMode==t.SpacingMode.Length,y=0,E=f-1;y0?t.MathUtils.degRad:-t.MathUtils.degRad;y=0;for(var P=3;yt.MathUtils.PI?B-=t.MathUtils.PI2:B<-t.MathUtils.PI&&(B+=t.MathUtils.PI2),B*=r,X=Math.cos(B),Y=Math.sin(B),k.a=X*O-Y*D,k.b=X*F-Y*U,k.c=Y*O+X*D,k.d=Y*F+X*U}k.appliedValid=!1}}}},e.prototype.computeWorldPositions=function(n,r,a,i,o){var s=this.target,h=this.position,l=this.spaces,u=t.Utils.setArraySize(this.positions,3*r+2),c=null,f=n.closed,d=n.worldVerticesLength,p=d/6,m=e.NONE;if(!n.constantSpeed){var v=n.lengths,g=v[p-=f?1:2];if(i&&(h*=g),o)for(var y=1;yg){m!=e.AFTER&&(m=e.AFTER,n.computeWorldVertices(s,d-6,4,c,0,2)),this.addAfterPosition(x-g,c,0,u,E);continue}}for(;;w++){var T=v[w];if(!(x>T)){if(0==w)x/=T;else x=(x-(Z=v[w-1]))/(T-Z);break}}w!=m&&(m=w,f&&w==p?(n.computeWorldVertices(s,d-4,4,c,0,2),n.computeWorldVertices(s,0,4,c,4,2)):n.computeWorldVertices(s,6*w+2,8,c,0,2)),this.addCurvePosition(x,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],u,E,a||y>0&&0==G)}return u}f?(d+=2,c=t.Utils.setArraySize(this.world,d),n.computeWorldVertices(s,2,d-4,c,0,2),n.computeWorldVertices(s,0,2,c,d-4,2),c[d-2]=c[0],c[d-1]=c[1]):(p--,d-=4,c=t.Utils.setArraySize(this.world,d),n.computeWorldVertices(s,2,d,c,0,2));for(var A=t.Utils.setArraySize(this.curves,p),M=0,I=c[0],b=c[1],R=0,S=0,C=0,P=0,k=0,N=0,_=0,V=0,L=0,O=0,F=0,D=0,U=0,B=0,X=(y=0,2);yM){this.addAfterPosition(x-M,c,d-4,u,E);continue}}for(;;w++){var q=A[w];if(!(x>q)){if(0==w)x/=q;else x=(x-(Z=A[w-1]))/(q-Z);break}}if(w!=m){m=w;var H=6*w;for(I=c[H],b=c[H+1],R=c[H+2],S=c[H+3],C=c[H+4],P=c[H+5],F=2*(_=.03*(I-2*R+C))+(L=.006*(3*(R-C)-I+(k=c[H+6]))),D=2*(V=.03*(b-2*S+P))+(O=.006*(3*(S-P)-b+(N=c[H+7]))),U=.3*(R-I)+_+.16666667*L,B=.3*(S-b)+V+.16666667*O,W=Math.sqrt(U*U+B*B),Y[0]=W,H=1;H<8;H++)U+=F,B+=D,F+=L,D+=O,W+=Math.sqrt(U*U+B*B),Y[H]=W;U+=F,B+=D,W+=Math.sqrt(U*U+B*B),Y[8]=W,U+=F+L,B+=D+O,W+=Math.sqrt(U*U+B*B),Y[9]=W,j=0}for(x*=W;;j++){var z=Y[j];if(!(x>z)){var Z;if(0==j)x/=z;else x=j+(x-(Z=Y[j-1]))/(z-Z);break}}this.addCurvePosition(.1*x,I,b,R,S,C,P,k,N,u,E,a||y>0&&0==G)}return u},e.prototype.addBeforePosition=function(t,e,n,r,a){var i=e[n],o=e[n+1],s=e[n+2]-i,h=e[n+3]-o,l=Math.atan2(h,s);r[a]=i+t*Math.cos(l),r[a+1]=o+t*Math.sin(l),r[a+2]=l},e.prototype.addAfterPosition=function(t,e,n,r,a){var i=e[n+2],o=e[n+3],s=i-e[n],h=o-e[n+1],l=Math.atan2(h,s);r[a]=i+t*Math.cos(l),r[a+1]=o+t*Math.sin(l),r[a+2]=l},e.prototype.addCurvePosition=function(t,e,n,r,a,i,o,s,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=n,void(l[u+2]=Math.atan2(a-n,r-e));var f=t*t,d=f*t,p=1-t,m=p*p,v=m*p,g=p*t,y=3*g,E=p*y,w=y*t,x=e*v+r*E+i*w+s*d,T=n*v+a*E+o*w+h*d;l[u]=x,l[u+1]=T,c&&(l[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(T-(n*m+a*g*2+o*f),x-(e*m+r*g*2+i*f)))},e.NONE=-1,e.BEFORE=-2,e.AFTER=-3,e.epsilon=1e-5,e}();t.PathConstraint=e}(a||(a={})),function(t){var e,n,r,a=function(t){function e(e){var n=t.call(this,e,0,!1)||this;return n.bones=new Array,n}return o(e,t),e}(t.ConstraintData);t.PathConstraintData=a,(e=t.PositionMode||(t.PositionMode={}))[e.Fixed=0]="Fixed",e[e.Percent=1]="Percent",(n=t.SpacingMode||(t.SpacingMode={}))[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",(r=t.RotateMode||(t.RotateMode={}))[r.Tangent=0]="Tangent",r[r.Chain=1]="Chain",r[r.ChainScale=2]="ChainScale"}(a||(a={})),function(t){var e=function(){function t(t){this.toLoad=new Array,this.assets={},this.clientId=t}return t.prototype.loaded=function(){var t=0;for(var e in this.assets)t++;return t},t}(),n=function(){function t(t){void 0===t&&(t=""),this.clientAssets={},this.queuedAssets={},this.rawAssets={},this.errors={},this.pathPrefix=t}return t.prototype.queueAsset=function(t,n,r){var a=this.clientAssets[t];return null==a&&(a=new e(t),this.clientAssets[t]=a),null!==n&&(a.textureLoader=n),a.toLoad.push(r),this.queuedAssets[r]!==r&&(this.queuedAssets[r]=r,!0)},t.prototype.loadText=function(t,e){var n=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?n.rawAssets[e]=r.responseText:n.errors[e]="Couldn't load text "+e+": status "+r.status+", "+r.responseText)},r.open("GET",e,!0),r.send()}},t.prototype.loadJson=function(t,e){var n=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var r=new XMLHttpRequest;r.overrideMimeType("text/html"),r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&(r.status>=200&&r.status<300?n.rawAssets[e]=JSON.parse(r.responseText):n.errors[e]="Couldn't load text "+e+": status "+r.status+", "+r.responseText)},r.open("GET",e,!0),r.send()}},t.prototype.loadTexture=function(t,e,n){var r=this;if(n=this.pathPrefix+n,this.queueAsset(t,e,n))if(!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)&&"undefined"!=typeof importScripts){fetch(n,{mode:"cors"}).then((function(t){return t.ok||(r.errors[n]="Couldn't load image "+n),t.blob()})).then((function(t){return createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"})})).then((function(t){r.rawAssets[n]=t}))}else{var a=new Image;a.crossOrigin="anonymous",a.onload=function(t){r.rawAssets[n]=a},a.onerror=function(t){r.errors[n]="Couldn't load image "+n},a.src=n}},t.prototype.get=function(t,e){e=this.pathPrefix+e;var n=this.clientAssets[t];return null==n||n.assets[e]},t.prototype.updateClientAssets=function(t){for(var e=!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)&&"undefined"!=typeof importScripts,n=0;n0},t.prototype.getErrors=function(){return this.errors},t}();t.SharedAssetManager=n}(a||(a={})),function(t){var e=function(){function e(e){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==e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(var n=0;n1){var i=r[r.length-1];this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}this._updateCache.push(e),this.sortReset(a.children),r[r.length-1].sorted=!0}},e.prototype.sortPathConstraint=function(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||null!=this.skin&&t.Utils.contains(this.skin.constraints,e.data,!0)),e.active){var n=e.target,r=n.data.index,a=n.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,r,a),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,r,a);for(var i=0,o=this.data.skins.length;i-1||this.updateCacheReset.push(i)}else for(a=0;a0){w=new t.DrawOrderTimeline(O);var F=a.slots.length;for(u=0;u=0;d--)U[d]=-1;var B=t.Utils.newArray(F-D,0),X=0,Y=0;for(d=0;d=0;d--)-1==U[d]&&(U[d]=B[--Y]);w.setFrame(u,y,U)}i.push(w),s=Math.max(s,w.frames[O-1])}var W=n.readInt(!0);if(W>0){for(w=new t.EventTimeline(W),u=0;u>>1^-(1&n)},t.prototype.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},t.prototype.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",n=0;n>4){case 12:case 13:e+=String.fromCharCode((31&r)<<6|63&this.readByte()),n+=2;break;case 14:e+=String.fromCharCode((15&r)<<12|(63&this.readByte())<<6|63&this.readByte()),n+=3;break;default:e+=String.fromCharCode(r),n++}}return e},t.prototype.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},t.prototype.readBoolean=function(){return 0!=this.readByte()},t}(),r=function(t,e,n,r,a){this.mesh=t,this.skin=e,this.slotIndex=n,this.parent=r,this.inheritDeform=a},a=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e}}(a||(a={})),function(t){var e=function(){function e(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new t.Pool((function(){return t.Utils.newFloatArray(16)}))}return e.prototype.update=function(e,n){if(null==e)throw new Error("skeleton cannot be null.");var r=this.boundingBoxes,a=this.polygons,i=this.polygonPool,o=e.slots,s=o.length;r.length=0,i.freeAll(a),a.length=0;for(var h=0;h=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},e.prototype.aabbIntersectsSegment=function(t,e,n,r){var a=this.minX,i=this.minY,o=this.maxX,s=this.maxY;if(t<=a&&n<=a||e<=i&&r<=i||t>=o&&n>=o||e>=s&&r>=s)return!1;var h=(r-e)/(n-t),l=h*(a-t)+e;if(l>i&&li&&la&&ua&&ut.minX&&this.minYt.minY},e.prototype.containsPoint=function(t,e){for(var n=this.polygons,r=0,a=n.length;r=n||l=n){var u=r[s];u+(n-h)/(l-h)*(r[i]-u)=u&&E<=d||E>=d&&E<=u)&&(E>=e&&E<=r||E>=r&&E<=e)){var w=(l*g-h*m)/y;if((w>=c&&w<=p||w>=p&&w<=c)&&(w>=n&&w<=a||w>=a&&w<=n))return!0}u=d,c=p}return!1},e.prototype.getPolygon=function(t){if(null==t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},e.prototype.getWidth=function(){return this.maxX-this.minX},e.prototype.getHeight=function(){return this.maxY-this.minY},e}();t.SkeletonBounds=e}(a||(a={})),function(t){var e=function(){function e(){this.triangulator=new t.Triangulator,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}return e.prototype.clipStart=function(n,r){if(null!=this.clipAttachment)return 0;this.clipAttachment=r;var a=r.worldVerticesLength,i=t.Utils.setArraySize(this.clippingPolygon,a);r.computeWorldVertices(n,0,a,i,0,2);var o=this.clippingPolygon;e.makeClockwise(o);for(var s=this.clippingPolygons=this.triangulator.decompose(o,this.triangulator.triangulate(o)),h=0,l=s.length;h>1,U=this.clipOutput,B=t.Utils.setArraySize(u,k+D*p),X=0;X=2?(u=s,s=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(n),u.push(r),u.push(a),u.push(i),u.push(t),u.push(e),s.length=0;for(var c=o,f=o.length-4,d=0;;d+=2){for(var p=c[d],m=c[d+1],v=c[d+2],g=c[d+3],y=p-v,E=m-g,w=u,x=u.length-2,T=s.length,A=0;A0;if(y*(I-g)-E*(M-v)>0){if(S){s.push(b),s.push(R);continue}var C=(k=R-I)*(v-p)-(N=b-M)*(g-m);if(Math.abs(C)>1e-6){var P=(N*(m-I)-k*(p-M))/C;s.push(p+(v-p)*P),s.push(m+(g-m)*P)}else s.push(p),s.push(m)}else if(S){var k,N;C=(k=R-I)*(v-p)-(N=b-M)*(g-m);if(Math.abs(C)>1e-6){P=(N*(m-I)-k*(p-M))/C;s.push(p+(v-p)*P),s.push(m+(g-m)*P)}else s.push(p),s.push(m);s.push(b),s.push(R)}l=!0}if(T==s.length)return h.length=0,!0;if(s.push(s[0]),s.push(s[1]),d==f)break;var _=s;(s=u).length=0,u=_}if(h!=s){h.length=0;d=0;for(var V=s.length-2;d>1;s=0;f--)-1==G[f]&&(G[f]=H[--Z])}w.setFrame(c++,this.getValue(j,"time",0),G)}i.push(w),o=Math.max(o,w.frames[w.getFrameCount()-1])}if(e.events){for(w=new t.EventTimeline(e.events.length),c=0,f=0;f=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=n},n.prototype.addSkin=function(t){for(var e=0;e= 0.");if(null==n)throw new Error("name cannot be null.");if(null==r)throw new Error("boneData cannot be null.");this.index=e,this.name=n,this.boneData=r};t.SlotData=e}(a||(a={})),function(t){var e,n,r=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 e.Nearest;case"linear":return e.Linear;case"mipmap":return e.MipMap;case"mipmapnearestnearest":return e.MipMapNearestNearest;case"mipmaplinearnearest":return e.MipMapLinearNearest;case"mipmapnearestlinear":return e.MipMapNearestLinear;case"mipmaplinearlinear":return e.MipMapLinearLinear;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return n.MirroredRepeat;case"clamptoedge":return n.ClampToEdge;case"repeat":return n.Repeat;default:throw new Error("Unknown texture wrap "+t)}},t}();t.Texture=r,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"}(e=t.TextureFilter||(t.TextureFilter={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(n=t.TextureWrap||(t.TextureWrap={}));var a=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};t.TextureRegion=a;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.setFilters=function(t,e){},e.prototype.setWraps=function(t,e){},e.prototype.dispose=function(){},e}(r);t.FakeTexture=i}(a||(a={})),function(t){var e=function(){function e(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}return e.prototype.load=function(e,i){if(null==i)throw new Error("textureLoader cannot be null.");for(var o=new n(e),s=new Array(4),h=null;;){var l=o.readLine();if(null==l)break;if(0==(l=l.trim()).length)h=null;else if(h){var u=new a;u.name=l,u.page=h;var c=o.readValue();"true"==c.toLocaleLowerCase()?u.degrees=90:"false"==c.toLocaleLowerCase()?u.degrees=0:u.degrees=parseFloat(c),u.rotate=90==u.degrees,o.readTuple(s);var f=parseInt(s[0]),d=parseInt(s[1]);o.readTuple(s);var p=parseInt(s[0]),m=parseInt(s[1]);u.u=f/h.width,u.v=d/h.height,u.rotate?(u.u2=(f+m)/h.width,u.v2=(d+p)/h.height):(u.u2=(f+p)/h.width,u.v2=(d+m)/h.height),u.x=f,u.y=d,u.width=Math.abs(p),u.height=Math.abs(m),4==o.readTuple(s)&&4==o.readTuple(s)&&o.readTuple(s),u.originalWidth=parseInt(s[0]),u.originalHeight=parseInt(s[1]),o.readTuple(s),u.offsetX=parseInt(s[0]),u.offsetY=parseInt(s[1]),u.index=parseInt(o.readValue()),u.texture=h.texture,this.regions.push(u)}else{(h=new r).name=l,2==o.readTuple(s)&&(h.width=parseInt(s[0]),h.height=parseInt(s[1]),o.readTuple(s)),o.readTuple(s),h.minFilter=t.Texture.filterFromString(s[0]),h.magFilter=t.Texture.filterFromString(s[1]);var v=o.readValue();h.uWrap=t.TextureWrap.ClampToEdge,h.vWrap=t.TextureWrap.ClampToEdge,"x"==v?h.uWrap=t.TextureWrap.Repeat:"y"==v?h.vWrap=t.TextureWrap.Repeat:"xy"==v&&(h.uWrap=h.vWrap=t.TextureWrap.Repeat),h.texture=i(l),h.texture.setFilters(h.minFilter,h.magFilter),h.texture.setWraps(h.uWrap,h.vWrap),h.width=h.texture.getImage().width,h.height=h.texture.getImage().height,this.pages.push(h)}}},e.prototype.findRegion=function(t){for(var e=0;e=this.lines.length?null:this.lines[this.index++]},t.prototype.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},t.prototype.readTuple=function(t){var e=this.readLine(),n=e.indexOf(":");if(-1==n)throw new Error("Invalid line: "+e);for(var r=0,a=n+1;r<3;r++){var i=e.indexOf(",",a);if(-1==i)break;t[r]=e.substr(a,i-a).trim(),a=i+1}return t[r]=e.substring(a).trim(),r+1},t}(),r=function(){};t.TextureAtlasPage=r;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(t.TextureRegion);t.TextureAtlasRegion=a}(a||(a={})),function(t){var e=function(){function e(e,n){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new t.Vector2,this.active=!1,null==e)throw new Error("data cannot be null.");if(null==n)throw new Error("skeleton cannot be null.");this.data=e,this.rotateMix=e.rotateMix,this.translateMix=e.translateMix,this.scaleMix=e.scaleMix,this.shearMix=e.shearMix,this.bones=new Array;for(var r=0;r0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*u,f=this.data.offsetShearY*u,d=this.bones,p=0,m=d.length;pt.MathUtils.PI?R-=t.MathUtils.PI2:R<-t.MathUtils.PI&&(R+=t.MathUtils.PI2),R*=e;var T=Math.cos(R),A=Math.sin(R);v.a=T*y-A*w,v.b=T*E-A*x,v.c=A*y+T*w,v.d=A*E+T*x,g=!0}if(0!=n){var M=this.temp;i.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(M.x-v.worldX)*n,v.worldY+=(M.y-v.worldY)*n,g=!0}if(r>0){var I=Math.sqrt(v.a*v.a+v.c*v.c),b=Math.sqrt(o*o+h*h);I>1e-5&&(I=(I+(b-I+this.data.offsetScaleX)*r)/I),v.a*=I,v.c*=I,I=Math.sqrt(v.b*v.b+v.d*v.d),b=Math.sqrt(s*s+l*l),I>1e-5&&(I=(I+(b-I+this.data.offsetScaleY)*r)/I),v.b*=I,v.d*=I,g=!0}if(a>0){E=v.b,x=v.d;var R,S=Math.atan2(x,E);(R=Math.atan2(l,s)-Math.atan2(h,o)-(S-Math.atan2(v.c,v.a)))>t.MathUtils.PI?R-=t.MathUtils.PI2:R<-t.MathUtils.PI&&(R+=t.MathUtils.PI2),R=S+(R+f)*a;I=Math.sqrt(E*E+x*x);v.b=Math.cos(R)*I,v.d=Math.sin(R)*I,g=!0}g&&(v.appliedValid=!1)}},e.prototype.applyRelativeWorld=function(){for(var e=this.rotateMix,n=this.translateMix,r=this.scaleMix,a=this.shearMix,i=this.target,o=i.a,s=i.b,h=i.c,l=i.d,u=o*l-s*h>0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*u,f=this.data.offsetShearY*u,d=this.bones,p=0,m=d.length;pt.MathUtils.PI?b-=t.MathUtils.PI2:b<-t.MathUtils.PI&&(b+=t.MathUtils.PI2),b*=e;var T=Math.cos(b),A=Math.sin(b);v.a=T*y-A*w,v.b=T*E-A*x,v.c=A*y+T*w,v.d=A*E+T*x,g=!0}if(0!=n){var M=this.temp;i.localToWorld(M.set(this.data.offsetX,this.data.offsetY)),v.worldX+=M.x*n,v.worldY+=M.y*n,g=!0}if(r>0){var I=(Math.sqrt(o*o+h*h)-1+this.data.offsetScaleX)*r+1;v.a*=I,v.c*=I,I=(Math.sqrt(s*s+l*l)-1+this.data.offsetScaleY)*r+1,v.b*=I,v.d*=I,g=!0}if(a>0){var b;(b=Math.atan2(l,s)-Math.atan2(h,o))>t.MathUtils.PI?b-=t.MathUtils.PI2:b<-t.MathUtils.PI&&(b+=t.MathUtils.PI2);E=v.b,x=v.d;b=Math.atan2(x,E)+(b-t.MathUtils.PI/2+f)*a;I=Math.sqrt(E*E+x*x);v.b=Math.cos(b)*I,v.d=Math.sin(b)*I,g=!0}g&&(v.appliedValid=!1)}},e.prototype.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,o=0,s=i.length;o1e-5&&(d=(d+(a.ascaleX-d+this.data.offsetScaleX)*n)/d),p>1e-5&&(p=(p+(a.ascaleY-p+this.data.offsetScaleY)*n)/p));var m=h.ashearY;if(0!=r){u=a.ashearY-m+this.data.offsetShearY;u-=360*(16384-(16384.499999999996-u/360|0)),h.shearY+=u*r}h.updateWorldTransformWith(c,f,l,d,p,h.ashearX,m)}},e.prototype.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,n=this.scaleMix,r=this.shearMix,a=this.target;a.appliedValid||a.updateAppliedTransform();for(var i=this.bones,o=0,s=i.length;o1e-5&&(f*=(a.ascaleX-1+this.data.offsetScaleX)*n+1),d>1e-5&&(d*=(a.ascaleY-1+this.data.offsetScaleY)*n+1));var p=h.ashearY;0!=r&&(p+=(a.ashearY+this.data.offsetShearY)*r),h.updateWorldTransformWith(u,c,l,f,d,h.ashearX,p)}},e}();t.TransformConstraint=e}(a||(a={})),function(t){var e=function(t){function e(e){var n=t.call(this,e,0,!1)||this;return n.bones=new Array,n.rotateMix=0,n.translateMix=0,n.scaleMix=0,n.shearMix=0,n.offsetRotation=0,n.offsetX=0,n.offsetY=0,n.offsetScaleX=0,n.offsetScaleY=0,n.offsetShearY=0,n.relative=!1,n.local=!1,n}return o(e,t),e}(t.ConstraintData);t.TransformConstraintData=e}(a||(a={})),function(t){var e=function(){function e(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new t.Pool((function(){return new Array})),this.polygonIndicesPool=new t.Pool((function(){return new Array}))}return e.prototype.triangulate=function(t){var n=t,r=t.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i3;){for(var l=r-1,u=(i=0,1);;){t:if(!o[i]){for(var c=a[l]<<1,f=a[i]<<1,d=a[u]<<1,p=n[c],m=n[c+1],v=n[f],g=n[f+1],y=n[d],E=n[d+1],w=(u+1)%r;w!=l;w=(w+1)%r)if(o[w]){var x=a[w]<<1,T=n[x],A=n[x+1];if(e.positiveArea(y,E,p,m,T,A)&&e.positiveArea(p,m,v,g,T,A)&&e.positiveArea(v,g,y,E,T,A))break t}break}if(0==u){do{if(!o[i])break;i--}while(i>0);break}l=i,i=u,u=(u+1)%r}h.push(a[(r+i-1)%r]),h.push(a[i]),h.push(a[(i+1)%r]),a.splice(i,1),o.splice(i,1);var M=(--r+i-1)%r,I=i==r?0:i;o[M]=e.isConcave(M,r,n,a),o[I]=e.isConcave(I,r,n,a)}return 3==r&&(h.push(a[2]),h.push(a[0]),h.push(a[1])),h},e.prototype.decompose=function(t,n){var r=t,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var o=this.polygonIndicesPool.obtain();o.length=0;var s=this.polygonPool.obtain();s.length=0;for(var h=-1,l=0,u=0,c=n.length;u0?(a.push(s),i.push(o)):(this.polygonPool.free(s),this.polygonIndicesPool.free(o)),(s=this.polygonPool.obtain()).length=0,s.push(m),s.push(v),s.push(g),s.push(y),s.push(E),s.push(w),(o=this.polygonIndicesPool.obtain()).length=0,o.push(f),o.push(d),o.push(p),l=e.winding(m,v,g,y,E,w),h=f)}s.length>0&&(a.push(s),i.push(o));for(u=0,c=a.length;u=0;u--)0==(s=a[u]).length&&(a.splice(u,1),this.polygonPool.free(s),o=i[u],i.splice(u,1),this.polygonIndicesPool.free(o));return a},e.isConcave=function(t,e,n,r){var a=r[(e+t-1)%e]<<1,i=r[t]<<1,o=r[(t+1)%e]<<1;return!this.positiveArea(n[a],n[a+1],n[i],n[i+1],n[o],n[o+1])},e.positiveArea=function(t,e,n,r,a,i){return t*(i-r)+n*(e-i)+a*(r-e)>=0},e.winding=function(t,e,n,r,a,i){var o=n-t,s=r-e;return a*s-i*o+o*e-t*s>=0?1:-1},e}();t.Triangulator=e}(a||(a={})),function(t){var e=function(){function t(){this.array=new Array}return t.prototype.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},t.prototype.contains=function(t){return null!=this.array[0|t]},t.prototype.remove=function(t){this.array[0|t]=void 0},t.prototype.clear=function(){this.array.length=0},t}();t.IntSet=e;var n=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=n,this.a=r}return t.prototype.set=function(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this.clamp(),this},t.prototype.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.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},t.prototype.add=function(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,this.a+=r,this.clamp(),this},t.prototype.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.WHITE=new t(1,1,1,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.MAGENTA=new t(1,0,1,1),t}();t.Color=n;var r=function(){function t(){}return t.clamp=function(t,e,n){return tn?n: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,n){return t.randomTriangularWith(e,n,.5*(e+n))},t.randomTriangularWith=function(t,e,n){var r=Math.random(),a=e-t;return r<=(n-t)/a?t+Math.sqrt(r*a*(n-t)):e-Math.sqrt((1-r)*a*(e-n))},t.PI=3.1415927,t.PI2=2*t.PI,t.radiansToDegrees=180/t.PI,t.radDeg=t.radiansToDegrees,t.degreesToRadians=t.PI/180,t.degRad=t.degreesToRadians,t}();t.MathUtils=r;var a=function(){function t(){}return t.prototype.apply=function(t,e,n){return t+(e-t)*this.applyInternal(n)},t}();t.Interpolation=a;var i=function(t){function e(e){var n=t.call(this)||this;return n.power=2,n.power=e,n}return o(e,t),e.prototype.applyInternal=function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1},e}(a);t.Pow=i;var s=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e}(i);t.PowOut=s;var h=function(){function t(){}return t.arrayCopy=function(t,e,n,r,a){for(var i=e,o=r;i=n?e:t.setArraySize(e,n,r)},t.newArray=function(t,e){for(var n=new Array(t),r=0;r0?this.items.pop():this.instantiator()},t.prototype.free=function(t){t.reset&&t.reset(),this.items.push(t)},t.prototype.freeAll=function(t){for(var e=0;ethis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)},t}();t.TimeKeeper=f;var d=function(){function t(t){void 0===t&&(t=32),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}return t.prototype.hasEnoughData=function(){return this.addedValues>=this.values.length},t.prototype.addValue=function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0},t.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*i;var o=t.bone.skeleton,s=t.deform,h=this.vertices,l=this.bones;if(null!=l){for(var u=0,c=0,f=0;f0&&(h=s);for(var w,x=(w=t.bone).worldX,T=w.worldY,A=w.a,M=w.b,I=w.c,b=w.d,R=e,S=a;S)?=?)"),d("XRANGEIDENTIFIERLOOSE","".concat(h[l.NUMERICIDENTIFIERLOOSE],"|x|X|\\*")),d("XRANGEIDENTIFIER","".concat(h[l.NUMERICIDENTIFIER],"|x|X|\\*")),d("XRANGEPLAIN","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:".concat(h[l.PRERELEASE],")?").concat(h[l.BUILD],"?")+")?)?"),d("XRANGEPLAINLOOSE","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:".concat(h[l.PRERELEASELOOSE],")?").concat(h[l.BUILD],"?")+")?)?"),d("XRANGE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAIN],"$")),d("XRANGELOOSE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAINLOOSE],"$")),d("COERCE","".concat("(^|[^\\d])(\\d{1,").concat(n,"})")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:$|[^\\d])"),d("COERCERTL",h[l.COERCE],!0),d("LONETILDE","(?:~>?)"),d("TILDETRIM","(\\s*)".concat(h[l.LONETILDE],"\\s+"),!0),e.tildeTrimReplace="$1~",d("TILDE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAIN],"$")),d("TILDELOOSE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAINLOOSE],"$")),d("LONECARET","(?:\\^)"),d("CARETTRIM","(\\s*)".concat(h[l.LONECARET],"\\s+"),!0),e.caretTrimReplace="$1^",d("CARET","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAIN],"$")),d("CARETLOOSE","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAINLOOSE],"$")),d("COMPARATORLOOSE","^".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],")$|^$")),d("COMPARATOR","^".concat(h[l.GTLT],"\\s*(").concat(h[l.FULLPLAIN],")$|^$")),d("COMPARATORTRIM","(\\s*)".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],"|").concat(h[l.XRANGEPLAIN],")"),!0),e.comparatorTrimReplace="$1$2$3",d("HYPHENRANGE","^\\s*(".concat(h[l.XRANGEPLAIN],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAIN],")")+"\\s*$"),d("HYPHENRANGELOOSE","^\\s*(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s*$"),d("STAR","(<|>)?=?\\s*\\*"),d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),d("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(_,_.exports);var V=_.exports;S(V);var L=Object.freeze({loose:!0}),O=Object.freeze({}),F=function(t){return t?"object"!==h(t)?L:t:O};S(F);var D=/^[0-9]+$/,U=function(t,e){var n=D.test(t),r=D.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:tY)throw new TypeError("version is longer than ".concat(Y," characters"));X("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;var r=e.trim().match(n.loose?j[G.LOOSE]:j[G.FULL]);if(!r)throw new TypeError("Invalid Version: ".concat(e));if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>W||this.major<0)throw new TypeError("Invalid major version");if(this.minor>W||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>W||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e=0;)"number"==typeof this.prerelease[a]&&(this.prerelease[a]++,a=-2);if(-1===a){if(e===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(r)}}if(e){var i=[e,r];!1===n&&(i=[e]),0===H(this.prerelease[0],e)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break;default:throw new Error("invalid increment argument: ".concat(t))}return this.raw=this.format(),this.build.length&&(this.raw+="+".concat(this.build.join("."))),this}}]),t}(),Z=z;S(Z);var $=Z,Q=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t instanceof $)return t;try{return new $(t,e)}catch(t){if(!n)return null;throw t}};S(Q);var J,K,tt=Q,et=S((function(t,e){var n=tt(t,e);return n?n.version:null})),nt=Z,rt=Q,at=V.safeRe,it=V.t,ot=S((function(t,e){if(t instanceof nt)return t;if("number"==typeof t&&(t=String(t)),"string"!=typeof t)return null;var n=null;if((e=e||{}).rtl){for(var r;(r=at[it.COERCERTL].exec(t))&&(!n||n.index+n[0].length!==t.length);)n&&r.index+r[0].length===n.index+n[0].length||(n=r),at[it.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;at[it.COERCERTL].lastIndex=-1}else n=t.match(at[it.COERCE]);return null===n?null:rt("".concat(n[2],".").concat(n[3]||"0",".").concat(n[4]||"0"),e)}));var st=ht;function ht(t){var e=this;if(e instanceof ht||(e=new ht),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var n=0,r=arguments.length;n1)n=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var a=0;null!==r;a++)n=t(n,r.value,a),r=r.next;return n},ht.prototype.reduceReverse=function(t,e){var n,r=this.tail;if(arguments.length>1)n=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var a=this.length-1;null!==r;a--)n=t(n,r.value,a),r=r.prev;return n},ht.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;null!==n;e++)t[e]=n.value,n=n.next;return t},ht.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;null!==n;e++)t[e]=n.value,n=n.prev;return t},ht.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var n=new ht;if(ethis.length&&(e=this.length);for(var r=0,a=this.head;null!==a&&rthis.length&&(e=this.length);for(var r=this.length,a=this.tail;null!==a&&r>e;r--)a=a.prev;for(;null!==a&&r>t;r--,a=a.prev)n.push(a.value);return n},ht.prototype.splice=function(t,e){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,r=this.head;null!==r&&nthis[pt])return Ct(this,this[Tt].get(t)),!1;var i=this[Tt].get(t).value;return this[Et]&&(this[wt]||this[Et](t,i.value)),i.now=r,i.maxAge=n,i.value=e,this[mt]+=a-i.length,i.length=a,this.get(t),St(this),!0}var o=new Pt(t,e,a,r,n);return o.length>this[pt]?(this[Et]&&this[Et](t,e),!1):(this[mt]+=o.length,this[xt].unshift(o),this[Tt].set(t,this[xt].head),St(this),!0)}},{key:"has",value:function(t){if(!this[Tt].has(t))return!1;var e=this[Tt].get(t).value;return!Rt(this,e)}},{key:"get",value:function(t){return bt(this,t,!0)}},{key:"peek",value:function(t){return bt(this,t,!1)}},{key:"pop",value:function(){var t=this[xt].tail;return t?(Ct(this,t),t.value):null}},{key:"del",value:function(t){Ct(this,this[Tt].get(t))}},{key:"load",value:function(t){this.reset();for(var e=Date.now(),n=t.length-1;n>=0;n--){var r=t[n],a=r.e||0;if(0===a)this.set(r.k,r.v);else{var i=a-e;i>0&&this.set(r.k,r.v,i)}}}},{key:"prune",value:function(){var t=this;this[Tt].forEach((function(e,n){return bt(t,n,!1)}))}}]),t}(),bt=function(t,e,n){var r=t[Tt].get(e);if(r){var a=r.value;if(Rt(t,a)){if(Ct(t,r),!t[gt])return}else n&&(t[At]&&(r.value.now=Date.now()),t[xt].unshiftNode(r));return a.value}},Rt=function(t,e){if(!e||!e.maxAge&&!t[yt])return!1;var n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[yt]&&n>t[yt]},St=function(t){if(t[mt]>t[pt])for(var e=t[xt].tail;t[mt]>t[pt]&&null!==e;){var n=e.prev;Ct(t,e),e=n}},Ct=function(t,e){if(e){var n=e.value;t[Et]&&t[Et](n.key,n.value),t[mt]-=n.length,t[Tt].delete(n.key),t[xt].removeNode(e)}},Pt=c((function t(e,n,r,a,i){l(this,t),this.key=e,this.value=n,this.length=r,this.now=a,this.maxAge=i||0})),kt=function(t,e,n,r){var a=n.value;Rt(t,a)&&(Ct(t,n),t[gt]||(a=void 0)),a&&e.call(r,a.value,a.key,t)},Nt=It;S(Nt);var _t=Z,Vt=function(t,e,n){return new _t(t,n).compare(new _t(e,n))};S(Vt);var Lt=Vt,Ot=function(t,e,n){return 0===Lt(t,e,n)};S(Ot);var Ft=Vt,Dt=function(t,e,n){return 0!==Ft(t,e,n)};S(Dt);var Ut=Vt,Bt=function(t,e,n){return Ut(t,e,n)>0};S(Bt);var Xt=Vt,Yt=function(t,e,n){return Xt(t,e,n)>=0};S(Yt);var Wt=Vt,jt=function(t,e,n){return Wt(t,e,n)<0};S(jt);var Gt=Vt,qt=function(t,e,n){return Gt(t,e,n)<=0};S(qt);var Ht,zt,Zt,$t,Qt=Ot,Jt=Dt,Kt=Bt,te=Yt,ee=jt,ne=qt,re=function(t,e,n,r){switch(e){case"===":return"object"===h(t)&&(t=t.version),"object"===h(n)&&(n=n.version),t===n;case"!==":return"object"===h(t)&&(t=t.version),"object"===h(n)&&(n=n.version),t!==n;case"":case"=":case"==":return Qt(t,n,r);case"!=":return Jt(t,n,r);case">":return Kt(t,n,r);case">=":return te(t,n,r);case"<":return ee(t,n,r);case"<=":return ne(t,n,r);default:throw new TypeError("Invalid operator: ".concat(e))}};function ae(){if($t)return Zt;$t=1;var t=function(){function t(e,a){var i=this;if(l(this,t),a=n(a),e instanceof t)return e.loose===!!a.loose&&e.includePrerelease===!!a.includePrerelease?e:new t(e.raw,a);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((function(t){return i.parseRange(t.trim())})).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: ".concat(this.raw));if(this.set.length>1){var o=this.set[0];if(this.set=this.set.filter((function(t){return!m(t[0])})),0===this.set.length)this.set=[o];else if(this.set.length>1){var s,h=A(this.set);try{for(h.s();!(s=h.n()).done;){var u=s.value;if(1===u.length&&v(u[0])){this.set=[u];break}}}catch(t){h.e(t)}finally{h.f()}}}this.format()}return c(t,[{key:"format",value:function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range}},{key:"toString",value:function(){return this.range}},{key:"parseRange",value:function(t){var n=this,i=((this.options.includePrerelease&&d)|(this.options.loose&&p))+":"+t,l=e.get(i);if(l)return l;var c=this.options.loose,v=c?o[s.HYPHENRANGELOOSE]:o[s.HYPHENRANGE];t=t.replace(v,k(this.options.includePrerelease)),a("hyphen replace",t),t=t.replace(o[s.COMPARATORTRIM],h),a("comparator trim",t),t=t.replace(o[s.TILDETRIM],u),a("tilde trim",t),t=t.replace(o[s.CARETTRIM],f),a("caret trim",t);var g=t.split(" ").map((function(t){return y(t,n.options)})).join(" ").split(/\s+/).map((function(t){return P(t,n.options)}));c&&(g=g.filter((function(t){return a("loose invalid filter",t,n.options),!!t.match(o[s.COMPARATORLOOSE])}))),a("range list",g);var E,x=new Map,T=g.map((function(t){return new r(t,n.options)})),M=A(T);try{for(M.s();!(E=M.n()).done;){var I=E.value;if(m(I))return[I];x.set(I.value,I)}}catch(t){M.e(t)}finally{M.f()}x.size>1&&x.has("")&&x.delete("");var b=w(x.values());return e.set(i,b),b}},{key:"intersects",value:function(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((function(t){return g(t,n)&&e.set.some((function(e){return g(e,n)&&t.every((function(t){return e.every((function(e){return t.intersects(e,n)}))}))}))}))}},{key:"test",value:function(t){if(!t)return!1;if("string"==typeof t)try{t=new i(t,this.options)}catch(t){return!1}for(var e=0;e")||!t.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!t.operator.startsWith("<"))&&(this.semver.version!==t.semver.version||!this.operator.includes("=")||!t.operator.includes("="))&&!(i(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<"))&&!(i(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}}],[{key:"ANY",get:function(){return t}}]),e}();Ht=e;var n=F,r=V.safeRe,a=V.t,i=re,o=N,s=Z,h=ae();return Ht}(),a=N,i=Z,o=V.safeRe,s=V.t,h=V.comparatorTrimReplace,u=V.tildeTrimReplace,f=V.caretTrimReplace,d=C.FLAG_INCLUDE_PRERELEASE,p=C.FLAG_LOOSE,m=function(t){return"<0.0.0-0"===t.value},v=function(t){return""===t.value},g=function(t,e){for(var n=!0,r=t.slice(),a=r.pop();n&&r.length;)n=r.every((function(t){return a.intersects(t,e)})),a=r.pop();return n},y=function(t,e){return a("comp",t,e),t=M(t,e),a("caret",t),t=x(t,e),a("tildes",t),t=b(t,e),a("xrange",t),t=S(t,e),a("stars",t),t},E=function(t){return!t||"x"===t.toLowerCase()||"*"===t},x=function(t,e){return t.trim().split(/\s+/).map((function(t){return T(t,e)})).join(" ")},T=function(t,e){var n=e.loose?o[s.TILDELOOSE]:o[s.TILDE];return t.replace(n,(function(e,n,r,i,o){var s;return a("tilde",t,e,n,r,i,o),E(n)?s="":E(r)?s=">=".concat(n,".0.0 <").concat(+n+1,".0.0-0"):E(i)?s=">=".concat(n,".").concat(r,".0 <").concat(n,".").concat(+r+1,".0-0"):o?(a("replaceTilde pr",o),s=">=".concat(n,".").concat(r,".").concat(i,"-").concat(o," <").concat(n,".").concat(+r+1,".0-0")):s=">=".concat(n,".").concat(r,".").concat(i," <").concat(n,".").concat(+r+1,".0-0"),a("tilde return",s),s}))},M=function(t,e){return t.trim().split(/\s+/).map((function(t){return I(t,e)})).join(" ")},I=function(t,e){a("caret",t,e);var n=e.loose?o[s.CARETLOOSE]:o[s.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(function(e,n,i,o,s){var h;return a("caret",t,e,n,i,o,s),E(n)?h="":E(i)?h=">=".concat(n,".0.0").concat(r," <").concat(+n+1,".0.0-0"):E(o)?h="0"===n?">=".concat(n,".").concat(i,".0").concat(r," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".0").concat(r," <").concat(+n+1,".0.0-0"):s?(a("replaceCaret pr",s),h="0"===n?"0"===i?">=".concat(n,".").concat(i,".").concat(o,"-").concat(s," <").concat(n,".").concat(i,".").concat(+o+1,"-0"):">=".concat(n,".").concat(i,".").concat(o,"-").concat(s," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".").concat(o,"-").concat(s," <").concat(+n+1,".0.0-0")):(a("no pr"),h="0"===n?"0"===i?">=".concat(n,".").concat(i,".").concat(o).concat(r," <").concat(n,".").concat(i,".").concat(+o+1,"-0"):">=".concat(n,".").concat(i,".").concat(o).concat(r," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".").concat(o," <").concat(+n+1,".0.0-0")),a("caret return",h),h}))},b=function(t,e){return a("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return R(t,e)})).join(" ")},R=function(t,e){t=t.trim();var n=e.loose?o[s.XRANGELOOSE]:o[s.XRANGE];return t.replace(n,(function(n,r,i,o,s,h){a("xRange",t,n,r,i,o,s,h);var l=E(i),u=l||E(o),c=u||E(s),f=c;return"="===r&&f&&(r=""),h=e.includePrerelease?"-0":"",l?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&f?(u&&(o=0),s=0,">"===r?(r=">=",u?(i=+i+1,o=0,s=0):(o=+o+1,s=0)):"<="===r&&(r="<",u?i=+i+1:o=+o+1),"<"===r&&(h="-0"),n="".concat(r+i,".").concat(o,".").concat(s).concat(h)):u?n=">=".concat(i,".0.0").concat(h," <").concat(+i+1,".0.0-0"):c&&(n=">=".concat(i,".").concat(o,".0").concat(h," <").concat(i,".").concat(+o+1,".0-0")),a("xRange return",n),n}))},S=function(t,e){return a("replaceStars",t,e),t.trim().replace(o[s.STAR],"")},P=function(t,e){return a("replaceGTE0",t,e),t.trim().replace(o[e.includePrerelease?s.GTE0PRE:s.GTE0],"")},k=function(t){return function(e,n,r,a,i,o,s,h,l,u,c,f,d){return n=E(r)?"":E(a)?">=".concat(r,".0.0").concat(t?"-0":""):E(i)?">=".concat(r,".").concat(a,".0").concat(t?"-0":""):o?">=".concat(n):">=".concat(n).concat(t?"-0":""),h=E(l)?"":E(u)?"<".concat(+l+1,".0.0-0"):E(c)?"<".concat(l,".").concat(+u+1,".0-0"):f?"<=".concat(l,".").concat(u,".").concat(c,"-").concat(f):t?"<".concat(l,".").concat(u,".").concat(+c+1,"-0"):"<=".concat(h),"".concat(n," ").concat(h).trim()}},_=function(t,e,n){for(var i=0;i0){var s=t[o].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0};return Zt}S(re);var ie,oe,se=ae(),he=function(t,e,n){try{e=new se(e,n)}catch(t){return!1}return e.test(t)},le={valid:et,coerce:ot,satisfies:S(he),SEMVER_SPEC_VERSION:P.SEMVER_SPEC_VERSION},ue=0,ce=1,fe=2,de=[0,1,2,2,3,0],pe=function(){function t(e,n,r,o){var s;if(l(this,t),f(this,"autoUpdate",!0),f(this,"skeleton",void 0),f(this,"states",void 0),this._app=e,this._position=new i.Vec3,1===a.TextureAtlas.length){var h,u=A((s=new a.TextureAtlas(n)).pages);try{for(u.s();!(h=u.n()).done;){var c=h.value;c.setTexture(new R(o[c.name]))}}catch(t){u.e(t)}finally{u.f()}}else s=new a.TextureAtlas(n,(function(t){return new R(o[t])}));var d=new a.SkeletonJson(new a.AtlasAttachmentLoader(s));d.scale*=.01;var p=d.readSkeletonData(r);this.skeletonVersion=le.valid(le.coerce(p.version)),this._spine_3_6_0=le.satisfies(this.skeletonVersion,"<=3.6.0"),this._spine_3_7_99=le.satisfies(this.skeletonVersion,"<=3.7.99"),this._spine_4_0_X=le.satisfies(this.skeletonVersion,"~4.0.0"),this._spine_4_1_X=le.satisfies(this.skeletonVersion,"~4.1.23"),this.skeleton=new a.Skeleton(p),this.skeleton.updateWorldTransform(),this.stateData=new a.AnimationStateData(this.skeleton.data),this.states=[new a.AnimationState(this.stateData)],this.clipper=new a.SkeletonClipping,this._node=new i.GraphNode,this._meshes=[],this._meshInstances=[],this._materials={},this._tint={},this._aabb=new i.BoundingBox,this._aabbTempArray=[],this._aabbTempOffset=new i.Vec2,this._aabbTempSize=new i.Vec2,this._renderCounts={vertexCount:0,indexCount:0},this._vertexFormat=null,this._vertexBuffer=null,this._indexBuffer=null,this._priority=0,this._timeScale=1,this._layers=[i.LAYERID_UI],this.init(),this._hidden=!1}return c(t,[{key:"destroy",value:function(){this.removeFromLayers();for(var t=0;t0&&this._renderCounts.vertexCount>0){this.skeleton.getBounds(this._aabbTempOffset,this._aabbTempSize,this._aabbTempArray),this._aabb.center=new i.Vec3(this._aabbTempOffset.x,this._aabbTempOffset.y,0),this._aabb.halfExtents=new i.Vec3(.5*this._aabbTempSize.x,.5*this._aabbTempSize.y,0),(!this._vertexBuffer||this._vertexBuffer.getNumVertices()0&&c.indices.length>0){t&&t!==c.material&&(this.SubmitBatch(e,n,t),t=c.material,e=o,n=0),t=c.material;var f=c.positions,d=c.vertexColor.r,p=c.vertexColor.g,m=c.vertexColor.b,v=c.vertexColor.a,g=c.uvs,y=void 0,E=f.length/2;for(y=0;y0){var r=new i.Mesh(this._app.graphicsDevice);r.vertexBuffer=this._vertexBuffer,r.indexBuffer[0]=this._indexBuffer,r.primitive[0].type=i.PRIMITIVE_TRIANGLES,r.primitive[0].base=t,r.primitive[0].count=e,r.primitive[0].indexed=!0,r.aabb=this._aabb,this._meshes.push(r);var a=new i.MeshInstance(r,this._materials[n],this._node);a.drawOrder=this.priority+this._meshInstances.length,a.visible=!this._hidden,this._meshInstances.push(a)}}},{key:"update",value:function(t){if(!this._hidden){var e;t*=this._timeScale;var n=this.states.length;for(e=0;e= 0; --o) { + var i = this.tryEntries[o], + a = i.completion; + if ("root" === i.tryLoc) return handle("end"); + if (i.tryLoc <= this.prev) { + var c = n.call(i, "catchLoc"), + u = n.call(i, "finallyLoc"); + if (c && u) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } else if (c) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + } else { + if (!u) throw new Error("try statement without catch or finally"); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } + } + } + }, + abrupt: function (t, e) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); + }, + complete: function (t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; + }, + finish: function (t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; + } + }, + catch: function (t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var o = n.arg; + resetTryEntry(r); + } + return o; + } + } + throw new Error("illegal catch attempt"); + }, + delegateYield: function (e, r, n) { + return this.delegate = { + iterator: values(e), + resultName: r, + nextLoc: n + }, "next" === this.method && (this.arg = t), y; + } + }, e; + } + function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); + } + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return self; + } + function _possibleConstructorReturn(self, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + return _assertThisInitialized(self); + } + function _createSuper(Derived) { + var hasNativeReflectConstruct = _isNativeReflectConstruct(); + return function _createSuperInternal() { + var Super = _getPrototypeOf(Derived), + result; + if (hasNativeReflectConstruct) { + var NewTarget = _getPrototypeOf(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + return _possibleConstructorReturn(this, result); + }; + } + function _superPropBase(object, property) { + while (!Object.prototype.hasOwnProperty.call(object, property)) { + object = _getPrototypeOf(object); + if (object === null) break; + } + return object; + } + function _get$1() { + if (typeof Reflect !== "undefined" && Reflect.get) { + _get$1 = Reflect.get.bind(); + } else { + _get$1 = function _get(target, property, receiver) { + var base = _superPropBase(target, property); + if (!base) return; + var desc = Object.getOwnPropertyDescriptor(base, property); + if (desc.get) { + return desc.get.call(arguments.length < 3 ? target : receiver); + } + return desc.value; + }; + } + return _get$1.apply(this, arguments); + } + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _createForOfIteratorHelper(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (!it) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + var F = function () {}; + return { + s: F, + n: function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }, + e: function (e) { + throw e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var normalCompletion = true, + didErr = false, + err; + return { + s: function () { + it = it.call(o); + }, + n: function () { + var step = it.next(); + normalCompletion = step.done; + return step; + }, + e: function (e) { + didErr = true; + err = e; + }, + f: function () { + try { + if (!normalCompletion && it.return != null) it.return(); + } finally { + if (didErr) throw err; + } + } + }; + } + function _toPrimitive(input, hint) { + if (typeof input !== "object" || input === null) return input; + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (typeof res !== "object") return res; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (hint === "string" ? String : Number)(input); + } + function _toPropertyKey(arg) { + var key = _toPrimitive(arg, "string"); + return typeof key === "symbol" ? key : String(key); + } + + var IntSet = function () { + function IntSet() { + _classCallCheck(this, IntSet); + this.array = new Array(); + } + _createClass(IntSet, [{ + key: "add", + value: function add(value) { + var contains = this.contains(value); + this.array[value | 0] = value | 0; + return !contains; + } + }, { + key: "contains", + value: function contains(value) { + return this.array[value | 0] != undefined; + } + }, { + key: "remove", + value: function remove(value) { + this.array[value | 0] = undefined; + } + }, { + key: "clear", + value: function clear() { + this.array.length = 0; + } + }]); + return IntSet; + }(); + var StringSet = function () { + function StringSet() { + _classCallCheck(this, StringSet); + this.entries = {}; + this.size = 0; + } + _createClass(StringSet, [{ + key: "add", + value: function add(value) { + var contains = this.entries[value]; + this.entries[value] = true; + if (!contains) { + this.size++; + return true; + } + return false; + } + }, { + key: "addAll", + value: function addAll(values) { + var oldSize = this.size; + for (var i = 0, n = values.length; i < n; i++) this.add(values[i]); + return oldSize != this.size; + } + }, { + key: "contains", + value: function contains(value) { + return this.entries[value]; + } + }, { + key: "clear", + value: function clear() { + this.entries = {}; + this.size = 0; + } + }]); + return StringSet; + }(); + var Color = function () { + function Color() { + var r = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var g = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var b = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + _classCallCheck(this, Color); + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } + _createClass(Color, [{ + key: "set", + value: function set(r, g, b, a) { + this.r = r; + this.g = g; + this.b = b; + this.a = a; + return this.clamp(); + } + }, { + key: "setFromColor", + value: function setFromColor(c) { + this.r = c.r; + this.g = c.g; + this.b = c.b; + this.a = c.a; + return this; + } + }, { + key: "setFromString", + value: function setFromString(hex) { + hex = hex.charAt(0) == '#' ? hex.substr(1) : hex; + this.r = parseInt(hex.substr(0, 2), 16) / 255; + this.g = parseInt(hex.substr(2, 2), 16) / 255; + this.b = parseInt(hex.substr(4, 2), 16) / 255; + this.a = hex.length != 8 ? 1 : parseInt(hex.substr(6, 2), 16) / 255; + return this; + } + }, { + key: "add", + value: function add(r, g, b, a) { + this.r += r; + this.g += g; + this.b += b; + this.a += a; + return this.clamp(); + } + }, { + key: "clamp", + value: function clamp() { + if (this.r < 0) this.r = 0;else if (this.r > 1) this.r = 1; + if (this.g < 0) this.g = 0;else if (this.g > 1) this.g = 1; + if (this.b < 0) this.b = 0;else if (this.b > 1) this.b = 1; + if (this.a < 0) this.a = 0;else if (this.a > 1) this.a = 1; + return this; + } + }], [{ + key: "rgba8888ToColor", + value: function rgba8888ToColor(color, value) { + color.r = ((value & 0xff000000) >>> 24) / 255; + color.g = ((value & 0x00ff0000) >>> 16) / 255; + color.b = ((value & 0x0000ff00) >>> 8) / 255; + color.a = (value & 0x000000ff) / 255; + } + }, { + key: "rgb888ToColor", + value: function rgb888ToColor(color, value) { + color.r = ((value & 0x00ff0000) >>> 16) / 255; + color.g = ((value & 0x0000ff00) >>> 8) / 255; + color.b = (value & 0x000000ff) / 255; + } + }, { + key: "fromString", + value: function fromString(hex) { + return new Color().setFromString(hex); + } + }]); + return Color; + }(); + Color.WHITE = new Color(1, 1, 1, 1); + Color.RED = new Color(1, 0, 0, 1); + Color.GREEN = new Color(0, 1, 0, 1); + Color.BLUE = new Color(0, 0, 1, 1); + Color.MAGENTA = new Color(1, 0, 1, 1); + var MathUtils = function () { + function MathUtils() { + _classCallCheck(this, MathUtils); + } + _createClass(MathUtils, null, [{ + key: "clamp", + value: function clamp(value, min, max) { + if (value < min) return min; + if (value > max) return max; + return value; + } + }, { + key: "cosDeg", + value: function cosDeg(degrees) { + return Math.cos(degrees * MathUtils.degRad); + } + }, { + key: "sinDeg", + value: function sinDeg(degrees) { + return Math.sin(degrees * MathUtils.degRad); + } + }, { + key: "signum", + value: function signum(value) { + return value > 0 ? 1 : value < 0 ? -1 : 0; + } + }, { + key: "toInt", + value: function toInt(x) { + return x > 0 ? Math.floor(x) : Math.ceil(x); + } + }, { + key: "cbrt", + value: function cbrt(x) { + var y = Math.pow(Math.abs(x), 1 / 3); + return x < 0 ? -y : y; + } + }, { + key: "randomTriangular", + value: function randomTriangular(min, max) { + return MathUtils.randomTriangularWith(min, max, (min + max) * 0.5); + } + }, { + key: "randomTriangularWith", + value: function randomTriangularWith(min, max, mode) { + var u = Math.random(); + var d = max - min; + if (u <= (mode - min) / d) return min + Math.sqrt(u * d * (mode - min)); + return max - Math.sqrt((1 - u) * d * (max - mode)); + } + }, { + key: "isPowerOfTwo", + value: function isPowerOfTwo(value) { + return value && (value & value - 1) === 0; + } + }]); + return MathUtils; + }(); + MathUtils.PI = 3.1415927; + MathUtils.PI2 = MathUtils.PI * 2; + MathUtils.radiansToDegrees = 180 / MathUtils.PI; + MathUtils.radDeg = MathUtils.radiansToDegrees; + MathUtils.degreesToRadians = MathUtils.PI / 180; + MathUtils.degRad = MathUtils.degreesToRadians; + var Interpolation = function () { + function Interpolation() { + _classCallCheck(this, Interpolation); + } + _createClass(Interpolation, [{ + key: "apply", + value: function apply(start, end, a) { + return start + (end - start) * this.applyInternal(a); + } + }]); + return Interpolation; + }(); + var Pow = function (_Interpolation) { + _inherits(Pow, _Interpolation); + var _super = _createSuper(Pow); + function Pow(power) { + var _this; + _classCallCheck(this, Pow); + _this = _super.call(this); + _this.power = 2; + _this.power = power; + return _this; + } + _createClass(Pow, [{ + key: "applyInternal", + value: function applyInternal(a) { + if (a <= 0.5) return Math.pow(a * 2, this.power) / 2; + return Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1; + } + }]); + return Pow; + }(Interpolation); + var PowOut = function (_Pow) { + _inherits(PowOut, _Pow); + var _super2 = _createSuper(PowOut); + function PowOut(power) { + _classCallCheck(this, PowOut); + return _super2.call(this, power); + } + _createClass(PowOut, [{ + key: "applyInternal", + value: function applyInternal(a) { + return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1; + } + }]); + return PowOut; + }(Pow); + var Utils = function () { + function Utils() { + _classCallCheck(this, Utils); + } + _createClass(Utils, null, [{ + key: "arrayCopy", + value: function arrayCopy(source, sourceStart, dest, destStart, numElements) { + for (var i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) { + dest[j] = source[i]; + } + } + }, { + key: "arrayFill", + value: function arrayFill(array, fromIndex, toIndex, value) { + for (var i = fromIndex; i < toIndex; i++) array[i] = value; + } + }, { + key: "setArraySize", + value: function setArraySize(array, size) { + var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var oldSize = array.length; + if (oldSize == size) return array; + array.length = size; + if (oldSize < size) { + for (var i = oldSize; i < size; i++) array[i] = value; + } + return array; + } + }, { + key: "ensureArrayCapacity", + value: function ensureArrayCapacity(array, size) { + var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + if (array.length >= size) return array; + return Utils.setArraySize(array, size, value); + } + }, { + key: "newArray", + value: function newArray(size, defaultValue) { + var array = new Array(size); + for (var i = 0; i < size; i++) array[i] = defaultValue; + return array; + } + }, { + key: "newFloatArray", + value: function newFloatArray(size) { + if (Utils.SUPPORTS_TYPED_ARRAYS) return new Float32Array(size);else { + var array = new Array(size); + for (var i = 0; i < array.length; i++) array[i] = 0; + return array; + } + } + }, { + key: "newShortArray", + value: function newShortArray(size) { + if (Utils.SUPPORTS_TYPED_ARRAYS) return new Int16Array(size);else { + var array = new Array(size); + for (var i = 0; i < array.length; i++) array[i] = 0; + return array; + } + } + }, { + key: "toFloatArray", + value: function toFloatArray(array) { + return Utils.SUPPORTS_TYPED_ARRAYS ? new Float32Array(array) : array; + } + }, { + key: "toSinglePrecision", + value: function toSinglePrecision(value) { + return Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value; + } + }, { + key: "webkit602BugfixHelper", + value: function webkit602BugfixHelper(alpha, blend) {} + }, { + key: "contains", + value: function contains(array, element) { + for (var i = 0; i < array.length; i++) if (array[i] == element) return true; + return false; + } + }, { + key: "enumValue", + value: function enumValue(type, name) { + return type[name[0].toUpperCase() + name.slice(1)]; + } + }]); + return Utils; + }(); + Utils.SUPPORTS_TYPED_ARRAYS = typeof Float32Array !== "undefined"; + var DebugUtils = function () { + function DebugUtils() { + _classCallCheck(this, DebugUtils); + } + _createClass(DebugUtils, null, [{ + key: "logBones", + value: function logBones(skeleton) { + for (var i = 0; i < skeleton.bones.length; i++) { + var bone = skeleton.bones[i]; + console.log(bone.data.name + ", " + bone.a + ", " + bone.b + ", " + bone.c + ", " + bone.d + ", " + bone.worldX + ", " + bone.worldY); + } + } + }]); + return DebugUtils; + }(); + var Pool = function () { + function Pool(instantiator) { + _classCallCheck(this, Pool); + this.items = new Array(); + this.instantiator = instantiator; + } + _createClass(Pool, [{ + key: "obtain", + value: function obtain() { + return this.items.length > 0 ? this.items.pop() : this.instantiator(); + } + }, { + key: "free", + value: function free(item) { + if (item.reset) item.reset(); + this.items.push(item); + } + }, { + key: "freeAll", + value: function freeAll(items) { + for (var i = 0; i < items.length; i++) this.free(items[i]); + } + }, { + key: "clear", + value: function clear() { + this.items.length = 0; + } + }]); + return Pool; + }(); + var Vector2 = function () { + function Vector2() { + var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + _classCallCheck(this, Vector2); + this.x = x; + this.y = y; + } + _createClass(Vector2, [{ + key: "set", + value: function set(x, y) { + this.x = x; + this.y = y; + return this; + } + }, { + key: "length", + value: function length() { + var x = this.x; + var y = this.y; + return Math.sqrt(x * x + y * y); + } + }, { + key: "normalize", + value: function normalize() { + var len = this.length(); + if (len != 0) { + this.x /= len; + this.y /= len; + } + return this; + } + }]); + return Vector2; + }(); + var TimeKeeper = function () { + function TimeKeeper() { + _classCallCheck(this, TimeKeeper); + this.maxDelta = 0.064; + this.framesPerSecond = 0; + this.delta = 0; + this.totalTime = 0; + this.lastTime = Date.now() / 1000; + this.frameCount = 0; + this.frameTime = 0; + } + _createClass(TimeKeeper, [{ + key: "update", + value: function update() { + var now = Date.now() / 1000; + this.delta = now - this.lastTime; + this.frameTime += this.delta; + this.totalTime += this.delta; + if (this.delta > this.maxDelta) this.delta = this.maxDelta; + this.lastTime = now; + this.frameCount++; + if (this.frameTime > 1) { + this.framesPerSecond = this.frameCount / this.frameTime; + this.frameTime = 0; + this.frameCount = 0; + } + } + }]); + return TimeKeeper; + }(); + var WindowedMean = function () { + function WindowedMean() { + var windowSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32; + _classCallCheck(this, WindowedMean); + this.addedValues = 0; + this.lastValue = 0; + this.mean = 0; + this.dirty = true; + this.values = new Array(windowSize); + } + _createClass(WindowedMean, [{ + key: "hasEnoughData", + value: function hasEnoughData() { + return this.addedValues >= this.values.length; + } + }, { + key: "addValue", + value: function addValue(value) { + if (this.addedValues < this.values.length) this.addedValues++; + this.values[this.lastValue++] = value; + if (this.lastValue > this.values.length - 1) this.lastValue = 0; + this.dirty = true; + } + }, { + key: "getMean", + value: function getMean() { + if (this.hasEnoughData()) { + if (this.dirty) { + var mean = 0; + for (var i = 0; i < this.values.length; i++) mean += this.values[i]; + this.mean = mean / this.values.length; + this.dirty = false; + } + return this.mean; + } + return 0; + } + }]); + return WindowedMean; + }(); + + var Attachment = _createClass(function Attachment(name) { + _classCallCheck(this, Attachment); + if (!name) throw new Error("name cannot be null."); + this.name = name; + }); + var VertexAttachment = function (_Attachment) { + _inherits(VertexAttachment, _Attachment); + var _super = _createSuper(VertexAttachment); + function VertexAttachment(name) { + var _this; + _classCallCheck(this, VertexAttachment); + _this = _super.call(this, name); + _this.id = VertexAttachment.nextID++; + _this.bones = null; + _this.vertices = null; + _this.worldVerticesLength = 0; + _this.deformAttachment = _assertThisInitialized(_this); + return _this; + } + _createClass(VertexAttachment, [{ + key: "computeWorldVertices", + value: function computeWorldVertices(slot, start, count, worldVertices, offset, stride) { + count = offset + (count >> 1) * stride; + var skeleton = slot.bone.skeleton; + var deformArray = slot.deform; + var vertices = this.vertices; + var bones = this.bones; + if (!bones) { + if (deformArray.length > 0) vertices = deformArray; + var bone = slot.bone; + var x = bone.worldX; + var y = bone.worldY; + var a = bone.a, + b = bone.b, + c = bone.c, + d = bone.d; + for (var _v = start, w = offset; w < count; _v += 2, w += stride) { + var vx = vertices[_v], + vy = vertices[_v + 1]; + worldVertices[w] = vx * a + vy * b + x; + worldVertices[w + 1] = vx * c + vy * d + y; + } + return; + } + var v = 0, + skip = 0; + for (var i = 0; i < start; i += 2) { + var n = bones[v]; + v += n + 1; + skip += n; + } + var skeletonBones = skeleton.bones; + if (deformArray.length == 0) { + for (var _w = offset, _b = skip * 3; _w < count; _w += stride) { + var wx = 0, + wy = 0; + var _n = bones[v++]; + _n += v; + for (; v < _n; v++, _b += 3) { + var _bone = skeletonBones[bones[v]]; + var _vx = vertices[_b], + _vy = vertices[_b + 1], + weight = vertices[_b + 2]; + wx += (_vx * _bone.a + _vy * _bone.b + _bone.worldX) * weight; + wy += (_vx * _bone.c + _vy * _bone.d + _bone.worldY) * weight; + } + worldVertices[_w] = wx; + worldVertices[_w + 1] = wy; + } + } else { + var deform = deformArray; + for (var _w2 = offset, _b2 = skip * 3, f = skip << 1; _w2 < count; _w2 += stride) { + var _wx = 0, + _wy = 0; + var _n2 = bones[v++]; + _n2 += v; + for (; v < _n2; v++, _b2 += 3, f += 2) { + var _bone2 = skeletonBones[bones[v]]; + var _vx2 = vertices[_b2] + deform[f], + _vy2 = vertices[_b2 + 1] + deform[f + 1], + _weight = vertices[_b2 + 2]; + _wx += (_vx2 * _bone2.a + _vy2 * _bone2.b + _bone2.worldX) * _weight; + _wy += (_vx2 * _bone2.c + _vy2 * _bone2.d + _bone2.worldY) * _weight; + } + worldVertices[_w2] = _wx; + worldVertices[_w2 + 1] = _wy; + } + } + } + }, { + key: "copyTo", + value: function copyTo(attachment) { + if (this.bones) { + attachment.bones = new Array(this.bones.length); + Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length); + } else attachment.bones = null; + if (this.vertices) { + attachment.vertices = Utils.newFloatArray(this.vertices.length); + Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length); + } else attachment.vertices = null; + attachment.worldVerticesLength = this.worldVerticesLength; + attachment.deformAttachment = this.deformAttachment; + } + }]); + return VertexAttachment; + }(Attachment); + VertexAttachment.nextID = 0; + + var Animation = function () { + function Animation(name, timelines, duration) { + _classCallCheck(this, Animation); + this.timelines = null; + this.timelineIds = null; + if (!name) throw new Error("name cannot be null."); + this.name = name; + this.setTimelines(timelines); + this.duration = duration; + } + _createClass(Animation, [{ + key: "setTimelines", + value: function setTimelines(timelines) { + if (!timelines) throw new Error("timelines cannot be null."); + this.timelines = timelines; + this.timelineIds = new StringSet(); + for (var i = 0; i < timelines.length; i++) this.timelineIds.addAll(timelines[i].getPropertyIds()); + } + }, { + key: "hasTimeline", + value: function hasTimeline(ids) { + for (var i = 0; i < ids.length; i++) if (this.timelineIds.contains(ids[i])) return true; + return false; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, loop, events, alpha, blend, direction) { + if (!skeleton) throw new Error("skeleton cannot be null."); + if (loop && this.duration != 0) { + time %= this.duration; + if (lastTime > 0) lastTime %= this.duration; + } + var timelines = this.timelines; + for (var i = 0, n = timelines.length; i < n; i++) timelines[i].apply(skeleton, lastTime, time, events, alpha, blend, direction); + } + }]); + return Animation; + }(); + var MixBlend; + (function (MixBlend) { + MixBlend[MixBlend["setup"] = 0] = "setup"; + MixBlend[MixBlend["first"] = 1] = "first"; + MixBlend[MixBlend["replace"] = 2] = "replace"; + MixBlend[MixBlend["add"] = 3] = "add"; + })(MixBlend || (MixBlend = {})); + var MixDirection; + (function (MixDirection) { + MixDirection[MixDirection["mixIn"] = 0] = "mixIn"; + MixDirection[MixDirection["mixOut"] = 1] = "mixOut"; + })(MixDirection || (MixDirection = {})); + var Property = { + rotate: 0, + x: 1, + y: 2, + scaleX: 3, + scaleY: 4, + shearX: 5, + shearY: 6, + rgb: 7, + alpha: 8, + rgb2: 9, + attachment: 10, + deform: 11, + event: 12, + drawOrder: 13, + ikConstraint: 14, + transformConstraint: 15, + pathConstraintPosition: 16, + pathConstraintSpacing: 17, + pathConstraintMix: 18 + }; + var Timeline = function () { + function Timeline(frameCount, propertyIds) { + _classCallCheck(this, Timeline); + this.propertyIds = null; + this.frames = null; + this.propertyIds = propertyIds; + this.frames = Utils.newFloatArray(frameCount * this.getFrameEntries()); + } + _createClass(Timeline, [{ + key: "getPropertyIds", + value: function getPropertyIds() { + return this.propertyIds; + } + }, { + key: "getFrameEntries", + value: function getFrameEntries() { + return 1; + } + }, { + key: "getFrameCount", + value: function getFrameCount() { + return this.frames.length / this.getFrameEntries(); + } + }, { + key: "getDuration", + value: function getDuration() { + return this.frames[this.frames.length - this.getFrameEntries()]; + } + }], [{ + key: "search1", + value: function search1(frames, time) { + var n = frames.length; + for (var i = 1; i < n; i++) if (frames[i] > time) return i - 1; + return n - 1; + } + }, { + key: "search", + value: function search(frames, time, step) { + var n = frames.length; + for (var i = step; i < n; i += step) if (frames[i] > time) return i - step; + return n - step; + } + }]); + return Timeline; + }(); + var CurveTimeline = function (_Timeline) { + _inherits(CurveTimeline, _Timeline); + var _super = _createSuper(CurveTimeline); + function CurveTimeline(frameCount, bezierCount, propertyIds) { + var _this; + _classCallCheck(this, CurveTimeline); + _this = _super.call(this, frameCount, propertyIds); + _this.curves = null; + _this.curves = Utils.newFloatArray(frameCount + bezierCount * 18); + _this.curves[frameCount - 1] = 1; + return _this; + } + _createClass(CurveTimeline, [{ + key: "setLinear", + value: function setLinear(frame) { + this.curves[frame] = 0; + } + }, { + key: "setStepped", + value: function setStepped(frame) { + this.curves[frame] = 1; + } + }, { + key: "shrink", + value: function shrink(bezierCount) { + var size = this.getFrameCount() + bezierCount * 18; + if (this.curves.length > size) { + var newCurves = Utils.newFloatArray(size); + Utils.arrayCopy(this.curves, 0, newCurves, 0, size); + this.curves = newCurves; + } + } + }, { + key: "setBezier", + value: function setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) { + var curves = this.curves; + var i = this.getFrameCount() + bezier * 18; + if (value == 0) curves[frame] = 2 + i; + var tmpx = (time1 - cx1 * 2 + cx2) * 0.03, + tmpy = (value1 - cy1 * 2 + cy2) * 0.03; + var dddx = ((cx1 - cx2) * 3 - time1 + time2) * 0.006, + dddy = ((cy1 - cy2) * 3 - value1 + value2) * 0.006; + var ddx = tmpx * 2 + dddx, + ddy = tmpy * 2 + dddy; + var dx = (cx1 - time1) * 0.3 + tmpx + dddx * 0.16666667, + dy = (cy1 - value1) * 0.3 + tmpy + dddy * 0.16666667; + var x = time1 + dx, + y = value1 + dy; + for (var n = i + 18; i < n; i += 2) { + curves[i] = x; + curves[i + 1] = y; + dx += ddx; + dy += ddy; + ddx += dddx; + ddy += dddy; + x += dx; + y += dy; + } + } + }, { + key: "getBezierValue", + value: function getBezierValue(time, frameIndex, valueOffset, i) { + var curves = this.curves; + if (curves[i] > time) { + var _x = this.frames[frameIndex], + _y = this.frames[frameIndex + valueOffset]; + return _y + (time - _x) / (curves[i] - _x) * (curves[i + 1] - _y); + } + var n = i + 18; + for (i += 2; i < n; i += 2) { + if (curves[i] >= time) { + var _x2 = curves[i - 2], + _y2 = curves[i - 1]; + return _y2 + (time - _x2) / (curves[i] - _x2) * (curves[i + 1] - _y2); + } + } + frameIndex += this.getFrameEntries(); + var x = curves[n - 2], + y = curves[n - 1]; + return y + (time - x) / (this.frames[frameIndex] - x) * (this.frames[frameIndex + valueOffset] - y); + } + }]); + return CurveTimeline; + }(Timeline); + var CurveTimeline1 = function (_CurveTimeline) { + _inherits(CurveTimeline1, _CurveTimeline); + var _super2 = _createSuper(CurveTimeline1); + function CurveTimeline1(frameCount, bezierCount, propertyId) { + _classCallCheck(this, CurveTimeline1); + return _super2.call(this, frameCount, bezierCount, [propertyId]); + } + _createClass(CurveTimeline1, [{ + key: "getFrameEntries", + value: function getFrameEntries() { + return 2; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, value) { + frame <<= 1; + this.frames[frame] = time; + this.frames[frame + 1] = value; + } + }, { + key: "getCurveValue", + value: function getCurveValue(time) { + var frames = this.frames; + var i = frames.length - 2; + for (var ii = 2; ii <= i; ii += 2) { + if (frames[ii] > time) { + i = ii - 2; + break; + } + } + var curveType = this.curves[i >> 1]; + switch (curveType) { + case 0: + var before = frames[i], + value = frames[i + 1]; + return value + (time - before) / (frames[i + 2] - before) * (frames[i + 2 + 1] - value); + case 1: + return frames[i + 1]; + } + return this.getBezierValue(time, i, 1, curveType - 2); + } + }]); + return CurveTimeline1; + }(CurveTimeline); + var CurveTimeline2 = function (_CurveTimeline2) { + _inherits(CurveTimeline2, _CurveTimeline2); + var _super3 = _createSuper(CurveTimeline2); + function CurveTimeline2(frameCount, bezierCount, propertyId1, propertyId2) { + _classCallCheck(this, CurveTimeline2); + return _super3.call(this, frameCount, bezierCount, [propertyId1, propertyId2]); + } + _createClass(CurveTimeline2, [{ + key: "getFrameEntries", + value: function getFrameEntries() { + return 3; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, value1, value2) { + frame *= 3; + this.frames[frame] = time; + this.frames[frame + 1] = value1; + this.frames[frame + 2] = value2; + } + }]); + return CurveTimeline2; + }(CurveTimeline); + var RotateTimeline = function (_CurveTimeline3) { + _inherits(RotateTimeline, _CurveTimeline3); + var _super4 = _createSuper(RotateTimeline); + function RotateTimeline(frameCount, bezierCount, boneIndex) { + var _this2; + _classCallCheck(this, RotateTimeline); + _this2 = _super4.call(this, frameCount, bezierCount, Property.rotate + "|" + boneIndex); + _this2.boneIndex = 0; + _this2.boneIndex = boneIndex; + return _this2; + } + _createClass(RotateTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var bone = skeleton.bones[this.boneIndex]; + if (!bone.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.rotation = bone.data.rotation; + return; + case MixBlend.first: + bone.rotation += (bone.data.rotation - bone.rotation) * alpha; + } + return; + } + var r = this.getCurveValue(time); + switch (blend) { + case MixBlend.setup: + bone.rotation = bone.data.rotation + r * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + r += bone.data.rotation - bone.rotation; + case MixBlend.add: + bone.rotation += r * alpha; + } + } + }]); + return RotateTimeline; + }(CurveTimeline1); + var TranslateTimeline = function (_CurveTimeline4) { + _inherits(TranslateTimeline, _CurveTimeline4); + var _super5 = _createSuper(TranslateTimeline); + function TranslateTimeline(frameCount, bezierCount, boneIndex) { + var _this3; + _classCallCheck(this, TranslateTimeline); + _this3 = _super5.call(this, frameCount, bezierCount, Property.x + "|" + boneIndex, Property.y + "|" + boneIndex); + _this3.boneIndex = 0; + _this3.boneIndex = boneIndex; + return _this3; + } + _createClass(TranslateTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var bone = skeleton.bones[this.boneIndex]; + if (!bone.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.x = bone.data.x; + bone.y = bone.data.y; + return; + case MixBlend.first: + bone.x += (bone.data.x - bone.x) * alpha; + bone.y += (bone.data.y - bone.y) * alpha; + } + return; + } + var x = 0, + y = 0; + var i = Timeline.search(frames, time, 3); + var curveType = this.curves[i / 3]; + switch (curveType) { + case 0: + var before = frames[i]; + x = frames[i + 1]; + y = frames[i + 2]; + var t = (time - before) / (frames[i + 3] - before); + x += (frames[i + 3 + 1] - x) * t; + y += (frames[i + 3 + 2] - y) * t; + break; + case 1: + x = frames[i + 1]; + y = frames[i + 2]; + break; + default: + x = this.getBezierValue(time, i, 1, curveType - 2); + y = this.getBezierValue(time, i, 2, curveType + 18 - 2); + } + switch (blend) { + case MixBlend.setup: + bone.x = bone.data.x + x * alpha; + bone.y = bone.data.y + y * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + bone.x += (bone.data.x + x - bone.x) * alpha; + bone.y += (bone.data.y + y - bone.y) * alpha; + break; + case MixBlend.add: + bone.x += x * alpha; + bone.y += y * alpha; + } + } + }]); + return TranslateTimeline; + }(CurveTimeline2); + var TranslateXTimeline = function (_CurveTimeline5) { + _inherits(TranslateXTimeline, _CurveTimeline5); + var _super6 = _createSuper(TranslateXTimeline); + function TranslateXTimeline(frameCount, bezierCount, boneIndex) { + var _this4; + _classCallCheck(this, TranslateXTimeline); + _this4 = _super6.call(this, frameCount, bezierCount, Property.x + "|" + boneIndex); + _this4.boneIndex = 0; + _this4.boneIndex = boneIndex; + return _this4; + } + _createClass(TranslateXTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var bone = skeleton.bones[this.boneIndex]; + if (!bone.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.x = bone.data.x; + return; + case MixBlend.first: + bone.x += (bone.data.x - bone.x) * alpha; + } + return; + } + var x = this.getCurveValue(time); + switch (blend) { + case MixBlend.setup: + bone.x = bone.data.x + x * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + bone.x += (bone.data.x + x - bone.x) * alpha; + break; + case MixBlend.add: + bone.x += x * alpha; + } + } + }]); + return TranslateXTimeline; + }(CurveTimeline1); + var TranslateYTimeline = function (_CurveTimeline6) { + _inherits(TranslateYTimeline, _CurveTimeline6); + var _super7 = _createSuper(TranslateYTimeline); + function TranslateYTimeline(frameCount, bezierCount, boneIndex) { + var _this5; + _classCallCheck(this, TranslateYTimeline); + _this5 = _super7.call(this, frameCount, bezierCount, Property.y + "|" + boneIndex); + _this5.boneIndex = 0; + _this5.boneIndex = boneIndex; + return _this5; + } + _createClass(TranslateYTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var bone = skeleton.bones[this.boneIndex]; + if (!bone.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.y = bone.data.y; + return; + case MixBlend.first: + bone.y += (bone.data.y - bone.y) * alpha; + } + return; + } + var y = this.getCurveValue(time); + switch (blend) { + case MixBlend.setup: + bone.y = bone.data.y + y * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + bone.y += (bone.data.y + y - bone.y) * alpha; + break; + case MixBlend.add: + bone.y += y * alpha; + } + } + }]); + return TranslateYTimeline; + }(CurveTimeline1); + var ScaleTimeline = function (_CurveTimeline7) { + _inherits(ScaleTimeline, _CurveTimeline7); + var _super8 = _createSuper(ScaleTimeline); + function ScaleTimeline(frameCount, bezierCount, boneIndex) { + var _this6; + _classCallCheck(this, ScaleTimeline); + _this6 = _super8.call(this, frameCount, bezierCount, Property.scaleX + "|" + boneIndex, Property.scaleY + "|" + boneIndex); + _this6.boneIndex = 0; + _this6.boneIndex = boneIndex; + return _this6; + } + _createClass(ScaleTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var bone = skeleton.bones[this.boneIndex]; + if (!bone.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.scaleX = bone.data.scaleX; + bone.scaleY = bone.data.scaleY; + return; + case MixBlend.first: + bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha; + bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha; + } + return; + } + var x, y; + var i = Timeline.search(frames, time, 3); + var curveType = this.curves[i / 3]; + switch (curveType) { + case 0: + var before = frames[i]; + x = frames[i + 1]; + y = frames[i + 2]; + var t = (time - before) / (frames[i + 3] - before); + x += (frames[i + 3 + 1] - x) * t; + y += (frames[i + 3 + 2] - y) * t; + break; + case 1: + x = frames[i + 1]; + y = frames[i + 2]; + break; + default: + x = this.getBezierValue(time, i, 1, curveType - 2); + y = this.getBezierValue(time, i, 2, curveType + 18 - 2); + } + x *= bone.data.scaleX; + y *= bone.data.scaleY; + if (alpha == 1) { + if (blend == MixBlend.add) { + bone.scaleX += x - bone.data.scaleX; + bone.scaleY += y - bone.data.scaleY; + } else { + bone.scaleX = x; + bone.scaleY = y; + } + } else { + var bx = 0, + by = 0; + if (direction == MixDirection.mixOut) { + switch (blend) { + case MixBlend.setup: + bx = bone.data.scaleX; + by = bone.data.scaleY; + bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha; + bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + bx = bone.scaleX; + by = bone.scaleY; + bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha; + bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha; + break; + case MixBlend.add: + bone.scaleX += (x - bone.data.scaleX) * alpha; + bone.scaleY += (y - bone.data.scaleY) * alpha; + } + } else { + switch (blend) { + case MixBlend.setup: + bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x); + by = Math.abs(bone.data.scaleY) * MathUtils.signum(y); + bone.scaleX = bx + (x - bx) * alpha; + bone.scaleY = by + (y - by) * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + bx = Math.abs(bone.scaleX) * MathUtils.signum(x); + by = Math.abs(bone.scaleY) * MathUtils.signum(y); + bone.scaleX = bx + (x - bx) * alpha; + bone.scaleY = by + (y - by) * alpha; + break; + case MixBlend.add: + bone.scaleX += (x - bone.data.scaleX) * alpha; + bone.scaleY += (y - bone.data.scaleY) * alpha; + } + } + } + } + }]); + return ScaleTimeline; + }(CurveTimeline2); + var ScaleXTimeline = function (_CurveTimeline8) { + _inherits(ScaleXTimeline, _CurveTimeline8); + var _super9 = _createSuper(ScaleXTimeline); + function ScaleXTimeline(frameCount, bezierCount, boneIndex) { + var _this7; + _classCallCheck(this, ScaleXTimeline); + _this7 = _super9.call(this, frameCount, bezierCount, Property.scaleX + "|" + boneIndex); + _this7.boneIndex = 0; + _this7.boneIndex = boneIndex; + return _this7; + } + _createClass(ScaleXTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var bone = skeleton.bones[this.boneIndex]; + if (!bone.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.scaleX = bone.data.scaleX; + return; + case MixBlend.first: + bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha; + } + return; + } + var x = this.getCurveValue(time) * bone.data.scaleX; + if (alpha == 1) { + if (blend == MixBlend.add) bone.scaleX += x - bone.data.scaleX;else bone.scaleX = x; + } else { + var bx = 0; + if (direction == MixDirection.mixOut) { + switch (blend) { + case MixBlend.setup: + bx = bone.data.scaleX; + bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + bx = bone.scaleX; + bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha; + break; + case MixBlend.add: + bone.scaleX += (x - bone.data.scaleX) * alpha; + } + } else { + switch (blend) { + case MixBlend.setup: + bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x); + bone.scaleX = bx + (x - bx) * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + bx = Math.abs(bone.scaleX) * MathUtils.signum(x); + bone.scaleX = bx + (x - bx) * alpha; + break; + case MixBlend.add: + bone.scaleX += (x - bone.data.scaleX) * alpha; + } + } + } + } + }]); + return ScaleXTimeline; + }(CurveTimeline1); + var ScaleYTimeline = function (_CurveTimeline9) { + _inherits(ScaleYTimeline, _CurveTimeline9); + var _super10 = _createSuper(ScaleYTimeline); + function ScaleYTimeline(frameCount, bezierCount, boneIndex) { + var _this8; + _classCallCheck(this, ScaleYTimeline); + _this8 = _super10.call(this, frameCount, bezierCount, Property.scaleY + "|" + boneIndex); + _this8.boneIndex = 0; + _this8.boneIndex = boneIndex; + return _this8; + } + _createClass(ScaleYTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var bone = skeleton.bones[this.boneIndex]; + if (!bone.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.scaleY = bone.data.scaleY; + return; + case MixBlend.first: + bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha; + } + return; + } + var y = this.getCurveValue(time) * bone.data.scaleY; + if (alpha == 1) { + if (blend == MixBlend.add) bone.scaleY += y - bone.data.scaleY;else bone.scaleY = y; + } else { + var by = 0; + if (direction == MixDirection.mixOut) { + switch (blend) { + case MixBlend.setup: + by = bone.data.scaleY; + bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + by = bone.scaleY; + bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha; + break; + case MixBlend.add: + bone.scaleY += (y - bone.data.scaleY) * alpha; + } + } else { + switch (blend) { + case MixBlend.setup: + by = Math.abs(bone.data.scaleY) * MathUtils.signum(y); + bone.scaleY = by + (y - by) * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + by = Math.abs(bone.scaleY) * MathUtils.signum(y); + bone.scaleY = by + (y - by) * alpha; + break; + case MixBlend.add: + bone.scaleY += (y - bone.data.scaleY) * alpha; + } + } + } + } + }]); + return ScaleYTimeline; + }(CurveTimeline1); + var ShearTimeline = function (_CurveTimeline10) { + _inherits(ShearTimeline, _CurveTimeline10); + var _super11 = _createSuper(ShearTimeline); + function ShearTimeline(frameCount, bezierCount, boneIndex) { + var _this9; + _classCallCheck(this, ShearTimeline); + _this9 = _super11.call(this, frameCount, bezierCount, Property.shearX + "|" + boneIndex, Property.shearY + "|" + boneIndex); + _this9.boneIndex = 0; + _this9.boneIndex = boneIndex; + return _this9; + } + _createClass(ShearTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var bone = skeleton.bones[this.boneIndex]; + if (!bone.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.shearX = bone.data.shearX; + bone.shearY = bone.data.shearY; + return; + case MixBlend.first: + bone.shearX += (bone.data.shearX - bone.shearX) * alpha; + bone.shearY += (bone.data.shearY - bone.shearY) * alpha; + } + return; + } + var x = 0, + y = 0; + var i = Timeline.search(frames, time, 3); + var curveType = this.curves[i / 3]; + switch (curveType) { + case 0: + var before = frames[i]; + x = frames[i + 1]; + y = frames[i + 2]; + var t = (time - before) / (frames[i + 3] - before); + x += (frames[i + 3 + 1] - x) * t; + y += (frames[i + 3 + 2] - y) * t; + break; + case 1: + x = frames[i + 1]; + y = frames[i + 2]; + break; + default: + x = this.getBezierValue(time, i, 1, curveType - 2); + y = this.getBezierValue(time, i, 2, curveType + 18 - 2); + } + switch (blend) { + case MixBlend.setup: + bone.shearX = bone.data.shearX + x * alpha; + bone.shearY = bone.data.shearY + y * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha; + bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha; + break; + case MixBlend.add: + bone.shearX += x * alpha; + bone.shearY += y * alpha; + } + } + }]); + return ShearTimeline; + }(CurveTimeline2); + var ShearXTimeline = function (_CurveTimeline11) { + _inherits(ShearXTimeline, _CurveTimeline11); + var _super12 = _createSuper(ShearXTimeline); + function ShearXTimeline(frameCount, bezierCount, boneIndex) { + var _this10; + _classCallCheck(this, ShearXTimeline); + _this10 = _super12.call(this, frameCount, bezierCount, Property.shearX + "|" + boneIndex); + _this10.boneIndex = 0; + _this10.boneIndex = boneIndex; + return _this10; + } + _createClass(ShearXTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var bone = skeleton.bones[this.boneIndex]; + if (!bone.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.shearX = bone.data.shearX; + return; + case MixBlend.first: + bone.shearX += (bone.data.shearX - bone.shearX) * alpha; + } + return; + } + var x = this.getCurveValue(time); + switch (blend) { + case MixBlend.setup: + bone.shearX = bone.data.shearX + x * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha; + break; + case MixBlend.add: + bone.shearX += x * alpha; + } + } + }]); + return ShearXTimeline; + }(CurveTimeline1); + var ShearYTimeline = function (_CurveTimeline12) { + _inherits(ShearYTimeline, _CurveTimeline12); + var _super13 = _createSuper(ShearYTimeline); + function ShearYTimeline(frameCount, bezierCount, boneIndex) { + var _this11; + _classCallCheck(this, ShearYTimeline); + _this11 = _super13.call(this, frameCount, bezierCount, Property.shearY + "|" + boneIndex); + _this11.boneIndex = 0; + _this11.boneIndex = boneIndex; + return _this11; + } + _createClass(ShearYTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var bone = skeleton.bones[this.boneIndex]; + if (!bone.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.shearY = bone.data.shearY; + return; + case MixBlend.first: + bone.shearY += (bone.data.shearY - bone.shearY) * alpha; + } + return; + } + var y = this.getCurveValue(time); + switch (blend) { + case MixBlend.setup: + bone.shearY = bone.data.shearY + y * alpha; + break; + case MixBlend.first: + case MixBlend.replace: + bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha; + break; + case MixBlend.add: + bone.shearY += y * alpha; + } + } + }]); + return ShearYTimeline; + }(CurveTimeline1); + var RGBATimeline = function (_CurveTimeline13) { + _inherits(RGBATimeline, _CurveTimeline13); + var _super14 = _createSuper(RGBATimeline); + function RGBATimeline(frameCount, bezierCount, slotIndex) { + var _this12; + _classCallCheck(this, RGBATimeline); + _this12 = _super14.call(this, frameCount, bezierCount, [Property.rgb + "|" + slotIndex, Property.alpha + "|" + slotIndex]); + _this12.slotIndex = 0; + _this12.slotIndex = slotIndex; + return _this12; + } + _createClass(RGBATimeline, [{ + key: "getFrameEntries", + value: function getFrameEntries() { + return 5; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, r, g, b, a) { + frame *= 5; + this.frames[frame] = time; + this.frames[frame + 1] = r; + this.frames[frame + 2] = g; + this.frames[frame + 3] = b; + this.frames[frame + 4] = a; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var slot = skeleton.slots[this.slotIndex]; + if (!slot.bone.active) return; + var frames = this.frames; + var color = slot.color; + if (time < frames[0]) { + var setup = slot.data.color; + switch (blend) { + case MixBlend.setup: + color.setFromColor(setup); + return; + case MixBlend.first: + color.add((setup.r - color.r) * alpha, (setup.g - color.g) * alpha, (setup.b - color.b) * alpha, (setup.a - color.a) * alpha); + } + return; + } + var r = 0, + g = 0, + b = 0, + a = 0; + var i = Timeline.search(frames, time, 5); + var curveType = this.curves[i / 5]; + switch (curveType) { + case 0: + var before = frames[i]; + r = frames[i + 1]; + g = frames[i + 2]; + b = frames[i + 3]; + a = frames[i + 4]; + var t = (time - before) / (frames[i + 5] - before); + r += (frames[i + 5 + 1] - r) * t; + g += (frames[i + 5 + 2] - g) * t; + b += (frames[i + 5 + 3] - b) * t; + a += (frames[i + 5 + 4] - a) * t; + break; + case 1: + r = frames[i + 1]; + g = frames[i + 2]; + b = frames[i + 3]; + a = frames[i + 4]; + break; + default: + r = this.getBezierValue(time, i, 1, curveType - 2); + g = this.getBezierValue(time, i, 2, curveType + 18 - 2); + b = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2); + a = this.getBezierValue(time, i, 4, curveType + 18 * 3 - 2); + } + if (alpha == 1) color.set(r, g, b, a);else { + if (blend == MixBlend.setup) color.setFromColor(slot.data.color); + color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha); + } + } + }]); + return RGBATimeline; + }(CurveTimeline); + var RGBTimeline = function (_CurveTimeline14) { + _inherits(RGBTimeline, _CurveTimeline14); + var _super15 = _createSuper(RGBTimeline); + function RGBTimeline(frameCount, bezierCount, slotIndex) { + var _this13; + _classCallCheck(this, RGBTimeline); + _this13 = _super15.call(this, frameCount, bezierCount, [Property.rgb + "|" + slotIndex]); + _this13.slotIndex = 0; + _this13.slotIndex = slotIndex; + return _this13; + } + _createClass(RGBTimeline, [{ + key: "getFrameEntries", + value: function getFrameEntries() { + return 4; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, r, g, b) { + frame <<= 2; + this.frames[frame] = time; + this.frames[frame + 1] = r; + this.frames[frame + 2] = g; + this.frames[frame + 3] = b; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var slot = skeleton.slots[this.slotIndex]; + if (!slot.bone.active) return; + var frames = this.frames; + var color = slot.color; + if (time < frames[0]) { + var setup = slot.data.color; + switch (blend) { + case MixBlend.setup: + color.r = setup.r; + color.g = setup.g; + color.b = setup.b; + return; + case MixBlend.first: + color.r += (setup.r - color.r) * alpha; + color.g += (setup.g - color.g) * alpha; + color.b += (setup.b - color.b) * alpha; + } + return; + } + var r = 0, + g = 0, + b = 0; + var i = Timeline.search(frames, time, 4); + var curveType = this.curves[i >> 2]; + switch (curveType) { + case 0: + var before = frames[i]; + r = frames[i + 1]; + g = frames[i + 2]; + b = frames[i + 3]; + var t = (time - before) / (frames[i + 4] - before); + r += (frames[i + 4 + 1] - r) * t; + g += (frames[i + 4 + 2] - g) * t; + b += (frames[i + 4 + 3] - b) * t; + break; + case 1: + r = frames[i + 1]; + g = frames[i + 2]; + b = frames[i + 3]; + break; + default: + r = this.getBezierValue(time, i, 1, curveType - 2); + g = this.getBezierValue(time, i, 2, curveType + 18 - 2); + b = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2); + } + if (alpha == 1) { + color.r = r; + color.g = g; + color.b = b; + } else { + if (blend == MixBlend.setup) { + var _setup = slot.data.color; + color.r = _setup.r; + color.g = _setup.g; + color.b = _setup.b; + } + color.r += (r - color.r) * alpha; + color.g += (g - color.g) * alpha; + color.b += (b - color.b) * alpha; + } + } + }]); + return RGBTimeline; + }(CurveTimeline); + var AlphaTimeline = function (_CurveTimeline15) { + _inherits(AlphaTimeline, _CurveTimeline15); + var _super16 = _createSuper(AlphaTimeline); + function AlphaTimeline(frameCount, bezierCount, slotIndex) { + var _this14; + _classCallCheck(this, AlphaTimeline); + _this14 = _super16.call(this, frameCount, bezierCount, Property.alpha + "|" + slotIndex); + _this14.slotIndex = 0; + _this14.slotIndex = slotIndex; + return _this14; + } + _createClass(AlphaTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var slot = skeleton.slots[this.slotIndex]; + if (!slot.bone.active) return; + var color = slot.color; + if (time < this.frames[0]) { + var setup = slot.data.color; + switch (blend) { + case MixBlend.setup: + color.a = setup.a; + return; + case MixBlend.first: + color.a += (setup.a - color.a) * alpha; + } + return; + } + var a = this.getCurveValue(time); + if (alpha == 1) color.a = a;else { + if (blend == MixBlend.setup) color.a = slot.data.color.a; + color.a += (a - color.a) * alpha; + } + } + }]); + return AlphaTimeline; + }(CurveTimeline1); + var RGBA2Timeline = function (_CurveTimeline16) { + _inherits(RGBA2Timeline, _CurveTimeline16); + var _super17 = _createSuper(RGBA2Timeline); + function RGBA2Timeline(frameCount, bezierCount, slotIndex) { + var _this15; + _classCallCheck(this, RGBA2Timeline); + _this15 = _super17.call(this, frameCount, bezierCount, [Property.rgb + "|" + slotIndex, Property.alpha + "|" + slotIndex, Property.rgb2 + "|" + slotIndex]); + _this15.slotIndex = 0; + _this15.slotIndex = slotIndex; + return _this15; + } + _createClass(RGBA2Timeline, [{ + key: "getFrameEntries", + value: function getFrameEntries() { + return 8; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, r, g, b, a, r2, g2, b2) { + frame <<= 3; + this.frames[frame] = time; + this.frames[frame + 1] = r; + this.frames[frame + 2] = g; + this.frames[frame + 3] = b; + this.frames[frame + 4] = a; + this.frames[frame + 5] = r2; + this.frames[frame + 6] = g2; + this.frames[frame + 7] = b2; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var slot = skeleton.slots[this.slotIndex]; + if (!slot.bone.active) return; + var frames = this.frames; + var light = slot.color, + dark = slot.darkColor; + if (time < frames[0]) { + var setupLight = slot.data.color, + setupDark = slot.data.darkColor; + switch (blend) { + case MixBlend.setup: + light.setFromColor(setupLight); + dark.r = setupDark.r; + dark.g = setupDark.g; + dark.b = setupDark.b; + return; + case MixBlend.first: + light.add((setupLight.r - light.r) * alpha, (setupLight.g - light.g) * alpha, (setupLight.b - light.b) * alpha, (setupLight.a - light.a) * alpha); + dark.r += (setupDark.r - dark.r) * alpha; + dark.g += (setupDark.g - dark.g) * alpha; + dark.b += (setupDark.b - dark.b) * alpha; + } + return; + } + var r = 0, + g = 0, + b = 0, + a = 0, + r2 = 0, + g2 = 0, + b2 = 0; + var i = Timeline.search(frames, time, 8); + var curveType = this.curves[i >> 3]; + switch (curveType) { + case 0: + var before = frames[i]; + r = frames[i + 1]; + g = frames[i + 2]; + b = frames[i + 3]; + a = frames[i + 4]; + r2 = frames[i + 5]; + g2 = frames[i + 6]; + b2 = frames[i + 7]; + var t = (time - before) / (frames[i + 8] - before); + r += (frames[i + 8 + 1] - r) * t; + g += (frames[i + 8 + 2] - g) * t; + b += (frames[i + 8 + 3] - b) * t; + a += (frames[i + 8 + 4] - a) * t; + r2 += (frames[i + 8 + 5] - r2) * t; + g2 += (frames[i + 8 + 6] - g2) * t; + b2 += (frames[i + 8 + 7] - b2) * t; + break; + case 1: + r = frames[i + 1]; + g = frames[i + 2]; + b = frames[i + 3]; + a = frames[i + 4]; + r2 = frames[i + 5]; + g2 = frames[i + 6]; + b2 = frames[i + 7]; + break; + default: + r = this.getBezierValue(time, i, 1, curveType - 2); + g = this.getBezierValue(time, i, 2, curveType + 18 - 2); + b = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2); + a = this.getBezierValue(time, i, 4, curveType + 18 * 3 - 2); + r2 = this.getBezierValue(time, i, 5, curveType + 18 * 4 - 2); + g2 = this.getBezierValue(time, i, 6, curveType + 18 * 5 - 2); + b2 = this.getBezierValue(time, i, 7, curveType + 18 * 6 - 2); + } + if (alpha == 1) { + light.set(r, g, b, a); + dark.r = r2; + dark.g = g2; + dark.b = b2; + } else { + if (blend == MixBlend.setup) { + light.setFromColor(slot.data.color); + var _setupDark = slot.data.darkColor; + dark.r = _setupDark.r; + dark.g = _setupDark.g; + dark.b = _setupDark.b; + } + light.add((r - light.r) * alpha, (g - light.g) * alpha, (b - light.b) * alpha, (a - light.a) * alpha); + dark.r += (r2 - dark.r) * alpha; + dark.g += (g2 - dark.g) * alpha; + dark.b += (b2 - dark.b) * alpha; + } + } + }]); + return RGBA2Timeline; + }(CurveTimeline); + var RGB2Timeline = function (_CurveTimeline17) { + _inherits(RGB2Timeline, _CurveTimeline17); + var _super18 = _createSuper(RGB2Timeline); + function RGB2Timeline(frameCount, bezierCount, slotIndex) { + var _this16; + _classCallCheck(this, RGB2Timeline); + _this16 = _super18.call(this, frameCount, bezierCount, [Property.rgb + "|" + slotIndex, Property.rgb2 + "|" + slotIndex]); + _this16.slotIndex = 0; + _this16.slotIndex = slotIndex; + return _this16; + } + _createClass(RGB2Timeline, [{ + key: "getFrameEntries", + value: function getFrameEntries() { + return 7; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, r, g, b, r2, g2, b2) { + frame *= 7; + this.frames[frame] = time; + this.frames[frame + 1] = r; + this.frames[frame + 2] = g; + this.frames[frame + 3] = b; + this.frames[frame + 4] = r2; + this.frames[frame + 5] = g2; + this.frames[frame + 6] = b2; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var slot = skeleton.slots[this.slotIndex]; + if (!slot.bone.active) return; + var frames = this.frames; + var light = slot.color, + dark = slot.darkColor; + if (time < frames[0]) { + var setupLight = slot.data.color, + setupDark = slot.data.darkColor; + switch (blend) { + case MixBlend.setup: + light.r = setupLight.r; + light.g = setupLight.g; + light.b = setupLight.b; + dark.r = setupDark.r; + dark.g = setupDark.g; + dark.b = setupDark.b; + return; + case MixBlend.first: + light.r += (setupLight.r - light.r) * alpha; + light.g += (setupLight.g - light.g) * alpha; + light.b += (setupLight.b - light.b) * alpha; + dark.r += (setupDark.r - dark.r) * alpha; + dark.g += (setupDark.g - dark.g) * alpha; + dark.b += (setupDark.b - dark.b) * alpha; + } + return; + } + var r = 0, + g = 0, + b = 0, + r2 = 0, + g2 = 0, + b2 = 0; + var i = Timeline.search(frames, time, 7); + var curveType = this.curves[i / 7]; + switch (curveType) { + case 0: + var before = frames[i]; + r = frames[i + 1]; + g = frames[i + 2]; + b = frames[i + 3]; + r2 = frames[i + 4]; + g2 = frames[i + 5]; + b2 = frames[i + 6]; + var t = (time - before) / (frames[i + 7] - before); + r += (frames[i + 7 + 1] - r) * t; + g += (frames[i + 7 + 2] - g) * t; + b += (frames[i + 7 + 3] - b) * t; + r2 += (frames[i + 7 + 4] - r2) * t; + g2 += (frames[i + 7 + 5] - g2) * t; + b2 += (frames[i + 7 + 6] - b2) * t; + break; + case 1: + r = frames[i + 1]; + g = frames[i + 2]; + b = frames[i + 3]; + r2 = frames[i + 4]; + g2 = frames[i + 5]; + b2 = frames[i + 6]; + break; + default: + r = this.getBezierValue(time, i, 1, curveType - 2); + g = this.getBezierValue(time, i, 2, curveType + 18 - 2); + b = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2); + r2 = this.getBezierValue(time, i, 4, curveType + 18 * 3 - 2); + g2 = this.getBezierValue(time, i, 5, curveType + 18 * 4 - 2); + b2 = this.getBezierValue(time, i, 6, curveType + 18 * 5 - 2); + } + if (alpha == 1) { + light.r = r; + light.g = g; + light.b = b; + dark.r = r2; + dark.g = g2; + dark.b = b2; + } else { + if (blend == MixBlend.setup) { + var _setupLight = slot.data.color, + _setupDark2 = slot.data.darkColor; + light.r = _setupLight.r; + light.g = _setupLight.g; + light.b = _setupLight.b; + dark.r = _setupDark2.r; + dark.g = _setupDark2.g; + dark.b = _setupDark2.b; + } + light.r += (r - light.r) * alpha; + light.g += (g - light.g) * alpha; + light.b += (b - light.b) * alpha; + dark.r += (r2 - dark.r) * alpha; + dark.g += (g2 - dark.g) * alpha; + dark.b += (b2 - dark.b) * alpha; + } + } + }]); + return RGB2Timeline; + }(CurveTimeline); + var AttachmentTimeline = function (_Timeline2) { + _inherits(AttachmentTimeline, _Timeline2); + var _super19 = _createSuper(AttachmentTimeline); + function AttachmentTimeline(frameCount, slotIndex) { + var _this17; + _classCallCheck(this, AttachmentTimeline); + _this17 = _super19.call(this, frameCount, [Property.attachment + "|" + slotIndex]); + _this17.slotIndex = 0; + _this17.slotIndex = slotIndex; + _this17.attachmentNames = new Array(frameCount); + return _this17; + } + _createClass(AttachmentTimeline, [{ + key: "getFrameCount", + value: function getFrameCount() { + return this.frames.length; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, attachmentName) { + this.frames[frame] = time; + this.attachmentNames[frame] = attachmentName; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, events, alpha, blend, direction) { + var slot = skeleton.slots[this.slotIndex]; + if (!slot.bone.active) return; + if (direction == MixDirection.mixOut) { + if (blend == MixBlend.setup) this.setAttachment(skeleton, slot, slot.data.attachmentName); + return; + } + if (time < this.frames[0]) { + if (blend == MixBlend.setup || blend == MixBlend.first) this.setAttachment(skeleton, slot, slot.data.attachmentName); + return; + } + this.setAttachment(skeleton, slot, this.attachmentNames[Timeline.search1(this.frames, time)]); + } + }, { + key: "setAttachment", + value: function setAttachment(skeleton, slot, attachmentName) { + slot.setAttachment(!attachmentName ? null : skeleton.getAttachment(this.slotIndex, attachmentName)); + } + }]); + return AttachmentTimeline; + }(Timeline); + var DeformTimeline = function (_CurveTimeline18) { + _inherits(DeformTimeline, _CurveTimeline18); + var _super20 = _createSuper(DeformTimeline); + function DeformTimeline(frameCount, bezierCount, slotIndex, attachment) { + var _this18; + _classCallCheck(this, DeformTimeline); + _this18 = _super20.call(this, frameCount, bezierCount, [Property.deform + "|" + slotIndex + "|" + attachment.id]); + _this18.slotIndex = 0; + _this18.attachment = null; + _this18.vertices = null; + _this18.slotIndex = slotIndex; + _this18.attachment = attachment; + _this18.vertices = new Array(frameCount); + return _this18; + } + _createClass(DeformTimeline, [{ + key: "getFrameCount", + value: function getFrameCount() { + return this.frames.length; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, vertices) { + this.frames[frame] = time; + this.vertices[frame] = vertices; + } + }, { + key: "setBezier", + value: function setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) { + var curves = this.curves; + var i = this.getFrameCount() + bezier * 18; + if (value == 0) curves[frame] = 2 + i; + var tmpx = (time1 - cx1 * 2 + cx2) * 0.03, + tmpy = cy2 * 0.03 - cy1 * 0.06; + var dddx = ((cx1 - cx2) * 3 - time1 + time2) * 0.006, + dddy = (cy1 - cy2 + 0.33333333) * 0.018; + var ddx = tmpx * 2 + dddx, + ddy = tmpy * 2 + dddy; + var dx = (cx1 - time1) * 0.3 + tmpx + dddx * 0.16666667, + dy = cy1 * 0.3 + tmpy + dddy * 0.16666667; + var x = time1 + dx, + y = dy; + for (var n = i + 18; i < n; i += 2) { + curves[i] = x; + curves[i + 1] = y; + dx += ddx; + dy += ddy; + ddx += dddx; + ddy += dddy; + x += dx; + y += dy; + } + } + }, { + key: "getCurvePercent", + value: function getCurvePercent(time, frame) { + var curves = this.curves; + var i = curves[frame]; + switch (i) { + case 0: + var _x3 = this.frames[frame]; + return (time - _x3) / (this.frames[frame + this.getFrameEntries()] - _x3); + case 1: + return 0; + } + i -= 2; + if (curves[i] > time) { + var _x4 = this.frames[frame]; + return curves[i + 1] * (time - _x4) / (curves[i] - _x4); + } + var n = i + 18; + for (i += 2; i < n; i += 2) { + if (curves[i] >= time) { + var _x5 = curves[i - 2], + _y3 = curves[i - 1]; + return _y3 + (time - _x5) / (curves[i] - _x5) * (curves[i + 1] - _y3); + } + } + var x = curves[n - 2], + y = curves[n - 1]; + return y + (1 - y) * (time - x) / (this.frames[frame + this.getFrameEntries()] - x); + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) { + var slot = skeleton.slots[this.slotIndex]; + if (!slot.bone.active) return; + var slotAttachment = slot.getAttachment(); + if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.deformAttachment != this.attachment) return; + var deform = slot.deform; + if (deform.length == 0) blend = MixBlend.setup; + var vertices = this.vertices; + var vertexCount = vertices[0].length; + var frames = this.frames; + if (time < frames[0]) { + var vertexAttachment = slotAttachment; + switch (blend) { + case MixBlend.setup: + deform.length = 0; + return; + case MixBlend.first: + if (alpha == 1) { + deform.length = 0; + return; + } + deform.length = vertexCount; + if (!vertexAttachment.bones) { + var setupVertices = vertexAttachment.vertices; + for (var i = 0; i < vertexCount; i++) deform[i] += (setupVertices[i] - deform[i]) * alpha; + } else { + alpha = 1 - alpha; + for (var i = 0; i < vertexCount; i++) deform[i] *= alpha; + } + } + return; + } + deform.length = vertexCount; + if (time >= frames[frames.length - 1]) { + var lastVertices = vertices[frames.length - 1]; + if (alpha == 1) { + if (blend == MixBlend.add) { + var _vertexAttachment = slotAttachment; + if (!_vertexAttachment.bones) { + var _setupVertices = _vertexAttachment.vertices; + for (var _i = 0; _i < vertexCount; _i++) deform[_i] += lastVertices[_i] - _setupVertices[_i]; + } else { + for (var _i2 = 0; _i2 < vertexCount; _i2++) deform[_i2] += lastVertices[_i2]; + } + } else Utils.arrayCopy(lastVertices, 0, deform, 0, vertexCount); + } else { + switch (blend) { + case MixBlend.setup: + { + var _vertexAttachment2 = slotAttachment; + if (!_vertexAttachment2.bones) { + var _setupVertices2 = _vertexAttachment2.vertices; + for (var _i3 = 0; _i3 < vertexCount; _i3++) { + var setup = _setupVertices2[_i3]; + deform[_i3] = setup + (lastVertices[_i3] - setup) * alpha; + } + } else { + for (var _i4 = 0; _i4 < vertexCount; _i4++) deform[_i4] = lastVertices[_i4] * alpha; + } + break; + } + case MixBlend.first: + case MixBlend.replace: + for (var _i5 = 0; _i5 < vertexCount; _i5++) deform[_i5] += (lastVertices[_i5] - deform[_i5]) * alpha; + break; + case MixBlend.add: + var _vertexAttachment3 = slotAttachment; + if (!_vertexAttachment3.bones) { + var _setupVertices3 = _vertexAttachment3.vertices; + for (var _i6 = 0; _i6 < vertexCount; _i6++) deform[_i6] += (lastVertices[_i6] - _setupVertices3[_i6]) * alpha; + } else { + for (var _i7 = 0; _i7 < vertexCount; _i7++) deform[_i7] += lastVertices[_i7] * alpha; + } + } + } + return; + } + var frame = Timeline.search1(frames, time); + var percent = this.getCurvePercent(time, frame); + var prevVertices = vertices[frame]; + var nextVertices = vertices[frame + 1]; + if (alpha == 1) { + if (blend == MixBlend.add) { + var _vertexAttachment4 = slotAttachment; + if (!_vertexAttachment4.bones) { + var _setupVertices4 = _vertexAttachment4.vertices; + for (var _i8 = 0; _i8 < vertexCount; _i8++) { + var prev = prevVertices[_i8]; + deform[_i8] += prev + (nextVertices[_i8] - prev) * percent - _setupVertices4[_i8]; + } + } else { + for (var _i9 = 0; _i9 < vertexCount; _i9++) { + var _prev = prevVertices[_i9]; + deform[_i9] += _prev + (nextVertices[_i9] - _prev) * percent; + } + } + } else { + for (var _i10 = 0; _i10 < vertexCount; _i10++) { + var _prev2 = prevVertices[_i10]; + deform[_i10] = _prev2 + (nextVertices[_i10] - _prev2) * percent; + } + } + } else { + switch (blend) { + case MixBlend.setup: + { + var _vertexAttachment5 = slotAttachment; + if (!_vertexAttachment5.bones) { + var _setupVertices5 = _vertexAttachment5.vertices; + for (var _i11 = 0; _i11 < vertexCount; _i11++) { + var _prev3 = prevVertices[_i11], + _setup2 = _setupVertices5[_i11]; + deform[_i11] = _setup2 + (_prev3 + (nextVertices[_i11] - _prev3) * percent - _setup2) * alpha; + } + } else { + for (var _i12 = 0; _i12 < vertexCount; _i12++) { + var _prev4 = prevVertices[_i12]; + deform[_i12] = (_prev4 + (nextVertices[_i12] - _prev4) * percent) * alpha; + } + } + break; + } + case MixBlend.first: + case MixBlend.replace: + for (var _i13 = 0; _i13 < vertexCount; _i13++) { + var _prev5 = prevVertices[_i13]; + deform[_i13] += (_prev5 + (nextVertices[_i13] - _prev5) * percent - deform[_i13]) * alpha; + } + break; + case MixBlend.add: + var _vertexAttachment6 = slotAttachment; + if (!_vertexAttachment6.bones) { + var _setupVertices6 = _vertexAttachment6.vertices; + for (var _i14 = 0; _i14 < vertexCount; _i14++) { + var _prev6 = prevVertices[_i14]; + deform[_i14] += (_prev6 + (nextVertices[_i14] - _prev6) * percent - _setupVertices6[_i14]) * alpha; + } + } else { + for (var _i15 = 0; _i15 < vertexCount; _i15++) { + var _prev7 = prevVertices[_i15]; + deform[_i15] += (_prev7 + (nextVertices[_i15] - _prev7) * percent) * alpha; + } + } + } + } + } + }]); + return DeformTimeline; + }(CurveTimeline); + var EventTimeline = function (_Timeline3) { + _inherits(EventTimeline, _Timeline3); + var _super21 = _createSuper(EventTimeline); + function EventTimeline(frameCount) { + var _this19; + _classCallCheck(this, EventTimeline); + _this19 = _super21.call(this, frameCount, EventTimeline.propertyIds); + _this19.events = null; + _this19.events = new Array(frameCount); + return _this19; + } + _createClass(EventTimeline, [{ + key: "getFrameCount", + value: function getFrameCount() { + return this.frames.length; + } + }, { + key: "setFrame", + value: function setFrame(frame, event) { + this.frames[frame] = event.time; + this.events[frame] = event; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) { + if (!firedEvents) return; + var frames = this.frames; + var frameCount = this.frames.length; + if (lastTime > time) { + this.apply(skeleton, lastTime, Number.MAX_VALUE, firedEvents, alpha, blend, direction); + lastTime = -1; + } else if (lastTime >= frames[frameCount - 1]) return; + if (time < frames[0]) return; + var i = 0; + if (lastTime < frames[0]) i = 0;else { + i = Timeline.search1(frames, lastTime) + 1; + var frameTime = frames[i]; + while (i > 0) { + if (frames[i - 1] != frameTime) break; + i--; + } + } + for (; i < frameCount && time >= frames[i]; i++) firedEvents.push(this.events[i]); + } + }]); + return EventTimeline; + }(Timeline); + EventTimeline.propertyIds = ["" + Property.event]; + var DrawOrderTimeline = function (_Timeline4) { + _inherits(DrawOrderTimeline, _Timeline4); + var _super22 = _createSuper(DrawOrderTimeline); + function DrawOrderTimeline(frameCount) { + var _this20; + _classCallCheck(this, DrawOrderTimeline); + _this20 = _super22.call(this, frameCount, DrawOrderTimeline.propertyIds); + _this20.drawOrders = null; + _this20.drawOrders = new Array(frameCount); + return _this20; + } + _createClass(DrawOrderTimeline, [{ + key: "getFrameCount", + value: function getFrameCount() { + return this.frames.length; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, drawOrder) { + this.frames[frame] = time; + this.drawOrders[frame] = drawOrder; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) { + if (direction == MixDirection.mixOut) { + if (blend == MixBlend.setup) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length); + return; + } + if (time < this.frames[0]) { + if (blend == MixBlend.setup || blend == MixBlend.first) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length); + return; + } + var drawOrderToSetupIndex = this.drawOrders[Timeline.search1(this.frames, time)]; + if (!drawOrderToSetupIndex) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);else { + var drawOrder = skeleton.drawOrder; + var slots = skeleton.slots; + for (var i = 0, n = drawOrderToSetupIndex.length; i < n; i++) drawOrder[i] = slots[drawOrderToSetupIndex[i]]; + } + } + }]); + return DrawOrderTimeline; + }(Timeline); + DrawOrderTimeline.propertyIds = ["" + Property.drawOrder]; + var IkConstraintTimeline = function (_CurveTimeline19) { + _inherits(IkConstraintTimeline, _CurveTimeline19); + var _super23 = _createSuper(IkConstraintTimeline); + function IkConstraintTimeline(frameCount, bezierCount, ikConstraintIndex) { + var _this21; + _classCallCheck(this, IkConstraintTimeline); + _this21 = _super23.call(this, frameCount, bezierCount, [Property.ikConstraint + "|" + ikConstraintIndex]); + _this21.ikConstraintIndex = 0; + _this21.ikConstraintIndex = ikConstraintIndex; + return _this21; + } + _createClass(IkConstraintTimeline, [{ + key: "getFrameEntries", + value: function getFrameEntries() { + return 6; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, mix, softness, bendDirection, compress, stretch) { + frame *= 6; + this.frames[frame] = time; + this.frames[frame + 1] = mix; + this.frames[frame + 2] = softness; + this.frames[frame + 3] = bendDirection; + this.frames[frame + 4] = compress ? 1 : 0; + this.frames[frame + 5] = stretch ? 1 : 0; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) { + var constraint = skeleton.ikConstraints[this.ikConstraintIndex]; + if (!constraint.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + constraint.mix = constraint.data.mix; + constraint.softness = constraint.data.softness; + constraint.bendDirection = constraint.data.bendDirection; + constraint.compress = constraint.data.compress; + constraint.stretch = constraint.data.stretch; + return; + case MixBlend.first: + constraint.mix += (constraint.data.mix - constraint.mix) * alpha; + constraint.softness += (constraint.data.softness - constraint.softness) * alpha; + constraint.bendDirection = constraint.data.bendDirection; + constraint.compress = constraint.data.compress; + constraint.stretch = constraint.data.stretch; + } + return; + } + var mix = 0, + softness = 0; + var i = Timeline.search(frames, time, 6); + var curveType = this.curves[i / 6]; + switch (curveType) { + case 0: + var before = frames[i]; + mix = frames[i + 1]; + softness = frames[i + 2]; + var t = (time - before) / (frames[i + 6] - before); + mix += (frames[i + 6 + 1] - mix) * t; + softness += (frames[i + 6 + 2] - softness) * t; + break; + case 1: + mix = frames[i + 1]; + softness = frames[i + 2]; + break; + default: + mix = this.getBezierValue(time, i, 1, curveType - 2); + softness = this.getBezierValue(time, i, 2, curveType + 18 - 2); + } + if (blend == MixBlend.setup) { + constraint.mix = constraint.data.mix + (mix - constraint.data.mix) * alpha; + constraint.softness = constraint.data.softness + (softness - constraint.data.softness) * alpha; + if (direction == MixDirection.mixOut) { + constraint.bendDirection = constraint.data.bendDirection; + constraint.compress = constraint.data.compress; + constraint.stretch = constraint.data.stretch; + } else { + constraint.bendDirection = frames[i + 3]; + constraint.compress = frames[i + 4] != 0; + constraint.stretch = frames[i + 5] != 0; + } + } else { + constraint.mix += (mix - constraint.mix) * alpha; + constraint.softness += (softness - constraint.softness) * alpha; + if (direction == MixDirection.mixIn) { + constraint.bendDirection = frames[i + 3]; + constraint.compress = frames[i + 4] != 0; + constraint.stretch = frames[i + 5] != 0; + } + } + } + }]); + return IkConstraintTimeline; + }(CurveTimeline); + var TransformConstraintTimeline = function (_CurveTimeline20) { + _inherits(TransformConstraintTimeline, _CurveTimeline20); + var _super24 = _createSuper(TransformConstraintTimeline); + function TransformConstraintTimeline(frameCount, bezierCount, transformConstraintIndex) { + var _this22; + _classCallCheck(this, TransformConstraintTimeline); + _this22 = _super24.call(this, frameCount, bezierCount, [Property.transformConstraint + "|" + transformConstraintIndex]); + _this22.transformConstraintIndex = 0; + _this22.transformConstraintIndex = transformConstraintIndex; + return _this22; + } + _createClass(TransformConstraintTimeline, [{ + key: "getFrameEntries", + value: function getFrameEntries() { + return 7; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY) { + var frames = this.frames; + frame *= 7; + frames[frame] = time; + frames[frame + 1] = mixRotate; + frames[frame + 2] = mixX; + frames[frame + 3] = mixY; + frames[frame + 4] = mixScaleX; + frames[frame + 5] = mixScaleY; + frames[frame + 6] = mixShearY; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) { + var constraint = skeleton.transformConstraints[this.transformConstraintIndex]; + if (!constraint.active) return; + var frames = this.frames; + if (time < frames[0]) { + var data = constraint.data; + switch (blend) { + case MixBlend.setup: + constraint.mixRotate = data.mixRotate; + constraint.mixX = data.mixX; + constraint.mixY = data.mixY; + constraint.mixScaleX = data.mixScaleX; + constraint.mixScaleY = data.mixScaleY; + constraint.mixShearY = data.mixShearY; + return; + case MixBlend.first: + constraint.mixRotate += (data.mixRotate - constraint.mixRotate) * alpha; + constraint.mixX += (data.mixX - constraint.mixX) * alpha; + constraint.mixY += (data.mixY - constraint.mixY) * alpha; + constraint.mixScaleX += (data.mixScaleX - constraint.mixScaleX) * alpha; + constraint.mixScaleY += (data.mixScaleY - constraint.mixScaleY) * alpha; + constraint.mixShearY += (data.mixShearY - constraint.mixShearY) * alpha; + } + return; + } + var rotate, x, y, scaleX, scaleY, shearY; + var i = Timeline.search(frames, time, 7); + var curveType = this.curves[i / 7]; + switch (curveType) { + case 0: + var before = frames[i]; + rotate = frames[i + 1]; + x = frames[i + 2]; + y = frames[i + 3]; + scaleX = frames[i + 4]; + scaleY = frames[i + 5]; + shearY = frames[i + 6]; + var t = (time - before) / (frames[i + 7] - before); + rotate += (frames[i + 7 + 1] - rotate) * t; + x += (frames[i + 7 + 2] - x) * t; + y += (frames[i + 7 + 3] - y) * t; + scaleX += (frames[i + 7 + 4] - scaleX) * t; + scaleY += (frames[i + 7 + 5] - scaleY) * t; + shearY += (frames[i + 7 + 6] - shearY) * t; + break; + case 1: + rotate = frames[i + 1]; + x = frames[i + 2]; + y = frames[i + 3]; + scaleX = frames[i + 4]; + scaleY = frames[i + 5]; + shearY = frames[i + 6]; + break; + default: + rotate = this.getBezierValue(time, i, 1, curveType - 2); + x = this.getBezierValue(time, i, 2, curveType + 18 - 2); + y = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2); + scaleX = this.getBezierValue(time, i, 4, curveType + 18 * 3 - 2); + scaleY = this.getBezierValue(time, i, 5, curveType + 18 * 4 - 2); + shearY = this.getBezierValue(time, i, 6, curveType + 18 * 5 - 2); + } + if (blend == MixBlend.setup) { + var _data = constraint.data; + constraint.mixRotate = _data.mixRotate + (rotate - _data.mixRotate) * alpha; + constraint.mixX = _data.mixX + (x - _data.mixX) * alpha; + constraint.mixY = _data.mixY + (y - _data.mixY) * alpha; + constraint.mixScaleX = _data.mixScaleX + (scaleX - _data.mixScaleX) * alpha; + constraint.mixScaleY = _data.mixScaleY + (scaleY - _data.mixScaleY) * alpha; + constraint.mixShearY = _data.mixShearY + (shearY - _data.mixShearY) * alpha; + } else { + constraint.mixRotate += (rotate - constraint.mixRotate) * alpha; + constraint.mixX += (x - constraint.mixX) * alpha; + constraint.mixY += (y - constraint.mixY) * alpha; + constraint.mixScaleX += (scaleX - constraint.mixScaleX) * alpha; + constraint.mixScaleY += (scaleY - constraint.mixScaleY) * alpha; + constraint.mixShearY += (shearY - constraint.mixShearY) * alpha; + } + } + }]); + return TransformConstraintTimeline; + }(CurveTimeline); + var PathConstraintPositionTimeline = function (_CurveTimeline21) { + _inherits(PathConstraintPositionTimeline, _CurveTimeline21); + var _super25 = _createSuper(PathConstraintPositionTimeline); + function PathConstraintPositionTimeline(frameCount, bezierCount, pathConstraintIndex) { + var _this23; + _classCallCheck(this, PathConstraintPositionTimeline); + _this23 = _super25.call(this, frameCount, bezierCount, Property.pathConstraintPosition + "|" + pathConstraintIndex); + _this23.pathConstraintIndex = 0; + _this23.pathConstraintIndex = pathConstraintIndex; + return _this23; + } + _createClass(PathConstraintPositionTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) { + var constraint = skeleton.pathConstraints[this.pathConstraintIndex]; + if (!constraint.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + constraint.position = constraint.data.position; + return; + case MixBlend.first: + constraint.position += (constraint.data.position - constraint.position) * alpha; + } + return; + } + var position = this.getCurveValue(time); + if (blend == MixBlend.setup) constraint.position = constraint.data.position + (position - constraint.data.position) * alpha;else constraint.position += (position - constraint.position) * alpha; + } + }]); + return PathConstraintPositionTimeline; + }(CurveTimeline1); + var PathConstraintSpacingTimeline = function (_CurveTimeline22) { + _inherits(PathConstraintSpacingTimeline, _CurveTimeline22); + var _super26 = _createSuper(PathConstraintSpacingTimeline); + function PathConstraintSpacingTimeline(frameCount, bezierCount, pathConstraintIndex) { + var _this24; + _classCallCheck(this, PathConstraintSpacingTimeline); + _this24 = _super26.call(this, frameCount, bezierCount, Property.pathConstraintSpacing + "|" + pathConstraintIndex); + _this24.pathConstraintIndex = 0; + _this24.pathConstraintIndex = pathConstraintIndex; + return _this24; + } + _createClass(PathConstraintSpacingTimeline, [{ + key: "apply", + value: function apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) { + var constraint = skeleton.pathConstraints[this.pathConstraintIndex]; + if (!constraint.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + constraint.spacing = constraint.data.spacing; + return; + case MixBlend.first: + constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha; + } + return; + } + var spacing = this.getCurveValue(time); + if (blend == MixBlend.setup) constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;else constraint.spacing += (spacing - constraint.spacing) * alpha; + } + }]); + return PathConstraintSpacingTimeline; + }(CurveTimeline1); + var PathConstraintMixTimeline = function (_CurveTimeline23) { + _inherits(PathConstraintMixTimeline, _CurveTimeline23); + var _super27 = _createSuper(PathConstraintMixTimeline); + function PathConstraintMixTimeline(frameCount, bezierCount, pathConstraintIndex) { + var _this25; + _classCallCheck(this, PathConstraintMixTimeline); + _this25 = _super27.call(this, frameCount, bezierCount, [Property.pathConstraintMix + "|" + pathConstraintIndex]); + _this25.pathConstraintIndex = 0; + _this25.pathConstraintIndex = pathConstraintIndex; + return _this25; + } + _createClass(PathConstraintMixTimeline, [{ + key: "getFrameEntries", + value: function getFrameEntries() { + return 4; + } + }, { + key: "setFrame", + value: function setFrame(frame, time, mixRotate, mixX, mixY) { + var frames = this.frames; + frame <<= 2; + frames[frame] = time; + frames[frame + 1] = mixRotate; + frames[frame + 2] = mixX; + frames[frame + 3] = mixY; + } + }, { + key: "apply", + value: function apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) { + var constraint = skeleton.pathConstraints[this.pathConstraintIndex]; + if (!constraint.active) return; + var frames = this.frames; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + constraint.mixRotate = constraint.data.mixRotate; + constraint.mixX = constraint.data.mixX; + constraint.mixY = constraint.data.mixY; + return; + case MixBlend.first: + constraint.mixRotate += (constraint.data.mixRotate - constraint.mixRotate) * alpha; + constraint.mixX += (constraint.data.mixX - constraint.mixX) * alpha; + constraint.mixY += (constraint.data.mixY - constraint.mixY) * alpha; + } + return; + } + var rotate, x, y; + var i = Timeline.search(frames, time, 4); + var curveType = this.curves[i >> 2]; + switch (curveType) { + case 0: + var before = frames[i]; + rotate = frames[i + 1]; + x = frames[i + 2]; + y = frames[i + 3]; + var t = (time - before) / (frames[i + 4] - before); + rotate += (frames[i + 4 + 1] - rotate) * t; + x += (frames[i + 4 + 2] - x) * t; + y += (frames[i + 4 + 3] - y) * t; + break; + case 1: + rotate = frames[i + 1]; + x = frames[i + 2]; + y = frames[i + 3]; + break; + default: + rotate = this.getBezierValue(time, i, 1, curveType - 2); + x = this.getBezierValue(time, i, 2, curveType + 18 - 2); + y = this.getBezierValue(time, i, 3, curveType + 18 * 2 - 2); + } + if (blend == MixBlend.setup) { + var data = constraint.data; + constraint.mixRotate = data.mixRotate + (rotate - data.mixRotate) * alpha; + constraint.mixX = data.mixX + (x - data.mixX) * alpha; + constraint.mixY = data.mixY + (y - data.mixY) * alpha; + } else { + constraint.mixRotate += (rotate - constraint.mixRotate) * alpha; + constraint.mixX += (x - constraint.mixX) * alpha; + constraint.mixY += (y - constraint.mixY) * alpha; + } + } + }]); + return PathConstraintMixTimeline; + }(CurveTimeline); + + var AnimationState = function () { + function AnimationState(data) { + _classCallCheck(this, AnimationState); + this.data = null; + this.tracks = new Array(); + this.timeScale = 1; + this.unkeyedState = 0; + this.events = new Array(); + this.listeners = new Array(); + this.queue = new EventQueue(this); + this.propertyIDs = new StringSet(); + this.animationsChanged = false; + this.trackEntryPool = new Pool(function () { + return new TrackEntry(); + }); + this.data = data; + } + _createClass(AnimationState, [{ + key: "update", + value: function update(delta) { + delta *= this.timeScale; + var tracks = this.tracks; + for (var i = 0, n = tracks.length; i < n; i++) { + var current = tracks[i]; + if (!current) continue; + current.animationLast = current.nextAnimationLast; + current.trackLast = current.nextTrackLast; + var currentDelta = delta * current.timeScale; + if (current.delay > 0) { + current.delay -= currentDelta; + if (current.delay > 0) continue; + currentDelta = -current.delay; + current.delay = 0; + } + var next = current.next; + if (next) { + var nextTime = current.trackLast - next.delay; + if (nextTime >= 0) { + next.delay = 0; + next.trackTime += current.timeScale == 0 ? 0 : (nextTime / current.timeScale + delta) * next.timeScale; + current.trackTime += currentDelta; + this.setCurrent(i, next, true); + while (next.mixingFrom) { + next.mixTime += delta; + next = next.mixingFrom; + } + continue; + } + } else if (current.trackLast >= current.trackEnd && !current.mixingFrom) { + tracks[i] = null; + this.queue.end(current); + this.clearNext(current); + continue; + } + if (current.mixingFrom && this.updateMixingFrom(current, delta)) { + var from = current.mixingFrom; + current.mixingFrom = null; + if (from) from.mixingTo = null; + while (from) { + this.queue.end(from); + from = from.mixingFrom; + } + } + current.trackTime += currentDelta; + } + this.queue.drain(); + } + }, { + key: "updateMixingFrom", + value: function updateMixingFrom(to, delta) { + var from = to.mixingFrom; + if (!from) return true; + var finished = this.updateMixingFrom(from, delta); + from.animationLast = from.nextAnimationLast; + from.trackLast = from.nextTrackLast; + if (to.mixTime > 0 && to.mixTime >= to.mixDuration) { + if (from.totalAlpha == 0 || to.mixDuration == 0) { + to.mixingFrom = from.mixingFrom; + if (from.mixingFrom) from.mixingFrom.mixingTo = to; + to.interruptAlpha = from.interruptAlpha; + this.queue.end(from); + } + return finished; + } + from.trackTime += delta * from.timeScale; + to.mixTime += delta; + return false; + } + }, { + key: "apply", + value: function apply(skeleton) { + if (!skeleton) throw new Error("skeleton cannot be null."); + if (this.animationsChanged) this._animationsChanged(); + var events = this.events; + var tracks = this.tracks; + var applied = false; + for (var _i = 0, _n = tracks.length; _i < _n; _i++) { + var current = tracks[_i]; + if (!current || current.delay > 0) continue; + applied = true; + var blend = _i == 0 ? MixBlend.first : current.mixBlend; + var mix = current.alpha; + if (current.mixingFrom) mix *= this.applyMixingFrom(current, skeleton, blend);else if (current.trackTime >= current.trackEnd && !current.next) mix = 0; + var animationLast = current.animationLast, + animationTime = current.getAnimationTime(), + applyTime = animationTime; + var applyEvents = events; + if (current.reverse) { + applyTime = current.animation.duration - applyTime; + applyEvents = null; + } + var timelines = current.animation.timelines; + var timelineCount = timelines.length; + if (_i == 0 && mix == 1 || blend == MixBlend.add) { + for (var ii = 0; ii < timelineCount; ii++) { + Utils.webkit602BugfixHelper(mix, blend); + var timeline = timelines[ii]; + if (timeline instanceof AttachmentTimeline) this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, true);else timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, blend, MixDirection.mixIn); + } + } else { + var timelineMode = current.timelineMode; + var firstFrame = current.timelinesRotation.length != timelineCount << 1; + if (firstFrame) current.timelinesRotation.length = timelineCount << 1; + for (var _ii = 0; _ii < timelineCount; _ii++) { + var _timeline = timelines[_ii]; + var timelineBlend = timelineMode[_ii] == SUBSEQUENT ? blend : MixBlend.setup; + if (_timeline instanceof RotateTimeline) { + this.applyRotateTimeline(_timeline, skeleton, applyTime, mix, timelineBlend, current.timelinesRotation, _ii << 1, firstFrame); + } else if (_timeline instanceof AttachmentTimeline) { + this.applyAttachmentTimeline(_timeline, skeleton, applyTime, blend, true); + } else { + Utils.webkit602BugfixHelper(mix, blend); + _timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend, MixDirection.mixIn); + } + } + } + this.queueEvents(current, animationTime); + events.length = 0; + current.nextAnimationLast = animationTime; + current.nextTrackLast = current.trackTime; + } + var setupState = this.unkeyedState + SETUP; + var slots = skeleton.slots; + for (var i = 0, n = skeleton.slots.length; i < n; i++) { + var slot = slots[i]; + if (slot.attachmentState == setupState) { + var attachmentName = slot.data.attachmentName; + slot.setAttachment(!attachmentName ? null : skeleton.getAttachment(slot.data.index, attachmentName)); + } + } + this.unkeyedState += 2; + this.queue.drain(); + return applied; + } + }, { + key: "applyMixingFrom", + value: function applyMixingFrom(to, skeleton, blend) { + var from = to.mixingFrom; + if (from.mixingFrom) this.applyMixingFrom(from, skeleton, blend); + var mix = 0; + if (to.mixDuration == 0) { + mix = 1; + if (blend == MixBlend.first) blend = MixBlend.setup; + } else { + mix = to.mixTime / to.mixDuration; + if (mix > 1) mix = 1; + if (blend != MixBlend.first) blend = from.mixBlend; + } + var attachments = mix < from.attachmentThreshold, + drawOrder = mix < from.drawOrderThreshold; + var timelines = from.animation.timelines; + var timelineCount = timelines.length; + var alphaHold = from.alpha * to.interruptAlpha, + alphaMix = alphaHold * (1 - mix); + var animationLast = from.animationLast, + animationTime = from.getAnimationTime(), + applyTime = animationTime; + var events = null; + if (from.reverse) applyTime = from.animation.duration - applyTime;else if (mix < from.eventThreshold) events = this.events; + if (blend == MixBlend.add) { + for (var i = 0; i < timelineCount; i++) timelines[i].apply(skeleton, animationLast, applyTime, events, alphaMix, blend, MixDirection.mixOut); + } else { + var timelineMode = from.timelineMode; + var timelineHoldMix = from.timelineHoldMix; + var firstFrame = from.timelinesRotation.length != timelineCount << 1; + if (firstFrame) from.timelinesRotation.length = timelineCount << 1; + from.totalAlpha = 0; + for (var _i2 = 0; _i2 < timelineCount; _i2++) { + var timeline = timelines[_i2]; + var direction = MixDirection.mixOut; + var timelineBlend = void 0; + var alpha = 0; + switch (timelineMode[_i2]) { + case SUBSEQUENT: + if (!drawOrder && timeline instanceof DrawOrderTimeline) continue; + timelineBlend = blend; + alpha = alphaMix; + break; + case FIRST: + timelineBlend = MixBlend.setup; + alpha = alphaMix; + break; + case HOLD_SUBSEQUENT: + timelineBlend = blend; + alpha = alphaHold; + break; + case HOLD_FIRST: + timelineBlend = MixBlend.setup; + alpha = alphaHold; + break; + default: + timelineBlend = MixBlend.setup; + var holdMix = timelineHoldMix[_i2]; + alpha = alphaHold * Math.max(0, 1 - holdMix.mixTime / holdMix.mixDuration); + break; + } + from.totalAlpha += alpha; + if (timeline instanceof RotateTimeline) this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, timelineBlend, from.timelinesRotation, _i2 << 1, firstFrame);else if (timeline instanceof AttachmentTimeline) this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);else { + Utils.webkit602BugfixHelper(alpha, blend); + if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == MixBlend.setup) direction = MixDirection.mixIn; + timeline.apply(skeleton, animationLast, applyTime, events, alpha, timelineBlend, direction); + } + } + } + if (to.mixDuration > 0) this.queueEvents(from, animationTime); + this.events.length = 0; + from.nextAnimationLast = animationTime; + from.nextTrackLast = from.trackTime; + return mix; + } + }, { + key: "applyAttachmentTimeline", + value: function applyAttachmentTimeline(timeline, skeleton, time, blend, attachments) { + var slot = skeleton.slots[timeline.slotIndex]; + if (!slot.bone.active) return; + if (time < timeline.frames[0]) { + if (blend == MixBlend.setup || blend == MixBlend.first) this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments); + } else this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(timeline.frames, time)], attachments); + if (slot.attachmentState <= this.unkeyedState) slot.attachmentState = this.unkeyedState + SETUP; + } + }, { + key: "setAttachment", + value: function setAttachment(skeleton, slot, attachmentName, attachments) { + slot.setAttachment(!attachmentName ? null : skeleton.getAttachment(slot.data.index, attachmentName)); + if (attachments) slot.attachmentState = this.unkeyedState + CURRENT; + } + }, { + key: "applyRotateTimeline", + value: function applyRotateTimeline(timeline, skeleton, time, alpha, blend, timelinesRotation, i, firstFrame) { + if (firstFrame) timelinesRotation[i] = 0; + if (alpha == 1) { + timeline.apply(skeleton, 0, time, null, 1, blend, MixDirection.mixIn); + return; + } + var bone = skeleton.bones[timeline.boneIndex]; + if (!bone.active) return; + var frames = timeline.frames; + var r1 = 0, + r2 = 0; + if (time < frames[0]) { + switch (blend) { + case MixBlend.setup: + bone.rotation = bone.data.rotation; + default: + return; + case MixBlend.first: + r1 = bone.rotation; + r2 = bone.data.rotation; + } + } else { + r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation; + r2 = bone.data.rotation + timeline.getCurveValue(time); + } + var total = 0, + diff = r2 - r1; + diff -= (16384 - (16384.499999999996 - diff / 360 | 0)) * 360; + if (diff == 0) { + total = timelinesRotation[i]; + } else { + var lastTotal = 0, + lastDiff = 0; + if (firstFrame) { + lastTotal = 0; + lastDiff = diff; + } else { + lastTotal = timelinesRotation[i]; + lastDiff = timelinesRotation[i + 1]; + } + var current = diff > 0, + dir = lastTotal >= 0; + if (MathUtils.signum(lastDiff) != MathUtils.signum(diff) && Math.abs(lastDiff) <= 90) { + if (Math.abs(lastTotal) > 180) lastTotal += 360 * MathUtils.signum(lastTotal); + dir = current; + } + total = diff + lastTotal - lastTotal % 360; + if (dir != current) total += 360 * MathUtils.signum(lastTotal); + timelinesRotation[i] = total; + } + timelinesRotation[i + 1] = diff; + bone.rotation = r1 + total * alpha; + } + }, { + key: "queueEvents", + value: function queueEvents(entry, animationTime) { + var animationStart = entry.animationStart, + animationEnd = entry.animationEnd; + var duration = animationEnd - animationStart; + var trackLastWrapped = entry.trackLast % duration; + var events = this.events; + var i = 0, + n = events.length; + for (; i < n; i++) { + var event = events[i]; + if (event.time < trackLastWrapped) break; + if (event.time > animationEnd) continue; + this.queue.event(entry, event); + } + var complete = false; + if (entry.loop) complete = duration == 0 || trackLastWrapped > entry.trackTime % duration;else complete = animationTime >= animationEnd && entry.animationLast < animationEnd; + if (complete) this.queue.complete(entry); + for (; i < n; i++) { + var _event = events[i]; + if (_event.time < animationStart) continue; + this.queue.event(entry, _event); + } + } + }, { + key: "clearTracks", + value: function clearTracks() { + var oldDrainDisabled = this.queue.drainDisabled; + this.queue.drainDisabled = true; + for (var i = 0, n = this.tracks.length; i < n; i++) this.clearTrack(i); + this.tracks.length = 0; + this.queue.drainDisabled = oldDrainDisabled; + this.queue.drain(); + } + }, { + key: "clearTrack", + value: function clearTrack(trackIndex) { + if (trackIndex >= this.tracks.length) return; + var current = this.tracks[trackIndex]; + if (!current) return; + this.queue.end(current); + this.clearNext(current); + var entry = current; + while (true) { + var from = entry.mixingFrom; + if (!from) break; + this.queue.end(from); + entry.mixingFrom = null; + entry.mixingTo = null; + entry = from; + } + this.tracks[current.trackIndex] = null; + this.queue.drain(); + } + }, { + key: "setCurrent", + value: function setCurrent(index, current, interrupt) { + var from = this.expandToIndex(index); + this.tracks[index] = current; + current.previous = null; + if (from) { + if (interrupt) this.queue.interrupt(from); + current.mixingFrom = from; + from.mixingTo = current; + current.mixTime = 0; + if (from.mixingFrom && from.mixDuration > 0) current.interruptAlpha *= Math.min(1, from.mixTime / from.mixDuration); + from.timelinesRotation.length = 0; + } + this.queue.start(current); + } + }, { + key: "setAnimation", + value: function setAnimation(trackIndex, animationName) { + var loop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var animation = this.data.skeletonData.findAnimation(animationName); + if (!animation) throw new Error("Animation not found: " + animationName); + return this.setAnimationWith(trackIndex, animation, loop); + } + }, { + key: "setAnimationWith", + value: function setAnimationWith(trackIndex, animation) { + var loop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + if (!animation) throw new Error("animation cannot be null."); + var interrupt = true; + var current = this.expandToIndex(trackIndex); + if (current) { + if (current.nextTrackLast == -1) { + this.tracks[trackIndex] = current.mixingFrom; + this.queue.interrupt(current); + this.queue.end(current); + this.clearNext(current); + current = current.mixingFrom; + interrupt = false; + } else this.clearNext(current); + } + var entry = this.trackEntry(trackIndex, animation, loop, current); + this.setCurrent(trackIndex, entry, interrupt); + this.queue.drain(); + return entry; + } + }, { + key: "addAnimation", + value: function addAnimation(trackIndex, animationName) { + var loop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var animation = this.data.skeletonData.findAnimation(animationName); + if (!animation) throw new Error("Animation not found: " + animationName); + return this.addAnimationWith(trackIndex, animation, loop, delay); + } + }, { + key: "addAnimationWith", + value: function addAnimationWith(trackIndex, animation) { + var loop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + if (!animation) throw new Error("animation cannot be null."); + var last = this.expandToIndex(trackIndex); + if (last) { + while (last.next) last = last.next; + } + var entry = this.trackEntry(trackIndex, animation, loop, last); + if (!last) { + this.setCurrent(trackIndex, entry, true); + this.queue.drain(); + } else { + last.next = entry; + entry.previous = last; + if (delay <= 0) delay += last.getTrackComplete() - entry.mixDuration; + } + entry.delay = delay; + return entry; + } + }, { + key: "setEmptyAnimation", + value: function setEmptyAnimation(trackIndex) { + var mixDuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var entry = this.setAnimationWith(trackIndex, AnimationState.emptyAnimation(), false); + entry.mixDuration = mixDuration; + entry.trackEnd = mixDuration; + return entry; + } + }, { + key: "addEmptyAnimation", + value: function addEmptyAnimation(trackIndex) { + var mixDuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation(), false, delay); + if (delay <= 0) entry.delay += entry.mixDuration - mixDuration; + entry.mixDuration = mixDuration; + entry.trackEnd = mixDuration; + return entry; + } + }, { + key: "setEmptyAnimations", + value: function setEmptyAnimations() { + var mixDuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var oldDrainDisabled = this.queue.drainDisabled; + this.queue.drainDisabled = true; + for (var i = 0, n = this.tracks.length; i < n; i++) { + var current = this.tracks[i]; + if (current) this.setEmptyAnimation(current.trackIndex, mixDuration); + } + this.queue.drainDisabled = oldDrainDisabled; + this.queue.drain(); + } + }, { + key: "expandToIndex", + value: function expandToIndex(index) { + if (index < this.tracks.length) return this.tracks[index]; + Utils.ensureArrayCapacity(this.tracks, index + 1, null); + this.tracks.length = index + 1; + return null; + } + }, { + key: "trackEntry", + value: function trackEntry(trackIndex, animation, loop, last) { + var entry = this.trackEntryPool.obtain(); + entry.reset(); + entry.trackIndex = trackIndex; + entry.animation = animation; + entry.loop = loop; + entry.holdPrevious = false; + entry.eventThreshold = 0; + entry.attachmentThreshold = 0; + entry.drawOrderThreshold = 0; + entry.animationStart = 0; + entry.animationEnd = animation.duration; + entry.animationLast = -1; + entry.nextAnimationLast = -1; + entry.delay = 0; + entry.trackTime = 0; + entry.trackLast = -1; + entry.nextTrackLast = -1; + entry.trackEnd = Number.MAX_VALUE; + entry.timeScale = 1; + entry.alpha = 1; + entry.interruptAlpha = 1; + entry.mixTime = 0; + entry.mixDuration = !last ? 0 : this.data.getMix(last.animation, animation); + entry.mixBlend = MixBlend.replace; + return entry; + } + }, { + key: "clearNext", + value: function clearNext(entry) { + var next = entry.next; + while (next) { + this.queue.dispose(next); + next = next.next; + } + entry.next = null; + } + }, { + key: "_animationsChanged", + value: function _animationsChanged() { + this.animationsChanged = false; + this.propertyIDs.clear(); + var tracks = this.tracks; + for (var i = 0, n = tracks.length; i < n; i++) { + var entry = tracks[i]; + if (!entry) continue; + while (entry.mixingFrom) entry = entry.mixingFrom; + do { + if (!entry.mixingTo || entry.mixBlend != MixBlend.add) this.computeHold(entry); + entry = entry.mixingTo; + } while (entry); + } + } + }, { + key: "computeHold", + value: function computeHold(entry) { + var to = entry.mixingTo; + var timelines = entry.animation.timelines; + var timelinesCount = entry.animation.timelines.length; + var timelineMode = entry.timelineMode; + timelineMode.length = timelinesCount; + var timelineHoldMix = entry.timelineHoldMix; + timelineHoldMix.length = 0; + var propertyIDs = this.propertyIDs; + if (to && to.holdPrevious) { + for (var i = 0; i < timelinesCount; i++) timelineMode[i] = propertyIDs.addAll(timelines[i].getPropertyIds()) ? HOLD_FIRST : HOLD_SUBSEQUENT; + return; + } + outer: for (var _i3 = 0; _i3 < timelinesCount; _i3++) { + var timeline = timelines[_i3]; + var ids = timeline.getPropertyIds(); + if (!propertyIDs.addAll(ids)) timelineMode[_i3] = SUBSEQUENT;else if (!to || timeline instanceof AttachmentTimeline || timeline instanceof DrawOrderTimeline || timeline instanceof EventTimeline || !to.animation.hasTimeline(ids)) { + timelineMode[_i3] = FIRST; + } else { + for (var next = to.mixingTo; next; next = next.mixingTo) { + if (next.animation.hasTimeline(ids)) continue; + if (entry.mixDuration > 0) { + timelineMode[_i3] = HOLD_MIX; + timelineHoldMix[_i3] = next; + continue outer; + } + break; + } + timelineMode[_i3] = HOLD_FIRST; + } + } + } + }, { + key: "getCurrent", + value: function getCurrent(trackIndex) { + if (trackIndex >= this.tracks.length) return null; + return this.tracks[trackIndex]; + } + }, { + key: "addListener", + value: function addListener(listener) { + if (!listener) throw new Error("listener cannot be null."); + this.listeners.push(listener); + } + }, { + key: "removeListener", + value: function removeListener(listener) { + var index = this.listeners.indexOf(listener); + if (index >= 0) this.listeners.splice(index, 1); + } + }, { + key: "clearListeners", + value: function clearListeners() { + this.listeners.length = 0; + } + }, { + key: "clearListenerNotifications", + value: function clearListenerNotifications() { + this.queue.clear(); + } + }], [{ + key: "emptyAnimation", + value: function emptyAnimation() { + if (!_emptyAnimation) _emptyAnimation = new Animation("", [], 0); + return _emptyAnimation; + } + }]); + return AnimationState; + }(); + var TrackEntry = function () { + function TrackEntry() { + _classCallCheck(this, TrackEntry); + this.animation = null; + this.previous = null; + this.next = null; + this.mixingFrom = null; + this.mixingTo = null; + this.listener = null; + this.trackIndex = 0; + this.loop = false; + this.holdPrevious = false; + this.reverse = false; + this.eventThreshold = 0; + this.attachmentThreshold = 0; + this.drawOrderThreshold = 0; + this.animationStart = 0; + this.animationEnd = 0; + this.animationLast = 0; + this.nextAnimationLast = 0; + this.delay = 0; + this.trackTime = 0; + this.trackLast = 0; + this.nextTrackLast = 0; + this.trackEnd = 0; + this.timeScale = 0; + this.alpha = 0; + this.mixTime = 0; + this.mixDuration = 0; + this.interruptAlpha = 0; + this.totalAlpha = 0; + this.mixBlend = MixBlend.replace; + this.timelineMode = new Array(); + this.timelineHoldMix = new Array(); + this.timelinesRotation = new Array(); + } + _createClass(TrackEntry, [{ + key: "reset", + value: function reset() { + this.next = null; + this.previous = null; + this.mixingFrom = null; + this.mixingTo = null; + this.animation = null; + this.listener = null; + this.timelineMode.length = 0; + this.timelineHoldMix.length = 0; + this.timelinesRotation.length = 0; + } + }, { + key: "getAnimationTime", + value: function getAnimationTime() { + if (this.loop) { + var duration = this.animationEnd - this.animationStart; + if (duration == 0) return this.animationStart; + return this.trackTime % duration + this.animationStart; + } + return Math.min(this.trackTime + this.animationStart, this.animationEnd); + } + }, { + key: "setAnimationLast", + value: function setAnimationLast(animationLast) { + this.animationLast = animationLast; + this.nextAnimationLast = animationLast; + } + }, { + key: "isComplete", + value: function isComplete() { + return this.trackTime >= this.animationEnd - this.animationStart; + } + }, { + key: "resetRotationDirections", + value: function resetRotationDirections() { + this.timelinesRotation.length = 0; + } + }, { + key: "getTrackComplete", + value: function getTrackComplete() { + var duration = this.animationEnd - this.animationStart; + if (duration != 0) { + if (this.loop) return duration * (1 + (this.trackTime / duration | 0)); + if (this.trackTime < duration) return duration; + } + return this.trackTime; + } + }]); + return TrackEntry; + }(); + var EventQueue = function () { + function EventQueue(animState) { + _classCallCheck(this, EventQueue); + this.objects = []; + this.drainDisabled = false; + this.animState = null; + this.animState = animState; + } + _createClass(EventQueue, [{ + key: "start", + value: function start(entry) { + this.objects.push(EventType.start); + this.objects.push(entry); + this.animState.animationsChanged = true; + } + }, { + key: "interrupt", + value: function interrupt(entry) { + this.objects.push(EventType.interrupt); + this.objects.push(entry); + } + }, { + key: "end", + value: function end(entry) { + this.objects.push(EventType.end); + this.objects.push(entry); + this.animState.animationsChanged = true; + } + }, { + key: "dispose", + value: function dispose(entry) { + this.objects.push(EventType.dispose); + this.objects.push(entry); + } + }, { + key: "complete", + value: function complete(entry) { + this.objects.push(EventType.complete); + this.objects.push(entry); + } + }, { + key: "event", + value: function event(entry, _event2) { + this.objects.push(EventType.event); + this.objects.push(entry); + this.objects.push(_event2); + } + }, { + key: "drain", + value: function drain() { + if (this.drainDisabled) return; + this.drainDisabled = true; + var objects = this.objects; + var listeners = this.animState.listeners; + for (var i = 0; i < objects.length; i += 2) { + var type = objects[i]; + var entry = objects[i + 1]; + switch (type) { + case EventType.start: + if (entry.listener && entry.listener.start) entry.listener.start(entry); + for (var ii = 0; ii < listeners.length; ii++) if (listeners[ii].start) listeners[ii].start(entry); + break; + case EventType.interrupt: + if (entry.listener && entry.listener.interrupt) entry.listener.interrupt(entry); + for (var _ii2 = 0; _ii2 < listeners.length; _ii2++) if (listeners[_ii2].interrupt) listeners[_ii2].interrupt(entry); + break; + case EventType.end: + if (entry.listener && entry.listener.end) entry.listener.end(entry); + for (var _ii3 = 0; _ii3 < listeners.length; _ii3++) if (listeners[_ii3].end) listeners[_ii3].end(entry); + case EventType.dispose: + if (entry.listener && entry.listener.dispose) entry.listener.dispose(entry); + for (var _ii4 = 0; _ii4 < listeners.length; _ii4++) if (listeners[_ii4].dispose) listeners[_ii4].dispose(entry); + this.animState.trackEntryPool.free(entry); + break; + case EventType.complete: + if (entry.listener && entry.listener.complete) entry.listener.complete(entry); + for (var _ii5 = 0; _ii5 < listeners.length; _ii5++) if (listeners[_ii5].complete) listeners[_ii5].complete(entry); + break; + case EventType.event: + var event = objects[i++ + 2]; + if (entry.listener && entry.listener.event) entry.listener.event(entry, event); + for (var _ii6 = 0; _ii6 < listeners.length; _ii6++) if (listeners[_ii6].event) listeners[_ii6].event(entry, event); + break; + } + } + this.clear(); + this.drainDisabled = false; + } + }, { + key: "clear", + value: function clear() { + this.objects.length = 0; + } + }]); + return EventQueue; + }(); + var EventType; + (function (EventType) { + EventType[EventType["start"] = 0] = "start"; + EventType[EventType["interrupt"] = 1] = "interrupt"; + EventType[EventType["end"] = 2] = "end"; + EventType[EventType["dispose"] = 3] = "dispose"; + EventType[EventType["complete"] = 4] = "complete"; + EventType[EventType["event"] = 5] = "event"; + })(EventType || (EventType = {})); + var AnimationStateAdapter = function () { + function AnimationStateAdapter() { + _classCallCheck(this, AnimationStateAdapter); + } + _createClass(AnimationStateAdapter, [{ + key: "start", + value: function start(entry) {} + }, { + key: "interrupt", + value: function interrupt(entry) {} + }, { + key: "end", + value: function end(entry) {} + }, { + key: "dispose", + value: function dispose(entry) {} + }, { + key: "complete", + value: function complete(entry) {} + }, { + key: "event", + value: function event(entry, _event3) {} + }]); + return AnimationStateAdapter; + }(); + var SUBSEQUENT = 0; + var FIRST = 1; + var HOLD_SUBSEQUENT = 2; + var HOLD_FIRST = 3; + var HOLD_MIX = 4; + var SETUP = 1; + var CURRENT = 2; + var _emptyAnimation = null; + + var AnimationStateData = function () { + function AnimationStateData(skeletonData) { + _classCallCheck(this, AnimationStateData); + this.skeletonData = null; + this.animationToMixTime = {}; + this.defaultMix = 0; + if (!skeletonData) throw new Error("skeletonData cannot be null."); + this.skeletonData = skeletonData; + } + _createClass(AnimationStateData, [{ + key: "setMix", + value: function setMix(fromName, toName, duration) { + var from = this.skeletonData.findAnimation(fromName); + if (!from) throw new Error("Animation not found: " + fromName); + var to = this.skeletonData.findAnimation(toName); + if (!to) throw new Error("Animation not found: " + toName); + this.setMixWith(from, to, duration); + } + }, { + key: "setMixWith", + value: function setMixWith(from, to, duration) { + if (!from) throw new Error("from cannot be null."); + if (!to) throw new Error("to cannot be null."); + var key = from.name + "." + to.name; + this.animationToMixTime[key] = duration; + } + }, { + key: "getMix", + value: function getMix(from, to) { + var key = from.name + "." + to.name; + var value = this.animationToMixTime[key]; + return value === undefined ? this.defaultMix : value; + } + }]); + return AnimationStateData; + }(); + + var BoundingBoxAttachment = function (_VertexAttachment) { + _inherits(BoundingBoxAttachment, _VertexAttachment); + var _super = _createSuper(BoundingBoxAttachment); + function BoundingBoxAttachment(name) { + var _this; + _classCallCheck(this, BoundingBoxAttachment); + _this = _super.call(this, name); + _this.color = new Color(1, 1, 1, 1); + return _this; + } + _createClass(BoundingBoxAttachment, [{ + key: "copy", + value: function copy() { + var copy = new BoundingBoxAttachment(this.name); + this.copyTo(copy); + copy.color.setFromColor(this.color); + return copy; + } + }]); + return BoundingBoxAttachment; + }(VertexAttachment); + + var ClippingAttachment = function (_VertexAttachment) { + _inherits(ClippingAttachment, _VertexAttachment); + var _super = _createSuper(ClippingAttachment); + function ClippingAttachment(name) { + var _this; + _classCallCheck(this, ClippingAttachment); + _this = _super.call(this, name); + _this.endSlot = null; + _this.color = new Color(0.2275, 0.2275, 0.8078, 1); + return _this; + } + _createClass(ClippingAttachment, [{ + key: "copy", + value: function copy() { + var copy = new ClippingAttachment(this.name); + this.copyTo(copy); + copy.endSlot = this.endSlot; + copy.color.setFromColor(this.color); + return copy; + } + }]); + return ClippingAttachment; + }(VertexAttachment); + + var Texture = function () { + function Texture(image) { + _classCallCheck(this, Texture); + this._image = image; + } + _createClass(Texture, [{ + key: "getImage", + value: function getImage() { + return this._image; + } + }]); + return Texture; + }(); + var TextureFilter; + (function (TextureFilter) { + TextureFilter[TextureFilter["Nearest"] = 9728] = "Nearest"; + TextureFilter[TextureFilter["Linear"] = 9729] = "Linear"; + TextureFilter[TextureFilter["MipMap"] = 9987] = "MipMap"; + TextureFilter[TextureFilter["MipMapNearestNearest"] = 9984] = "MipMapNearestNearest"; + TextureFilter[TextureFilter["MipMapLinearNearest"] = 9985] = "MipMapLinearNearest"; + TextureFilter[TextureFilter["MipMapNearestLinear"] = 9986] = "MipMapNearestLinear"; + TextureFilter[TextureFilter["MipMapLinearLinear"] = 9987] = "MipMapLinearLinear"; + })(TextureFilter || (TextureFilter = {})); + var TextureWrap; + (function (TextureWrap) { + TextureWrap[TextureWrap["MirroredRepeat"] = 33648] = "MirroredRepeat"; + TextureWrap[TextureWrap["ClampToEdge"] = 33071] = "ClampToEdge"; + TextureWrap[TextureWrap["Repeat"] = 10497] = "Repeat"; + })(TextureWrap || (TextureWrap = {})); + var TextureRegion = _createClass(function TextureRegion() { + _classCallCheck(this, TextureRegion); + this.u = 0; + this.v = 0; + this.u2 = 0; + this.v2 = 0; + this.width = 0; + this.height = 0; + this.degrees = 0; + this.offsetX = 0; + this.offsetY = 0; + this.originalWidth = 0; + this.originalHeight = 0; + }); + var FakeTexture = function (_Texture) { + _inherits(FakeTexture, _Texture); + var _super = _createSuper(FakeTexture); + function FakeTexture() { + _classCallCheck(this, FakeTexture); + return _super.apply(this, arguments); + } + _createClass(FakeTexture, [{ + key: "setFilters", + value: function setFilters(minFilter, magFilter) {} + }, { + key: "setWraps", + value: function setWraps(uWrap, vWrap) {} + }, { + key: "dispose", + value: function dispose() {} + }]); + return FakeTexture; + }(Texture); + + var TextureAtlas = function () { + function TextureAtlas(atlasText) { + _classCallCheck(this, TextureAtlas); + this.pages = new Array(); + this.regions = new Array(); + var reader = new TextureAtlasReader(atlasText); + var entry = new Array(4); + var page = null; + var region = null; + var pageFields = {}; + pageFields["size"] = function () { + page.width = parseInt(entry[1]); + page.height = parseInt(entry[2]); + }; + pageFields["format"] = function () {}; + pageFields["filter"] = function () { + page.minFilter = Utils.enumValue(TextureFilter, entry[1]); + page.magFilter = Utils.enumValue(TextureFilter, entry[2]); + }; + pageFields["repeat"] = function () { + if (entry[1].indexOf('x') != -1) page.uWrap = TextureWrap.Repeat; + if (entry[1].indexOf('y') != -1) page.vWrap = TextureWrap.Repeat; + }; + pageFields["pma"] = function () { + page.pma = entry[1] == "true"; + }; + var regionFields = {}; + regionFields["xy"] = function () { + region.x = parseInt(entry[1]); + region.y = parseInt(entry[2]); + }; + regionFields["size"] = function () { + region.width = parseInt(entry[1]); + region.height = parseInt(entry[2]); + }; + regionFields["bounds"] = function () { + region.x = parseInt(entry[1]); + region.y = parseInt(entry[2]); + region.width = parseInt(entry[3]); + region.height = parseInt(entry[4]); + }; + regionFields["offset"] = function () { + region.offsetX = parseInt(entry[1]); + region.offsetY = parseInt(entry[2]); + }; + regionFields["orig"] = function () { + region.originalWidth = parseInt(entry[1]); + region.originalHeight = parseInt(entry[2]); + }; + regionFields["offsets"] = function () { + region.offsetX = parseInt(entry[1]); + region.offsetY = parseInt(entry[2]); + region.originalWidth = parseInt(entry[3]); + region.originalHeight = parseInt(entry[4]); + }; + regionFields["rotate"] = function () { + var value = entry[1]; + if (value == "true") region.degrees = 90;else if (value != "false") region.degrees = parseInt(value); + }; + regionFields["index"] = function () { + region.index = parseInt(entry[1]); + }; + var line = reader.readLine(); + while (line && line.trim().length == 0) line = reader.readLine(); + while (true) { + if (!line || line.trim().length == 0) break; + if (reader.readEntry(entry, line) == 0) break; + line = reader.readLine(); + } + var names = null; + var values = null; + while (true) { + if (line === null) break; + if (line.trim().length == 0) { + page = null; + line = reader.readLine(); + } else if (!page) { + page = new TextureAtlasPage(); + page.name = line.trim(); + while (true) { + if (reader.readEntry(entry, line = reader.readLine()) == 0) break; + var field = pageFields[entry[0]]; + if (field) field(); + } + this.pages.push(page); + } else { + region = new TextureAtlasRegion(); + region.page = page; + region.name = line; + while (true) { + var count = reader.readEntry(entry, line = reader.readLine()); + if (count == 0) break; + var _field = regionFields[entry[0]]; + if (_field) _field();else { + if (!names) { + names = []; + values = []; + } + names.push(entry[0]); + var entryValues = []; + for (var i = 0; i < count; i++) entryValues.push(parseInt(entry[i + 1])); + values.push(entryValues); + } + } + if (region.originalWidth == 0 && region.originalHeight == 0) { + region.originalWidth = region.width; + region.originalHeight = region.height; + } + if (names && names.length > 0) { + region.names = names; + region.values = values; + names = null; + values = null; + } + region.u = region.x / page.width; + region.v = region.y / page.height; + if (region.degrees == 90) { + region.u2 = (region.x + region.height) / page.width; + region.v2 = (region.y + region.width) / page.height; + } else { + region.u2 = (region.x + region.width) / page.width; + region.v2 = (region.y + region.height) / page.height; + } + this.regions.push(region); + } + } + } + _createClass(TextureAtlas, [{ + key: "findRegion", + value: function findRegion(name) { + for (var i = 0; i < this.regions.length; i++) { + if (this.regions[i].name == name) { + return this.regions[i]; + } + } + return null; + } + }, { + key: "setTextures", + value: function setTextures(assetManager) { + var pathPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; + var _iterator = _createForOfIteratorHelper(this.pages), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var page = _step.value; + page.setTexture(assetManager.get(pathPrefix + page.name)); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } + }, { + key: "dispose", + value: function dispose() { + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].texture.dispose(); + } + } + }]); + return TextureAtlas; + }(); + var TextureAtlasReader = function () { + function TextureAtlasReader(text) { + _classCallCheck(this, TextureAtlasReader); + this.lines = null; + this.index = 0; + this.lines = text.split(/\r\n|\r|\n/); + } + _createClass(TextureAtlasReader, [{ + key: "readLine", + value: function readLine() { + if (this.index >= this.lines.length) return null; + return this.lines[this.index++]; + } + }, { + key: "readEntry", + value: function readEntry(entry, line) { + if (!line) return 0; + line = line.trim(); + if (line.length == 0) return 0; + var colon = line.indexOf(':'); + if (colon == -1) return 0; + entry[0] = line.substr(0, colon).trim(); + for (var i = 1, lastMatch = colon + 1;; i++) { + var comma = line.indexOf(',', lastMatch); + if (comma == -1) { + entry[i] = line.substr(lastMatch).trim(); + return i; + } + entry[i] = line.substr(lastMatch, comma - lastMatch).trim(); + lastMatch = comma + 1; + if (i == 4) return 4; + } + } + }]); + return TextureAtlasReader; + }(); + var TextureAtlasPage = function () { + function TextureAtlasPage() { + _classCallCheck(this, TextureAtlasPage); + this.name = null; + this.minFilter = TextureFilter.Nearest; + this.magFilter = TextureFilter.Nearest; + this.uWrap = TextureWrap.ClampToEdge; + this.vWrap = TextureWrap.ClampToEdge; + this.texture = null; + this.width = 0; + this.height = 0; + this.pma = false; + } + _createClass(TextureAtlasPage, [{ + key: "setTexture", + value: function setTexture(texture) { + this.texture = texture; + texture.setFilters(this.minFilter, this.magFilter); + texture.setWraps(this.uWrap, this.vWrap); + } + }]); + return TextureAtlasPage; + }(); + var TextureAtlasRegion = function (_TextureRegion) { + _inherits(TextureAtlasRegion, _TextureRegion); + var _super = _createSuper(TextureAtlasRegion); + function TextureAtlasRegion() { + var _this; + _classCallCheck(this, TextureAtlasRegion); + _this = _super.apply(this, arguments); + _this.page = null; + _this.name = null; + _this.x = 0; + _this.y = 0; + _this.offsetX = 0; + _this.offsetY = 0; + _this.originalWidth = 0; + _this.originalHeight = 0; + _this.index = 0; + _this.degrees = 0; + _this.names = null; + _this.values = null; + return _this; + } + return _createClass(TextureAtlasRegion); + }(TextureRegion); + + var MeshAttachment = function (_VertexAttachment) { + _inherits(MeshAttachment, _VertexAttachment); + var _super = _createSuper(MeshAttachment); + function MeshAttachment(name) { + var _this; + _classCallCheck(this, MeshAttachment); + _this = _super.call(this, name); + _this.region = null; + _this.path = null; + _this.regionUVs = null; + _this.uvs = null; + _this.triangles = null; + _this.color = new Color(1, 1, 1, 1); + _this.width = 0; + _this.height = 0; + _this.hullLength = 0; + _this.edges = null; + _this.parentMesh = null; + _this.tempColor = new Color(0, 0, 0, 0); + return _this; + } + _createClass(MeshAttachment, [{ + key: "updateUVs", + value: function updateUVs() { + var regionUVs = this.regionUVs; + if (!this.uvs || this.uvs.length != regionUVs.length) this.uvs = Utils.newFloatArray(regionUVs.length); + var uvs = this.uvs; + var n = this.uvs.length; + var u = this.region.u, + v = this.region.v, + width = 0, + height = 0; + if (this.region instanceof TextureAtlasRegion) { + var region = this.region, + image = region.page.texture.getImage(); + var textureWidth = image.width, + textureHeight = image.height; + switch (region.degrees) { + case 90: + u -= (region.originalHeight - region.offsetY - region.height) / textureWidth; + v -= (region.originalWidth - region.offsetX - region.width) / textureHeight; + width = region.originalHeight / textureWidth; + height = region.originalWidth / textureHeight; + for (var i = 0; i < n; i += 2) { + uvs[i] = u + regionUVs[i + 1] * width; + uvs[i + 1] = v + (1 - regionUVs[i]) * height; + } + return; + case 180: + u -= (region.originalWidth - region.offsetX - region.width) / textureWidth; + v -= region.offsetY / textureHeight; + width = region.originalWidth / textureWidth; + height = region.originalHeight / textureHeight; + for (var _i = 0; _i < n; _i += 2) { + uvs[_i] = u + (1 - regionUVs[_i]) * width; + uvs[_i + 1] = v + (1 - regionUVs[_i + 1]) * height; + } + return; + case 270: + u -= region.offsetY / textureWidth; + v -= region.offsetX / textureHeight; + width = region.originalHeight / textureWidth; + height = region.originalWidth / textureHeight; + for (var _i2 = 0; _i2 < n; _i2 += 2) { + uvs[_i2] = u + (1 - regionUVs[_i2 + 1]) * width; + uvs[_i2 + 1] = v + regionUVs[_i2] * height; + } + return; + } + u -= region.offsetX / textureWidth; + v -= (region.originalHeight - region.offsetY - region.height) / textureHeight; + width = region.originalWidth / textureWidth; + height = region.originalHeight / textureHeight; + } else if (!this.region) { + u = v = 0; + width = height = 1; + } else { + width = this.region.u2 - u; + height = this.region.v2 - v; + } + for (var _i3 = 0; _i3 < n; _i3 += 2) { + uvs[_i3] = u + regionUVs[_i3] * width; + uvs[_i3 + 1] = v + regionUVs[_i3 + 1] * height; + } + } + }, { + key: "getParentMesh", + value: function getParentMesh() { + return this.parentMesh; + } + }, { + key: "setParentMesh", + value: function setParentMesh(parentMesh) { + this.parentMesh = parentMesh; + if (parentMesh) { + this.bones = parentMesh.bones; + this.vertices = parentMesh.vertices; + this.worldVerticesLength = parentMesh.worldVerticesLength; + this.regionUVs = parentMesh.regionUVs; + this.triangles = parentMesh.triangles; + this.hullLength = parentMesh.hullLength; + this.worldVerticesLength = parentMesh.worldVerticesLength; + } + } + }, { + key: "copy", + value: function copy() { + if (this.parentMesh) return this.newLinkedMesh(); + var copy = new MeshAttachment(this.name); + copy.region = this.region; + copy.path = this.path; + copy.color.setFromColor(this.color); + this.copyTo(copy); + copy.regionUVs = new Array(this.regionUVs.length); + Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length); + copy.uvs = new Array(this.uvs.length); + Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length); + copy.triangles = new Array(this.triangles.length); + Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length); + copy.hullLength = this.hullLength; + if (this.edges) { + copy.edges = new Array(this.edges.length); + Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length); + } + copy.width = this.width; + copy.height = this.height; + return copy; + } + }, { + key: "newLinkedMesh", + value: function newLinkedMesh() { + var copy = new MeshAttachment(this.name); + copy.region = this.region; + copy.path = this.path; + copy.color.setFromColor(this.color); + copy.deformAttachment = this.deformAttachment; + copy.setParentMesh(this.parentMesh ? this.parentMesh : this); + copy.updateUVs(); + return copy; + } + }]); + return MeshAttachment; + }(VertexAttachment); + + var PathAttachment = function (_VertexAttachment) { + _inherits(PathAttachment, _VertexAttachment); + var _super = _createSuper(PathAttachment); + function PathAttachment(name) { + var _this; + _classCallCheck(this, PathAttachment); + _this = _super.call(this, name); + _this.lengths = null; + _this.closed = false; + _this.constantSpeed = false; + _this.color = new Color(1, 1, 1, 1); + return _this; + } + _createClass(PathAttachment, [{ + key: "copy", + value: function copy() { + var copy = new PathAttachment(this.name); + this.copyTo(copy); + copy.lengths = new Array(this.lengths.length); + Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length); + copy.closed = closed; + copy.constantSpeed = this.constantSpeed; + copy.color.setFromColor(this.color); + return copy; + } + }]); + return PathAttachment; + }(VertexAttachment); + + var PointAttachment = function (_VertexAttachment) { + _inherits(PointAttachment, _VertexAttachment); + var _super = _createSuper(PointAttachment); + function PointAttachment(name) { + var _this; + _classCallCheck(this, PointAttachment); + _this = _super.call(this, name); + _this.x = 0; + _this.y = 0; + _this.rotation = 0; + _this.color = new Color(0.38, 0.94, 0, 1); + return _this; + } + _createClass(PointAttachment, [{ + key: "computeWorldPosition", + value: function computeWorldPosition(bone, point) { + point.x = this.x * bone.a + this.y * bone.b + bone.worldX; + point.y = this.x * bone.c + this.y * bone.d + bone.worldY; + return point; + } + }, { + key: "computeWorldRotation", + value: function computeWorldRotation(bone) { + var cos = MathUtils.cosDeg(this.rotation), + sin = MathUtils.sinDeg(this.rotation); + var x = cos * bone.a + sin * bone.b; + var y = cos * bone.c + sin * bone.d; + return Math.atan2(y, x) * MathUtils.radDeg; + } + }, { + key: "copy", + value: function copy() { + var copy = new PointAttachment(this.name); + copy.x = this.x; + copy.y = this.y; + copy.rotation = this.rotation; + copy.color.setFromColor(this.color); + return copy; + } + }]); + return PointAttachment; + }(VertexAttachment); + + var RegionAttachment = function (_Attachment) { + _inherits(RegionAttachment, _Attachment); + var _super = _createSuper(RegionAttachment); + function RegionAttachment(name) { + var _this; + _classCallCheck(this, RegionAttachment); + _this = _super.call(this, name); + _this.x = 0; + _this.y = 0; + _this.scaleX = 1; + _this.scaleY = 1; + _this.rotation = 0; + _this.width = 0; + _this.height = 0; + _this.color = new Color(1, 1, 1, 1); + _this.path = null; + _this.rendererObject = null; + _this.region = null; + _this.offset = Utils.newFloatArray(8); + _this.uvs = Utils.newFloatArray(8); + _this.tempColor = new Color(1, 1, 1, 1); + return _this; + } + _createClass(RegionAttachment, [{ + key: "updateOffset", + value: function updateOffset() { + this.region; + var regionScaleX = this.width / this.region.originalWidth * this.scaleX; + var regionScaleY = this.height / this.region.originalHeight * this.scaleY; + var localX = -this.width / 2 * this.scaleX + this.region.offsetX * regionScaleX; + var localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY; + var localX2 = localX + this.region.width * regionScaleX; + var localY2 = localY + this.region.height * regionScaleY; + var radians = this.rotation * Math.PI / 180; + var cos = Math.cos(radians); + var sin = Math.sin(radians); + var x = this.x, + y = this.y; + var localXCos = localX * cos + x; + var localXSin = localX * sin; + var localYCos = localY * cos + y; + var localYSin = localY * sin; + var localX2Cos = localX2 * cos + x; + var localX2Sin = localX2 * sin; + var localY2Cos = localY2 * cos + y; + var localY2Sin = localY2 * sin; + var offset = this.offset; + offset[0] = localXCos - localYSin; + offset[1] = localYCos + localXSin; + offset[2] = localXCos - localY2Sin; + offset[3] = localY2Cos + localXSin; + offset[4] = localX2Cos - localY2Sin; + offset[5] = localY2Cos + localX2Sin; + offset[6] = localX2Cos - localYSin; + offset[7] = localYCos + localX2Sin; + } + }, { + key: "setRegion", + value: function setRegion(region) { + this.region = region; + var uvs = this.uvs; + if (region.degrees == 90) { + uvs[2] = region.u; + uvs[3] = region.v2; + uvs[4] = region.u; + uvs[5] = region.v; + uvs[6] = region.u2; + uvs[7] = region.v; + uvs[0] = region.u2; + uvs[1] = region.v2; + } else { + uvs[0] = region.u; + uvs[1] = region.v2; + uvs[2] = region.u; + uvs[3] = region.v; + uvs[4] = region.u2; + uvs[5] = region.v; + uvs[6] = region.u2; + uvs[7] = region.v2; + } + } + }, { + key: "computeWorldVertices", + value: function computeWorldVertices(bone, worldVertices, offset, stride) { + var vertexOffset = this.offset; + var x = bone.worldX, + y = bone.worldY; + var a = bone.a, + b = bone.b, + c = bone.c, + d = bone.d; + var offsetX = 0, + offsetY = 0; + offsetX = vertexOffset[0]; + offsetY = vertexOffset[1]; + worldVertices[offset] = offsetX * a + offsetY * b + x; + worldVertices[offset + 1] = offsetX * c + offsetY * d + y; + offset += stride; + offsetX = vertexOffset[2]; + offsetY = vertexOffset[3]; + worldVertices[offset] = offsetX * a + offsetY * b + x; + worldVertices[offset + 1] = offsetX * c + offsetY * d + y; + offset += stride; + offsetX = vertexOffset[4]; + offsetY = vertexOffset[5]; + worldVertices[offset] = offsetX * a + offsetY * b + x; + worldVertices[offset + 1] = offsetX * c + offsetY * d + y; + offset += stride; + offsetX = vertexOffset[6]; + offsetY = vertexOffset[7]; + worldVertices[offset] = offsetX * a + offsetY * b + x; + worldVertices[offset + 1] = offsetX * c + offsetY * d + y; + } + }, { + key: "copy", + value: function copy() { + var copy = new RegionAttachment(this.name); + copy.region = this.region; + copy.rendererObject = this.rendererObject; + copy.path = this.path; + copy.x = this.x; + copy.y = this.y; + copy.scaleX = this.scaleX; + copy.scaleY = this.scaleY; + copy.rotation = this.rotation; + copy.width = this.width; + copy.height = this.height; + Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8); + Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8); + copy.color.setFromColor(this.color); + return copy; + } + }]); + return RegionAttachment; + }(Attachment); + RegionAttachment.X1 = 0; + RegionAttachment.Y1 = 1; + RegionAttachment.C1R = 2; + RegionAttachment.C1G = 3; + RegionAttachment.C1B = 4; + RegionAttachment.C1A = 5; + RegionAttachment.U1 = 6; + RegionAttachment.V1 = 7; + RegionAttachment.X2 = 8; + RegionAttachment.Y2 = 9; + RegionAttachment.C2R = 10; + RegionAttachment.C2G = 11; + RegionAttachment.C2B = 12; + RegionAttachment.C2A = 13; + RegionAttachment.U2 = 14; + RegionAttachment.V2 = 15; + RegionAttachment.X3 = 16; + RegionAttachment.Y3 = 17; + RegionAttachment.C3R = 18; + RegionAttachment.C3G = 19; + RegionAttachment.C3B = 20; + RegionAttachment.C3A = 21; + RegionAttachment.U3 = 22; + RegionAttachment.V3 = 23; + RegionAttachment.X4 = 24; + RegionAttachment.Y4 = 25; + RegionAttachment.C4R = 26; + RegionAttachment.C4G = 27; + RegionAttachment.C4B = 28; + RegionAttachment.C4A = 29; + RegionAttachment.U4 = 30; + RegionAttachment.V4 = 31; + + var AtlasAttachmentLoader = function () { + function AtlasAttachmentLoader(atlas) { + _classCallCheck(this, AtlasAttachmentLoader); + this.atlas = null; + this.atlas = atlas; + } + _createClass(AtlasAttachmentLoader, [{ + key: "newRegionAttachment", + value: function newRegionAttachment(skin, name, path) { + var region = this.atlas.findRegion(path); + if (!region) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")"); + region.renderObject = region; + var attachment = new RegionAttachment(name); + attachment.setRegion(region); + return attachment; + } + }, { + key: "newMeshAttachment", + value: function newMeshAttachment(skin, name, path) { + var region = this.atlas.findRegion(path); + if (!region) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")"); + region.renderObject = region; + var attachment = new MeshAttachment(name); + attachment.region = region; + return attachment; + } + }, { + key: "newBoundingBoxAttachment", + value: function newBoundingBoxAttachment(skin, name) { + return new BoundingBoxAttachment(name); + } + }, { + key: "newPathAttachment", + value: function newPathAttachment(skin, name) { + return new PathAttachment(name); + } + }, { + key: "newPointAttachment", + value: function newPointAttachment(skin, name) { + return new PointAttachment(name); + } + }, { + key: "newClippingAttachment", + value: function newClippingAttachment(skin, name) { + return new ClippingAttachment(name); + } + }]); + return AtlasAttachmentLoader; + }(); + + var BoneData = _createClass(function BoneData(index, name, parent) { + _classCallCheck(this, BoneData); + this.index = 0; + this.name = null; + this.parent = null; + this.length = 0; + this.x = 0; + this.y = 0; + this.rotation = 0; + this.scaleX = 1; + this.scaleY = 1; + this.shearX = 0; + this.shearY = 0; + this.transformMode = TransformMode.Normal; + this.skinRequired = false; + this.color = new Color(); + if (index < 0) throw new Error("index must be >= 0."); + if (!name) throw new Error("name cannot be null."); + this.index = index; + this.name = name; + this.parent = parent; + }); + var TransformMode; + (function (TransformMode) { + TransformMode[TransformMode["Normal"] = 0] = "Normal"; + TransformMode[TransformMode["OnlyTranslation"] = 1] = "OnlyTranslation"; + TransformMode[TransformMode["NoRotationOrReflection"] = 2] = "NoRotationOrReflection"; + TransformMode[TransformMode["NoScale"] = 3] = "NoScale"; + TransformMode[TransformMode["NoScaleOrReflection"] = 4] = "NoScaleOrReflection"; + })(TransformMode || (TransformMode = {})); + + var Bone = function () { + function Bone(data, skeleton, parent) { + _classCallCheck(this, Bone); + this.data = null; + this.skeleton = null; + this.parent = null; + this.children = new Array(); + this.x = 0; + this.y = 0; + this.rotation = 0; + this.scaleX = 0; + this.scaleY = 0; + this.shearX = 0; + this.shearY = 0; + this.ax = 0; + this.ay = 0; + this.arotation = 0; + this.ascaleX = 0; + this.ascaleY = 0; + this.ashearX = 0; + this.ashearY = 0; + this.a = 0; + this.b = 0; + this.c = 0; + this.d = 0; + this.worldY = 0; + this.worldX = 0; + this.sorted = false; + this.active = false; + if (!data) throw new Error("data cannot be null."); + if (!skeleton) throw new Error("skeleton cannot be null."); + this.data = data; + this.skeleton = skeleton; + this.parent = parent; + this.setToSetupPose(); + } + _createClass(Bone, [{ + key: "isActive", + value: function isActive() { + return this.active; + } + }, { + key: "update", + value: function update() { + this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY); + } + }, { + key: "updateWorldTransform", + value: function updateWorldTransform() { + this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY); + } + }, { + key: "updateWorldTransformWith", + value: function updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY) { + this.ax = x; + this.ay = y; + this.arotation = rotation; + this.ascaleX = scaleX; + this.ascaleY = scaleY; + this.ashearX = shearX; + this.ashearY = shearY; + var parent = this.parent; + if (!parent) { + var skeleton = this.skeleton; + var rotationY = rotation + 90 + shearY; + var sx = skeleton.scaleX; + var sy = skeleton.scaleY; + this.a = MathUtils.cosDeg(rotation + shearX) * scaleX * sx; + this.b = MathUtils.cosDeg(rotationY) * scaleY * sx; + this.c = MathUtils.sinDeg(rotation + shearX) * scaleX * sy; + this.d = MathUtils.sinDeg(rotationY) * scaleY * sy; + this.worldX = x * sx + skeleton.x; + this.worldY = y * sy + skeleton.y; + return; + } + var pa = parent.a, + pb = parent.b, + pc = parent.c, + pd = parent.d; + this.worldX = pa * x + pb * y + parent.worldX; + this.worldY = pc * x + pd * y + parent.worldY; + switch (this.data.transformMode) { + case TransformMode.Normal: + { + var _rotationY = rotation + 90 + shearY; + var la = MathUtils.cosDeg(rotation + shearX) * scaleX; + var lb = MathUtils.cosDeg(_rotationY) * scaleY; + var lc = MathUtils.sinDeg(rotation + shearX) * scaleX; + var ld = MathUtils.sinDeg(_rotationY) * scaleY; + this.a = pa * la + pb * lc; + this.b = pa * lb + pb * ld; + this.c = pc * la + pd * lc; + this.d = pc * lb + pd * ld; + return; + } + case TransformMode.OnlyTranslation: + { + var _rotationY2 = rotation + 90 + shearY; + this.a = MathUtils.cosDeg(rotation + shearX) * scaleX; + this.b = MathUtils.cosDeg(_rotationY2) * scaleY; + this.c = MathUtils.sinDeg(rotation + shearX) * scaleX; + this.d = MathUtils.sinDeg(_rotationY2) * scaleY; + break; + } + case TransformMode.NoRotationOrReflection: + { + var s = pa * pa + pc * pc; + var prx = 0; + if (s > 0.0001) { + s = Math.abs(pa * pd - pb * pc) / s; + pa /= this.skeleton.scaleX; + pc /= this.skeleton.scaleY; + pb = pc * s; + pd = pa * s; + prx = Math.atan2(pc, pa) * MathUtils.radDeg; + } else { + pa = 0; + pc = 0; + prx = 90 - Math.atan2(pd, pb) * MathUtils.radDeg; + } + var rx = rotation + shearX - prx; + var ry = rotation + shearY - prx + 90; + var _la = MathUtils.cosDeg(rx) * scaleX; + var _lb = MathUtils.cosDeg(ry) * scaleY; + var _lc = MathUtils.sinDeg(rx) * scaleX; + var _ld = MathUtils.sinDeg(ry) * scaleY; + this.a = pa * _la - pb * _lc; + this.b = pa * _lb - pb * _ld; + this.c = pc * _la + pd * _lc; + this.d = pc * _lb + pd * _ld; + break; + } + case TransformMode.NoScale: + case TransformMode.NoScaleOrReflection: + { + var cos = MathUtils.cosDeg(rotation); + var sin = MathUtils.sinDeg(rotation); + var za = (pa * cos + pb * sin) / this.skeleton.scaleX; + var zc = (pc * cos + pd * sin) / this.skeleton.scaleY; + var _s = Math.sqrt(za * za + zc * zc); + if (_s > 0.00001) _s = 1 / _s; + za *= _s; + zc *= _s; + _s = Math.sqrt(za * za + zc * zc); + if (this.data.transformMode == TransformMode.NoScale && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) _s = -_s; + var r = Math.PI / 2 + Math.atan2(zc, za); + var zb = Math.cos(r) * _s; + var zd = Math.sin(r) * _s; + var _la2 = MathUtils.cosDeg(shearX) * scaleX; + var _lb2 = MathUtils.cosDeg(90 + shearY) * scaleY; + var _lc2 = MathUtils.sinDeg(shearX) * scaleX; + var _ld2 = MathUtils.sinDeg(90 + shearY) * scaleY; + this.a = za * _la2 + zb * _lc2; + this.b = za * _lb2 + zb * _ld2; + this.c = zc * _la2 + zd * _lc2; + this.d = zc * _lb2 + zd * _ld2; + break; + } + } + this.a *= this.skeleton.scaleX; + this.b *= this.skeleton.scaleX; + this.c *= this.skeleton.scaleY; + this.d *= this.skeleton.scaleY; + } + }, { + key: "setToSetupPose", + value: function setToSetupPose() { + var data = this.data; + this.x = data.x; + this.y = data.y; + this.rotation = data.rotation; + this.scaleX = data.scaleX; + this.scaleY = data.scaleY; + this.shearX = data.shearX; + this.shearY = data.shearY; + } + }, { + key: "getWorldRotationX", + value: function getWorldRotationX() { + return Math.atan2(this.c, this.a) * MathUtils.radDeg; + } + }, { + key: "getWorldRotationY", + value: function getWorldRotationY() { + return Math.atan2(this.d, this.b) * MathUtils.radDeg; + } + }, { + key: "getWorldScaleX", + value: function getWorldScaleX() { + return Math.sqrt(this.a * this.a + this.c * this.c); + } + }, { + key: "getWorldScaleY", + value: function getWorldScaleY() { + return Math.sqrt(this.b * this.b + this.d * this.d); + } + }, { + key: "updateAppliedTransform", + value: function updateAppliedTransform() { + var parent = this.parent; + if (!parent) { + this.ax = this.worldX - this.skeleton.x; + this.ay = this.worldY - this.skeleton.y; + this.arotation = Math.atan2(this.c, this.a) * MathUtils.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; + this.ashearY = Math.atan2(this.a * this.b + this.c * this.d, this.a * this.d - this.b * this.c) * MathUtils.radDeg; + return; + } + var pa = parent.a, + pb = parent.b, + pc = parent.c, + pd = parent.d; + var pid = 1 / (pa * pd - pb * pc); + var dx = this.worldX - parent.worldX, + dy = this.worldY - parent.worldY; + this.ax = dx * pd * pid - dy * pb * pid; + this.ay = dy * pa * pid - dx * pc * pid; + var ia = pid * pd; + var id = pid * pa; + var ib = pid * pb; + var ic = pid * pc; + var ra = ia * this.a - ib * this.c; + var rb = ia * this.b - ib * this.d; + var rc = id * this.c - ic * this.a; + var rd = id * this.d - ic * this.b; + this.ashearX = 0; + this.ascaleX = Math.sqrt(ra * ra + rc * rc); + if (this.ascaleX > 0.0001) { + var det = ra * rd - rb * rc; + this.ascaleY = det / this.ascaleX; + this.ashearY = Math.atan2(ra * rb + rc * rd, det) * MathUtils.radDeg; + this.arotation = Math.atan2(rc, ra) * MathUtils.radDeg; + } else { + this.ascaleX = 0; + this.ascaleY = Math.sqrt(rb * rb + rd * rd); + this.ashearY = 0; + this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg; + } + } + }, { + key: "worldToLocal", + value: function worldToLocal(world) { + var invDet = 1 / (this.a * this.d - this.b * this.c); + var x = world.x - this.worldX, + y = world.y - this.worldY; + world.x = x * this.d * invDet - y * this.b * invDet; + world.y = y * this.a * invDet - x * this.c * invDet; + return world; + } + }, { + key: "localToWorld", + value: function localToWorld(local) { + var x = local.x, + y = local.y; + local.x = x * this.a + y * this.b + this.worldX; + local.y = x * this.c + y * this.d + this.worldY; + return local; + } + }, { + key: "worldToLocalRotation", + value: function worldToLocalRotation(worldRotation) { + var sin = MathUtils.sinDeg(worldRotation), + cos = MathUtils.cosDeg(worldRotation); + return Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * MathUtils.radDeg + this.rotation - this.shearX; + } + }, { + key: "localToWorldRotation", + value: function localToWorldRotation(localRotation) { + localRotation -= this.rotation - this.shearX; + var sin = MathUtils.sinDeg(localRotation), + cos = MathUtils.cosDeg(localRotation); + return Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * MathUtils.radDeg; + } + }, { + key: "rotateWorld", + value: function rotateWorld(degrees) { + var a = this.a, + b = this.b, + c = this.c, + d = this.d; + var cos = MathUtils.cosDeg(degrees), + sin = MathUtils.sinDeg(degrees); + this.a = cos * a - sin * c; + this.b = cos * b - sin * d; + this.c = sin * a + cos * c; + this.d = sin * b + cos * d; + } + }]); + return Bone; + }(); + + var ConstraintData = _createClass(function ConstraintData(name, order, skinRequired) { + _classCallCheck(this, ConstraintData); + this.name = name; + this.order = order; + this.skinRequired = skinRequired; + }); + + var AssetManagerBase = function () { + function AssetManagerBase(textureLoader) { + var pathPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; + var downloader = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + _classCallCheck(this, AssetManagerBase); + this.pathPrefix = null; + this.assets = {}; + this.errors = {}; + this.toLoad = 0; + this.loaded = 0; + this.textureLoader = textureLoader; + this.pathPrefix = pathPrefix; + this.downloader = downloader || new Downloader(); + } + _createClass(AssetManagerBase, [{ + key: "start", + value: function start(path) { + this.toLoad++; + return this.pathPrefix + path; + } + }, { + key: "success", + value: function success(callback, path, asset) { + this.toLoad--; + this.loaded++; + this.assets[path] = asset; + if (callback) callback(path, asset); + } + }, { + key: "error", + value: function error(callback, path, message) { + this.toLoad--; + this.loaded++; + this.errors[path] = message; + if (callback) callback(path, message); + } + }, { + key: "loadAll", + value: function loadAll() { + var _this = this; + var promise = new Promise(function (resolve, reject) { + var check = function check() { + if (_this.isLoadingComplete()) { + if (_this.hasErrors()) reject(_this.errors);else resolve(_this); + return; + } + requestAnimationFrame(check); + }; + requestAnimationFrame(check); + }); + return promise; + } + }, { + key: "setRawDataURI", + value: function setRawDataURI(path, data) { + this.downloader.rawDataUris[this.pathPrefix + path] = data; + } + }, { + key: "loadBinary", + value: function loadBinary(path) { + var _this2 = this; + var success = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + path = this.start(path); + this.downloader.downloadBinary(path, function (data) { + _this2.success(success, path, data); + }, function (status, responseText) { + _this2.error(error, path, "Couldn't load binary ".concat(path, ": status ").concat(status, ", ").concat(responseText)); + }); + } + }, { + key: "loadText", + value: function loadText(path) { + var _this3 = this; + var success = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + path = this.start(path); + this.downloader.downloadText(path, function (data) { + _this3.success(success, path, data); + }, function (status, responseText) { + _this3.error(error, path, "Couldn't load text ".concat(path, ": status ").concat(status, ", ").concat(responseText)); + }); + } + }, { + key: "loadJson", + value: function loadJson(path) { + var _this4 = this; + var success = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + path = this.start(path); + this.downloader.downloadJson(path, function (data) { + _this4.success(success, path, data); + }, function (status, responseText) { + _this4.error(error, path, "Couldn't load JSON ".concat(path, ": status ").concat(status, ", ").concat(responseText)); + }); + } + }, { + key: "loadTexture", + value: function loadTexture(path) { + var _this5 = this; + var success = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + path = this.start(path); + var isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document); + var isWebWorker = !isBrowser; + if (isWebWorker) { + fetch(path, { + mode: "cors" + }).then(function (response) { + if (response.ok) return response.blob(); + _this5.error(error, path, "Couldn't load image: ".concat(path)); + return null; + }).then(function (blob) { + return blob ? createImageBitmap(blob, { + premultiplyAlpha: "none", + colorSpaceConversion: "none" + }) : null; + }).then(function (bitmap) { + if (bitmap) _this5.success(success, path, _this5.textureLoader(bitmap)); + }); + } else { + var image = new Image(); + image.crossOrigin = "anonymous"; + image.onload = function () { + _this5.success(success, path, _this5.textureLoader(image)); + }; + image.onerror = function () { + _this5.error(error, path, "Couldn't load image: ".concat(path)); + }; + if (this.downloader.rawDataUris[path]) path = this.downloader.rawDataUris[path]; + image.src = path; + } + } + }, { + key: "loadTextureAtlas", + value: function loadTextureAtlas(path) { + var _this6 = this; + var success = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + var fileAlias = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; + var index = path.lastIndexOf("/"); + var parent = index >= 0 ? path.substring(0, index + 1) : ""; + path = this.start(path); + this.downloader.downloadText(path, function (atlasText) { + try { + var atlas = new TextureAtlas(atlasText); + var toLoad = atlas.pages.length, + abort = false; + var _iterator = _createForOfIteratorHelper(atlas.pages), + _step; + try { + var _loop = function _loop() { + var page = _step.value; + _this6.loadTexture(fileAlias == null ? parent + page.name : fileAlias[page.name], function (imagePath, texture) { + if (!abort) { + page.setTexture(texture); + if (--toLoad == 0) _this6.success(success, path, atlas); + } + }, function (imagePath, message) { + if (!abort) _this6.error(error, path, "Couldn't load texture atlas ".concat(path, " page image: ").concat(imagePath)); + abort = true; + }); + }; + for (_iterator.s(); !(_step = _iterator.n()).done;) { + _loop(); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } catch (e) { + _this6.error(error, path, "Couldn't parse texture atlas ".concat(path, ": ").concat(e.message)); + } + }, function (status, responseText) { + _this6.error(error, path, "Couldn't load texture atlas ".concat(path, ": status ").concat(status, ", ").concat(responseText)); + }); + } + }, { + key: "get", + value: function get(path) { + return this.assets[this.pathPrefix + path]; + } + }, { + key: "require", + value: function require(path) { + path = this.pathPrefix + path; + var asset = this.assets[path]; + if (asset) return asset; + var error = this.errors[path]; + throw Error("Asset not found: " + path + (error ? "\n" + error : "")); + } + }, { + key: "remove", + value: function remove(path) { + path = this.pathPrefix + path; + var asset = this.assets[path]; + if (asset.dispose) asset.dispose(); + delete this.assets[path]; + return asset; + } + }, { + key: "removeAll", + value: function removeAll() { + for (var key in this.assets) { + var asset = this.assets[key]; + if (asset.dispose) asset.dispose(); + } + this.assets = {}; + } + }, { + key: "isLoadingComplete", + value: function isLoadingComplete() { + return this.toLoad == 0; + } + }, { + key: "getToLoad", + value: function getToLoad() { + return this.toLoad; + } + }, { + key: "getLoaded", + value: function getLoaded() { + return this.loaded; + } + }, { + key: "dispose", + value: function dispose() { + this.removeAll(); + } + }, { + key: "hasErrors", + value: function hasErrors() { + return Object.keys(this.errors).length > 0; + } + }, { + key: "getErrors", + value: function getErrors() { + return this.errors; + } + }]); + return AssetManagerBase; + }(); + var Downloader = function () { + function Downloader() { + _classCallCheck(this, Downloader); + this.callbacks = {}; + this.rawDataUris = {}; + } + _createClass(Downloader, [{ + key: "dataUriToString", + value: function dataUriToString(dataUri) { + if (!dataUri.startsWith("data:")) { + throw new Error("Not a data URI."); + } + var base64Idx = dataUri.indexOf("base64,"); + if (base64Idx != -1) { + base64Idx += "base64,".length; + return atob(dataUri.substr(base64Idx)); + } else { + return dataUri.substr(dataUri.indexOf(",") + 1); + } + } + }, { + key: "base64ToUint8Array", + value: function base64ToUint8Array(base64) { + var binary_string = window.atob(base64); + var len = binary_string.length; + var bytes = new Uint8Array(len); + for (var i = 0; i < len; i++) { + bytes[i] = binary_string.charCodeAt(i); + } + return bytes; + } + }, { + key: "dataUriToUint8Array", + value: function dataUriToUint8Array(dataUri) { + if (!dataUri.startsWith("data:")) { + throw new Error("Not a data URI."); + } + var base64Idx = dataUri.indexOf("base64,"); + if (base64Idx == -1) throw new Error("Not a binary data URI."); + base64Idx += "base64,".length; + return this.base64ToUint8Array(dataUri.substr(base64Idx)); + } + }, { + key: "downloadText", + value: function downloadText(url, success, error) { + var _this7 = this; + if (this.start(url, success, error)) return; + if (this.rawDataUris[url]) { + try { + var dataUri = this.rawDataUris[url]; + this.finish(url, 200, this.dataUriToString(dataUri)); + } catch (e) { + this.finish(url, 400, JSON.stringify(e)); + } + return; + } + var request = new XMLHttpRequest(); + request.overrideMimeType("text/html"); + request.open("GET", url, true); + var done = function done() { + _this7.finish(url, request.status, request.responseText); + }; + request.onload = done; + request.onerror = done; + request.send(); + } + }, { + key: "downloadJson", + value: function downloadJson(url, success, error) { + this.downloadText(url, function (data) { + success(JSON.parse(data)); + }, error); + } + }, { + key: "downloadBinary", + value: function downloadBinary(url, success, error) { + var _this8 = this; + if (this.start(url, success, error)) return; + if (this.rawDataUris[url]) { + try { + var dataUri = this.rawDataUris[url]; + this.finish(url, 200, this.dataUriToUint8Array(dataUri)); + } catch (e) { + this.finish(url, 400, JSON.stringify(e)); + } + return; + } + var request = new XMLHttpRequest(); + request.open("GET", url, true); + request.responseType = "arraybuffer"; + var onerror = function onerror() { + _this8.finish(url, request.status, request.response); + }; + request.onload = function () { + if (request.status == 200 || request.status == 0) _this8.finish(url, 200, new Uint8Array(request.response));else onerror(); + }; + request.onerror = onerror; + request.send(); + } + }, { + key: "start", + value: function start(url, success, error) { + var callbacks = this.callbacks[url]; + try { + if (callbacks) return true; + this.callbacks[url] = callbacks = []; + } finally { + callbacks.push(success, error); + } + } + }, { + key: "finish", + value: function finish(url, status, data) { + var callbacks = this.callbacks[url]; + delete this.callbacks[url]; + var args = status == 200 || status == 0 ? [data] : [status, data]; + for (var i = args.length - 1, n = callbacks.length; i < n; i += 2) callbacks[i].apply(null, args); + } + }]); + return Downloader; + }(); + + var Event = _createClass(function Event(time, data) { + _classCallCheck(this, Event); + this.data = null; + this.intValue = 0; + this.floatValue = 0; + this.stringValue = null; + this.time = 0; + this.volume = 0; + this.balance = 0; + if (!data) throw new Error("data cannot be null."); + this.time = time; + this.data = data; + }); + + var EventData = _createClass(function EventData(name) { + _classCallCheck(this, EventData); + this.name = null; + this.intValue = 0; + this.floatValue = 0; + this.stringValue = null; + this.audioPath = null; + this.volume = 0; + this.balance = 0; + this.name = name; + }); + + var IkConstraint = function () { + function IkConstraint(data, skeleton) { + _classCallCheck(this, IkConstraint); + this.data = null; + this.bones = null; + this.target = null; + this.bendDirection = 0; + this.compress = false; + this.stretch = false; + this.mix = 1; + this.softness = 0; + this.active = false; + if (!data) throw new Error("data cannot be null."); + if (!skeleton) throw new Error("skeleton cannot be null."); + this.data = data; + this.mix = data.mix; + this.softness = data.softness; + this.bendDirection = data.bendDirection; + this.compress = data.compress; + this.stretch = data.stretch; + this.bones = new Array(); + for (var i = 0; i < data.bones.length; i++) this.bones.push(skeleton.findBone(data.bones[i].name)); + this.target = skeleton.findBone(data.target.name); + } + _createClass(IkConstraint, [{ + key: "isActive", + value: function isActive() { + return this.active; + } + }, { + key: "update", + value: function update() { + if (this.mix == 0) return; + var target = this.target; + var bones = this.bones; + switch (bones.length) { + case 1: + this.apply1(bones[0], target.worldX, target.worldY, this.compress, this.stretch, this.data.uniform, this.mix); + break; + case 2: + this.apply2(bones[0], bones[1], target.worldX, target.worldY, this.bendDirection, this.stretch, this.data.uniform, this.softness, this.mix); + break; + } + } + }, { + key: "apply1", + value: function apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) { + var p = bone.parent; + var pa = p.a, + pb = p.b, + pc = p.c, + pd = p.d; + var rotationIK = -bone.ashearX - bone.arotation, + tx = 0, + ty = 0; + switch (bone.data.transformMode) { + case TransformMode.OnlyTranslation: + tx = targetX - bone.worldX; + ty = targetY - bone.worldY; + break; + case TransformMode.NoRotationOrReflection: + var s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc); + var sa = pa / bone.skeleton.scaleX; + var sc = pc / bone.skeleton.scaleY; + pb = -sc * s * bone.skeleton.scaleX; + pd = sa * s * bone.skeleton.scaleY; + rotationIK += Math.atan2(sc, sa) * MathUtils.radDeg; + default: + var x = targetX - p.worldX, + y = targetY - p.worldY; + var d = pa * pd - pb * pc; + tx = (x * pd - y * pb) / d - bone.ax; + ty = (y * pa - x * pc) / d - bone.ay; + } + rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg; + if (bone.ascaleX < 0) rotationIK += 180; + if (rotationIK > 180) rotationIK -= 360;else if (rotationIK < -180) rotationIK += 360; + var sx = bone.ascaleX, + sy = bone.ascaleY; + if (compress || stretch) { + switch (bone.data.transformMode) { + case TransformMode.NoScale: + case TransformMode.NoScaleOrReflection: + tx = targetX - bone.worldX; + ty = targetY - bone.worldY; + } + var b = bone.data.length * sx, + dd = Math.sqrt(tx * tx + ty * ty); + if (compress && dd < b || stretch && dd > b && b > 0.0001) { + var _s = (dd / b - 1) * alpha + 1; + sx *= _s; + if (uniform) sy *= _s; + } + } + bone.updateWorldTransformWith(bone.ax, bone.ay, bone.arotation + rotationIK * alpha, sx, sy, bone.ashearX, bone.ashearY); + } + }, { + key: "apply2", + value: function apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) { + var px = parent.ax, + py = parent.ay, + psx = parent.ascaleX, + psy = parent.ascaleY, + sx = psx, + sy = psy, + csx = child.ascaleX; + var os1 = 0, + os2 = 0, + s2 = 0; + if (psx < 0) { + psx = -psx; + os1 = 180; + s2 = -1; + } else { + os1 = 0; + s2 = 1; + } + if (psy < 0) { + psy = -psy; + s2 = -s2; + } + if (csx < 0) { + csx = -csx; + os2 = 180; + } else os2 = 0; + var cx = child.ax, + cy = 0, + cwx = 0, + cwy = 0, + a = parent.a, + b = parent.b, + c = parent.c, + d = parent.d; + var u = Math.abs(psx - psy) <= 0.0001; + if (!u || stretch) { + cy = 0; + cwx = a * cx + parent.worldX; + cwy = c * cx + parent.worldY; + } else { + cy = child.ay; + cwx = a * cx + b * cy + parent.worldX; + cwy = c * cx + d * cy + parent.worldY; + } + var pp = parent.parent; + a = pp.a; + b = pp.b; + c = pp.c; + d = pp.d; + var id = 1 / (a * d - b * c), + x = cwx - pp.worldX, + y = cwy - pp.worldY; + var dx = (x * d - y * b) * id - px, + dy = (y * a - x * c) * id - py; + var l1 = Math.sqrt(dx * dx + dy * dy), + l2 = child.data.length * csx, + a1, + a2; + if (l1 < 0.0001) { + this.apply1(parent, targetX, targetY, false, stretch, false, alpha); + child.updateWorldTransformWith(cx, cy, 0, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY); + return; + } + x = targetX - pp.worldX; + y = targetY - pp.worldY; + var tx = (x * d - y * b) * id - px, + ty = (y * a - x * c) * id - py; + var dd = tx * tx + ty * ty; + if (softness != 0) { + softness *= psx * (csx + 1) * 0.5; + var td = Math.sqrt(dd), + sd = td - l1 - l2 * psx + softness; + if (sd > 0) { + var p = Math.min(1, sd / (softness * 2)) - 1; + p = (sd - softness * (1 - p * p)) / td; + tx -= p * tx; + ty -= p * ty; + dd = tx * tx + ty * ty; + } + } + outer: if (u) { + l2 *= psx; + var cos = (dd - l1 * l1 - l2 * l2) / (2 * l1 * l2); + if (cos < -1) { + cos = -1; + a2 = Math.PI * bendDir; + } else if (cos > 1) { + cos = 1; + a2 = 0; + if (stretch) { + a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1; + sx *= a; + if (uniform) sy *= a; + } + } else a2 = Math.acos(cos) * bendDir; + a = l1 + l2 * cos; + b = l2 * Math.sin(a2); + a1 = Math.atan2(ty * a - tx * b, tx * a + ty * b); + } else { + a = psx * l2; + b = psy * l2; + var aa = a * a, + bb = b * b, + ta = Math.atan2(ty, tx); + c = bb * l1 * l1 + aa * dd - aa * bb; + var c1 = -2 * bb * l1, + c2 = bb - aa; + d = c1 * c1 - 4 * c2 * c; + if (d >= 0) { + var q = Math.sqrt(d); + if (c1 < 0) q = -q; + q = -(c1 + q) * 0.5; + var r0 = q / c2, + r1 = c / q; + var r = Math.abs(r0) < Math.abs(r1) ? r0 : r1; + if (r * r <= dd) { + y = Math.sqrt(dd - r * r) * bendDir; + a1 = ta - Math.atan2(y, r); + a2 = Math.atan2(y / psy, (r - l1) / psx); + break outer; + } + } + var minAngle = MathUtils.PI, + minX = l1 - a, + minDist = minX * minX, + minY = 0; + var maxAngle = 0, + maxX = l1 + a, + maxDist = maxX * maxX, + maxY = 0; + c = -a * l1 / (aa - bb); + if (c >= -1 && c <= 1) { + c = Math.acos(c); + x = a * Math.cos(c) + l1; + y = b * Math.sin(c); + d = x * x + y * y; + if (d < minDist) { + minAngle = c; + minDist = d; + minX = x; + minY = y; + } + if (d > maxDist) { + maxAngle = c; + maxDist = d; + maxX = x; + maxY = y; + } + } + if (dd <= (minDist + maxDist) * 0.5) { + a1 = ta - Math.atan2(minY * bendDir, minX); + a2 = minAngle * bendDir; + } else { + a1 = ta - Math.atan2(maxY * bendDir, maxX); + a2 = maxAngle * bendDir; + } + } + var os = Math.atan2(cy, cx) * s2; + var rotation = parent.arotation; + a1 = (a1 - os) * MathUtils.radDeg + os1 - rotation; + if (a1 > 180) a1 -= 360;else if (a1 < -180) a1 += 360; + parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, sy, 0, 0); + rotation = child.arotation; + a2 = ((a2 + os) * MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation; + if (a2 > 180) a2 -= 360;else if (a2 < -180) a2 += 360; + child.updateWorldTransformWith(cx, cy, rotation + a2 * alpha, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY); + } + }]); + return IkConstraint; + }(); + + var IkConstraintData = function (_ConstraintData) { + _inherits(IkConstraintData, _ConstraintData); + var _super = _createSuper(IkConstraintData); + function IkConstraintData(name) { + var _this; + _classCallCheck(this, IkConstraintData); + _this = _super.call(this, name, 0, false); + _this.bones = new Array(); + _this.target = null; + _this.bendDirection = 1; + _this.compress = false; + _this.stretch = false; + _this.uniform = false; + _this.mix = 1; + _this.softness = 0; + return _this; + } + return _createClass(IkConstraintData); + }(ConstraintData); + + var PathConstraintData = function (_ConstraintData) { + _inherits(PathConstraintData, _ConstraintData); + var _super = _createSuper(PathConstraintData); + function PathConstraintData(name) { + var _this; + _classCallCheck(this, PathConstraintData); + _this = _super.call(this, name, 0, false); + _this.bones = new Array(); + _this.target = null; + _this.positionMode = null; + _this.spacingMode = null; + _this.rotateMode = null; + _this.offsetRotation = 0; + _this.position = 0; + _this.spacing = 0; + _this.mixRotate = 0; + _this.mixX = 0; + _this.mixY = 0; + return _this; + } + return _createClass(PathConstraintData); + }(ConstraintData); + var PositionMode; + (function (PositionMode) { + PositionMode[PositionMode["Fixed"] = 0] = "Fixed"; + PositionMode[PositionMode["Percent"] = 1] = "Percent"; + })(PositionMode || (PositionMode = {})); + var SpacingMode; + (function (SpacingMode) { + SpacingMode[SpacingMode["Length"] = 0] = "Length"; + SpacingMode[SpacingMode["Fixed"] = 1] = "Fixed"; + SpacingMode[SpacingMode["Percent"] = 2] = "Percent"; + SpacingMode[SpacingMode["Proportional"] = 3] = "Proportional"; + })(SpacingMode || (SpacingMode = {})); + var RotateMode; + (function (RotateMode) { + RotateMode[RotateMode["Tangent"] = 0] = "Tangent"; + RotateMode[RotateMode["Chain"] = 1] = "Chain"; + RotateMode[RotateMode["ChainScale"] = 2] = "ChainScale"; + })(RotateMode || (RotateMode = {})); + + var PathConstraint = function () { + function PathConstraint(data, skeleton) { + _classCallCheck(this, PathConstraint); + this.data = null; + this.bones = null; + this.target = null; + this.position = 0; + this.spacing = 0; + this.mixRotate = 0; + this.mixX = 0; + this.mixY = 0; + this.spaces = new Array(); + this.positions = new Array(); + this.world = new Array(); + this.curves = new Array(); + this.lengths = new Array(); + this.segments = new Array(); + this.active = false; + if (!data) throw new Error("data cannot be null."); + if (!skeleton) throw new Error("skeleton cannot be null."); + this.data = data; + this.bones = new Array(); + for (var i = 0, n = data.bones.length; i < n; i++) this.bones.push(skeleton.findBone(data.bones[i].name)); + this.target = skeleton.findSlot(data.target.name); + this.position = data.position; + this.spacing = data.spacing; + this.mixRotate = data.mixRotate; + this.mixX = data.mixX; + this.mixY = data.mixY; + } + _createClass(PathConstraint, [{ + key: "isActive", + value: function isActive() { + return this.active; + } + }, { + key: "update", + value: function update() { + var attachment = this.target.getAttachment(); + if (!(attachment instanceof PathAttachment)) return; + var mixRotate = this.mixRotate, + mixX = this.mixX, + mixY = this.mixY; + if (mixRotate == 0 && mixX == 0 && mixY == 0) return; + var data = this.data; + var tangents = data.rotateMode == RotateMode.Tangent, + scale = data.rotateMode == RotateMode.ChainScale; + var bones = this.bones; + var boneCount = bones.length, + spacesCount = tangents ? boneCount : boneCount + 1; + var spaces = Utils.setArraySize(this.spaces, spacesCount), + lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : null; + var spacing = this.spacing; + switch (data.spacingMode) { + case SpacingMode.Percent: + if (scale) { + for (var i = 0, n = spacesCount - 1; i < n; i++) { + var bone = bones[i]; + var setupLength = bone.data.length; + if (setupLength < PathConstraint.epsilon) lengths[i] = 0;else { + var x = setupLength * bone.a, + y = setupLength * bone.c; + lengths[i] = Math.sqrt(x * x + y * y); + } + } + } + Utils.arrayFill(spaces, 1, spacesCount, spacing); + break; + case SpacingMode.Proportional: + var sum = 0; + for (var _i = 0, _n = spacesCount - 1; _i < _n;) { + var _bone = bones[_i]; + var _setupLength = _bone.data.length; + if (_setupLength < PathConstraint.epsilon) { + if (scale) lengths[_i] = 0; + spaces[++_i] = spacing; + } else { + var _x = _setupLength * _bone.a, + _y = _setupLength * _bone.c; + var length = Math.sqrt(_x * _x + _y * _y); + if (scale) lengths[_i] = length; + spaces[++_i] = length; + sum += length; + } + } + if (sum > 0) { + sum = spacesCount / sum * spacing; + for (var _i2 = 1; _i2 < spacesCount; _i2++) spaces[_i2] *= sum; + } + break; + default: + var lengthSpacing = data.spacingMode == SpacingMode.Length; + for (var _i3 = 0, _n2 = spacesCount - 1; _i3 < _n2;) { + var _bone2 = bones[_i3]; + var _setupLength2 = _bone2.data.length; + if (_setupLength2 < PathConstraint.epsilon) { + if (scale) lengths[_i3] = 0; + spaces[++_i3] = spacing; + } else { + var _x2 = _setupLength2 * _bone2.a, + _y2 = _setupLength2 * _bone2.c; + var _length = Math.sqrt(_x2 * _x2 + _y2 * _y2); + if (scale) lengths[_i3] = _length; + spaces[++_i3] = (lengthSpacing ? _setupLength2 + spacing : spacing) * _length / _setupLength2; + } + } + } + var positions = this.computeWorldPositions(attachment, spacesCount, tangents); + var boneX = positions[0], + boneY = positions[1], + offsetRotation = data.offsetRotation; + var tip = false; + if (offsetRotation == 0) tip = data.rotateMode == RotateMode.Chain;else { + tip = false; + var p = this.target.bone; + offsetRotation *= p.a * p.d - p.b * p.c > 0 ? MathUtils.degRad : -MathUtils.degRad; + } + for (var _i4 = 0, _p = 3; _i4 < boneCount; _i4++, _p += 3) { + var _bone3 = bones[_i4]; + _bone3.worldX += (boneX - _bone3.worldX) * mixX; + _bone3.worldY += (boneY - _bone3.worldY) * mixY; + var _x3 = positions[_p], + _y3 = positions[_p + 1], + dx = _x3 - boneX, + dy = _y3 - boneY; + if (scale) { + var _length2 = lengths[_i4]; + if (_length2 != 0) { + var s = (Math.sqrt(dx * dx + dy * dy) / _length2 - 1) * mixRotate + 1; + _bone3.a *= s; + _bone3.c *= s; + } + } + boneX = _x3; + boneY = _y3; + if (mixRotate > 0) { + var a = _bone3.a, + b = _bone3.b, + c = _bone3.c, + d = _bone3.d, + r = 0, + cos = 0, + sin = 0; + if (tangents) r = positions[_p - 1];else if (spaces[_i4 + 1] == 0) r = positions[_p + 2];else r = Math.atan2(dy, dx); + r -= Math.atan2(c, a); + if (tip) { + cos = Math.cos(r); + sin = Math.sin(r); + var _length3 = _bone3.data.length; + boneX += (_length3 * (cos * a - sin * c) - dx) * mixRotate; + boneY += (_length3 * (sin * a + cos * c) - dy) * mixRotate; + } else { + r += offsetRotation; + } + if (r > MathUtils.PI) r -= MathUtils.PI2;else if (r < -MathUtils.PI) r += MathUtils.PI2; + r *= mixRotate; + cos = Math.cos(r); + sin = Math.sin(r); + _bone3.a = cos * a - sin * c; + _bone3.b = cos * b - sin * d; + _bone3.c = sin * a + cos * c; + _bone3.d = sin * b + cos * d; + } + _bone3.updateAppliedTransform(); + } + } + }, { + key: "computeWorldPositions", + value: function computeWorldPositions(path, spacesCount, tangents) { + var target = this.target; + var position = this.position; + var spaces = this.spaces, + out = Utils.setArraySize(this.positions, spacesCount * 3 + 2), + world = null; + var closed = path.closed; + var verticesLength = path.worldVerticesLength, + curveCount = verticesLength / 6, + prevCurve = PathConstraint.NONE; + if (!path.constantSpeed) { + var lengths = path.lengths; + curveCount -= closed ? 1 : 2; + var _pathLength = lengths[curveCount]; + if (this.data.positionMode == PositionMode.Percent) position *= _pathLength; + var _multiplier; + switch (this.data.spacingMode) { + case SpacingMode.Percent: + _multiplier = _pathLength; + break; + case SpacingMode.Proportional: + _multiplier = _pathLength / spacesCount; + break; + default: + _multiplier = 1; + } + world = Utils.setArraySize(this.world, 8); + for (var i = 0, o = 0, curve = 0; i < spacesCount; i++, o += 3) { + var space = spaces[i] * _multiplier; + position += space; + var p = position; + if (closed) { + p %= _pathLength; + if (p < 0) p += _pathLength; + curve = 0; + } else if (p < 0) { + if (prevCurve != PathConstraint.BEFORE) { + prevCurve = PathConstraint.BEFORE; + path.computeWorldVertices(target, 2, 4, world, 0, 2); + } + this.addBeforePosition(p, world, 0, out, o); + continue; + } else if (p > _pathLength) { + if (prevCurve != PathConstraint.AFTER) { + prevCurve = PathConstraint.AFTER; + path.computeWorldVertices(target, verticesLength - 6, 4, world, 0, 2); + } + this.addAfterPosition(p - _pathLength, world, 0, out, o); + continue; + } + for (;; curve++) { + var length = lengths[curve]; + if (p > length) continue; + if (curve == 0) p /= length;else { + var prev = lengths[curve - 1]; + p = (p - prev) / (length - prev); + } + break; + } + if (curve != prevCurve) { + prevCurve = curve; + if (closed && curve == curveCount) { + path.computeWorldVertices(target, verticesLength - 4, 4, world, 0, 2); + path.computeWorldVertices(target, 0, 4, world, 4, 2); + } else path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2); + } + this.addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o, tangents || i > 0 && space == 0); + } + return out; + } + if (closed) { + verticesLength += 2; + world = Utils.setArraySize(this.world, verticesLength); + path.computeWorldVertices(target, 2, verticesLength - 4, world, 0, 2); + path.computeWorldVertices(target, 0, 2, world, verticesLength - 4, 2); + world[verticesLength - 2] = world[0]; + world[verticesLength - 1] = world[1]; + } else { + curveCount--; + verticesLength -= 4; + world = Utils.setArraySize(this.world, verticesLength); + path.computeWorldVertices(target, 2, verticesLength, world, 0, 2); + } + var curves = Utils.setArraySize(this.curves, curveCount); + var pathLength = 0; + var x1 = world[0], + y1 = world[1], + cx1 = 0, + cy1 = 0, + cx2 = 0, + cy2 = 0, + x2 = 0, + y2 = 0; + var tmpx = 0, + tmpy = 0, + dddfx = 0, + dddfy = 0, + ddfx = 0, + ddfy = 0, + dfx = 0, + dfy = 0; + for (var _i5 = 0, w = 2; _i5 < curveCount; _i5++, w += 6) { + cx1 = world[w]; + cy1 = world[w + 1]; + cx2 = world[w + 2]; + cy2 = world[w + 3]; + x2 = world[w + 4]; + y2 = world[w + 5]; + tmpx = (x1 - cx1 * 2 + cx2) * 0.1875; + tmpy = (y1 - cy1 * 2 + cy2) * 0.1875; + dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.09375; + dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.09375; + ddfx = tmpx * 2 + dddfx; + ddfy = tmpy * 2 + dddfy; + dfx = (cx1 - x1) * 0.75 + tmpx + dddfx * 0.16666667; + dfy = (cy1 - y1) * 0.75 + tmpy + dddfy * 0.16666667; + pathLength += Math.sqrt(dfx * dfx + dfy * dfy); + dfx += ddfx; + dfy += ddfy; + ddfx += dddfx; + ddfy += dddfy; + pathLength += Math.sqrt(dfx * dfx + dfy * dfy); + dfx += ddfx; + dfy += ddfy; + pathLength += Math.sqrt(dfx * dfx + dfy * dfy); + dfx += ddfx + dddfx; + dfy += ddfy + dddfy; + pathLength += Math.sqrt(dfx * dfx + dfy * dfy); + curves[_i5] = pathLength; + x1 = x2; + y1 = y2; + } + if (this.data.positionMode == PositionMode.Percent) position *= pathLength; + var multiplier; + switch (this.data.spacingMode) { + case SpacingMode.Percent: + multiplier = pathLength; + break; + case SpacingMode.Proportional: + multiplier = pathLength / spacesCount; + break; + default: + multiplier = 1; + } + var segments = this.segments; + var curveLength = 0; + for (var _i6 = 0, _o = 0, _curve = 0, segment = 0; _i6 < spacesCount; _i6++, _o += 3) { + var _space = spaces[_i6] * multiplier; + position += _space; + var _p2 = position; + if (closed) { + _p2 %= pathLength; + if (_p2 < 0) _p2 += pathLength; + _curve = 0; + } else if (_p2 < 0) { + this.addBeforePosition(_p2, world, 0, out, _o); + continue; + } else if (_p2 > pathLength) { + this.addAfterPosition(_p2 - pathLength, world, verticesLength - 4, out, _o); + continue; + } + for (;; _curve++) { + var _length4 = curves[_curve]; + if (_p2 > _length4) continue; + if (_curve == 0) _p2 /= _length4;else { + var _prev = curves[_curve - 1]; + _p2 = (_p2 - _prev) / (_length4 - _prev); + } + break; + } + if (_curve != prevCurve) { + prevCurve = _curve; + var ii = _curve * 6; + x1 = world[ii]; + y1 = world[ii + 1]; + cx1 = world[ii + 2]; + cy1 = world[ii + 3]; + cx2 = world[ii + 4]; + cy2 = world[ii + 5]; + x2 = world[ii + 6]; + y2 = world[ii + 7]; + tmpx = (x1 - cx1 * 2 + cx2) * 0.03; + tmpy = (y1 - cy1 * 2 + cy2) * 0.03; + dddfx = ((cx1 - cx2) * 3 - x1 + x2) * 0.006; + dddfy = ((cy1 - cy2) * 3 - y1 + y2) * 0.006; + ddfx = tmpx * 2 + dddfx; + ddfy = tmpy * 2 + dddfy; + dfx = (cx1 - x1) * 0.3 + tmpx + dddfx * 0.16666667; + dfy = (cy1 - y1) * 0.3 + tmpy + dddfy * 0.16666667; + curveLength = Math.sqrt(dfx * dfx + dfy * dfy); + segments[0] = curveLength; + for (ii = 1; ii < 8; ii++) { + dfx += ddfx; + dfy += ddfy; + ddfx += dddfx; + ddfy += dddfy; + curveLength += Math.sqrt(dfx * dfx + dfy * dfy); + segments[ii] = curveLength; + } + dfx += ddfx; + dfy += ddfy; + curveLength += Math.sqrt(dfx * dfx + dfy * dfy); + segments[8] = curveLength; + dfx += ddfx + dddfx; + dfy += ddfy + dddfy; + curveLength += Math.sqrt(dfx * dfx + dfy * dfy); + segments[9] = curveLength; + segment = 0; + } + _p2 *= curveLength; + for (;; segment++) { + var _length5 = segments[segment]; + if (_p2 > _length5) continue; + if (segment == 0) _p2 /= _length5;else { + var _prev2 = segments[segment - 1]; + _p2 = segment + (_p2 - _prev2) / (_length5 - _prev2); + } + break; + } + this.addCurvePosition(_p2 * 0.1, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, _o, tangents || _i6 > 0 && _space == 0); + } + return out; + } + }, { + key: "addBeforePosition", + value: function addBeforePosition(p, temp, i, out, o) { + var x1 = temp[i], + y1 = temp[i + 1], + dx = temp[i + 2] - x1, + dy = temp[i + 3] - y1, + r = Math.atan2(dy, dx); + out[o] = x1 + p * Math.cos(r); + out[o + 1] = y1 + p * Math.sin(r); + out[o + 2] = r; + } + }, { + key: "addAfterPosition", + value: function addAfterPosition(p, temp, i, out, o) { + var x1 = temp[i + 2], + y1 = temp[i + 3], + dx = x1 - temp[i], + dy = y1 - temp[i + 1], + r = Math.atan2(dy, dx); + out[o] = x1 + p * Math.cos(r); + out[o + 1] = y1 + p * Math.sin(r); + out[o + 2] = r; + } + }, { + key: "addCurvePosition", + value: function addCurvePosition(p, x1, y1, cx1, cy1, cx2, cy2, x2, y2, out, o, tangents) { + if (p == 0 || isNaN(p)) { + out[o] = x1; + out[o + 1] = y1; + out[o + 2] = Math.atan2(cy1 - y1, cx1 - x1); + return; + } + var tt = p * p, + ttt = tt * p, + u = 1 - p, + uu = u * u, + uuu = uu * u; + var ut = u * p, + ut3 = ut * 3, + uut3 = u * ut3, + utt3 = ut3 * p; + var x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, + y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt; + out[o] = x; + out[o + 1] = y; + if (tangents) { + if (p < 0.001) out[o + 2] = Math.atan2(cy1 - y1, cx1 - x1);else out[o + 2] = Math.atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt)); + } + } + }]); + return PathConstraint; + }(); + PathConstraint.NONE = -1; + PathConstraint.BEFORE = -2; + PathConstraint.AFTER = -3; + PathConstraint.epsilon = 0.00001; + + var Slot = function () { + function Slot(data, bone) { + _classCallCheck(this, Slot); + this.data = null; + this.bone = null; + this.color = null; + this.darkColor = null; + this.attachment = null; + this.attachmentTime = 0; + this.attachmentState = 0; + this.deform = new Array(); + if (!data) throw new Error("data cannot be null."); + if (!bone) throw new Error("bone cannot be null."); + this.data = data; + this.bone = bone; + this.color = new Color(); + this.darkColor = !data.darkColor ? null : new Color(); + this.setToSetupPose(); + } + _createClass(Slot, [{ + key: "getSkeleton", + value: function getSkeleton() { + return this.bone.skeleton; + } + }, { + key: "getAttachment", + value: function getAttachment() { + return this.attachment; + } + }, { + key: "setAttachment", + value: function setAttachment(attachment) { + if (this.attachment == attachment) return; + if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.deformAttachment != this.attachment.deformAttachment) { + this.deform.length = 0; + } + this.attachment = attachment; + this.attachmentTime = this.bone.skeleton.time; + } + }, { + key: "setAttachmentTime", + value: function setAttachmentTime(time) { + this.attachmentTime = this.bone.skeleton.time - time; + } + }, { + key: "getAttachmentTime", + value: function getAttachmentTime() { + return this.bone.skeleton.time - this.attachmentTime; + } + }, { + key: "setToSetupPose", + value: function setToSetupPose() { + this.color.setFromColor(this.data.color); + if (this.darkColor) this.darkColor.setFromColor(this.data.darkColor); + if (!this.data.attachmentName) this.attachment = null;else { + this.attachment = null; + this.setAttachment(this.bone.skeleton.getAttachment(this.data.index, this.data.attachmentName)); + } + } + }]); + return Slot; + }(); + + var TransformConstraint = function () { + function TransformConstraint(data, skeleton) { + _classCallCheck(this, TransformConstraint); + this.data = null; + this.bones = null; + this.target = null; + this.mixRotate = 0; + this.mixX = 0; + this.mixY = 0; + this.mixScaleX = 0; + this.mixScaleY = 0; + this.mixShearY = 0; + this.temp = new Vector2(); + this.active = false; + if (!data) throw new Error("data cannot be null."); + if (!skeleton) throw new Error("skeleton cannot be null."); + this.data = data; + this.mixRotate = data.mixRotate; + this.mixX = data.mixX; + this.mixY = data.mixY; + this.mixScaleX = data.mixScaleX; + this.mixScaleY = data.mixScaleY; + this.mixShearY = data.mixShearY; + this.bones = new Array(); + for (var i = 0; i < data.bones.length; i++) this.bones.push(skeleton.findBone(data.bones[i].name)); + this.target = skeleton.findBone(data.target.name); + } + _createClass(TransformConstraint, [{ + key: "isActive", + value: function isActive() { + return this.active; + } + }, { + key: "update", + value: function update() { + if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleX == 0 && this.mixShearY == 0) return; + if (this.data.local) { + if (this.data.relative) this.applyRelativeLocal();else this.applyAbsoluteLocal(); + } else { + if (this.data.relative) this.applyRelativeWorld();else this.applyAbsoluteWorld(); + } + } + }, { + key: "applyAbsoluteWorld", + value: function applyAbsoluteWorld() { + var mixRotate = this.mixRotate, + mixX = this.mixX, + mixY = this.mixY, + mixScaleX = this.mixScaleX, + mixScaleY = this.mixScaleY, + mixShearY = this.mixShearY; + var translate = mixX != 0 || mixY != 0; + var target = this.target; + var ta = target.a, + tb = target.b, + tc = target.c, + td = target.d; + var degRadReflect = ta * td - tb * tc > 0 ? MathUtils.degRad : -MathUtils.degRad; + var offsetRotation = this.data.offsetRotation * degRadReflect; + var offsetShearY = this.data.offsetShearY * degRadReflect; + var bones = this.bones; + for (var i = 0, n = bones.length; i < n; i++) { + var bone = bones[i]; + if (mixRotate != 0) { + var a = bone.a, + b = bone.b, + c = bone.c, + d = bone.d; + var r = Math.atan2(tc, ta) - Math.atan2(c, a) + offsetRotation; + if (r > MathUtils.PI) r -= MathUtils.PI2;else if (r < -MathUtils.PI) r += MathUtils.PI2; + r *= mixRotate; + var cos = Math.cos(r), + sin = Math.sin(r); + bone.a = cos * a - sin * c; + bone.b = cos * b - sin * d; + bone.c = sin * a + cos * c; + bone.d = sin * b + cos * d; + } + if (translate) { + var temp = this.temp; + target.localToWorld(temp.set(this.data.offsetX, this.data.offsetY)); + bone.worldX += (temp.x - bone.worldX) * mixX; + bone.worldY += (temp.y - bone.worldY) * mixY; + } + if (mixScaleX != 0) { + var s = Math.sqrt(bone.a * bone.a + bone.c * bone.c); + if (s != 0) s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s; + bone.a *= s; + bone.c *= s; + } + if (mixScaleY != 0) { + var _s = Math.sqrt(bone.b * bone.b + bone.d * bone.d); + if (_s != 0) _s = (_s + (Math.sqrt(tb * tb + td * td) - _s + this.data.offsetScaleY) * mixScaleY) / _s; + bone.b *= _s; + bone.d *= _s; + } + if (mixShearY > 0) { + var _b = bone.b, + _d = bone.d; + var by = Math.atan2(_d, _b); + var _r = Math.atan2(td, tb) - Math.atan2(tc, ta) - (by - Math.atan2(bone.c, bone.a)); + if (_r > MathUtils.PI) _r -= MathUtils.PI2;else if (_r < -MathUtils.PI) _r += MathUtils.PI2; + _r = by + (_r + offsetShearY) * mixShearY; + var _s2 = Math.sqrt(_b * _b + _d * _d); + bone.b = Math.cos(_r) * _s2; + bone.d = Math.sin(_r) * _s2; + } + bone.updateAppliedTransform(); + } + } + }, { + key: "applyRelativeWorld", + value: function applyRelativeWorld() { + var mixRotate = this.mixRotate, + mixX = this.mixX, + mixY = this.mixY, + mixScaleX = this.mixScaleX, + mixScaleY = this.mixScaleY, + mixShearY = this.mixShearY; + var translate = mixX != 0 || mixY != 0; + var target = this.target; + var ta = target.a, + tb = target.b, + tc = target.c, + td = target.d; + var degRadReflect = ta * td - tb * tc > 0 ? MathUtils.degRad : -MathUtils.degRad; + var offsetRotation = this.data.offsetRotation * degRadReflect, + offsetShearY = this.data.offsetShearY * degRadReflect; + var bones = this.bones; + for (var i = 0, n = bones.length; i < n; i++) { + var bone = bones[i]; + if (mixRotate != 0) { + var a = bone.a, + b = bone.b, + c = bone.c, + d = bone.d; + var r = Math.atan2(tc, ta) + offsetRotation; + if (r > MathUtils.PI) r -= MathUtils.PI2;else if (r < -MathUtils.PI) r += MathUtils.PI2; + r *= mixRotate; + var cos = Math.cos(r), + sin = Math.sin(r); + bone.a = cos * a - sin * c; + bone.b = cos * b - sin * d; + bone.c = sin * a + cos * c; + bone.d = sin * b + cos * d; + } + if (translate) { + var temp = this.temp; + target.localToWorld(temp.set(this.data.offsetX, this.data.offsetY)); + bone.worldX += temp.x * mixX; + bone.worldY += temp.y * mixY; + } + if (mixScaleX != 0) { + var s = (Math.sqrt(ta * ta + tc * tc) - 1 + this.data.offsetScaleX) * mixScaleX + 1; + bone.a *= s; + bone.c *= s; + } + if (mixScaleY != 0) { + var _s3 = (Math.sqrt(tb * tb + td * td) - 1 + this.data.offsetScaleY) * mixScaleY + 1; + bone.b *= _s3; + bone.d *= _s3; + } + if (mixShearY > 0) { + var _r2 = Math.atan2(td, tb) - Math.atan2(tc, ta); + if (_r2 > MathUtils.PI) _r2 -= MathUtils.PI2;else if (_r2 < -MathUtils.PI) _r2 += MathUtils.PI2; + var _b2 = bone.b, + _d2 = bone.d; + _r2 = Math.atan2(_d2, _b2) + (_r2 - MathUtils.PI / 2 + offsetShearY) * mixShearY; + var _s4 = Math.sqrt(_b2 * _b2 + _d2 * _d2); + bone.b = Math.cos(_r2) * _s4; + bone.d = Math.sin(_r2) * _s4; + } + bone.updateAppliedTransform(); + } + } + }, { + key: "applyAbsoluteLocal", + value: function applyAbsoluteLocal() { + var mixRotate = this.mixRotate, + mixX = this.mixX, + mixY = this.mixY, + mixScaleX = this.mixScaleX, + mixScaleY = this.mixScaleY, + mixShearY = this.mixShearY; + var target = this.target; + var bones = this.bones; + for (var i = 0, n = bones.length; i < n; i++) { + var bone = bones[i]; + var rotation = bone.arotation; + if (mixRotate != 0) { + var r = target.arotation - rotation + this.data.offsetRotation; + r -= (16384 - (16384.499999999996 - r / 360 | 0)) * 360; + rotation += r * mixRotate; + } + var x = bone.ax, + y = bone.ay; + x += (target.ax - x + this.data.offsetX) * mixX; + y += (target.ay - y + this.data.offsetY) * mixY; + var scaleX = bone.ascaleX, + scaleY = bone.ascaleY; + if (mixScaleX != 0 && scaleX != 0) scaleX = (scaleX + (target.ascaleX - scaleX + this.data.offsetScaleX) * mixScaleX) / scaleX; + if (mixScaleY != 0 && scaleY != 0) scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * mixScaleY) / scaleY; + var shearY = bone.ashearY; + if (mixShearY != 0) { + var _r3 = target.ashearY - shearY + this.data.offsetShearY; + _r3 -= (16384 - (16384.499999999996 - _r3 / 360 | 0)) * 360; + shearY += _r3 * mixShearY; + } + bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY); + } + } + }, { + key: "applyRelativeLocal", + value: function applyRelativeLocal() { + var mixRotate = this.mixRotate, + mixX = this.mixX, + mixY = this.mixY, + mixScaleX = this.mixScaleX, + mixScaleY = this.mixScaleY, + mixShearY = this.mixShearY; + var target = this.target; + var bones = this.bones; + for (var i = 0, n = bones.length; i < n; i++) { + var bone = bones[i]; + var rotation = bone.arotation + (target.arotation + this.data.offsetRotation) * mixRotate; + var x = bone.ax + (target.ax + this.data.offsetX) * mixX; + var y = bone.ay + (target.ay + this.data.offsetY) * mixY; + var scaleX = bone.ascaleX * ((target.ascaleX - 1 + this.data.offsetScaleX) * mixScaleX + 1); + var scaleY = bone.ascaleY * ((target.ascaleY - 1 + this.data.offsetScaleY) * mixScaleY + 1); + var shearY = bone.ashearY + (target.ashearY + this.data.offsetShearY) * mixShearY; + bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY); + } + } + }]); + return TransformConstraint; + }(); + + var Skeleton = function () { + function Skeleton(data) { + _classCallCheck(this, Skeleton); + this.data = null; + this.bones = null; + this.slots = null; + this.drawOrder = null; + this.ikConstraints = null; + this.transformConstraints = null; + this.pathConstraints = null; + this._updateCache = new Array(); + this.skin = null; + this.color = null; + this.time = 0; + this.scaleX = 1; + this.scaleY = 1; + this.x = 0; + this.y = 0; + if (!data) throw new Error("data cannot be null."); + this.data = data; + this.bones = new Array(); + for (var i = 0; i < data.bones.length; i++) { + var boneData = data.bones[i]; + var bone = void 0; + if (!boneData.parent) bone = new Bone(boneData, this, null);else { + var parent = this.bones[boneData.parent.index]; + bone = new Bone(boneData, this, parent); + parent.children.push(bone); + } + this.bones.push(bone); + } + this.slots = new Array(); + this.drawOrder = new Array(); + for (var _i = 0; _i < data.slots.length; _i++) { + var slotData = data.slots[_i]; + var _bone = this.bones[slotData.boneData.index]; + var slot = new Slot(slotData, _bone); + this.slots.push(slot); + this.drawOrder.push(slot); + } + this.ikConstraints = new Array(); + for (var _i2 = 0; _i2 < data.ikConstraints.length; _i2++) { + var ikConstraintData = data.ikConstraints[_i2]; + this.ikConstraints.push(new IkConstraint(ikConstraintData, this)); + } + this.transformConstraints = new Array(); + for (var _i3 = 0; _i3 < data.transformConstraints.length; _i3++) { + var transformConstraintData = data.transformConstraints[_i3]; + this.transformConstraints.push(new TransformConstraint(transformConstraintData, this)); + } + this.pathConstraints = new Array(); + for (var _i4 = 0; _i4 < data.pathConstraints.length; _i4++) { + var pathConstraintData = data.pathConstraints[_i4]; + this.pathConstraints.push(new PathConstraint(pathConstraintData, this)); + } + this.color = new Color(1, 1, 1, 1); + this.updateCache(); + } + _createClass(Skeleton, [{ + key: "updateCache", + value: function updateCache() { + var updateCache = this._updateCache; + updateCache.length = 0; + var bones = this.bones; + for (var i = 0, n = bones.length; i < n; i++) { + var bone = bones[i]; + bone.sorted = bone.data.skinRequired; + bone.active = !bone.sorted; + } + if (this.skin) { + var skinBones = this.skin.bones; + for (var _i5 = 0, _n = this.skin.bones.length; _i5 < _n; _i5++) { + var _bone2 = this.bones[skinBones[_i5].index]; + do { + _bone2.sorted = false; + _bone2.active = true; + _bone2 = _bone2.parent; + } while (_bone2); + } + } + var ikConstraints = this.ikConstraints; + var transformConstraints = this.transformConstraints; + var pathConstraints = this.pathConstraints; + var ikCount = ikConstraints.length, + transformCount = transformConstraints.length, + pathCount = pathConstraints.length; + var constraintCount = ikCount + transformCount + pathCount; + outer: for (var _i6 = 0; _i6 < constraintCount; _i6++) { + for (var ii = 0; ii < ikCount; ii++) { + var constraint = ikConstraints[ii]; + if (constraint.data.order == _i6) { + this.sortIkConstraint(constraint); + continue outer; + } + } + for (var _ii = 0; _ii < transformCount; _ii++) { + var _constraint = transformConstraints[_ii]; + if (_constraint.data.order == _i6) { + this.sortTransformConstraint(_constraint); + continue outer; + } + } + for (var _ii2 = 0; _ii2 < pathCount; _ii2++) { + var _constraint2 = pathConstraints[_ii2]; + if (_constraint2.data.order == _i6) { + this.sortPathConstraint(_constraint2); + continue outer; + } + } + } + for (var _i7 = 0, _n2 = bones.length; _i7 < _n2; _i7++) this.sortBone(bones[_i7]); + } + }, { + key: "sortIkConstraint", + value: function sortIkConstraint(constraint) { + constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true)); + if (!constraint.active) return; + var target = constraint.target; + this.sortBone(target); + var constrained = constraint.bones; + var parent = constrained[0]; + this.sortBone(parent); + if (constrained.length == 1) { + this._updateCache.push(constraint); + this.sortReset(parent.children); + } else { + var child = constrained[constrained.length - 1]; + this.sortBone(child); + this._updateCache.push(constraint); + this.sortReset(parent.children); + child.sorted = true; + } + } + }, { + key: "sortPathConstraint", + value: function sortPathConstraint(constraint) { + constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true)); + if (!constraint.active) return; + var slot = constraint.target; + var slotIndex = slot.data.index; + var slotBone = slot.bone; + if (this.skin) this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone); + if (this.data.defaultSkin && this.data.defaultSkin != this.skin) this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone); + for (var i = 0, n = this.data.skins.length; i < n; i++) this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone); + var attachment = slot.getAttachment(); + if (attachment instanceof PathAttachment) this.sortPathConstraintAttachmentWith(attachment, slotBone); + var constrained = constraint.bones; + var boneCount = constrained.length; + for (var _i8 = 0; _i8 < boneCount; _i8++) this.sortBone(constrained[_i8]); + this._updateCache.push(constraint); + for (var _i9 = 0; _i9 < boneCount; _i9++) this.sortReset(constrained[_i9].children); + for (var _i10 = 0; _i10 < boneCount; _i10++) constrained[_i10].sorted = true; + } + }, { + key: "sortTransformConstraint", + value: function sortTransformConstraint(constraint) { + constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true)); + if (!constraint.active) return; + this.sortBone(constraint.target); + var constrained = constraint.bones; + var boneCount = constrained.length; + if (constraint.data.local) { + for (var i = 0; i < boneCount; i++) { + var child = constrained[i]; + this.sortBone(child.parent); + this.sortBone(child); + } + } else { + for (var _i11 = 0; _i11 < boneCount; _i11++) { + this.sortBone(constrained[_i11]); + } + } + this._updateCache.push(constraint); + for (var _i12 = 0; _i12 < boneCount; _i12++) this.sortReset(constrained[_i12].children); + for (var _i13 = 0; _i13 < boneCount; _i13++) constrained[_i13].sorted = true; + } + }, { + key: "sortPathConstraintAttachment", + value: function sortPathConstraintAttachment(skin, slotIndex, slotBone) { + var attachments = skin.attachments[slotIndex]; + if (!attachments) return; + for (var key in attachments) { + this.sortPathConstraintAttachmentWith(attachments[key], slotBone); + } + } + }, { + key: "sortPathConstraintAttachmentWith", + value: function sortPathConstraintAttachmentWith(attachment, slotBone) { + if (!(attachment instanceof PathAttachment)) return; + var pathBones = attachment.bones; + if (!pathBones) this.sortBone(slotBone);else { + var bones = this.bones; + for (var i = 0, n = pathBones.length; i < n;) { + var nn = pathBones[i++]; + nn += i; + while (i < nn) this.sortBone(bones[pathBones[i++]]); + } + } + } + }, { + key: "sortBone", + value: function sortBone(bone) { + if (bone.sorted) return; + var parent = bone.parent; + if (parent) this.sortBone(parent); + bone.sorted = true; + this._updateCache.push(bone); + } + }, { + key: "sortReset", + value: function sortReset(bones) { + for (var i = 0, n = bones.length; i < n; i++) { + var bone = bones[i]; + if (!bone.active) continue; + if (bone.sorted) this.sortReset(bone.children); + bone.sorted = false; + } + } + }, { + key: "updateWorldTransform", + value: function updateWorldTransform() { + var bones = this.bones; + for (var i = 0, n = bones.length; i < n; i++) { + var bone = bones[i]; + bone.ax = bone.x; + bone.ay = bone.y; + bone.arotation = bone.rotation; + bone.ascaleX = bone.scaleX; + bone.ascaleY = bone.scaleY; + bone.ashearX = bone.shearX; + bone.ashearY = bone.shearY; + } + var updateCache = this._updateCache; + for (var _i14 = 0, _n3 = updateCache.length; _i14 < _n3; _i14++) updateCache[_i14].update(); + } + }, { + key: "updateWorldTransformWith", + value: function updateWorldTransformWith(parent) { + var rootBone = this.getRootBone(); + var pa = parent.a, + pb = parent.b, + pc = parent.c, + pd = parent.d; + rootBone.worldX = pa * this.x + pb * this.y + parent.worldX; + rootBone.worldY = pc * this.x + pd * this.y + parent.worldY; + var rotationY = rootBone.rotation + 90 + rootBone.shearY; + var la = MathUtils.cosDeg(rootBone.rotation + rootBone.shearX) * rootBone.scaleX; + var lb = MathUtils.cosDeg(rotationY) * rootBone.scaleY; + var lc = MathUtils.sinDeg(rootBone.rotation + rootBone.shearX) * rootBone.scaleX; + var ld = MathUtils.sinDeg(rotationY) * rootBone.scaleY; + rootBone.a = (pa * la + pb * lc) * this.scaleX; + rootBone.b = (pa * lb + pb * ld) * this.scaleX; + rootBone.c = (pc * la + pd * lc) * this.scaleY; + rootBone.d = (pc * lb + pd * ld) * this.scaleY; + var updateCache = this._updateCache; + for (var i = 0, n = updateCache.length; i < n; i++) { + var updatable = updateCache[i]; + if (updatable != rootBone) updatable.update(); + } + } + }, { + key: "setToSetupPose", + value: function setToSetupPose() { + this.setBonesToSetupPose(); + this.setSlotsToSetupPose(); + } + }, { + key: "setBonesToSetupPose", + value: function setBonesToSetupPose() { + var bones = this.bones; + for (var i = 0, n = bones.length; i < n; i++) bones[i].setToSetupPose(); + var ikConstraints = this.ikConstraints; + for (var _i15 = 0, _n4 = ikConstraints.length; _i15 < _n4; _i15++) { + var constraint = ikConstraints[_i15]; + constraint.mix = constraint.data.mix; + constraint.softness = constraint.data.softness; + constraint.bendDirection = constraint.data.bendDirection; + constraint.compress = constraint.data.compress; + constraint.stretch = constraint.data.stretch; + } + var transformConstraints = this.transformConstraints; + for (var _i16 = 0, _n5 = transformConstraints.length; _i16 < _n5; _i16++) { + var _constraint3 = transformConstraints[_i16]; + var data = _constraint3.data; + _constraint3.mixRotate = data.mixRotate; + _constraint3.mixX = data.mixX; + _constraint3.mixY = data.mixY; + _constraint3.mixScaleX = data.mixScaleX; + _constraint3.mixScaleY = data.mixScaleY; + _constraint3.mixShearY = data.mixShearY; + } + var pathConstraints = this.pathConstraints; + for (var _i17 = 0, _n6 = pathConstraints.length; _i17 < _n6; _i17++) { + var _constraint4 = pathConstraints[_i17]; + var _data = _constraint4.data; + _constraint4.position = _data.position; + _constraint4.spacing = _data.spacing; + _constraint4.mixRotate = _data.mixRotate; + _constraint4.mixX = _data.mixX; + _constraint4.mixY = _data.mixY; + } + } + }, { + key: "setSlotsToSetupPose", + value: function setSlotsToSetupPose() { + var slots = this.slots; + Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length); + for (var i = 0, n = slots.length; i < n; i++) slots[i].setToSetupPose(); + } + }, { + key: "getRootBone", + value: function getRootBone() { + if (this.bones.length == 0) return null; + return this.bones[0]; + } + }, { + key: "findBone", + value: function findBone(boneName) { + if (!boneName) throw new Error("boneName cannot be null."); + var bones = this.bones; + for (var i = 0, n = bones.length; i < n; i++) { + var bone = bones[i]; + if (bone.data.name == boneName) return bone; + } + return null; + } + }, { + key: "findSlot", + value: function findSlot(slotName) { + if (!slotName) throw new Error("slotName cannot be null."); + var slots = this.slots; + for (var i = 0, n = slots.length; i < n; i++) { + var slot = slots[i]; + if (slot.data.name == slotName) return slot; + } + return null; + } + }, { + key: "setSkinByName", + value: function setSkinByName(skinName) { + var skin = this.data.findSkin(skinName); + if (!skin) throw new Error("Skin not found: " + skinName); + this.setSkin(skin); + } + }, { + key: "setSkin", + value: function setSkin(newSkin) { + if (newSkin == this.skin) return; + if (newSkin) { + if (this.skin) newSkin.attachAll(this, this.skin);else { + var slots = this.slots; + for (var i = 0, n = slots.length; i < n; i++) { + var slot = slots[i]; + var name = slot.data.attachmentName; + if (name) { + var attachment = newSkin.getAttachment(i, name); + if (attachment) slot.setAttachment(attachment); + } + } + } + } + this.skin = newSkin; + this.updateCache(); + } + }, { + key: "getAttachmentByName", + value: function getAttachmentByName(slotName, attachmentName) { + return this.getAttachment(this.data.findSlot(slotName).index, attachmentName); + } + }, { + key: "getAttachment", + value: function getAttachment(slotIndex, attachmentName) { + if (!attachmentName) throw new Error("attachmentName cannot be null."); + if (this.skin) { + var attachment = this.skin.getAttachment(slotIndex, attachmentName); + if (attachment) return attachment; + } + if (this.data.defaultSkin) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName); + return null; + } + }, { + key: "setAttachment", + value: function setAttachment(slotName, attachmentName) { + if (!slotName) throw new Error("slotName cannot be null."); + var slots = this.slots; + for (var i = 0, n = slots.length; i < n; i++) { + var slot = slots[i]; + if (slot.data.name == slotName) { + var attachment = null; + if (attachmentName) { + attachment = this.getAttachment(i, attachmentName); + if (!attachment) throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName); + } + slot.setAttachment(attachment); + return; + } + } + throw new Error("Slot not found: " + slotName); + } + }, { + key: "findIkConstraint", + value: function findIkConstraint(constraintName) { + if (!constraintName) throw new Error("constraintName cannot be null."); + var ikConstraints = this.ikConstraints; + for (var i = 0, n = ikConstraints.length; i < n; i++) { + var ikConstraint = ikConstraints[i]; + if (ikConstraint.data.name == constraintName) return ikConstraint; + } + return null; + } + }, { + key: "findTransformConstraint", + value: function findTransformConstraint(constraintName) { + if (!constraintName) throw new Error("constraintName cannot be null."); + var transformConstraints = this.transformConstraints; + for (var i = 0, n = transformConstraints.length; i < n; i++) { + var constraint = transformConstraints[i]; + if (constraint.data.name == constraintName) return constraint; + } + return null; + } + }, { + key: "findPathConstraint", + value: function findPathConstraint(constraintName) { + if (!constraintName) throw new Error("constraintName cannot be null."); + var pathConstraints = this.pathConstraints; + for (var i = 0, n = pathConstraints.length; i < n; i++) { + var constraint = pathConstraints[i]; + if (constraint.data.name == constraintName) return constraint; + } + return null; + } + }, { + key: "getBoundsRect", + value: function getBoundsRect() { + var offset = new Vector2(); + var size = new Vector2(); + this.getBounds(offset, size); + return { + x: offset.x, + y: offset.y, + width: size.x, + height: size.y + }; + } + }, { + key: "getBounds", + value: function getBounds(offset, size) { + var temp = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Array(2); + if (!offset) throw new Error("offset cannot be null."); + if (!size) throw new Error("size cannot be null."); + var drawOrder = this.drawOrder; + var minX = Number.POSITIVE_INFINITY, + minY = Number.POSITIVE_INFINITY, + maxX = Number.NEGATIVE_INFINITY, + maxY = Number.NEGATIVE_INFINITY; + for (var i = 0, n = drawOrder.length; i < n; i++) { + var slot = drawOrder[i]; + if (!slot.bone.active) continue; + var verticesLength = 0; + var vertices = null; + var attachment = slot.getAttachment(); + if (attachment instanceof RegionAttachment) { + verticesLength = 8; + vertices = Utils.setArraySize(temp, verticesLength, 0); + attachment.computeWorldVertices(slot.bone, vertices, 0, 2); + } else if (attachment instanceof MeshAttachment) { + var mesh = attachment; + verticesLength = mesh.worldVerticesLength; + vertices = Utils.setArraySize(temp, verticesLength, 0); + mesh.computeWorldVertices(slot, 0, verticesLength, vertices, 0, 2); + } + if (vertices) { + for (var ii = 0, nn = vertices.length; ii < nn; ii += 2) { + var x = vertices[ii], + y = vertices[ii + 1]; + minX = Math.min(minX, x); + minY = Math.min(minY, y); + maxX = Math.max(maxX, x); + maxY = Math.max(maxY, y); + } + } + } + offset.set(minX, minY); + size.set(maxX - minX, maxY - minY); + } + }, { + key: "update", + value: function update(delta) { + this.time += delta; + } + }]); + return Skeleton; + }(); + + var SkeletonData = function () { + function SkeletonData() { + _classCallCheck(this, SkeletonData); + this.name = null; + this.bones = new Array(); + this.slots = new Array(); + this.skins = new Array(); + this.defaultSkin = null; + this.events = new Array(); + this.animations = new Array(); + this.ikConstraints = new Array(); + this.transformConstraints = new Array(); + this.pathConstraints = new Array(); + this.x = 0; + this.y = 0; + this.width = 0; + this.height = 0; + this.version = null; + this.hash = null; + this.fps = 0; + this.imagesPath = null; + this.audioPath = null; + } + _createClass(SkeletonData, [{ + key: "findBone", + value: function findBone(boneName) { + if (!boneName) throw new Error("boneName cannot be null."); + var bones = this.bones; + for (var i = 0, n = bones.length; i < n; i++) { + var bone = bones[i]; + if (bone.name == boneName) return bone; + } + return null; + } + }, { + key: "findSlot", + value: function findSlot(slotName) { + if (!slotName) throw new Error("slotName cannot be null."); + var slots = this.slots; + for (var i = 0, n = slots.length; i < n; i++) { + var slot = slots[i]; + if (slot.name == slotName) return slot; + } + return null; + } + }, { + key: "findSkin", + value: function findSkin(skinName) { + if (!skinName) throw new Error("skinName cannot be null."); + var skins = this.skins; + for (var i = 0, n = skins.length; i < n; i++) { + var skin = skins[i]; + if (skin.name == skinName) return skin; + } + return null; + } + }, { + key: "findEvent", + value: function findEvent(eventDataName) { + if (!eventDataName) throw new Error("eventDataName cannot be null."); + var events = this.events; + for (var i = 0, n = events.length; i < n; i++) { + var event = events[i]; + if (event.name == eventDataName) return event; + } + return null; + } + }, { + key: "findAnimation", + value: function findAnimation(animationName) { + if (!animationName) throw new Error("animationName cannot be null."); + var animations = this.animations; + for (var i = 0, n = animations.length; i < n; i++) { + var animation = animations[i]; + if (animation.name == animationName) return animation; + } + return null; + } + }, { + key: "findIkConstraint", + value: function findIkConstraint(constraintName) { + if (!constraintName) throw new Error("constraintName cannot be null."); + var ikConstraints = this.ikConstraints; + for (var i = 0, n = ikConstraints.length; i < n; i++) { + var constraint = ikConstraints[i]; + if (constraint.name == constraintName) return constraint; + } + return null; + } + }, { + key: "findTransformConstraint", + value: function findTransformConstraint(constraintName) { + if (!constraintName) throw new Error("constraintName cannot be null."); + var transformConstraints = this.transformConstraints; + for (var i = 0, n = transformConstraints.length; i < n; i++) { + var constraint = transformConstraints[i]; + if (constraint.name == constraintName) return constraint; + } + return null; + } + }, { + key: "findPathConstraint", + value: function findPathConstraint(constraintName) { + if (!constraintName) throw new Error("constraintName cannot be null."); + var pathConstraints = this.pathConstraints; + for (var i = 0, n = pathConstraints.length; i < n; i++) { + var constraint = pathConstraints[i]; + if (constraint.name == constraintName) return constraint; + } + return null; + } + }]); + return SkeletonData; + }(); + + var SkinEntry = _createClass(function SkinEntry() { + var slotIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var attachment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + _classCallCheck(this, SkinEntry); + this.slotIndex = slotIndex; + this.name = name; + this.attachment = attachment; + }); + var Skin = function () { + function Skin(name) { + _classCallCheck(this, Skin); + this.name = null; + this.attachments = new Array(); + this.bones = Array(); + this.constraints = new Array(); + if (!name) throw new Error("name cannot be null."); + this.name = name; + } + _createClass(Skin, [{ + key: "setAttachment", + value: function setAttachment(slotIndex, name, attachment) { + if (!attachment) throw new Error("attachment cannot be null."); + var attachments = this.attachments; + if (slotIndex >= attachments.length) attachments.length = slotIndex + 1; + if (!attachments[slotIndex]) attachments[slotIndex] = {}; + attachments[slotIndex][name] = attachment; + } + }, { + key: "addSkin", + value: function addSkin(skin) { + for (var i = 0; i < skin.bones.length; i++) { + var bone = skin.bones[i]; + var contained = false; + for (var ii = 0; ii < this.bones.length; ii++) { + if (this.bones[ii] == bone) { + contained = true; + break; + } + } + if (!contained) this.bones.push(bone); + } + for (var _i = 0; _i < skin.constraints.length; _i++) { + var constraint = skin.constraints[_i]; + var _contained = false; + for (var _ii = 0; _ii < this.constraints.length; _ii++) { + if (this.constraints[_ii] == constraint) { + _contained = true; + break; + } + } + if (!_contained) this.constraints.push(constraint); + } + var attachments = skin.getAttachments(); + for (var _i2 = 0; _i2 < attachments.length; _i2++) { + var attachment = attachments[_i2]; + this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment); + } + } + }, { + key: "copySkin", + value: function copySkin(skin) { + for (var i = 0; i < skin.bones.length; i++) { + var bone = skin.bones[i]; + var contained = false; + for (var ii = 0; ii < this.bones.length; ii++) { + if (this.bones[ii] == bone) { + contained = true; + break; + } + } + if (!contained) this.bones.push(bone); + } + for (var _i3 = 0; _i3 < skin.constraints.length; _i3++) { + var constraint = skin.constraints[_i3]; + var _contained2 = false; + for (var _ii2 = 0; _ii2 < this.constraints.length; _ii2++) { + if (this.constraints[_ii2] == constraint) { + _contained2 = true; + break; + } + } + if (!_contained2) this.constraints.push(constraint); + } + var attachments = skin.getAttachments(); + for (var _i4 = 0; _i4 < attachments.length; _i4++) { + var attachment = attachments[_i4]; + if (!attachment.attachment) continue; + if (attachment.attachment instanceof MeshAttachment) { + attachment.attachment = attachment.attachment.newLinkedMesh(); + this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment); + } else { + attachment.attachment = attachment.attachment.copy(); + this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment); + } + } + } + }, { + key: "getAttachment", + value: function getAttachment(slotIndex, name) { + var dictionary = this.attachments[slotIndex]; + return dictionary ? dictionary[name] : null; + } + }, { + key: "removeAttachment", + value: function removeAttachment(slotIndex, name) { + var dictionary = this.attachments[slotIndex]; + if (dictionary) dictionary[name] = null; + } + }, { + key: "getAttachments", + value: function getAttachments() { + var entries = new Array(); + for (var i = 0; i < this.attachments.length; i++) { + var slotAttachments = this.attachments[i]; + if (slotAttachments) { + for (var name in slotAttachments) { + var attachment = slotAttachments[name]; + if (attachment) entries.push(new SkinEntry(i, name, attachment)); + } + } + } + return entries; + } + }, { + key: "getAttachmentsForSlot", + value: function getAttachmentsForSlot(slotIndex, attachments) { + var slotAttachments = this.attachments[slotIndex]; + if (slotAttachments) { + for (var name in slotAttachments) { + var attachment = slotAttachments[name]; + if (attachment) attachments.push(new SkinEntry(slotIndex, name, attachment)); + } + } + } + }, { + key: "clear", + value: function clear() { + this.attachments.length = 0; + this.bones.length = 0; + this.constraints.length = 0; + } + }, { + key: "attachAll", + value: function attachAll(skeleton, oldSkin) { + var slotIndex = 0; + for (var i = 0; i < skeleton.slots.length; i++) { + var slot = skeleton.slots[i]; + var slotAttachment = slot.getAttachment(); + if (slotAttachment && slotIndex < oldSkin.attachments.length) { + var dictionary = oldSkin.attachments[slotIndex]; + for (var key in dictionary) { + var skinAttachment = dictionary[key]; + if (slotAttachment == skinAttachment) { + var attachment = this.getAttachment(slotIndex, key); + if (attachment) slot.setAttachment(attachment); + break; + } + } + } + slotIndex++; + } + } + }]); + return Skin; + }(); + + var SlotData = _createClass(function SlotData(index, name, boneData) { + _classCallCheck(this, SlotData); + this.index = 0; + this.name = null; + this.boneData = null; + this.color = new Color(1, 1, 1, 1); + this.darkColor = null; + this.attachmentName = null; + this.blendMode = null; + if (index < 0) throw new Error("index must be >= 0."); + if (!name) throw new Error("name cannot be null."); + if (!boneData) throw new Error("boneData cannot be null."); + this.index = index; + this.name = name; + this.boneData = boneData; + }); + var BlendMode; + (function (BlendMode) { + BlendMode[BlendMode["Normal"] = 0] = "Normal"; + BlendMode[BlendMode["Additive"] = 1] = "Additive"; + BlendMode[BlendMode["Multiply"] = 2] = "Multiply"; + BlendMode[BlendMode["Screen"] = 3] = "Screen"; + })(BlendMode || (BlendMode = {})); + + var TransformConstraintData = function (_ConstraintData) { + _inherits(TransformConstraintData, _ConstraintData); + var _super = _createSuper(TransformConstraintData); + function TransformConstraintData(name) { + var _this; + _classCallCheck(this, TransformConstraintData); + _this = _super.call(this, name, 0, false); + _this.bones = new Array(); + _this.target = null; + _this.mixRotate = 0; + _this.mixX = 0; + _this.mixY = 0; + _this.mixScaleX = 0; + _this.mixScaleY = 0; + _this.mixShearY = 0; + _this.offsetRotation = 0; + _this.offsetX = 0; + _this.offsetY = 0; + _this.offsetScaleX = 0; + _this.offsetScaleY = 0; + _this.offsetShearY = 0; + _this.relative = false; + _this.local = false; + return _this; + } + return _createClass(TransformConstraintData); + }(ConstraintData); + + var SkeletonBinary = function () { + function SkeletonBinary(attachmentLoader) { + _classCallCheck(this, SkeletonBinary); + this.scale = 1; + this.attachmentLoader = null; + this.linkedMeshes = new Array(); + this.attachmentLoader = attachmentLoader; + } + _createClass(SkeletonBinary, [{ + key: "readSkeletonData", + value: function readSkeletonData(binary) { + var scale = this.scale; + var skeletonData = new SkeletonData(); + skeletonData.name = ""; + var input = new BinaryInput(binary); + var lowHash = input.readInt32(); + var highHash = input.readInt32(); + skeletonData.hash = highHash == 0 && lowHash == 0 ? null : highHash.toString(16) + lowHash.toString(16); + skeletonData.version = input.readString(); + skeletonData.x = input.readFloat(); + skeletonData.y = input.readFloat(); + skeletonData.width = input.readFloat(); + skeletonData.height = input.readFloat(); + var nonessential = input.readBoolean(); + if (nonessential) { + skeletonData.fps = input.readFloat(); + skeletonData.imagesPath = input.readString(); + skeletonData.audioPath = input.readString(); + } + var n = 0; + n = input.readInt(true); + for (var i = 0; i < n; i++) input.strings.push(input.readString()); + n = input.readInt(true); + for (var _i = 0; _i < n; _i++) { + var name = input.readString(); + var parent = _i == 0 ? null : skeletonData.bones[input.readInt(true)]; + var data = new BoneData(_i, name, parent); + data.rotation = input.readFloat(); + data.x = input.readFloat() * scale; + data.y = input.readFloat() * scale; + data.scaleX = input.readFloat(); + data.scaleY = input.readFloat(); + data.shearX = input.readFloat(); + data.shearY = input.readFloat(); + data.length = input.readFloat() * scale; + data.transformMode = input.readInt(true); + data.skinRequired = input.readBoolean(); + if (nonessential) Color.rgba8888ToColor(data.color, input.readInt32()); + skeletonData.bones.push(data); + } + n = input.readInt(true); + for (var _i2 = 0; _i2 < n; _i2++) { + var slotName = input.readString(); + var boneData = skeletonData.bones[input.readInt(true)]; + var _data = new SlotData(_i2, slotName, boneData); + Color.rgba8888ToColor(_data.color, input.readInt32()); + var darkColor = input.readInt32(); + if (darkColor != -1) Color.rgb888ToColor(_data.darkColor = new Color(), darkColor); + _data.attachmentName = input.readStringRef(); + _data.blendMode = input.readInt(true); + skeletonData.slots.push(_data); + } + n = input.readInt(true); + for (var _i3 = 0, nn; _i3 < n; _i3++) { + var _data2 = new IkConstraintData(input.readString()); + _data2.order = input.readInt(true); + _data2.skinRequired = input.readBoolean(); + nn = input.readInt(true); + for (var ii = 0; ii < nn; ii++) _data2.bones.push(skeletonData.bones[input.readInt(true)]); + _data2.target = skeletonData.bones[input.readInt(true)]; + _data2.mix = input.readFloat(); + _data2.softness = input.readFloat() * scale; + _data2.bendDirection = input.readByte(); + _data2.compress = input.readBoolean(); + _data2.stretch = input.readBoolean(); + _data2.uniform = input.readBoolean(); + skeletonData.ikConstraints.push(_data2); + } + n = input.readInt(true); + for (var _i4 = 0, _nn; _i4 < n; _i4++) { + var _data3 = new TransformConstraintData(input.readString()); + _data3.order = input.readInt(true); + _data3.skinRequired = input.readBoolean(); + _nn = input.readInt(true); + for (var _ii = 0; _ii < _nn; _ii++) _data3.bones.push(skeletonData.bones[input.readInt(true)]); + _data3.target = skeletonData.bones[input.readInt(true)]; + _data3.local = input.readBoolean(); + _data3.relative = input.readBoolean(); + _data3.offsetRotation = input.readFloat(); + _data3.offsetX = input.readFloat() * scale; + _data3.offsetY = input.readFloat() * scale; + _data3.offsetScaleX = input.readFloat(); + _data3.offsetScaleY = input.readFloat(); + _data3.offsetShearY = input.readFloat(); + _data3.mixRotate = input.readFloat(); + _data3.mixX = input.readFloat(); + _data3.mixY = input.readFloat(); + _data3.mixScaleX = input.readFloat(); + _data3.mixScaleY = input.readFloat(); + _data3.mixShearY = input.readFloat(); + skeletonData.transformConstraints.push(_data3); + } + n = input.readInt(true); + for (var _i5 = 0, _nn2; _i5 < n; _i5++) { + var _data4 = new PathConstraintData(input.readString()); + _data4.order = input.readInt(true); + _data4.skinRequired = input.readBoolean(); + _nn2 = input.readInt(true); + for (var _ii2 = 0; _ii2 < _nn2; _ii2++) _data4.bones.push(skeletonData.bones[input.readInt(true)]); + _data4.target = skeletonData.slots[input.readInt(true)]; + _data4.positionMode = input.readInt(true); + _data4.spacingMode = input.readInt(true); + _data4.rotateMode = input.readInt(true); + _data4.offsetRotation = input.readFloat(); + _data4.position = input.readFloat(); + if (_data4.positionMode == PositionMode.Fixed) _data4.position *= scale; + _data4.spacing = input.readFloat(); + if (_data4.spacingMode == SpacingMode.Length || _data4.spacingMode == SpacingMode.Fixed) _data4.spacing *= scale; + _data4.mixRotate = input.readFloat(); + _data4.mixX = input.readFloat(); + _data4.mixY = input.readFloat(); + skeletonData.pathConstraints.push(_data4); + } + var defaultSkin = this.readSkin(input, skeletonData, true, nonessential); + if (defaultSkin) { + skeletonData.defaultSkin = defaultSkin; + skeletonData.skins.push(defaultSkin); + } + { + var _i6 = skeletonData.skins.length; + Utils.setArraySize(skeletonData.skins, n = _i6 + input.readInt(true)); + for (; _i6 < n; _i6++) skeletonData.skins[_i6] = this.readSkin(input, skeletonData, false, nonessential); + } + n = this.linkedMeshes.length; + for (var _i7 = 0; _i7 < n; _i7++) { + var linkedMesh = this.linkedMeshes[_i7]; + var skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin); + var _parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent); + linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? _parent : linkedMesh.mesh; + linkedMesh.mesh.setParentMesh(_parent); + linkedMesh.mesh.updateUVs(); + } + this.linkedMeshes.length = 0; + n = input.readInt(true); + for (var _i8 = 0; _i8 < n; _i8++) { + var _data5 = new EventData(input.readStringRef()); + _data5.intValue = input.readInt(false); + _data5.floatValue = input.readFloat(); + _data5.stringValue = input.readString(); + _data5.audioPath = input.readString(); + if (_data5.audioPath) { + _data5.volume = input.readFloat(); + _data5.balance = input.readFloat(); + } + skeletonData.events.push(_data5); + } + n = input.readInt(true); + for (var _i9 = 0; _i9 < n; _i9++) skeletonData.animations.push(this.readAnimation(input, input.readString(), skeletonData)); + return skeletonData; + } + }, { + key: "readSkin", + value: function readSkin(input, skeletonData, defaultSkin, nonessential) { + var skin = null; + var slotCount = 0; + if (defaultSkin) { + slotCount = input.readInt(true); + if (slotCount == 0) return null; + skin = new Skin("default"); + } else { + skin = new Skin(input.readStringRef()); + skin.bones.length = input.readInt(true); + for (var i = 0, n = skin.bones.length; i < n; i++) skin.bones[i] = skeletonData.bones[input.readInt(true)]; + for (var _i10 = 0, _n = input.readInt(true); _i10 < _n; _i10++) skin.constraints.push(skeletonData.ikConstraints[input.readInt(true)]); + for (var _i11 = 0, _n2 = input.readInt(true); _i11 < _n2; _i11++) skin.constraints.push(skeletonData.transformConstraints[input.readInt(true)]); + for (var _i12 = 0, _n3 = input.readInt(true); _i12 < _n3; _i12++) skin.constraints.push(skeletonData.pathConstraints[input.readInt(true)]); + slotCount = input.readInt(true); + } + for (var _i13 = 0; _i13 < slotCount; _i13++) { + var slotIndex = input.readInt(true); + for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) { + var name = input.readStringRef(); + var attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential); + if (attachment) skin.setAttachment(slotIndex, name, attachment); + } + } + return skin; + } + }, { + key: "readAttachment", + value: function readAttachment(input, skeletonData, skin, slotIndex, attachmentName, nonessential) { + var scale = this.scale; + var name = input.readStringRef(); + if (!name) name = attachmentName; + switch (input.readByte()) { + case AttachmentType.Region: + { + var path = input.readStringRef(); + var rotation = input.readFloat(); + var x = input.readFloat(); + var y = input.readFloat(); + var scaleX = input.readFloat(); + var scaleY = input.readFloat(); + var width = input.readFloat(); + var height = input.readFloat(); + var color = input.readInt32(); + if (!path) path = name; + var region = this.attachmentLoader.newRegionAttachment(skin, name, path); + if (!region) return null; + region.path = path; + region.x = x * scale; + region.y = y * scale; + region.scaleX = scaleX; + region.scaleY = scaleY; + region.rotation = rotation; + region.width = width * scale; + region.height = height * scale; + Color.rgba8888ToColor(region.color, color); + region.updateOffset(); + return region; + } + case AttachmentType.BoundingBox: + { + var vertexCount = input.readInt(true); + var vertices = this.readVertices(input, vertexCount); + var _color = nonessential ? input.readInt32() : 0; + var box = this.attachmentLoader.newBoundingBoxAttachment(skin, name); + if (!box) return null; + box.worldVerticesLength = vertexCount << 1; + box.vertices = vertices.vertices; + box.bones = vertices.bones; + if (nonessential) Color.rgba8888ToColor(box.color, _color); + return box; + } + case AttachmentType.Mesh: + { + var _path = input.readStringRef(); + var _color2 = input.readInt32(); + var _vertexCount = input.readInt(true); + var uvs = this.readFloatArray(input, _vertexCount << 1, 1); + var triangles = this.readShortArray(input); + var _vertices = this.readVertices(input, _vertexCount); + var hullLength = input.readInt(true); + var edges = null; + var _width = 0, + _height = 0; + if (nonessential) { + edges = this.readShortArray(input); + _width = input.readFloat(); + _height = input.readFloat(); + } + if (!_path) _path = name; + var mesh = this.attachmentLoader.newMeshAttachment(skin, name, _path); + if (!mesh) return null; + mesh.path = _path; + Color.rgba8888ToColor(mesh.color, _color2); + mesh.bones = _vertices.bones; + mesh.vertices = _vertices.vertices; + mesh.worldVerticesLength = _vertexCount << 1; + mesh.triangles = triangles; + mesh.regionUVs = uvs; + mesh.updateUVs(); + mesh.hullLength = hullLength << 1; + if (nonessential) { + mesh.edges = edges; + mesh.width = _width * scale; + mesh.height = _height * scale; + } + return mesh; + } + case AttachmentType.LinkedMesh: + { + var _path2 = input.readStringRef(); + var _color3 = input.readInt32(); + var skinName = input.readStringRef(); + var parent = input.readStringRef(); + var inheritDeform = input.readBoolean(); + var _width2 = 0, + _height2 = 0; + if (nonessential) { + _width2 = input.readFloat(); + _height2 = input.readFloat(); + } + if (!_path2) _path2 = name; + var _mesh = this.attachmentLoader.newMeshAttachment(skin, name, _path2); + if (!_mesh) return null; + _mesh.path = _path2; + Color.rgba8888ToColor(_mesh.color, _color3); + if (nonessential) { + _mesh.width = _width2 * scale; + _mesh.height = _height2 * scale; + } + this.linkedMeshes.push(new LinkedMesh$1(_mesh, skinName, slotIndex, parent, inheritDeform)); + return _mesh; + } + case AttachmentType.Path: + { + var closed = input.readBoolean(); + var constantSpeed = input.readBoolean(); + var _vertexCount2 = input.readInt(true); + var _vertices2 = this.readVertices(input, _vertexCount2); + var lengths = Utils.newArray(_vertexCount2 / 3, 0); + for (var i = 0, n = lengths.length; i < n; i++) lengths[i] = input.readFloat() * scale; + var _color4 = nonessential ? input.readInt32() : 0; + var _path3 = this.attachmentLoader.newPathAttachment(skin, name); + if (!_path3) return null; + _path3.closed = closed; + _path3.constantSpeed = constantSpeed; + _path3.worldVerticesLength = _vertexCount2 << 1; + _path3.vertices = _vertices2.vertices; + _path3.bones = _vertices2.bones; + _path3.lengths = lengths; + if (nonessential) Color.rgba8888ToColor(_path3.color, _color4); + return _path3; + } + case AttachmentType.Point: + { + var _rotation = input.readFloat(); + var _x = input.readFloat(); + var _y = input.readFloat(); + var _color5 = nonessential ? input.readInt32() : 0; + var point = this.attachmentLoader.newPointAttachment(skin, name); + if (!point) return null; + point.x = _x * scale; + point.y = _y * scale; + point.rotation = _rotation; + if (nonessential) Color.rgba8888ToColor(point.color, _color5); + return point; + } + case AttachmentType.Clipping: + { + var endSlotIndex = input.readInt(true); + var _vertexCount3 = input.readInt(true); + var _vertices3 = this.readVertices(input, _vertexCount3); + var _color6 = nonessential ? input.readInt32() : 0; + var clip = this.attachmentLoader.newClippingAttachment(skin, name); + if (!clip) return null; + clip.endSlot = skeletonData.slots[endSlotIndex]; + clip.worldVerticesLength = _vertexCount3 << 1; + clip.vertices = _vertices3.vertices; + clip.bones = _vertices3.bones; + if (nonessential) Color.rgba8888ToColor(clip.color, _color6); + return clip; + } + } + return null; + } + }, { + key: "readVertices", + value: function readVertices(input, vertexCount) { + var scale = this.scale; + var verticesLength = vertexCount << 1; + var vertices = new Vertices(); + if (!input.readBoolean()) { + vertices.vertices = this.readFloatArray(input, verticesLength, scale); + return vertices; + } + var weights = new Array(); + var bonesArray = new Array(); + for (var i = 0; i < vertexCount; i++) { + var boneCount = input.readInt(true); + bonesArray.push(boneCount); + for (var ii = 0; ii < boneCount; ii++) { + bonesArray.push(input.readInt(true)); + weights.push(input.readFloat() * scale); + weights.push(input.readFloat() * scale); + weights.push(input.readFloat()); + } + } + vertices.vertices = Utils.toFloatArray(weights); + vertices.bones = bonesArray; + return vertices; + } + }, { + key: "readFloatArray", + value: function readFloatArray(input, n, scale) { + var array = new Array(n); + if (scale == 1) { + for (var i = 0; i < n; i++) array[i] = input.readFloat(); + } else { + for (var _i14 = 0; _i14 < n; _i14++) array[_i14] = input.readFloat() * scale; + } + return array; + } + }, { + key: "readShortArray", + value: function readShortArray(input) { + var n = input.readInt(true); + var array = new Array(n); + for (var i = 0; i < n; i++) array[i] = input.readShort(); + return array; + } + }, { + key: "readAnimation", + value: function readAnimation(input, name, skeletonData) { + input.readInt(true); + var timelines = new Array(); + var scale = this.scale; + new Color(); + new Color(); + for (var i = 0, n = input.readInt(true); i < n; i++) { + var slotIndex = input.readInt(true); + for (var ii = 0, nn = input.readInt(true); ii < nn; ii++) { + var timelineType = input.readByte(); + var frameCount = input.readInt(true); + var frameLast = frameCount - 1; + switch (timelineType) { + case SLOT_ATTACHMENT: + { + var timeline = new AttachmentTimeline(frameCount, slotIndex); + for (var frame = 0; frame < frameCount; frame++) timeline.setFrame(frame, input.readFloat(), input.readStringRef()); + timelines.push(timeline); + break; + } + case SLOT_RGBA: + { + var bezierCount = input.readInt(true); + var _timeline = new RGBATimeline(frameCount, bezierCount, slotIndex); + var time = input.readFloat(); + var r = input.readUnsignedByte() / 255.0; + var g = input.readUnsignedByte() / 255.0; + var b = input.readUnsignedByte() / 255.0; + var a = input.readUnsignedByte() / 255.0; + for (var _frame = 0, bezier = 0;; _frame++) { + _timeline.setFrame(_frame, time, r, g, b, a); + if (_frame == frameLast) break; + var time2 = input.readFloat(); + var r2 = input.readUnsignedByte() / 255.0; + var g2 = input.readUnsignedByte() / 255.0; + var b2 = input.readUnsignedByte() / 255.0; + var a2 = input.readUnsignedByte() / 255.0; + switch (input.readByte()) { + case CURVE_STEPPED: + _timeline.setStepped(_frame); + break; + case CURVE_BEZIER: + setBezier(input, _timeline, bezier++, _frame, 0, time, time2, r, r2, 1); + setBezier(input, _timeline, bezier++, _frame, 1, time, time2, g, g2, 1); + setBezier(input, _timeline, bezier++, _frame, 2, time, time2, b, b2, 1); + setBezier(input, _timeline, bezier++, _frame, 3, time, time2, a, a2, 1); + } + time = time2; + r = r2; + g = g2; + b = b2; + a = a2; + } + timelines.push(_timeline); + break; + } + case SLOT_RGB: + { + var _bezierCount = input.readInt(true); + var _timeline2 = new RGBTimeline(frameCount, _bezierCount, slotIndex); + var _time = input.readFloat(); + var _r = input.readUnsignedByte() / 255.0; + var _g = input.readUnsignedByte() / 255.0; + var _b = input.readUnsignedByte() / 255.0; + for (var _frame2 = 0, _bezier = 0;; _frame2++) { + _timeline2.setFrame(_frame2, _time, _r, _g, _b); + if (_frame2 == frameLast) break; + var _time2 = input.readFloat(); + var _r2 = input.readUnsignedByte() / 255.0; + var _g2 = input.readUnsignedByte() / 255.0; + var _b2 = input.readUnsignedByte() / 255.0; + switch (input.readByte()) { + case CURVE_STEPPED: + _timeline2.setStepped(_frame2); + break; + case CURVE_BEZIER: + setBezier(input, _timeline2, _bezier++, _frame2, 0, _time, _time2, _r, _r2, 1); + setBezier(input, _timeline2, _bezier++, _frame2, 1, _time, _time2, _g, _g2, 1); + setBezier(input, _timeline2, _bezier++, _frame2, 2, _time, _time2, _b, _b2, 1); + } + _time = _time2; + _r = _r2; + _g = _g2; + _b = _b2; + } + timelines.push(_timeline2); + break; + } + case SLOT_RGBA2: + { + var _bezierCount2 = input.readInt(true); + var _timeline3 = new RGBA2Timeline(frameCount, _bezierCount2, slotIndex); + var _time3 = input.readFloat(); + var _r3 = input.readUnsignedByte() / 255.0; + var _g3 = input.readUnsignedByte() / 255.0; + var _b3 = input.readUnsignedByte() / 255.0; + var _a = input.readUnsignedByte() / 255.0; + var _r4 = input.readUnsignedByte() / 255.0; + var _g4 = input.readUnsignedByte() / 255.0; + var _b4 = input.readUnsignedByte() / 255.0; + for (var _frame3 = 0, _bezier2 = 0;; _frame3++) { + _timeline3.setFrame(_frame3, _time3, _r3, _g3, _b3, _a, _r4, _g4, _b4); + if (_frame3 == frameLast) break; + var _time4 = input.readFloat(); + var nr = input.readUnsignedByte() / 255.0; + var ng = input.readUnsignedByte() / 255.0; + var nb = input.readUnsignedByte() / 255.0; + var na = input.readUnsignedByte() / 255.0; + var nr2 = input.readUnsignedByte() / 255.0; + var ng2 = input.readUnsignedByte() / 255.0; + var nb2 = input.readUnsignedByte() / 255.0; + switch (input.readByte()) { + case CURVE_STEPPED: + _timeline3.setStepped(_frame3); + break; + case CURVE_BEZIER: + setBezier(input, _timeline3, _bezier2++, _frame3, 0, _time3, _time4, _r3, nr, 1); + setBezier(input, _timeline3, _bezier2++, _frame3, 1, _time3, _time4, _g3, ng, 1); + setBezier(input, _timeline3, _bezier2++, _frame3, 2, _time3, _time4, _b3, nb, 1); + setBezier(input, _timeline3, _bezier2++, _frame3, 3, _time3, _time4, _a, na, 1); + setBezier(input, _timeline3, _bezier2++, _frame3, 4, _time3, _time4, _r4, nr2, 1); + setBezier(input, _timeline3, _bezier2++, _frame3, 5, _time3, _time4, _g4, ng2, 1); + setBezier(input, _timeline3, _bezier2++, _frame3, 6, _time3, _time4, _b4, nb2, 1); + } + _time3 = _time4; + _r3 = nr; + _g3 = ng; + _b3 = nb; + _a = na; + _r4 = nr2; + _g4 = ng2; + _b4 = nb2; + } + timelines.push(_timeline3); + break; + } + case SLOT_RGB2: + { + var _bezierCount3 = input.readInt(true); + var _timeline4 = new RGB2Timeline(frameCount, _bezierCount3, slotIndex); + var _time5 = input.readFloat(); + var _r5 = input.readUnsignedByte() / 255.0; + var _g5 = input.readUnsignedByte() / 255.0; + var _b5 = input.readUnsignedByte() / 255.0; + var _r6 = input.readUnsignedByte() / 255.0; + var _g6 = input.readUnsignedByte() / 255.0; + var _b6 = input.readUnsignedByte() / 255.0; + for (var _frame4 = 0, _bezier3 = 0;; _frame4++) { + _timeline4.setFrame(_frame4, _time5, _r5, _g5, _b5, _r6, _g6, _b6); + if (_frame4 == frameLast) break; + var _time6 = input.readFloat(); + var _nr = input.readUnsignedByte() / 255.0; + var _ng = input.readUnsignedByte() / 255.0; + var _nb = input.readUnsignedByte() / 255.0; + var _nr2 = input.readUnsignedByte() / 255.0; + var _ng2 = input.readUnsignedByte() / 255.0; + var _nb2 = input.readUnsignedByte() / 255.0; + switch (input.readByte()) { + case CURVE_STEPPED: + _timeline4.setStepped(_frame4); + break; + case CURVE_BEZIER: + setBezier(input, _timeline4, _bezier3++, _frame4, 0, _time5, _time6, _r5, _nr, 1); + setBezier(input, _timeline4, _bezier3++, _frame4, 1, _time5, _time6, _g5, _ng, 1); + setBezier(input, _timeline4, _bezier3++, _frame4, 2, _time5, _time6, _b5, _nb, 1); + setBezier(input, _timeline4, _bezier3++, _frame4, 3, _time5, _time6, _r6, _nr2, 1); + setBezier(input, _timeline4, _bezier3++, _frame4, 4, _time5, _time6, _g6, _ng2, 1); + setBezier(input, _timeline4, _bezier3++, _frame4, 5, _time5, _time6, _b6, _nb2, 1); + } + _time5 = _time6; + _r5 = _nr; + _g5 = _ng; + _b5 = _nb; + _r6 = _nr2; + _g6 = _ng2; + _b6 = _nb2; + } + timelines.push(_timeline4); + break; + } + case SLOT_ALPHA: + { + var _timeline5 = new AlphaTimeline(frameCount, input.readInt(true), slotIndex); + var _time7 = input.readFloat(), + _a2 = input.readUnsignedByte() / 255; + for (var _frame5 = 0, _bezier4 = 0;; _frame5++) { + _timeline5.setFrame(_frame5, _time7, _a2); + if (_frame5 == frameLast) break; + var _time8 = input.readFloat(); + var _a3 = input.readUnsignedByte() / 255; + switch (input.readByte()) { + case CURVE_STEPPED: + _timeline5.setStepped(_frame5); + break; + case CURVE_BEZIER: + setBezier(input, _timeline5, _bezier4++, _frame5, 0, _time7, _time8, _a2, _a3, 1); + } + _time7 = _time8; + _a2 = _a3; + } + timelines.push(_timeline5); + break; + } + } + } + } + for (var _i15 = 0, _n4 = input.readInt(true); _i15 < _n4; _i15++) { + var boneIndex = input.readInt(true); + for (var _ii3 = 0, _nn3 = input.readInt(true); _ii3 < _nn3; _ii3++) { + var type = input.readByte(), + _frameCount = input.readInt(true), + _bezierCount4 = input.readInt(true); + switch (type) { + case BONE_ROTATE: + timelines.push(readTimeline1$1(input, new RotateTimeline(_frameCount, _bezierCount4, boneIndex), 1)); + break; + case BONE_TRANSLATE: + timelines.push(readTimeline2$1(input, new TranslateTimeline(_frameCount, _bezierCount4, boneIndex), scale)); + break; + case BONE_TRANSLATEX: + timelines.push(readTimeline1$1(input, new TranslateXTimeline(_frameCount, _bezierCount4, boneIndex), scale)); + break; + case BONE_TRANSLATEY: + timelines.push(readTimeline1$1(input, new TranslateYTimeline(_frameCount, _bezierCount4, boneIndex), scale)); + break; + case BONE_SCALE: + timelines.push(readTimeline2$1(input, new ScaleTimeline(_frameCount, _bezierCount4, boneIndex), 1)); + break; + case BONE_SCALEX: + timelines.push(readTimeline1$1(input, new ScaleXTimeline(_frameCount, _bezierCount4, boneIndex), 1)); + break; + case BONE_SCALEY: + timelines.push(readTimeline1$1(input, new ScaleYTimeline(_frameCount, _bezierCount4, boneIndex), 1)); + break; + case BONE_SHEAR: + timelines.push(readTimeline2$1(input, new ShearTimeline(_frameCount, _bezierCount4, boneIndex), 1)); + break; + case BONE_SHEARX: + timelines.push(readTimeline1$1(input, new ShearXTimeline(_frameCount, _bezierCount4, boneIndex), 1)); + break; + case BONE_SHEARY: + timelines.push(readTimeline1$1(input, new ShearYTimeline(_frameCount, _bezierCount4, boneIndex), 1)); + } + } + } + for (var _i16 = 0, _n5 = input.readInt(true); _i16 < _n5; _i16++) { + var index = input.readInt(true), + _frameCount2 = input.readInt(true), + _frameLast = _frameCount2 - 1; + var _timeline6 = new IkConstraintTimeline(_frameCount2, input.readInt(true), index); + var _time9 = input.readFloat(), + mix = input.readFloat(), + softness = input.readFloat() * scale; + for (var _frame6 = 0, _bezier5 = 0;; _frame6++) { + _timeline6.setFrame(_frame6, _time9, mix, softness, input.readByte(), input.readBoolean(), input.readBoolean()); + if (_frame6 == _frameLast) break; + var _time10 = input.readFloat(), + mix2 = input.readFloat(), + softness2 = input.readFloat() * scale; + switch (input.readByte()) { + case CURVE_STEPPED: + _timeline6.setStepped(_frame6); + break; + case CURVE_BEZIER: + setBezier(input, _timeline6, _bezier5++, _frame6, 0, _time9, _time10, mix, mix2, 1); + setBezier(input, _timeline6, _bezier5++, _frame6, 1, _time9, _time10, softness, softness2, scale); + } + _time9 = _time10; + mix = mix2; + softness = softness2; + } + timelines.push(_timeline6); + } + for (var _i17 = 0, _n6 = input.readInt(true); _i17 < _n6; _i17++) { + var _index = input.readInt(true), + _frameCount3 = input.readInt(true), + _frameLast2 = _frameCount3 - 1; + var _timeline7 = new TransformConstraintTimeline(_frameCount3, input.readInt(true), _index); + var _time11 = input.readFloat(), + mixRotate = input.readFloat(), + mixX = input.readFloat(), + mixY = input.readFloat(), + mixScaleX = input.readFloat(), + mixScaleY = input.readFloat(), + mixShearY = input.readFloat(); + for (var _frame7 = 0, _bezier6 = 0;; _frame7++) { + _timeline7.setFrame(_frame7, _time11, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY); + if (_frame7 == _frameLast2) break; + var _time12 = input.readFloat(), + mixRotate2 = input.readFloat(), + mixX2 = input.readFloat(), + mixY2 = input.readFloat(), + mixScaleX2 = input.readFloat(), + mixScaleY2 = input.readFloat(), + mixShearY2 = input.readFloat(); + switch (input.readByte()) { + case CURVE_STEPPED: + _timeline7.setStepped(_frame7); + break; + case CURVE_BEZIER: + setBezier(input, _timeline7, _bezier6++, _frame7, 0, _time11, _time12, mixRotate, mixRotate2, 1); + setBezier(input, _timeline7, _bezier6++, _frame7, 1, _time11, _time12, mixX, mixX2, 1); + setBezier(input, _timeline7, _bezier6++, _frame7, 2, _time11, _time12, mixY, mixY2, 1); + setBezier(input, _timeline7, _bezier6++, _frame7, 3, _time11, _time12, mixScaleX, mixScaleX2, 1); + setBezier(input, _timeline7, _bezier6++, _frame7, 4, _time11, _time12, mixScaleY, mixScaleY2, 1); + setBezier(input, _timeline7, _bezier6++, _frame7, 5, _time11, _time12, mixShearY, mixShearY2, 1); + } + _time11 = _time12; + mixRotate = mixRotate2; + mixX = mixX2; + mixY = mixY2; + mixScaleX = mixScaleX2; + mixScaleY = mixScaleY2; + mixShearY = mixShearY2; + } + timelines.push(_timeline7); + } + for (var _i18 = 0, _n7 = input.readInt(true); _i18 < _n7; _i18++) { + var _index2 = input.readInt(true); + var data = skeletonData.pathConstraints[_index2]; + for (var _ii4 = 0, _nn4 = input.readInt(true); _ii4 < _nn4; _ii4++) { + switch (input.readByte()) { + case PATH_POSITION: + timelines.push(readTimeline1$1(input, new PathConstraintPositionTimeline(input.readInt(true), input.readInt(true), _index2), data.positionMode == PositionMode.Fixed ? scale : 1)); + break; + case PATH_SPACING: + timelines.push(readTimeline1$1(input, new PathConstraintSpacingTimeline(input.readInt(true), input.readInt(true), _index2), data.spacingMode == SpacingMode.Length || data.spacingMode == SpacingMode.Fixed ? scale : 1)); + break; + case PATH_MIX: + var _timeline8 = new PathConstraintMixTimeline(input.readInt(true), input.readInt(true), _index2); + var _time13 = input.readFloat(), + _mixRotate = input.readFloat(), + _mixX = input.readFloat(), + _mixY = input.readFloat(); + for (var _frame8 = 0, _bezier7 = 0, _frameLast3 = _timeline8.getFrameCount() - 1;; _frame8++) { + _timeline8.setFrame(_frame8, _time13, _mixRotate, _mixX, _mixY); + if (_frame8 == _frameLast3) break; + var _time14 = input.readFloat(), + _mixRotate2 = input.readFloat(), + _mixX2 = input.readFloat(), + _mixY2 = input.readFloat(); + switch (input.readByte()) { + case CURVE_STEPPED: + _timeline8.setStepped(_frame8); + break; + case CURVE_BEZIER: + setBezier(input, _timeline8, _bezier7++, _frame8, 0, _time13, _time14, _mixRotate, _mixRotate2, 1); + setBezier(input, _timeline8, _bezier7++, _frame8, 1, _time13, _time14, _mixX, _mixX2, 1); + setBezier(input, _timeline8, _bezier7++, _frame8, 2, _time13, _time14, _mixY, _mixY2, 1); + } + _time13 = _time14; + _mixRotate = _mixRotate2; + _mixX = _mixX2; + _mixY = _mixY2; + } + timelines.push(_timeline8); + } + } + } + for (var _i19 = 0, _n8 = input.readInt(true); _i19 < _n8; _i19++) { + var skin = skeletonData.skins[input.readInt(true)]; + for (var _ii5 = 0, _nn5 = input.readInt(true); _ii5 < _nn5; _ii5++) { + var _slotIndex = input.readInt(true); + for (var iii = 0, nnn = input.readInt(true); iii < nnn; iii++) { + var attachmentName = input.readStringRef(); + var attachment = skin.getAttachment(_slotIndex, attachmentName); + var weighted = attachment.bones; + var vertices = attachment.vertices; + var deformLength = weighted ? vertices.length / 3 * 2 : vertices.length; + var _frameCount4 = input.readInt(true); + var _frameLast4 = _frameCount4 - 1; + var _bezierCount5 = input.readInt(true); + var _timeline9 = new DeformTimeline(_frameCount4, _bezierCount5, _slotIndex, attachment); + var _time15 = input.readFloat(); + for (var _frame9 = 0, _bezier8 = 0;; _frame9++) { + var deform = void 0; + var end = input.readInt(true); + if (end == 0) deform = weighted ? Utils.newFloatArray(deformLength) : vertices;else { + deform = Utils.newFloatArray(deformLength); + var start = input.readInt(true); + end += start; + if (scale == 1) { + for (var v = start; v < end; v++) deform[v] = input.readFloat(); + } else { + for (var _v = start; _v < end; _v++) deform[_v] = input.readFloat() * scale; + } + if (!weighted) { + for (var _v2 = 0, vn = deform.length; _v2 < vn; _v2++) deform[_v2] += vertices[_v2]; + } + } + _timeline9.setFrame(_frame9, _time15, deform); + if (_frame9 == _frameLast4) break; + var _time16 = input.readFloat(); + switch (input.readByte()) { + case CURVE_STEPPED: + _timeline9.setStepped(_frame9); + break; + case CURVE_BEZIER: + setBezier(input, _timeline9, _bezier8++, _frame9, 0, _time15, _time16, 0, 1, 1); + } + _time15 = _time16; + } + timelines.push(_timeline9); + } + } + } + var drawOrderCount = input.readInt(true); + if (drawOrderCount > 0) { + var _timeline10 = new DrawOrderTimeline(drawOrderCount); + var slotCount = skeletonData.slots.length; + for (var _i20 = 0; _i20 < drawOrderCount; _i20++) { + var _time17 = input.readFloat(); + var offsetCount = input.readInt(true); + var drawOrder = Utils.newArray(slotCount, 0); + for (var _ii6 = slotCount - 1; _ii6 >= 0; _ii6--) drawOrder[_ii6] = -1; + var unchanged = Utils.newArray(slotCount - offsetCount, 0); + var originalIndex = 0, + unchangedIndex = 0; + for (var _ii7 = 0; _ii7 < offsetCount; _ii7++) { + var _slotIndex2 = input.readInt(true); + while (originalIndex != _slotIndex2) unchanged[unchangedIndex++] = originalIndex++; + drawOrder[originalIndex + input.readInt(true)] = originalIndex++; + } + while (originalIndex < slotCount) unchanged[unchangedIndex++] = originalIndex++; + for (var _ii8 = slotCount - 1; _ii8 >= 0; _ii8--) if (drawOrder[_ii8] == -1) drawOrder[_ii8] = unchanged[--unchangedIndex]; + _timeline10.setFrame(_i20, _time17, drawOrder); + } + timelines.push(_timeline10); + } + var eventCount = input.readInt(true); + if (eventCount > 0) { + var _timeline11 = new EventTimeline(eventCount); + for (var _i21 = 0; _i21 < eventCount; _i21++) { + var _time18 = input.readFloat(); + var eventData = skeletonData.events[input.readInt(true)]; + var event = new Event(_time18, eventData); + event.intValue = input.readInt(false); + event.floatValue = input.readFloat(); + event.stringValue = input.readBoolean() ? input.readString() : eventData.stringValue; + if (event.data.audioPath) { + event.volume = input.readFloat(); + event.balance = input.readFloat(); + } + _timeline11.setFrame(_i21, event); + } + timelines.push(_timeline11); + } + var duration = 0; + for (var _i22 = 0, _n9 = timelines.length; _i22 < _n9; _i22++) duration = Math.max(duration, timelines[_i22].getDuration()); + return new Animation(name, timelines, duration); + } + }]); + return SkeletonBinary; + }(); + var BinaryInput = function () { + function BinaryInput(data) { + var strings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Array(); + var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + var buffer = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new DataView(data.buffer); + _classCallCheck(this, BinaryInput); + this.strings = strings; + this.index = index; + this.buffer = buffer; + } + _createClass(BinaryInput, [{ + key: "readByte", + value: function readByte() { + return this.buffer.getInt8(this.index++); + } + }, { + key: "readUnsignedByte", + value: function readUnsignedByte() { + return this.buffer.getUint8(this.index++); + } + }, { + key: "readShort", + value: function readShort() { + var value = this.buffer.getInt16(this.index); + this.index += 2; + return value; + } + }, { + key: "readInt32", + value: function readInt32() { + var value = this.buffer.getInt32(this.index); + this.index += 4; + return value; + } + }, { + key: "readInt", + value: function readInt(optimizePositive) { + var b = this.readByte(); + var result = b & 0x7F; + if ((b & 0x80) != 0) { + b = this.readByte(); + result |= (b & 0x7F) << 7; + if ((b & 0x80) != 0) { + b = this.readByte(); + result |= (b & 0x7F) << 14; + if ((b & 0x80) != 0) { + b = this.readByte(); + result |= (b & 0x7F) << 21; + if ((b & 0x80) != 0) { + b = this.readByte(); + result |= (b & 0x7F) << 28; + } + } + } + } + return optimizePositive ? result : result >>> 1 ^ -(result & 1); + } + }, { + key: "readStringRef", + value: function readStringRef() { + var index = this.readInt(true); + return index == 0 ? null : this.strings[index - 1]; + } + }, { + key: "readString", + value: function readString() { + var byteCount = this.readInt(true); + switch (byteCount) { + case 0: + return null; + case 1: + return ""; + } + byteCount--; + var chars = ""; + for (var i = 0; i < byteCount;) { + var b = this.readUnsignedByte(); + switch (b >> 4) { + case 12: + case 13: + chars += String.fromCharCode((b & 0x1F) << 6 | this.readByte() & 0x3F); + i += 2; + break; + case 14: + chars += String.fromCharCode((b & 0x0F) << 12 | (this.readByte() & 0x3F) << 6 | this.readByte() & 0x3F); + i += 3; + break; + default: + chars += String.fromCharCode(b); + i++; + } + } + return chars; + } + }, { + key: "readFloat", + value: function readFloat() { + var value = this.buffer.getFloat32(this.index); + this.index += 4; + return value; + } + }, { + key: "readBoolean", + value: function readBoolean() { + return this.readByte() != 0; + } + }]); + return BinaryInput; + }(); + var LinkedMesh$1 = _createClass(function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) { + _classCallCheck(this, LinkedMesh); + this.mesh = mesh; + this.skin = skin; + this.slotIndex = slotIndex; + this.parent = parent; + this.inheritDeform = inheritDeform; + }); + var Vertices = _createClass(function Vertices() { + var bones = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var vertices = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + _classCallCheck(this, Vertices); + this.bones = bones; + this.vertices = vertices; + }); + var AttachmentType; + (function (AttachmentType) { + AttachmentType[AttachmentType["Region"] = 0] = "Region"; + AttachmentType[AttachmentType["BoundingBox"] = 1] = "BoundingBox"; + AttachmentType[AttachmentType["Mesh"] = 2] = "Mesh"; + AttachmentType[AttachmentType["LinkedMesh"] = 3] = "LinkedMesh"; + AttachmentType[AttachmentType["Path"] = 4] = "Path"; + AttachmentType[AttachmentType["Point"] = 5] = "Point"; + AttachmentType[AttachmentType["Clipping"] = 6] = "Clipping"; + })(AttachmentType || (AttachmentType = {})); + function readTimeline1$1(input, timeline, scale) { + var time = input.readFloat(), + value = input.readFloat() * scale; + for (var frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1;; frame++) { + timeline.setFrame(frame, time, value); + if (frame == frameLast) break; + var time2 = input.readFloat(), + value2 = input.readFloat() * scale; + switch (input.readByte()) { + case CURVE_STEPPED: + timeline.setStepped(frame); + break; + case CURVE_BEZIER: + setBezier(input, timeline, bezier++, frame, 0, time, time2, value, value2, scale); + } + time = time2; + value = value2; + } + return timeline; + } + function readTimeline2$1(input, timeline, scale) { + var time = input.readFloat(), + value1 = input.readFloat() * scale, + value2 = input.readFloat() * scale; + for (var frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1;; frame++) { + timeline.setFrame(frame, time, value1, value2); + if (frame == frameLast) break; + var time2 = input.readFloat(), + nvalue1 = input.readFloat() * scale, + nvalue2 = input.readFloat() * scale; + switch (input.readByte()) { + case CURVE_STEPPED: + timeline.setStepped(frame); + break; + case CURVE_BEZIER: + setBezier(input, timeline, bezier++, frame, 0, time, time2, value1, nvalue1, scale); + setBezier(input, timeline, bezier++, frame, 1, time, time2, value2, nvalue2, scale); + } + time = time2; + value1 = nvalue1; + value2 = nvalue2; + } + return timeline; + } + function setBezier(input, timeline, bezier, frame, value, time1, time2, value1, value2, scale) { + timeline.setBezier(bezier, frame, value, time1, value1, input.readFloat(), input.readFloat() * scale, input.readFloat(), input.readFloat() * scale, time2, value2); + } + var BONE_ROTATE = 0; + var BONE_TRANSLATE = 1; + var BONE_TRANSLATEX = 2; + var BONE_TRANSLATEY = 3; + var BONE_SCALE = 4; + var BONE_SCALEX = 5; + var BONE_SCALEY = 6; + var BONE_SHEAR = 7; + var BONE_SHEARX = 8; + var BONE_SHEARY = 9; + var SLOT_ATTACHMENT = 0; + var SLOT_RGBA = 1; + var SLOT_RGB = 2; + var SLOT_RGBA2 = 3; + var SLOT_RGB2 = 4; + var SLOT_ALPHA = 5; + var PATH_POSITION = 0; + var PATH_SPACING = 1; + var PATH_MIX = 2; + var CURVE_STEPPED = 1; + var CURVE_BEZIER = 2; + + var SkeletonBounds = function () { + function SkeletonBounds() { + _classCallCheck(this, SkeletonBounds); + this.minX = 0; + this.minY = 0; + this.maxX = 0; + this.maxY = 0; + this.boundingBoxes = new Array(); + this.polygons = new Array(); + this.polygonPool = new Pool(function () { + return Utils.newFloatArray(16); + }); + } + _createClass(SkeletonBounds, [{ + key: "update", + value: function update(skeleton, updateAabb) { + if (!skeleton) throw new Error("skeleton cannot be null."); + var boundingBoxes = this.boundingBoxes; + var polygons = this.polygons; + var polygonPool = this.polygonPool; + var slots = skeleton.slots; + var slotCount = slots.length; + boundingBoxes.length = 0; + polygonPool.freeAll(polygons); + polygons.length = 0; + for (var i = 0; i < slotCount; i++) { + var slot = slots[i]; + if (!slot.bone.active) continue; + var attachment = slot.getAttachment(); + if (attachment instanceof BoundingBoxAttachment) { + var boundingBox = attachment; + boundingBoxes.push(boundingBox); + var polygon = polygonPool.obtain(); + if (polygon.length != boundingBox.worldVerticesLength) { + polygon = Utils.newFloatArray(boundingBox.worldVerticesLength); + } + polygons.push(polygon); + boundingBox.computeWorldVertices(slot, 0, boundingBox.worldVerticesLength, polygon, 0, 2); + } + } + if (updateAabb) { + this.aabbCompute(); + } else { + this.minX = Number.POSITIVE_INFINITY; + this.minY = Number.POSITIVE_INFINITY; + this.maxX = Number.NEGATIVE_INFINITY; + this.maxY = Number.NEGATIVE_INFINITY; + } + } + }, { + key: "aabbCompute", + value: function aabbCompute() { + var minX = Number.POSITIVE_INFINITY, + minY = Number.POSITIVE_INFINITY, + maxX = Number.NEGATIVE_INFINITY, + maxY = Number.NEGATIVE_INFINITY; + var polygons = this.polygons; + for (var i = 0, n = polygons.length; i < n; i++) { + var polygon = polygons[i]; + var vertices = polygon; + for (var ii = 0, nn = polygon.length; ii < nn; ii += 2) { + var x = vertices[ii]; + var y = vertices[ii + 1]; + minX = Math.min(minX, x); + minY = Math.min(minY, y); + maxX = Math.max(maxX, x); + maxY = Math.max(maxY, y); + } + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + } + }, { + key: "aabbContainsPoint", + value: function aabbContainsPoint(x, y) { + return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY; + } + }, { + key: "aabbIntersectsSegment", + value: function aabbIntersectsSegment(x1, y1, x2, y2) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + if (x1 <= minX && x2 <= minX || y1 <= minY && y2 <= minY || x1 >= maxX && x2 >= maxX || y1 >= maxY && y2 >= maxY) return false; + var m = (y2 - y1) / (x2 - x1); + var y = m * (minX - x1) + y1; + if (y > minY && y < maxY) return true; + y = m * (maxX - x1) + y1; + if (y > minY && y < maxY) return true; + var x = (minY - y1) / m + x1; + if (x > minX && x < maxX) return true; + x = (maxY - y1) / m + x1; + if (x > minX && x < maxX) return true; + return false; + } + }, { + key: "aabbIntersectsSkeleton", + value: function aabbIntersectsSkeleton(bounds) { + return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY; + } + }, { + key: "containsPoint", + value: function containsPoint(x, y) { + var polygons = this.polygons; + for (var i = 0, n = polygons.length; i < n; i++) if (this.containsPointPolygon(polygons[i], x, y)) return this.boundingBoxes[i]; + return null; + } + }, { + key: "containsPointPolygon", + value: function containsPointPolygon(polygon, x, y) { + var vertices = polygon; + var nn = polygon.length; + var prevIndex = nn - 2; + var inside = false; + for (var ii = 0; ii < nn; ii += 2) { + var vertexY = vertices[ii + 1]; + var prevY = vertices[prevIndex + 1]; + if (vertexY < y && prevY >= y || prevY < y && vertexY >= y) { + var vertexX = vertices[ii]; + if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x) inside = !inside; + } + prevIndex = ii; + } + return inside; + } + }, { + key: "intersectsSegment", + value: function intersectsSegment(x1, y1, x2, y2) { + var polygons = this.polygons; + for (var i = 0, n = polygons.length; i < n; i++) if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) return this.boundingBoxes[i]; + return null; + } + }, { + key: "intersectsSegmentPolygon", + value: function intersectsSegmentPolygon(polygon, x1, y1, x2, y2) { + var vertices = polygon; + var nn = polygon.length; + var width12 = x1 - x2, + height12 = y1 - y2; + var det1 = x1 * y2 - y1 * x2; + var x3 = vertices[nn - 2], + y3 = vertices[nn - 1]; + for (var ii = 0; ii < nn; ii += 2) { + var x4 = vertices[ii], + y4 = vertices[ii + 1]; + var det2 = x3 * y4 - y3 * x4; + var width34 = x3 - x4, + height34 = y3 - y4; + var det3 = width12 * height34 - height12 * width34; + var x = (det1 * width34 - width12 * det2) / det3; + if ((x >= x3 && x <= x4 || x >= x4 && x <= x3) && (x >= x1 && x <= x2 || x >= x2 && x <= x1)) { + var y = (det1 * height34 - height12 * det2) / det3; + if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1)) return true; + } + x3 = x4; + y3 = y4; + } + return false; + } + }, { + key: "getPolygon", + value: function getPolygon(boundingBox) { + if (!boundingBox) throw new Error("boundingBox cannot be null."); + var index = this.boundingBoxes.indexOf(boundingBox); + return index == -1 ? null : this.polygons[index]; + } + }, { + key: "getWidth", + value: function getWidth() { + return this.maxX - this.minX; + } + }, { + key: "getHeight", + value: function getHeight() { + return this.maxY - this.minY; + } + }]); + return SkeletonBounds; + }(); + + var Triangulator = function () { + function Triangulator() { + _classCallCheck(this, Triangulator); + this.convexPolygons = new Array(); + this.convexPolygonsIndices = new Array(); + this.indicesArray = new Array(); + this.isConcaveArray = new Array(); + this.triangles = new Array(); + this.polygonPool = new Pool(function () { + return new Array(); + }); + this.polygonIndicesPool = new Pool(function () { + return new Array(); + }); + } + _createClass(Triangulator, [{ + key: "triangulate", + value: function triangulate(verticesArray) { + var vertices = verticesArray; + var vertexCount = verticesArray.length >> 1; + var indices = this.indicesArray; + indices.length = 0; + for (var i = 0; i < vertexCount; i++) indices[i] = i; + var isConcave = this.isConcaveArray; + isConcave.length = 0; + for (var _i = 0, n = vertexCount; _i < n; ++_i) isConcave[_i] = Triangulator.isConcave(_i, vertexCount, vertices, indices); + var triangles = this.triangles; + triangles.length = 0; + while (vertexCount > 3) { + var previous = vertexCount - 1, + _i2 = 0, + next = 1; + while (true) { + outer: if (!isConcave[_i2]) { + var p1 = indices[previous] << 1, + p2 = indices[_i2] << 1, + p3 = indices[next] << 1; + var p1x = vertices[p1], + p1y = vertices[p1 + 1]; + var p2x = vertices[p2], + p2y = vertices[p2 + 1]; + var p3x = vertices[p3], + p3y = vertices[p3 + 1]; + for (var ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) { + if (!isConcave[ii]) continue; + var v = indices[ii] << 1; + var vx = vertices[v], + vy = vertices[v + 1]; + if (Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) { + if (Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) { + if (Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy)) break outer; + } + } + } + break; + } + if (next == 0) { + do { + if (!isConcave[_i2]) break; + _i2--; + } while (_i2 > 0); + break; + } + previous = _i2; + _i2 = next; + next = (next + 1) % vertexCount; + } + triangles.push(indices[(vertexCount + _i2 - 1) % vertexCount]); + triangles.push(indices[_i2]); + triangles.push(indices[(_i2 + 1) % vertexCount]); + indices.splice(_i2, 1); + isConcave.splice(_i2, 1); + vertexCount--; + var previousIndex = (vertexCount + _i2 - 1) % vertexCount; + var nextIndex = _i2 == vertexCount ? 0 : _i2; + isConcave[previousIndex] = Triangulator.isConcave(previousIndex, vertexCount, vertices, indices); + isConcave[nextIndex] = Triangulator.isConcave(nextIndex, vertexCount, vertices, indices); + } + if (vertexCount == 3) { + triangles.push(indices[2]); + triangles.push(indices[0]); + triangles.push(indices[1]); + } + return triangles; + } + }, { + key: "decompose", + value: function decompose(verticesArray, triangles) { + var vertices = verticesArray; + var convexPolygons = this.convexPolygons; + this.polygonPool.freeAll(convexPolygons); + convexPolygons.length = 0; + var convexPolygonsIndices = this.convexPolygonsIndices; + this.polygonIndicesPool.freeAll(convexPolygonsIndices); + convexPolygonsIndices.length = 0; + var polygonIndices = this.polygonIndicesPool.obtain(); + polygonIndices.length = 0; + var polygon = this.polygonPool.obtain(); + polygon.length = 0; + var fanBaseIndex = -1, + lastWinding = 0; + for (var i = 0, n = triangles.length; i < n; i += 3) { + var t1 = triangles[i] << 1, + t2 = triangles[i + 1] << 1, + t3 = triangles[i + 2] << 1; + var x1 = vertices[t1], + y1 = vertices[t1 + 1]; + var x2 = vertices[t2], + y2 = vertices[t2 + 1]; + var x3 = vertices[t3], + y3 = vertices[t3 + 1]; + var merged = false; + if (fanBaseIndex == t1) { + var o = polygon.length - 4; + var winding1 = Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3); + var winding2 = Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]); + if (winding1 == lastWinding && winding2 == lastWinding) { + polygon.push(x3); + polygon.push(y3); + polygonIndices.push(t3); + merged = true; + } + } + if (!merged) { + if (polygon.length > 0) { + convexPolygons.push(polygon); + convexPolygonsIndices.push(polygonIndices); + } else { + this.polygonPool.free(polygon); + this.polygonIndicesPool.free(polygonIndices); + } + polygon = this.polygonPool.obtain(); + polygon.length = 0; + polygon.push(x1); + polygon.push(y1); + polygon.push(x2); + polygon.push(y2); + polygon.push(x3); + polygon.push(y3); + polygonIndices = this.polygonIndicesPool.obtain(); + polygonIndices.length = 0; + polygonIndices.push(t1); + polygonIndices.push(t2); + polygonIndices.push(t3); + lastWinding = Triangulator.winding(x1, y1, x2, y2, x3, y3); + fanBaseIndex = t1; + } + } + if (polygon.length > 0) { + convexPolygons.push(polygon); + convexPolygonsIndices.push(polygonIndices); + } + for (var _i3 = 0, _n = convexPolygons.length; _i3 < _n; _i3++) { + polygonIndices = convexPolygonsIndices[_i3]; + if (polygonIndices.length == 0) continue; + var firstIndex = polygonIndices[0]; + var lastIndex = polygonIndices[polygonIndices.length - 1]; + polygon = convexPolygons[_i3]; + var _o = polygon.length - 4; + var prevPrevX = polygon[_o], + prevPrevY = polygon[_o + 1]; + var prevX = polygon[_o + 2], + prevY = polygon[_o + 3]; + var firstX = polygon[0], + firstY = polygon[1]; + var secondX = polygon[2], + secondY = polygon[3]; + var winding = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY); + for (var ii = 0; ii < _n; ii++) { + if (ii == _i3) continue; + var otherIndices = convexPolygonsIndices[ii]; + if (otherIndices.length != 3) continue; + var otherFirstIndex = otherIndices[0]; + var otherSecondIndex = otherIndices[1]; + var otherLastIndex = otherIndices[2]; + var otherPoly = convexPolygons[ii]; + var _x = otherPoly[otherPoly.length - 2], + _y = otherPoly[otherPoly.length - 1]; + if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) continue; + var _winding = Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, _x, _y); + var _winding2 = Triangulator.winding(_x, _y, firstX, firstY, secondX, secondY); + if (_winding == winding && _winding2 == winding) { + otherPoly.length = 0; + otherIndices.length = 0; + polygon.push(_x); + polygon.push(_y); + polygonIndices.push(otherLastIndex); + prevPrevX = prevX; + prevPrevY = prevY; + prevX = _x; + prevY = _y; + ii = 0; + } + } + } + for (var _i4 = convexPolygons.length - 1; _i4 >= 0; _i4--) { + polygon = convexPolygons[_i4]; + if (polygon.length == 0) { + convexPolygons.splice(_i4, 1); + this.polygonPool.free(polygon); + polygonIndices = convexPolygonsIndices[_i4]; + convexPolygonsIndices.splice(_i4, 1); + this.polygonIndicesPool.free(polygonIndices); + } + } + return convexPolygons; + } + }], [{ + key: "isConcave", + value: function isConcave(index, vertexCount, vertices, indices) { + var previous = indices[(vertexCount + index - 1) % vertexCount] << 1; + var current = indices[index] << 1; + var next = indices[(index + 1) % vertexCount] << 1; + return !this.positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], vertices[next], vertices[next + 1]); + } + }, { + key: "positiveArea", + value: function positiveArea(p1x, p1y, p2x, p2y, p3x, p3y) { + return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0; + } + }, { + key: "winding", + value: function winding(p1x, p1y, p2x, p2y, p3x, p3y) { + var px = p2x - p1x, + py = p2y - p1y; + return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1; + } + }]); + return Triangulator; + }(); + + var SkeletonClipping = function () { + function SkeletonClipping() { + _classCallCheck(this, SkeletonClipping); + this.triangulator = new Triangulator(); + this.clippingPolygon = new Array(); + this.clipOutput = new Array(); + this.clippedVertices = new Array(); + this.clippedTriangles = new Array(); + this.scratch = new Array(); + } + _createClass(SkeletonClipping, [{ + key: "clipStart", + value: function clipStart(slot, clip) { + if (this.clipAttachment) return 0; + this.clipAttachment = clip; + var n = clip.worldVerticesLength; + var vertices = Utils.setArraySize(this.clippingPolygon, n); + clip.computeWorldVertices(slot, 0, n, vertices, 0, 2); + var clippingPolygon = this.clippingPolygon; + SkeletonClipping.makeClockwise(clippingPolygon); + var clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon)); + for (var i = 0, _n = clippingPolygons.length; i < _n; i++) { + var polygon = clippingPolygons[i]; + SkeletonClipping.makeClockwise(polygon); + polygon.push(polygon[0]); + polygon.push(polygon[1]); + } + return clippingPolygons.length; + } + }, { + key: "clipEndWithSlot", + value: function clipEndWithSlot(slot) { + if (this.clipAttachment && this.clipAttachment.endSlot == slot.data) this.clipEnd(); + } + }, { + key: "clipEnd", + value: function clipEnd() { + if (!this.clipAttachment) return; + this.clipAttachment = null; + this.clippingPolygons = null; + this.clippedVertices.length = 0; + this.clippedTriangles.length = 0; + this.clippingPolygon.length = 0; + } + }, { + key: "isClipping", + value: function isClipping() { + return this.clipAttachment != null; + } + }, { + key: "clipTriangles", + value: function clipTriangles(vertices, verticesLength, triangles, trianglesLength, uvs, light, dark, twoColor) { + var clipOutput = this.clipOutput, + clippedVertices = this.clippedVertices; + var clippedTriangles = this.clippedTriangles; + var polygons = this.clippingPolygons; + var polygonsCount = this.clippingPolygons.length; + var vertexSize = twoColor ? 12 : 8; + var index = 0; + clippedVertices.length = 0; + clippedTriangles.length = 0; + outer: for (var i = 0; i < trianglesLength; i += 3) { + var vertexOffset = triangles[i] << 1; + var x1 = vertices[vertexOffset], + y1 = vertices[vertexOffset + 1]; + var u1 = uvs[vertexOffset], + v1 = uvs[vertexOffset + 1]; + vertexOffset = triangles[i + 1] << 1; + var x2 = vertices[vertexOffset], + y2 = vertices[vertexOffset + 1]; + var u2 = uvs[vertexOffset], + v2 = uvs[vertexOffset + 1]; + vertexOffset = triangles[i + 2] << 1; + var x3 = vertices[vertexOffset], + y3 = vertices[vertexOffset + 1]; + var u3 = uvs[vertexOffset], + v3 = uvs[vertexOffset + 1]; + for (var p = 0; p < polygonsCount; p++) { + var s = clippedVertices.length; + if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) { + var clipOutputLength = clipOutput.length; + if (clipOutputLength == 0) continue; + var d0 = y2 - y3, + d1 = x3 - x2, + d2 = x1 - x3, + d4 = y3 - y1; + var d = 1 / (d0 * d2 + d1 * (y1 - y3)); + var clipOutputCount = clipOutputLength >> 1; + var clipOutputItems = this.clipOutput; + var clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * vertexSize); + for (var ii = 0; ii < clipOutputLength; ii += 2) { + var x = clipOutputItems[ii], + y = clipOutputItems[ii + 1]; + clippedVerticesItems[s] = x; + clippedVerticesItems[s + 1] = y; + clippedVerticesItems[s + 2] = light.r; + clippedVerticesItems[s + 3] = light.g; + clippedVerticesItems[s + 4] = light.b; + clippedVerticesItems[s + 5] = light.a; + var c0 = x - x3, + c1 = y - y3; + var a = (d0 * c0 + d1 * c1) * d; + var b = (d4 * c0 + d2 * c1) * d; + var c = 1 - a - b; + clippedVerticesItems[s + 6] = u1 * a + u2 * b + u3 * c; + clippedVerticesItems[s + 7] = v1 * a + v2 * b + v3 * c; + if (twoColor) { + clippedVerticesItems[s + 8] = dark.r; + clippedVerticesItems[s + 9] = dark.g; + clippedVerticesItems[s + 10] = dark.b; + clippedVerticesItems[s + 11] = dark.a; + } + s += vertexSize; + } + s = clippedTriangles.length; + var clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3 * (clipOutputCount - 2)); + clipOutputCount--; + for (var _ii = 1; _ii < clipOutputCount; _ii++) { + clippedTrianglesItems[s] = index; + clippedTrianglesItems[s + 1] = index + _ii; + clippedTrianglesItems[s + 2] = index + _ii + 1; + s += 3; + } + index += clipOutputCount + 1; + } else { + var _clippedVerticesItems = Utils.setArraySize(clippedVertices, s + 3 * vertexSize); + _clippedVerticesItems[s] = x1; + _clippedVerticesItems[s + 1] = y1; + _clippedVerticesItems[s + 2] = light.r; + _clippedVerticesItems[s + 3] = light.g; + _clippedVerticesItems[s + 4] = light.b; + _clippedVerticesItems[s + 5] = light.a; + if (!twoColor) { + _clippedVerticesItems[s + 6] = u1; + _clippedVerticesItems[s + 7] = v1; + _clippedVerticesItems[s + 8] = x2; + _clippedVerticesItems[s + 9] = y2; + _clippedVerticesItems[s + 10] = light.r; + _clippedVerticesItems[s + 11] = light.g; + _clippedVerticesItems[s + 12] = light.b; + _clippedVerticesItems[s + 13] = light.a; + _clippedVerticesItems[s + 14] = u2; + _clippedVerticesItems[s + 15] = v2; + _clippedVerticesItems[s + 16] = x3; + _clippedVerticesItems[s + 17] = y3; + _clippedVerticesItems[s + 18] = light.r; + _clippedVerticesItems[s + 19] = light.g; + _clippedVerticesItems[s + 20] = light.b; + _clippedVerticesItems[s + 21] = light.a; + _clippedVerticesItems[s + 22] = u3; + _clippedVerticesItems[s + 23] = v3; + } else { + _clippedVerticesItems[s + 6] = u1; + _clippedVerticesItems[s + 7] = v1; + _clippedVerticesItems[s + 8] = dark.r; + _clippedVerticesItems[s + 9] = dark.g; + _clippedVerticesItems[s + 10] = dark.b; + _clippedVerticesItems[s + 11] = dark.a; + _clippedVerticesItems[s + 12] = x2; + _clippedVerticesItems[s + 13] = y2; + _clippedVerticesItems[s + 14] = light.r; + _clippedVerticesItems[s + 15] = light.g; + _clippedVerticesItems[s + 16] = light.b; + _clippedVerticesItems[s + 17] = light.a; + _clippedVerticesItems[s + 18] = u2; + _clippedVerticesItems[s + 19] = v2; + _clippedVerticesItems[s + 20] = dark.r; + _clippedVerticesItems[s + 21] = dark.g; + _clippedVerticesItems[s + 22] = dark.b; + _clippedVerticesItems[s + 23] = dark.a; + _clippedVerticesItems[s + 24] = x3; + _clippedVerticesItems[s + 25] = y3; + _clippedVerticesItems[s + 26] = light.r; + _clippedVerticesItems[s + 27] = light.g; + _clippedVerticesItems[s + 28] = light.b; + _clippedVerticesItems[s + 29] = light.a; + _clippedVerticesItems[s + 30] = u3; + _clippedVerticesItems[s + 31] = v3; + _clippedVerticesItems[s + 32] = dark.r; + _clippedVerticesItems[s + 33] = dark.g; + _clippedVerticesItems[s + 34] = dark.b; + _clippedVerticesItems[s + 35] = dark.a; + } + s = clippedTriangles.length; + var _clippedTrianglesItems = Utils.setArraySize(clippedTriangles, s + 3); + _clippedTrianglesItems[s] = index; + _clippedTrianglesItems[s + 1] = index + 1; + _clippedTrianglesItems[s + 2] = index + 2; + index += 3; + continue outer; + } + } + } + } + }, { + key: "clip", + value: function clip(x1, y1, x2, y2, x3, y3, clippingArea, output) { + var originalOutput = output; + var clipped = false; + var input = null; + if (clippingArea.length % 4 >= 2) { + input = output; + output = this.scratch; + } else input = this.scratch; + input.length = 0; + input.push(x1); + input.push(y1); + input.push(x2); + input.push(y2); + input.push(x3); + input.push(y3); + input.push(x1); + input.push(y1); + output.length = 0; + var clippingVertices = clippingArea; + var clippingVerticesLast = clippingArea.length - 4; + for (var i = 0;; i += 2) { + var edgeX = clippingVertices[i], + edgeY = clippingVertices[i + 1]; + var edgeX2 = clippingVertices[i + 2], + edgeY2 = clippingVertices[i + 3]; + var deltaX = edgeX - edgeX2, + deltaY = edgeY - edgeY2; + var inputVertices = input; + var inputVerticesLength = input.length - 2, + outputStart = output.length; + for (var ii = 0; ii < inputVerticesLength; ii += 2) { + var inputX = inputVertices[ii], + inputY = inputVertices[ii + 1]; + var inputX2 = inputVertices[ii + 2], + inputY2 = inputVertices[ii + 3]; + var side2 = deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0; + if (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0) { + if (side2) { + output.push(inputX2); + output.push(inputY2); + continue; + } + var c0 = inputY2 - inputY, + c2 = inputX2 - inputX; + var s = c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY); + if (Math.abs(s) > 0.000001) { + var ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / s; + output.push(edgeX + (edgeX2 - edgeX) * ua); + output.push(edgeY + (edgeY2 - edgeY) * ua); + } else { + output.push(edgeX); + output.push(edgeY); + } + } else if (side2) { + var _c = inputY2 - inputY, + _c2 = inputX2 - inputX; + var _s = _c * (edgeX2 - edgeX) - _c2 * (edgeY2 - edgeY); + if (Math.abs(_s) > 0.000001) { + var _ua = (_c2 * (edgeY - inputY) - _c * (edgeX - inputX)) / _s; + output.push(edgeX + (edgeX2 - edgeX) * _ua); + output.push(edgeY + (edgeY2 - edgeY) * _ua); + } else { + output.push(edgeX); + output.push(edgeY); + } + output.push(inputX2); + output.push(inputY2); + } + clipped = true; + } + if (outputStart == output.length) { + originalOutput.length = 0; + return true; + } + output.push(output[0]); + output.push(output[1]); + if (i == clippingVerticesLast) break; + var temp = output; + output = input; + output.length = 0; + input = temp; + } + if (originalOutput != output) { + originalOutput.length = 0; + for (var _i = 0, n = output.length - 2; _i < n; _i++) originalOutput[_i] = output[_i]; + } else originalOutput.length = originalOutput.length - 2; + return clipped; + } + }], [{ + key: "makeClockwise", + value: function makeClockwise(polygon) { + var vertices = polygon; + var verticeslength = polygon.length; + var area = vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], + p1x = 0, + p1y = 0, + p2x = 0, + p2y = 0; + for (var i = 0, n = verticeslength - 3; i < n; i += 2) { + p1x = vertices[i]; + p1y = vertices[i + 1]; + p2x = vertices[i + 2]; + p2y = vertices[i + 3]; + area += p1x * p2y - p2x * p1y; + } + if (area < 0) return; + for (var _i2 = 0, lastX = verticeslength - 2, _n2 = verticeslength >> 1; _i2 < _n2; _i2 += 2) { + var x = vertices[_i2], + y = vertices[_i2 + 1]; + var other = lastX - _i2; + vertices[_i2] = vertices[other]; + vertices[_i2 + 1] = vertices[other + 1]; + vertices[other] = x; + vertices[other + 1] = y; + } + } + }]); + return SkeletonClipping; + }(); + + var SkeletonJson = function () { + function SkeletonJson(attachmentLoader) { + _classCallCheck(this, SkeletonJson); + this.attachmentLoader = null; + this.scale = 1; + this.linkedMeshes = new Array(); + this.attachmentLoader = attachmentLoader; + } + _createClass(SkeletonJson, [{ + key: "readSkeletonData", + value: function readSkeletonData(json) { + var scale = this.scale; + var skeletonData = new SkeletonData(); + var root = typeof json === "string" ? JSON.parse(json) : json; + var skeletonMap = root.skeleton; + if (skeletonMap) { + skeletonData.hash = skeletonMap.hash; + skeletonData.version = skeletonMap.spine; + skeletonData.x = skeletonMap.x; + skeletonData.y = skeletonMap.y; + skeletonData.width = skeletonMap.width; + skeletonData.height = skeletonMap.height; + skeletonData.fps = skeletonMap.fps; + skeletonData.imagesPath = skeletonMap.images; + } + if (root.bones) { + for (var i = 0; i < root.bones.length; i++) { + var boneMap = root.bones[i]; + var parent = null; + var parentName = getValue(boneMap, "parent", null); + if (parentName) parent = skeletonData.findBone(parentName); + var data = new BoneData(skeletonData.bones.length, boneMap.name, parent); + data.length = getValue(boneMap, "length", 0) * scale; + data.x = getValue(boneMap, "x", 0) * scale; + data.y = getValue(boneMap, "y", 0) * scale; + data.rotation = getValue(boneMap, "rotation", 0); + data.scaleX = getValue(boneMap, "scaleX", 1); + data.scaleY = getValue(boneMap, "scaleY", 1); + data.shearX = getValue(boneMap, "shearX", 0); + data.shearY = getValue(boneMap, "shearY", 0); + data.transformMode = Utils.enumValue(TransformMode, getValue(boneMap, "transform", "Normal")); + data.skinRequired = getValue(boneMap, "skin", false); + var color = getValue(boneMap, "color", null); + if (color) data.color.setFromString(color); + skeletonData.bones.push(data); + } + } + if (root.slots) { + for (var _i = 0; _i < root.slots.length; _i++) { + var slotMap = root.slots[_i]; + var boneData = skeletonData.findBone(slotMap.bone); + var _data = new SlotData(skeletonData.slots.length, slotMap.name, boneData); + var _color = getValue(slotMap, "color", null); + if (_color) _data.color.setFromString(_color); + var dark = getValue(slotMap, "dark", null); + if (dark) _data.darkColor = Color.fromString(dark); + _data.attachmentName = getValue(slotMap, "attachment", null); + _data.blendMode = Utils.enumValue(BlendMode, getValue(slotMap, "blend", "normal")); + skeletonData.slots.push(_data); + } + } + if (root.ik) { + for (var _i2 = 0; _i2 < root.ik.length; _i2++) { + var constraintMap = root.ik[_i2]; + var _data2 = new IkConstraintData(constraintMap.name); + _data2.order = getValue(constraintMap, "order", 0); + _data2.skinRequired = getValue(constraintMap, "skin", false); + for (var ii = 0; ii < constraintMap.bones.length; ii++) _data2.bones.push(skeletonData.findBone(constraintMap.bones[ii])); + _data2.target = skeletonData.findBone(constraintMap.target); + _data2.mix = getValue(constraintMap, "mix", 1); + _data2.softness = getValue(constraintMap, "softness", 0) * scale; + _data2.bendDirection = getValue(constraintMap, "bendPositive", true) ? 1 : -1; + _data2.compress = getValue(constraintMap, "compress", false); + _data2.stretch = getValue(constraintMap, "stretch", false); + _data2.uniform = getValue(constraintMap, "uniform", false); + skeletonData.ikConstraints.push(_data2); + } + } + if (root.transform) { + for (var _i3 = 0; _i3 < root.transform.length; _i3++) { + var _constraintMap = root.transform[_i3]; + var _data3 = new TransformConstraintData(_constraintMap.name); + _data3.order = getValue(_constraintMap, "order", 0); + _data3.skinRequired = getValue(_constraintMap, "skin", false); + for (var _ii = 0; _ii < _constraintMap.bones.length; _ii++) _data3.bones.push(skeletonData.findBone(_constraintMap.bones[_ii])); + var targetName = _constraintMap.target; + _data3.target = skeletonData.findBone(targetName); + _data3.local = getValue(_constraintMap, "local", false); + _data3.relative = getValue(_constraintMap, "relative", false); + _data3.offsetRotation = getValue(_constraintMap, "rotation", 0); + _data3.offsetX = getValue(_constraintMap, "x", 0) * scale; + _data3.offsetY = getValue(_constraintMap, "y", 0) * scale; + _data3.offsetScaleX = getValue(_constraintMap, "scaleX", 0); + _data3.offsetScaleY = getValue(_constraintMap, "scaleY", 0); + _data3.offsetShearY = getValue(_constraintMap, "shearY", 0); + _data3.mixRotate = getValue(_constraintMap, "mixRotate", 1); + _data3.mixX = getValue(_constraintMap, "mixX", 1); + _data3.mixY = getValue(_constraintMap, "mixY", _data3.mixX); + _data3.mixScaleX = getValue(_constraintMap, "mixScaleX", 1); + _data3.mixScaleY = getValue(_constraintMap, "mixScaleY", _data3.mixScaleX); + _data3.mixShearY = getValue(_constraintMap, "mixShearY", 1); + skeletonData.transformConstraints.push(_data3); + } + } + if (root.path) { + for (var _i4 = 0; _i4 < root.path.length; _i4++) { + var _constraintMap2 = root.path[_i4]; + var _data4 = new PathConstraintData(_constraintMap2.name); + _data4.order = getValue(_constraintMap2, "order", 0); + _data4.skinRequired = getValue(_constraintMap2, "skin", false); + for (var _ii2 = 0; _ii2 < _constraintMap2.bones.length; _ii2++) _data4.bones.push(skeletonData.findBone(_constraintMap2.bones[_ii2])); + var _targetName = _constraintMap2.target; + _data4.target = skeletonData.findSlot(_targetName); + _data4.positionMode = Utils.enumValue(PositionMode, getValue(_constraintMap2, "positionMode", "Percent")); + _data4.spacingMode = Utils.enumValue(SpacingMode, getValue(_constraintMap2, "spacingMode", "Length")); + _data4.rotateMode = Utils.enumValue(RotateMode, getValue(_constraintMap2, "rotateMode", "Tangent")); + _data4.offsetRotation = getValue(_constraintMap2, "rotation", 0); + _data4.position = getValue(_constraintMap2, "position", 0); + if (_data4.positionMode == PositionMode.Fixed) _data4.position *= scale; + _data4.spacing = getValue(_constraintMap2, "spacing", 0); + if (_data4.spacingMode == SpacingMode.Length || _data4.spacingMode == SpacingMode.Fixed) _data4.spacing *= scale; + _data4.mixRotate = getValue(_constraintMap2, "mixRotate", 1); + _data4.mixX = getValue(_constraintMap2, "mixX", 1); + _data4.mixY = getValue(_constraintMap2, "mixY", _data4.mixX); + skeletonData.pathConstraints.push(_data4); + } + } + if (root.skins) { + for (var _i5 = 0; _i5 < root.skins.length; _i5++) { + var skinMap = root.skins[_i5]; + var skin = new Skin(skinMap.name); + if (skinMap.bones) { + for (var _ii3 = 0; _ii3 < skinMap.bones.length; _ii3++) skin.bones.push(skeletonData.findBone(skinMap.bones[_ii3])); + } + if (skinMap.ik) { + for (var _ii4 = 0; _ii4 < skinMap.ik.length; _ii4++) skin.constraints.push(skeletonData.findIkConstraint(skinMap.ik[_ii4])); + } + if (skinMap.transform) { + for (var _ii5 = 0; _ii5 < skinMap.transform.length; _ii5++) skin.constraints.push(skeletonData.findTransformConstraint(skinMap.transform[_ii5])); + } + if (skinMap.path) { + for (var _ii6 = 0; _ii6 < skinMap.path.length; _ii6++) skin.constraints.push(skeletonData.findPathConstraint(skinMap.path[_ii6])); + } + for (var slotName in skinMap.attachments) { + var slot = skeletonData.findSlot(slotName); + var _slotMap = skinMap.attachments[slotName]; + for (var entryName in _slotMap) { + var attachment = this.readAttachment(_slotMap[entryName], skin, slot.index, entryName, skeletonData); + if (attachment) skin.setAttachment(slot.index, entryName, attachment); + } + } + skeletonData.skins.push(skin); + if (skin.name == "default") skeletonData.defaultSkin = skin; + } + } + for (var _i6 = 0, n = this.linkedMeshes.length; _i6 < n; _i6++) { + var linkedMesh = this.linkedMeshes[_i6]; + var _skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin); + var _parent = _skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent); + linkedMesh.mesh.deformAttachment = linkedMesh.inheritDeform ? _parent : linkedMesh.mesh; + linkedMesh.mesh.setParentMesh(_parent); + linkedMesh.mesh.updateUVs(); + } + this.linkedMeshes.length = 0; + if (root.events) { + for (var eventName in root.events) { + var eventMap = root.events[eventName]; + var _data5 = new EventData(eventName); + _data5.intValue = getValue(eventMap, "int", 0); + _data5.floatValue = getValue(eventMap, "float", 0); + _data5.stringValue = getValue(eventMap, "string", ""); + _data5.audioPath = getValue(eventMap, "audio", null); + if (_data5.audioPath) { + _data5.volume = getValue(eventMap, "volume", 1); + _data5.balance = getValue(eventMap, "balance", 0); + } + skeletonData.events.push(_data5); + } + } + if (root.animations) { + for (var animationName in root.animations) { + var animationMap = root.animations[animationName]; + this.readAnimation(animationMap, animationName, skeletonData); + } + } + return skeletonData; + } + }, { + key: "readAttachment", + value: function readAttachment(map, skin, slotIndex, name, skeletonData) { + var scale = this.scale; + name = getValue(map, "name", name); + switch (getValue(map, "type", "region")) { + case "region": + { + var path = getValue(map, "path", name); + var region = this.attachmentLoader.newRegionAttachment(skin, name, path); + if (!region) return null; + region.path = path; + region.x = getValue(map, "x", 0) * scale; + region.y = getValue(map, "y", 0) * scale; + region.scaleX = getValue(map, "scaleX", 1); + region.scaleY = getValue(map, "scaleY", 1); + region.rotation = getValue(map, "rotation", 0); + region.width = map.width * scale; + region.height = map.height * scale; + var color = getValue(map, "color", null); + if (color) region.color.setFromString(color); + region.updateOffset(); + return region; + } + case "boundingbox": + { + var box = this.attachmentLoader.newBoundingBoxAttachment(skin, name); + if (!box) return null; + this.readVertices(map, box, map.vertexCount << 1); + var _color2 = getValue(map, "color", null); + if (_color2) box.color.setFromString(_color2); + return box; + } + case "mesh": + case "linkedmesh": + { + var _path = getValue(map, "path", name); + var mesh = this.attachmentLoader.newMeshAttachment(skin, name, _path); + if (!mesh) return null; + mesh.path = _path; + var _color3 = getValue(map, "color", null); + if (_color3) mesh.color.setFromString(_color3); + mesh.width = getValue(map, "width", 0) * scale; + mesh.height = getValue(map, "height", 0) * scale; + var parent = getValue(map, "parent", null); + if (parent) { + this.linkedMeshes.push(new LinkedMesh(mesh, getValue(map, "skin", null), slotIndex, parent, getValue(map, "deform", true))); + return mesh; + } + var uvs = map.uvs; + this.readVertices(map, mesh, uvs.length); + mesh.triangles = map.triangles; + mesh.regionUVs = uvs; + mesh.updateUVs(); + mesh.edges = getValue(map, "edges", null); + mesh.hullLength = getValue(map, "hull", 0) * 2; + return mesh; + } + case "path": + { + var _path2 = this.attachmentLoader.newPathAttachment(skin, name); + if (!_path2) return null; + _path2.closed = getValue(map, "closed", false); + _path2.constantSpeed = getValue(map, "constantSpeed", true); + var vertexCount = map.vertexCount; + this.readVertices(map, _path2, vertexCount << 1); + var lengths = Utils.newArray(vertexCount / 3, 0); + for (var i = 0; i < map.lengths.length; i++) lengths[i] = map.lengths[i] * scale; + _path2.lengths = lengths; + var _color4 = getValue(map, "color", null); + if (_color4) _path2.color.setFromString(_color4); + return _path2; + } + case "point": + { + var point = this.attachmentLoader.newPointAttachment(skin, name); + if (!point) return null; + point.x = getValue(map, "x", 0) * scale; + point.y = getValue(map, "y", 0) * scale; + point.rotation = getValue(map, "rotation", 0); + var _color5 = getValue(map, "color", null); + if (_color5) point.color.setFromString(_color5); + return point; + } + case "clipping": + { + var clip = this.attachmentLoader.newClippingAttachment(skin, name); + if (!clip) return null; + var end = getValue(map, "end", null); + if (end) clip.endSlot = skeletonData.findSlot(end); + var _vertexCount = map.vertexCount; + this.readVertices(map, clip, _vertexCount << 1); + var _color6 = getValue(map, "color", null); + if (_color6) clip.color.setFromString(_color6); + return clip; + } + } + return null; + } + }, { + key: "readVertices", + value: function readVertices(map, attachment, verticesLength) { + var scale = this.scale; + attachment.worldVerticesLength = verticesLength; + var vertices = map.vertices; + if (verticesLength == vertices.length) { + var scaledVertices = Utils.toFloatArray(vertices); + if (scale != 1) { + for (var i = 0, n = vertices.length; i < n; i++) scaledVertices[i] *= scale; + } + attachment.vertices = scaledVertices; + return; + } + var weights = new Array(); + var bones = new Array(); + for (var _i7 = 0, _n = vertices.length; _i7 < _n;) { + var boneCount = vertices[_i7++]; + bones.push(boneCount); + for (var nn = _i7 + boneCount * 4; _i7 < nn; _i7 += 4) { + bones.push(vertices[_i7]); + weights.push(vertices[_i7 + 1] * scale); + weights.push(vertices[_i7 + 2] * scale); + weights.push(vertices[_i7 + 3]); + } + } + attachment.bones = bones; + attachment.vertices = Utils.toFloatArray(weights); + } + }, { + key: "readAnimation", + value: function readAnimation(map, name, skeletonData) { + var scale = this.scale; + var timelines = new Array(); + if (map.slots) { + for (var slotName in map.slots) { + var slotMap = map.slots[slotName]; + var slotIndex = skeletonData.findSlot(slotName).index; + for (var timelineName in slotMap) { + var timelineMap = slotMap[timelineName]; + if (!timelineMap) continue; + var frames = timelineMap.length; + if (timelineName == "attachment") { + var timeline = new AttachmentTimeline(frames, slotIndex); + for (var frame = 0; frame < frames; frame++) { + var keyMap = timelineMap[frame]; + timeline.setFrame(frame, getValue(keyMap, "time", 0), keyMap.name); + } + timelines.push(timeline); + } else if (timelineName == "rgba") { + var _timeline = new RGBATimeline(frames, frames << 2, slotIndex); + var _keyMap = timelineMap[0]; + var time = getValue(_keyMap, "time", 0); + var color = Color.fromString(_keyMap.color); + for (var _frame = 0, bezier = 0;; _frame++) { + _timeline.setFrame(_frame, time, color.r, color.g, color.b, color.a); + var nextMap = timelineMap[_frame + 1]; + if (!nextMap) { + _timeline.shrink(bezier); + break; + } + var time2 = getValue(nextMap, "time", 0); + var newColor = Color.fromString(nextMap.color); + var curve = _keyMap.curve; + if (curve) { + bezier = readCurve(curve, _timeline, bezier, _frame, 0, time, time2, color.r, newColor.r, 1); + bezier = readCurve(curve, _timeline, bezier, _frame, 1, time, time2, color.g, newColor.g, 1); + bezier = readCurve(curve, _timeline, bezier, _frame, 2, time, time2, color.b, newColor.b, 1); + bezier = readCurve(curve, _timeline, bezier, _frame, 3, time, time2, color.a, newColor.a, 1); + } + time = time2; + color = newColor; + _keyMap = nextMap; + } + timelines.push(_timeline); + } else if (timelineName == "rgb") { + var _timeline2 = new RGBTimeline(frames, frames * 3, slotIndex); + var _keyMap2 = timelineMap[0]; + var _time = getValue(_keyMap2, "time", 0); + var _color7 = Color.fromString(_keyMap2.color); + for (var _frame2 = 0, _bezier = 0;; _frame2++) { + _timeline2.setFrame(_frame2, _time, _color7.r, _color7.g, _color7.b); + var _nextMap = timelineMap[_frame2 + 1]; + if (!_nextMap) { + _timeline2.shrink(_bezier); + break; + } + var _time2 = getValue(_nextMap, "time", 0); + var _newColor = Color.fromString(_nextMap.color); + var _curve = _keyMap2.curve; + if (_curve) { + _bezier = readCurve(_curve, _timeline2, _bezier, _frame2, 0, _time, _time2, _color7.r, _newColor.r, 1); + _bezier = readCurve(_curve, _timeline2, _bezier, _frame2, 1, _time, _time2, _color7.g, _newColor.g, 1); + _bezier = readCurve(_curve, _timeline2, _bezier, _frame2, 2, _time, _time2, _color7.b, _newColor.b, 1); + } + _time = _time2; + _color7 = _newColor; + _keyMap2 = _nextMap; + } + timelines.push(_timeline2); + } else if (timelineName == "alpha") { + timelines.push(readTimeline1(timelineMap, new AlphaTimeline(frames, frames, slotIndex), 0, 1)); + } else if (timelineName == "rgba2") { + var _timeline3 = new RGBA2Timeline(frames, frames * 7, slotIndex); + var _keyMap3 = timelineMap[0]; + var _time3 = getValue(_keyMap3, "time", 0); + var _color8 = Color.fromString(_keyMap3.light); + var color2 = Color.fromString(_keyMap3.dark); + for (var _frame3 = 0, _bezier2 = 0;; _frame3++) { + _timeline3.setFrame(_frame3, _time3, _color8.r, _color8.g, _color8.b, _color8.a, color2.r, color2.g, color2.b); + var _nextMap2 = timelineMap[_frame3 + 1]; + if (!_nextMap2) { + _timeline3.shrink(_bezier2); + break; + } + var _time4 = getValue(_nextMap2, "time", 0); + var _newColor2 = Color.fromString(_nextMap2.light); + var newColor2 = Color.fromString(_nextMap2.dark); + var _curve2 = _keyMap3.curve; + if (_curve2) { + _bezier2 = readCurve(_curve2, _timeline3, _bezier2, _frame3, 0, _time3, _time4, _color8.r, _newColor2.r, 1); + _bezier2 = readCurve(_curve2, _timeline3, _bezier2, _frame3, 1, _time3, _time4, _color8.g, _newColor2.g, 1); + _bezier2 = readCurve(_curve2, _timeline3, _bezier2, _frame3, 2, _time3, _time4, _color8.b, _newColor2.b, 1); + _bezier2 = readCurve(_curve2, _timeline3, _bezier2, _frame3, 3, _time3, _time4, _color8.a, _newColor2.a, 1); + _bezier2 = readCurve(_curve2, _timeline3, _bezier2, _frame3, 4, _time3, _time4, color2.r, newColor2.r, 1); + _bezier2 = readCurve(_curve2, _timeline3, _bezier2, _frame3, 5, _time3, _time4, color2.g, newColor2.g, 1); + _bezier2 = readCurve(_curve2, _timeline3, _bezier2, _frame3, 6, _time3, _time4, color2.b, newColor2.b, 1); + } + _time3 = _time4; + _color8 = _newColor2; + color2 = newColor2; + _keyMap3 = _nextMap2; + } + timelines.push(_timeline3); + } else if (timelineName == "rgb2") { + var _timeline4 = new RGB2Timeline(frames, frames * 6, slotIndex); + var _keyMap4 = timelineMap[0]; + var _time5 = getValue(_keyMap4, "time", 0); + var _color9 = Color.fromString(_keyMap4.light); + var _color10 = Color.fromString(_keyMap4.dark); + for (var _frame4 = 0, _bezier3 = 0;; _frame4++) { + _timeline4.setFrame(_frame4, _time5, _color9.r, _color9.g, _color9.b, _color10.r, _color10.g, _color10.b); + var _nextMap3 = timelineMap[_frame4 + 1]; + if (!_nextMap3) { + _timeline4.shrink(_bezier3); + break; + } + var _time6 = getValue(_nextMap3, "time", 0); + var _newColor3 = Color.fromString(_nextMap3.light); + var _newColor4 = Color.fromString(_nextMap3.dark); + var _curve3 = _keyMap4.curve; + if (_curve3) { + _bezier3 = readCurve(_curve3, _timeline4, _bezier3, _frame4, 0, _time5, _time6, _color9.r, _newColor3.r, 1); + _bezier3 = readCurve(_curve3, _timeline4, _bezier3, _frame4, 1, _time5, _time6, _color9.g, _newColor3.g, 1); + _bezier3 = readCurve(_curve3, _timeline4, _bezier3, _frame4, 2, _time5, _time6, _color9.b, _newColor3.b, 1); + _bezier3 = readCurve(_curve3, _timeline4, _bezier3, _frame4, 3, _time5, _time6, _color10.r, _newColor4.r, 1); + _bezier3 = readCurve(_curve3, _timeline4, _bezier3, _frame4, 4, _time5, _time6, _color10.g, _newColor4.g, 1); + _bezier3 = readCurve(_curve3, _timeline4, _bezier3, _frame4, 5, _time5, _time6, _color10.b, _newColor4.b, 1); + } + _time5 = _time6; + _color9 = _newColor3; + _color10 = _newColor4; + _keyMap4 = _nextMap3; + } + timelines.push(_timeline4); + } + } + } + } + if (map.bones) { + for (var boneName in map.bones) { + var boneMap = map.bones[boneName]; + var boneIndex = skeletonData.findBone(boneName).index; + for (var _timelineName in boneMap) { + var _timelineMap = boneMap[_timelineName]; + var _frames = _timelineMap.length; + if (_frames == 0) continue; + if (_timelineName === "rotate") { + timelines.push(readTimeline1(_timelineMap, new RotateTimeline(_frames, _frames, boneIndex), 0, 1)); + } else if (_timelineName === "translate") { + var _timeline5 = new TranslateTimeline(_frames, _frames << 1, boneIndex); + timelines.push(readTimeline2(_timelineMap, _timeline5, "x", "y", 0, scale)); + } else if (_timelineName === "translatex") { + var _timeline6 = new TranslateXTimeline(_frames, _frames, boneIndex); + timelines.push(readTimeline1(_timelineMap, _timeline6, 0, scale)); + } else if (_timelineName === "translatey") { + var _timeline7 = new TranslateYTimeline(_frames, _frames, boneIndex); + timelines.push(readTimeline1(_timelineMap, _timeline7, 0, scale)); + } else if (_timelineName === "scale") { + var _timeline8 = new ScaleTimeline(_frames, _frames << 1, boneIndex); + timelines.push(readTimeline2(_timelineMap, _timeline8, "x", "y", 1, 1)); + } else if (_timelineName === "scalex") { + var _timeline9 = new ScaleXTimeline(_frames, _frames, boneIndex); + timelines.push(readTimeline1(_timelineMap, _timeline9, 1, 1)); + } else if (_timelineName === "scaley") { + var _timeline10 = new ScaleYTimeline(_frames, _frames, boneIndex); + timelines.push(readTimeline1(_timelineMap, _timeline10, 1, 1)); + } else if (_timelineName === "shear") { + var _timeline11 = new ShearTimeline(_frames, _frames << 1, boneIndex); + timelines.push(readTimeline2(_timelineMap, _timeline11, "x", "y", 0, 1)); + } else if (_timelineName === "shearx") { + var _timeline12 = new ShearXTimeline(_frames, _frames, boneIndex); + timelines.push(readTimeline1(_timelineMap, _timeline12, 0, 1)); + } else if (_timelineName === "sheary") { + var _timeline13 = new ShearYTimeline(_frames, _frames, boneIndex); + timelines.push(readTimeline1(_timelineMap, _timeline13, 0, 1)); + } + } + } + } + if (map.ik) { + for (var constraintName in map.ik) { + var constraintMap = map.ik[constraintName]; + var _keyMap5 = constraintMap[0]; + if (!_keyMap5) continue; + var constraint = skeletonData.findIkConstraint(constraintName); + var constraintIndex = skeletonData.ikConstraints.indexOf(constraint); + var _timeline14 = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex); + var _time7 = getValue(_keyMap5, "time", 0); + var mix = getValue(_keyMap5, "mix", 1); + var softness = getValue(_keyMap5, "softness", 0) * scale; + for (var _frame5 = 0, _bezier4 = 0;; _frame5++) { + _timeline14.setFrame(_frame5, _time7, mix, softness, getValue(_keyMap5, "bendPositive", true) ? 1 : -1, getValue(_keyMap5, "compress", false), getValue(_keyMap5, "stretch", false)); + var _nextMap4 = constraintMap[_frame5 + 1]; + if (!_nextMap4) { + _timeline14.shrink(_bezier4); + break; + } + var _time8 = getValue(_nextMap4, "time", 0); + var mix2 = getValue(_nextMap4, "mix", 1); + var softness2 = getValue(_nextMap4, "softness", 0) * scale; + var _curve4 = _keyMap5.curve; + if (_curve4) { + _bezier4 = readCurve(_curve4, _timeline14, _bezier4, _frame5, 0, _time7, _time8, mix, mix2, 1); + _bezier4 = readCurve(_curve4, _timeline14, _bezier4, _frame5, 1, _time7, _time8, softness, softness2, scale); + } + _time7 = _time8; + mix = mix2; + softness = softness2; + _keyMap5 = _nextMap4; + } + timelines.push(_timeline14); + } + } + if (map.transform) { + for (var _constraintName in map.transform) { + var _timelineMap2 = map.transform[_constraintName]; + var _keyMap6 = _timelineMap2[0]; + if (!_keyMap6) continue; + var _constraint = skeletonData.findTransformConstraint(_constraintName); + var _constraintIndex = skeletonData.transformConstraints.indexOf(_constraint); + var _timeline15 = new TransformConstraintTimeline(_timelineMap2.length, _timelineMap2.length * 6, _constraintIndex); + var _time9 = getValue(_keyMap6, "time", 0); + var mixRotate = getValue(_keyMap6, "mixRotate", 1); + var mixX = getValue(_keyMap6, "mixX", 1); + var mixY = getValue(_keyMap6, "mixY", mixX); + var mixScaleX = getValue(_keyMap6, "mixScaleX", 1); + var mixScaleY = getValue(_keyMap6, "mixScaleY", mixScaleX); + var mixShearY = getValue(_keyMap6, "mixShearY", 1); + for (var _frame6 = 0, _bezier5 = 0;; _frame6++) { + _timeline15.setFrame(_frame6, _time9, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY); + var _nextMap5 = _timelineMap2[_frame6 + 1]; + if (!_nextMap5) { + _timeline15.shrink(_bezier5); + break; + } + var _time10 = getValue(_nextMap5, "time", 0); + var mixRotate2 = getValue(_nextMap5, "mixRotate", 1); + var mixX2 = getValue(_nextMap5, "mixX", 1); + var mixY2 = getValue(_nextMap5, "mixY", mixX2); + var mixScaleX2 = getValue(_nextMap5, "mixScaleX", 1); + var mixScaleY2 = getValue(_nextMap5, "mixScaleY", mixScaleX2); + var mixShearY2 = getValue(_nextMap5, "mixShearY", 1); + var _curve5 = _keyMap6.curve; + if (_curve5) { + _bezier5 = readCurve(_curve5, _timeline15, _bezier5, _frame6, 0, _time9, _time10, mixRotate, mixRotate2, 1); + _bezier5 = readCurve(_curve5, _timeline15, _bezier5, _frame6, 1, _time9, _time10, mixX, mixX2, 1); + _bezier5 = readCurve(_curve5, _timeline15, _bezier5, _frame6, 2, _time9, _time10, mixY, mixY2, 1); + _bezier5 = readCurve(_curve5, _timeline15, _bezier5, _frame6, 3, _time9, _time10, mixScaleX, mixScaleX2, 1); + _bezier5 = readCurve(_curve5, _timeline15, _bezier5, _frame6, 4, _time9, _time10, mixScaleY, mixScaleY2, 1); + _bezier5 = readCurve(_curve5, _timeline15, _bezier5, _frame6, 5, _time9, _time10, mixShearY, mixShearY2, 1); + } + _time9 = _time10; + mixRotate = mixRotate2; + mixX = mixX2; + mixY = mixY2; + mixScaleX = mixScaleX2; + mixScaleY = mixScaleY2; + mixScaleX = mixScaleX2; + _keyMap6 = _nextMap5; + } + timelines.push(_timeline15); + } + } + if (map.path) { + for (var _constraintName2 in map.path) { + var _constraintMap3 = map.path[_constraintName2]; + var _constraint2 = skeletonData.findPathConstraint(_constraintName2); + var _constraintIndex2 = skeletonData.pathConstraints.indexOf(_constraint2); + for (var _timelineName2 in _constraintMap3) { + var _timelineMap3 = _constraintMap3[_timelineName2]; + var _keyMap7 = _timelineMap3[0]; + if (!_keyMap7) continue; + var _frames2 = _timelineMap3.length; + if (_timelineName2 === "position") { + var _timeline16 = new PathConstraintPositionTimeline(_frames2, _frames2, _constraintIndex2); + timelines.push(readTimeline1(_timelineMap3, _timeline16, 0, _constraint2.positionMode == PositionMode.Fixed ? scale : 1)); + } else if (_timelineName2 === "spacing") { + var _timeline17 = new PathConstraintSpacingTimeline(_frames2, _frames2, _constraintIndex2); + timelines.push(readTimeline1(_timelineMap3, _timeline17, 0, _constraint2.spacingMode == SpacingMode.Length || _constraint2.spacingMode == SpacingMode.Fixed ? scale : 1)); + } else if (_timelineName2 === "mix") { + var _timeline18 = new PathConstraintMixTimeline(_frames2, _frames2 * 3, _constraintIndex2); + var _time11 = getValue(_keyMap7, "time", 0); + var _mixRotate = getValue(_keyMap7, "mixRotate", 1); + var _mixX = getValue(_keyMap7, "mixX", 1); + var _mixY = getValue(_keyMap7, "mixY", _mixX); + for (var _frame7 = 0, _bezier6 = 0;; _frame7++) { + _timeline18.setFrame(_frame7, _time11, _mixRotate, _mixX, _mixY); + var _nextMap6 = _timelineMap3[_frame7 + 1]; + if (!_nextMap6) { + _timeline18.shrink(_bezier6); + break; + } + var _time12 = getValue(_nextMap6, "time", 0); + var _mixRotate2 = getValue(_nextMap6, "mixRotate", 1); + var _mixX2 = getValue(_nextMap6, "mixX", 1); + var _mixY2 = getValue(_nextMap6, "mixY", _mixX2); + var _curve6 = _keyMap7.curve; + if (_curve6) { + _bezier6 = readCurve(_curve6, _timeline18, _bezier6, _frame7, 0, _time11, _time12, _mixRotate, _mixRotate2, 1); + _bezier6 = readCurve(_curve6, _timeline18, _bezier6, _frame7, 1, _time11, _time12, _mixX, _mixX2, 1); + _bezier6 = readCurve(_curve6, _timeline18, _bezier6, _frame7, 2, _time11, _time12, _mixY, _mixY2, 1); + } + _time11 = _time12; + _mixRotate = _mixRotate2; + _mixX = _mixX2; + _mixY = _mixY2; + _keyMap7 = _nextMap6; + } + timelines.push(_timeline18); + } + } + } + } + if (map.deform) { + for (var deformName in map.deform) { + var deformMap = map.deform[deformName]; + var skin = skeletonData.findSkin(deformName); + for (var _slotName in deformMap) { + var _slotMap2 = deformMap[_slotName]; + var _slotIndex = skeletonData.findSlot(_slotName).index; + for (var _timelineName3 in _slotMap2) { + var _timelineMap4 = _slotMap2[_timelineName3]; + var _keyMap8 = _timelineMap4[0]; + if (!_keyMap8) continue; + var attachment = skin.getAttachment(_slotIndex, _timelineName3); + var weighted = attachment.bones; + var vertices = attachment.vertices; + var deformLength = weighted ? vertices.length / 3 * 2 : vertices.length; + var _timeline19 = new DeformTimeline(_timelineMap4.length, _timelineMap4.length, _slotIndex, attachment); + var _time13 = getValue(_keyMap8, "time", 0); + for (var _frame8 = 0, _bezier7 = 0;; _frame8++) { + var deform = void 0; + var verticesValue = getValue(_keyMap8, "vertices", null); + if (!verticesValue) deform = weighted ? Utils.newFloatArray(deformLength) : vertices;else { + deform = Utils.newFloatArray(deformLength); + var start = getValue(_keyMap8, "offset", 0); + Utils.arrayCopy(verticesValue, 0, deform, start, verticesValue.length); + if (scale != 1) { + for (var i = start, n = i + verticesValue.length; i < n; i++) deform[i] *= scale; + } + if (!weighted) { + for (var _i8 = 0; _i8 < deformLength; _i8++) deform[_i8] += vertices[_i8]; + } + } + _timeline19.setFrame(_frame8, _time13, deform); + var _nextMap7 = _timelineMap4[_frame8 + 1]; + if (!_nextMap7) { + _timeline19.shrink(_bezier7); + break; + } + var _time14 = getValue(_nextMap7, "time", 0); + var _curve7 = _keyMap8.curve; + if (_curve7) _bezier7 = readCurve(_curve7, _timeline19, _bezier7, _frame8, 0, _time13, _time14, 0, 1, 1); + _time13 = _time14; + _keyMap8 = _nextMap7; + } + timelines.push(_timeline19); + } + } + } + } + if (map.drawOrder) { + var _timeline20 = new DrawOrderTimeline(map.drawOrder.length); + var slotCount = skeletonData.slots.length; + var _frame9 = 0; + for (var _i9 = 0; _i9 < map.drawOrder.length; _i9++, _frame9++) { + var drawOrderMap = map.drawOrder[_i9]; + var drawOrder = null; + var offsets = getValue(drawOrderMap, "offsets", null); + if (offsets) { + drawOrder = Utils.newArray(slotCount, -1); + var unchanged = Utils.newArray(slotCount - offsets.length, 0); + var originalIndex = 0, + unchangedIndex = 0; + for (var ii = 0; ii < offsets.length; ii++) { + var offsetMap = offsets[ii]; + var _slotIndex2 = skeletonData.findSlot(offsetMap.slot).index; + while (originalIndex != _slotIndex2) unchanged[unchangedIndex++] = originalIndex++; + drawOrder[originalIndex + offsetMap.offset] = originalIndex++; + } + while (originalIndex < slotCount) unchanged[unchangedIndex++] = originalIndex++; + for (var _ii7 = slotCount - 1; _ii7 >= 0; _ii7--) if (drawOrder[_ii7] == -1) drawOrder[_ii7] = unchanged[--unchangedIndex]; + } + _timeline20.setFrame(_frame9, getValue(drawOrderMap, "time", 0), drawOrder); + } + timelines.push(_timeline20); + } + if (map.events) { + var _timeline21 = new EventTimeline(map.events.length); + var _frame10 = 0; + for (var _i10 = 0; _i10 < map.events.length; _i10++, _frame10++) { + var eventMap = map.events[_i10]; + var eventData = skeletonData.findEvent(eventMap.name); + var event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData); + event.intValue = getValue(eventMap, "int", eventData.intValue); + event.floatValue = getValue(eventMap, "float", eventData.floatValue); + event.stringValue = getValue(eventMap, "string", eventData.stringValue); + if (event.data.audioPath) { + event.volume = getValue(eventMap, "volume", 1); + event.balance = getValue(eventMap, "balance", 0); + } + _timeline21.setFrame(_frame10, event); + } + timelines.push(_timeline21); + } + var duration = 0; + for (var _i11 = 0, _n2 = timelines.length; _i11 < _n2; _i11++) duration = Math.max(duration, timelines[_i11].getDuration()); + skeletonData.animations.push(new Animation(name, timelines, duration)); + } + }]); + return SkeletonJson; + }(); + var LinkedMesh = _createClass(function LinkedMesh(mesh, skin, slotIndex, parent, inheritDeform) { + _classCallCheck(this, LinkedMesh); + this.mesh = mesh; + this.skin = skin; + this.slotIndex = slotIndex; + this.parent = parent; + this.inheritDeform = inheritDeform; + }); + function readTimeline1(keys, timeline, defaultValue, scale) { + var keyMap = keys[0]; + var time = getValue(keyMap, "time", 0); + var value = getValue(keyMap, "value", defaultValue) * scale; + var bezier = 0; + for (var frame = 0;; frame++) { + timeline.setFrame(frame, time, value); + var nextMap = keys[frame + 1]; + if (!nextMap) { + timeline.shrink(bezier); + return timeline; + } + var time2 = getValue(nextMap, "time", 0); + var value2 = getValue(nextMap, "value", defaultValue) * scale; + if (keyMap.curve) bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale); + time = time2; + value = value2; + keyMap = nextMap; + } + } + function readTimeline2(keys, timeline, name1, name2, defaultValue, scale) { + var keyMap = keys[0]; + var time = getValue(keyMap, "time", 0); + var value1 = getValue(keyMap, name1, defaultValue) * scale; + var value2 = getValue(keyMap, name2, defaultValue) * scale; + var bezier = 0; + for (var frame = 0;; frame++) { + timeline.setFrame(frame, time, value1, value2); + var nextMap = keys[frame + 1]; + if (!nextMap) { + timeline.shrink(bezier); + return timeline; + } + var time2 = getValue(nextMap, "time", 0); + var nvalue1 = getValue(nextMap, name1, defaultValue) * scale; + var nvalue2 = getValue(nextMap, name2, defaultValue) * scale; + var curve = keyMap.curve; + if (curve) { + bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, value1, nvalue1, scale); + bezier = readCurve(curve, timeline, bezier, frame, 1, time, time2, value2, nvalue2, scale); + } + time = time2; + value1 = nvalue1; + value2 = nvalue2; + keyMap = nextMap; + } + } + function readCurve(curve, timeline, bezier, frame, value, time1, time2, value1, value2, scale) { + if (curve == "stepped") { + timeline.setStepped(frame); + return bezier; + } + var i = value << 2; + var cx1 = curve[i]; + var cy1 = curve[i + 1] * scale; + var cx2 = curve[i + 2]; + var cy2 = curve[i + 3] * scale; + timeline.setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2); + return bezier + 1; + } + function getValue(map, property, defaultValue) { + return map[property] !== undefined ? map[property] : defaultValue; + } + + (function () { + if (typeof Math.fround === "undefined") { + Math.fround = function (array) { + return function (x) { + return array[0] = x, array[0]; + }; + }(new Float32Array(1)); + } + })(); + + var JitterEffect = function () { + function JitterEffect(jitterX, jitterY) { + _classCallCheck(this, JitterEffect); + this.jitterX = 0; + this.jitterY = 0; + this.jitterX = jitterX; + this.jitterY = jitterY; + } + _createClass(JitterEffect, [{ + key: "begin", + value: function begin(skeleton) {} + }, { + key: "transform", + value: function transform(position, uv, light, dark) { + position.x += MathUtils.randomTriangular(-this.jitterX, this.jitterY); + position.y += MathUtils.randomTriangular(-this.jitterX, this.jitterY); + } + }, { + key: "end", + value: function end() {} + }]); + return JitterEffect; + }(); + + var SwirlEffect = function () { + function SwirlEffect(radius) { + _classCallCheck(this, SwirlEffect); + this.centerX = 0; + this.centerY = 0; + this.radius = 0; + this.angle = 0; + this.worldX = 0; + this.worldY = 0; + this.radius = radius; + } + _createClass(SwirlEffect, [{ + key: "begin", + value: function begin(skeleton) { + this.worldX = skeleton.x + this.centerX; + this.worldY = skeleton.y + this.centerY; + } + }, { + key: "transform", + value: function transform(position, uv, light, dark) { + var radAngle = this.angle * MathUtils.degreesToRadians; + var x = position.x - this.worldX; + var y = position.y - this.worldY; + var dist = Math.sqrt(x * x + y * y); + if (dist < this.radius) { + var theta = SwirlEffect.interpolation.apply(0, radAngle, (this.radius - dist) / this.radius); + var cos = Math.cos(theta); + var sin = Math.sin(theta); + position.x = cos * x - sin * y + this.worldX; + position.y = sin * x + cos * y + this.worldY; + } + } + }, { + key: "end", + value: function end() {} + }]); + return SwirlEffect; + }(); + SwirlEffect.interpolation = new PowOut(2); + + var spine = /*#__PURE__*/Object.freeze({ + __proto__: null, + AlphaTimeline: AlphaTimeline, + Animation: Animation, + AnimationState: AnimationState, + AnimationStateAdapter: AnimationStateAdapter, + AnimationStateData: AnimationStateData, + AssetManagerBase: AssetManagerBase, + AtlasAttachmentLoader: AtlasAttachmentLoader, + Attachment: Attachment, + AttachmentTimeline: AttachmentTimeline, + BinaryInput: BinaryInput, + get BlendMode () { return BlendMode; }, + Bone: Bone, + BoneData: BoneData, + BoundingBoxAttachment: BoundingBoxAttachment, + CURRENT: CURRENT, + ClippingAttachment: ClippingAttachment, + Color: Color, + ConstraintData: ConstraintData, + CurveTimeline: CurveTimeline, + CurveTimeline1: CurveTimeline1, + CurveTimeline2: CurveTimeline2, + DebugUtils: DebugUtils, + DeformTimeline: DeformTimeline, + Downloader: Downloader, + DrawOrderTimeline: DrawOrderTimeline, + Event: Event, + EventData: EventData, + EventQueue: EventQueue, + EventTimeline: EventTimeline, + get EventType () { return EventType; }, + FIRST: FIRST, + FakeTexture: FakeTexture, + HOLD_FIRST: HOLD_FIRST, + HOLD_MIX: HOLD_MIX, + HOLD_SUBSEQUENT: HOLD_SUBSEQUENT, + IkConstraint: IkConstraint, + IkConstraintData: IkConstraintData, + IkConstraintTimeline: IkConstraintTimeline, + IntSet: IntSet, + Interpolation: Interpolation, + JitterEffect: JitterEffect, + MathUtils: MathUtils, + MeshAttachment: MeshAttachment, + get MixBlend () { return MixBlend; }, + get MixDirection () { return MixDirection; }, + PathAttachment: PathAttachment, + PathConstraint: PathConstraint, + PathConstraintData: PathConstraintData, + PathConstraintMixTimeline: PathConstraintMixTimeline, + PathConstraintPositionTimeline: PathConstraintPositionTimeline, + PathConstraintSpacingTimeline: PathConstraintSpacingTimeline, + PointAttachment: PointAttachment, + Pool: Pool, + get PositionMode () { return PositionMode; }, + Pow: Pow, + PowOut: PowOut, + RGB2Timeline: RGB2Timeline, + RGBA2Timeline: RGBA2Timeline, + RGBATimeline: RGBATimeline, + RGBTimeline: RGBTimeline, + RegionAttachment: RegionAttachment, + get RotateMode () { return RotateMode; }, + RotateTimeline: RotateTimeline, + SETUP: SETUP, + SUBSEQUENT: SUBSEQUENT, + ScaleTimeline: ScaleTimeline, + ScaleXTimeline: ScaleXTimeline, + ScaleYTimeline: ScaleYTimeline, + ShearTimeline: ShearTimeline, + ShearXTimeline: ShearXTimeline, + ShearYTimeline: ShearYTimeline, + Skeleton: Skeleton, + SkeletonBinary: SkeletonBinary, + SkeletonBounds: SkeletonBounds, + SkeletonClipping: SkeletonClipping, + SkeletonData: SkeletonData, + SkeletonJson: SkeletonJson, + Skin: Skin, + SkinEntry: SkinEntry, + Slot: Slot, + SlotData: SlotData, + get SpacingMode () { return SpacingMode; }, + StringSet: StringSet, + SwirlEffect: SwirlEffect, + Texture: Texture, + TextureAtlas: TextureAtlas, + TextureAtlasPage: TextureAtlasPage, + TextureAtlasRegion: TextureAtlasRegion, + get TextureFilter () { return TextureFilter; }, + TextureRegion: TextureRegion, + get TextureWrap () { return TextureWrap; }, + TimeKeeper: TimeKeeper, + Timeline: Timeline, + TrackEntry: TrackEntry, + TransformConstraint: TransformConstraint, + TransformConstraintData: TransformConstraintData, + TransformConstraintTimeline: TransformConstraintTimeline, + get TransformMode () { return TransformMode; }, + TranslateTimeline: TranslateTimeline, + TranslateXTimeline: TranslateXTimeline, + TranslateYTimeline: TranslateYTimeline, + Triangulator: Triangulator, + Utils: Utils, + Vector2: Vector2, + VertexAttachment: VertexAttachment, + WindowedMean: WindowedMean + }); + + var TO_TEXTURE_FILTER = { + 9728: pc.FILTER_NEAREST, + 9729: pc.FILTER_LINEAR, + 9984: pc.FILTER_NEAREST_MIPMAP_NEAREST, + 9985: pc.FILTER_LINEAR_MIPMAP_NEAREST, + 9986: pc.FILTER_NEAREST_MIPMAP_LINEAR, + 9987: pc.FILTER_LINEAR_MIPMAP_LINEAR + }; + var TO_UV_WRAP_MODE = { + 33648: pc.ADDRESS_MIRRORED_REPEAT, + 33071: pc.ADDRESS_CLAMP_TO_EDGE, + 10487: pc.ADDRESS_REPEAT + }; + var SpineTextureWrapper = function () { + function SpineTextureWrapper(texture) { + _classCallCheck(this, SpineTextureWrapper); + this._image = { + width: texture.width, + height: texture.height + }; + this.pcTexture = texture; + } + _createClass(SpineTextureWrapper, [{ + key: "setFilters", + value: function setFilters(minFilter, magFilter) { + this.pcTexture.minFilter = TO_TEXTURE_FILTER[minFilter]; + this.pcTexture.magFilter = TO_TEXTURE_FILTER[magFilter]; + } + }, { + key: "setWraps", + value: function setWraps(uWrap, vWrap) { + this.pcTexture.addressU = TO_UV_WRAP_MODE[uWrap]; + this.pcTexture.addressV = TO_UV_WRAP_MODE[vWrap]; + } + }, { + key: "getImage", + value: function getImage() { + return this._image; + } + }, { + key: "dispose", + value: function dispose() { + this.pcTexture.destroy(); + } + }]); + return SpineTextureWrapper; + }(); + + function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + } + + var SEMVER_SPEC_VERSION = '2.0.0'; + var MAX_LENGTH$1 = 256; + var MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || 9007199254740991; + var MAX_SAFE_COMPONENT_LENGTH = 16; + var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6; + var RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease']; + var constants = { + MAX_LENGTH: MAX_LENGTH$1, + MAX_SAFE_COMPONENT_LENGTH: MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH: MAX_SAFE_BUILD_LENGTH, + MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1, + RELEASE_TYPES: RELEASE_TYPES, + SEMVER_SPEC_VERSION: SEMVER_SPEC_VERSION, + FLAG_INCLUDE_PRERELEASE: 1, + FLAG_LOOSE: 2 + }; + var constants$1 = getDefaultExportFromCjs(constants); + + var debug$1 = (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? function () { + var _console; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + return (_console = console).error.apply(_console, ['SEMVER'].concat(args)); + } : function () {}; + var debug_1 = debug$1; + getDefaultExportFromCjs(debug_1); + + var re$2 = {exports: {}}; + + (function (module, exports) { + var MAX_SAFE_COMPONENT_LENGTH = constants.MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH = constants.MAX_SAFE_BUILD_LENGTH, + MAX_LENGTH = constants.MAX_LENGTH; + var debug = debug_1; + exports = module.exports = {}; + var re = exports.re = []; + var safeRe = exports.safeRe = []; + var src = exports.src = []; + var t = exports.t = {}; + var R = 0; + var LETTERDASHNUMBER = '[a-zA-Z0-9-]'; + var safeRegexReplacements = [['\\s', 1], ['\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]]; + var makeSafeRegex = function makeSafeRegex(value) { + for (var _i = 0, _safeRegexReplacement = safeRegexReplacements; _i < _safeRegexReplacement.length; _i++) { + var _safeRegexReplacement2 = _slicedToArray(_safeRegexReplacement[_i], 2), + token = _safeRegexReplacement2[0], + max = _safeRegexReplacement2[1]; + value = value.split("".concat(token, "*")).join("".concat(token, "{0,").concat(max, "}")).split("".concat(token, "+")).join("".concat(token, "{1,").concat(max, "}")); + } + return value; + }; + var createToken = function createToken(name, value, isGlobal) { + var safe = makeSafeRegex(value); + var index = R++; + debug(name, index, value); + t[name] = index; + src[index] = value; + re[index] = new RegExp(value, isGlobal ? 'g' : undefined); + safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined); + }; + createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*'); + createToken('NUMERICIDENTIFIERLOOSE', '\\d+'); + createToken('NONNUMERICIDENTIFIER', "\\d*[a-zA-Z-]".concat(LETTERDASHNUMBER, "*")); + createToken('MAINVERSION', "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")")); + createToken('MAINVERSIONLOOSE', "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")")); + createToken('PRERELEASEIDENTIFIER', "(?:".concat(src[t.NUMERICIDENTIFIER], "|").concat(src[t.NONNUMERICIDENTIFIER], ")")); + createToken('PRERELEASEIDENTIFIERLOOSE', "(?:".concat(src[t.NUMERICIDENTIFIERLOOSE], "|").concat(src[t.NONNUMERICIDENTIFIER], ")")); + createToken('PRERELEASE', "(?:-(".concat(src[t.PRERELEASEIDENTIFIER], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIER], ")*))")); + createToken('PRERELEASELOOSE', "(?:-?(".concat(src[t.PRERELEASEIDENTIFIERLOOSE], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIERLOOSE], ")*))")); + createToken('BUILDIDENTIFIER', "".concat(LETTERDASHNUMBER, "+")); + createToken('BUILD', "(?:\\+(".concat(src[t.BUILDIDENTIFIER], "(?:\\.").concat(src[t.BUILDIDENTIFIER], ")*))")); + createToken('FULLPLAIN', "v?".concat(src[t.MAINVERSION]).concat(src[t.PRERELEASE], "?").concat(src[t.BUILD], "?")); + createToken('FULL', "^".concat(src[t.FULLPLAIN], "$")); + createToken('LOOSEPLAIN', "[v=\\s]*".concat(src[t.MAINVERSIONLOOSE]).concat(src[t.PRERELEASELOOSE], "?").concat(src[t.BUILD], "?")); + createToken('LOOSE', "^".concat(src[t.LOOSEPLAIN], "$")); + createToken('GTLT', '((?:<|>)?=?)'); + createToken('XRANGEIDENTIFIERLOOSE', "".concat(src[t.NUMERICIDENTIFIERLOOSE], "|x|X|\\*")); + createToken('XRANGEIDENTIFIER', "".concat(src[t.NUMERICIDENTIFIER], "|x|X|\\*")); + createToken('XRANGEPLAIN', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:".concat(src[t.PRERELEASE], ")?").concat(src[t.BUILD], "?") + ")?)?"); + createToken('XRANGEPLAINLOOSE', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:".concat(src[t.PRERELEASELOOSE], ")?").concat(src[t.BUILD], "?") + ")?)?"); + createToken('XRANGE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAIN], "$")); + createToken('XRANGELOOSE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAINLOOSE], "$")); + createToken('COERCE', "".concat('(^|[^\\d])' + '(\\d{1,').concat(MAX_SAFE_COMPONENT_LENGTH, "})") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:$|[^\\d])"); + createToken('COERCERTL', src[t.COERCE], true); + createToken('LONETILDE', '(?:~>?)'); + createToken('TILDETRIM', "(\\s*)".concat(src[t.LONETILDE], "\\s+"), true); + exports.tildeTrimReplace = '$1~'; + createToken('TILDE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAIN], "$")); + createToken('TILDELOOSE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAINLOOSE], "$")); + createToken('LONECARET', '(?:\\^)'); + createToken('CARETTRIM', "(\\s*)".concat(src[t.LONECARET], "\\s+"), true); + exports.caretTrimReplace = '$1^'; + createToken('CARET', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAIN], "$")); + createToken('CARETLOOSE', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAINLOOSE], "$")); + createToken('COMPARATORLOOSE', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], ")$|^$")); + createToken('COMPARATOR', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.FULLPLAIN], ")$|^$")); + createToken('COMPARATORTRIM', "(\\s*)".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], "|").concat(src[t.XRANGEPLAIN], ")"), true); + exports.comparatorTrimReplace = '$1$2$3'; + createToken('HYPHENRANGE', "^\\s*(".concat(src[t.XRANGEPLAIN], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAIN], ")") + "\\s*$"); + createToken('HYPHENRANGELOOSE', "^\\s*(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s*$"); + createToken('STAR', '(<|>)?=?\\s*\\*'); + createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$'); + createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$'); + })(re$2, re$2.exports); + var reExports = re$2.exports; + getDefaultExportFromCjs(reExports); + + var looseOption = Object.freeze({ + loose: true + }); + var emptyOpts = Object.freeze({}); + var parseOptions$1 = function parseOptions(options) { + if (!options) { + return emptyOpts; + } + if (_typeof(options) !== 'object') { + return looseOption; + } + return options; + }; + var parseOptions_1 = parseOptions$1; + getDefaultExportFromCjs(parseOptions_1); + + var numeric = /^[0-9]+$/; + var compareIdentifiers$1 = function compareIdentifiers(a, b) { + var anum = numeric.test(a); + var bnum = numeric.test(b); + if (anum && bnum) { + a = +a; + b = +b; + } + return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; + }; + var rcompareIdentifiers = function rcompareIdentifiers(a, b) { + return compareIdentifiers$1(b, a); + }; + var identifiers = { + compareIdentifiers: compareIdentifiers$1, + rcompareIdentifiers: rcompareIdentifiers + }; + getDefaultExportFromCjs(identifiers); + + var debug = debug_1; + var MAX_LENGTH = constants.MAX_LENGTH, + MAX_SAFE_INTEGER = constants.MAX_SAFE_INTEGER; + var re$1 = reExports.safeRe, + t$1 = reExports.t; + var parseOptions = parseOptions_1; + var compareIdentifiers = identifiers.compareIdentifiers; + var SemVer$3 = function () { + function SemVer(version, options) { + _classCallCheck(this, SemVer); + options = parseOptions(options); + if (version instanceof SemVer) { + if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { + return version; + } else { + version = version.version; + } + } else if (typeof version !== 'string') { + throw new TypeError("Invalid version. Must be a string. Got type \"".concat(_typeof(version), "\".")); + } + if (version.length > MAX_LENGTH) { + throw new TypeError("version is longer than ".concat(MAX_LENGTH, " characters")); + } + debug('SemVer', version, options); + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + var m = version.trim().match(options.loose ? re$1[t$1.LOOSE] : re$1[t$1.FULL]); + if (!m) { + throw new TypeError("Invalid Version: ".concat(version)); + } + this.raw = version; + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version'); + } + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version'); + } + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version'); + } + if (!m[4]) { + this.prerelease = []; + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num; + } + } + return id; + }); + } + this.build = m[5] ? m[5].split('.') : []; + this.format(); + } + _createClass(SemVer, [{ + key: "format", + value: function format() { + this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch); + if (this.prerelease.length) { + this.version += "-".concat(this.prerelease.join('.')); + } + return this.version; + } + }, { + key: "toString", + value: function toString() { + return this.version; + } + }, { + key: "compare", + value: function compare(other) { + debug('SemVer.compare', this.version, this.options, other); + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0; + } + other = new SemVer(other, this.options); + } + if (other.version === this.version) { + return 0; + } + return this.compareMain(other) || this.comparePre(other); + } + }, { + key: "compareMain", + value: function compareMain(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch); + } + }, { + key: "comparePre", + value: function comparePre(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + if (this.prerelease.length && !other.prerelease.length) { + return -1; + } else if (!this.prerelease.length && other.prerelease.length) { + return 1; + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0; + } + var i = 0; + do { + var a = this.prerelease[i]; + var b = other.prerelease[i]; + debug('prerelease compare', i, a, b); + if (a === undefined && b === undefined) { + return 0; + } else if (b === undefined) { + return 1; + } else if (a === undefined) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + }, { + key: "compareBuild", + value: function compareBuild(other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + var i = 0; + do { + var a = this.build[i]; + var b = other.build[i]; + debug('prerelease compare', i, a, b); + if (a === undefined && b === undefined) { + return 0; + } else if (b === undefined) { + return 1; + } else if (a === undefined) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); + } + }, { + key: "inc", + value: function inc(release, identifier, identifierBase) { + switch (release) { + case 'premajor': + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc('pre', identifier, identifierBase); + break; + case 'preminor': + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc('pre', identifier, identifierBase); + break; + case 'prepatch': + this.prerelease.length = 0; + this.inc('patch', identifier, identifierBase); + this.inc('pre', identifier, identifierBase); + break; + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier, identifierBase); + } + this.inc('pre', identifier, identifierBase); + break; + case 'major': + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { + this.major++; + } + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case 'minor': + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } + this.patch = 0; + this.prerelease = []; + break; + case 'patch': + if (this.prerelease.length === 0) { + this.patch++; + } + this.prerelease = []; + break; + case 'pre': + { + var base = Number(identifierBase) ? 1 : 0; + if (!identifier && identifierBase === false) { + throw new Error('invalid increment argument: identifier is empty'); + } + if (this.prerelease.length === 0) { + this.prerelease = [base]; + } else { + var i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) { + if (identifier === this.prerelease.join('.') && identifierBase === false) { + throw new Error('invalid increment argument: identifier already exists'); + } + this.prerelease.push(base); + } + } + if (identifier) { + var prerelease = [identifier, base]; + if (identifierBase === false) { + prerelease = [identifier]; + } + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = prerelease; + } + } else { + this.prerelease = prerelease; + } + } + break; + } + default: + throw new Error("invalid increment argument: ".concat(release)); + } + this.raw = this.format(); + if (this.build.length) { + this.raw += "+".concat(this.build.join('.')); + } + return this; + } + }]); + return SemVer; + }(); + var semver$1 = SemVer$3; + getDefaultExportFromCjs(semver$1); + + var SemVer$2 = semver$1; + var parse$2 = function parse(version, options) { + var throwErrors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + if (version instanceof SemVer$2) { + return version; + } + try { + return new SemVer$2(version, options); + } catch (er) { + if (!throwErrors) { + return null; + } + throw er; + } + }; + var parse_1 = parse$2; + getDefaultExportFromCjs(parse_1); + + var parse$1 = parse_1; + var valid = function valid(version, options) { + var v = parse$1(version, options); + return v ? v.version : null; + }; + var valid_1 = valid; + var valid$1 = getDefaultExportFromCjs(valid_1); + + var SemVer$1 = semver$1; + var parse = parse_1; + var re = reExports.safeRe, + t = reExports.t; + var coerce = function coerce(version, options) { + if (version instanceof SemVer$1) { + return version; + } + if (typeof version === 'number') { + version = String(version); + } + if (typeof version !== 'string') { + return null; + } + options = options || {}; + var match = null; + if (!options.rtl) { + match = version.match(re[t.COERCE]); + } else { + var next; + while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) { + if (!match || next.index + next[0].length !== match.index + match[0].length) { + match = next; + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length; + } + re[t.COERCERTL].lastIndex = -1; + } + if (match === null) { + return null; + } + return parse("".concat(match[2], ".").concat(match[3] || '0', ".").concat(match[4] || '0'), options); + }; + var coerce_1 = coerce; + var coerce$1 = getDefaultExportFromCjs(coerce_1); + + var iterator; + var hasRequiredIterator; + function requireIterator() { + if (hasRequiredIterator) return iterator; + hasRequiredIterator = 1; + iterator = function iterator(Yallist) { + Yallist.prototype[Symbol.iterator] = _regeneratorRuntime().mark(function _callee() { + var walker; + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + walker = this.head; + case 1: + if (!walker) { + _context.next = 7; + break; + } + _context.next = 4; + return walker.value; + case 4: + walker = walker.next; + _context.next = 1; + break; + case 7: + case "end": + return _context.stop(); + } + }, _callee, this); + }); + }; + return iterator; + } + + var yallist = Yallist$1; + Yallist$1.Node = Node; + Yallist$1.create = Yallist$1; + function Yallist$1(list) { + var self = this; + if (!(self instanceof Yallist$1)) { + self = new Yallist$1(); + } + self.tail = null; + self.head = null; + self.length = 0; + if (list && typeof list.forEach === 'function') { + list.forEach(function (item) { + self.push(item); + }); + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self.push(arguments[i]); + } + } + return self; + } + Yallist$1.prototype.removeNode = function (node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list'); + } + var next = node.next; + var prev = node.prev; + if (next) { + next.prev = prev; + } + if (prev) { + prev.next = next; + } + if (node === this.head) { + this.head = next; + } + if (node === this.tail) { + this.tail = prev; + } + node.list.length--; + node.next = null; + node.prev = null; + node.list = null; + return next; + }; + Yallist$1.prototype.unshiftNode = function (node) { + if (node === this.head) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + var head = this.head; + node.list = this; + node.next = head; + if (head) { + head.prev = node; + } + this.head = node; + if (!this.tail) { + this.tail = node; + } + this.length++; + }; + Yallist$1.prototype.pushNode = function (node) { + if (node === this.tail) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + var tail = this.tail; + node.list = this; + node.prev = tail; + if (tail) { + tail.next = node; + } + this.tail = node; + if (!this.head) { + this.head = node; + } + this.length++; + }; + Yallist$1.prototype.push = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + push(this, arguments[i]); + } + return this.length; + }; + Yallist$1.prototype.unshift = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]); + } + return this.length; + }; + Yallist$1.prototype.pop = function () { + if (!this.tail) { + return undefined; + } + var res = this.tail.value; + this.tail = this.tail.prev; + if (this.tail) { + this.tail.next = null; + } else { + this.head = null; + } + this.length--; + return res; + }; + Yallist$1.prototype.shift = function () { + if (!this.head) { + return undefined; + } + var res = this.head.value; + this.head = this.head.next; + if (this.head) { + this.head.prev = null; + } else { + this.tail = null; + } + this.length--; + return res; + }; + Yallist$1.prototype.forEach = function (fn, thisp) { + thisp = thisp || this; + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this); + walker = walker.next; + } + }; + Yallist$1.prototype.forEachReverse = function (fn, thisp) { + thisp = thisp || this; + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this); + walker = walker.prev; + } + }; + Yallist$1.prototype.get = function (n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + walker = walker.next; + } + if (i === n && walker !== null) { + return walker.value; + } + }; + Yallist$1.prototype.getReverse = function (n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + walker = walker.prev; + } + if (i === n && walker !== null) { + return walker.value; + } + }; + Yallist$1.prototype.map = function (fn, thisp) { + thisp = thisp || this; + var res = new Yallist$1(); + for (var walker = this.head; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.next; + } + return res; + }; + Yallist$1.prototype.mapReverse = function (fn, thisp) { + thisp = thisp || this; + var res = new Yallist$1(); + for (var walker = this.tail; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.prev; + } + return res; + }; + Yallist$1.prototype.reduce = function (fn, initial) { + var acc; + var walker = this.head; + if (arguments.length > 1) { + acc = initial; + } else if (this.head) { + walker = this.head.next; + acc = this.head.value; + } else { + throw new TypeError('Reduce of empty list with no initial value'); + } + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i); + walker = walker.next; + } + return acc; + }; + Yallist$1.prototype.reduceReverse = function (fn, initial) { + var acc; + var walker = this.tail; + if (arguments.length > 1) { + acc = initial; + } else if (this.tail) { + walker = this.tail.prev; + acc = this.tail.value; + } else { + throw new TypeError('Reduce of empty list with no initial value'); + } + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i); + walker = walker.prev; + } + return acc; + }; + Yallist$1.prototype.toArray = function () { + var arr = new Array(this.length); + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value; + walker = walker.next; + } + return arr; + }; + Yallist$1.prototype.toArrayReverse = function () { + var arr = new Array(this.length); + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value; + walker = walker.prev; + } + return arr; + }; + Yallist$1.prototype.slice = function (from, to) { + to = to || this.length; + if (to < 0) { + to += this.length; + } + from = from || 0; + if (from < 0) { + from += this.length; + } + var ret = new Yallist$1(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next; + } + for (; walker !== null && i < to; i++, walker = walker.next) { + ret.push(walker.value); + } + return ret; + }; + Yallist$1.prototype.sliceReverse = function (from, to) { + to = to || this.length; + if (to < 0) { + to += this.length; + } + from = from || 0; + if (from < 0) { + from += this.length; + } + var ret = new Yallist$1(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev; + } + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret.push(walker.value); + } + return ret; + }; + Yallist$1.prototype.splice = function (start, deleteCount) { + if (start > this.length) { + start = this.length - 1; + } + if (start < 0) { + start = this.length + start; + } + for (var i = 0, walker = this.head; walker !== null && i < start; i++) { + walker = walker.next; + } + var ret = []; + for (var i = 0; walker && i < deleteCount; i++) { + ret.push(walker.value); + walker = this.removeNode(walker); + } + if (walker === null) { + walker = this.tail; + } + if (walker !== this.head && walker !== this.tail) { + walker = walker.prev; + } + for (var i = 0; i < (arguments.length <= 2 ? 0 : arguments.length - 2); i++) { + walker = insert(this, walker, i + 2 < 2 || arguments.length <= i + 2 ? undefined : arguments[i + 2]); + } + return ret; + }; + Yallist$1.prototype.reverse = function () { + var head = this.head; + var tail = this.tail; + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev; + walker.prev = walker.next; + walker.next = p; + } + this.head = tail; + this.tail = head; + return this; + }; + function insert(self, node, value) { + var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self); + if (inserted.next === null) { + self.tail = inserted; + } + if (inserted.prev === null) { + self.head = inserted; + } + self.length++; + return inserted; + } + function push(self, item) { + self.tail = new Node(item, self.tail, null, self); + if (!self.head) { + self.head = self.tail; + } + self.length++; + } + function unshift(self, item) { + self.head = new Node(item, null, self.head, self); + if (!self.tail) { + self.tail = self.head; + } + self.length++; + } + function Node(value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list); + } + this.list = list; + this.value = value; + if (prev) { + prev.next = this; + this.prev = prev; + } else { + this.prev = null; + } + if (next) { + next.prev = this; + this.next = next; + } else { + this.next = null; + } + } + try { + requireIterator()(Yallist$1); + } catch (er) {} + getDefaultExportFromCjs(yallist); + + var Yallist = yallist; + var MAX = Symbol('max'); + var LENGTH = Symbol('length'); + var LENGTH_CALCULATOR = Symbol('lengthCalculator'); + var ALLOW_STALE = Symbol('allowStale'); + var MAX_AGE = Symbol('maxAge'); + var DISPOSE = Symbol('dispose'); + var NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet'); + var LRU_LIST = Symbol('lruList'); + var CACHE = Symbol('cache'); + var UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet'); + var naiveLength = function naiveLength() { + return 1; + }; + var LRUCache = function () { + function LRUCache(options) { + _classCallCheck(this, LRUCache); + if (typeof options === 'number') options = { + max: options + }; + if (!options) options = {}; + if (options.max && (typeof options.max !== 'number' || options.max < 0)) throw new TypeError('max must be a non-negative number'); + this[MAX] = options.max || Infinity; + var lc = options.length || naiveLength; + this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc; + this[ALLOW_STALE] = options.stale || false; + if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number'); + this[MAX_AGE] = options.maxAge || 0; + this[DISPOSE] = options.dispose; + this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false; + this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false; + this.reset(); + } + _createClass(LRUCache, [{ + key: "max", + get: function get() { + return this[MAX]; + }, + set: function set(mL) { + if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number'); + this[MAX] = mL || Infinity; + trim(this); + } + }, { + key: "allowStale", + get: function get() { + return this[ALLOW_STALE]; + }, + set: function set(allowStale) { + this[ALLOW_STALE] = !!allowStale; + } + }, { + key: "maxAge", + get: function get() { + return this[MAX_AGE]; + }, + set: function set(mA) { + if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number'); + this[MAX_AGE] = mA; + trim(this); + } + }, { + key: "lengthCalculator", + get: function get() { + return this[LENGTH_CALCULATOR]; + }, + set: function set(lC) { + var _this = this; + if (typeof lC !== 'function') lC = naiveLength; + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC; + this[LENGTH] = 0; + this[LRU_LIST].forEach(function (hit) { + hit.length = _this[LENGTH_CALCULATOR](hit.value, hit.key); + _this[LENGTH] += hit.length; + }); + } + trim(this); + } + }, { + key: "length", + get: function get() { + return this[LENGTH]; + } + }, { + key: "itemCount", + get: function get() { + return this[LRU_LIST].length; + } + }, { + key: "rforEach", + value: function rforEach(fn, thisp) { + thisp = thisp || this; + for (var walker = this[LRU_LIST].tail; walker !== null;) { + var prev = walker.prev; + forEachStep(this, fn, walker, thisp); + walker = prev; + } + } + }, { + key: "forEach", + value: function forEach(fn, thisp) { + thisp = thisp || this; + for (var walker = this[LRU_LIST].head; walker !== null;) { + var next = walker.next; + forEachStep(this, fn, walker, thisp); + walker = next; + } + } + }, { + key: "keys", + value: function keys() { + return this[LRU_LIST].toArray().map(function (k) { + return k.key; + }); + } + }, { + key: "values", + value: function values() { + return this[LRU_LIST].toArray().map(function (k) { + return k.value; + }); + } + }, { + key: "reset", + value: function reset() { + var _this2 = this; + if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) { + this[LRU_LIST].forEach(function (hit) { + return _this2[DISPOSE](hit.key, hit.value); + }); + } + this[CACHE] = new Map(); + this[LRU_LIST] = new Yallist(); + this[LENGTH] = 0; + } + }, { + key: "dump", + value: function dump() { + var _this3 = this; + return this[LRU_LIST].map(function (hit) { + return isStale(_this3, hit) ? false : { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }; + }).toArray().filter(function (h) { + return h; + }); + } + }, { + key: "dumpLru", + value: function dumpLru() { + return this[LRU_LIST]; + } + }, { + key: "set", + value: function set(key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE]; + if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number'); + var now = maxAge ? Date.now() : 0; + var len = this[LENGTH_CALCULATOR](value, key); + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + _del(this, this[CACHE].get(key)); + return false; + } + var node = this[CACHE].get(key); + var item = node.value; + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value); + } + item.now = now; + item.maxAge = maxAge; + item.value = value; + this[LENGTH] += len - item.length; + item.length = len; + this.get(key); + trim(this); + return true; + } + var hit = new Entry(key, value, len, now, maxAge); + if (hit.length > this[MAX]) { + if (this[DISPOSE]) this[DISPOSE](key, value); + return false; + } + this[LENGTH] += hit.length; + this[LRU_LIST].unshift(hit); + this[CACHE].set(key, this[LRU_LIST].head); + trim(this); + return true; + } + }, { + key: "has", + value: function has(key) { + if (!this[CACHE].has(key)) return false; + var hit = this[CACHE].get(key).value; + return !isStale(this, hit); + } + }, { + key: "get", + value: function get(key) { + return _get(this, key, true); + } + }, { + key: "peek", + value: function peek(key) { + return _get(this, key, false); + } + }, { + key: "pop", + value: function pop() { + var node = this[LRU_LIST].tail; + if (!node) return null; + _del(this, node); + return node.value; + } + }, { + key: "del", + value: function del(key) { + _del(this, this[CACHE].get(key)); + } + }, { + key: "load", + value: function load(arr) { + this.reset(); + var now = Date.now(); + for (var l = arr.length - 1; l >= 0; l--) { + var hit = arr[l]; + var expiresAt = hit.e || 0; + if (expiresAt === 0) this.set(hit.k, hit.v);else { + var maxAge = expiresAt - now; + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge); + } + } + } + } + }, { + key: "prune", + value: function prune() { + var _this4 = this; + this[CACHE].forEach(function (value, key) { + return _get(_this4, key, false); + }); + } + }]); + return LRUCache; + }(); + var _get = function _get(self, key, doUse) { + var node = self[CACHE].get(key); + if (node) { + var hit = node.value; + if (isStale(self, hit)) { + _del(self, node); + if (!self[ALLOW_STALE]) return undefined; + } else { + if (doUse) { + if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now(); + self[LRU_LIST].unshiftNode(node); + } + } + return hit.value; + } + }; + var isStale = function isStale(self, hit) { + if (!hit || !hit.maxAge && !self[MAX_AGE]) return false; + var diff = Date.now() - hit.now; + return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE]; + }; + var trim = function trim(self) { + if (self[LENGTH] > self[MAX]) { + for (var walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) { + var prev = walker.prev; + _del(self, walker); + walker = prev; + } + } + }; + var _del = function _del(self, node) { + if (node) { + var hit = node.value; + if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value); + self[LENGTH] -= hit.length; + self[CACHE].delete(hit.key); + self[LRU_LIST].removeNode(node); + } + }; + var Entry = _createClass(function Entry(key, value, length, now, maxAge) { + _classCallCheck(this, Entry); + this.key = key; + this.value = value; + this.length = length; + this.now = now; + this.maxAge = maxAge || 0; + }); + var forEachStep = function forEachStep(self, fn, node, thisp) { + var hit = node.value; + if (isStale(self, hit)) { + _del(self, node); + if (!self[ALLOW_STALE]) hit = undefined; + } + if (hit) fn.call(thisp, hit.value, hit.key, self); + }; + var lruCache = LRUCache; + getDefaultExportFromCjs(lruCache); + + var SemVer = semver$1; + var compare$6 = function compare(a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)); + }; + var compare_1 = compare$6; + getDefaultExportFromCjs(compare_1); + + var compare$5 = compare_1; + var eq$1 = function eq(a, b, loose) { + return compare$5(a, b, loose) === 0; + }; + var eq_1 = eq$1; + getDefaultExportFromCjs(eq_1); + + var compare$4 = compare_1; + var neq$1 = function neq(a, b, loose) { + return compare$4(a, b, loose) !== 0; + }; + var neq_1 = neq$1; + getDefaultExportFromCjs(neq_1); + + var compare$3 = compare_1; + var gt$1 = function gt(a, b, loose) { + return compare$3(a, b, loose) > 0; + }; + var gt_1 = gt$1; + getDefaultExportFromCjs(gt_1); + + var compare$2 = compare_1; + var gte$1 = function gte(a, b, loose) { + return compare$2(a, b, loose) >= 0; + }; + var gte_1 = gte$1; + getDefaultExportFromCjs(gte_1); + + var compare$1 = compare_1; + var lt$1 = function lt(a, b, loose) { + return compare$1(a, b, loose) < 0; + }; + var lt_1 = lt$1; + getDefaultExportFromCjs(lt_1); + + var compare = compare_1; + var lte$1 = function lte(a, b, loose) { + return compare(a, b, loose) <= 0; + }; + var lte_1 = lte$1; + getDefaultExportFromCjs(lte_1); + + var eq = eq_1; + var neq = neq_1; + var gt = gt_1; + var gte = gte_1; + var lt = lt_1; + var lte = lte_1; + var cmp = function cmp(a, op, b, loose) { + switch (op) { + case '===': + if (_typeof(a) === 'object') { + a = a.version; + } + if (_typeof(b) === 'object') { + b = b.version; + } + return a === b; + case '!==': + if (_typeof(a) === 'object') { + a = a.version; + } + if (_typeof(b) === 'object') { + b = b.version; + } + return a !== b; + case '': + case '=': + case '==': + return eq(a, b, loose); + case '!=': + return neq(a, b, loose); + case '>': + return gt(a, b, loose); + case '>=': + return gte(a, b, loose); + case '<': + return lt(a, b, loose); + case '<=': + return lte(a, b, loose); + default: + throw new TypeError("Invalid operator: ".concat(op)); + } + }; + var cmp_1 = cmp; + getDefaultExportFromCjs(cmp_1); + + var comparator; + var hasRequiredComparator; + function requireComparator() { + if (hasRequiredComparator) return comparator; + hasRequiredComparator = 1; + var ANY = Symbol('SemVer ANY'); + var Comparator = function () { + function Comparator(comp, options) { + _classCallCheck(this, Comparator); + options = parseOptions(options); + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp; + } else { + comp = comp.value; + } + } + comp = comp.trim().split(/\s+/).join(' '); + debug('comparator', comp, options); + this.options = options; + this.loose = !!options.loose; + this.parse(comp); + if (this.semver === ANY) { + this.value = ''; + } else { + this.value = this.operator + this.semver.version; + } + debug('comp', this); + } + _createClass(Comparator, [{ + key: "parse", + value: function parse(comp) { + var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; + var m = comp.match(r); + if (!m) { + throw new TypeError("Invalid comparator: ".concat(comp)); + } + this.operator = m[1] !== undefined ? m[1] : ''; + if (this.operator === '=') { + this.operator = ''; + } + if (!m[2]) { + this.semver = ANY; + } else { + this.semver = new SemVer(m[2], this.options.loose); + } + } + }, { + key: "toString", + value: function toString() { + return this.value; + } + }, { + key: "test", + value: function test(version) { + debug('Comparator.test', version, this.options.loose); + if (this.semver === ANY || version === ANY) { + return true; + } + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } + } + return cmp(version, this.operator, this.semver, this.options); + } + }, { + key: "intersects", + value: function intersects(comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required'); + } + if (this.operator === '') { + if (this.value === '') { + return true; + } + return new Range(comp.value, options).test(this.value); + } else if (comp.operator === '') { + if (comp.value === '') { + return true; + } + return new Range(this.value, options).test(comp.semver); + } + options = parseOptions(options); + if (options.includePrerelease && (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) { + return false; + } + if (!options.includePrerelease && (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) { + return false; + } + if (this.operator.startsWith('>') && comp.operator.startsWith('>')) { + return true; + } + if (this.operator.startsWith('<') && comp.operator.startsWith('<')) { + return true; + } + if (this.semver.version === comp.semver.version && this.operator.includes('=') && comp.operator.includes('=')) { + return true; + } + if (cmp(this.semver, '<', comp.semver, options) && this.operator.startsWith('>') && comp.operator.startsWith('<')) { + return true; + } + if (cmp(this.semver, '>', comp.semver, options) && this.operator.startsWith('<') && comp.operator.startsWith('>')) { + return true; + } + return false; + } + }], [{ + key: "ANY", + get: function get() { + return ANY; + } + }]); + return Comparator; + }(); + comparator = Comparator; + var parseOptions = parseOptions_1; + var re = reExports.safeRe, + t = reExports.t; + var cmp = cmp_1; + var debug = debug_1; + var SemVer = semver$1; + var Range = requireRange(); + return comparator; + } + + var range; + var hasRequiredRange; + function requireRange() { + if (hasRequiredRange) return range; + hasRequiredRange = 1; + var Range = function () { + function Range(range, options) { + var _this = this; + _classCallCheck(this, Range); + options = parseOptions(options); + if (range instanceof Range) { + if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { + return range; + } else { + return new Range(range.raw, options); + } + } + if (range instanceof Comparator) { + this.raw = range.value; + this.set = [[range]]; + this.format(); + return this; + } + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + this.raw = range.trim().split(/\s+/).join(' '); + this.set = this.raw.split('||').map(function (r) { + return _this.parseRange(r.trim()); + }).filter(function (c) { + return c.length; + }); + if (!this.set.length) { + throw new TypeError("Invalid SemVer Range: ".concat(this.raw)); + } + if (this.set.length > 1) { + var first = this.set[0]; + this.set = this.set.filter(function (c) { + return !isNullSet(c[0]); + }); + if (this.set.length === 0) { + this.set = [first]; + } else if (this.set.length > 1) { + var _iterator = _createForOfIteratorHelper(this.set), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var c = _step.value; + if (c.length === 1 && isAny(c[0])) { + this.set = [c]; + break; + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } + } + this.format(); + } + _createClass(Range, [{ + key: "format", + value: function format() { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim(); + }).join('||').trim(); + return this.range; + } + }, { + key: "toString", + value: function toString() { + return this.range; + } + }, { + key: "parseRange", + value: function parseRange(range) { + var _this2 = this; + var memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE); + var memoKey = memoOpts + ':' + range; + var cached = cache.get(memoKey); + if (cached) { + return cached; + } + var loose = this.options.loose; + var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)); + debug('hyphen replace', range); + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); + debug('comparator trim', range); + range = range.replace(re[t.TILDETRIM], tildeTrimReplace); + debug('tilde trim', range); + range = range.replace(re[t.CARETTRIM], caretTrimReplace); + debug('caret trim', range); + var rangeList = range.split(' ').map(function (comp) { + return parseComparator(comp, _this2.options); + }).join(' ').split(/\s+/).map(function (comp) { + return replaceGTE0(comp, _this2.options); + }); + if (loose) { + rangeList = rangeList.filter(function (comp) { + debug('loose invalid filter', comp, _this2.options); + return !!comp.match(re[t.COMPARATORLOOSE]); + }); + } + debug('range list', rangeList); + var rangeMap = new Map(); + var comparators = rangeList.map(function (comp) { + return new Comparator(comp, _this2.options); + }); + var _iterator2 = _createForOfIteratorHelper(comparators), + _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var comp = _step2.value; + if (isNullSet(comp)) { + return [comp]; + } + rangeMap.set(comp.value, comp); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + if (rangeMap.size > 1 && rangeMap.has('')) { + rangeMap.delete(''); + } + var result = _toConsumableArray(rangeMap.values()); + cache.set(memoKey, result); + return result; + } + }, { + key: "intersects", + value: function intersects(range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required'); + } + return this.set.some(function (thisComparators) { + return isSatisfiable(thisComparators, options) && range.set.some(function (rangeComparators) { + return isSatisfiable(rangeComparators, options) && thisComparators.every(function (thisComparator) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options); + }); + }); + }); + }); + } + }, { + key: "test", + value: function test(version) { + if (!version) { + return false; + } + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } + } + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true; + } + } + return false; + } + }]); + return Range; + }(); + range = Range; + var LRU = lruCache; + var cache = new LRU({ + max: 1000 + }); + var parseOptions = parseOptions_1; + var Comparator = requireComparator(); + var debug = debug_1; + var SemVer = semver$1; + var re = reExports.safeRe, + t = reExports.t, + comparatorTrimReplace = reExports.comparatorTrimReplace, + tildeTrimReplace = reExports.tildeTrimReplace, + caretTrimReplace = reExports.caretTrimReplace; + var FLAG_INCLUDE_PRERELEASE = constants.FLAG_INCLUDE_PRERELEASE, + FLAG_LOOSE = constants.FLAG_LOOSE; + var isNullSet = function isNullSet(c) { + return c.value === '<0.0.0-0'; + }; + var isAny = function isAny(c) { + return c.value === ''; + }; + var isSatisfiable = function isSatisfiable(comparators, options) { + var result = true; + var remainingComparators = comparators.slice(); + var testComparator = remainingComparators.pop(); + while (result && remainingComparators.length) { + result = remainingComparators.every(function (otherComparator) { + return testComparator.intersects(otherComparator, options); + }); + testComparator = remainingComparators.pop(); + } + return result; + }; + var parseComparator = function parseComparator(comp, options) { + debug('comp', comp, options); + comp = replaceCarets(comp, options); + debug('caret', comp); + comp = replaceTildes(comp, options); + debug('tildes', comp); + comp = replaceXRanges(comp, options); + debug('xrange', comp); + comp = replaceStars(comp, options); + debug('stars', comp); + return comp; + }; + var isX = function isX(id) { + return !id || id.toLowerCase() === 'x' || id === '*'; + }; + var replaceTildes = function replaceTildes(comp, options) { + return comp.trim().split(/\s+/).map(function (c) { + return replaceTilde(c, options); + }).join(' '); + }; + var replaceTilde = function replaceTilde(comp, options) { + var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]; + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr); + var ret; + if (isX(M)) { + ret = ''; + } else if (isX(m)) { + ret = ">=".concat(M, ".0.0 <").concat(+M + 1, ".0.0-0"); + } else if (isX(p)) { + ret = ">=".concat(M, ".").concat(m, ".0 <").concat(M, ".").concat(+m + 1, ".0-0"); + } else if (pr) { + debug('replaceTilde pr', pr); + ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0"); + } else { + ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(M, ".").concat(+m + 1, ".0-0"); + } + debug('tilde return', ret); + return ret; + }); + }; + var replaceCarets = function replaceCarets(comp, options) { + return comp.trim().split(/\s+/).map(function (c) { + return replaceCaret(c, options); + }).join(' '); + }; + var replaceCaret = function replaceCaret(comp, options) { + debug('caret', comp, options); + var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]; + var z = options.includePrerelease ? '-0' : ''; + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr); + var ret; + if (isX(M)) { + ret = ''; + } else if (isX(m)) { + ret = ">=".concat(M, ".0.0").concat(z, " <").concat(+M + 1, ".0.0-0"); + } else if (isX(p)) { + if (M === '0') { + ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0"); + } else { + ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(+M + 1, ".0.0-0"); + } + } else if (pr) { + debug('replaceCaret pr', pr); + if (M === '0') { + if (m === '0') { + ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0"); + } else { + ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0"); + } + } else { + ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(+M + 1, ".0.0-0"); + } + } else { + debug('no pr'); + if (M === '0') { + if (m === '0') { + ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0"); + } else { + ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0"); + } + } else { + ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(+M + 1, ".0.0-0"); + } + } + debug('caret return', ret); + return ret; + }); + }; + var replaceXRanges = function replaceXRanges(comp, options) { + debug('replaceXRanges', comp, options); + return comp.split(/\s+/).map(function (c) { + return replaceXRange(c, options); + }).join(' '); + }; + var replaceXRange = function replaceXRange(comp, options) { + comp = comp.trim(); + var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr); + var xM = isX(M); + var xm = xM || isX(m); + var xp = xm || isX(p); + var anyX = xp; + if (gtlt === '=' && anyX) { + gtlt = ''; + } + pr = options.includePrerelease ? '-0' : ''; + if (xM) { + if (gtlt === '>' || gtlt === '<') { + ret = '<0.0.0-0'; + } else { + ret = '*'; + } + } else if (gtlt && anyX) { + if (xm) { + m = 0; + } + p = 0; + if (gtlt === '>') { + gtlt = '>='; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else { + m = +m + 1; + p = 0; + } + } else if (gtlt === '<=') { + gtlt = '<'; + if (xm) { + M = +M + 1; + } else { + m = +m + 1; + } + } + if (gtlt === '<') { + pr = '-0'; + } + ret = "".concat(gtlt + M, ".").concat(m, ".").concat(p).concat(pr); + } else if (xm) { + ret = ">=".concat(M, ".0.0").concat(pr, " <").concat(+M + 1, ".0.0-0"); + } else if (xp) { + ret = ">=".concat(M, ".").concat(m, ".0").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0"); + } + debug('xRange return', ret); + return ret; + }); + }; + var replaceStars = function replaceStars(comp, options) { + debug('replaceStars', comp, options); + return comp.trim().replace(re[t.STAR], ''); + }; + var replaceGTE0 = function replaceGTE0(comp, options) { + debug('replaceGTE0', comp, options); + return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], ''); + }; + var hyphenReplace = function hyphenReplace(incPr) { + return function ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = ''; + } else if (isX(fm)) { + from = ">=".concat(fM, ".0.0").concat(incPr ? '-0' : ''); + } else if (isX(fp)) { + from = ">=".concat(fM, ".").concat(fm, ".0").concat(incPr ? '-0' : ''); + } else if (fpr) { + from = ">=".concat(from); + } else { + from = ">=".concat(from).concat(incPr ? '-0' : ''); + } + if (isX(tM)) { + to = ''; + } else if (isX(tm)) { + to = "<".concat(+tM + 1, ".0.0-0"); + } else if (isX(tp)) { + to = "<".concat(tM, ".").concat(+tm + 1, ".0-0"); + } else if (tpr) { + to = "<=".concat(tM, ".").concat(tm, ".").concat(tp, "-").concat(tpr); + } else if (incPr) { + to = "<".concat(tM, ".").concat(tm, ".").concat(+tp + 1, "-0"); + } else { + to = "<=".concat(to); + } + return "".concat(from, " ").concat(to).trim(); + }; + }; + var testSet = function testSet(set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false; + } + } + if (version.prerelease.length && !options.includePrerelease) { + for (var _i = 0; _i < set.length; _i++) { + debug(set[_i].semver); + if (set[_i].semver === Comparator.ANY) { + continue; + } + if (set[_i].semver.prerelease.length > 0) { + var allowed = set[_i].semver; + if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { + return true; + } + } + } + return false; + } + return true; + }; + return range; + } + + var Range = requireRange(); + var satisfies = function satisfies(version, range, options) { + try { + range = new Range(range, options); + } catch (er) { + return false; + } + return range.test(version); + }; + var satisfies_1 = satisfies; + var satisfies$1 = getDefaultExportFromCjs(satisfies_1); + + var semver = { + valid: valid$1, + coerce: coerce$1, + satisfies: satisfies$1, + SEMVER_SPEC_VERSION: constants$1.SEMVER_SPEC_VERSION + }; + + var ATTACHMENT_TYPE = { + NULL: 0, + MESH: 1, + REGION: 2 + }; + var QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0]; + var Spine = function () { + function Spine(app, atlasData, skeletonData, textureData) { + _classCallCheck(this, Spine); + _defineProperty(this, "autoUpdate", true); + _defineProperty(this, "skeleton", void 0); + _defineProperty(this, "states", void 0); + this._app = app; + this._position = new pc__namespace.Vec3(); + var atlas; + if (TextureAtlas.length === 1) { + atlas = new TextureAtlas(atlasData); + var _iterator = _createForOfIteratorHelper(atlas.pages), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var page = _step.value; + page.setTexture(new SpineTextureWrapper(textureData[page.name])); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } else { + atlas = new TextureAtlas(atlasData, function (path) { + return new SpineTextureWrapper(textureData[path]); + }); + } + var json = new SkeletonJson(new AtlasAttachmentLoader(atlas)); + json.scale *= 0.01; + var _skeletonData = json.readSkeletonData(skeletonData); + this.skeletonVersion = semver.valid(semver.coerce(_skeletonData.version)); + this._spine_3_6_0 = semver.satisfies(this.skeletonVersion, '<=3.6.0'); + this._spine_3_7_99 = semver.satisfies(this.skeletonVersion, '<=3.7.99'); + this._spine_4_0_X = semver.satisfies(this.skeletonVersion, '~4.0.0'); + this._spine_4_1_X = semver.satisfies(this.skeletonVersion, '~4.1.23'); + this.skeleton = new Skeleton(_skeletonData); + this.skeleton.updateWorldTransform(); + this.stateData = new AnimationStateData(this.skeleton.data); + this.states = [new AnimationState(this.stateData)]; + this.clipper = new SkeletonClipping(); + this._node = new pc__namespace.GraphNode(); + this._meshes = []; + this._meshInstances = []; + this._materials = {}; + this._tint = {}; + this._aabb = new pc__namespace.BoundingBox(); + this._aabbTempArray = []; + this._aabbTempOffset = new pc__namespace.Vec2(); + this._aabbTempSize = new pc__namespace.Vec2(); + this._renderCounts = { + vertexCount: 0, + indexCount: 0 + }; + this._vertexFormat = null; + this._vertexBuffer = null; + this._indexBuffer = null; + this._priority = 0; + this._timeScale = 1; + this._layers = [pc__namespace.LAYERID_UI]; + this.init(); + this._hidden = false; + } + _createClass(Spine, [{ + key: "destroy", + value: function destroy() { + this.removeFromLayers(); + for (var i = 0; i < this._meshInstances.length; i++) { + this._meshInstances[i].mesh.vertexBuffer = null; + this._meshInstances[i].mesh.indexBuffer.length = 0; + this._meshInstances[i].material = null; + } + if (this._vertexBuffer) { + this._vertexBuffer.destroy(); + this._vertexBuffer = null; + } + if (this._indexBuffer) { + this._indexBuffer.destroy(); + this._indexBuffer = null; + } + this._meshInstances = []; + this.skeleton = null; + this.stateData = null; + this._materials = {}; + this._node = null; + } + }, { + key: "hide", + value: function hide() { + if (this._hidden) return; + for (var i = 0, n = this._meshInstances.length; i < n; i++) { + this._meshInstances[i].visible = false; + } + this._hidden = true; + } + }, { + key: "show", + value: function show() { + if (!this._hidden) return; + for (var i = 0, n = this._meshInstances.length; i < n; i++) { + this._meshInstances[i].visible = true; + } + this._hidden = false; + } + }, { + key: "init", + value: function init() { + this._vertexFormat = new pc__namespace.VertexFormat(this._app.graphicsDevice, [{ + semantic: pc__namespace.SEMANTIC_POSITION, + components: 2, + type: pc__namespace.TYPE_FLOAT32 + }, { + semantic: pc__namespace.SEMANTIC_NORMAL, + components: 4, + type: pc__namespace.TYPE_UINT8, + normalize: true + }, { + semantic: pc__namespace.SEMANTIC_TEXCOORD0, + components: 2, + type: pc__namespace.TYPE_FLOAT32 + }, { + semantic: pc__namespace.SEMANTIC_COLOR, + components: 4, + type: pc__namespace.TYPE_UINT8, + normalize: true + }]); + var drawOrder = this.skeleton.drawOrder; + for (var i = 0, n = drawOrder.length; i < n; i++) { + this.initSlot(drawOrder[i]); + } + } + }, { + key: "initSlot", + value: function initSlot(slot) { + slot.positions = []; + slot.uvs = []; + slot.indices = []; + slot.vertexColor = {}; + slot._active = { + name: '', + type: ATTACHMENT_TYPE.NULL + }; + this.initAttachment(slot); + } + }, { + key: "createMaterial", + value: function createMaterial(texture) { + var material = new pc__namespace.StandardMaterial(); + material.emissiveMap = texture; + material.emissiveVertexColor = true; + material.opacityMap = texture; + material.opacityVertexColor = true; + material.depthWrite = false; + material.cull = pc__namespace.CULLFACE_NONE; + material.blendType = pc__namespace.BLEND_PREMULTIPLIED; + if (this._spine_3_6_0) { + var alphaPremul = ['gl_FragColor.rgb *= vVertexColor.a;', 'gl_FragColor.a = dAlpha;'].join('\n'); + material.chunks.outputAlphaPremulPS = alphaPremul; + } + material.update(); + return material; + } + }, { + key: "initAttachment", + value: function initAttachment(slot) { + var attachment = slot.attachment; + if (attachment) { + slot._active.name = attachment.name; + if (attachment instanceof RegionAttachment) { + slot._active.type = ATTACHMENT_TYPE.REGION; + } else if (attachment instanceof MeshAttachment) { + slot._active.type = ATTACHMENT_TYPE.MESH; + } + var texture = null; + if (attachment.region) { + if (attachment.region.texture) { + texture = attachment.region.texture.pcTexture; + } + if (attachment.region.page && attachment.region.page.texture) { + texture = attachment.region.page.texture.pcTexture; + } + } + if (texture) { + if (texture instanceof pc__namespace.StandardMaterial) { + this._materials[texture.name] = texture; + slot.material = texture.name; + } else { + var key = null; + if (texture.name) { + key = texture.name; + } else if (texture.getSource() instanceof Image) { + key = texture.getSource().getAttribute('src'); + } + if (key) { + if (this._materials[key] === undefined) { + var material = this.createMaterial(texture); + this._materials[key] = material; + } + slot.material = key; + } + } + } + } + } + }, { + key: "updateSlot", + value: function updateSlot(slot, clipper) { + var attachment = slot.attachment; + var name = attachment.name; + var type = attachment instanceof RegionAttachment ? ATTACHMENT_TYPE.REGION : attachment instanceof MeshAttachment ? ATTACHMENT_TYPE.MESH : ATTACHMENT_TYPE.NULL; + if (slot._active.name !== name || slot._active.type !== type) { + this.initAttachment(slot); + } + slot.positions.length = 0; + if (attachment instanceof RegionAttachment) { + if (this._spine_4_1_X) { + attachment.computeWorldVertices(slot, slot.positions, 0, 2); + } else { + attachment.computeWorldVertices(slot.bone, slot.positions, 0, 2); + } + } else if (attachment instanceof MeshAttachment) { + attachment.computeWorldVertices(slot, 0, attachment.worldVerticesLength, slot.positions, 0, 2); + } + var tint = this._tint[name]; + slot.vertexColor = { + r: Math.round(255 * slot.color.r * (tint ? tint.r : 1)), + g: Math.round(255 * slot.color.g * (tint ? tint.g : 1)), + b: Math.round(255 * slot.color.b * (tint ? tint.b : 1)), + a: Math.round(255 * slot.color.a * (tint ? tint.a : 1)) + }; + var srcTriangles = attachment.triangles || QUAD_TRIANGLES; + var i; + var count; + if (clipper.isClipping()) { + var twoColorTint = false; + clipper.clipTriangles(slot.positions, 0, srcTriangles, srcTriangles.length, attachment.uvs, Color.WHITE, Color.WHITE, twoColorTint); + slot.positions.length = 0; + slot.uvs.length = 0; + var vertexSize = twoColorTint ? 12 : 8; + count = clipper.clippedVertices.length; + for (i = 0; i < count; i += vertexSize) { + slot.positions.push(clipper.clippedVertices[i], clipper.clippedVertices[i + 1]); + slot.uvs.push(clipper.clippedVertices[i + 6], 1 - clipper.clippedVertices[i + 7]); + } + slot.indices = clipper.clippedTriangles.slice(); + } else { + slot.uvs.length = 0; + count = slot.positions.length; + for (i = 0; i < count; i += 2) { + slot.uvs.push(attachment.uvs[i], 1 - attachment.uvs[i + 1]); + } + slot.indices = srcTriangles; + } + this._renderCounts.vertexCount += slot.positions.length / 2; + this._renderCounts.indexCount += slot.indices.length; + } + }, { + key: "updateSkeleton", + value: function updateSkeleton(dt) { + this._renderCounts.vertexCount = 0; + this._renderCounts.indexCount = 0; + var clipper = this.clipper; + var inRange = false; + inRange = true; + var drawOrder = this.skeleton.drawOrder; + var count = drawOrder.length; + for (var i = 0; i < count; i++) { + var slot = drawOrder[i]; + if (!this._spine_3_7_99) { + if (!slot.bone.active) { + clipper.clipEndWithSlot(slot); + continue; + } + } + if (!inRange) { + clipper.clipEndWithSlot(slot); + continue; + } + var attachment = slot.getAttachment(); + if (attachment instanceof ClippingAttachment) { + clipper.clipStart(slot, attachment); + continue; + } else if (!(attachment instanceof RegionAttachment) && !(attachment instanceof MeshAttachment)) { + if (!this._spine_3_7_99) clipper.clipEndWithSlot(slot); + continue; + } + this.updateSlot(slot, clipper); + } + } + }, { + key: "render", + value: function render() { + this._meshInstances.forEach(function (instance) { + instance.material = null; + }); + this.removeFromLayers(); + this._meshes = []; + this._meshInstances.length = 0; + if (this._renderCounts.indexCount > 0 && this._renderCounts.vertexCount > 0) { + this.skeleton.getBounds(this._aabbTempOffset, this._aabbTempSize, this._aabbTempArray); + this._aabb.center = new pc__namespace.Vec3(this._aabbTempOffset.x, this._aabbTempOffset.y, 0); + this._aabb.halfExtents = new pc__namespace.Vec3(0.5 * this._aabbTempSize.x, 0.5 * this._aabbTempSize.y, 0); + if (!this._vertexBuffer || this._vertexBuffer.getNumVertices() < this._renderCounts.vertexCount) { + if (this._vertexBuffer) this._vertexBuffer.destroy(); + this._vertexBuffer = new pc__namespace.VertexBuffer(this._app.graphicsDevice, this._vertexFormat, this._renderCounts.vertexCount); + } + if (!this._indexBuffer || this._indexBuffer.getNumIndices() < this._renderCounts.indexCount) { + if (this._indexBuffer) this._indexBuffer.destroy(); + this._indexBuffer = new pc__namespace.IndexBuffer(this._app.graphicsDevice, pc__namespace.INDEXFORMAT_UINT16, this._renderCounts.indexCount); + } + var currentMaterialKey = null; + var batchStartIndex = 0; + var batchIndexCount = 0; + var dstVertices = new pc__namespace.VertexIterator(this._vertexBuffer); + var dstIndices = new Uint16Array(this._indexBuffer.lock()); + var dstIndexOffset = 0; + var dstVertexOffset = 0; + var drawOrder = this.skeleton.drawOrder; + var count = drawOrder.length; + for (var i = 0; i < count; i++) { + var slot = drawOrder[i]; + if (slot.attachment && slot.material && slot.positions.length > 0 && slot.indices.length > 0) { + if (currentMaterialKey && currentMaterialKey !== slot.material) { + this.SubmitBatch(batchStartIndex, batchIndexCount, currentMaterialKey); + currentMaterialKey = slot.material; + batchStartIndex = dstIndexOffset; + batchIndexCount = 0; + } + currentMaterialKey = slot.material; + var positions = slot.positions; + var r = slot.vertexColor.r; + var g = slot.vertexColor.g; + var b = slot.vertexColor.b; + var a = slot.vertexColor.a; + var uvs = slot.uvs; + var j = void 0; + var posCount = positions.length / 2; + for (j = 0; j < posCount; j++) { + dstVertices.element[pc__namespace.SEMANTIC_POSITION].set(positions[j * 2], positions[j * 2 + 1]); + dstVertices.element[pc__namespace.SEMANTIC_NORMAL].set(0, 255, 0, 0); + dstVertices.element[pc__namespace.SEMANTIC_COLOR].set(r, g, b, a); + dstVertices.element[pc__namespace.SEMANTIC_TEXCOORD0].set(uvs[j * 2], 1.0 - uvs[j * 2 + 1]); + dstVertices.next(); + } + var indices = slot.indices; + var indCount = indices.length; + for (j = 0; j < indCount; j++) dstIndices[dstIndexOffset + j] = indices[j] + dstVertexOffset; + batchIndexCount += indCount; + dstIndexOffset += indCount; + dstVertexOffset += posCount; + } + } + dstVertices.end(); + this._indexBuffer.unlock(); + this.SubmitBatch(batchStartIndex, batchIndexCount, currentMaterialKey); + } + this.addToLayers(); + } + }, { + key: "SubmitBatch", + value: function SubmitBatch(indexBase, indexCount, materialKey) { + if (indexCount > 0) { + var mesh = new pc__namespace.Mesh(this._app.graphicsDevice); + mesh.vertexBuffer = this._vertexBuffer; + mesh.indexBuffer[0] = this._indexBuffer; + mesh.primitive[0].type = pc__namespace.PRIMITIVE_TRIANGLES; + mesh.primitive[0].base = indexBase; + mesh.primitive[0].count = indexCount; + mesh.primitive[0].indexed = true; + mesh.aabb = this._aabb; + this._meshes.push(mesh); + var mi = new pc__namespace.MeshInstance(mesh, this._materials[materialKey], this._node); + mi.drawOrder = this.priority + this._meshInstances.length; + mi.visible = !this._hidden; + this._meshInstances.push(mi); + } + } + }, { + key: "update", + value: function update(dt) { + if (this._hidden) return; + dt *= this._timeScale; + var i; + var n = this.states.length; + for (i = 0; i < n; i++) { + this.states[i].update(dt); + } + for (i = 0; i < n; i++) { + this.states[i].apply(this.skeleton); + } + if (this.autoUpdate) { + this.skeleton.updateWorldTransform(); + } + this.updateSkeleton(); + this.render(); + } + }, { + key: "setPosition", + value: function setPosition(p) { + this._position.copy(p); + } + }, { + key: "setTint", + value: function setTint(name, color) { + this._tint[name] = color; + } + }, { + key: "removeFromLayers", + value: function removeFromLayers() { + if (this._meshInstances.length) { + for (var i = 0; i < this._layers.length; i++) { + var layer = this._app.scene.layers.getLayerById(this._layers[i]); + if (layer) layer.removeMeshInstances(this._meshInstances); + } + } + } + }, { + key: "addToLayers", + value: function addToLayers() { + if (this._meshInstances.length) { + for (var i = 0; i < this._layers.length; i++) { + var layer = this._app.scene.layers.getLayerById(this._layers[i]); + if (layer) layer.addMeshInstances(this._meshInstances); + } + } + } + }, { + key: "state", + get: function get() { + return this.states[0]; + } + }, { + key: "priority", + get: function get() { + return this._priority; + }, + set: function set(value) { + this._priority = value; + } + }, { + key: "timeScale", + get: function get() { + return this._timeScale; + }, + set: function set(value) { + this._timeScale = value; + } + }, { + key: "layers", + get: function get() { + return this._layers; + }, + set: function set(value) { + this.removeFromLayers(); + this._layers = value || []; + this.addToLayers(); + } + }]); + return Spine; + }(); + + var SpineComponent = function (_Component) { + _inherits(SpineComponent, _Component); + var _super = _createSuper(SpineComponent); + function SpineComponent(system, entity) { + var _this; + _classCallCheck(this, SpineComponent); + _this = _super.call(this, system, entity); + _this.on('set_atlasAsset', _this.onSetAsset, _assertThisInitialized(_this)); + _this.on('set_textureAssets', _this.onSetAssets, _assertThisInitialized(_this)); + _this.on('set_skeletonAsset', _this.onSetAsset, _assertThisInitialized(_this)); + _this.on('set_atlasData', _this.onSetResource, _assertThisInitialized(_this)); + _this.on('set_textures', _this.onSetResource, _assertThisInitialized(_this)); + _this.on('set_skeletonData', _this.onSetResource, _assertThisInitialized(_this)); + return _this; + } + _createClass(SpineComponent, [{ + key: "_createSpine", + value: function _createSpine() { + if (this.data.spine) { + this.data.spine.destroy(); + this.data.spine = null; + } + var textureData = {}; + for (var i = 0, n = this.textureAssets.length; i < n; i++) { + var asset = this.system.app.assets.get(this.textureAssets[i]); + var path = asset.name ? asset.name : asset.file ? asset.file.filename : null; + if (!path) { + path = pc.path.getBasename(asset.file.url); + } + var query = path.indexOf('?'); + if (query !== -1) path = path.substring(0, query); + textureData[path] = asset.resource; + } + this.data.spine = new Spine(this.system.app, this.atlasData, this.skeletonData, textureData); + this.state = this.data.spine.state; + this.states = this.data.spine.states; + this.skeleton = this.data.spine.skeleton; + this.entity.addChild(this.data.spine._node); + } + }, { + key: "_onAssetReady", + value: function _onAssetReady(_ref) { + var type = _ref.type, + resource = _ref.resource; + if (type === 'texture') { + this.textures.push(resource); + } + if (type === 'json') { + this.skeletonData = resource; + } + if (type === 'text') { + this.atlasData = resource; + } + } + }, { + key: "_onAssetAdd", + value: function _onAssetAdd(asset) { + asset.off('change', this.onAssetChanged, this); + asset.on('change', this.onAssetChanged, this); + asset.off('remove', this.onAssetRemoved, this); + asset.on('remove', this.onAssetRemoved, this); + asset.ready(this._onAssetReady, this); + this.system.app.assets.load(asset); + } + }, { + key: "onSetResource", + value: function onSetResource() { + if (this.data.atlasData && this.data.textures.length && this.data.skeletonData) { + this._createSpine(); + } + } + }, { + key: "onSetAsset", + value: function onSetAsset(name, oldValue, newValue) { + var registry = this.system.app.assets; + var asset = null; + if (oldValue) { + asset = registry.get(oldValue); + if (asset) { + asset.off('change', this.onAssetChanged); + asset.off('remove', this.onAssetRemoved); + } + } + if (newValue) { + var id = newValue; + if (newValue instanceof pc.Asset) { + id = newValue.id; + this.data[name] = id; + } + asset = registry.get(id); + if (asset) { + this._onAssetAdd(asset); + } else { + registry.on("add:".concat(id)); + } + } + } + }, { + key: "onSetAssets", + value: function onSetAssets(name, oldValue, newValue) { + var registry = this.system.app.assets; + var asset = null; + var i; + var n; + if (oldValue.length) { + for (i = 0, n = oldValue.length; i < n; i++) { + asset = registry.get(oldValue[i]); + if (asset) { + asset.off('change', this.onAssetChanged); + asset.off('remove', this.onAssetRemoved); + } + } + } + if (newValue && newValue.length) { + var ids = newValue.map(function (v) { + if (v instanceof pc.Asset) { + return v.id; + } + return v; + }); + for (i = 0, n = newValue.length; i < n; i++) { + asset = registry.get(ids[i]); + if (asset) { + this._onAssetAdd(asset); + } else { + registry.on("add:".concat(ids[i])); + } + } + } + } + }, { + key: "onAssetChanged", + value: function onAssetChanged(asset, attribute, newValue, oldValue) {} + }, { + key: "onAssetRemoved", + value: function onAssetRemoved(asset) {} + }, { + key: "onEnable", + value: function onEnable() { + pc.Component.prototype.onEnable.call(this); + var spine = this.data.spine; + if (spine) { + spine.addToLayers(); + } + } + }, { + key: "onDisable", + value: function onDisable() { + pc.Component.prototype.onDisable.call(this); + var spine = this.data.spine; + if (spine) { + spine.removeFromLayers(); + } + } + }, { + key: "hide", + value: function hide() { + if (this.data.spine) { + this.data.spine.hide(); + } + } + }, { + key: "show", + value: function show() { + if (this.data.spine) { + this.data.spine.show(); + } + } + }, { + key: "removeComponent", + value: function removeComponent() { + var asset; + if (this.atlasAsset) { + asset = this.system.app.assets.get(this.atlasAsset); + if (asset) { + asset.off('change', this.onAssetChanged); + asset.off('remove', this.onAssetRemoved); + } + } + if (this.skeletonAsset) { + asset = this.system.app.assets.get(this.skeletonAsset); + if (asset) { + asset.off('change', this.onAssetChanged); + asset.off('remove', this.onAssetRemoved); + } + } + if (this.textureAssets && this.textureAssets.length) { + for (var i = 0; i < this.textureAssets.length; i++) { + asset = this.system.app.assets.get(this.textureAssets[i]); + if (asset) { + asset.off('change', this.onAssetChanged); + asset.off('remove', this.onAssetRemoved); + } + } + } + } + }]); + return SpineComponent; + }(pc.Component); + + var SpineComponentData = _createClass(function SpineComponentData() { + _classCallCheck(this, SpineComponentData); + this.enabled = true; + this.atlasAsset = null; + this.textureAssets = []; + this.skeletonAsset = null; + this.speed = 1; + this.spine = null; + this.atlasData = null; + this.textures = []; + this.skeletonData = null; + }); + + var SpineComponentSystem = function (_ComponentSystem) { + _inherits(SpineComponentSystem, _ComponentSystem); + var _super = _createSuper(SpineComponentSystem); + function SpineComponentSystem(app) { + var _this; + _classCallCheck(this, SpineComponentSystem); + _this = _super.call(this, app); + _this.id = 'spine'; + _this.ComponentType = SpineComponent; + _this.DataType = SpineComponentData; + _this.schema = ['enabled', 'atlasAsset', 'textureAssets', 'skeletonAsset', 'atlasData', 'textures', 'skeletonData', 'speed', 'spine']; + _this.on('beforeremove', _this.onBeforeRemove, _assertThisInitialized(_this)); + _this.app.systems.on('update', _this.onUpdate, _assertThisInitialized(_this)); + return _this; + } + _createClass(SpineComponentSystem, [{ + key: "initializeComponentData", + value: function initializeComponentData(component, data, properties) { + properties = ['enabled', 'atlasAsset', 'textureAssets', 'skeletonAsset', 'atlasData', 'textures', 'skeletonData', 'spine']; + _get$1(_getPrototypeOf(SpineComponentSystem.prototype), "initializeComponentData", this).call(this, component, data, properties); + } + }, { + key: "onBeforeRemove", + value: function onBeforeRemove(entity, component) { + var data = entity.spine.data; + if (data.spine) { + data.spine.destroy(); + } + entity.spine.removeComponent(); + } + }, { + key: "onUpdate", + value: function onUpdate(dt) { + var components = this.store; + for (var id in components) { + if (components.hasOwnProperty(id)) { + var component = components[id]; + var componentData = component.data; + if (componentData.enabled && component.entity.enabled) { + if (componentData.spine) { + componentData.spine.setPosition(component.entity.getPosition()); + componentData.spine.update(componentData.speed * dt); + } + } + } + } + } + }]); + return SpineComponentSystem; + }(pc.ComponentSystem); + + (function () { + var app = pc__namespace.Application.getApplication(); + var system = new SpineComponentSystem(app); + app.systems.add(system); + })(); + + return spine; + +})(pc); diff --git a/build/playcanvas-spine.4.0.min.js b/build/playcanvas-spine.4.0.min.js new file mode 100644 index 0000000..d1ca73f --- /dev/null +++ b/build/playcanvas-spine.4.0.min.js @@ -0,0 +1 @@ +var spine=function(t){"use strict";function e(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(a){if("default"!==a){var n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,n.get?n:{enumerable:!0,get:function(){return t[a]}})}})),e.default=t,Object.freeze(e)}var a=e(t);function n(){n=function(){return e};var t,e={},a=Object.prototype,r=a.hasOwnProperty,i=Object.defineProperty||function(t,e,a){t[e]=a.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",h=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function u(t,e,a){return Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,a){return t[e]=a}}function c(t,e,a,n){var r=e&&e.prototype instanceof y?e:y,s=Object.create(r.prototype),o=new F(n||[]);return i(s,"_invoke",{value:T(t,a,o)}),s}function f(t,e,a){try{return{type:"normal",arg:t.call(e,a)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var d="suspendedStart",v="suspendedYield",m="executing",p="completed",g={};function y(){}function k(){}function b(){}var x={};u(x,o,(function(){return this}));var w=Object.getPrototypeOf,A=w&&w(w(Y([])));A&&A!==a&&r.call(A,o)&&(x=A);var I=b.prototype=y.prototype=Object.create(x);function E(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function a(n,i,s,o){var h=f(t[n],t,i);if("throw"!==h.type){var l=h.arg,u=l.value;return u&&"object"==typeof u&&r.call(u,"__await")?e.resolve(u.__await).then((function(t){a("next",t,s,o)}),(function(t){a("throw",t,s,o)})):e.resolve(u).then((function(t){l.value=t,s(l)}),(function(t){return a("throw",t,s,o)}))}o(h.arg)}var n;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,n){a(t,r,e,n)}))}return n=n?n.then(i,i):i()}})}function T(e,a,n){var r=d;return function(i,s){if(r===m)throw new Error("Generator is already running");if(r===p){if("throw"===i)throw s;return{value:t,done:!0}}for(n.method=i,n.arg=s;;){var o=n.delegate;if(o){var h=R(o,n);if(h){if(h===g)continue;return h}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=m;var l=f(e,a,n);if("normal"===l.type){if(r=n.done?p:v,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r=p,n.method="throw",n.arg=l.arg)}}}function R(e,a){var n=a.method,r=e.iterator[n];if(r===t)return a.delegate=null,"throw"===n&&e.iterator.return&&(a.method="return",a.arg=t,R(e,a),"throw"===a.method)||"return"!==n&&(a.method="throw",a.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=f(r,e.iterator,a.arg);if("throw"===i.type)return a.method="throw",a.arg=i.arg,a.delegate=null,g;var s=i.arg;return s?s.done?(a[e.resultName]=s.value,a.next=e.nextLoc,"return"!==a.method&&(a.method="next",a.arg=t),a.delegate=null,g):s:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function Y(e){if(e||""===e){var a=e[o];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function a(){for(;++n=0;--i){var s=this.tryEntries[i],o=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var h=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(h&&l){if(this.prev=0;--a){var n=this.tryEntries[a];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev=0;--e){var a=this.tryEntries[e];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),M(a),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var a=this.tryEntries[e];if(a.tryLoc===t){var n=a.completion;if("throw"===n.type){var r=n.arg;M(a)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,a,n){return this.delegate={iterator:Y(e),resultName:a,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var a=0;at.length)&&(e=t.length);for(var a=0,n=new Array(e);a=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,o=!1;return{s:function(){a=a.call(t)},n:function(){var t=a.next();return s=t.done,t},e:function(t){o=!0,i=t},f:function(){try{s||null==a.return||a.return()}finally{if(o)throw i}}}}function b(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var n=a.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var x=function(){function t(){i(this,t),this.array=new Array}return o(t,[{key:"add",value:function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e}},{key:"contains",value:function(t){return null!=this.array[0|t]}},{key:"remove",value:function(t){this.array[0|t]=void 0}},{key:"clear",value:function(){this.array.length=0}}]),t}(),w=function(){function t(){i(this,t),this.entries={},this.size=0}return o(t,[{key:"add",value:function(t){var e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}},{key:"addAll",value:function(t){for(var e=this.size,a=0,n=t.length;a0&&void 0!==arguments[0]?arguments[0]:0,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;i(this,t),this.r=e,this.g=a,this.b=n,this.a=r}return o(t,[{key:"set",value:function(t,e,a,n){return this.r=t,this.g=e,this.b=a,this.a=n,this.clamp()}},{key:"setFromColor",value:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}},{key:"setFromString",value: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?1:parseInt(t.substr(6,2),16)/255,this}},{key:"add",value:function(t,e,a,n){return this.r+=t,this.g+=e,this.b+=a,this.a+=n,this.clamp()}},{key:"clamp",value: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}}],[{key:"rgba8888ToColor",value: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}},{key:"rgb888ToColor",value:function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}},{key:"fromString",value:function(e){return(new t).setFromString(e)}}]),t}();A.WHITE=new A(1,1,1,1),A.RED=new A(1,0,0,1),A.GREEN=new A(0,1,0,1),A.BLUE=new A(0,0,1,1),A.MAGENTA=new A(1,0,1,1);var I=function(){function t(){i(this,t)}return o(t,null,[{key:"clamp",value:function(t,e,a){return ta?a:t}},{key:"cosDeg",value:function(e){return Math.cos(e*t.degRad)}},{key:"sinDeg",value:function(e){return Math.sin(e*t.degRad)}},{key:"signum",value:function(t){return t>0?1:t<0?-1:0}},{key:"toInt",value:function(t){return t>0?Math.floor(t):Math.ceil(t)}},{key:"cbrt",value:function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}},{key:"randomTriangular",value:function(e,a){return t.randomTriangularWith(e,a,.5*(e+a))}},{key:"randomTriangularWith",value:function(t,e,a){var n=Math.random(),r=e-t;return n<=(a-t)/r?t+Math.sqrt(n*r*(a-t)):e-Math.sqrt((1-n)*r*(e-a))}},{key:"isPowerOfTwo",value:function(t){return t&&0==(t&t-1)}}]),t}();I.PI=3.1415927,I.PI2=2*I.PI,I.radiansToDegrees=180/I.PI,I.radDeg=I.radiansToDegrees,I.degreesToRadians=I.PI/180,I.degRad=I.degreesToRadians;var E=function(){function t(){i(this,t)}return o(t,[{key:"apply",value:function(t,e,a){return t+(e-t)*this.applyInternal(a)}}]),t}(),S=function(t){l(a,t);var e=d(a);function a(t){var n;return i(this,a),(n=e.call(this)).power=2,n.power=t,n}return o(a,[{key:"applyInternal",value:function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}]),a}(E),T=function(t){l(a,t);var e=d(a);function a(t){return i(this,a),e.call(this,t)}return o(a,[{key:"applyInternal",value:function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}]),a}(S),R=function(){function t(){i(this,t)}return o(t,null,[{key:"arrayCopy",value:function(t,e,a,n,r){for(var i=e,s=n;i2&&void 0!==arguments[2]?arguments[2]:0,n=t.length;if(n==e)return t;if(t.length=e,n2&&void 0!==arguments[2]?arguments[2]:0;return e.length>=a?e:t.setArraySize(e,a,n)}},{key:"newArray",value:function(t,e){for(var a=new Array(t),n=0;n0?this.items.pop():this.instantiator()}},{key:"free",value:function(t){t.reset&&t.reset(),this.items.push(t)}},{key:"freeAll",value:function(t){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:0,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(this,t),this.x=e,this.y=a}return o(t,[{key:"set",value:function(t,e){return this.x=t,this.y=e,this}},{key:"length",value:function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}},{key:"normalize",value:function(){var t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}}]),t}(),Y=function(){function t(){i(this,t),this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.frameTime=0}return o(t,[{key:"update",value:function(){var t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}]),t}(),X=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;i(this,t),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(e)}return o(t,[{key:"hasEnoughData",value:function(){return this.addedValues>=this.values.length}},{key:"addValue",value:function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}},{key:"getMean",value:function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*i;var s=t.bone.skeleton,o=t.deform,h=this.vertices,l=this.bones;if(l){for(var u=0,c=0,f=0;f0&&(h=o);for(var N=t.bone,P=N.worldX,_=N.worldY,O=N.a,B=N.b,D=N.c,V=N.d,U=e,W=r;W0&&(e%=this.duration));for(var h=this.timelines,l=0,u=h.length;le)return n-1;return a-1}},{key:"search",value:function(t,e,a){for(var n=t.length,r=a;re)return r-a;return n-a}}]),t}(),it=function(t){l(a,t);var e=d(a);function a(t,n,r){var s;return i(this,a),(s=e.call(this,t,r)).curves=null,s.curves=R.newFloatArray(t+18*n),s.curves[t-1]=1,s}return o(a,[{key:"setLinear",value:function(t){this.curves[t]=0}},{key:"setStepped",value:function(t){this.curves[t]=1}},{key:"shrink",value:function(t){var e=this.getFrameCount()+18*t;if(this.curves.length>e){var a=R.newFloatArray(e);R.arrayCopy(this.curves,0,a,0,e),this.curves=a}}},{key:"setBezier",value:function(t,e,a,n,r,i,s,o,h,l,u){var c=this.curves,f=this.getFrameCount()+18*t;0==a&&(c[e]=2+f);for(var d=.03*(n-2*i+o),v=.03*(r-2*s+h),m=.006*(3*(i-o)-n+l),p=.006*(3*(s-h)-r+u),g=2*d+m,y=2*v+p,k=.3*(i-n)+d+.16666667*m,b=.3*(s-r)+v+.16666667*p,x=n+k,w=r+b,A=f+18;ft){var i=this.frames[e],s=this.frames[e+a];return s+(t-i)/(r[n]-i)*(r[n+1]-s)}var o=n+18;for(n+=2;n=t){var h=r[n-2],l=r[n-1];return l+(t-h)/(r[n]-h)*(r[n+1]-l)}e+=this.getFrameEntries();var u=r[o-2],c=r[o-1];return c+(t-u)/(this.frames[e]-u)*(this.frames[e+a]-c)}}]),a}(rt),st=function(t){l(a,t);var e=d(a);function a(t,n,r){return i(this,a),e.call(this,t,n,[r])}return o(a,[{key:"getFrameEntries",value:function(){return 2}},{key:"setFrame",value:function(t,e,a){t<<=1,this.frames[t]=e,this.frames[t+1]=a}},{key:"getCurveValue",value:function(t){for(var e=this.frames,a=e.length-2,n=2;n<=a;n+=2)if(e[n]>t){a=n-2;break}var r=this.curves[a>>1];switch(r){case 0:var i=e[a],s=e[a+1];return s+(t-i)/(e[a+2]-i)*(e[a+2+1]-s);case 1:return e[a+1]}return this.getBezierValue(t,a,1,r-2)}}]),a}(it),ot=function(t){l(a,t);var e=d(a);function a(t,n,r,s){return i(this,a),e.call(this,t,n,[r,s])}return o(a,[{key:"getFrameEntries",value:function(){return 3}},{key:"setFrame",value:function(t,e,a,n){t*=3,this.frames[t]=e,this.frames[t+1]=a,this.frames[t+2]=n}}]),a}(it),ht=function(t){l(a,t);var e=d(a);function a(t,n,r){var s;return i(this,a),(s=e.call(this,t,n,B+"|"+r)).boneIndex=0,s.boneIndex=r,s}return o(a,[{key:"apply",value:function(t,e,a,n,r,i,s){var o=t.bones[this.boneIndex];if(o.active)if(a>2];switch(m){case 0:var p=h[v];c=h[v+1],f=h[v+2],d=h[v+3];var g=(a-p)/(h[v+4]-p);c+=(h[v+4+1]-c)*g,f+=(h[v+4+2]-f)*g,d+=(h[v+4+3]-d)*g;break;case 1:c=h[v+1],f=h[v+2],d=h[v+3];break;default:c=this.getBezierValue(a,v,1,m-2),f=this.getBezierValue(a,v,2,m+18-2),d=this.getBezierValue(a,v,3,m+36-2)}if(1==r)l.r=c,l.g=f,l.b=d;else{if(i==P.setup){var y=o.data.color;l.r=y.r,l.g=y.g,l.b=y.b}l.r+=(c-l.r)*r,l.g+=(f-l.g)*r,l.b+=(d-l.b)*r}}}}}]),a}(it),bt=function(t){l(a,t);var e=d(a);function a(t,n,r){var s;return i(this,a),(s=e.call(this,t,n,z+"|"+r)).slotIndex=0,s.slotIndex=r,s}return o(a,[{key:"apply",value:function(t,e,a,n,r,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=o.color;if(a>3];switch(x){case 0:var w=h[b];d=h[b+1],v=h[b+2],m=h[b+3],p=h[b+4],g=h[b+5],y=h[b+6],k=h[b+7];var A=(a-w)/(h[b+8]-w);d+=(h[b+8+1]-d)*A,v+=(h[b+8+2]-v)*A,m+=(h[b+8+3]-m)*A,p+=(h[b+8+4]-p)*A,g+=(h[b+8+5]-g)*A,y+=(h[b+8+6]-y)*A,k+=(h[b+8+7]-k)*A;break;case 1:d=h[b+1],v=h[b+2],m=h[b+3],p=h[b+4],g=h[b+5],y=h[b+6],k=h[b+7];break;default:d=this.getBezierValue(a,b,1,x-2),v=this.getBezierValue(a,b,2,x+18-2),m=this.getBezierValue(a,b,3,x+36-2),p=this.getBezierValue(a,b,4,x+54-2),g=this.getBezierValue(a,b,5,x+72-2),y=this.getBezierValue(a,b,6,x+90-2),k=this.getBezierValue(a,b,7,x+108-2)}if(1==r)l.set(d,v,m,p),u.r=g,u.g=y,u.b=k;else{if(i==P.setup){l.setFromColor(o.data.color);var I=o.data.darkColor;u.r=I.r,u.g=I.g,u.b=I.b}l.add((d-l.r)*r,(v-l.g)*r,(m-l.b)*r,(p-l.a)*r),u.r+=(g-u.r)*r,u.g+=(y-u.g)*r,u.b+=(k-u.b)*r}}}}}]),a}(it),wt=function(t){l(a,t);var e=d(a);function a(t,n,r){var s;return i(this,a),(s=e.call(this,t,n,[G+"|"+r,H+"|"+r])).slotIndex=0,s.slotIndex=r,s}return o(a,[{key:"getFrameEntries",value:function(){return 7}},{key:"setFrame",value:function(t,e,a,n,r,i,s,o){t*=7,this.frames[t]=e,this.frames[t+1]=a,this.frames[t+2]=n,this.frames[t+3]=r,this.frames[t+4]=i,this.frames[t+5]=s,this.frames[t+6]=o}},{key:"apply",value:function(t,e,a,n,r,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=this.frames,l=o.color,u=o.darkColor;if(at){var i=this.frames[e];return a[n+1]*(t-i)/(a[n]-i)}var s=n+18;for(n+=2;n=t){var o=a[n-2],h=a[n-1];return h+(t-o)/(a[n]-o)*(a[n+1]-h)}var l=a[s-2],u=a[s-1];return u+(1-u)*(t-l)/(this.frames[e+this.getFrameEntries()]-l)}},{key:"apply",value:function(t,e,a,n,r,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=o.getAttachment();if(h instanceof N&&h.deformAttachment==this.attachment){var l=o.deform;0==l.length&&(i=P.setup);var u=this.vertices,c=u[0].length,f=this.frames;if(a=f[f.length-1]){var p=u[f.length-1];if(1==r)if(i==P.add){var g=h;if(g.bones)for(var y=0;ya)this.apply(t,e,Number.MAX_VALUE,n,r,i,s),e=-1;else if(e>=o[h-1])return;if(!(a0&&o[l-1]==u;)l--;for(;l=o[l];l++)n.push(this.events[l])}}}}]),a}(rt);Et.propertyIds=[""+Q];var St=function(t){l(a,t);var e=d(a);function a(t){var n;return i(this,a),(n=e.call(this,t,a.propertyIds)).drawOrders=null,n.drawOrders=new Array(t),n}return o(a,[{key:"getFrameCount",value:function(){return this.frames.length}},{key:"setFrame",value:function(t,e,a){this.frames[t]=e,this.drawOrders[t]=a}},{key:"apply",value:function(t,e,a,n,r,i,s){if(s!=_.mixOut)if(a>2];switch(d){case 0:var v=h[f];l=h[f+1],u=h[f+2],c=h[f+3];var m=(a-v)/(h[f+4]-v);l+=(h[f+4+1]-l)*m,u+=(h[f+4+2]-u)*m,c+=(h[f+4+3]-c)*m;break;case 1:l=h[f+1],u=h[f+2],c=h[f+3];break;default:l=this.getBezierValue(a,f,1,d-2),u=this.getBezierValue(a,f,2,d+18-2),c=this.getBezierValue(a,f,3,d+36-2)}if(i==P.setup){var p=o.data;o.mixRotate=p.mixRotate+(l-p.mixRotate)*r,o.mixX=p.mixX+(u-p.mixX)*r,o.mixY=p.mixY+(c-p.mixY)*r}else o.mixRotate+=(l-o.mixRotate)*r,o.mixX+=(u-o.mixX)*r,o.mixY+=(c-o.mixY)*r}}}}]),a}(it),Xt=function(){function t(e){i(this,t),this.data=null,this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Nt(this),this.propertyIDs=new w,this.animationsChanged=!1,this.trackEntryPool=new M((function(){return new Lt})),this.data=e}return o(t,[{key:"update",value:function(t){t*=this.timeScale;for(var e=this.tracks,a=0,n=e.length;a0){if(r.delay-=i,r.delay>0)continue;i=-r.delay,r.delay=0}var s=r.next;if(s){var o=r.trackLast-s.delay;if(o>=0){for(s.delay=0,s.trackTime+=0==r.timeScale?0:(o/r.timeScale+t)*s.timeScale,r.trackTime+=i,this.setCurrent(a,s,!0);s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){e[a]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,t)){var h=r.mixingFrom;for(r.mixingFrom=null,h&&(h.mixingTo=null);h;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=i}}this.queue.drain()}},{key:"updateMixingFrom",value:function(t,e){var a=t.mixingFrom;if(!a)return!0;var n=this.updateMixingFrom(a,e);return a.animationLast=a.nextAnimationLast,a.trackLast=a.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=a.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=a.mixingFrom,a.mixingFrom&&(a.mixingFrom.mixingTo=t),t.interruptAlpha=a.interruptAlpha,this.queue.end(a)),n):(a.trackTime+=e*a.timeScale,t.mixTime+=e,!1)}},{key:"apply",value:function(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var e=this.events,a=this.tracks,n=!1,r=0,i=a.length;r0)){n=!0;var o=0==r?P.first:s.mixBlend,h=s.alpha;s.mixingFrom?h*=this.applyMixingFrom(s,t,o):s.trackTime>=s.trackEnd&&!s.next&&(h=0);var l=s.animationLast,u=s.getAnimationTime(),c=u,f=e;s.reverse&&(c=s.animation.duration-c,f=null);var d=s.animation.timelines,v=d.length;if(0==r&&1==h||o==P.add)for(var m=0;m1&&(r=1),a!=P.first&&(a=n.mixBlend));var i=r0&&this.queueEvents(n,f),this.events.length=0,n.nextAnimationLast=f,n.nextTrackLast=n.trackTime,r}},{key:"applyAttachmentTimeline",value:function(t,e,a,n,r){var i=e.slots[t.slotIndex];i.bone.active&&(a0,p=d>=0;I.signum(v)!=I.signum(f)&&Math.abs(v)<=90&&(Math.abs(d)>180&&(d+=360*I.signum(d)),p=m),c=f+d-d%360,p!=m&&(c+=360*I.signum(d)),i[s]=c}i[s+1]=f,h.rotation=l+c*n}}else t.apply(e,0,a,null,1,r,_.mixIn)}},{key:"queueEvents",value:function(t,e){for(var a=t.animationStart,n=t.animationEnd,r=n-a,i=t.trackLast%r,s=this.events,o=0,h=s.length;on||this.queue.event(t,l)}for((t.loop?0==r||i>t.trackTime%r:e>=n&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(e){this.queue.end(e),this.clearNext(e);for(var a=e;;){var n=a.mixingFrom;if(!n)break;this.queue.end(n),a.mixingFrom=null,a.mixingTo=null,a=n}this.tracks[e.trackIndex]=null,this.queue.drain()}}}},{key:"setCurrent",value:function(t,e,a){var n=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,n&&(a&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)}},{key:"setAnimation",value:function(t,e){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this.data.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,a)}},{key:"setAnimationWith",value:function(t,e){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)throw new Error("animation cannot be null.");var n=!0,r=this.expandToIndex(t);r&&(-1==r.nextTrackLast?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,n=!1):this.clearNext(r));var i=this.trackEntry(t,e,a,r);return this.setCurrent(t,i,n),this.queue.drain(),i}},{key:"addAnimation",value:function(t,e){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,r,a,n)}},{key:"addAnimationWith",value:function(t,e){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!e)throw new Error("animation cannot be null.");var r=this.expandToIndex(t);if(r)for(;r.next;)r=r.next;var i=this.trackEntry(t,e,a,r);return r?(r.next=i,i.previous=r,n<=0&&(n+=r.getTrackComplete()-i.mixDuration)):(this.setCurrent(t,i,!0),this.queue.drain()),i.delay=n,i}},{key:"setEmptyAnimation",value:function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.setAnimationWith(e,t.emptyAnimation(),!1);return n.mixDuration=a,n.trackEnd=a,n}},{key:"addEmptyAnimation",value:function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.addAnimationWith(e,t.emptyAnimation(),!1,n);return n<=0&&(r.delay+=r.mixDuration-a),r.mixDuration=a,r.trackEnd=a,r}},{key:"setEmptyAnimations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var a=0,n=this.tracks.length;a0){r[h]=Wt,i[h]=c;continue t}break}r[h]=Ut}else r[h]=Bt}}},{key:"getCurrent",value:function(t){return t>=this.tracks.length?null:this.tracks[t]}},{key:"addListener",value:function(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}},{key:"removeListener",value:function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}},{key:"clearListeners",value:function(){this.listeners.length=0}},{key:"clearListenerNotifications",value:function(){this.queue.clear()}}],[{key:"emptyAnimation",value:function(){return Gt||(Gt=new O("",[],0)),Gt}}]),t}(),Lt=function(){function t(){i(this,t),this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.eventThreshold=0,this.attachmentThreshold=0,this.drawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this.mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=P.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}return o(t,[{key:"reset",value:function(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}},{key:"getAnimationTime",value: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)}},{key:"setAnimationLast",value:function(t){this.animationLast=t,this.nextAnimationLast=t}},{key:"isComplete",value:function(){return this.trackTime>=this.animationEnd-this.animationStart}},{key:"resetRotationDirections",value:function(){this.timelinesRotation.length=0}},{key:"getTrackComplete",value:function(){var t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime0&&(s.names=u,s.values=c,u=null,c=null),s.u=s.x/r.width,s.v=s.y/r.height,90==s.degrees?(s.u2=(s.x+s.height)/r.width,s.v2=(s.y+s.width)/r.height):(s.u2=(s.x+s.width)/r.width,s.v2=(s.y+s.height)/r.height),this.regions.push(s)}else{for((r=new ee).name=l.trim();0!=a.readEntry(n,l=a.readLine());){var p=o[n[0]];p&&p()}this.pages.push(r)}}return o(t,[{key:"findRegion",value:function(t){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:"",n=k(this.pages);try{for(n.s();!(e=n.n()).done;){var r=e.value;r.setTexture(t.get(a+r.name))}}catch(t){n.e(t)}finally{n.f()}}},{key:"dispose",value:function(){for(var t=0;t=this.lines.length?null:this.lines[this.index++]}},{key:"readEntry",value:function(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;var a=e.indexOf(":");if(-1==a)return 0;t[0]=e.substr(0,a).trim();for(var n=1,r=a+1;;n++){var i=e.indexOf(",",r);if(-1==i)return t[n]=e.substr(r).trim(),n;if(t[n]=e.substr(r,i-r).trim(),r=i+1,4==n)return 4}}}]),t}(),ee=function(){function t(){i(this,t),this.name=null,this.minFilter=Pt.Nearest,this.magFilter=Pt.Nearest,this.uWrap=_t.ClampToEdge,this.vWrap=_t.ClampToEdge,this.texture=null,this.width=0,this.height=0,this.pma=!1}return o(t,[{key:"setTexture",value:function(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap)}}]),t}(),ae=function(t){l(a,t);var e=d(a);function a(){var t;return i(this,a),(t=e.apply(this,arguments)).page=null,t.name=null,t.x=0,t.y=0,t.offsetX=0,t.offsetY=0,t.originalWidth=0,t.originalHeight=0,t.index=0,t.degrees=0,t.names=null,t.values=null,t}return o(a)}(Qt),ne=function(t){l(a,t);var e=d(a);function a(t){var n;return i(this,a),(n=e.call(this,t)).region=null,n.path=null,n.regionUVs=null,n.uvs=null,n.triangles=null,n.color=new A(1,1,1,1),n.width=0,n.height=0,n.hullLength=0,n.edges=null,n.parentMesh=null,n.tempColor=new A(0,0,0,0),n}return o(a,[{key:"updateUVs",value:function(){var t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=R.newFloatArray(t.length));var e=this.uvs,a=this.uvs.length,n=this.region.u,r=this.region.v,i=0,s=0;if(this.region instanceof ae){var o=this.region,h=o.page.texture.getImage(),l=h.width,u=h.height;switch(o.degrees){case 90:n-=(o.originalHeight-o.offsetY-o.height)/l,r-=(o.originalWidth-o.offsetX-o.width)/u,i=o.originalHeight/l,s=o.originalWidth/u;for(var c=0;c= 0.");if(!a)throw new Error("name cannot be null.");this.index=e,this.name=a,this.parent=n}));!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"}(oe||(oe={}));var ue,ce,fe,de=function(){function t(e,a,n){if(i(this,t),this.data=null,this.skeleton=null,this.parent=null,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,!e)throw new Error("data cannot be null.");if(!a)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=a,this.parent=n,this.setToSetupPose()}return o(t,[{key:"isActive",value:function(){return this.active}},{key:"update",value:function(){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}},{key:"updateWorldTransform",value:function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}},{key:"updateWorldTransformWith",value:function(t,e,a,n,r,i,s){this.ax=t,this.ay=e,this.arotation=a,this.ascaleX=n,this.ascaleY=r,this.ashearX=i,this.ashearY=s;var o=this.parent;if(!o){var h=this.skeleton,l=a+90+s,u=h.scaleX,c=h.scaleY;return this.a=I.cosDeg(a+i)*n*u,this.b=I.cosDeg(l)*r*u,this.c=I.sinDeg(a+i)*n*c,this.d=I.sinDeg(l)*r*c,this.worldX=t*u+h.x,void(this.worldY=e*c+h.y)}var f=o.a,d=o.b,v=o.c,m=o.d;switch(this.worldX=f*t+d*e+o.worldX,this.worldY=v*t+m*e+o.worldY,this.data.transformMode){case oe.Normal:var p=a+90+s,g=I.cosDeg(a+i)*n,y=I.cosDeg(p)*r,k=I.sinDeg(a+i)*n,b=I.sinDeg(p)*r;return this.a=f*g+d*k,this.b=f*y+d*b,this.c=v*g+m*k,void(this.d=v*y+m*b);case oe.OnlyTranslation:var x=a+90+s;this.a=I.cosDeg(a+i)*n,this.b=I.cosDeg(x)*r,this.c=I.sinDeg(a+i)*n,this.d=I.sinDeg(x)*r;break;case oe.NoRotationOrReflection:var w=f*f+v*v,A=0;w>1e-4?(w=Math.abs(f*m-d*v)/w,f/=this.skeleton.scaleX,d=(v/=this.skeleton.scaleY)*w,m=f*w,A=Math.atan2(v,f)*I.radDeg):(f=0,v=0,A=90-Math.atan2(m,d)*I.radDeg);var E=a+i-A,S=a+s-A+90,T=I.cosDeg(E)*n,R=I.cosDeg(S)*r,C=I.sinDeg(E)*n,M=I.sinDeg(S)*r;this.a=f*T-d*C,this.b=f*R-d*M,this.c=v*T+m*C,this.d=v*R+m*M;break;case oe.NoScale:case oe.NoScaleOrReflection:var F=I.cosDeg(a),Y=I.sinDeg(a),X=(f*F+d*Y)/this.skeleton.scaleX,L=(v*F+m*Y)/this.skeleton.scaleY,N=Math.sqrt(X*X+L*L);N>1e-5&&(N=1/N),X*=N,L*=N,N=Math.sqrt(X*X+L*L),this.data.transformMode==oe.NoScale&&f*m-d*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(N=-N);var P=Math.PI/2+Math.atan2(L,X),_=Math.cos(P)*N,O=Math.sin(P)*N,B=I.cosDeg(i)*n,D=I.cosDeg(90+s)*r,V=I.sinDeg(i)*n,U=I.sinDeg(90+s)*r;this.a=X*B+_*V,this.b=X*D+_*U,this.c=L*B+O*V,this.d=L*D+O*U}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}},{key:"setToSetupPose",value: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}},{key:"getWorldRotationX",value:function(){return Math.atan2(this.c,this.a)*I.radDeg}},{key:"getWorldRotationY",value:function(){return Math.atan2(this.d,this.b)*I.radDeg}},{key:"getWorldScaleX",value:function(){return Math.sqrt(this.a*this.a+this.c*this.c)}},{key:"getWorldScaleY",value:function(){return Math.sqrt(this.b*this.b+this.d*this.d)}},{key:"updateAppliedTransform",value:function(){var t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*I.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)*I.radDeg);var e=t.a,a=t.b,n=t.c,r=t.d,i=1/(e*r-a*n),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*r*i-o*a*i,this.ay=o*e*i-s*n*i;var h=i*r,l=i*e,u=i*a,c=i*n,f=h*this.a-u*this.c,d=h*this.b-u*this.d,v=l*this.c-c*this.a,m=l*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+v*v),this.ascaleX>1e-4){var p=f*m-d*v;this.ascaleY=p/this.ascaleX,this.ashearY=Math.atan2(f*d+v*m,p)*I.radDeg,this.arotation=Math.atan2(v,f)*I.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,d)*I.radDeg}},{key:"worldToLocal",value:function(t){var e=1/(this.a*this.d-this.b*this.c),a=t.x-this.worldX,n=t.y-this.worldY;return t.x=a*this.d*e-n*this.b*e,t.y=n*this.a*e-a*this.c*e,t}},{key:"localToWorld",value:function(t){var e=t.x,a=t.y;return t.x=e*this.a+a*this.b+this.worldX,t.y=e*this.c+a*this.d+this.worldY,t}},{key:"worldToLocalRotation",value:function(t){var e=I.sinDeg(t),a=I.cosDeg(t);return Math.atan2(this.a*e-this.c*a,this.d*a-this.b*e)*I.radDeg+this.rotation-this.shearX}},{key:"localToWorldRotation",value:function(t){t-=this.rotation-this.shearX;var e=I.sinDeg(t),a=I.cosDeg(t);return Math.atan2(a*this.c+e*this.d,a*this.a+e*this.b)*I.radDeg}},{key:"rotateWorld",value:function(t){var e=this.a,a=this.b,n=this.c,r=this.d,i=I.cosDeg(t),s=I.sinDeg(t);this.a=i*e-s*n,this.b=i*a-s*r,this.c=s*e+i*n,this.d=s*a+i*r}}]),t}(),ve=o((function t(e,a,n){i(this,t),this.name=e,this.order=a,this.skinRequired=n})),me=function(){function t(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;i(this,t),this.pathPrefix=null,this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.textureLoader=e,this.pathPrefix=a,this.downloader=n||new pe}return o(t,[{key:"start",value:function(t){return this.toLoad++,this.pathPrefix+t}},{key:"success",value:function(t,e,a){this.toLoad--,this.loaded++,this.assets[e]=a,t&&t(e,a)}},{key:"error",value:function(t,e,a){this.toLoad--,this.loaded++,this.errors[e]=a,t&&t(e,a)}},{key:"loadAll",value:function(){var t=this;return new Promise((function(e,a){requestAnimationFrame((function n(){t.isLoadingComplete()?t.hasErrors()?a(t.errors):e(t):requestAnimationFrame(n)}))}))}},{key:"setRawDataURI",value:function(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}},{key:"loadBinary",value:function(t){var e=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t=this.start(t),this.downloader.downloadBinary(t,(function(n){e.success(a,t,n)}),(function(a,r){e.error(n,t,"Couldn't load binary ".concat(t,": status ").concat(a,", ").concat(r))}))}},{key:"loadText",value:function(t){var e=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t=this.start(t),this.downloader.downloadText(t,(function(n){e.success(a,t,n)}),(function(a,r){e.error(n,t,"Couldn't load text ".concat(t,": status ").concat(a,", ").concat(r))}))}},{key:"loadJson",value:function(t){var e=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t=this.start(t),this.downloader.downloadJson(t,(function(n){e.success(a,t,n)}),(function(a,r){e.error(n,t,"Couldn't load JSON ".concat(t,": status ").concat(a,", ").concat(r))}))}},{key:"loadTexture",value:function(t){var e=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((function(a){return a.ok?a.blob():(e.error(n,t,"Couldn't load image: ".concat(t)),null)})).then((function(t){return t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null})).then((function(n){n&&e.success(a,t,e.textureLoader(n))}));else{var r=new Image;r.crossOrigin="anonymous",r.onload=function(){e.success(a,t,e.textureLoader(r))},r.onerror=function(){e.error(n,t,"Couldn't load image: ".concat(t))},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),r.src=t}}},{key:"loadTextureAtlas",value:function(t){var e=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=t.lastIndexOf("/"),s=i>=0?t.substring(0,i+1):"";t=this.start(t),this.downloader.downloadText(t,(function(i){try{var o,h=new Kt(i),l=h.pages.length,u=!1,c=k(h.pages);try{var f=function(){var i=o.value;e.loadTexture(null==r?s+i.name:r[i.name],(function(n,r){u||(i.setTexture(r),0==--l&&e.success(a,t,h))}),(function(a,r){u||e.error(n,t,"Couldn't load texture atlas ".concat(t," page image: ").concat(a)),u=!0}))};for(c.s();!(o=c.n()).done;)f()}catch(t){c.e(t)}finally{c.f()}}catch(a){e.error(n,t,"Couldn't parse texture atlas ".concat(t,": ").concat(a.message))}}),(function(a,r){e.error(n,t,"Couldn't load texture atlas ".concat(t,": status ").concat(a,", ").concat(r))}))}},{key:"get",value:function(t){return this.assets[this.pathPrefix+t]}},{key:"require",value:function(t){t=this.pathPrefix+t;var e=this.assets[t];if(e)return e;var a=this.errors[t];throw Error("Asset not found: "+t+(a?"\n"+a:""))}},{key:"remove",value:function(t){t=this.pathPrefix+t;var e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}},{key:"removeAll",value:function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}},{key:"isLoadingComplete",value:function(){return 0==this.toLoad}},{key:"getToLoad",value:function(){return this.toLoad}},{key:"getLoaded",value:function(){return this.loaded}},{key:"dispose",value:function(){this.removeAll()}},{key:"hasErrors",value:function(){return Object.keys(this.errors).length>0}},{key:"getErrors",value:function(){return this.errors}}]),t}(),pe=function(){function t(){i(this,t),this.callbacks={},this.rawDataUris={}}return o(t,[{key:"dataUriToString",value:function(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");var e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}},{key:"base64ToUint8Array",value:function(t){for(var e=window.atob(t),a=e.length,n=new Uint8Array(a),r=0;r180?f-=360:f<-180&&(f+=360);var x=t.ascaleX,w=t.ascaleY;if(n||r){switch(t.data.transformMode){case oe.NoScale:case oe.NoScaleOrReflection:d=e-t.worldX,v=a-t.worldY}var A=t.data.length*x,E=Math.sqrt(d*d+v*v);if(n&&EA&&A>1e-4){var S=(E/A-1)*s+1;x*=S,i&&(w*=S)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*s,x,w,t.ashearX,t.ashearY)}},{key:"apply2",value:function(t,e,a,n,r,i,s,o,h){var l=t.ax,u=t.ay,c=t.ascaleX,f=t.ascaleY,d=c,v=f,m=e.ascaleX,p=0,g=0,y=0;c<0?(c=-c,p=180,y=-1):(p=0,y=1),f<0&&(f=-f,y=-y),m<0?(m=-m,g=180):g=0;var k=e.ax,b=0,x=0,w=0,A=t.a,E=t.b,S=t.c,T=t.d,R=Math.abs(c-f)<=1e-4;!R||i?(b=0,x=A*k+t.worldX,w=S*k+t.worldY):(x=A*k+E*(b=e.ay)+t.worldX,w=S*k+T*b+t.worldY);var C=t.parent;A=C.a,E=C.b,S=C.c;var M,F,Y=1/(A*(T=C.d)-E*S),X=x-C.worldX,L=w-C.worldY,N=(X*T-L*E)*Y-l,P=(L*A-X*S)*Y-u,_=Math.sqrt(N*N+P*P),O=e.data.length*m;if(_<1e-4)return this.apply1(t,a,n,!1,i,!1,h),void e.updateWorldTransformWith(k,b,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var B=((X=a-C.worldX)*T-(L=n-C.worldY)*E)*Y-l,D=(L*A-X*S)*Y-u,V=B*B+D*D;if(0!=o){o*=c*(m+1)*.5;var U=Math.sqrt(V),W=U-_-O*c+o;if(W>0){var j=Math.min(1,W/(2*o))-1;V=(B-=(j=(W-o*(1-j*j))/U)*B)*B+(D-=j*D)*D}}t:if(R){var q=(V-_*_-(O*=c)*O)/(2*_*O);q<-1?(q=-1,F=Math.PI*r):q>1?(q=1,F=0,i&&(d*=A=(Math.sqrt(V)/(_+O)-1)*h+1,s&&(v*=A))):F=Math.acos(q)*r,A=_+O*q,E=O*Math.sin(F),M=Math.atan2(D*A-B*E,B*A+D*E)}else{var G=(A=c*O)*A,z=(E=f*O)*E,H=Math.atan2(D,B),$=-2*z*_,J=z-G;if((T=$*$-4*J*(S=z*_*_+G*V-G*z))>=0){var Q=Math.sqrt(T);$<0&&(Q=-Q);var Z=(Q=.5*-($+Q))/J,K=S/Q,tt=Math.abs(Z)=-1&&S<=1&&(S=Math.acos(S),(T=(X=A*Math.cos(S)+_)*X+(L=E*Math.sin(S))*L)ot&&(it=S,ot=T,st=X,ht=L)),V<=.5*(nt+ot)?(M=H-Math.atan2(rt*r,at),F=et*r):(M=H-Math.atan2(ht*r,st),F=it*r)}var lt=Math.atan2(b,k)*y,ut=t.arotation;(M=(M-lt)*I.radDeg+p-ut)>180?M-=360:M<-180&&(M+=360),t.updateWorldTransformWith(l,u,ut+M*h,d,v,0,0),ut=e.arotation,(F=((F+lt)*I.radDeg-e.ashearX)*y+g-ut)>180?F-=360:F<-180&&(F+=360),e.updateWorldTransformWith(k,b,ut+F*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}]),t}(),be=function(t){l(a,t);var e=d(a);function a(t){var n;return i(this,a),(n=e.call(this,t,0,!1)).bones=new Array,n.target=null,n.bendDirection=1,n.compress=!1,n.stretch=!1,n.uniform=!1,n.mix=1,n.softness=0,n}return o(a)}(ve),xe=function(t){l(a,t);var e=d(a);function a(t){var n;return i(this,a),(n=e.call(this,t,0,!1)).bones=new Array,n.target=null,n.positionMode=null,n.spacingMode=null,n.rotateMode=null,n.offsetRotation=0,n.position=0,n.spacing=0,n.mixRotate=0,n.mixX=0,n.mixY=0,n}return o(a)}(ve);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(ue||(ue={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"}(ce||(ce={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(fe||(fe={}));var we=function(){function t(e,a){if(i(this,t),this.data=null,this.bones=null,this.target=null,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!e)throw new Error("data cannot be null.");if(!a)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(var n=0,r=e.bones.length;n0){b=u/b*d;for(var M=1;M0?I.degRad:-I.degRad}for(var q=0,G=3;q0){var tt=z.a,et=z.b,at=z.c,nt=z.d,rt=0,it=0,st=0;if(rt=s?B[G-1]:0==c[q+1]?B[G+2]:Math.atan2(Q,J),rt-=Math.atan2(at,tt),W){it=Math.cos(rt),st=Math.sin(rt);var ot=z.data.length;D+=(ot*(it*tt-st*at)-J)*a,V+=(ot*(st*tt+it*at)-Q)*a}else rt+=U;rt>I.PI?rt-=I.PI2:rt<-I.PI&&(rt+=I.PI2),rt*=a,it=Math.cos(rt),st=Math.sin(rt),z.a=it*tt-st*at,z.b=it*et-st*nt,z.c=st*tt+it*at,z.d=st*et+it*nt}z.updateAppliedTransform()}}}}},{key:"computeWorldPositions",value:function(e,a,n){var r=this.target,i=this.position,s=this.spaces,o=R.setArraySize(this.positions,3*a+2),h=null,l=e.closed,u=e.worldVerticesLength,c=u/6,f=t.NONE;if(!e.constantSpeed){var d,v=e.lengths,m=v[c-=l?1:2];switch(this.data.positionMode==ue.Percent&&(i*=m),this.data.spacingMode){case ce.Percent:d=m;break;case ce.Proportional:d=m/a;break;default:d=1}h=R.setArraySize(this.world,8);for(var p=0,g=0,y=0;pm){f!=t.AFTER&&(f=t.AFTER,e.computeWorldVertices(r,u-6,4,h,0,2)),this.addAfterPosition(b-m,h,0,o,g);continue}}for(;;y++){var x=v[y];if(!(b>x)){if(0==y)b/=x;else{var w=v[y-1];b=(b-w)/(x-w)}break}}y!=f&&(f=y,l&&y==c?(e.computeWorldVertices(r,u-4,4,h,0,2),e.computeWorldVertices(r,0,4,h,4,2)):e.computeWorldVertices(r,6*y+2,8,h,0,2)),this.addCurvePosition(b,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],o,g,n||p>0&&0==k)}return o}l?(u+=2,h=R.setArraySize(this.world,u),e.computeWorldVertices(r,2,u-4,h,0,2),e.computeWorldVertices(r,0,2,h,u-4,2),h[u-2]=h[0],h[u-1]=h[1]):(c--,u-=4,h=R.setArraySize(this.world,u),e.computeWorldVertices(r,2,u,h,0,2));for(var A,I=R.setArraySize(this.curves,c),E=0,S=h[0],T=h[1],C=0,M=0,F=0,Y=0,X=0,L=0,N=0,P=0,_=0,O=0,B=0,D=0,V=0,U=0,W=0,j=2;WE){this.addAfterPosition(Z-E,h,u-4,o,H);continue}}for(;;$++){var K=I[$];if(!(Z>K)){if(0==$)Z/=K;else{var tt=I[$-1];Z=(Z-tt)/(K-tt)}break}}if($!=f){f=$;var et=6*$;for(S=h[et],T=h[et+1],C=h[et+2],M=h[et+3],F=h[et+4],Y=h[et+5],B=2*(N=.03*(S-2*C+F))+(_=.006*(3*(C-F)-S+(X=h[et+6]))),D=2*(P=.03*(T-2*M+Y))+(O=.006*(3*(M-Y)-T+(L=h[et+7]))),V=.3*(C-S)+N+.16666667*_,U=.3*(M-T)+P+.16666667*O,G=Math.sqrt(V*V+U*U),q[0]=G,et=1;et<8;et++)V+=B,U+=D,B+=_,D+=O,G+=Math.sqrt(V*V+U*U),q[et]=G;V+=B,U+=D,G+=Math.sqrt(V*V+U*U),q[8]=G,V+=B+_,U+=D+O,G+=Math.sqrt(V*V+U*U),q[9]=G,J=0}for(Z*=G;;J++){var at=q[J];if(!(Z>at)){if(0==J)Z/=at;else{var nt=q[J-1];Z=J+(Z-nt)/(at-nt)}break}}this.addCurvePosition(.1*Z,S,T,C,M,F,Y,X,L,o,H,n||z>0&&0==Q)}return o}},{key:"addBeforePosition",value:function(t,e,a,n,r){var i=e[a],s=e[a+1],o=e[a+2]-i,h=e[a+3]-s,l=Math.atan2(h,o);n[r]=i+t*Math.cos(l),n[r+1]=s+t*Math.sin(l),n[r+2]=l}},{key:"addAfterPosition",value:function(t,e,a,n,r){var i=e[a+2],s=e[a+3],o=i-e[a],h=s-e[a+1],l=Math.atan2(h,o);n[r]=i+t*Math.cos(l),n[r+1]=s+t*Math.sin(l),n[r+2]=l}},{key:"addCurvePosition",value:function(t,e,a,n,r,i,s,o,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=a,void(l[u+2]=Math.atan2(r-a,n-e));var f=t*t,d=f*t,v=1-t,m=v*v,p=m*v,g=v*t,y=3*g,k=v*y,b=y*t,x=e*p+n*k+i*b+o*d,w=a*p+r*k+s*b+h*d;l[u]=x,l[u+1]=w,c&&(l[u+2]=t<.001?Math.atan2(r-a,n-e):Math.atan2(w-(a*m+r*g*2+s*f),x-(e*m+n*g*2+i*f)))}}]),t}();we.NONE=-1,we.BEFORE=-2,we.AFTER=-3,we.epsilon=1e-5;var Ae,Ie=function(){function t(e,a){if(i(this,t),this.data=null,this.bone=null,this.color=null,this.darkColor=null,this.attachment=null,this.attachmentTime=0,this.attachmentState=0,this.deform=new Array,!e)throw new Error("data cannot be null.");if(!a)throw new Error("bone cannot be null.");this.data=e,this.bone=a,this.color=new A,this.darkColor=e.darkColor?new A:null,this.setToSetupPose()}return o(t,[{key:"getSkeleton",value:function(){return this.bone.skeleton}},{key:"getAttachment",value:function(){return this.attachment}},{key:"setAttachment",value:function(t){this.attachment!=t&&(t instanceof N&&this.attachment instanceof N&&t.deformAttachment==this.attachment.deformAttachment||(this.deform.length=0),this.attachment=t,this.attachmentTime=this.bone.skeleton.time)}},{key:"setAttachmentTime",value:function(t){this.attachmentTime=this.bone.skeleton.time-t}},{key:"getAttachmentTime",value:function(){return this.bone.skeleton.time-this.attachmentTime}},{key:"setToSetupPose",value:function(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}]),t}(),Ee=function(){function t(e,a){if(i(this,t),this.data=null,this.bones=null,this.target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new F,this.active=!1,!e)throw new Error("data cannot be null.");if(!a)throw new Error("skeleton cannot be null.");this.data=e,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,this.bones=new Array;for(var n=0;n0?I.degRad:-I.degRad,d=this.data.offsetRotation*f,v=this.data.offsetShearY*f,m=this.bones,p=0,g=m.length;pI.PI?A-=I.PI2:A<-I.PI&&(A+=I.PI2),A*=t;var E=Math.cos(A),S=Math.sin(A);y.a=E*k-S*x,y.b=E*b-S*w,y.c=S*k+E*x,y.d=S*b+E*w}if(s){var T=this.temp;o.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),y.worldX+=(T.x-y.worldX)*e,y.worldY+=(T.y-y.worldY)*a}if(0!=n){var R=Math.sqrt(y.a*y.a+y.c*y.c);0!=R&&(R=(R+(Math.sqrt(h*h+u*u)-R+this.data.offsetScaleX)*n)/R),y.a*=R,y.c*=R}if(0!=r){var C=Math.sqrt(y.b*y.b+y.d*y.d);0!=C&&(C=(C+(Math.sqrt(l*l+c*c)-C+this.data.offsetScaleY)*r)/C),y.b*=C,y.d*=C}if(i>0){var M=y.b,F=y.d,Y=Math.atan2(F,M),X=Math.atan2(c,l)-Math.atan2(u,h)-(Y-Math.atan2(y.c,y.a));X>I.PI?X-=I.PI2:X<-I.PI&&(X+=I.PI2),X=Y+(X+v)*i;var L=Math.sqrt(M*M+F*F);y.b=Math.cos(X)*L,y.d=Math.sin(X)*L}y.updateAppliedTransform()}}},{key:"applyRelativeWorld",value:function(){for(var t=this.mixRotate,e=this.mixX,a=this.mixY,n=this.mixScaleX,r=this.mixScaleY,i=this.mixShearY,s=0!=e||0!=a,o=this.target,h=o.a,l=o.b,u=o.c,c=o.d,f=h*c-l*u>0?I.degRad:-I.degRad,d=this.data.offsetRotation*f,v=this.data.offsetShearY*f,m=this.bones,p=0,g=m.length;pI.PI?A-=I.PI2:A<-I.PI&&(A+=I.PI2),A*=t;var E=Math.cos(A),S=Math.sin(A);y.a=E*k-S*x,y.b=E*b-S*w,y.c=S*k+E*x,y.d=S*b+E*w}if(s){var T=this.temp;o.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),y.worldX+=T.x*e,y.worldY+=T.y*a}if(0!=n){var R=(Math.sqrt(h*h+u*u)-1+this.data.offsetScaleX)*n+1;y.a*=R,y.c*=R}if(0!=r){var C=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleY)*r+1;y.b*=C,y.d*=C}if(i>0){var M=Math.atan2(c,l)-Math.atan2(u,h);M>I.PI?M-=I.PI2:M<-I.PI&&(M+=I.PI2);var F=y.b,Y=y.d;M=Math.atan2(Y,F)+(M-I.PI/2+v)*i;var X=Math.sqrt(F*F+Y*Y);y.b=Math.cos(M)*X,y.d=Math.sin(M)*X}y.updateAppliedTransform()}}},{key:"applyAbsoluteLocal",value:function(){for(var t=this.mixRotate,e=this.mixX,a=this.mixY,n=this.mixScaleX,r=this.mixScaleY,i=this.mixShearY,s=this.target,o=this.bones,h=0,l=o.length;h2&&void 0!==arguments[2]?arguments[2]:new Array(2);if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");for(var n=this.drawOrder,r=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=0,l=n.length;h0&&void 0!==arguments[0]?arguments[0]:0,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;i(this,t),this.slotIndex=e,this.name=a,this.attachment=n})),Ce=function(){function t(e){if(i(this,t),this.name=null,this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!e)throw new Error("name cannot be null.");this.name=e}return o(t,[{key:"setAttachment",value:function(t,e,a){if(!a)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]=a}},{key:"addSkin",value:function(t){for(var e=0;e= 0.");if(!a)throw new Error("name cannot be null.");if(!n)throw new Error("boneData cannot be null.");this.index=e,this.name=a,this.boneData=n}));!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(Ae||(Ae={}));var Fe,Ye=function(t){l(a,t);var e=d(a);function a(t){var n;return i(this,a),(n=e.call(this,t,0,!1)).bones=new Array,n.target=null,n.mixRotate=0,n.mixX=0,n.mixY=0,n.mixScaleX=0,n.mixScaleY=0,n.mixShearY=0,n.offsetRotation=0,n.offsetX=0,n.offsetY=0,n.offsetScaleX=0,n.offsetScaleY=0,n.offsetShearY=0,n.relative=!1,n.local=!1,n}return o(a)}(ve),Xe=function(){function t(e){i(this,t),this.scale=1,this.attachmentLoader=null,this.linkedMeshes=new Array,this.attachmentLoader=e}return o(t,[{key:"readSkeletonData",value:function(t){var e=this.scale,a=new Te;a.name="";var n=new Le(t),r=n.readInt32(),i=n.readInt32();a.hash=0==i&&0==r?null:i.toString(16)+r.toString(16),a.version=n.readString(),a.x=n.readFloat(),a.y=n.readFloat(),a.width=n.readFloat(),a.height=n.readFloat();var s=n.readBoolean();s&&(a.fps=n.readFloat(),a.imagesPath=n.readString(),a.audioPath=n.readString());var o=0;o=n.readInt(!0);for(var h=0;h0){for(var pn=new St(mn),gn=a.slots.length,yn=0;yn=0;wn--)xn[wn]=-1;for(var An=R.newArray(gn-bn,0),In=0,En=0,Sn=0;Sn=0;Rn--)-1==xn[Rn]&&(xn[Rn]=An[--En]);pn.setFrame(yn,kn,xn)}n.push(pn)}var Cn=t.readInt(!0);if(Cn>0){for(var Mn=new Et(Cn),Fn=0;Fn1&&void 0!==arguments[1]?arguments[1]:new Array,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new DataView(e.buffer);i(this,t),this.strings=a,this.index=n,this.buffer=r}return o(t,[{key:"readByte",value:function(){return this.buffer.getInt8(this.index++)}},{key:"readUnsignedByte",value:function(){return this.buffer.getUint8(this.index++)}},{key:"readShort",value:function(){var t=this.buffer.getInt16(this.index);return this.index+=2,t}},{key:"readInt32",value:function(){var t=this.buffer.getInt32(this.index);return this.index+=4,t}},{key:"readInt",value:function(t){var e=this.readByte(),a=127&e;return 0!=(128&e)&&(a|=(127&(e=this.readByte()))<<7,0!=(128&e)&&(a|=(127&(e=this.readByte()))<<14,0!=(128&e)&&(a|=(127&(e=this.readByte()))<<21,0!=(128&e)&&(a|=(127&(e=this.readByte()))<<28)))),t?a:a>>>1^-(1&a)}},{key:"readStringRef",value:function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]}},{key:"readString",value:function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",a=0;a>4){case 12:case 13:e+=String.fromCharCode((31&n)<<6|63&this.readByte()),a+=2;break;case 14:e+=String.fromCharCode((15&n)<<12|(63&this.readByte())<<6|63&this.readByte()),a+=3;break;default:e+=String.fromCharCode(n),a++}}return e}},{key:"readFloat",value:function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t}},{key:"readBoolean",value:function(){return 0!=this.readByte()}}]),t}(),Ne=o((function t(e,a,n,r,s){i(this,t),this.mesh=e,this.skin=a,this.slotIndex=n,this.parent=r,this.inheritDeform=s})),Pe=o((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;i(this,t),this.bones=e,this.vertices=a}));function _e(t,e,a){for(var n=t.readFloat(),r=t.readFloat()*a,i=0,s=0,o=e.getFrameCount()-1;e.setFrame(i,n,r),i!=o;i++){var h=t.readFloat(),l=t.readFloat()*a;switch(t.readByte()){case sa:e.setStepped(i);break;case oa:Be(t,e,s++,i,0,n,h,r,l,a)}n=h,r=l}return e}function Oe(t,e,a){for(var n=t.readFloat(),r=t.readFloat()*a,i=t.readFloat()*a,s=0,o=0,h=e.getFrameCount()-1;e.setFrame(s,n,r,i),s!=h;s++){var l=t.readFloat(),u=t.readFloat()*a,c=t.readFloat()*a;switch(t.readByte()){case sa:e.setStepped(s);break;case oa:Be(t,e,o++,s,0,n,l,r,u,a),Be(t,e,o++,s,1,n,l,i,c,a)}n=l,r=u,i=c}return e}function Be(t,e,a,n,r,i,s,o,h,l){e.setBezier(a,n,r,i,o,t.readFloat(),t.readFloat()*l,t.readFloat(),t.readFloat()*l,s,h)}!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"}(Fe||(Fe={}));var De,Ve=0,Ue=1,We=2,je=3,qe=4,Ge=5,ze=6,He=7,$e=8,Je=9,Qe=0,Ze=1,Ke=2,ta=3,ea=4,aa=5,na=0,ra=1,ia=2,sa=1,oa=2,ha=function(){function t(){i(this,t),this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new M((function(){return R.newFloatArray(16)}))}return o(t,[{key:"update",value:function(t,e){if(!t)throw new Error("skeleton cannot be null.");var a=this.boundingBoxes,n=this.polygons,r=this.polygonPool,i=t.slots,s=i.length;a.length=0,r.freeAll(n),n.length=0;for(var o=0;o=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}},{key:"aabbIntersectsSegment",value:function(t,e,a,n){var r=this.minX,i=this.minY,s=this.maxX,o=this.maxY;if(t<=r&&a<=r||e<=i&&n<=i||t>=s&&a>=s||e>=o&&n>=o)return!1;var h=(n-e)/(a-t),l=h*(r-t)+e;if(l>i&&li&&lr&&ur&&ut.minX&&this.minYt.minY}},{key:"containsPoint",value:function(t,e){for(var a=this.polygons,n=0,r=a.length;n=a||l=a){var u=n[o];u+(a-h)/(l-h)*(n[i]-u)=u&&k<=d||k>=d&&k<=u)&&(k>=e&&k<=n||k>=n&&k<=e)){var b=(l*g-h*m)/y;if((b>=c&&b<=v||b>=v&&b<=c)&&(b>=a&&b<=r||b>=r&&b<=a))return!0}u=d,c=v}return!1}},{key:"getPolygon",value:function(t){if(!t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}},{key:"getWidth",value:function(){return this.maxX-this.minX}},{key:"getHeight",value:function(){return this.maxY-this.minY}}]),t}(),la=function(){function t(){i(this,t),this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new M((function(){return new Array})),this.polygonIndicesPool=new M((function(){return new Array}))}return o(t,[{key:"triangulate",value:function(e){var a=e,n=e.length>>1,r=this.indicesArray;r.length=0;for(var i=0;i3;){for(var u=n-1,c=0,f=1;;){t:if(!s[c]){for(var d=r[u]<<1,v=r[c]<<1,m=r[f]<<1,p=a[d],g=a[d+1],y=a[v],k=a[v+1],b=a[m],x=a[m+1],w=(f+1)%n;w!=u;w=(w+1)%n)if(s[w]){var A=r[w]<<1,I=a[A],E=a[A+1];if(t.positiveArea(b,x,p,g,I,E)&&t.positiveArea(p,g,y,k,I,E)&&t.positiveArea(y,k,b,x,I,E))break t}break}if(0==f){do{if(!s[c])break;c--}while(c>0);break}u=c,c=f,f=(f+1)%n}l.push(r[(n+c-1)%n]),l.push(r[c]),l.push(r[(c+1)%n]),r.splice(c,1),s.splice(c,1);var S=(--n+c-1)%n,T=c==n?0:c;s[S]=t.isConcave(S,n,a,r),s[T]=t.isConcave(T,n,a,r)}return 3==n&&(l.push(r[2]),l.push(r[0]),l.push(r[1])),l}},{key:"decompose",value:function(e,a){var n=e,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var s=this.polygonIndicesPool.obtain();s.length=0;var o=this.polygonPool.obtain();o.length=0;for(var h=-1,l=0,u=0,c=a.length;u0?(r.push(o),i.push(s)):(this.polygonPool.free(o),this.polygonIndicesPool.free(s)),(o=this.polygonPool.obtain()).length=0,o.push(m),o.push(p),o.push(g),o.push(y),o.push(k),o.push(b),(s=this.polygonIndicesPool.obtain()).length=0,s.push(f),s.push(d),s.push(v),l=t.winding(m,p,g,y,k,b),h=f)}o.length>0&&(r.push(o),i.push(s));for(var E=0,S=r.length;E=0;$--)0==(o=r[$]).length&&(r.splice($,1),this.polygonPool.free(o),s=i[$],i.splice($,1),this.polygonIndicesPool.free(s));return r}}],[{key:"isConcave",value:function(t,e,a,n){var r=n[(e+t-1)%e]<<1,i=n[t]<<1,s=n[(t+1)%e]<<1;return!this.positiveArea(a[r],a[r+1],a[i],a[i+1],a[s],a[s+1])}},{key:"positiveArea",value:function(t,e,a,n,r,i){return t*(i-n)+a*(e-i)+r*(n-e)>=0}},{key:"winding",value:function(t,e,a,n,r,i){var s=a-t,o=n-e;return r*o-i*s+s*e-t*o>=0?1:-1}}]),t}(),ua=function(){function t(){i(this,t),this.triangulator=new la,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}return o(t,[{key:"clipStart",value:function(e,a){if(this.clipAttachment)return 0;this.clipAttachment=a;var n=a.worldVerticesLength,r=R.setArraySize(this.clippingPolygon,n);a.computeWorldVertices(e,0,n,r,0,2);var i=this.clippingPolygon;t.makeClockwise(i);for(var s=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i)),o=0,h=s.length;o>1,V=this.clipOutput,U=R.setArraySize(l,F+D*d),W=0;W=2?(u=o,o=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(a),u.push(n),u.push(r),u.push(i),u.push(t),u.push(e),o.length=0;for(var c=s,f=s.length-4,d=0;;d+=2){for(var v=c[d],m=c[d+1],p=c[d+2],g=c[d+3],y=v-p,k=m-g,b=u,x=u.length-2,w=o.length,A=0;A0;if(y*(E-g)-k*(I-p)>0){if(R){o.push(S),o.push(T);continue}var C=T-E,M=S-I,F=C*(p-v)-M*(g-m);if(Math.abs(F)>1e-6){var Y=(M*(m-E)-C*(v-I))/F;o.push(v+(p-v)*Y),o.push(m+(g-m)*Y)}else o.push(v),o.push(m)}else if(R){var X=T-E,L=S-I,N=X*(p-v)-L*(g-m);if(Math.abs(N)>1e-6){var P=(L*(m-E)-X*(v-I))/N;o.push(v+(p-v)*P),o.push(m+(g-m)*P)}else o.push(v),o.push(m);o.push(S),o.push(T)}l=!0}if(w==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),d==f)break;var _=o;(o=u).length=0,u=_}if(h!=o){h.length=0;for(var O=0,B=o.length-2;O>1;l=0;za--)-1==Ba[za]&&(Ba[za]=Va[--Wa])}La.setFrame(Pa,pa(Oa,"time",0),Ba)}r.push(La)}if(t.events){for(var Ha=new Et(t.events.length),$a=0,Ja=0;Ja)?=?)"),d("XRANGEIDENTIFIERLOOSE","".concat(h[l.NUMERICIDENTIFIERLOOSE],"|x|X|\\*")),d("XRANGEIDENTIFIER","".concat(h[l.NUMERICIDENTIFIER],"|x|X|\\*")),d("XRANGEPLAIN","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:".concat(h[l.PRERELEASE],")?").concat(h[l.BUILD],"?")+")?)?"),d("XRANGEPLAINLOOSE","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:".concat(h[l.PRERELEASELOOSE],")?").concat(h[l.BUILD],"?")+")?)?"),d("XRANGE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAIN],"$")),d("XRANGELOOSE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAINLOOSE],"$")),d("COERCE","".concat("(^|[^\\d])(\\d{1,").concat(a,"})")+"(?:\\.(\\d{1,".concat(a,"}))?")+"(?:\\.(\\d{1,".concat(a,"}))?")+"(?:$|[^\\d])"),d("COERCERTL",h[l.COERCE],!0),d("LONETILDE","(?:~>?)"),d("TILDETRIM","(\\s*)".concat(h[l.LONETILDE],"\\s+"),!0),e.tildeTrimReplace="$1~",d("TILDE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAIN],"$")),d("TILDELOOSE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAINLOOSE],"$")),d("LONECARET","(?:\\^)"),d("CARETTRIM","(\\s*)".concat(h[l.LONECARET],"\\s+"),!0),e.caretTrimReplace="$1^",d("CARET","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAIN],"$")),d("CARETLOOSE","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAINLOOSE],"$")),d("COMPARATORLOOSE","^".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],")$|^$")),d("COMPARATOR","^".concat(h[l.GTLT],"\\s*(").concat(h[l.FULLPLAIN],")$|^$")),d("COMPARATORTRIM","(\\s*)".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],"|").concat(h[l.XRANGEPLAIN],")"),!0),e.comparatorTrimReplace="$1$2$3",d("HYPHENRANGE","^\\s*(".concat(h[l.XRANGEPLAIN],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAIN],")")+"\\s*$"),d("HYPHENRANGELOOSE","^\\s*(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s*$"),d("STAR","(<|>)?=?\\s*\\*"),d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),d("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Ra,Ra.exports);var Ca=Ra.exports;Aa(Ca);var Ma=Object.freeze({loose:!0}),Fa=Object.freeze({}),Ya=function(t){return t?"object"!==r(t)?Ma:t:Fa};Aa(Ya);var Xa=/^[0-9]+$/,La=function(t,e){var a=Xa.test(t),n=Xa.test(e);return a&&n&&(t=+t,e=+e),t===e?0:a&&!n?-1:n&&!a?1:t_a)throw new TypeError("version is longer than ".concat(_a," characters"));Pa("SemVer",e,a),this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease;var n=e.trim().match(a.loose?Ba[Da.LOOSE]:Ba[Da.FULL]);if(!n)throw new TypeError("Invalid Version: ".concat(e));if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Oa||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Oa||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Oa||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(e===this.prerelease.join(".")&&!1===a)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(e){var i=[e,n];!1===a&&(i=[e]),0===Ua(this.prerelease[0],e)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break;default:throw new Error("invalid increment argument: ".concat(t))}return this.raw=this.format(),this.build.length&&(this.raw+="+".concat(this.build.join("."))),this}}]),t}(),ja=Wa;Aa(ja);var qa=ja,Ga=function(t,e){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t instanceof qa)return t;try{return new qa(t,e)}catch(t){if(!a)return null;throw t}};Aa(Ga);var za,Ha,$a=Ga,Ja=Aa((function(t,e){var a=$a(t,e);return a?a.version:null})),Qa=ja,Za=Ga,Ka=Ca.safeRe,tn=Ca.t,en=Aa((function(t,e){if(t instanceof Qa)return t;if("number"==typeof t&&(t=String(t)),"string"!=typeof t)return null;var a=null;if((e=e||{}).rtl){for(var n;(n=Ka[tn.COERCERTL].exec(t))&&(!a||a.index+a[0].length!==t.length);)a&&n.index+n[0].length===a.index+a[0].length||(a=n),Ka[tn.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;Ka[tn.COERCERTL].lastIndex=-1}else a=t.match(Ka[tn.COERCE]);return null===a?null:Za("".concat(a[2],".").concat(a[3]||"0",".").concat(a[4]||"0"),e)}));var an=nn;function nn(t){var e=this;if(e instanceof nn||(e=new nn),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var a=0,n=arguments.length;a1)a=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,a=this.head.value}for(var r=0;null!==n;r++)a=t(a,n.value,r),n=n.next;return a},nn.prototype.reduceReverse=function(t,e){var a,n=this.tail;if(arguments.length>1)a=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,a=this.tail.value}for(var r=this.length-1;null!==n;r--)a=t(a,n.value,r),n=n.prev;return a},nn.prototype.toArray=function(){for(var t=new Array(this.length),e=0,a=this.head;null!==a;e++)t[e]=a.value,a=a.next;return t},nn.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,a=this.tail;null!==a;e++)t[e]=a.value,a=a.prev;return t},nn.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var a=new nn;if(ethis.length&&(e=this.length);for(var n=0,r=this.head;null!==r&&nthis.length&&(e=this.length);for(var n=this.length,r=this.tail;null!==r&&n>e;n--)r=r.prev;for(;null!==r&&n>t;n--,r=r.prev)a.push(r.value);return a},nn.prototype.splice=function(t,e){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var a=0,n=this.head;null!==n&&athis[un])return En(this,this[yn].get(t)),!1;var i=this[yn].get(t).value;return this[mn]&&(this[pn]||this[mn](t,i.value)),i.now=n,i.maxAge=a,i.value=e,this[cn]+=r-i.length,i.length=r,this.get(t),In(this),!0}var s=new Sn(t,e,r,n,a);return s.length>this[un]?(this[mn]&&this[mn](t,e),!1):(this[cn]+=s.length,this[gn].unshift(s),this[yn].set(t,this[gn].head),In(this),!0)}},{key:"has",value:function(t){if(!this[yn].has(t))return!1;var e=this[yn].get(t).value;return!An(this,e)}},{key:"get",value:function(t){return wn(this,t,!0)}},{key:"peek",value:function(t){return wn(this,t,!1)}},{key:"pop",value:function(){var t=this[gn].tail;return t?(En(this,t),t.value):null}},{key:"del",value:function(t){En(this,this[yn].get(t))}},{key:"load",value:function(t){this.reset();for(var e=Date.now(),a=t.length-1;a>=0;a--){var n=t[a],r=n.e||0;if(0===r)this.set(n.k,n.v);else{var i=r-e;i>0&&this.set(n.k,n.v,i)}}}},{key:"prune",value:function(){var t=this;this[yn].forEach((function(e,a){return wn(t,a,!1)}))}}]),t}(),wn=function(t,e,a){var n=t[yn].get(e);if(n){var r=n.value;if(An(t,r)){if(En(t,n),!t[dn])return}else a&&(t[kn]&&(n.value.now=Date.now()),t[gn].unshiftNode(n));return r.value}},An=function(t,e){if(!e||!e.maxAge&&!t[vn])return!1;var a=Date.now()-e.now;return e.maxAge?a>e.maxAge:t[vn]&&a>t[vn]},In=function(t){if(t[cn]>t[un])for(var e=t[gn].tail;t[cn]>t[un]&&null!==e;){var a=e.prev;En(t,e),e=a}},En=function(t,e){if(e){var a=e.value;t[mn]&&t[mn](a.key,a.value),t[cn]-=a.length,t[yn].delete(a.key),t[gn].removeNode(e)}},Sn=o((function t(e,a,n,r,s){i(this,t),this.key=e,this.value=a,this.length=n,this.now=r,this.maxAge=s||0})),Tn=function(t,e,a,n){var r=a.value;An(t,r)&&(En(t,a),t[dn]||(r=void 0)),r&&e.call(n,r.value,r.key,t)},Rn=xn;Aa(Rn);var Cn=ja,Mn=function(t,e,a){return new Cn(t,a).compare(new Cn(e,a))};Aa(Mn);var Fn=Mn,Yn=function(t,e,a){return 0===Fn(t,e,a)};Aa(Yn);var Xn=Mn,Ln=function(t,e,a){return 0!==Xn(t,e,a)};Aa(Ln);var Nn=Mn,Pn=function(t,e,a){return Nn(t,e,a)>0};Aa(Pn);var _n=Mn,On=function(t,e,a){return _n(t,e,a)>=0};Aa(On);var Bn=Mn,Dn=function(t,e,a){return Bn(t,e,a)<0};Aa(Dn);var Vn=Mn,Un=function(t,e,a){return Vn(t,e,a)<=0};Aa(Un);var Wn,jn,qn,Gn,zn=Yn,Hn=Ln,$n=Pn,Jn=On,Qn=Dn,Zn=Un,Kn=function(t,e,a,n){switch(e){case"===":return"object"===r(t)&&(t=t.version),"object"===r(a)&&(a=a.version),t===a;case"!==":return"object"===r(t)&&(t=t.version),"object"===r(a)&&(a=a.version),t!==a;case"":case"=":case"==":return zn(t,a,n);case"!=":return Hn(t,a,n);case">":return $n(t,a,n);case">=":return Jn(t,a,n);case"<":return Qn(t,a,n);case"<=":return Zn(t,a,n);default:throw new TypeError("Invalid operator: ".concat(e))}};function tr(){if(Gn)return qn;Gn=1;var t=function(){function t(e,r){var s=this;if(i(this,t),r=a(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof n)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((function(t){return s.parseRange(t.trim())})).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: ".concat(this.raw));if(this.set.length>1){var o=this.set[0];if(this.set=this.set.filter((function(t){return!m(t[0])})),0===this.set.length)this.set=[o];else if(this.set.length>1){var h,l=k(this.set);try{for(l.s();!(h=l.n()).done;){var u=h.value;if(1===u.length&&g(u[0])){this.set=[u];break}}}catch(t){l.e(t)}finally{l.f()}}}this.format()}return o(t,[{key:"format",value:function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range}},{key:"toString",value:function(){return this.range}},{key:"parseRange",value:function(t){var a=this,i=((this.options.includePrerelease&&d)|(this.options.loose&&v))+":"+t,s=e.get(i);if(s)return s;var o=this.options.loose,g=o?h[l.HYPHENRANGELOOSE]:h[l.HYPHENRANGE];t=t.replace(g,M(this.options.includePrerelease)),r("hyphen replace",t),t=t.replace(h[l.COMPARATORTRIM],u),r("comparator trim",t),t=t.replace(h[l.TILDETRIM],c),r("tilde trim",t),t=t.replace(h[l.CARETTRIM],f),r("caret trim",t);var y=t.split(" ").map((function(t){return b(t,a.options)})).join(" ").split(/\s+/).map((function(t){return C(t,a.options)}));o&&(y=y.filter((function(t){return r("loose invalid filter",t,a.options),!!t.match(h[l.COMPARATORLOOSE])}))),r("range list",y);var x,w=new Map,A=y.map((function(t){return new n(t,a.options)})),I=k(A);try{for(I.s();!(x=I.n()).done;){var E=x.value;if(m(E))return[E];w.set(E.value,E)}}catch(t){I.e(t)}finally{I.f()}w.size>1&&w.has("")&&w.delete("");var S=p(w.values());return e.set(i,S),S}},{key:"intersects",value:function(e,a){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((function(t){return y(t,a)&&e.set.some((function(e){return y(e,a)&&t.every((function(t){return e.every((function(e){return t.intersects(e,a)}))}))}))}))}},{key:"test",value:function(t){if(!t)return!1;if("string"==typeof t)try{t=new s(t,this.options)}catch(t){return!1}for(var e=0;e")||!t.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!t.operator.startsWith("<"))&&(this.semver.version!==t.semver.version||!this.operator.includes("=")||!t.operator.includes("="))&&!(s(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<"))&&!(s(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}}],[{key:"ANY",get:function(){return t}}]),e}();Wn=e;var a=Ya,n=Ca.safeRe,r=Ca.t,s=Kn,h=Ta,l=ja,u=tr();return Wn}(),r=Ta,s=ja,h=Ca.safeRe,l=Ca.t,u=Ca.comparatorTrimReplace,c=Ca.tildeTrimReplace,f=Ca.caretTrimReplace,d=Ia.FLAG_INCLUDE_PRERELEASE,v=Ia.FLAG_LOOSE,m=function(t){return"<0.0.0-0"===t.value},g=function(t){return""===t.value},y=function(t,e){for(var a=!0,n=t.slice(),r=n.pop();a&&n.length;)a=n.every((function(t){return r.intersects(t,e)})),r=n.pop();return a},b=function(t,e){return r("comp",t,e),t=I(t,e),r("caret",t),t=w(t,e),r("tildes",t),t=S(t,e),r("xrange",t),t=R(t,e),r("stars",t),t},x=function(t){return!t||"x"===t.toLowerCase()||"*"===t},w=function(t,e){return t.trim().split(/\s+/).map((function(t){return A(t,e)})).join(" ")},A=function(t,e){var a=e.loose?h[l.TILDELOOSE]:h[l.TILDE];return t.replace(a,(function(e,a,n,i,s){var o;return r("tilde",t,e,a,n,i,s),x(a)?o="":x(n)?o=">=".concat(a,".0.0 <").concat(+a+1,".0.0-0"):x(i)?o=">=".concat(a,".").concat(n,".0 <").concat(a,".").concat(+n+1,".0-0"):s?(r("replaceTilde pr",s),o=">=".concat(a,".").concat(n,".").concat(i,"-").concat(s," <").concat(a,".").concat(+n+1,".0-0")):o=">=".concat(a,".").concat(n,".").concat(i," <").concat(a,".").concat(+n+1,".0-0"),r("tilde return",o),o}))},I=function(t,e){return t.trim().split(/\s+/).map((function(t){return E(t,e)})).join(" ")},E=function(t,e){r("caret",t,e);var a=e.loose?h[l.CARETLOOSE]:h[l.CARET],n=e.includePrerelease?"-0":"";return t.replace(a,(function(e,a,i,s,o){var h;return r("caret",t,e,a,i,s,o),x(a)?h="":x(i)?h=">=".concat(a,".0.0").concat(n," <").concat(+a+1,".0.0-0"):x(s)?h="0"===a?">=".concat(a,".").concat(i,".0").concat(n," <").concat(a,".").concat(+i+1,".0-0"):">=".concat(a,".").concat(i,".0").concat(n," <").concat(+a+1,".0.0-0"):o?(r("replaceCaret pr",o),h="0"===a?"0"===i?">=".concat(a,".").concat(i,".").concat(s,"-").concat(o," <").concat(a,".").concat(i,".").concat(+s+1,"-0"):">=".concat(a,".").concat(i,".").concat(s,"-").concat(o," <").concat(a,".").concat(+i+1,".0-0"):">=".concat(a,".").concat(i,".").concat(s,"-").concat(o," <").concat(+a+1,".0.0-0")):(r("no pr"),h="0"===a?"0"===i?">=".concat(a,".").concat(i,".").concat(s).concat(n," <").concat(a,".").concat(i,".").concat(+s+1,"-0"):">=".concat(a,".").concat(i,".").concat(s).concat(n," <").concat(a,".").concat(+i+1,".0-0"):">=".concat(a,".").concat(i,".").concat(s," <").concat(+a+1,".0.0-0")),r("caret return",h),h}))},S=function(t,e){return r("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return T(t,e)})).join(" ")},T=function(t,e){t=t.trim();var a=e.loose?h[l.XRANGELOOSE]:h[l.XRANGE];return t.replace(a,(function(a,n,i,s,o,h){r("xRange",t,a,n,i,s,o,h);var l=x(i),u=l||x(s),c=u||x(o),f=c;return"="===n&&f&&(n=""),h=e.includePrerelease?"-0":"",l?a=">"===n||"<"===n?"<0.0.0-0":"*":n&&f?(u&&(s=0),o=0,">"===n?(n=">=",u?(i=+i+1,s=0,o=0):(s=+s+1,o=0)):"<="===n&&(n="<",u?i=+i+1:s=+s+1),"<"===n&&(h="-0"),a="".concat(n+i,".").concat(s,".").concat(o).concat(h)):u?a=">=".concat(i,".0.0").concat(h," <").concat(+i+1,".0.0-0"):c&&(a=">=".concat(i,".").concat(s,".0").concat(h," <").concat(i,".").concat(+s+1,".0-0")),r("xRange return",a),a}))},R=function(t,e){return r("replaceStars",t,e),t.trim().replace(h[l.STAR],"")},C=function(t,e){return r("replaceGTE0",t,e),t.trim().replace(h[e.includePrerelease?l.GTE0PRE:l.GTE0],"")},M=function(t){return function(e,a,n,r,i,s,o,h,l,u,c,f,d){return a=x(n)?"":x(r)?">=".concat(n,".0.0").concat(t?"-0":""):x(i)?">=".concat(n,".").concat(r,".0").concat(t?"-0":""):s?">=".concat(a):">=".concat(a).concat(t?"-0":""),h=x(l)?"":x(u)?"<".concat(+l+1,".0.0-0"):x(c)?"<".concat(l,".").concat(+u+1,".0-0"):f?"<=".concat(l,".").concat(u,".").concat(c,"-").concat(f):t?"<".concat(l,".").concat(u,".").concat(+c+1,"-0"):"<=".concat(h),"".concat(a," ").concat(h).trim()}},F=function(t,e,a){for(var i=0;i0){var o=t[s].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0};return qn}Aa(Kn);var er,ar,nr=tr(),rr=function(t,e,a){try{e=new nr(e,a)}catch(t){return!1}return e.test(t)},ir={valid:Ja,coerce:en,satisfies:Aa(rr),SEMVER_SPEC_VERSION:Ea.SEMVER_SPEC_VERSION},sr=0,or=1,hr=2,lr=[0,1,2,2,3,0],ur=function(){function t(e,n,r,s){var o;if(i(this,t),h(this,"autoUpdate",!0),h(this,"skeleton",void 0),h(this,"states",void 0),this._app=e,this._position=new a.Vec3,1===Kt.length){var l,u=k((o=new Kt(n)).pages);try{for(u.s();!(l=u.n()).done;){var c=l.value;c.setTexture(new wa(s[c.name]))}}catch(t){u.e(t)}finally{u.f()}}else o=new Kt(n,(function(t){return new wa(s[t])}));var f=new ca(new he(o));f.scale*=.01;var d=f.readSkeletonData(r);this.skeletonVersion=ir.valid(ir.coerce(d.version)),this._spine_3_6_0=ir.satisfies(this.skeletonVersion,"<=3.6.0"),this._spine_3_7_99=ir.satisfies(this.skeletonVersion,"<=3.7.99"),this._spine_4_0_X=ir.satisfies(this.skeletonVersion,"~4.0.0"),this._spine_4_1_X=ir.satisfies(this.skeletonVersion,"~4.1.23"),this.skeleton=new Se(d),this.skeleton.updateWorldTransform(),this.stateData=new zt(this.skeleton.data),this.states=[new Xt(this.stateData)],this.clipper=new ua,this._node=new a.GraphNode,this._meshes=[],this._meshInstances=[],this._materials={},this._tint={},this._aabb=new a.BoundingBox,this._aabbTempArray=[],this._aabbTempOffset=new a.Vec2,this._aabbTempSize=new a.Vec2,this._renderCounts={vertexCount:0,indexCount:0},this._vertexFormat=null,this._vertexBuffer=null,this._indexBuffer=null,this._priority=0,this._timeScale=1,this._layers=[a.LAYERID_UI],this.init(),this._hidden=!1}return o(t,[{key:"destroy",value:function(){this.removeFromLayers();for(var t=0;t0&&this._renderCounts.vertexCount>0){this.skeleton.getBounds(this._aabbTempOffset,this._aabbTempSize,this._aabbTempArray),this._aabb.center=new a.Vec3(this._aabbTempOffset.x,this._aabbTempOffset.y,0),this._aabb.halfExtents=new a.Vec3(.5*this._aabbTempSize.x,.5*this._aabbTempSize.y,0),(!this._vertexBuffer||this._vertexBuffer.getNumVertices()0&&c.indices.length>0){t&&t!==c.material&&(this.SubmitBatch(e,n,t),t=c.material,e=s,n=0),t=c.material;var f=c.positions,d=c.vertexColor.r,v=c.vertexColor.g,m=c.vertexColor.b,p=c.vertexColor.a,g=c.uvs,y=void 0,k=f.length/2;for(y=0;y0){var r=new a.Mesh(this._app.graphicsDevice);r.vertexBuffer=this._vertexBuffer,r.indexBuffer[0]=this._indexBuffer,r.primitive[0].type=a.PRIMITIVE_TRIANGLES,r.primitive[0].base=t,r.primitive[0].count=e,r.primitive[0].indexed=!0,r.aabb=this._aabb,this._meshes.push(r);var i=new a.MeshInstance(r,this._materials[n],this._node);i.drawOrder=this.priority+this._meshInstances.length,i.visible=!this._hidden,this._meshInstances.push(i)}}},{key:"update",value:function(t){if(!this._hidden){var e;t*=this._timeScale;var a=this.states.length;for(e=0;e=0;--i){var s=this.tryEntries[i],o=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var h=a.call(s,"catchLoc"),l=a.call(s,"finallyLoc");if(h&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;M(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:Y(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,o=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){o=!0,i=t},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw i}}}}function k(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var b=function(){function t(){i(this,t),this.array=new Array}return o(t,[{key:"add",value:function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e}},{key:"contains",value:function(t){return null!=this.array[0|t]}},{key:"remove",value:function(t){this.array[0|t]=void 0}},{key:"clear",value:function(){this.array.length=0}}]),t}(),x=function(){function t(){i(this,t),this.entries={},this.size=0}return o(t,[{key:"add",value:function(t){var e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}},{key:"addAll",value:function(t){for(var e=this.size,n=0,r=t.length;n0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;i(this,t),this.r=e,this.g=n,this.b=r,this.a=a}return o(t,[{key:"set",value:function(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this.clamp()}},{key:"setFromColor",value:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}},{key:"setFromString",value: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?1:parseInt(t.substr(6,2),16)/255,this}},{key:"add",value:function(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,this.a+=r,this.clamp()}},{key:"clamp",value: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}}],[{key:"rgba8888ToColor",value: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}},{key:"rgb888ToColor",value:function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}},{key:"fromString",value:function(e){return(new t).setFromString(e)}}]),t}();E.WHITE=new E(1,1,1,1),E.RED=new E(1,0,0,1),E.GREEN=new E(0,1,0,1),E.BLUE=new E(0,0,1,1),E.MAGENTA=new E(1,0,1,1);var I=function(){function t(){i(this,t)}return o(t,null,[{key:"clamp",value:function(t,e,n){return tn?n:t}},{key:"cosDeg",value:function(e){return Math.cos(e*t.degRad)}},{key:"sinDeg",value:function(e){return Math.sin(e*t.degRad)}},{key:"signum",value:function(t){return t>0?1:t<0?-1:0}},{key:"toInt",value:function(t){return t>0?Math.floor(t):Math.ceil(t)}},{key:"cbrt",value:function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}},{key:"randomTriangular",value:function(e,n){return t.randomTriangularWith(e,n,.5*(e+n))}},{key:"randomTriangularWith",value:function(t,e,n){var r=Math.random(),a=e-t;return r<=(n-t)/a?t+Math.sqrt(r*a*(n-t)):e-Math.sqrt((1-r)*a*(e-n))}},{key:"isPowerOfTwo",value:function(t){return t&&0==(t&t-1)}}]),t}();I.PI=3.1415927,I.PI2=2*I.PI,I.radiansToDegrees=180/I.PI,I.radDeg=I.radiansToDegrees,I.degreesToRadians=I.PI/180,I.degRad=I.degreesToRadians;var A=function(){function t(){i(this,t)}return o(t,[{key:"apply",value:function(t,e,n){return t+(e-t)*this.applyInternal(n)}}]),t}(),S=function(t){l(n,t);var e=d(n);function n(t){var r;return i(this,n),(r=e.call(this)).power=2,r.power=t,r}return o(n,[{key:"applyInternal",value:function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}]),n}(A),T=function(t){l(n,t);var e=d(n);function n(t){return i(this,n),e.call(this,t)}return o(n,[{key:"applyInternal",value:function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}]),n}(S),R=function(){function t(){i(this,t)}return o(t,null,[{key:"arrayCopy",value:function(t,e,n,r,a){for(var i=e,s=r;i2&&void 0!==arguments[2]?arguments[2]:0,r=t.length;if(r==e)return t;if(t.length=e,r2&&void 0!==arguments[2]?arguments[2]:0;return e.length>=n?e:t.setArraySize(e,n,r)}},{key:"newArray",value:function(t,e){for(var n=new Array(t),r=0;r0?this.items.pop():this.instantiator()}},{key:"free",value:function(t){t.reset&&t.reset(),this.items.push(t)}},{key:"freeAll",value:function(t){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(this,t),this.x=e,this.y=n}return o(t,[{key:"set",value:function(t,e){return this.x=t,this.y=e,this}},{key:"length",value:function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}},{key:"normalize",value:function(){var t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}}]),t}(),Y=function(){function t(){i(this,t),this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.frameTime=0}return o(t,[{key:"update",value:function(){var t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}]),t}(),L=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;i(this,t),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(e)}return o(t,[{key:"hasEnoughData",value:function(){return this.addedValues>=this.values.length}},{key:"addValue",value:function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}},{key:"getMean",value:function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*i;var s=t.bone.skeleton,o=t.deform,h=this.vertices,l=this.bones;if(l){for(var u=0,c=0,f=0;f0&&(h=o);for(var N=t.bone,P=N.worldX,_=N.worldY,O=N.a,B=N.b,D=N.c,V=N.d,U=e,q=a;q=this.regions.length&&(n=this.regions.length-1);var r=this.regions[n];e.region!=r&&(e.region=r,e.updateRegion())}},{key:"getPath",value:function(t,e){for(var n=t,r=(this.start+e).toString(),a=this.digits-r.length;a>0;a--)n+="0";return n+=r}}],[{key:"nextID",value:function(){return t._nextID++}}]),t}();_._nextID=0,function(t){t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse"}(P||(P={}));var O,B,D=[P.hold,P.once,P.loop,P.pingpong,P.onceReverse,P.loopReverse,P.pingpongReverse],V=function(){function t(e,n,r){if(i(this,t),this.timelines=[],this.timelineIds=new x,!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(n),this.duration=r}return o(t,[{key:"setTimelines",value:function(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e0&&(e%=this.duration));for(var h=this.timelines,l=0,u=h.length;le)return r-1;return n-1}},{key:"search",value:function(t,e,n){for(var r=t.length,a=n;ae)return a-n;return r-n}}]),t}(),lt=function(t){l(n,t);var e=d(n);function n(t,r,a){var s;return i(this,n),(s=e.call(this,t,a)).curves=R.newFloatArray(t+18*r),s.curves[t-1]=1,s}return o(n,[{key:"setLinear",value:function(t){this.curves[t]=0}},{key:"setStepped",value:function(t){this.curves[t]=1}},{key:"shrink",value:function(t){var e=this.getFrameCount()+18*t;if(this.curves.length>e){var n=R.newFloatArray(e);R.arrayCopy(this.curves,0,n,0,e),this.curves=n}}},{key:"setBezier",value:function(t,e,n,r,a,i,s,o,h,l,u){var c=this.curves,f=this.getFrameCount()+18*t;0==n&&(c[e]=2+f);for(var d=.03*(r-2*i+o),v=.03*(a-2*s+h),m=.006*(3*(i-o)-r+l),p=.006*(3*(s-h)-a+u),g=2*d+m,y=2*v+p,w=.3*(i-r)+d+.16666667*m,k=.3*(s-a)+v+.16666667*p,b=r+w,x=a+k,E=f+18;ft){var i=this.frames[e],s=this.frames[e+n];return s+(t-i)/(a[r]-i)*(a[r+1]-s)}var o=r+18;for(r+=2;r=t){var h=a[r-2],l=a[r-1];return l+(t-h)/(a[r]-h)*(a[r+1]-l)}e+=this.getFrameEntries();var u=a[o-2],c=a[o-1];return c+(t-u)/(this.frames[e]-u)*(this.frames[e+n]-c)}}]),n}(ht),ut=function(t){l(n,t);var e=d(n);function n(t,r,a){return i(this,n),e.call(this,t,r,[a])}return o(n,[{key:"getFrameEntries",value:function(){return 2}},{key:"setFrame",value:function(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+1]=n}},{key:"getCurveValue",value:function(t){for(var e=this.frames,n=e.length-2,r=2;r<=n;r+=2)if(e[r]>t){n=r-2;break}var a=this.curves[n>>1];switch(a){case 0:var i=e[n],s=e[n+1];return s+(t-i)/(e[n+2]-i)*(e[n+2+1]-s);case 1:return e[n+1]}return this.getBezierValue(t,n,1,a-2)}}]),n}(lt),ct=function(t){l(n,t);var e=d(n);function n(t,r,a,s){return i(this,n),e.call(this,t,r,[a,s])}return o(n,[{key:"getFrameEntries",value:function(){return 3}},{key:"setFrame",value:function(t,e,n,r){t*=3,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=r}}]),n}(lt),ft=function(t){l(n,t);var e=d(n);function n(t,r,a){var s;return i(this,n),(s=e.call(this,t,r,U+"|"+a)).boneIndex=0,s.boneIndex=a,s}return o(n,[{key:"apply",value:function(t,e,n,r,a,i,s){var o=t.bones[this.boneIndex];if(o.active)if(n>2];switch(m){case 0:var p=h[v];c=h[v+1],f=h[v+2],d=h[v+3];var g=(n-p)/(h[v+4]-p);c+=(h[v+4+1]-c)*g,f+=(h[v+4+2]-f)*g,d+=(h[v+4+3]-d)*g;break;case 1:c=h[v+1],f=h[v+2],d=h[v+3];break;default:c=this.getBezierValue(n,v,1,m-2),f=this.getBezierValue(n,v,2,m+18-2),d=this.getBezierValue(n,v,3,m+36-2)}if(1==a)l.r=c,l.g=f,l.b=d;else{if(i==O.setup){var y=o.data.color;l.r=y.r,l.g=y.g,l.b=y.b}l.r+=(c-l.r)*a,l.g+=(f-l.g)*a,l.b+=(d-l.b)*a}}}}}]),n}(lt),It=function(t){l(n,t);var e=d(n);function n(t,r,a){var s;return i(this,n),(s=e.call(this,t,r,J+"|"+a)).slotIndex=0,s.slotIndex=a,s}return o(n,[{key:"apply",value:function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=o.color;if(n>3];switch(b){case 0:var x=h[k];d=h[k+1],v=h[k+2],m=h[k+3],p=h[k+4],g=h[k+5],y=h[k+6],w=h[k+7];var E=(n-x)/(h[k+8]-x);d+=(h[k+8+1]-d)*E,v+=(h[k+8+2]-v)*E,m+=(h[k+8+3]-m)*E,p+=(h[k+8+4]-p)*E,g+=(h[k+8+5]-g)*E,y+=(h[k+8+6]-y)*E,w+=(h[k+8+7]-w)*E;break;case 1:d=h[k+1],v=h[k+2],m=h[k+3],p=h[k+4],g=h[k+5],y=h[k+6],w=h[k+7];break;default:d=this.getBezierValue(n,k,1,b-2),v=this.getBezierValue(n,k,2,b+18-2),m=this.getBezierValue(n,k,3,b+36-2),p=this.getBezierValue(n,k,4,b+54-2),g=this.getBezierValue(n,k,5,b+72-2),y=this.getBezierValue(n,k,6,b+90-2),w=this.getBezierValue(n,k,7,b+108-2)}if(1==a)l.set(d,v,m,p),u.r=g,u.g=y,u.b=w;else{if(i==O.setup){l.setFromColor(o.data.color);var I=o.data.darkColor;u.r=I.r,u.g=I.g,u.b=I.b}l.add((d-l.r)*a,(v-l.g)*a,(m-l.b)*a,(p-l.a)*a),u.r+=(g-u.r)*a,u.g+=(y-u.g)*a,u.b+=(w-u.b)*a}}}}}]),n}(lt),St=function(t){l(n,t);var e=d(n);function n(t,r,a){var s;return i(this,n),(s=e.call(this,t,r,[$+"|"+a,K+"|"+a])).slotIndex=0,s.slotIndex=a,s}return o(n,[{key:"getFrameEntries",value:function(){return 7}},{key:"setFrame",value:function(t,e,n,r,a,i,s,o){t*=7,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=a,this.frames[t+4]=i,this.frames[t+5]=s,this.frames[t+6]=o}},{key:"apply",value:function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=this.frames,l=o.color,u=o.darkColor;if(nt){var i=this.frames[e];return n[r+1]*(t-i)/(n[r]-i)}var s=r+18;for(r+=2;r=t){var o=n[r-2],h=n[r-1];return h+(t-o)/(n[r]-o)*(n[r+1]-h)}var l=n[s-2],u=n[s-1];return u+(1-u)*(t-l)/(this.frames[e+this.getFrameEntries()]-l)}},{key:"apply",value:function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=o.getAttachment();if(h&&h instanceof N&&h.timelineAttachment==this.attachment){var l=o.deform;0==l.length&&(i=O.setup);var u=this.vertices,c=u[0].length,f=this.frames;if(n=f[f.length-1]){var p=u[f.length-1];if(1==a)if(i==O.add){var g=h;if(g.bones)for(var y=0;yn)this.apply(t,e,Number.MAX_VALUE,r,a,i,s),e=-1;else if(e>=o[h-1])return;if(!(n0&&o[l-1]==u;)l--;for(;l=o[l];l++)r.push(this.events[l])}}}}]),n}(ht);Ct.propertyIds=[""+tt];var Mt=function(t){l(n,t);var e=d(n);function n(t){var r;return i(this,n),(r=e.call(this,t,n.propertyIds)).drawOrders=new Array(t),r}return o(n,[{key:"getFrameCount",value:function(){return this.frames.length}},{key:"setFrame",value:function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n}},{key:"apply",value:function(t,e,n,r,a,i,s){if(s!=B.mixOut)if(n>2];switch(d){case 0:var v=h[f];l=h[f+1],u=h[f+2],c=h[f+3];var m=(n-v)/(h[f+4]-v);l+=(h[f+4+1]-l)*m,u+=(h[f+4+2]-u)*m,c+=(h[f+4+3]-c)*m;break;case 1:l=h[f+1],u=h[f+2],c=h[f+3];break;default:l=this.getBezierValue(n,f,1,d-2),u=this.getBezierValue(n,f,2,d+18-2),c=this.getBezierValue(n,f,3,d+36-2)}if(i==O.setup){var p=o.data;o.mixRotate=p.mixRotate+(l-p.mixRotate)*a,o.mixX=p.mixX+(u-p.mixX)*a,o.mixY=p.mixY+(c-p.mixY)*a}else o.mixRotate+=(l-o.mixRotate)*a,o.mixX+=(u-o.mixX)*a,o.mixY+=(c-o.mixY)*a}}}}]),n}(lt),Pt=function(t){l(n,t);var e=d(n);function n(t,r,a){var s;return i(this,n),(s=e.call(this,t,[ot+"|"+r+"|"+a.sequence.id])).slotIndex=r,s.attachment=a,s}return o(n,[{key:"getFrameEntries",value:function(){return n.ENTRIES}},{key:"getSlotIndex",value:function(){return this.slotIndex}},{key:"getAttachment",value:function(){return this.attachment}},{key:"setFrame",value:function(t,e,r,a,i){var s=this.frames;s[t*=n.ENTRIES]=e,s[t+n.MODE]=r|a<<4,s[t+n.DELAY]=i}},{key:"apply",value:function(t,e,r,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=h.attachment,u=this.attachment;if(l==u||l instanceof N&&l.timelineAttachment==u){var c=this.frames;if(r>4,g=this.attachment.sequence.regions.length,y=D[15&v];if(y!=P.hold)switch(p+=(r-d)/m+1e-5|0,y){case P.once:p=Math.min(g-1,p);break;case P.loop:p%=g;break;case P.pingpong:var w=(g<<1)-2;(p=0==w?0:p%w)>=g&&(p=w-p);break;case P.onceReverse:p=Math.max(g-1-p,0);break;case P.loopReverse:p=g-1-p%g;break;case P.pingpongReverse:var k=(g<<1)-2;(p=0==k?0:(p+g-1)%k)>=g&&(p=k-p)}h.sequenceIndex=p}}}}}}]),n}(ht);Pt.ENTRIES=3,Pt.MODE=1,Pt.DELAY=2;var _t=function(){function t(e){i(this,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 x,this.animationsChanged=!1,this.trackEntryPool=new M((function(){return new Bt})),this.data=e}return o(t,[{key:"update",value:function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(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(n,s,!0);s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){e[n]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,t)){var h=a.mixingFrom;for(a.mixingFrom=null,h&&(h.mixingTo=null);h;)this.queue.end(h),h=h.mixingFrom}a.trackTime+=i}}this.queue.drain()}},{key:"updateMixingFrom",value:function(t,e){var n=t.mixingFrom;if(!n)return!0;var r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)}},{key:"apply",value:function(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var e=this.events,n=this.tracks,r=!1,a=0,i=n.length;a0)){r=!0;var o=0==a?O.first:s.mixBlend,h=s.alpha;s.mixingFrom?h*=this.applyMixingFrom(s,t,o):s.trackTime>=s.trackEnd&&!s.next&&(h=0);var l=s.animationLast,u=s.getAnimationTime(),c=u,f=e;s.reverse&&(c=s.animation.duration-c,f=null);var d=s.animation.timelines,v=d.length;if(0==a&&1==h||o==O.add)for(var m=0;m1&&(a=1),n!=O.first&&(n=r.mixBlend));var i=a0&&this.queueEvents(r,f),this.events.length=0,r.nextAnimationLast=f,r.nextTrackLast=r.trackTime,a}},{key:"applyAttachmentTimeline",value:function(t,e,n,r,a){var i=e.slots[t.slotIndex];i.bone.active&&(n0,p=d>=0;I.signum(v)!=I.signum(f)&&Math.abs(v)<=90&&(Math.abs(d)>180&&(d+=360*I.signum(d)),p=m),c=f+d-d%360,p!=m&&(c+=360*I.signum(d)),i[s]=c}i[s+1]=f,h.rotation=l+c*r}}else t.apply(e,0,n,null,1,a,B.mixIn)}},{key:"queueEvents",value:function(t,e){for(var n=t.animationStart,r=t.animationEnd,a=r-n,i=t.trackLast%a,s=this.events,o=0,h=s.length;or||this.queue.event(t,l)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(e){this.queue.end(e),this.clearNext(e);for(var n=e;;){var r=n.mixingFrom;if(!r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}}},{key:"setCurrent",value:function(t,e,n){var r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}},{key:"setAnimation",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,n)}},{key:"setAnimationWith",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)throw new Error("animation cannot be null.");var r=!0,a=this.expandToIndex(t);a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,r=!1):this.clearNext(a));var i=this.trackEntry(t,e,n,a);return this.setCurrent(t,i,r),this.queue.drain(),i}},{key:"addAnimation",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=this.data.skeletonData.findAnimation(e);if(!a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,n,r)}},{key:"addAnimationWith",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!e)throw new Error("animation cannot be null.");var a=this.expandToIndex(t);if(a)for(;a.next;)a=a.next;var i=this.trackEntry(t,e,n,a);return a?(a.next=i,i.previous=a,r<=0&&(r+=a.getTrackComplete()-i.mixDuration)):(this.setCurrent(t,i,!0),this.queue.drain()),i.delay=r,i}},{key:"setEmptyAnimation",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.setAnimationWith(e,t.emptyAnimation(),!1);return r.mixDuration=n,r.trackEnd=n,r}},{key:"addEmptyAnimation",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=this.addAnimationWith(e,t.emptyAnimation(),!1,r);return r<=0&&(a.delay+=a.mixDuration-n),a.mixDuration=n,a.trackEnd=n,a}},{key:"setEmptyAnimations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n0){a[h]=Ht,i[h]=c;continue t}break}a[h]=zt}else a[h]=Wt}}},{key:"getCurrent",value:function(t){return t>=this.tracks.length?null:this.tracks[t]}},{key:"addListener",value:function(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}},{key:"removeListener",value:function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}},{key:"clearListeners",value:function(){this.listeners.length=0}},{key:"clearListenerNotifications",value:function(){this.queue.clear()}}],[{key:"emptyAnimation",value:function(){return t._emptyAnimation}}]),t}();_t._emptyAnimation=new V("",[],0);var Ot,Bt=function(){function t(){i(this,t),this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.attachmentThreshold=0,this.drawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this.mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=O.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}return o(t,[{key:"reset",value:function(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}},{key:"getAnimationTime",value: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)}},{key:"setAnimationLast",value:function(t){this.animationLast=t,this.nextAnimationLast=t}},{key:"isComplete",value:function(){return this.trackTime>=this.animationEnd-this.animationStart}},{key:"resetRotationDirections",value:function(){this.timelinesRotation.length=0}},{key:"getTrackComplete",value:function(){var t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime0&&u&&u.length>0&&(c.names=l,c.values=u,l=null,u=null),c.u=c.x/h.width,c.v=c.y/h.height,90==c.degrees?(c.u2=(c.x+c.height)/h.width,c.v2=(c.y+c.width)/h.height):(c.u2=(c.x+c.width)/h.width,c.v2=(c.y+c.height)/h.height),this.regions.push(c)}else{for(h=new ie(o.trim());0!=n.readEntry(r,o=n.readLine());){var p=a[r[0]];p&&p(h)}this.pages.push(h)}}return o(t,[{key:"findRegion",value:function(t){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:"",r=w(this.pages);try{for(r.s();!(e=r.n()).done;){var a=e.value;a.setTexture(t.get(n+a.name))}}catch(t){r.e(t)}finally{r.f()}}},{key:"dispose",value:function(){for(var t,e=0;e=this.lines.length?null:this.lines[this.index++]}},{key:"readEntry",value:function(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;var n=e.indexOf(":");if(-1==n)return 0;t[0]=e.substr(0,n).trim();for(var r=1,a=n+1;;r++){var i=e.indexOf(",",a);if(-1==i)return t[r]=e.substr(a).trim(),r;if(t[r]=e.substr(a,i-a).trim(),a=i+1,4==r)return 4}}}]),t}(),ie=function(){function t(e){i(this,t),this.minFilter=Vt.Nearest,this.magFilter=Vt.Nearest,this.uWrap=Ut.ClampToEdge,this.vWrap=Ut.ClampToEdge,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.regions=new Array,this.name=e}return o(t,[{key:"setTexture",value:function(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);var e,n=w(this.regions);try{for(n.s();!(e=n.n()).done;){e.value.texture=t}}catch(t){n.e(t)}finally{n.f()}}}]),t}(),se=function(t){l(n,t);var e=d(n);function n(t,r){var a;return i(this,n),(a=e.call(this)).x=0,a.y=0,a.offsetX=0,a.offsetY=0,a.originalWidth=0,a.originalHeight=0,a.index=0,a.degrees=0,a.names=null,a.values=null,a.page=t,a.name=r,t.regions.push(f(a)),a}return o(n)}(ee),oe=function(t){l(n,t);var e=d(n);function n(t,r){var a;return i(this,n),(a=e.call(this,t)).region=null,a.regionUVs=[],a.uvs=[],a.triangles=[],a.color=new E(1,1,1,1),a.width=0,a.height=0,a.hullLength=0,a.edges=[],a.parentMesh=null,a.sequence=null,a.tempColor=new E(0,0,0,0),a.path=r,a}return o(n,[{key:"updateRegion",value:function(){if(!this.region)throw new Error("Region not set.");var t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=R.newFloatArray(t.length));var e=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,i=0,s=0;if(this.region instanceof se){var o=this.region,h=o.page.texture.getImage(),l=h.width,u=h.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/l,a-=(o.originalWidth-o.offsetX-o.width)/u,i=o.originalHeight/l,s=o.originalWidth/u;for(var c=0;c= 0.");if(!n)throw new Error("name cannot be null.");this.index=e,this.name=n,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"}(ce||(ce={}));var ve,me,pe,ge=function(){function t(e,n,r){if(i(this,t),this.parent=null,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,!e)throw new Error("data cannot be null.");if(!n)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=n,this.parent=r,this.setToSetupPose()}return o(t,[{key:"isActive",value:function(){return this.active}},{key:"update",value:function(){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}},{key:"updateWorldTransform",value:function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}},{key:"updateWorldTransformWith",value:function(t,e,n,r,a,i,s){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=a,this.ashearX=i,this.ashearY=s;var o=this.parent;if(!o){var h=this.skeleton,l=n+90+s,u=h.scaleX,c=h.scaleY;return this.a=I.cosDeg(n+i)*r*u,this.b=I.cosDeg(l)*a*u,this.c=I.sinDeg(n+i)*r*c,this.d=I.sinDeg(l)*a*c,this.worldX=t*u+h.x,void(this.worldY=e*c+h.y)}var f=o.a,d=o.b,v=o.c,m=o.d;switch(this.worldX=f*t+d*e+o.worldX,this.worldY=v*t+m*e+o.worldY,this.data.transformMode){case ce.Normal:var p=n+90+s,g=I.cosDeg(n+i)*r,y=I.cosDeg(p)*a,w=I.sinDeg(n+i)*r,k=I.sinDeg(p)*a;return this.a=f*g+d*w,this.b=f*y+d*k,this.c=v*g+m*w,void(this.d=v*y+m*k);case ce.OnlyTranslation:var b=n+90+s;this.a=I.cosDeg(n+i)*r,this.b=I.cosDeg(b)*a,this.c=I.sinDeg(n+i)*r,this.d=I.sinDeg(b)*a;break;case ce.NoRotationOrReflection:var x=f*f+v*v,E=0;x>1e-4?(x=Math.abs(f*m-d*v)/x,f/=this.skeleton.scaleX,d=(v/=this.skeleton.scaleY)*x,m=f*x,E=Math.atan2(v,f)*I.radDeg):(f=0,v=0,E=90-Math.atan2(m,d)*I.radDeg);var A=n+i-E,S=n+s-E+90,T=I.cosDeg(A)*r,R=I.cosDeg(S)*a,C=I.sinDeg(A)*r,M=I.sinDeg(S)*a;this.a=f*T-d*C,this.b=f*R-d*M,this.c=v*T+m*C,this.d=v*R+m*M;break;case ce.NoScale:case ce.NoScaleOrReflection:var F=I.cosDeg(n),Y=I.sinDeg(n),L=(f*F+d*Y)/this.skeleton.scaleX,X=(v*F+m*Y)/this.skeleton.scaleY,N=Math.sqrt(L*L+X*X);N>1e-5&&(N=1/N),L*=N,X*=N,N=Math.sqrt(L*L+X*X),this.data.transformMode==ce.NoScale&&f*m-d*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(N=-N);var P=Math.PI/2+Math.atan2(X,L),_=Math.cos(P)*N,O=Math.sin(P)*N,B=I.cosDeg(i)*r,D=I.cosDeg(90+s)*a,V=I.sinDeg(i)*r,U=I.sinDeg(90+s)*a;this.a=L*B+_*V,this.b=L*D+_*U,this.c=X*B+O*V,this.d=X*D+O*U}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}},{key:"setToSetupPose",value: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}},{key:"getWorldRotationX",value:function(){return Math.atan2(this.c,this.a)*I.radDeg}},{key:"getWorldRotationY",value:function(){return Math.atan2(this.d,this.b)*I.radDeg}},{key:"getWorldScaleX",value:function(){return Math.sqrt(this.a*this.a+this.c*this.c)}},{key:"getWorldScaleY",value:function(){return Math.sqrt(this.b*this.b+this.d*this.d)}},{key:"updateAppliedTransform",value:function(){var t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*I.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)*I.radDeg);var e=t.a,n=t.b,r=t.c,a=t.d,i=1/(e*a-n*r),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*a*i-o*n*i,this.ay=o*e*i-s*r*i;var h=i*a,l=i*e,u=i*n,c=i*r,f=h*this.a-u*this.c,d=h*this.b-u*this.d,v=l*this.c-c*this.a,m=l*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+v*v),this.ascaleX>1e-4){var p=f*m-d*v;this.ascaleY=p/this.ascaleX,this.ashearY=Math.atan2(f*d+v*m,p)*I.radDeg,this.arotation=Math.atan2(v,f)*I.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,d)*I.radDeg}},{key:"worldToLocal",value:function(t){var e=1/(this.a*this.d-this.b*this.c),n=t.x-this.worldX,r=t.y-this.worldY;return t.x=n*this.d*e-r*this.b*e,t.y=r*this.a*e-n*this.c*e,t}},{key:"localToWorld",value:function(t){var e=t.x,n=t.y;return t.x=e*this.a+n*this.b+this.worldX,t.y=e*this.c+n*this.d+this.worldY,t}},{key:"worldToLocalRotation",value:function(t){var e=I.sinDeg(t),n=I.cosDeg(t);return Math.atan2(this.a*e-this.c*n,this.d*n-this.b*e)*I.radDeg+this.rotation-this.shearX}},{key:"localToWorldRotation",value:function(t){t-=this.rotation-this.shearX;var e=I.sinDeg(t),n=I.cosDeg(t);return Math.atan2(n*this.c+e*this.d,n*this.a+e*this.b)*I.radDeg}},{key:"rotateWorld",value:function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=I.cosDeg(t),s=I.sinDeg(t);this.a=i*e-s*r,this.b=i*n-s*a,this.c=s*e+i*r,this.d=s*n+i*a}}]),t}(),ye=o((function t(e,n,r){i(this,t),this.name=e,this.order=n,this.skinRequired=r})),we=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new ke;i(this,t),this.pathPrefix="",this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.textureLoader=e,this.pathPrefix=n,this.downloader=r}return o(t,[{key:"start",value:function(t){return this.toLoad++,this.pathPrefix+t}},{key:"success",value:function(t,e,n){this.toLoad--,this.loaded++,this.assets[e]=n,t&&t(e,n)}},{key:"error",value:function(t,e,n){this.toLoad--,this.loaded++,this.errors[e]=n,t&&t(e,n)}},{key:"loadAll",value:function(){var t=this;return new Promise((function(e,n){requestAnimationFrame((function r(){t.isLoadingComplete()?t.hasErrors()?n(t.errors):e(t):requestAnimationFrame(r)}))}))}},{key:"setRawDataURI",value:function(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}},{key:"loadBinary",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};t=this.start(t),this.downloader.downloadBinary(t,(function(r){e.success(n,t,r)}),(function(n,a){e.error(r,t,"Couldn't load binary ".concat(t,": status ").concat(n,", ").concat(a))}))}},{key:"loadText",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};t=this.start(t),this.downloader.downloadText(t,(function(r){e.success(n,t,r)}),(function(n,a){e.error(r,t,"Couldn't load text ".concat(t,": status ").concat(n,", ").concat(a))}))}},{key:"loadJson",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};t=this.start(t),this.downloader.downloadJson(t,(function(r){e.success(n,t,r)}),(function(n,a){e.error(r,t,"Couldn't load JSON ".concat(t,": status ").concat(n,", ").concat(a))}))}},{key:"loadTexture",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((function(n){return n.ok?n.blob():(e.error(r,t,"Couldn't load image: ".concat(t)),null)})).then((function(t){return t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null})).then((function(r){r&&e.success(n,t,e.textureLoader(r))}));else{var a=new Image;a.crossOrigin="anonymous",a.onload=function(){e.success(n,t,e.textureLoader(a))},a.onerror=function(){e.error(r,t,"Couldn't load image: ".concat(t))},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),a.src=t}}},{key:"loadTextureAtlas",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},a=arguments.length>3?arguments[3]:void 0,i=t.lastIndexOf("/"),s=i>=0?t.substring(0,i+1):"";t=this.start(t),this.downloader.downloadText(t,(function(i){try{var o,h=new re(i),l=h.pages.length,u=!1,c=w(h.pages);try{var f=function(){var i=o.value;e.loadTexture(a?a[i.name]:s+i.name,(function(r,a){u||(i.setTexture(a),0==--l&&e.success(n,t,h))}),(function(n,a){u||e.error(r,t,"Couldn't load texture atlas ".concat(t," page image: ").concat(n)),u=!0}))};for(c.s();!(o=c.n()).done;)f()}catch(t){c.e(t)}finally{c.f()}}catch(n){e.error(r,t,"Couldn't parse texture atlas ".concat(t,": ").concat(n.message))}}),(function(n,a){e.error(r,t,"Couldn't load texture atlas ".concat(t,": status ").concat(n,", ").concat(a))}))}},{key:"get",value:function(t){return this.assets[this.pathPrefix+t]}},{key:"require",value:function(t){t=this.pathPrefix+t;var e=this.assets[t];if(e)return e;var n=this.errors[t];throw Error("Asset not found: "+t+(n?"\n"+n:""))}},{key:"remove",value:function(t){t=this.pathPrefix+t;var e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}},{key:"removeAll",value:function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}},{key:"isLoadingComplete",value:function(){return 0==this.toLoad}},{key:"getToLoad",value:function(){return this.toLoad}},{key:"getLoaded",value:function(){return this.loaded}},{key:"dispose",value:function(){this.removeAll()}},{key:"hasErrors",value:function(){return Object.keys(this.errors).length>0}},{key:"getErrors",value:function(){return this.errors}}]),t}(),ke=function(){function t(){i(this,t),this.callbacks={},this.rawDataUris={}}return o(t,[{key:"dataUriToString",value:function(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");var e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}},{key:"base64ToUint8Array",value:function(t){for(var e=window.atob(t),n=e.length,r=new Uint8Array(n),a=0;a180?f-=360:f<-180&&(f+=360);var b=t.ascaleX,x=t.ascaleY;if(r||a){switch(t.data.transformMode){case ce.NoScale:case ce.NoScaleOrReflection:d=e-t.worldX,v=n-t.worldY}var E=t.data.length*b,A=Math.sqrt(d*d+v*v);if(r&&AE&&E>1e-4){var S=(A/E-1)*s+1;b*=S,i&&(x*=S)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*s,b,x,t.ashearX,t.ashearY)}},{key:"apply2",value:function(t,e,n,r,a,i,s,o,h){var l=t.ax,u=t.ay,c=t.ascaleX,f=t.ascaleY,d=c,v=f,m=e.ascaleX,p=0,g=0,y=0;c<0?(c=-c,p=180,y=-1):(p=0,y=1),f<0&&(f=-f,y=-y),m<0?(m=-m,g=180):g=0;var w=e.ax,k=0,b=0,x=0,E=t.a,A=t.b,S=t.c,T=t.d,R=Math.abs(c-f)<=1e-4;!R||i?(k=0,b=E*w+t.worldX,x=S*w+t.worldY):(b=E*w+A*(k=e.ay)+t.worldX,x=S*w+T*k+t.worldY);var C=t.parent;if(!C)throw new Error("IK parent must itself have a parent.");E=C.a,A=C.b,S=C.c;var M,F,Y=E*(T=C.d)-A*S,L=b-C.worldX,X=x-C.worldY,N=(L*T-X*A)*(Y=Math.abs(Y)<=1e-4?0:1/Y)-l,P=(X*E-L*S)*Y-u,_=Math.sqrt(N*N+P*P),O=e.data.length*m;if(_<1e-4)return this.apply1(t,n,r,!1,i,!1,h),void e.updateWorldTransformWith(w,k,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var B=((L=n-C.worldX)*T-(X=r-C.worldY)*A)*Y-l,D=(X*E-L*S)*Y-u,V=B*B+D*D;if(0!=o){o*=c*(m+1)*.5;var U=Math.sqrt(V),q=U-_-O*c+o;if(q>0){var W=Math.min(1,q/(2*o))-1;V=(B-=(W=(q-o*(1-W*W))/U)*B)*B+(D-=W*D)*D}}t:if(R){var j=(V-_*_-(O*=c)*O)/(2*_*O);j<-1?(j=-1,F=Math.PI*a):j>1?(j=1,F=0,i&&(d*=E=(Math.sqrt(V)/(_+O)-1)*h+1,s&&(v*=E))):F=Math.acos(j)*a,E=_+O*j,A=O*Math.sin(F),M=Math.atan2(D*E-B*A,B*E+D*A)}else{var G=(E=c*O)*E,z=(A=f*O)*A,H=Math.atan2(D,B),$=-2*z*_,J=z-G;if((T=$*$-4*J*(S=z*_*_+G*V-G*z))>=0){var K=Math.sqrt(T);$<0&&(K=-K);var Q=(K=.5*-($+K))/J,Z=S/K,tt=Math.abs(Q)=-1&&S<=1&&(S=Math.acos(S),(T=(L=E*Math.cos(S)+_)*L+(X=A*Math.sin(S))*X)ot&&(it=S,ot=T,st=L,ht=X)),V<=.5*(rt+ot)?(M=H-Math.atan2(at*a,nt),F=et*a):(M=H-Math.atan2(ht*a,st),F=it*a)}var lt=Math.atan2(k,w)*y,ut=t.arotation;(M=(M-lt)*I.radDeg+p-ut)>180?M-=360:M<-180&&(M+=360),t.updateWorldTransformWith(l,u,ut+M*h,d,v,0,0),ut=e.arotation,(F=((F+lt)*I.radDeg-e.ashearX)*y+g-ut)>180?F-=360:F<-180&&(F+=360),e.updateWorldTransformWith(w,k,ut+F*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}]),t}(),Ie=function(t){l(n,t);var e=d(n);function n(t){var r;return i(this,n),(r=e.call(this,t,0,!1)).bones=new Array,r._target=null,r.bendDirection=1,r.compress=!1,r.stretch=!1,r.uniform=!1,r.mix=1,r.softness=0,r}return o(n,[{key:"target",get:function(){if(this._target)return this._target;throw new Error("BoneData not set.")},set:function(t){this._target=t}}]),n}(ye),Ae=function(t){l(n,t);var e=d(n);function n(t){var r;return i(this,n),(r=e.call(this,t,0,!1)).bones=new Array,r._target=null,r.positionMode=ve.Fixed,r.spacingMode=me.Fixed,r.rotateMode=pe.Chain,r.offsetRotation=0,r.position=0,r.spacing=0,r.mixRotate=0,r.mixX=0,r.mixY=0,r}return o(n,[{key:"target",get:function(){if(this._target)return this._target;throw new Error("SlotData not set.")},set:function(t){this._target=t}}]),n}(ye);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(ve||(ve={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"}(me||(me={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(pe||(pe={}));var Se=function(){function t(e,n){if(i(this,t),this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!e)throw new Error("data cannot be null.");if(!n)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(var r=0,a=e.bones.length;r0){k=u/k*d;for(var M=1;M0?I.degRad:-I.degRad}for(var j=0,G=3;j0){var tt=z.a,et=z.b,nt=z.c,rt=z.d,at=0,it=0,st=0;if(at=s?B[G-1]:0==c[j+1]?B[G+2]:Math.atan2(K,J),at-=Math.atan2(nt,tt),q){it=Math.cos(at),st=Math.sin(at);var ot=z.data.length;D+=(ot*(it*tt-st*nt)-J)*n,V+=(ot*(st*tt+it*nt)-K)*n}else at+=U;at>I.PI?at-=I.PI2:at<-I.PI&&(at+=I.PI2),at*=n,it=Math.cos(at),st=Math.sin(at),z.a=it*tt-st*nt,z.b=it*et-st*rt,z.c=st*tt+it*nt,z.d=st*et+it*rt}z.updateAppliedTransform()}}}}},{key:"computeWorldPositions",value:function(e,n,r){var a=this.target,i=this.position,s=this.spaces,o=R.setArraySize(this.positions,3*n+2),h=this.world,l=e.closed,u=e.worldVerticesLength,c=u/6,f=t.NONE;if(!e.constantSpeed){var d,v=e.lengths,m=v[c-=l?1:2];switch(this.data.positionMode==ve.Percent&&(i*=m),this.data.spacingMode){case me.Percent:d=m;break;case me.Proportional:d=m/n;break;default:d=1}h=R.setArraySize(this.world,8);for(var p=0,g=0,y=0;pm){f!=t.AFTER&&(f=t.AFTER,e.computeWorldVertices(a,u-6,4,h,0,2)),this.addAfterPosition(k-m,h,0,o,g);continue}}for(;;y++){var b=v[y];if(!(k>b)){if(0==y)k/=b;else{var x=v[y-1];k=(k-x)/(b-x)}break}}y!=f&&(f=y,l&&y==c?(e.computeWorldVertices(a,u-4,4,h,0,2),e.computeWorldVertices(a,0,4,h,4,2)):e.computeWorldVertices(a,6*y+2,8,h,0,2)),this.addCurvePosition(k,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],o,g,r||p>0&&0==w)}return o}l?(u+=2,h=R.setArraySize(this.world,u),e.computeWorldVertices(a,2,u-4,h,0,2),e.computeWorldVertices(a,0,2,h,u-4,2),h[u-2]=h[0],h[u-1]=h[1]):(c--,u-=4,h=R.setArraySize(this.world,u),e.computeWorldVertices(a,2,u,h,0,2));for(var E,I=R.setArraySize(this.curves,c),A=0,S=h[0],T=h[1],C=0,M=0,F=0,Y=0,L=0,X=0,N=0,P=0,_=0,O=0,B=0,D=0,V=0,U=0,q=0,W=2;qA){this.addAfterPosition(Q-A,h,u-4,o,H);continue}}for(;;$++){var Z=I[$];if(!(Q>Z)){if(0==$)Q/=Z;else{var tt=I[$-1];Q=(Q-tt)/(Z-tt)}break}}if($!=f){f=$;var et=6*$;for(S=h[et],T=h[et+1],C=h[et+2],M=h[et+3],F=h[et+4],Y=h[et+5],B=2*(N=.03*(S-2*C+F))+(_=.006*(3*(C-F)-S+(L=h[et+6]))),D=2*(P=.03*(T-2*M+Y))+(O=.006*(3*(M-Y)-T+(X=h[et+7]))),V=.3*(C-S)+N+.16666667*_,U=.3*(M-T)+P+.16666667*O,G=Math.sqrt(V*V+U*U),j[0]=G,et=1;et<8;et++)V+=B,U+=D,B+=_,D+=O,G+=Math.sqrt(V*V+U*U),j[et]=G;V+=B,U+=D,G+=Math.sqrt(V*V+U*U),j[8]=G,V+=B+_,U+=D+O,G+=Math.sqrt(V*V+U*U),j[9]=G,J=0}for(Q*=G;;J++){var nt=j[J];if(!(Q>nt)){if(0==J)Q/=nt;else{var rt=j[J-1];Q=J+(Q-rt)/(nt-rt)}break}}this.addCurvePosition(.1*Q,S,T,C,M,F,Y,L,X,o,H,r||z>0&&0==K)}return o}},{key:"addBeforePosition",value:function(t,e,n,r,a){var i=e[n],s=e[n+1],o=e[n+2]-i,h=e[n+3]-s,l=Math.atan2(h,o);r[a]=i+t*Math.cos(l),r[a+1]=s+t*Math.sin(l),r[a+2]=l}},{key:"addAfterPosition",value:function(t,e,n,r,a){var i=e[n+2],s=e[n+3],o=i-e[n],h=s-e[n+1],l=Math.atan2(h,o);r[a]=i+t*Math.cos(l),r[a+1]=s+t*Math.sin(l),r[a+2]=l}},{key:"addCurvePosition",value:function(t,e,n,r,a,i,s,o,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=n,void(l[u+2]=Math.atan2(a-n,r-e));var f=t*t,d=f*t,v=1-t,m=v*v,p=m*v,g=v*t,y=3*g,w=v*y,k=y*t,b=e*p+r*w+i*k+o*d,x=n*p+a*w+s*k+h*d;l[u]=b,l[u+1]=x,c&&(l[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(x-(n*m+a*g*2+s*f),b-(e*m+r*g*2+i*f)))}}]),t}();Se.NONE=-1,Se.BEFORE=-2,Se.AFTER=-3,Se.epsilon=1e-5;var Te=function(){function t(e,n){if(i(this,t),this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!e)throw new Error("data cannot be null.");if(!n)throw new Error("bone cannot be null.");this.data=e,this.bone=n,this.color=new E,this.darkColor=e.darkColor?new E:null,this.setToSetupPose()}return o(t,[{key:"getSkeleton",value:function(){return this.bone.skeleton}},{key:"getAttachment",value:function(){return this.attachment}},{key:"setAttachment",value:function(t){this.attachment!=t&&(t instanceof N&&this.attachment instanceof N&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}},{key:"setToSetupPose",value:function(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}]),t}(),Re=function(){function t(e,n){if(i(this,t),this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new F,this.active=!1,!e)throw new Error("data cannot be null.");if(!n)throw new Error("skeleton cannot be null.");this.data=e,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,this.bones=new Array;for(var r=0;r0?I.degRad:-I.degRad,d=this.data.offsetRotation*f,v=this.data.offsetShearY*f,m=this.bones,p=0,g=m.length;pI.PI?E-=I.PI2:E<-I.PI&&(E+=I.PI2),E*=t;var A=Math.cos(E),S=Math.sin(E);y.a=A*w-S*b,y.b=A*k-S*x,y.c=S*w+A*b,y.d=S*k+A*x}if(s){var T=this.temp;o.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),y.worldX+=(T.x-y.worldX)*e,y.worldY+=(T.y-y.worldY)*n}if(0!=r){var R=Math.sqrt(y.a*y.a+y.c*y.c);0!=R&&(R=(R+(Math.sqrt(h*h+u*u)-R+this.data.offsetScaleX)*r)/R),y.a*=R,y.c*=R}if(0!=a){var C=Math.sqrt(y.b*y.b+y.d*y.d);0!=C&&(C=(C+(Math.sqrt(l*l+c*c)-C+this.data.offsetScaleY)*a)/C),y.b*=C,y.d*=C}if(i>0){var M=y.b,F=y.d,Y=Math.atan2(F,M),L=Math.atan2(c,l)-Math.atan2(u,h)-(Y-Math.atan2(y.c,y.a));L>I.PI?L-=I.PI2:L<-I.PI&&(L+=I.PI2),L=Y+(L+v)*i;var X=Math.sqrt(M*M+F*F);y.b=Math.cos(L)*X,y.d=Math.sin(L)*X}y.updateAppliedTransform()}}},{key:"applyRelativeWorld",value:function(){for(var t=this.mixRotate,e=this.mixX,n=this.mixY,r=this.mixScaleX,a=this.mixScaleY,i=this.mixShearY,s=0!=e||0!=n,o=this.target,h=o.a,l=o.b,u=o.c,c=o.d,f=h*c-l*u>0?I.degRad:-I.degRad,d=this.data.offsetRotation*f,v=this.data.offsetShearY*f,m=this.bones,p=0,g=m.length;pI.PI?E-=I.PI2:E<-I.PI&&(E+=I.PI2),E*=t;var A=Math.cos(E),S=Math.sin(E);y.a=A*w-S*b,y.b=A*k-S*x,y.c=S*w+A*b,y.d=S*k+A*x}if(s){var T=this.temp;o.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),y.worldX+=T.x*e,y.worldY+=T.y*n}if(0!=r){var R=(Math.sqrt(h*h+u*u)-1+this.data.offsetScaleX)*r+1;y.a*=R,y.c*=R}if(0!=a){var C=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleY)*a+1;y.b*=C,y.d*=C}if(i>0){var M=Math.atan2(c,l)-Math.atan2(u,h);M>I.PI?M-=I.PI2:M<-I.PI&&(M+=I.PI2);var F=y.b,Y=y.d;M=Math.atan2(Y,F)+(M-I.PI/2+v)*i;var L=Math.sqrt(F*F+Y*Y);y.b=Math.cos(M)*L,y.d=Math.sin(M)*L}y.updateAppliedTransform()}}},{key:"applyAbsoluteLocal",value:function(){for(var t=this.mixRotate,e=this.mixX,n=this.mixY,r=this.mixScaleX,a=this.mixScaleY,i=this.mixShearY,s=this.target,o=this.bones,h=0,l=o.length;h2&&void 0!==arguments[2]?arguments[2]:new Array(2);if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");for(var r=this.drawOrder,a=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=0,l=r.length;h0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;i(this,t),this.slotIndex=e,this.name=n,this.attachment=r})),Le=function(){function t(e){if(i(this,t),this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!e)throw new Error("name cannot be null.");this.name=e}return o(t,[{key:"setAttachment",value:function(t,e,n){if(!n)throw new Error("attachment cannot be null.");var r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=n}},{key:"addSkin",value:function(t){for(var e=0;e= 0.");if(!n)throw new Error("name cannot be null.");if(!r)throw new Error("boneData cannot be null.");this.index=e,this.name=n,this.boneData=r}));!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(Me||(Me={}));var Ne,Pe=function(t){l(n,t);var e=d(n);function n(t){var r;return i(this,n),(r=e.call(this,t,0,!1)).bones=new Array,r._target=null,r.mixRotate=0,r.mixX=0,r.mixY=0,r.mixScaleX=0,r.mixScaleY=0,r.mixShearY=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 o(n,[{key:"target",get:function(){if(this._target)return this._target;throw new Error("BoneData not set.")},set:function(t){this._target=t}}]),n}(ye),_e=function(){function t(e){i(this,t),this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=e}return o(t,[{key:"readSkeletonData",value:function(t){var e=this.scale,n=new Fe;n.name="";var r=new Oe(t),a=r.readInt32(),i=r.readInt32();n.hash=0==i&&0==a?null:i.toString(16)+a.toString(16),n.version=r.readString(),n.x=r.readFloat(),n.y=r.readFloat(),n.width=r.readFloat(),n.height=r.readFloat();var s=r.readBoolean();s&&(n.fps=r.readFloat(),n.imagesPath=r.readString(),n.audioPath=r.readString());var o=0;o=r.readInt(!0);for(var h=0;h>4,t.readFloat())}r.push(br)}}var Ar=t.readInt(!0);if(Ar>0){for(var Sr=new Mt(Ar),Tr=n.slots.length,Rr=0;Rr=0;Yr--)Fr[Yr]=-1;for(var Lr=R.newArray(Tr-Mr,0),Xr=0,Nr=0,Pr=0;Pr=0;Or--)-1==Fr[Or]&&(Fr[Or]=Lr[--Nr]);Sr.setFrame(Rr,Cr,Fr)}r.push(Sr)}var Br=t.readInt(!0);if(Br>0){for(var Dr=new Ct(Br),Vr=0;Vr1&&void 0!==arguments[1]?arguments[1]:new Array,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new DataView(e.buffer);i(this,t),this.strings=n,this.index=r,this.buffer=a}return o(t,[{key:"readByte",value:function(){return this.buffer.getInt8(this.index++)}},{key:"readUnsignedByte",value:function(){return this.buffer.getUint8(this.index++)}},{key:"readShort",value:function(){var t=this.buffer.getInt16(this.index);return this.index+=2,t}},{key:"readInt32",value:function(){var t=this.buffer.getInt32(this.index);return this.index+=4,t}},{key:"readInt",value:function(t){var e=this.readByte(),n=127&e;return 0!=(128&e)&&(n|=(127&(e=this.readByte()))<<7,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<14,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<21,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<28)))),t?n:n>>>1^-(1&n)}},{key:"readStringRef",value:function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]}},{key:"readString",value:function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",n=0;n>4){case 12:case 13:e+=String.fromCharCode((31&r)<<6|63&this.readByte()),n+=2;break;case 14:e+=String.fromCharCode((15&r)<<12|(63&this.readByte())<<6|63&this.readByte()),n+=3;break;default:e+=String.fromCharCode(r),n++}}return e}},{key:"readFloat",value:function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t}},{key:"readBoolean",value:function(){return 0!=this.readByte()}}]),t}(),Be=o((function t(e,n,r,a,s){i(this,t),this.mesh=e,this.skin=n,this.slotIndex=r,this.parent=a,this.inheritTimeline=s})),De=o((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;i(this,t),this.bones=e,this.vertices=n}));function Ve(t,e,n){for(var r=t.readFloat(),a=t.readFloat()*n,i=0,s=0,o=e.getFrameCount()-1;e.setFrame(i,r,a),i!=o;i++){var h=t.readFloat(),l=t.readFloat()*n;switch(t.readByte()){case dn:e.setStepped(i);break;case vn:qe(t,e,s++,i,0,r,h,a,l,n)}r=h,a=l}return e}function Ue(t,e,n){for(var r=t.readFloat(),a=t.readFloat()*n,i=t.readFloat()*n,s=0,o=0,h=e.getFrameCount()-1;e.setFrame(s,r,a,i),s!=h;s++){var l=t.readFloat(),u=t.readFloat()*n,c=t.readFloat()*n;switch(t.readByte()){case dn:e.setStepped(s);break;case vn:qe(t,e,o++,s,0,r,l,a,u,n),qe(t,e,o++,s,1,r,l,i,c,n)}r=l,a=u,i=c}return e}function qe(t,e,n,r,a,i,s,o,h,l){e.setBezier(n,r,a,i,o,t.readFloat(),t.readFloat()*l,t.readFloat(),t.readFloat()*l,s,h)}!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(Ne||(Ne={}));var We,je=0,Ge=1,ze=2,He=3,$e=4,Je=5,Ke=6,Qe=7,Ze=8,tn=9,en=0,nn=1,rn=2,an=3,sn=4,on=5,hn=0,ln=1,un=0,cn=1,fn=2,dn=1,vn=2,mn=function(){function t(){i(this,t),this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new M((function(){return R.newFloatArray(16)}))}return o(t,[{key:"update",value:function(t,e){if(!t)throw new Error("skeleton cannot be null.");var n=this.boundingBoxes,r=this.polygons,a=this.polygonPool,i=t.slots,s=i.length;n.length=0,a.freeAll(r),r.length=0;for(var o=0;o=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}},{key:"aabbIntersectsSegment",value:function(t,e,n,r){var a=this.minX,i=this.minY,s=this.maxX,o=this.maxY;if(t<=a&&n<=a||e<=i&&r<=i||t>=s&&n>=s||e>=o&&r>=o)return!1;var h=(r-e)/(n-t),l=h*(a-t)+e;if(l>i&&li&&la&&ua&&ut.minX&&this.minYt.minY}},{key:"containsPoint",value:function(t,e){for(var n=this.polygons,r=0,a=n.length;r=n||l=n){var u=r[o];u+(n-h)/(l-h)*(r[i]-u)=u&&w<=d||w>=d&&w<=u)&&(w>=e&&w<=r||w>=r&&w<=e)){var k=(l*g-h*m)/y;if((k>=c&&k<=v||k>=v&&k<=c)&&(k>=n&&k<=a||k>=a&&k<=n))return!0}u=d,c=v}return!1}},{key:"getPolygon",value:function(t){if(!t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}},{key:"getWidth",value:function(){return this.maxX-this.minX}},{key:"getHeight",value:function(){return this.maxY-this.minY}}]),t}(),pn=function(){function t(){i(this,t),this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new M((function(){return new Array})),this.polygonIndicesPool=new M((function(){return new Array}))}return o(t,[{key:"triangulate",value:function(e){var n=e,r=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i3;){for(var u=r-1,c=0,f=1;;){t:if(!s[c]){for(var d=a[u]<<1,v=a[c]<<1,m=a[f]<<1,p=n[d],g=n[d+1],y=n[v],w=n[v+1],k=n[m],b=n[m+1],x=(f+1)%r;x!=u;x=(x+1)%r)if(s[x]){var E=a[x]<<1,I=n[E],A=n[E+1];if(t.positiveArea(k,b,p,g,I,A)&&t.positiveArea(p,g,y,w,I,A)&&t.positiveArea(y,w,k,b,I,A))break t}break}if(0==f){do{if(!s[c])break;c--}while(c>0);break}u=c,c=f,f=(f+1)%r}l.push(a[(r+c-1)%r]),l.push(a[c]),l.push(a[(c+1)%r]),a.splice(c,1),s.splice(c,1);var S=(--r+c-1)%r,T=c==r?0:c;s[S]=t.isConcave(S,r,n,a),s[T]=t.isConcave(T,r,n,a)}return 3==r&&(l.push(a[2]),l.push(a[0]),l.push(a[1])),l}},{key:"decompose",value:function(e,n){var r=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var s=this.polygonIndicesPool.obtain();s.length=0;var o=this.polygonPool.obtain();o.length=0;for(var h=-1,l=0,u=0,c=n.length;u0?(a.push(o),i.push(s)):(this.polygonPool.free(o),this.polygonIndicesPool.free(s)),(o=this.polygonPool.obtain()).length=0,o.push(m),o.push(p),o.push(g),o.push(y),o.push(w),o.push(k),(s=this.polygonIndicesPool.obtain()).length=0,s.push(f),s.push(d),s.push(v),l=t.winding(m,p,g,y,w,k),h=f)}o.length>0&&(a.push(o),i.push(s));for(var A=0,S=a.length;A=0;$--)0==(o=a[$]).length&&(a.splice($,1),this.polygonPool.free(o),s=i[$],i.splice($,1),this.polygonIndicesPool.free(s));return a}}],[{key:"isConcave",value:function(t,e,n,r){var a=r[(e+t-1)%e]<<1,i=r[t]<<1,s=r[(t+1)%e]<<1;return!this.positiveArea(n[a],n[a+1],n[i],n[i+1],n[s],n[s+1])}},{key:"positiveArea",value:function(t,e,n,r,a,i){return t*(i-r)+n*(e-i)+a*(r-e)>=0}},{key:"winding",value:function(t,e,n,r,a,i){var s=n-t,o=r-e;return a*o-i*s+s*e-t*o>=0?1:-1}}]),t}(),gn=function(){function t(){i(this,t),this.triangulator=new pn,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}return o(t,[{key:"clipStart",value:function(e,n){if(this.clipAttachment)return 0;this.clipAttachment=n;var r=n.worldVerticesLength,a=R.setArraySize(this.clippingPolygon,r);n.computeWorldVertices(e,0,r,a,0,2);var i=this.clippingPolygon;t.makeClockwise(i);for(var s=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i)),o=0,h=s.length;o>1,V=this.clipOutput,U=R.setArraySize(l,F+D*d),q=0;q=2?(h=o,o=this.scratch):h=this.scratch,h.length=0,h.push(t),h.push(e),h.push(n),h.push(r),h.push(a),h.push(i),h.push(t),h.push(e),o.length=0;for(var c=s,f=s.length-4,d=0;;d+=2){for(var v=c[d],m=c[d+1],p=c[d+2],g=c[d+3],y=v-p,w=m-g,k=h,b=h.length-2,x=o.length,E=0;E0;if(y*(A-g)-w*(I-p)>0){if(R){o.push(S),o.push(T);continue}var C=T-A,M=S-I,F=C*(p-v)-M*(g-m);if(Math.abs(F)>1e-6){var Y=(M*(m-A)-C*(v-I))/F;o.push(v+(p-v)*Y),o.push(m+(g-m)*Y)}else o.push(v),o.push(m)}else if(R){var L=T-A,X=S-I,N=L*(p-v)-X*(g-m);if(Math.abs(N)>1e-6){var P=(X*(m-A)-L*(v-I))/N;o.push(v+(p-v)*P),o.push(m+(g-m)*P)}else o.push(v),o.push(m);o.push(S),o.push(T)}u=!0}if(x==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),d==f)break;var _=o;(o=h).length=0,h=_}if(l!=o){l.length=0;for(var O=0,B=o.length-2;O>1;l=0;lr--)-1==tr[lr]&&(tr[lr]=nr[--ar])}$n.setFrame(Kn,En(Zn,"time",0),tr)}a.push($n)}if(t.events){for(var ur=new Ct(t.events.length),cr=0,fr=0;fr)?=?)"),d("XRANGEIDENTIFIERLOOSE","".concat(h[l.NUMERICIDENTIFIERLOOSE],"|x|X|\\*")),d("XRANGEIDENTIFIER","".concat(h[l.NUMERICIDENTIFIER],"|x|X|\\*")),d("XRANGEPLAIN","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:".concat(h[l.PRERELEASE],")?").concat(h[l.BUILD],"?")+")?)?"),d("XRANGEPLAINLOOSE","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:".concat(h[l.PRERELEASELOOSE],")?").concat(h[l.BUILD],"?")+")?)?"),d("XRANGE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAIN],"$")),d("XRANGELOOSE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAINLOOSE],"$")),d("COERCE","".concat("(^|[^\\d])(\\d{1,").concat(n,"})")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:$|[^\\d])"),d("COERCERTL",h[l.COERCE],!0),d("LONETILDE","(?:~>?)"),d("TILDETRIM","(\\s*)".concat(h[l.LONETILDE],"\\s+"),!0),e.tildeTrimReplace="$1~",d("TILDE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAIN],"$")),d("TILDELOOSE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAINLOOSE],"$")),d("LONECARET","(?:\\^)"),d("CARETTRIM","(\\s*)".concat(h[l.LONECARET],"\\s+"),!0),e.caretTrimReplace="$1^",d("CARET","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAIN],"$")),d("CARETLOOSE","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAINLOOSE],"$")),d("COMPARATORLOOSE","^".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],")$|^$")),d("COMPARATOR","^".concat(h[l.GTLT],"\\s*(").concat(h[l.FULLPLAIN],")$|^$")),d("COMPARATORTRIM","(\\s*)".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],"|").concat(h[l.XRANGEPLAIN],")"),!0),e.comparatorTrimReplace="$1$2$3",d("HYPHENRANGE","^\\s*(".concat(h[l.XRANGEPLAIN],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAIN],")")+"\\s*$"),d("HYPHENRANGELOOSE","^\\s*(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s*$"),d("STAR","(<|>)?=?\\s*\\*"),d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),d("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Ln,Ln.exports);var Xn=Ln.exports;Rn(Xn);var Nn=Object.freeze({loose:!0}),Pn=Object.freeze({}),_n=function(t){return t?"object"!==a(t)?Nn:t:Pn};Rn(_n);var On=/^[0-9]+$/,Bn=function(t,e){var n=On.test(t),r=On.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:tUn)throw new TypeError("version is longer than ".concat(Un," characters"));Vn("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;var r=e.trim().match(n.loose?Wn[jn.LOOSE]:Wn[jn.FULL]);if(!r)throw new TypeError("Invalid Version: ".concat(e));if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>qn||this.major<0)throw new TypeError("Invalid major version");if(this.minor>qn||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>qn||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e=0;)"number"==typeof this.prerelease[a]&&(this.prerelease[a]++,a=-2);if(-1===a){if(e===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(r)}}if(e){var i=[e,r];!1===n&&(i=[e]),0===zn(this.prerelease[0],e)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break;default:throw new Error("invalid increment argument: ".concat(t))}return this.raw=this.format(),this.build.length&&(this.raw+="+".concat(this.build.join("."))),this}}]),t}(),$n=Hn;Rn($n);var Jn=$n,Kn=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t instanceof Jn)return t;try{return new Jn(t,e)}catch(t){if(!n)return null;throw t}};Rn(Kn);var Qn,Zn,tr=Kn,er=Rn((function(t,e){var n=tr(t,e);return n?n.version:null})),nr=$n,rr=Kn,ar=Xn.safeRe,ir=Xn.t,sr=Rn((function(t,e){if(t instanceof nr)return t;if("number"==typeof t&&(t=String(t)),"string"!=typeof t)return null;var n=null;if((e=e||{}).rtl){for(var r;(r=ar[ir.COERCERTL].exec(t))&&(!n||n.index+n[0].length!==t.length);)n&&r.index+r[0].length===n.index+n[0].length||(n=r),ar[ir.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;ar[ir.COERCERTL].lastIndex=-1}else n=t.match(ar[ir.COERCE]);return null===n?null:rr("".concat(n[2],".").concat(n[3]||"0",".").concat(n[4]||"0"),e)}));var or=hr;function hr(t){var e=this;if(e instanceof hr||(e=new hr),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var n=0,r=arguments.length;n1)n=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var a=0;null!==r;a++)n=t(n,r.value,a),r=r.next;return n},hr.prototype.reduceReverse=function(t,e){var n,r=this.tail;if(arguments.length>1)n=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var a=this.length-1;null!==r;a--)n=t(n,r.value,a),r=r.prev;return n},hr.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;null!==n;e++)t[e]=n.value,n=n.next;return t},hr.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;null!==n;e++)t[e]=n.value,n=n.prev;return t},hr.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var n=new hr;if(ethis.length&&(e=this.length);for(var r=0,a=this.head;null!==a&&rthis.length&&(e=this.length);for(var r=this.length,a=this.tail;null!==a&&r>e;r--)a=a.prev;for(;null!==a&&r>t;r--,a=a.prev)n.push(a.value);return n},hr.prototype.splice=function(t,e){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,r=this.head;null!==r&&nthis[vr])return Cr(this,this[xr].get(t)),!1;var i=this[xr].get(t).value;return this[wr]&&(this[kr]||this[wr](t,i.value)),i.now=r,i.maxAge=n,i.value=e,this[mr]+=a-i.length,i.length=a,this.get(t),Rr(this),!0}var s=new Mr(t,e,a,r,n);return s.length>this[vr]?(this[wr]&&this[wr](t,e),!1):(this[mr]+=s.length,this[br].unshift(s),this[xr].set(t,this[br].head),Rr(this),!0)}},{key:"has",value:function(t){if(!this[xr].has(t))return!1;var e=this[xr].get(t).value;return!Tr(this,e)}},{key:"get",value:function(t){return Sr(this,t,!0)}},{key:"peek",value:function(t){return Sr(this,t,!1)}},{key:"pop",value:function(){var t=this[br].tail;return t?(Cr(this,t),t.value):null}},{key:"del",value:function(t){Cr(this,this[xr].get(t))}},{key:"load",value:function(t){this.reset();for(var e=Date.now(),n=t.length-1;n>=0;n--){var r=t[n],a=r.e||0;if(0===a)this.set(r.k,r.v);else{var i=a-e;i>0&&this.set(r.k,r.v,i)}}}},{key:"prune",value:function(){var t=this;this[xr].forEach((function(e,n){return Sr(t,n,!1)}))}}]),t}(),Sr=function(t,e,n){var r=t[xr].get(e);if(r){var a=r.value;if(Tr(t,a)){if(Cr(t,r),!t[gr])return}else n&&(t[Er]&&(r.value.now=Date.now()),t[br].unshiftNode(r));return a.value}},Tr=function(t,e){if(!e||!e.maxAge&&!t[yr])return!1;var n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[yr]&&n>t[yr]},Rr=function(t){if(t[mr]>t[vr])for(var e=t[br].tail;t[mr]>t[vr]&&null!==e;){var n=e.prev;Cr(t,e),e=n}},Cr=function(t,e){if(e){var n=e.value;t[wr]&&t[wr](n.key,n.value),t[mr]-=n.length,t[xr].delete(n.key),t[br].removeNode(e)}},Mr=o((function t(e,n,r,a,s){i(this,t),this.key=e,this.value=n,this.length=r,this.now=a,this.maxAge=s||0})),Fr=function(t,e,n,r){var a=n.value;Tr(t,a)&&(Cr(t,n),t[gr]||(a=void 0)),a&&e.call(r,a.value,a.key,t)},Yr=Ar;Rn(Yr);var Lr=$n,Xr=function(t,e,n){return new Lr(t,n).compare(new Lr(e,n))};Rn(Xr);var Nr=Xr,Pr=function(t,e,n){return 0===Nr(t,e,n)};Rn(Pr);var _r=Xr,Or=function(t,e,n){return 0!==_r(t,e,n)};Rn(Or);var Br=Xr,Dr=function(t,e,n){return Br(t,e,n)>0};Rn(Dr);var Vr=Xr,Ur=function(t,e,n){return Vr(t,e,n)>=0};Rn(Ur);var qr=Xr,Wr=function(t,e,n){return qr(t,e,n)<0};Rn(Wr);var jr=Xr,Gr=function(t,e,n){return jr(t,e,n)<=0};Rn(Gr);var zr,Hr,$r,Jr,Kr=Pr,Qr=Or,Zr=Dr,ta=Ur,ea=Wr,na=Gr,ra=function(t,e,n,r){switch(e){case"===":return"object"===a(t)&&(t=t.version),"object"===a(n)&&(n=n.version),t===n;case"!==":return"object"===a(t)&&(t=t.version),"object"===a(n)&&(n=n.version),t!==n;case"":case"=":case"==":return Kr(t,n,r);case"!=":return Qr(t,n,r);case">":return Zr(t,n,r);case">=":return ta(t,n,r);case"<":return ea(t,n,r);case"<=":return na(t,n,r);default:throw new TypeError("Invalid operator: ".concat(e))}};function aa(){if(Jr)return $r;Jr=1;var t=function(){function t(e,a){var s=this;if(i(this,t),a=n(a),e instanceof t)return e.loose===!!a.loose&&e.includePrerelease===!!a.includePrerelease?e:new t(e.raw,a);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((function(t){return s.parseRange(t.trim())})).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: ".concat(this.raw));if(this.set.length>1){var o=this.set[0];if(this.set=this.set.filter((function(t){return!m(t[0])})),0===this.set.length)this.set=[o];else if(this.set.length>1){var h,l=w(this.set);try{for(l.s();!(h=l.n()).done;){var u=h.value;if(1===u.length&&g(u[0])){this.set=[u];break}}}catch(t){l.e(t)}finally{l.f()}}}this.format()}return o(t,[{key:"format",value:function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range}},{key:"toString",value:function(){return this.range}},{key:"parseRange",value:function(t){var n=this,i=((this.options.includePrerelease&&d)|(this.options.loose&&v))+":"+t,s=e.get(i);if(s)return s;var o=this.options.loose,g=o?h[l.HYPHENRANGELOOSE]:h[l.HYPHENRANGE];t=t.replace(g,M(this.options.includePrerelease)),a("hyphen replace",t),t=t.replace(h[l.COMPARATORTRIM],u),a("comparator trim",t),t=t.replace(h[l.TILDETRIM],c),a("tilde trim",t),t=t.replace(h[l.CARETTRIM],f),a("caret trim",t);var y=t.split(" ").map((function(t){return k(t,n.options)})).join(" ").split(/\s+/).map((function(t){return C(t,n.options)}));o&&(y=y.filter((function(t){return a("loose invalid filter",t,n.options),!!t.match(h[l.COMPARATORLOOSE])}))),a("range list",y);var b,x=new Map,E=y.map((function(t){return new r(t,n.options)})),I=w(E);try{for(I.s();!(b=I.n()).done;){var A=b.value;if(m(A))return[A];x.set(A.value,A)}}catch(t){I.e(t)}finally{I.f()}x.size>1&&x.has("")&&x.delete("");var S=p(x.values());return e.set(i,S),S}},{key:"intersects",value:function(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((function(t){return y(t,n)&&e.set.some((function(e){return y(e,n)&&t.every((function(t){return e.every((function(e){return t.intersects(e,n)}))}))}))}))}},{key:"test",value:function(t){if(!t)return!1;if("string"==typeof t)try{t=new s(t,this.options)}catch(t){return!1}for(var e=0;e")||!t.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!t.operator.startsWith("<"))&&(this.semver.version!==t.semver.version||!this.operator.includes("=")||!t.operator.includes("="))&&!(s(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<"))&&!(s(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}}],[{key:"ANY",get:function(){return t}}]),e}();zr=e;var n=_n,r=Xn.safeRe,a=Xn.t,s=ra,h=Yn,l=$n,u=aa();return zr}(),a=Yn,s=$n,h=Xn.safeRe,l=Xn.t,u=Xn.comparatorTrimReplace,c=Xn.tildeTrimReplace,f=Xn.caretTrimReplace,d=Cn.FLAG_INCLUDE_PRERELEASE,v=Cn.FLAG_LOOSE,m=function(t){return"<0.0.0-0"===t.value},g=function(t){return""===t.value},y=function(t,e){for(var n=!0,r=t.slice(),a=r.pop();n&&r.length;)n=r.every((function(t){return a.intersects(t,e)})),a=r.pop();return n},k=function(t,e){return a("comp",t,e),t=I(t,e),a("caret",t),t=x(t,e),a("tildes",t),t=S(t,e),a("xrange",t),t=R(t,e),a("stars",t),t},b=function(t){return!t||"x"===t.toLowerCase()||"*"===t},x=function(t,e){return t.trim().split(/\s+/).map((function(t){return E(t,e)})).join(" ")},E=function(t,e){var n=e.loose?h[l.TILDELOOSE]:h[l.TILDE];return t.replace(n,(function(e,n,r,i,s){var o;return a("tilde",t,e,n,r,i,s),b(n)?o="":b(r)?o=">=".concat(n,".0.0 <").concat(+n+1,".0.0-0"):b(i)?o=">=".concat(n,".").concat(r,".0 <").concat(n,".").concat(+r+1,".0-0"):s?(a("replaceTilde pr",s),o=">=".concat(n,".").concat(r,".").concat(i,"-").concat(s," <").concat(n,".").concat(+r+1,".0-0")):o=">=".concat(n,".").concat(r,".").concat(i," <").concat(n,".").concat(+r+1,".0-0"),a("tilde return",o),o}))},I=function(t,e){return t.trim().split(/\s+/).map((function(t){return A(t,e)})).join(" ")},A=function(t,e){a("caret",t,e);var n=e.loose?h[l.CARETLOOSE]:h[l.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(function(e,n,i,s,o){var h;return a("caret",t,e,n,i,s,o),b(n)?h="":b(i)?h=">=".concat(n,".0.0").concat(r," <").concat(+n+1,".0.0-0"):b(s)?h="0"===n?">=".concat(n,".").concat(i,".0").concat(r," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".0").concat(r," <").concat(+n+1,".0.0-0"):o?(a("replaceCaret pr",o),h="0"===n?"0"===i?">=".concat(n,".").concat(i,".").concat(s,"-").concat(o," <").concat(n,".").concat(i,".").concat(+s+1,"-0"):">=".concat(n,".").concat(i,".").concat(s,"-").concat(o," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".").concat(s,"-").concat(o," <").concat(+n+1,".0.0-0")):(a("no pr"),h="0"===n?"0"===i?">=".concat(n,".").concat(i,".").concat(s).concat(r," <").concat(n,".").concat(i,".").concat(+s+1,"-0"):">=".concat(n,".").concat(i,".").concat(s).concat(r," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".").concat(s," <").concat(+n+1,".0.0-0")),a("caret return",h),h}))},S=function(t,e){return a("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return T(t,e)})).join(" ")},T=function(t,e){t=t.trim();var n=e.loose?h[l.XRANGELOOSE]:h[l.XRANGE];return t.replace(n,(function(n,r,i,s,o,h){a("xRange",t,n,r,i,s,o,h);var l=b(i),u=l||b(s),c=u||b(o),f=c;return"="===r&&f&&(r=""),h=e.includePrerelease?"-0":"",l?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&f?(u&&(s=0),o=0,">"===r?(r=">=",u?(i=+i+1,s=0,o=0):(s=+s+1,o=0)):"<="===r&&(r="<",u?i=+i+1:s=+s+1),"<"===r&&(h="-0"),n="".concat(r+i,".").concat(s,".").concat(o).concat(h)):u?n=">=".concat(i,".0.0").concat(h," <").concat(+i+1,".0.0-0"):c&&(n=">=".concat(i,".").concat(s,".0").concat(h," <").concat(i,".").concat(+s+1,".0-0")),a("xRange return",n),n}))},R=function(t,e){return a("replaceStars",t,e),t.trim().replace(h[l.STAR],"")},C=function(t,e){return a("replaceGTE0",t,e),t.trim().replace(h[e.includePrerelease?l.GTE0PRE:l.GTE0],"")},M=function(t){return function(e,n,r,a,i,s,o,h,l,u,c,f,d){return n=b(r)?"":b(a)?">=".concat(r,".0.0").concat(t?"-0":""):b(i)?">=".concat(r,".").concat(a,".0").concat(t?"-0":""):s?">=".concat(n):">=".concat(n).concat(t?"-0":""),h=b(l)?"":b(u)?"<".concat(+l+1,".0.0-0"):b(c)?"<".concat(l,".").concat(+u+1,".0-0"):f?"<=".concat(l,".").concat(u,".").concat(c,"-").concat(f):t?"<".concat(l,".").concat(u,".").concat(+c+1,"-0"):"<=".concat(h),"".concat(n," ").concat(h).trim()}},F=function(t,e,n){for(var i=0;i0){var o=t[s].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0};return $r}Rn(ra);var ia,sa,oa=aa(),ha=function(t,e,n){try{e=new oa(e,n)}catch(t){return!1}return e.test(t)},la={valid:er,coerce:sr,satisfies:Rn(ha),SEMVER_SPEC_VERSION:Mn.SEMVER_SPEC_VERSION},ua=0,ca=1,fa=2,da=[0,1,2,2,3,0],va=function(){function t(e,r,a,s){var o;if(i(this,t),h(this,"autoUpdate",!0),h(this,"skeleton",void 0),h(this,"states",void 0),this._app=e,this._position=new n.Vec3,1===re.length){var l,u=w((o=new re(r)).pages);try{for(u.s();!(l=u.n()).done;){var c=l.value;c.setTexture(new Tn(s[c.name]))}}catch(t){u.e(t)}finally{u.f()}}else o=new re(r,(function(t){return new Tn(s[t])}));var f=new yn(new fe(o));f.scale*=.01;var d=f.readSkeletonData(a);this.skeletonVersion=la.valid(la.coerce(d.version)),this._spine_3_6_0=la.satisfies(this.skeletonVersion,"<=3.6.0"),this._spine_3_7_99=la.satisfies(this.skeletonVersion,"<=3.7.99"),this._spine_4_1_X=la.satisfies(this.skeletonVersion,"~4.1.23"),this.skeleton=new Ce(d),this.skeleton.updateWorldTransform(),this.stateData=new Kt(this.skeleton.data),this.states=[new _t(this.stateData)],this.clipper=new gn,this._node=new n.GraphNode,this._meshes=[],this._meshInstances=[],this._materials={},this._tint={},this._aabb=new n.BoundingBox,this._aabbTempArray=[],this._aabbTempOffset=new n.Vec2,this._aabbTempSize=new n.Vec2,this._renderCounts={vertexCount:0,indexCount:0},this._vertexFormat=null,this._vertexBuffer=null,this._indexBuffer=null,this._priority=0,this._timeScale=1,this._layers=[n.LAYERID_UI],this.init(),this._hidden=!1}return o(t,[{key:"destroy",value:function(){this.removeFromLayers();for(var t=0;t0&&this._renderCounts.vertexCount>0){this.skeleton.getBounds(this._aabbTempOffset,this._aabbTempSize,this._aabbTempArray),this._aabb.center=new n.Vec3(this._aabbTempOffset.x,this._aabbTempOffset.y,0),this._aabb.halfExtents=new n.Vec3(.5*this._aabbTempSize.x,.5*this._aabbTempSize.y,0),(!this._vertexBuffer||this._vertexBuffer.getNumVertices()0&&c.indices.length>0){t&&t!==c.material&&(this.SubmitBatch(e,r,t),t=c.material,e=s,r=0),t=c.material;var f=c.positions,d=c.vertexColor.r,v=c.vertexColor.g,m=c.vertexColor.b,p=c.vertexColor.a,g=c.uvs,y=void 0,w=f.length/2;for(y=0;y0){var a=new n.Mesh(this._app.graphicsDevice);a.vertexBuffer=this._vertexBuffer,a.indexBuffer[0]=this._indexBuffer,a.primitive[0].type=n.PRIMITIVE_TRIANGLES,a.primitive[0].base=t,a.primitive[0].count=e,a.primitive[0].indexed=!0,a.aabb=this._aabb,this._meshes.push(a);var i=new n.MeshInstance(a,this._materials[r],this._node);i.drawOrder=this.priority+this._meshInstances.length,i.visible=!this._hidden,this._meshInstances.push(i)}}},{key:"update",value:function(t){if(!this._hidden){var e;t*=this._timeScale;var n=this.states.length;for(e=0;e=0;--i){var s=this.tryEntries[i],o=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var h=a.call(s,"catchLoc"),l=a.call(s,"finallyLoc");if(h&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;M(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:Y(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,o=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){o=!0,i=t},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw i}}}}function k(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var b=function(){function t(){i(this,t),this.array=new Array}return o(t,[{key:"add",value:function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e}},{key:"contains",value:function(t){return null!=this.array[0|t]}},{key:"remove",value:function(t){this.array[0|t]=void 0}},{key:"clear",value:function(){this.array.length=0}}]),t}(),x=function(){function t(){i(this,t),this.entries={},this.size=0}return o(t,[{key:"add",value:function(t){var e=this.entries[t];return this.entries[t]=!0,!e&&(this.size++,!0)}},{key:"addAll",value:function(t){for(var e=this.size,n=0,r=t.length;n0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;i(this,t),this.r=e,this.g=n,this.b=r,this.a=a}return o(t,[{key:"set",value:function(t,e,n,r){return this.r=t,this.g=e,this.b=n,this.a=r,this.clamp()}},{key:"setFromColor",value:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}},{key:"setFromString",value: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?1:parseInt(t.substr(6,2),16)/255,this}},{key:"add",value:function(t,e,n,r){return this.r+=t,this.g+=e,this.b+=n,this.a+=r,this.clamp()}},{key:"clamp",value: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}}],[{key:"rgba8888ToColor",value: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}},{key:"rgb888ToColor",value:function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255}},{key:"fromString",value:function(e){return(new t).setFromString(e)}}]),t}();E.WHITE=new E(1,1,1,1),E.RED=new E(1,0,0,1),E.GREEN=new E(0,1,0,1),E.BLUE=new E(0,0,1,1),E.MAGENTA=new E(1,0,1,1);var I=function(){function t(){i(this,t)}return o(t,null,[{key:"clamp",value:function(t,e,n){return tn?n:t}},{key:"cosDeg",value:function(e){return Math.cos(e*t.degRad)}},{key:"sinDeg",value:function(e){return Math.sin(e*t.degRad)}},{key:"signum",value:function(t){return t>0?1:t<0?-1:0}},{key:"toInt",value:function(t){return t>0?Math.floor(t):Math.ceil(t)}},{key:"cbrt",value:function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e}},{key:"randomTriangular",value:function(e,n){return t.randomTriangularWith(e,n,.5*(e+n))}},{key:"randomTriangularWith",value:function(t,e,n){var r=Math.random(),a=e-t;return r<=(n-t)/a?t+Math.sqrt(r*a*(n-t)):e-Math.sqrt((1-r)*a*(e-n))}},{key:"isPowerOfTwo",value:function(t){return t&&0==(t&t-1)}}]),t}();I.PI=3.1415927,I.PI2=2*I.PI,I.radiansToDegrees=180/I.PI,I.radDeg=I.radiansToDegrees,I.degreesToRadians=I.PI/180,I.degRad=I.degreesToRadians;var A=function(){function t(){i(this,t)}return o(t,[{key:"apply",value:function(t,e,n){return t+(e-t)*this.applyInternal(n)}}]),t}(),S=function(t){l(n,t);var e=d(n);function n(t){var r;return i(this,n),(r=e.call(this)).power=2,r.power=t,r}return o(n,[{key:"applyInternal",value:function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1}}]),n}(A),T=function(t){l(n,t);var e=d(n);function n(t){return i(this,n),e.call(this,t)}return o(n,[{key:"applyInternal",value:function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}]),n}(S),R=function(){function t(){i(this,t)}return o(t,null,[{key:"arrayCopy",value:function(t,e,n,r,a){for(var i=e,s=r;i2&&void 0!==arguments[2]?arguments[2]:0,r=t.length;if(r==e)return t;if(t.length=e,r2&&void 0!==arguments[2]?arguments[2]:0;return e.length>=n?e:t.setArraySize(e,n,r)}},{key:"newArray",value:function(t,e){for(var n=new Array(t),r=0;r0?this.items.pop():this.instantiator()}},{key:"free",value:function(t){t.reset&&t.reset(),this.items.push(t)}},{key:"freeAll",value:function(t){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(this,t),this.x=e,this.y=n}return o(t,[{key:"set",value:function(t,e){return this.x=t,this.y=e,this}},{key:"length",value:function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}},{key:"normalize",value:function(){var t=this.length();return 0!=t&&(this.x/=t,this.y/=t),this}}]),t}(),Y=function(){function t(){i(this,t),this.maxDelta=.064,this.framesPerSecond=0,this.delta=0,this.totalTime=0,this.lastTime=Date.now()/1e3,this.frameCount=0,this.frameTime=0}return o(t,[{key:"update",value:function(){var t=Date.now()/1e3;this.delta=t-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}]),t}(),L=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;i(this,t),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(e)}return o(t,[{key:"hasEnoughData",value:function(){return this.addedValues>=this.values.length}},{key:"addValue",value:function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}},{key:"getMean",value:function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*i;var s=t.bone.skeleton,o=t.deform,h=this.vertices,l=this.bones;if(l){for(var u=0,c=0,f=0;f0&&(h=o);for(var N=t.bone,P=N.worldX,_=N.worldY,O=N.a,B=N.b,D=N.c,V=N.d,U=e,q=a;q=this.regions.length&&(n=this.regions.length-1);var r=this.regions[n];e.region!=r&&(e.region=r,e.updateRegion())}},{key:"getPath",value:function(t,e){for(var n=t,r=(this.start+e).toString(),a=this.digits-r.length;a>0;a--)n+="0";return n+=r}}],[{key:"nextID",value:function(){return t._nextID++}}]),t}();_._nextID=0,function(t){t[t.hold=0]="hold",t[t.once=1]="once",t[t.loop=2]="loop",t[t.pingpong=3]="pingpong",t[t.onceReverse=4]="onceReverse",t[t.loopReverse=5]="loopReverse",t[t.pingpongReverse=6]="pingpongReverse"}(P||(P={}));var O,B,D=[P.hold,P.once,P.loop,P.pingpong,P.onceReverse,P.loopReverse,P.pingpongReverse],V=function(){function t(e,n,r){if(i(this,t),this.timelines=[],this.timelineIds=new x,!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(n),this.duration=r}return o(t,[{key:"setTimelines",value:function(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(var e=0;e0&&(e%=this.duration));for(var h=this.timelines,l=0,u=h.length;le)return r-1;return n-1}},{key:"search",value:function(t,e,n){for(var r=t.length,a=n;ae)return a-n;return r-n}}]),t}(),lt=function(t){l(n,t);var e=d(n);function n(t,r,a){var s;return i(this,n),(s=e.call(this,t,a)).curves=R.newFloatArray(t+18*r),s.curves[t-1]=1,s}return o(n,[{key:"setLinear",value:function(t){this.curves[t]=0}},{key:"setStepped",value:function(t){this.curves[t]=1}},{key:"shrink",value:function(t){var e=this.getFrameCount()+18*t;if(this.curves.length>e){var n=R.newFloatArray(e);R.arrayCopy(this.curves,0,n,0,e),this.curves=n}}},{key:"setBezier",value:function(t,e,n,r,a,i,s,o,h,l,u){var c=this.curves,f=this.getFrameCount()+18*t;0==n&&(c[e]=2+f);for(var d=.03*(r-2*i+o),v=.03*(a-2*s+h),m=.006*(3*(i-o)-r+l),p=.006*(3*(s-h)-a+u),g=2*d+m,y=2*v+p,w=.3*(i-r)+d+.16666667*m,k=.3*(s-a)+v+.16666667*p,b=r+w,x=a+k,E=f+18;ft){var i=this.frames[e],s=this.frames[e+n];return s+(t-i)/(a[r]-i)*(a[r+1]-s)}var o=r+18;for(r+=2;r=t){var h=a[r-2],l=a[r-1];return l+(t-h)/(a[r]-h)*(a[r+1]-l)}e+=this.getFrameEntries();var u=a[o-2],c=a[o-1];return c+(t-u)/(this.frames[e]-u)*(this.frames[e+n]-c)}}]),n}(ht),ut=function(t){l(n,t);var e=d(n);function n(t,r,a){return i(this,n),e.call(this,t,r,[a])}return o(n,[{key:"getFrameEntries",value:function(){return 2}},{key:"setFrame",value:function(t,e,n){t<<=1,this.frames[t]=e,this.frames[t+1]=n}},{key:"getCurveValue",value:function(t){for(var e=this.frames,n=e.length-2,r=2;r<=n;r+=2)if(e[r]>t){n=r-2;break}var a=this.curves[n>>1];switch(a){case 0:var i=e[n],s=e[n+1];return s+(t-i)/(e[n+2]-i)*(e[n+2+1]-s);case 1:return e[n+1]}return this.getBezierValue(t,n,1,a-2)}}]),n}(lt),ct=function(t){l(n,t);var e=d(n);function n(t,r,a,s){return i(this,n),e.call(this,t,r,[a,s])}return o(n,[{key:"getFrameEntries",value:function(){return 3}},{key:"setFrame",value:function(t,e,n,r){t*=3,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=r}}]),n}(lt),ft=function(t){l(n,t);var e=d(n);function n(t,r,a){var s;return i(this,n),(s=e.call(this,t,r,U+"|"+a)).boneIndex=0,s.boneIndex=a,s}return o(n,[{key:"apply",value:function(t,e,n,r,a,i,s){var o=t.bones[this.boneIndex];if(o.active)if(n>2];switch(m){case 0:var p=h[v];c=h[v+1],f=h[v+2],d=h[v+3];var g=(n-p)/(h[v+4]-p);c+=(h[v+4+1]-c)*g,f+=(h[v+4+2]-f)*g,d+=(h[v+4+3]-d)*g;break;case 1:c=h[v+1],f=h[v+2],d=h[v+3];break;default:c=this.getBezierValue(n,v,1,m-2),f=this.getBezierValue(n,v,2,m+18-2),d=this.getBezierValue(n,v,3,m+36-2)}if(1==a)l.r=c,l.g=f,l.b=d;else{if(i==O.setup){var y=o.data.color;l.r=y.r,l.g=y.g,l.b=y.b}l.r+=(c-l.r)*a,l.g+=(f-l.g)*a,l.b+=(d-l.b)*a}}}}}]),n}(lt),It=function(t){l(n,t);var e=d(n);function n(t,r,a){var s;return i(this,n),(s=e.call(this,t,r,J+"|"+a)).slotIndex=0,s.slotIndex=a,s}return o(n,[{key:"apply",value:function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=o.color;if(n>3];switch(b){case 0:var x=h[k];d=h[k+1],v=h[k+2],m=h[k+3],p=h[k+4],g=h[k+5],y=h[k+6],w=h[k+7];var E=(n-x)/(h[k+8]-x);d+=(h[k+8+1]-d)*E,v+=(h[k+8+2]-v)*E,m+=(h[k+8+3]-m)*E,p+=(h[k+8+4]-p)*E,g+=(h[k+8+5]-g)*E,y+=(h[k+8+6]-y)*E,w+=(h[k+8+7]-w)*E;break;case 1:d=h[k+1],v=h[k+2],m=h[k+3],p=h[k+4],g=h[k+5],y=h[k+6],w=h[k+7];break;default:d=this.getBezierValue(n,k,1,b-2),v=this.getBezierValue(n,k,2,b+18-2),m=this.getBezierValue(n,k,3,b+36-2),p=this.getBezierValue(n,k,4,b+54-2),g=this.getBezierValue(n,k,5,b+72-2),y=this.getBezierValue(n,k,6,b+90-2),w=this.getBezierValue(n,k,7,b+108-2)}if(1==a)l.set(d,v,m,p),u.r=g,u.g=y,u.b=w;else{if(i==O.setup){l.setFromColor(o.data.color);var I=o.data.darkColor;u.r=I.r,u.g=I.g,u.b=I.b}l.add((d-l.r)*a,(v-l.g)*a,(m-l.b)*a,(p-l.a)*a),u.r+=(g-u.r)*a,u.g+=(y-u.g)*a,u.b+=(w-u.b)*a}}}}}]),n}(lt),St=function(t){l(n,t);var e=d(n);function n(t,r,a){var s;return i(this,n),(s=e.call(this,t,r,[$+"|"+a,K+"|"+a])).slotIndex=0,s.slotIndex=a,s}return o(n,[{key:"getFrameEntries",value:function(){return 7}},{key:"setFrame",value:function(t,e,n,r,a,i,s,o){t*=7,this.frames[t]=e,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=a,this.frames[t+4]=i,this.frames[t+5]=s,this.frames[t+6]=o}},{key:"apply",value:function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=this.frames,l=o.color,u=o.darkColor;if(nt){var i=this.frames[e];return n[r+1]*(t-i)/(n[r]-i)}var s=r+18;for(r+=2;r=t){var o=n[r-2],h=n[r-1];return h+(t-o)/(n[r]-o)*(n[r+1]-h)}var l=n[s-2],u=n[s-1];return u+(1-u)*(t-l)/(this.frames[e+this.getFrameEntries()]-l)}},{key:"apply",value:function(t,e,n,r,a,i,s){var o=t.slots[this.slotIndex];if(o.bone.active){var h=o.getAttachment();if(h&&h instanceof N&&h.timelineAttachment==this.attachment){var l=o.deform;0==l.length&&(i=O.setup);var u=this.vertices,c=u[0].length,f=this.frames;if(n=f[f.length-1]){var p=u[f.length-1];if(1==a)if(i==O.add){var g=h;if(g.bones)for(var y=0;yn)this.apply(t,e,Number.MAX_VALUE,r,a,i,s),e=-1;else if(e>=o[h-1])return;if(!(n0&&o[l-1]==u;)l--;for(;l=o[l];l++)r.push(this.events[l])}}}}]),n}(ht);Ct.propertyIds=[""+tt];var Mt=function(t){l(n,t);var e=d(n);function n(t){var r;return i(this,n),(r=e.call(this,t,n.propertyIds)).drawOrders=new Array(t),r}return o(n,[{key:"getFrameCount",value:function(){return this.frames.length}},{key:"setFrame",value:function(t,e,n){this.frames[t]=e,this.drawOrders[t]=n}},{key:"apply",value:function(t,e,n,r,a,i,s){if(s!=B.mixOut)if(n>2];switch(d){case 0:var v=h[f];l=h[f+1],u=h[f+2],c=h[f+3];var m=(n-v)/(h[f+4]-v);l+=(h[f+4+1]-l)*m,u+=(h[f+4+2]-u)*m,c+=(h[f+4+3]-c)*m;break;case 1:l=h[f+1],u=h[f+2],c=h[f+3];break;default:l=this.getBezierValue(n,f,1,d-2),u=this.getBezierValue(n,f,2,d+18-2),c=this.getBezierValue(n,f,3,d+36-2)}if(i==O.setup){var p=o.data;o.mixRotate=p.mixRotate+(l-p.mixRotate)*a,o.mixX=p.mixX+(u-p.mixX)*a,o.mixY=p.mixY+(c-p.mixY)*a}else o.mixRotate+=(l-o.mixRotate)*a,o.mixX+=(u-o.mixX)*a,o.mixY+=(c-o.mixY)*a}}}}]),n}(lt),Pt=function(t){l(n,t);var e=d(n);function n(t,r,a){var s;return i(this,n),(s=e.call(this,t,[ot+"|"+r+"|"+a.sequence.id])).slotIndex=r,s.attachment=a,s}return o(n,[{key:"getFrameEntries",value:function(){return n.ENTRIES}},{key:"getSlotIndex",value:function(){return this.slotIndex}},{key:"getAttachment",value:function(){return this.attachment}},{key:"setFrame",value:function(t,e,r,a,i){var s=this.frames;s[t*=n.ENTRIES]=e,s[t+n.MODE]=r|a<<4,s[t+n.DELAY]=i}},{key:"apply",value:function(t,e,r,a,i,s,o){var h=t.slots[this.slotIndex];if(h.bone.active){var l=h.attachment,u=this.attachment;if(l==u||l instanceof N&&l.timelineAttachment==u){var c=this.frames;if(r>4,g=this.attachment.sequence.regions.length,y=D[15&v];if(y!=P.hold)switch(p+=(r-d)/m+1e-5|0,y){case P.once:p=Math.min(g-1,p);break;case P.loop:p%=g;break;case P.pingpong:var w=(g<<1)-2;(p=0==w?0:p%w)>=g&&(p=w-p);break;case P.onceReverse:p=Math.max(g-1-p,0);break;case P.loopReverse:p=g-1-p%g;break;case P.pingpongReverse:var k=(g<<1)-2;(p=0==k?0:(p+g-1)%k)>=g&&(p=k-p)}h.sequenceIndex=p}}}}}}]),n}(ht);Pt.ENTRIES=3,Pt.MODE=1,Pt.DELAY=2;var _t=function(){function t(e){i(this,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 x,this.animationsChanged=!1,this.trackEntryPool=new M((function(){return new Bt})),this.data=e}return o(t,[{key:"update",value:function(t){t*=this.timeScale;for(var e=this.tracks,n=0,r=e.length;n0){if(a.delay-=i,a.delay>0)continue;i=-a.delay,a.delay=0}var s=a.next;if(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(n,s,!0);s.mixingFrom;)s.mixTime+=t,s=s.mixingFrom;continue}}else if(a.trackLast>=a.trackEnd&&!a.mixingFrom){e[n]=null,this.queue.end(a),this.clearNext(a);continue}if(a.mixingFrom&&this.updateMixingFrom(a,t)){var h=a.mixingFrom;for(a.mixingFrom=null,h&&(h.mixingTo=null);h;)this.queue.end(h),h=h.mixingFrom}a.trackTime+=i}}this.queue.drain()}},{key:"updateMixingFrom",value:function(t,e){var n=t.mixingFrom;if(!n)return!0;var r=this.updateMixingFrom(n,e);return n.animationLast=n.nextAnimationLast,n.trackLast=n.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=n.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=n.mixingFrom,n.mixingFrom&&(n.mixingFrom.mixingTo=t),t.interruptAlpha=n.interruptAlpha,this.queue.end(n)),r):(n.trackTime+=e*n.timeScale,t.mixTime+=e,!1)}},{key:"apply",value:function(t){if(!t)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var e=this.events,n=this.tracks,r=!1,a=0,i=n.length;a0)){r=!0;var o=0==a?O.first:s.mixBlend,h=s.alpha;s.mixingFrom?h*=this.applyMixingFrom(s,t,o):s.trackTime>=s.trackEnd&&!s.next&&(h=0);var l=s.animationLast,u=s.getAnimationTime(),c=u,f=e;s.reverse&&(c=s.animation.duration-c,f=null);var d=s.animation.timelines,v=d.length;if(0==a&&1==h||o==O.add)for(var m=0;m1&&(a=1),n!=O.first&&(n=r.mixBlend));var i=a0&&this.queueEvents(r,f),this.events.length=0,r.nextAnimationLast=f,r.nextTrackLast=r.trackTime,a}},{key:"applyAttachmentTimeline",value:function(t,e,n,r,a){var i=e.slots[t.slotIndex];i.bone.active&&(n0,p=d>=0;I.signum(v)!=I.signum(f)&&Math.abs(v)<=90&&(Math.abs(d)>180&&(d+=360*I.signum(d)),p=m),c=f+d-d%360,p!=m&&(c+=360*I.signum(d)),i[s]=c}i[s+1]=f,h.rotation=l+c*r}}else t.apply(e,0,n,null,1,a,B.mixIn)}},{key:"queueEvents",value:function(t,e){for(var n=t.animationStart,r=t.animationEnd,a=r-n,i=t.trackLast%a,s=this.events,o=0,h=s.length;or||this.queue.event(t,l)}for((t.loop?0==a||i>t.trackTime%a:e>=r&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(e){this.queue.end(e),this.clearNext(e);for(var n=e;;){var r=n.mixingFrom;if(!r)break;this.queue.end(r),n.mixingFrom=null,n.mixingTo=null,n=r}this.tracks[e.trackIndex]=null,this.queue.drain()}}}},{key:"setCurrent",value:function(t,e,n){var r=this.expandToIndex(t);this.tracks[t]=e,e.previous=null,r&&(n&&this.queue.interrupt(r),e.mixingFrom=r,r.mixingTo=e,e.mixTime=0,r.mixingFrom&&r.mixDuration>0&&(e.interruptAlpha*=Math.min(1,r.mixTime/r.mixDuration)),r.timelinesRotation.length=0),this.queue.start(e)}},{key:"setAnimation",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.data.skeletonData.findAnimation(e);if(!r)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,r,n)}},{key:"setAnimationWith",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)throw new Error("animation cannot be null.");var r=!0,a=this.expandToIndex(t);a&&(-1==a.nextTrackLast?(this.tracks[t]=a.mixingFrom,this.queue.interrupt(a),this.queue.end(a),this.clearNext(a),a=a.mixingFrom,r=!1):this.clearNext(a));var i=this.trackEntry(t,e,n,a);return this.setCurrent(t,i,r),this.queue.drain(),i}},{key:"addAnimation",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=this.data.skeletonData.findAnimation(e);if(!a)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,a,n,r)}},{key:"addAnimationWith",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!e)throw new Error("animation cannot be null.");var a=this.expandToIndex(t);if(a)for(;a.next;)a=a.next;var i=this.trackEntry(t,e,n,a);return a?(a.next=i,i.previous=a,r<=0&&(r+=a.getTrackComplete()-i.mixDuration)):(this.setCurrent(t,i,!0),this.queue.drain()),i.delay=r,i}},{key:"setEmptyAnimation",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.setAnimationWith(e,t.emptyAnimation(),!1);return r.mixDuration=n,r.trackEnd=n,r}},{key:"addEmptyAnimation",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=this.addAnimationWith(e,t.emptyAnimation(),!1,r);return r<=0&&(a.delay+=a.mixDuration-n),a.mixDuration=n,a.trackEnd=n,a}},{key:"setEmptyAnimations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var n=0,r=this.tracks.length;n0){a[h]=Ht,i[h]=c;continue t}break}a[h]=zt}else a[h]=Wt}}},{key:"getCurrent",value:function(t){return t>=this.tracks.length?null:this.tracks[t]}},{key:"addListener",value:function(t){if(!t)throw new Error("listener cannot be null.");this.listeners.push(t)}},{key:"removeListener",value:function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)}},{key:"clearListeners",value:function(){this.listeners.length=0}},{key:"clearListenerNotifications",value:function(){this.queue.clear()}}],[{key:"emptyAnimation",value:function(){return t._emptyAnimation}}]),t}();_t._emptyAnimation=new V("",[],0);var Ot,Bt=function(){function t(){i(this,t),this.animation=null,this.previous=null,this.next=null,this.mixingFrom=null,this.mixingTo=null,this.listener=null,this.trackIndex=0,this.loop=!1,this.holdPrevious=!1,this.reverse=!1,this.shortestRotation=!1,this.eventThreshold=0,this.attachmentThreshold=0,this.drawOrderThreshold=0,this.animationStart=0,this.animationEnd=0,this.animationLast=0,this.nextAnimationLast=0,this.delay=0,this.trackTime=0,this.trackLast=0,this.nextTrackLast=0,this.trackEnd=0,this.timeScale=0,this.alpha=0,this.mixTime=0,this.mixDuration=0,this.interruptAlpha=0,this.totalAlpha=0,this.mixBlend=O.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}return o(t,[{key:"reset",value:function(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}},{key:"getAnimationTime",value: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)}},{key:"setAnimationLast",value:function(t){this.animationLast=t,this.nextAnimationLast=t}},{key:"isComplete",value:function(){return this.trackTime>=this.animationEnd-this.animationStart}},{key:"resetRotationDirections",value:function(){this.timelinesRotation.length=0}},{key:"getTrackComplete",value:function(){var t=this.animationEnd-this.animationStart;if(0!=t){if(this.loop)return t*(1+(this.trackTime/t|0));if(this.trackTime0&&u&&u.length>0&&(c.names=l,c.values=u,l=null,u=null),c.u=c.x/h.width,c.v=c.y/h.height,90==c.degrees?(c.u2=(c.x+c.height)/h.width,c.v2=(c.y+c.width)/h.height):(c.u2=(c.x+c.width)/h.width,c.v2=(c.y+c.height)/h.height),this.regions.push(c)}else{for(h=new ie(o.trim());0!=n.readEntry(r,o=n.readLine());){var p=a[r[0]];p&&p(h)}this.pages.push(h)}}return o(t,[{key:"findRegion",value:function(t){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:"",r=w(this.pages);try{for(r.s();!(e=r.n()).done;){var a=e.value;a.setTexture(t.get(n+a.name))}}catch(t){r.e(t)}finally{r.f()}}},{key:"dispose",value:function(){for(var t,e=0;e=this.lines.length?null:this.lines[this.index++]}},{key:"readEntry",value:function(t,e){if(!e)return 0;if(0==(e=e.trim()).length)return 0;var n=e.indexOf(":");if(-1==n)return 0;t[0]=e.substr(0,n).trim();for(var r=1,a=n+1;;r++){var i=e.indexOf(",",a);if(-1==i)return t[r]=e.substr(a).trim(),r;if(t[r]=e.substr(a,i-a).trim(),a=i+1,4==r)return 4}}}]),t}(),ie=function(){function t(e){i(this,t),this.minFilter=Vt.Nearest,this.magFilter=Vt.Nearest,this.uWrap=Ut.ClampToEdge,this.vWrap=Ut.ClampToEdge,this.texture=null,this.width=0,this.height=0,this.pma=!1,this.regions=new Array,this.name=e}return o(t,[{key:"setTexture",value:function(t){this.texture=t,t.setFilters(this.minFilter,this.magFilter),t.setWraps(this.uWrap,this.vWrap);var e,n=w(this.regions);try{for(n.s();!(e=n.n()).done;){e.value.texture=t}}catch(t){n.e(t)}finally{n.f()}}}]),t}(),se=function(t){l(n,t);var e=d(n);function n(t,r){var a;return i(this,n),(a=e.call(this)).x=0,a.y=0,a.offsetX=0,a.offsetY=0,a.originalWidth=0,a.originalHeight=0,a.index=0,a.degrees=0,a.names=null,a.values=null,a.page=t,a.name=r,t.regions.push(f(a)),a}return o(n)}(ee),oe=function(t){l(n,t);var e=d(n);function n(t,r){var a;return i(this,n),(a=e.call(this,t)).region=null,a.regionUVs=[],a.uvs=[],a.triangles=[],a.color=new E(1,1,1,1),a.width=0,a.height=0,a.hullLength=0,a.edges=[],a.parentMesh=null,a.sequence=null,a.tempColor=new E(0,0,0,0),a.path=r,a}return o(n,[{key:"updateRegion",value:function(){if(!this.region)throw new Error("Region not set.");var t=this.regionUVs;this.uvs&&this.uvs.length==t.length||(this.uvs=R.newFloatArray(t.length));var e=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,i=0,s=0;if(this.region instanceof se){var o=this.region,h=o.page.texture.getImage(),l=h.width,u=h.height;switch(o.degrees){case 90:r-=(o.originalHeight-o.offsetY-o.height)/l,a-=(o.originalWidth-o.offsetX-o.width)/u,i=o.originalHeight/l,s=o.originalWidth/u;for(var c=0;c= 0.");if(!n)throw new Error("name cannot be null.");this.index=e,this.name=n,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"}(ce||(ce={}));var ve,me,pe,ge=function(){function t(e,n,r){if(i(this,t),this.parent=null,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,!e)throw new Error("data cannot be null.");if(!n)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=n,this.parent=r,this.setToSetupPose()}return o(t,[{key:"isActive",value:function(){return this.active}},{key:"update",value:function(){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}},{key:"updateWorldTransform",value:function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}},{key:"updateWorldTransformWith",value:function(t,e,n,r,a,i,s){this.ax=t,this.ay=e,this.arotation=n,this.ascaleX=r,this.ascaleY=a,this.ashearX=i,this.ashearY=s;var o=this.parent;if(!o){var h=this.skeleton,l=n+90+s,u=h.scaleX,c=h.scaleY;return this.a=I.cosDeg(n+i)*r*u,this.b=I.cosDeg(l)*a*u,this.c=I.sinDeg(n+i)*r*c,this.d=I.sinDeg(l)*a*c,this.worldX=t*u+h.x,void(this.worldY=e*c+h.y)}var f=o.a,d=o.b,v=o.c,m=o.d;switch(this.worldX=f*t+d*e+o.worldX,this.worldY=v*t+m*e+o.worldY,this.data.transformMode){case ce.Normal:var p=n+90+s,g=I.cosDeg(n+i)*r,y=I.cosDeg(p)*a,w=I.sinDeg(n+i)*r,k=I.sinDeg(p)*a;return this.a=f*g+d*w,this.b=f*y+d*k,this.c=v*g+m*w,void(this.d=v*y+m*k);case ce.OnlyTranslation:var b=n+90+s;this.a=I.cosDeg(n+i)*r,this.b=I.cosDeg(b)*a,this.c=I.sinDeg(n+i)*r,this.d=I.sinDeg(b)*a;break;case ce.NoRotationOrReflection:var x=f*f+v*v,E=0;x>1e-4?(x=Math.abs(f*m-d*v)/x,f/=this.skeleton.scaleX,d=(v/=this.skeleton.scaleY)*x,m=f*x,E=Math.atan2(v,f)*I.radDeg):(f=0,v=0,E=90-Math.atan2(m,d)*I.radDeg);var A=n+i-E,S=n+s-E+90,T=I.cosDeg(A)*r,R=I.cosDeg(S)*a,C=I.sinDeg(A)*r,M=I.sinDeg(S)*a;this.a=f*T-d*C,this.b=f*R-d*M,this.c=v*T+m*C,this.d=v*R+m*M;break;case ce.NoScale:case ce.NoScaleOrReflection:var F=I.cosDeg(n),Y=I.sinDeg(n),L=(f*F+d*Y)/this.skeleton.scaleX,X=(v*F+m*Y)/this.skeleton.scaleY,N=Math.sqrt(L*L+X*X);N>1e-5&&(N=1/N),L*=N,X*=N,N=Math.sqrt(L*L+X*X),this.data.transformMode==ce.NoScale&&f*m-d*v<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(N=-N);var P=Math.PI/2+Math.atan2(X,L),_=Math.cos(P)*N,O=Math.sin(P)*N,B=I.cosDeg(i)*r,D=I.cosDeg(90+s)*a,V=I.sinDeg(i)*r,U=I.sinDeg(90+s)*a;this.a=L*B+_*V,this.b=L*D+_*U,this.c=X*B+O*V,this.d=X*D+O*U}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}},{key:"setToSetupPose",value: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}},{key:"getWorldRotationX",value:function(){return Math.atan2(this.c,this.a)*I.radDeg}},{key:"getWorldRotationY",value:function(){return Math.atan2(this.d,this.b)*I.radDeg}},{key:"getWorldScaleX",value:function(){return Math.sqrt(this.a*this.a+this.c*this.c)}},{key:"getWorldScaleY",value:function(){return Math.sqrt(this.b*this.b+this.d*this.d)}},{key:"updateAppliedTransform",value:function(){var t=this.parent;if(!t)return this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*I.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)*I.radDeg);var e=t.a,n=t.b,r=t.c,a=t.d,i=1/(e*a-n*r),s=this.worldX-t.worldX,o=this.worldY-t.worldY;this.ax=s*a*i-o*n*i,this.ay=o*e*i-s*r*i;var h=i*a,l=i*e,u=i*n,c=i*r,f=h*this.a-u*this.c,d=h*this.b-u*this.d,v=l*this.c-c*this.a,m=l*this.d-c*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+v*v),this.ascaleX>1e-4){var p=f*m-d*v;this.ascaleY=p/this.ascaleX,this.ashearY=Math.atan2(f*d+v*m,p)*I.radDeg,this.arotation=Math.atan2(v,f)*I.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,d)*I.radDeg}},{key:"worldToLocal",value:function(t){var e=1/(this.a*this.d-this.b*this.c),n=t.x-this.worldX,r=t.y-this.worldY;return t.x=n*this.d*e-r*this.b*e,t.y=r*this.a*e-n*this.c*e,t}},{key:"localToWorld",value:function(t){var e=t.x,n=t.y;return t.x=e*this.a+n*this.b+this.worldX,t.y=e*this.c+n*this.d+this.worldY,t}},{key:"worldToLocalRotation",value:function(t){var e=I.sinDeg(t),n=I.cosDeg(t);return Math.atan2(this.a*e-this.c*n,this.d*n-this.b*e)*I.radDeg+this.rotation-this.shearX}},{key:"localToWorldRotation",value:function(t){t-=this.rotation-this.shearX;var e=I.sinDeg(t),n=I.cosDeg(t);return Math.atan2(n*this.c+e*this.d,n*this.a+e*this.b)*I.radDeg}},{key:"rotateWorld",value:function(t){var e=this.a,n=this.b,r=this.c,a=this.d,i=I.cosDeg(t),s=I.sinDeg(t);this.a=i*e-s*r,this.b=i*n-s*a,this.c=s*e+i*r,this.d=s*n+i*a}}]),t}(),ye=o((function t(e,n,r){i(this,t),this.name=e,this.order=n,this.skinRequired=r})),we=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new ke;i(this,t),this.pathPrefix="",this.assets={},this.errors={},this.toLoad=0,this.loaded=0,this.textureLoader=e,this.pathPrefix=n,this.downloader=r}return o(t,[{key:"start",value:function(t){return this.toLoad++,this.pathPrefix+t}},{key:"success",value:function(t,e,n){this.toLoad--,this.loaded++,this.assets[e]=n,t&&t(e,n)}},{key:"error",value:function(t,e,n){this.toLoad--,this.loaded++,this.errors[e]=n,t&&t(e,n)}},{key:"loadAll",value:function(){var t=this;return new Promise((function(e,n){requestAnimationFrame((function r(){t.isLoadingComplete()?t.hasErrors()?n(t.errors):e(t):requestAnimationFrame(r)}))}))}},{key:"setRawDataURI",value:function(t,e){this.downloader.rawDataUris[this.pathPrefix+t]=e}},{key:"loadBinary",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};t=this.start(t),this.downloader.downloadBinary(t,(function(r){e.success(n,t,r)}),(function(n,a){e.error(r,t,"Couldn't load binary ".concat(t,": status ").concat(n,", ").concat(a))}))}},{key:"loadText",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};t=this.start(t),this.downloader.downloadText(t,(function(r){e.success(n,t,r)}),(function(n,a){e.error(r,t,"Couldn't load text ".concat(t,": status ").concat(n,", ").concat(a))}))}},{key:"loadJson",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};t=this.start(t),this.downloader.downloadJson(t,(function(r){e.success(n,t,r)}),(function(n,a){e.error(r,t,"Couldn't load JSON ".concat(t,": status ").concat(n,", ").concat(a))}))}},{key:"loadTexture",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(t=this.start(t),!!("undefined"==typeof window||"undefined"==typeof navigator||!window.document))fetch(t,{mode:"cors"}).then((function(n){return n.ok?n.blob():(e.error(r,t,"Couldn't load image: ".concat(t)),null)})).then((function(t){return t?createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}):null})).then((function(r){r&&e.success(n,t,e.textureLoader(r))}));else{var a=new Image;a.crossOrigin="anonymous",a.onload=function(){e.success(n,t,e.textureLoader(a))},a.onerror=function(){e.error(r,t,"Couldn't load image: ".concat(t))},this.downloader.rawDataUris[t]&&(t=this.downloader.rawDataUris[t]),a.src=t}}},{key:"loadTextureAtlas",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},a=arguments.length>3?arguments[3]:void 0,i=t.lastIndexOf("/"),s=i>=0?t.substring(0,i+1):"";t=this.start(t),this.downloader.downloadText(t,(function(i){try{var o,h=new re(i),l=h.pages.length,u=!1,c=w(h.pages);try{var f=function(){var i=o.value;e.loadTexture(a?a[i.name]:s+i.name,(function(r,a){u||(i.setTexture(a),0==--l&&e.success(n,t,h))}),(function(n,a){u||e.error(r,t,"Couldn't load texture atlas ".concat(t," page image: ").concat(n)),u=!0}))};for(c.s();!(o=c.n()).done;)f()}catch(t){c.e(t)}finally{c.f()}}catch(n){e.error(r,t,"Couldn't parse texture atlas ".concat(t,": ").concat(n.message))}}),(function(n,a){e.error(r,t,"Couldn't load texture atlas ".concat(t,": status ").concat(n,", ").concat(a))}))}},{key:"get",value:function(t){return this.assets[this.pathPrefix+t]}},{key:"require",value:function(t){t=this.pathPrefix+t;var e=this.assets[t];if(e)return e;var n=this.errors[t];throw Error("Asset not found: "+t+(n?"\n"+n:""))}},{key:"remove",value:function(t){t=this.pathPrefix+t;var e=this.assets[t];return e.dispose&&e.dispose(),delete this.assets[t],e}},{key:"removeAll",value:function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}}},{key:"isLoadingComplete",value:function(){return 0==this.toLoad}},{key:"getToLoad",value:function(){return this.toLoad}},{key:"getLoaded",value:function(){return this.loaded}},{key:"dispose",value:function(){this.removeAll()}},{key:"hasErrors",value:function(){return Object.keys(this.errors).length>0}},{key:"getErrors",value:function(){return this.errors}}]),t}(),ke=function(){function t(){i(this,t),this.callbacks={},this.rawDataUris={}}return o(t,[{key:"dataUriToString",value:function(t){if(!t.startsWith("data:"))throw new Error("Not a data URI.");var e=t.indexOf("base64,");return-1!=e?(e+=7,atob(t.substr(e))):t.substr(t.indexOf(",")+1)}},{key:"base64ToUint8Array",value:function(t){for(var e=window.atob(t),n=e.length,r=new Uint8Array(n),a=0;a180?f-=360:f<-180&&(f+=360);var b=t.ascaleX,x=t.ascaleY;if(r||a){switch(t.data.transformMode){case ce.NoScale:case ce.NoScaleOrReflection:d=e-t.worldX,v=n-t.worldY}var E=t.data.length*b,A=Math.sqrt(d*d+v*v);if(r&&AE&&E>1e-4){var S=(A/E-1)*s+1;b*=S,i&&(x*=S)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*s,b,x,t.ashearX,t.ashearY)}},{key:"apply2",value:function(t,e,n,r,a,i,s,o,h){var l=t.ax,u=t.ay,c=t.ascaleX,f=t.ascaleY,d=c,v=f,m=e.ascaleX,p=0,g=0,y=0;c<0?(c=-c,p=180,y=-1):(p=0,y=1),f<0&&(f=-f,y=-y),m<0?(m=-m,g=180):g=0;var w=e.ax,k=0,b=0,x=0,E=t.a,A=t.b,S=t.c,T=t.d,R=Math.abs(c-f)<=1e-4;!R||i?(k=0,b=E*w+t.worldX,x=S*w+t.worldY):(b=E*w+A*(k=e.ay)+t.worldX,x=S*w+T*k+t.worldY);var C=t.parent;if(!C)throw new Error("IK parent must itself have a parent.");E=C.a,A=C.b,S=C.c;var M,F,Y=E*(T=C.d)-A*S,L=b-C.worldX,X=x-C.worldY,N=(L*T-X*A)*(Y=Math.abs(Y)<=1e-4?0:1/Y)-l,P=(X*E-L*S)*Y-u,_=Math.sqrt(N*N+P*P),O=e.data.length*m;if(_<1e-4)return this.apply1(t,n,r,!1,i,!1,h),void e.updateWorldTransformWith(w,k,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);var B=((L=n-C.worldX)*T-(X=r-C.worldY)*A)*Y-l,D=(X*E-L*S)*Y-u,V=B*B+D*D;if(0!=o){o*=c*(m+1)*.5;var U=Math.sqrt(V),q=U-_-O*c+o;if(q>0){var W=Math.min(1,q/(2*o))-1;V=(B-=(W=(q-o*(1-W*W))/U)*B)*B+(D-=W*D)*D}}t:if(R){var j=(V-_*_-(O*=c)*O)/(2*_*O);j<-1?(j=-1,F=Math.PI*a):j>1?(j=1,F=0,i&&(d*=E=(Math.sqrt(V)/(_+O)-1)*h+1,s&&(v*=E))):F=Math.acos(j)*a,E=_+O*j,A=O*Math.sin(F),M=Math.atan2(D*E-B*A,B*E+D*A)}else{var G=(E=c*O)*E,z=(A=f*O)*A,H=Math.atan2(D,B),$=-2*z*_,J=z-G;if((T=$*$-4*J*(S=z*_*_+G*V-G*z))>=0){var K=Math.sqrt(T);$<0&&(K=-K);var Q=(K=.5*-($+K))/J,Z=S/K,tt=Math.abs(Q)=-1&&S<=1&&(S=Math.acos(S),(T=(L=E*Math.cos(S)+_)*L+(X=A*Math.sin(S))*X)ot&&(it=S,ot=T,st=L,ht=X)),V<=.5*(rt+ot)?(M=H-Math.atan2(at*a,nt),F=et*a):(M=H-Math.atan2(ht*a,st),F=it*a)}var lt=Math.atan2(k,w)*y,ut=t.arotation;(M=(M-lt)*I.radDeg+p-ut)>180?M-=360:M<-180&&(M+=360),t.updateWorldTransformWith(l,u,ut+M*h,d,v,0,0),ut=e.arotation,(F=((F+lt)*I.radDeg-e.ashearX)*y+g-ut)>180?F-=360:F<-180&&(F+=360),e.updateWorldTransformWith(w,k,ut+F*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}]),t}(),Ie=function(t){l(n,t);var e=d(n);function n(t){var r;return i(this,n),(r=e.call(this,t,0,!1)).bones=new Array,r._target=null,r.bendDirection=1,r.compress=!1,r.stretch=!1,r.uniform=!1,r.mix=1,r.softness=0,r}return o(n,[{key:"target",get:function(){if(this._target)return this._target;throw new Error("BoneData not set.")},set:function(t){this._target=t}}]),n}(ye),Ae=function(t){l(n,t);var e=d(n);function n(t){var r;return i(this,n),(r=e.call(this,t,0,!1)).bones=new Array,r._target=null,r.positionMode=ve.Fixed,r.spacingMode=me.Fixed,r.rotateMode=pe.Chain,r.offsetRotation=0,r.position=0,r.spacing=0,r.mixRotate=0,r.mixX=0,r.mixY=0,r}return o(n,[{key:"target",get:function(){if(this._target)return this._target;throw new Error("SlotData not set.")},set:function(t){this._target=t}}]),n}(ye);!function(t){t[t.Fixed=0]="Fixed",t[t.Percent=1]="Percent"}(ve||(ve={})),function(t){t[t.Length=0]="Length",t[t.Fixed=1]="Fixed",t[t.Percent=2]="Percent",t[t.Proportional=3]="Proportional"}(me||(me={})),function(t){t[t.Tangent=0]="Tangent",t[t.Chain=1]="Chain",t[t.ChainScale=2]="ChainScale"}(pe||(pe={}));var Se=function(){function t(e,n){if(i(this,t),this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,!e)throw new Error("data cannot be null.");if(!n)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(var r=0,a=e.bones.length;r0){k=u/k*d;for(var M=1;M0?I.degRad:-I.degRad}for(var j=0,G=3;j0){var tt=z.a,et=z.b,nt=z.c,rt=z.d,at=0,it=0,st=0;if(at=s?B[G-1]:0==c[j+1]?B[G+2]:Math.atan2(K,J),at-=Math.atan2(nt,tt),q){it=Math.cos(at),st=Math.sin(at);var ot=z.data.length;D+=(ot*(it*tt-st*nt)-J)*n,V+=(ot*(st*tt+it*nt)-K)*n}else at+=U;at>I.PI?at-=I.PI2:at<-I.PI&&(at+=I.PI2),at*=n,it=Math.cos(at),st=Math.sin(at),z.a=it*tt-st*nt,z.b=it*et-st*rt,z.c=st*tt+it*nt,z.d=st*et+it*rt}z.updateAppliedTransform()}}}}},{key:"computeWorldPositions",value:function(e,n,r){var a=this.target,i=this.position,s=this.spaces,o=R.setArraySize(this.positions,3*n+2),h=this.world,l=e.closed,u=e.worldVerticesLength,c=u/6,f=t.NONE;if(!e.constantSpeed){var d,v=e.lengths,m=v[c-=l?1:2];switch(this.data.positionMode==ve.Percent&&(i*=m),this.data.spacingMode){case me.Percent:d=m;break;case me.Proportional:d=m/n;break;default:d=1}h=R.setArraySize(this.world,8);for(var p=0,g=0,y=0;pm){f!=t.AFTER&&(f=t.AFTER,e.computeWorldVertices(a,u-6,4,h,0,2)),this.addAfterPosition(k-m,h,0,o,g);continue}}for(;;y++){var b=v[y];if(!(k>b)){if(0==y)k/=b;else{var x=v[y-1];k=(k-x)/(b-x)}break}}y!=f&&(f=y,l&&y==c?(e.computeWorldVertices(a,u-4,4,h,0,2),e.computeWorldVertices(a,0,4,h,4,2)):e.computeWorldVertices(a,6*y+2,8,h,0,2)),this.addCurvePosition(k,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],o,g,r||p>0&&0==w)}return o}l?(u+=2,h=R.setArraySize(this.world,u),e.computeWorldVertices(a,2,u-4,h,0,2),e.computeWorldVertices(a,0,2,h,u-4,2),h[u-2]=h[0],h[u-1]=h[1]):(c--,u-=4,h=R.setArraySize(this.world,u),e.computeWorldVertices(a,2,u,h,0,2));for(var E,I=R.setArraySize(this.curves,c),A=0,S=h[0],T=h[1],C=0,M=0,F=0,Y=0,L=0,X=0,N=0,P=0,_=0,O=0,B=0,D=0,V=0,U=0,q=0,W=2;qA){this.addAfterPosition(Q-A,h,u-4,o,H);continue}}for(;;$++){var Z=I[$];if(!(Q>Z)){if(0==$)Q/=Z;else{var tt=I[$-1];Q=(Q-tt)/(Z-tt)}break}}if($!=f){f=$;var et=6*$;for(S=h[et],T=h[et+1],C=h[et+2],M=h[et+3],F=h[et+4],Y=h[et+5],B=2*(N=.03*(S-2*C+F))+(_=.006*(3*(C-F)-S+(L=h[et+6]))),D=2*(P=.03*(T-2*M+Y))+(O=.006*(3*(M-Y)-T+(X=h[et+7]))),V=.3*(C-S)+N+.16666667*_,U=.3*(M-T)+P+.16666667*O,G=Math.sqrt(V*V+U*U),j[0]=G,et=1;et<8;et++)V+=B,U+=D,B+=_,D+=O,G+=Math.sqrt(V*V+U*U),j[et]=G;V+=B,U+=D,G+=Math.sqrt(V*V+U*U),j[8]=G,V+=B+_,U+=D+O,G+=Math.sqrt(V*V+U*U),j[9]=G,J=0}for(Q*=G;;J++){var nt=j[J];if(!(Q>nt)){if(0==J)Q/=nt;else{var rt=j[J-1];Q=J+(Q-rt)/(nt-rt)}break}}this.addCurvePosition(.1*Q,S,T,C,M,F,Y,L,X,o,H,r||z>0&&0==K)}return o}},{key:"addBeforePosition",value:function(t,e,n,r,a){var i=e[n],s=e[n+1],o=e[n+2]-i,h=e[n+3]-s,l=Math.atan2(h,o);r[a]=i+t*Math.cos(l),r[a+1]=s+t*Math.sin(l),r[a+2]=l}},{key:"addAfterPosition",value:function(t,e,n,r,a){var i=e[n+2],s=e[n+3],o=i-e[n],h=s-e[n+1],l=Math.atan2(h,o);r[a]=i+t*Math.cos(l),r[a+1]=s+t*Math.sin(l),r[a+2]=l}},{key:"addCurvePosition",value:function(t,e,n,r,a,i,s,o,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=n,void(l[u+2]=Math.atan2(a-n,r-e));var f=t*t,d=f*t,v=1-t,m=v*v,p=m*v,g=v*t,y=3*g,w=v*y,k=y*t,b=e*p+r*w+i*k+o*d,x=n*p+a*w+s*k+h*d;l[u]=b,l[u+1]=x,c&&(l[u+2]=t<.001?Math.atan2(a-n,r-e):Math.atan2(x-(n*m+a*g*2+s*f),b-(e*m+r*g*2+i*f)))}}]),t}();Se.NONE=-1,Se.BEFORE=-2,Se.AFTER=-3,Se.epsilon=1e-5;var Te=function(){function t(e,n){if(i(this,t),this.darkColor=null,this.attachment=null,this.attachmentState=0,this.sequenceIndex=-1,this.deform=new Array,!e)throw new Error("data cannot be null.");if(!n)throw new Error("bone cannot be null.");this.data=e,this.bone=n,this.color=new E,this.darkColor=e.darkColor?new E:null,this.setToSetupPose()}return o(t,[{key:"getSkeleton",value:function(){return this.bone.skeleton}},{key:"getAttachment",value:function(){return this.attachment}},{key:"setAttachment",value:function(t){this.attachment!=t&&(t instanceof N&&this.attachment instanceof N&&t.timelineAttachment==this.attachment.timelineAttachment||(this.deform.length=0),this.attachment=t,this.sequenceIndex=-1)}},{key:"setToSetupPose",value:function(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}]),t}(),Re=function(){function t(e,n){if(i(this,t),this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.temp=new F,this.active=!1,!e)throw new Error("data cannot be null.");if(!n)throw new Error("skeleton cannot be null.");this.data=e,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY,this.bones=new Array;for(var r=0;r0?I.degRad:-I.degRad,d=this.data.offsetRotation*f,v=this.data.offsetShearY*f,m=this.bones,p=0,g=m.length;pI.PI?E-=I.PI2:E<-I.PI&&(E+=I.PI2),E*=t;var A=Math.cos(E),S=Math.sin(E);y.a=A*w-S*b,y.b=A*k-S*x,y.c=S*w+A*b,y.d=S*k+A*x}if(s){var T=this.temp;o.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),y.worldX+=(T.x-y.worldX)*e,y.worldY+=(T.y-y.worldY)*n}if(0!=r){var R=Math.sqrt(y.a*y.a+y.c*y.c);0!=R&&(R=(R+(Math.sqrt(h*h+u*u)-R+this.data.offsetScaleX)*r)/R),y.a*=R,y.c*=R}if(0!=a){var C=Math.sqrt(y.b*y.b+y.d*y.d);0!=C&&(C=(C+(Math.sqrt(l*l+c*c)-C+this.data.offsetScaleY)*a)/C),y.b*=C,y.d*=C}if(i>0){var M=y.b,F=y.d,Y=Math.atan2(F,M),L=Math.atan2(c,l)-Math.atan2(u,h)-(Y-Math.atan2(y.c,y.a));L>I.PI?L-=I.PI2:L<-I.PI&&(L+=I.PI2),L=Y+(L+v)*i;var X=Math.sqrt(M*M+F*F);y.b=Math.cos(L)*X,y.d=Math.sin(L)*X}y.updateAppliedTransform()}}},{key:"applyRelativeWorld",value:function(){for(var t=this.mixRotate,e=this.mixX,n=this.mixY,r=this.mixScaleX,a=this.mixScaleY,i=this.mixShearY,s=0!=e||0!=n,o=this.target,h=o.a,l=o.b,u=o.c,c=o.d,f=h*c-l*u>0?I.degRad:-I.degRad,d=this.data.offsetRotation*f,v=this.data.offsetShearY*f,m=this.bones,p=0,g=m.length;pI.PI?E-=I.PI2:E<-I.PI&&(E+=I.PI2),E*=t;var A=Math.cos(E),S=Math.sin(E);y.a=A*w-S*b,y.b=A*k-S*x,y.c=S*w+A*b,y.d=S*k+A*x}if(s){var T=this.temp;o.localToWorld(T.set(this.data.offsetX,this.data.offsetY)),y.worldX+=T.x*e,y.worldY+=T.y*n}if(0!=r){var R=(Math.sqrt(h*h+u*u)-1+this.data.offsetScaleX)*r+1;y.a*=R,y.c*=R}if(0!=a){var C=(Math.sqrt(l*l+c*c)-1+this.data.offsetScaleY)*a+1;y.b*=C,y.d*=C}if(i>0){var M=Math.atan2(c,l)-Math.atan2(u,h);M>I.PI?M-=I.PI2:M<-I.PI&&(M+=I.PI2);var F=y.b,Y=y.d;M=Math.atan2(Y,F)+(M-I.PI/2+v)*i;var L=Math.sqrt(F*F+Y*Y);y.b=Math.cos(M)*L,y.d=Math.sin(M)*L}y.updateAppliedTransform()}}},{key:"applyAbsoluteLocal",value:function(){for(var t=this.mixRotate,e=this.mixX,n=this.mixY,r=this.mixScaleX,a=this.mixScaleY,i=this.mixShearY,s=this.target,o=this.bones,h=0,l=o.length;h2&&void 0!==arguments[2]?arguments[2]:new Array(2);if(!t)throw new Error("offset cannot be null.");if(!e)throw new Error("size cannot be null.");for(var r=this.drawOrder,a=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=0,l=r.length;h0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;i(this,t),this.slotIndex=e,this.name=n,this.attachment=r})),Le=function(){function t(e){if(i(this,t),this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!e)throw new Error("name cannot be null.");this.name=e}return o(t,[{key:"setAttachment",value:function(t,e,n){if(!n)throw new Error("attachment cannot be null.");var r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=n}},{key:"addSkin",value:function(t){for(var e=0;e= 0.");if(!n)throw new Error("name cannot be null.");if(!r)throw new Error("boneData cannot be null.");this.index=e,this.name=n,this.boneData=r}));!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(Me||(Me={}));var Ne,Pe=function(t){l(n,t);var e=d(n);function n(t){var r;return i(this,n),(r=e.call(this,t,0,!1)).bones=new Array,r._target=null,r.mixRotate=0,r.mixX=0,r.mixY=0,r.mixScaleX=0,r.mixScaleY=0,r.mixShearY=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 o(n,[{key:"target",get:function(){if(this._target)return this._target;throw new Error("BoneData not set.")},set:function(t){this._target=t}}]),n}(ye),_e=function(){function t(e){i(this,t),this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=e}return o(t,[{key:"readSkeletonData",value:function(t){var e=this.scale,n=new Fe;n.name="";var r=new Oe(t),a=r.readInt32(),i=r.readInt32();n.hash=0==i&&0==a?null:i.toString(16)+a.toString(16),n.version=r.readString(),n.x=r.readFloat(),n.y=r.readFloat(),n.width=r.readFloat(),n.height=r.readFloat();var s=r.readBoolean();s&&(n.fps=r.readFloat(),n.imagesPath=r.readString(),n.audioPath=r.readString());var o=0;o=r.readInt(!0);for(var h=0;h>4,t.readFloat())}r.push(br)}}var Ar=t.readInt(!0);if(Ar>0){for(var Sr=new Mt(Ar),Tr=n.slots.length,Rr=0;Rr=0;Yr--)Fr[Yr]=-1;for(var Lr=R.newArray(Tr-Mr,0),Xr=0,Nr=0,Pr=0;Pr=0;Or--)-1==Fr[Or]&&(Fr[Or]=Lr[--Nr]);Sr.setFrame(Rr,Cr,Fr)}r.push(Sr)}var Br=t.readInt(!0);if(Br>0){for(var Dr=new Ct(Br),Vr=0;Vr1&&void 0!==arguments[1]?arguments[1]:new Array,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new DataView(e.buffer);i(this,t),this.strings=n,this.index=r,this.buffer=a}return o(t,[{key:"readByte",value:function(){return this.buffer.getInt8(this.index++)}},{key:"readUnsignedByte",value:function(){return this.buffer.getUint8(this.index++)}},{key:"readShort",value:function(){var t=this.buffer.getInt16(this.index);return this.index+=2,t}},{key:"readInt32",value:function(){var t=this.buffer.getInt32(this.index);return this.index+=4,t}},{key:"readInt",value:function(t){var e=this.readByte(),n=127&e;return 0!=(128&e)&&(n|=(127&(e=this.readByte()))<<7,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<14,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<21,0!=(128&e)&&(n|=(127&(e=this.readByte()))<<28)))),t?n:n>>>1^-(1&n)}},{key:"readStringRef",value:function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]}},{key:"readString",value:function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",n=0;n>4){case 12:case 13:e+=String.fromCharCode((31&r)<<6|63&this.readByte()),n+=2;break;case 14:e+=String.fromCharCode((15&r)<<12|(63&this.readByte())<<6|63&this.readByte()),n+=3;break;default:e+=String.fromCharCode(r),n++}}return e}},{key:"readFloat",value:function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t}},{key:"readBoolean",value:function(){return 0!=this.readByte()}}]),t}(),Be=o((function t(e,n,r,a,s){i(this,t),this.mesh=e,this.skin=n,this.slotIndex=r,this.parent=a,this.inheritTimeline=s})),De=o((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;i(this,t),this.bones=e,this.vertices=n}));function Ve(t,e,n){for(var r=t.readFloat(),a=t.readFloat()*n,i=0,s=0,o=e.getFrameCount()-1;e.setFrame(i,r,a),i!=o;i++){var h=t.readFloat(),l=t.readFloat()*n;switch(t.readByte()){case dn:e.setStepped(i);break;case vn:qe(t,e,s++,i,0,r,h,a,l,n)}r=h,a=l}return e}function Ue(t,e,n){for(var r=t.readFloat(),a=t.readFloat()*n,i=t.readFloat()*n,s=0,o=0,h=e.getFrameCount()-1;e.setFrame(s,r,a,i),s!=h;s++){var l=t.readFloat(),u=t.readFloat()*n,c=t.readFloat()*n;switch(t.readByte()){case dn:e.setStepped(s);break;case vn:qe(t,e,o++,s,0,r,l,a,u,n),qe(t,e,o++,s,1,r,l,i,c,n)}r=l,a=u,i=c}return e}function qe(t,e,n,r,a,i,s,o,h,l){e.setBezier(n,r,a,i,o,t.readFloat(),t.readFloat()*l,t.readFloat(),t.readFloat()*l,s,h)}!function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(Ne||(Ne={}));var We,je=0,Ge=1,ze=2,He=3,$e=4,Je=5,Ke=6,Qe=7,Ze=8,tn=9,en=0,nn=1,rn=2,an=3,sn=4,on=5,hn=0,ln=1,un=0,cn=1,fn=2,dn=1,vn=2,mn=function(){function t(){i(this,t),this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new M((function(){return R.newFloatArray(16)}))}return o(t,[{key:"update",value:function(t,e){if(!t)throw new Error("skeleton cannot be null.");var n=this.boundingBoxes,r=this.polygons,a=this.polygonPool,i=t.slots,s=i.length;n.length=0,a.freeAll(r),r.length=0;for(var o=0;o=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY}},{key:"aabbIntersectsSegment",value:function(t,e,n,r){var a=this.minX,i=this.minY,s=this.maxX,o=this.maxY;if(t<=a&&n<=a||e<=i&&r<=i||t>=s&&n>=s||e>=o&&r>=o)return!1;var h=(r-e)/(n-t),l=h*(a-t)+e;if(l>i&&li&&la&&ua&&ut.minX&&this.minYt.minY}},{key:"containsPoint",value:function(t,e){for(var n=this.polygons,r=0,a=n.length;r=n||l=n){var u=r[o];u+(n-h)/(l-h)*(r[i]-u)=u&&w<=d||w>=d&&w<=u)&&(w>=e&&w<=r||w>=r&&w<=e)){var k=(l*g-h*m)/y;if((k>=c&&k<=v||k>=v&&k<=c)&&(k>=n&&k<=a||k>=a&&k<=n))return!0}u=d,c=v}return!1}},{key:"getPolygon",value:function(t){if(!t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]}},{key:"getWidth",value:function(){return this.maxX-this.minX}},{key:"getHeight",value:function(){return this.maxY-this.minY}}]),t}(),pn=function(){function t(){i(this,t),this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new M((function(){return new Array})),this.polygonIndicesPool=new M((function(){return new Array}))}return o(t,[{key:"triangulate",value:function(e){var n=e,r=e.length>>1,a=this.indicesArray;a.length=0;for(var i=0;i3;){for(var u=r-1,c=0,f=1;;){t:if(!s[c]){for(var d=a[u]<<1,v=a[c]<<1,m=a[f]<<1,p=n[d],g=n[d+1],y=n[v],w=n[v+1],k=n[m],b=n[m+1],x=(f+1)%r;x!=u;x=(x+1)%r)if(s[x]){var E=a[x]<<1,I=n[E],A=n[E+1];if(t.positiveArea(k,b,p,g,I,A)&&t.positiveArea(p,g,y,w,I,A)&&t.positiveArea(y,w,k,b,I,A))break t}break}if(0==f){do{if(!s[c])break;c--}while(c>0);break}u=c,c=f,f=(f+1)%r}l.push(a[(r+c-1)%r]),l.push(a[c]),l.push(a[(c+1)%r]),a.splice(c,1),s.splice(c,1);var S=(--r+c-1)%r,T=c==r?0:c;s[S]=t.isConcave(S,r,n,a),s[T]=t.isConcave(T,r,n,a)}return 3==r&&(l.push(a[2]),l.push(a[0]),l.push(a[1])),l}},{key:"decompose",value:function(e,n){var r=e,a=this.convexPolygons;this.polygonPool.freeAll(a),a.length=0;var i=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(i),i.length=0;var s=this.polygonIndicesPool.obtain();s.length=0;var o=this.polygonPool.obtain();o.length=0;for(var h=-1,l=0,u=0,c=n.length;u0?(a.push(o),i.push(s)):(this.polygonPool.free(o),this.polygonIndicesPool.free(s)),(o=this.polygonPool.obtain()).length=0,o.push(m),o.push(p),o.push(g),o.push(y),o.push(w),o.push(k),(s=this.polygonIndicesPool.obtain()).length=0,s.push(f),s.push(d),s.push(v),l=t.winding(m,p,g,y,w,k),h=f)}o.length>0&&(a.push(o),i.push(s));for(var A=0,S=a.length;A=0;$--)0==(o=a[$]).length&&(a.splice($,1),this.polygonPool.free(o),s=i[$],i.splice($,1),this.polygonIndicesPool.free(s));return a}}],[{key:"isConcave",value:function(t,e,n,r){var a=r[(e+t-1)%e]<<1,i=r[t]<<1,s=r[(t+1)%e]<<1;return!this.positiveArea(n[a],n[a+1],n[i],n[i+1],n[s],n[s+1])}},{key:"positiveArea",value:function(t,e,n,r,a,i){return t*(i-r)+n*(e-i)+a*(r-e)>=0}},{key:"winding",value:function(t,e,n,r,a,i){var s=n-t,o=r-e;return a*o-i*s+s*e-t*o>=0?1:-1}}]),t}(),gn=function(){function t(){i(this,t),this.triangulator=new pn,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array,this.clipAttachment=null,this.clippingPolygons=null}return o(t,[{key:"clipStart",value:function(e,n){if(this.clipAttachment)return 0;this.clipAttachment=n;var r=n.worldVerticesLength,a=R.setArraySize(this.clippingPolygon,r);n.computeWorldVertices(e,0,r,a,0,2);var i=this.clippingPolygon;t.makeClockwise(i);for(var s=this.clippingPolygons=this.triangulator.decompose(i,this.triangulator.triangulate(i)),o=0,h=s.length;o>1,V=this.clipOutput,U=R.setArraySize(l,F+D*d),q=0;q=2?(h=o,o=this.scratch):h=this.scratch,h.length=0,h.push(t),h.push(e),h.push(n),h.push(r),h.push(a),h.push(i),h.push(t),h.push(e),o.length=0;for(var c=s,f=s.length-4,d=0;;d+=2){for(var v=c[d],m=c[d+1],p=c[d+2],g=c[d+3],y=v-p,w=m-g,k=h,b=h.length-2,x=o.length,E=0;E0;if(y*(A-g)-w*(I-p)>0){if(R){o.push(S),o.push(T);continue}var C=T-A,M=S-I,F=C*(p-v)-M*(g-m);if(Math.abs(F)>1e-6){var Y=(M*(m-A)-C*(v-I))/F;o.push(v+(p-v)*Y),o.push(m+(g-m)*Y)}else o.push(v),o.push(m)}else if(R){var L=T-A,X=S-I,N=L*(p-v)-X*(g-m);if(Math.abs(N)>1e-6){var P=(X*(m-A)-L*(v-I))/N;o.push(v+(p-v)*P),o.push(m+(g-m)*P)}else o.push(v),o.push(m);o.push(S),o.push(T)}u=!0}if(x==o.length)return l.length=0,!0;if(o.push(o[0]),o.push(o[1]),d==f)break;var _=o;(o=h).length=0,h=_}if(l!=o){l.length=0;for(var O=0,B=o.length-2;O>1;l=0;lr--)-1==tr[lr]&&(tr[lr]=nr[--ar])}$n.setFrame(Kn,En(Zn,"time",0),tr)}a.push($n)}if(t.events){for(var ur=new Ct(t.events.length),cr=0,fr=0;fr)?=?)"),d("XRANGEIDENTIFIERLOOSE","".concat(h[l.NUMERICIDENTIFIERLOOSE],"|x|X|\\*")),d("XRANGEIDENTIFIER","".concat(h[l.NUMERICIDENTIFIER],"|x|X|\\*")),d("XRANGEPLAIN","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIER],")")+"(?:".concat(h[l.PRERELEASE],")?").concat(h[l.BUILD],"?")+")?)?"),d("XRANGEPLAINLOOSE","[v=\\s]*(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(h[l.XRANGEIDENTIFIERLOOSE],")")+"(?:".concat(h[l.PRERELEASELOOSE],")?").concat(h[l.BUILD],"?")+")?)?"),d("XRANGE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAIN],"$")),d("XRANGELOOSE","^".concat(h[l.GTLT],"\\s*").concat(h[l.XRANGEPLAINLOOSE],"$")),d("COERCE","".concat("(^|[^\\d])(\\d{1,").concat(n,"})")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:$|[^\\d])"),d("COERCERTL",h[l.COERCE],!0),d("LONETILDE","(?:~>?)"),d("TILDETRIM","(\\s*)".concat(h[l.LONETILDE],"\\s+"),!0),e.tildeTrimReplace="$1~",d("TILDE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAIN],"$")),d("TILDELOOSE","^".concat(h[l.LONETILDE]).concat(h[l.XRANGEPLAINLOOSE],"$")),d("LONECARET","(?:\\^)"),d("CARETTRIM","(\\s*)".concat(h[l.LONECARET],"\\s+"),!0),e.caretTrimReplace="$1^",d("CARET","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAIN],"$")),d("CARETLOOSE","^".concat(h[l.LONECARET]).concat(h[l.XRANGEPLAINLOOSE],"$")),d("COMPARATORLOOSE","^".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],")$|^$")),d("COMPARATOR","^".concat(h[l.GTLT],"\\s*(").concat(h[l.FULLPLAIN],")$|^$")),d("COMPARATORTRIM","(\\s*)".concat(h[l.GTLT],"\\s*(").concat(h[l.LOOSEPLAIN],"|").concat(h[l.XRANGEPLAIN],")"),!0),e.comparatorTrimReplace="$1$2$3",d("HYPHENRANGE","^\\s*(".concat(h[l.XRANGEPLAIN],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAIN],")")+"\\s*$"),d("HYPHENRANGELOOSE","^\\s*(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s+-\\s+"+"(".concat(h[l.XRANGEPLAINLOOSE],")")+"\\s*$"),d("STAR","(<|>)?=?\\s*\\*"),d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),d("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Ln,Ln.exports);var Xn=Ln.exports;Rn(Xn);var Nn=Object.freeze({loose:!0}),Pn=Object.freeze({}),_n=function(t){return t?"object"!==a(t)?Nn:t:Pn};Rn(_n);var On=/^[0-9]+$/,Bn=function(t,e){var n=On.test(t),r=On.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:tUn)throw new TypeError("version is longer than ".concat(Un," characters"));Vn("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;var r=e.trim().match(n.loose?Wn[jn.LOOSE]:Wn[jn.FULL]);if(!r)throw new TypeError("Invalid Version: ".concat(e));if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>qn||this.major<0)throw new TypeError("Invalid major version");if(this.minor>qn||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>qn||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e=0;)"number"==typeof this.prerelease[a]&&(this.prerelease[a]++,a=-2);if(-1===a){if(e===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(r)}}if(e){var i=[e,r];!1===n&&(i=[e]),0===zn(this.prerelease[0],e)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break;default:throw new Error("invalid increment argument: ".concat(t))}return this.raw=this.format(),this.build.length&&(this.raw+="+".concat(this.build.join("."))),this}}]),t}(),$n=Hn;Rn($n);var Jn=$n,Kn=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t instanceof Jn)return t;try{return new Jn(t,e)}catch(t){if(!n)return null;throw t}};Rn(Kn);var Qn,Zn,tr=Kn,er=Rn((function(t,e){var n=tr(t,e);return n?n.version:null})),nr=$n,rr=Kn,ar=Xn.safeRe,ir=Xn.t,sr=Rn((function(t,e){if(t instanceof nr)return t;if("number"==typeof t&&(t=String(t)),"string"!=typeof t)return null;var n=null;if((e=e||{}).rtl){for(var r;(r=ar[ir.COERCERTL].exec(t))&&(!n||n.index+n[0].length!==t.length);)n&&r.index+r[0].length===n.index+n[0].length||(n=r),ar[ir.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;ar[ir.COERCERTL].lastIndex=-1}else n=t.match(ar[ir.COERCE]);return null===n?null:rr("".concat(n[2],".").concat(n[3]||"0",".").concat(n[4]||"0"),e)}));var or=hr;function hr(t){var e=this;if(e instanceof hr||(e=new hr),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var n=0,r=arguments.length;n1)n=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var a=0;null!==r;a++)n=t(n,r.value,a),r=r.next;return n},hr.prototype.reduceReverse=function(t,e){var n,r=this.tail;if(arguments.length>1)n=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var a=this.length-1;null!==r;a--)n=t(n,r.value,a),r=r.prev;return n},hr.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;null!==n;e++)t[e]=n.value,n=n.next;return t},hr.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;null!==n;e++)t[e]=n.value,n=n.prev;return t},hr.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var n=new hr;if(ethis.length&&(e=this.length);for(var r=0,a=this.head;null!==a&&rthis.length&&(e=this.length);for(var r=this.length,a=this.tail;null!==a&&r>e;r--)a=a.prev;for(;null!==a&&r>t;r--,a=a.prev)n.push(a.value);return n},hr.prototype.splice=function(t,e){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,r=this.head;null!==r&&nthis[vr])return Cr(this,this[xr].get(t)),!1;var i=this[xr].get(t).value;return this[wr]&&(this[kr]||this[wr](t,i.value)),i.now=r,i.maxAge=n,i.value=e,this[mr]+=a-i.length,i.length=a,this.get(t),Rr(this),!0}var s=new Mr(t,e,a,r,n);return s.length>this[vr]?(this[wr]&&this[wr](t,e),!1):(this[mr]+=s.length,this[br].unshift(s),this[xr].set(t,this[br].head),Rr(this),!0)}},{key:"has",value:function(t){if(!this[xr].has(t))return!1;var e=this[xr].get(t).value;return!Tr(this,e)}},{key:"get",value:function(t){return Sr(this,t,!0)}},{key:"peek",value:function(t){return Sr(this,t,!1)}},{key:"pop",value:function(){var t=this[br].tail;return t?(Cr(this,t),t.value):null}},{key:"del",value:function(t){Cr(this,this[xr].get(t))}},{key:"load",value:function(t){this.reset();for(var e=Date.now(),n=t.length-1;n>=0;n--){var r=t[n],a=r.e||0;if(0===a)this.set(r.k,r.v);else{var i=a-e;i>0&&this.set(r.k,r.v,i)}}}},{key:"prune",value:function(){var t=this;this[xr].forEach((function(e,n){return Sr(t,n,!1)}))}}]),t}(),Sr=function(t,e,n){var r=t[xr].get(e);if(r){var a=r.value;if(Tr(t,a)){if(Cr(t,r),!t[gr])return}else n&&(t[Er]&&(r.value.now=Date.now()),t[br].unshiftNode(r));return a.value}},Tr=function(t,e){if(!e||!e.maxAge&&!t[yr])return!1;var n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[yr]&&n>t[yr]},Rr=function(t){if(t[mr]>t[vr])for(var e=t[br].tail;t[mr]>t[vr]&&null!==e;){var n=e.prev;Cr(t,e),e=n}},Cr=function(t,e){if(e){var n=e.value;t[wr]&&t[wr](n.key,n.value),t[mr]-=n.length,t[xr].delete(n.key),t[br].removeNode(e)}},Mr=o((function t(e,n,r,a,s){i(this,t),this.key=e,this.value=n,this.length=r,this.now=a,this.maxAge=s||0})),Fr=function(t,e,n,r){var a=n.value;Tr(t,a)&&(Cr(t,n),t[gr]||(a=void 0)),a&&e.call(r,a.value,a.key,t)},Yr=Ar;Rn(Yr);var Lr=$n,Xr=function(t,e,n){return new Lr(t,n).compare(new Lr(e,n))};Rn(Xr);var Nr=Xr,Pr=function(t,e,n){return 0===Nr(t,e,n)};Rn(Pr);var _r=Xr,Or=function(t,e,n){return 0!==_r(t,e,n)};Rn(Or);var Br=Xr,Dr=function(t,e,n){return Br(t,e,n)>0};Rn(Dr);var Vr=Xr,Ur=function(t,e,n){return Vr(t,e,n)>=0};Rn(Ur);var qr=Xr,Wr=function(t,e,n){return qr(t,e,n)<0};Rn(Wr);var jr=Xr,Gr=function(t,e,n){return jr(t,e,n)<=0};Rn(Gr);var zr,Hr,$r,Jr,Kr=Pr,Qr=Or,Zr=Dr,ta=Ur,ea=Wr,na=Gr,ra=function(t,e,n,r){switch(e){case"===":return"object"===a(t)&&(t=t.version),"object"===a(n)&&(n=n.version),t===n;case"!==":return"object"===a(t)&&(t=t.version),"object"===a(n)&&(n=n.version),t!==n;case"":case"=":case"==":return Kr(t,n,r);case"!=":return Qr(t,n,r);case">":return Zr(t,n,r);case">=":return ta(t,n,r);case"<":return ea(t,n,r);case"<=":return na(t,n,r);default:throw new TypeError("Invalid operator: ".concat(e))}};function aa(){if(Jr)return $r;Jr=1;var t=function(){function t(e,a){var s=this;if(i(this,t),a=n(a),e instanceof t)return e.loose===!!a.loose&&e.includePrerelease===!!a.includePrerelease?e:new t(e.raw,a);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=a,this.loose=!!a.loose,this.includePrerelease=!!a.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((function(t){return s.parseRange(t.trim())})).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: ".concat(this.raw));if(this.set.length>1){var o=this.set[0];if(this.set=this.set.filter((function(t){return!m(t[0])})),0===this.set.length)this.set=[o];else if(this.set.length>1){var h,l=w(this.set);try{for(l.s();!(h=l.n()).done;){var u=h.value;if(1===u.length&&g(u[0])){this.set=[u];break}}}catch(t){l.e(t)}finally{l.f()}}}this.format()}return o(t,[{key:"format",value:function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range}},{key:"toString",value:function(){return this.range}},{key:"parseRange",value:function(t){var n=this,i=((this.options.includePrerelease&&d)|(this.options.loose&&v))+":"+t,s=e.get(i);if(s)return s;var o=this.options.loose,g=o?h[l.HYPHENRANGELOOSE]:h[l.HYPHENRANGE];t=t.replace(g,M(this.options.includePrerelease)),a("hyphen replace",t),t=t.replace(h[l.COMPARATORTRIM],u),a("comparator trim",t),t=t.replace(h[l.TILDETRIM],c),a("tilde trim",t),t=t.replace(h[l.CARETTRIM],f),a("caret trim",t);var y=t.split(" ").map((function(t){return k(t,n.options)})).join(" ").split(/\s+/).map((function(t){return C(t,n.options)}));o&&(y=y.filter((function(t){return a("loose invalid filter",t,n.options),!!t.match(h[l.COMPARATORLOOSE])}))),a("range list",y);var b,x=new Map,E=y.map((function(t){return new r(t,n.options)})),I=w(E);try{for(I.s();!(b=I.n()).done;){var A=b.value;if(m(A))return[A];x.set(A.value,A)}}catch(t){I.e(t)}finally{I.f()}x.size>1&&x.has("")&&x.delete("");var S=p(x.values());return e.set(i,S),S}},{key:"intersects",value:function(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((function(t){return y(t,n)&&e.set.some((function(e){return y(e,n)&&t.every((function(t){return e.every((function(e){return t.intersects(e,n)}))}))}))}))}},{key:"test",value:function(t){if(!t)return!1;if("string"==typeof t)try{t=new s(t,this.options)}catch(t){return!1}for(var e=0;e")||!t.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!t.operator.startsWith("<"))&&(this.semver.version!==t.semver.version||!this.operator.includes("=")||!t.operator.includes("="))&&!(s(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<"))&&!(s(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}}],[{key:"ANY",get:function(){return t}}]),e}();zr=e;var n=_n,r=Xn.safeRe,a=Xn.t,s=ra,h=Yn,l=$n,u=aa();return zr}(),a=Yn,s=$n,h=Xn.safeRe,l=Xn.t,u=Xn.comparatorTrimReplace,c=Xn.tildeTrimReplace,f=Xn.caretTrimReplace,d=Cn.FLAG_INCLUDE_PRERELEASE,v=Cn.FLAG_LOOSE,m=function(t){return"<0.0.0-0"===t.value},g=function(t){return""===t.value},y=function(t,e){for(var n=!0,r=t.slice(),a=r.pop();n&&r.length;)n=r.every((function(t){return a.intersects(t,e)})),a=r.pop();return n},k=function(t,e){return a("comp",t,e),t=I(t,e),a("caret",t),t=x(t,e),a("tildes",t),t=S(t,e),a("xrange",t),t=R(t,e),a("stars",t),t},b=function(t){return!t||"x"===t.toLowerCase()||"*"===t},x=function(t,e){return t.trim().split(/\s+/).map((function(t){return E(t,e)})).join(" ")},E=function(t,e){var n=e.loose?h[l.TILDELOOSE]:h[l.TILDE];return t.replace(n,(function(e,n,r,i,s){var o;return a("tilde",t,e,n,r,i,s),b(n)?o="":b(r)?o=">=".concat(n,".0.0 <").concat(+n+1,".0.0-0"):b(i)?o=">=".concat(n,".").concat(r,".0 <").concat(n,".").concat(+r+1,".0-0"):s?(a("replaceTilde pr",s),o=">=".concat(n,".").concat(r,".").concat(i,"-").concat(s," <").concat(n,".").concat(+r+1,".0-0")):o=">=".concat(n,".").concat(r,".").concat(i," <").concat(n,".").concat(+r+1,".0-0"),a("tilde return",o),o}))},I=function(t,e){return t.trim().split(/\s+/).map((function(t){return A(t,e)})).join(" ")},A=function(t,e){a("caret",t,e);var n=e.loose?h[l.CARETLOOSE]:h[l.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(function(e,n,i,s,o){var h;return a("caret",t,e,n,i,s,o),b(n)?h="":b(i)?h=">=".concat(n,".0.0").concat(r," <").concat(+n+1,".0.0-0"):b(s)?h="0"===n?">=".concat(n,".").concat(i,".0").concat(r," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".0").concat(r," <").concat(+n+1,".0.0-0"):o?(a("replaceCaret pr",o),h="0"===n?"0"===i?">=".concat(n,".").concat(i,".").concat(s,"-").concat(o," <").concat(n,".").concat(i,".").concat(+s+1,"-0"):">=".concat(n,".").concat(i,".").concat(s,"-").concat(o," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".").concat(s,"-").concat(o," <").concat(+n+1,".0.0-0")):(a("no pr"),h="0"===n?"0"===i?">=".concat(n,".").concat(i,".").concat(s).concat(r," <").concat(n,".").concat(i,".").concat(+s+1,"-0"):">=".concat(n,".").concat(i,".").concat(s).concat(r," <").concat(n,".").concat(+i+1,".0-0"):">=".concat(n,".").concat(i,".").concat(s," <").concat(+n+1,".0.0-0")),a("caret return",h),h}))},S=function(t,e){return a("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return T(t,e)})).join(" ")},T=function(t,e){t=t.trim();var n=e.loose?h[l.XRANGELOOSE]:h[l.XRANGE];return t.replace(n,(function(n,r,i,s,o,h){a("xRange",t,n,r,i,s,o,h);var l=b(i),u=l||b(s),c=u||b(o),f=c;return"="===r&&f&&(r=""),h=e.includePrerelease?"-0":"",l?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&f?(u&&(s=0),o=0,">"===r?(r=">=",u?(i=+i+1,s=0,o=0):(s=+s+1,o=0)):"<="===r&&(r="<",u?i=+i+1:s=+s+1),"<"===r&&(h="-0"),n="".concat(r+i,".").concat(s,".").concat(o).concat(h)):u?n=">=".concat(i,".0.0").concat(h," <").concat(+i+1,".0.0-0"):c&&(n=">=".concat(i,".").concat(s,".0").concat(h," <").concat(i,".").concat(+s+1,".0-0")),a("xRange return",n),n}))},R=function(t,e){return a("replaceStars",t,e),t.trim().replace(h[l.STAR],"")},C=function(t,e){return a("replaceGTE0",t,e),t.trim().replace(h[e.includePrerelease?l.GTE0PRE:l.GTE0],"")},M=function(t){return function(e,n,r,a,i,s,o,h,l,u,c,f,d){return n=b(r)?"":b(a)?">=".concat(r,".0.0").concat(t?"-0":""):b(i)?">=".concat(r,".").concat(a,".0").concat(t?"-0":""):s?">=".concat(n):">=".concat(n).concat(t?"-0":""),h=b(l)?"":b(u)?"<".concat(+l+1,".0.0-0"):b(c)?"<".concat(l,".").concat(+u+1,".0-0"):f?"<=".concat(l,".").concat(u,".").concat(c,"-").concat(f):t?"<".concat(l,".").concat(u,".").concat(+c+1,"-0"):"<=".concat(h),"".concat(n," ").concat(h).trim()}},F=function(t,e,n){for(var i=0;i0){var o=t[s].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0};return $r}Rn(ra);var ia,sa,oa=aa(),ha=function(t,e,n){try{e=new oa(e,n)}catch(t){return!1}return e.test(t)},la={valid:er,coerce:sr,satisfies:Rn(ha),SEMVER_SPEC_VERSION:Mn.SEMVER_SPEC_VERSION},ua=0,ca=1,fa=2,da=[0,1,2,2,3,0],va=function(){function t(e,r,a,s){var o;if(i(this,t),h(this,"autoUpdate",!0),h(this,"skeleton",void 0),h(this,"states",void 0),this._app=e,this._position=new n.Vec3,1===re.length){var l,u=w((o=new re(r)).pages);try{for(u.s();!(l=u.n()).done;){var c=l.value;c.setTexture(new Tn(s[c.name]))}}catch(t){u.e(t)}finally{u.f()}}else o=new re(r,(function(t){return new Tn(s[t])}));var f=new yn(new fe(o));f.scale*=.01;var d=f.readSkeletonData(a);this.skeletonVersion=la.valid(la.coerce(d.version)),this._spine_3_6_0=la.satisfies(this.skeletonVersion,"<=3.6.0"),this._spine_3_7_99=la.satisfies(this.skeletonVersion,"<=3.7.99"),this._spine_4_0_X=la.satisfies(this.skeletonVersion,"~4.0.0"),this._spine_4_1_X=la.satisfies(this.skeletonVersion,"~4.1.23"),this.skeleton=new Ce(d),this.skeleton.updateWorldTransform(),this.stateData=new Kt(this.skeleton.data),this.states=[new _t(this.stateData)],this.clipper=new gn,this._node=new n.GraphNode,this._meshes=[],this._meshInstances=[],this._materials={},this._tint={},this._aabb=new n.BoundingBox,this._aabbTempArray=[],this._aabbTempOffset=new n.Vec2,this._aabbTempSize=new n.Vec2,this._renderCounts={vertexCount:0,indexCount:0},this._vertexFormat=null,this._vertexBuffer=null,this._indexBuffer=null,this._priority=0,this._timeScale=1,this._layers=[n.LAYERID_UI],this.init(),this._hidden=!1}return o(t,[{key:"destroy",value:function(){this.removeFromLayers();for(var t=0;t0&&this._renderCounts.vertexCount>0){this.skeleton.getBounds(this._aabbTempOffset,this._aabbTempSize,this._aabbTempArray),this._aabb.center=new n.Vec3(this._aabbTempOffset.x,this._aabbTempOffset.y,0),this._aabb.halfExtents=new n.Vec3(.5*this._aabbTempSize.x,.5*this._aabbTempSize.y,0),(!this._vertexBuffer||this._vertexBuffer.getNumVertices()0&&c.indices.length>0){t&&t!==c.material&&(this.SubmitBatch(e,r,t),t=c.material,e=s,r=0),t=c.material;var f=c.positions,d=c.vertexColor.r,v=c.vertexColor.g,m=c.vertexColor.b,p=c.vertexColor.a,g=c.uvs,y=void 0,w=f.length/2;for(y=0;y0){var a=new n.Mesh(this._app.graphicsDevice);a.vertexBuffer=this._vertexBuffer,a.indexBuffer[0]=this._indexBuffer,a.primitive[0].type=n.PRIMITIVE_TRIANGLES,a.primitive[0].base=t,a.primitive[0].count=e,a.primitive[0].indexed=!0,a.aabb=this._aabb,this._meshes.push(a);var i=new n.MeshInstance(a,this._materials[r],this._node);i.drawOrder=this.priority+this._meshInstances.length,i.visible=!this._hidden,this._meshInstances.push(i)}}},{key:"update",value:function(t){if(!this._hidden){var e;t*=this._timeScale;var n=this.states.length;for(e=0;e + + + + PlayCanvas Spine 4.0 - Owl + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/raptor40.html b/examples/raptor40.html new file mode 100644 index 0000000..37534dd --- /dev/null +++ b/examples/raptor40.html @@ -0,0 +1,83 @@ + + + + + PlayCanvas Spine 4.0 - Raptor + + + + + + + + + + + + + + + + diff --git a/package-lock.json b/package-lock.json index c82b28f..a640155 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "rollup": "^3.28.1", "semver": "^7.5.4", "serve": "^14.2.1", + "spine40": "npm:@esotericsoftware/spine-core@4.0", "spine41": "npm:@esotericsoftware/spine-core@4.1" } }, @@ -5343,6 +5344,13 @@ "integrity": "sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==", "dev": true }, + "node_modules/spine40": { + "name": "@esotericsoftware/spine-core", + "version": "4.0.28", + "resolved": "https://registry.npmjs.org/@esotericsoftware/spine-core/-/spine-core-4.0.28.tgz", + "integrity": "sha512-Gylet5qbhzxIgG3+ht1dJrObf6TozY1ZEBJqqTZG2NKaNb7gJNgwRNPAe27wD2Kmen39ITtWdXYHNeB1ocbNpw==", + "dev": true + }, "node_modules/spine41": { "name": "@esotericsoftware/spine-core", "version": "4.1.37", diff --git a/package.json b/package.json index 5c8557c..01f417a 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "rollup": "^3.28.1", "semver": "^7.5.4", "serve": "^14.2.1", + "spine40": "npm:@esotericsoftware/spine-core@4.0", "spine41": "npm:@esotericsoftware/spine-core@4.1" }, "scripts": { diff --git a/rollup.config.mjs b/rollup.config.mjs index f221c46..afaf6de 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -29,6 +29,10 @@ const builds = [ name: 'playcanvas-spine.3.8', lib: 'contrib/spine-ts/build/3.8/spine-core.js' }, + { + name: 'playcanvas-spine.4.0', + lib: 'src/wrapper40.js' + }, { name: 'playcanvas-spine.4.1', lib: 'src/wrapper41.js' diff --git a/src/component/Spine.js b/src/component/Spine.js index b1e0281..4b66c64 100644 --- a/src/component/Spine.js +++ b/src/component/Spine.js @@ -91,6 +91,7 @@ class Spine { ); this._spine_3_6_0 = semver.satisfies(this.skeletonVersion, '<=3.6.0'); // version 3.6.0 or below this._spine_3_7_99 = semver.satisfies(this.skeletonVersion, '<=3.7.99'); // version 3.7.99 or below + this._spine_4_0_X = semver.satisfies(this.skeletonVersion, '~4.0.0'); // version 4.0 family (4.0.31 - 4.0.79-beta) this._spine_4_1_X = semver.satisfies(this.skeletonVersion, '~4.1.23'); // version 4.1 family this.skeleton = new spine.Skeleton(_skeletonData); @@ -253,29 +254,38 @@ class Spine { slot._active.type = ATTACHMENT_TYPE.MESH; } + let texture = null; + + // search for texture property if it exists + if (attachment.region) { + if (attachment.region.texture) { + texture = attachment.region.texture.pcTexture; + } + if (attachment.region.page && attachment.region.page.texture) { + texture = attachment.region.page.texture.pcTexture; + } + } + // create / assign material - if (attachment.region && attachment.region.texture) { - const texture = attachment.region.texture.pcTexture; - if (texture) { - if (texture instanceof pc.StandardMaterial) { - this._materials[texture.name] = texture; - slot.material = texture.name; - } else { - // get a unique key for the texture - let key = null; - if (texture.name) { - key = texture.name; // texture name might not be unique - should be resolved with content - } else if (texture.getSource() instanceof Image) { - key = texture.getSource().getAttribute('src'); - } - if (key) { - // create a new material if required - if (this._materials[key] === undefined) { - const material = this.createMaterial(texture); - this._materials[key] = material; - } - slot.material = key; + if (texture) { + if (texture instanceof pc.StandardMaterial) { + this._materials[texture.name] = texture; + slot.material = texture.name; + } else { + // get a unique key for the texture + let key = null; + if (texture.name) { + key = texture.name; // texture name might not be unique - should be resolved with content + } else if (texture.getSource() instanceof Image) { + key = texture.getSource().getAttribute('src'); + } + if (key) { + // create a new material if required + if (this._materials[key] === undefined) { + const material = this.createMaterial(texture); + this._materials[key] = material; } + slot.material = key; } } } diff --git a/src/wrapper40.js b/src/wrapper40.js new file mode 100644 index 0000000..ecbce72 --- /dev/null +++ b/src/wrapper40.js @@ -0,0 +1,2 @@ +// spine 4.0 requires a wrapper to match import signature of other versions +export * as spine from "spine40";